// Buttplug Rust Source Code File - See https://buttplug.io for more info. // // Copyright 2016-2024 Nonpolynomial Labs LLC. All rights reserved. // // Licensed under the BSD 3-Clause license. See LICENSE file in the project root // for full license information. use uuid::Uuid; use crate::device::{ hardware::{HardwareCommand, HardwareWriteCmd}, protocol::{ProtocolHandler, generic_protocol_setup}, }; use buttplug_core::errors::ButtplugDeviceError; use buttplug_server_device_config::Endpoint; generic_protocol_setup!(FleshyThrust, "fleshy-thrust"); #[derive(Default)] pub struct FleshyThrust {} impl ProtocolHandler for FleshyThrust { fn handle_position_with_duration_cmd( &self, _feature_index: u32, feature_id: Uuid, position: u32, duration: u32, ) -> Result, ButtplugDeviceError> { Ok(vec![ HardwareWriteCmd::new( &[feature_id], Endpoint::Tx, vec![ position as u8, ((duration & 0xff00) >> 8) as u8, (duration & 0xff) as u8, ], false, ) .into(), ]) } }