Buttplug sex toy control library
at master 53 lines 1.3 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, ProtocolKeepaliveStrategy, generic_protocol_setup}, 13}; 14use buttplug_core::errors::ButtplugDeviceError; 15use buttplug_server_device_config::Endpoint; 16 17generic_protocol_setup!(SvakomDice, "svakom-dice"); 18 19#[derive(Default)] 20pub struct SvakomDice {} 21 22impl ProtocolHandler for SvakomDice { 23 fn keepalive_strategy(&self) -> ProtocolKeepaliveStrategy { 24 ProtocolKeepaliveStrategy::HardwareRequiredRepeatLastPacketStrategy 25 } 26 27 fn handle_output_vibrate_cmd( 28 &self, 29 _feature_index: u32, 30 feature_id: Uuid, 31 speed: u32, 32 ) -> Result<Vec<HardwareCommand>, ButtplugDeviceError> { 33 Ok(vec![ 34 HardwareWriteCmd::new( 35 &[feature_id], 36 Endpoint::Tx, 37 [0x55, 0x04, 0x00, 0x00, 01, speed as u8, 0xaa].to_vec(), 38 false, 39 ) 40 .into(), 41 ]) 42 } 43} 44 45/* 46Start roll sensor: tx: 550e01 47Stop roll sensor: tx: 550e00 48 49Started roll: rx: 5508d01000000 50Settled roll: rx: 5508d00000000 51 52Battery: rx: 55080000001XX 0-100 53*/