Buttplug sex toy control library
at dev 82 lines 1.7 kB view raw
1// Buttplug Rust Source Code File - See https://buttplug.io for more info. 2// 3// Copyright 2016-2024 Nonpolynomial Labs LLC. All rights reserved. 4// 5// Licensed under the BSD 3-Clause license. See LICENSE file in the project root 6// for full license information. 7 8use uuid::Uuid; 9 10use crate::device::{ 11 hardware::{HardwareCommand, HardwareWriteCmd}, 12 protocol::{ProtocolHandler, generic_protocol_setup}, 13}; 14use buttplug_core::errors::ButtplugDeviceError; 15use buttplug_server_device_config::Endpoint; 16 17generic_protocol_setup!(Sakuraneko, "sakuraneko"); 18 19#[derive(Default)] 20pub struct Sakuraneko {} 21 22impl ProtocolHandler for Sakuraneko { 23 fn handle_output_vibrate_cmd( 24 &self, 25 _feature_index: u32, 26 feature_id: Uuid, 27 speed: u32, 28 ) -> Result<Vec<HardwareCommand>, ButtplugDeviceError> { 29 Ok(vec![ 30 HardwareWriteCmd::new( 31 &[feature_id], 32 Endpoint::Tx, 33 vec![ 34 0xa1, 35 0x08, 36 0x01, 37 0x00, 38 0x00, 39 0x00, 40 0x64, 41 speed as u8, 42 0x00, 43 0x64, 44 0xdf, 45 0x55, 46 ], 47 false, 48 ) 49 .into(), 50 ]) 51 } 52 53 fn handle_output_rotate_cmd( 54 &self, 55 _feature_index: u32, 56 feature_id: Uuid, 57 speed: i32, 58 ) -> Result<Vec<HardwareCommand>, ButtplugDeviceError> { 59 Ok(vec![ 60 HardwareWriteCmd::new( 61 &[feature_id], 62 Endpoint::Tx, 63 vec![ 64 0xa2, 65 0x08, 66 0x01, 67 0x00, 68 0x00, 69 0x00, 70 0x64, 71 speed as u8, 72 0x00, 73 0x32, 74 0xdf, 75 0x55, 76 ], 77 false, 78 ) 79 .into(), 80 ]) 81 } 82}