Buttplug sex toy control library

wip: Add support for Sinloli Aston

The test passes, but I think the buffer compression might cause issues in the real world

authored by

blackspherefollower and committed by qdot.tngl.sh 2fd9e1e9 fe77f708

+127 -2
+35
crates/buttplug_server/src/device/protocol_impl/hismith_mini.rs
··· 21 21 use uuid::{Uuid, uuid}; 22 22 23 23 const HISMITH_MINI_PROTOCOL_UUID: Uuid = uuid!("94befc1a-9859-4bf6-99ee-5678c89237a7"); 24 + const HISMITH_MINI_ROTATE_DIRECTIOM_UUID: Uuid = uuid!("94befc1a-9859-4bf6-99ee-5678c89237a7"); 24 25 25 26 pub mod setup { 26 27 use crate::device::protocol::{ProtocolIdentifier, ProtocolIdentifierFactory}; ··· 171 172 &[feature_id], 172 173 Endpoint::Tx, 173 174 vec![0xCC, idx, speed, speed + idx], 175 + false, 176 + ) 177 + .into(), 178 + ]) 179 + } 180 + 181 + fn handle_output_rotate_cmd( 182 + &self, 183 + _feature_index: u32, 184 + feature_id: Uuid, 185 + speed: i32, 186 + ) -> Result<Vec<HardwareCommand>, ButtplugDeviceError> { 187 + Ok(vec![ 188 + HardwareWriteCmd::new( 189 + &[feature_id], 190 + Endpoint::Tx, 191 + vec![ 192 + 0xCC, 193 + 0x03, 194 + speed.unsigned_abs() as u8, 195 + speed.unsigned_abs() as u8 + 3, 196 + ], 197 + false, 198 + ) 199 + .into(), 200 + HardwareWriteCmd::new( 201 + &vec![HISMITH_MINI_ROTATE_DIRECTIOM_UUID], 202 + Endpoint::Tx, 203 + vec![ 204 + 0xCC, 205 + 0x01, 206 + if speed >= 0 { 0xc0 } else { 0xc1 }, 207 + if speed >= 0 { 0xc1 } else { 0xc2 }, 208 + ], 174 209 false, 175 210 ) 176 211 .into(),
+15 -1
crates/buttplug_server_device_config/build-config/buttplug-device-config-v4.json
··· 1 1 { 2 2 "version": { 3 3 "major": 4, 4 - "minor": 69 4 + "minor": 72 5 5 }, 6 6 "protocols": { 7 7 "activejoy": { ··· 4308 4308 "name": "Sinloli Ethel" 4309 4309 }, 4310 4310 { 4311 + "features": [ 4312 + { 4313 + "description": "Rotate", 4314 + "id": "e4fa9535-0f48-4401-a1e4-f13fbfb519a5", 4315 + "output": { 4316 + "rotate": { 4317 + "value": [ 4318 + -100, 4319 + 100 4320 + ] 4321 + } 4322 + } 4323 + } 4324 + ], 4311 4325 "id": "d9ced3ed-cc74-4731-baeb-7bbf7fda288e", 4312 4326 "identifier": [ 4313 4327 "2205"
+8
crates/buttplug_server_device_config/device-config-v4/protocols/hismith-mini.yml
··· 152 152 - identifier: 153 153 - '2205' 154 154 name: Sinloli Aston 155 + features: 156 + - description: Rotate 157 + id: e4fa9535-0f48-4401-a1e4-f13fbfb519a5 158 + output: 159 + rotate: 160 + value: 161 + - -100 162 + - 100 155 163 id: d9ced3ed-cc74-4731-baeb-7bbf7fda288e 156 164 communication: 157 165 - btle:
+1 -1
crates/buttplug_server_device_config/device-config-v4/version.yaml
··· 1 1 version: 2 2 major: 4 3 - minor: 69 3 + minor: 72
+4
crates/buttplug_tests/tests/test_device_protocols.rs
··· 40 40 #[test_case("test_hgod_protocol.yaml" ; "Hgod Protocol")] 41 41 #[test_case("test_hismith_auxfun_box.yaml" ; "Hismith Mini Protocol - Auxfun Box")] 42 42 #[test_case("test_hismith_sinloli.yaml" ; "Hismith Mini Protocol - Sinloli")] 43 + #[test_case("test_hismith_sinloli_aston.yaml" ; "Hismith Mini Protocol - Sinloli Aston")] 43 44 #[test_case("test_hismith_thrusting_cup.yaml" ; "Hismith Protocol - Thrusting Cup")] 44 45 #[test_case("test_hismith_v4.yaml" ; "Hismith Mini Protocol - Hismith v4")] 45 46 #[test_case("test_hismith_wildolo.yaml" ; "Hismith Protocol - Wildolo")] ··· 161 162 #[test_case("test_hgod_protocol.yaml" ; "Hgod Protocol")] 162 163 #[test_case("test_hismith_auxfun_box.yaml" ; "Hismith Mini Protocol - Auxfun Box")] 163 164 #[test_case("test_hismith_sinloli.yaml" ; "Hismith Mini Protocol - Sinloli")] 165 + #[test_case("test_hismith_sinloli_aston.yaml" ; "Hismith Mini Protocol - Sinloli Aston")] 164 166 #[test_case("test_hismith_thrusting_cup.yaml" ; "Hismith Protocol - Thrusting Cup")] 165 167 #[test_case("test_hismith_v4.yaml" ; "Hismith Mini Protocol - Hismith v4")] 166 168 #[test_case("test_hismith_wildolo.yaml" ; "Hismith Protocol - Wildolo")] ··· 281 283 #[test_case("test_hgod_protocol.yaml" ; "Hgod Protocol")] 282 284 #[test_case("test_hismith_auxfun_box.yaml" ; "Hismith Mini Protocol - Auxfun Box")] 283 285 #[test_case("test_hismith_sinloli.yaml" ; "Hismith Mini Protocol - Sinloli")] 286 + #[test_case("test_hismith_sinloli_aston.yaml" ; "Hismith Mini Protocol - Sinloli Aston")] 284 287 #[test_case("test_hismith_thrusting_cup.yaml" ; "Hismith Protocol - Thrusting Cup")] 285 288 #[test_case("test_hismith_v4.yaml" ; "Hismith Mini Protocol - Hismith v4")] 286 289 #[test_case("test_hismith_wildolo.yaml" ; "Hismith Protocol - Wildolo")] ··· 402 405 #[test_case("test_hgod_protocol.yaml" ; "Hgod Protocol")] 403 406 #[test_case("test_hismith_auxfun_box.yaml" ; "Hismith Mini Protocol - Auxfun Box")] 404 407 #[test_case("test_hismith_sinloli.yaml" ; "Hismith Mini Protocol - Sinloli")] 408 + #[test_case("test_hismith_sinloli_aston.yaml" ; "Hismith Mini Protocol - Sinloli Aston")] 405 409 #[test_case("test_hismith_thrusting_cup.yaml" ; "Hismith Protocol - Thrusting Cup")] 406 410 #[test_case("test_hismith_v4.yaml" ; "Hismith Mini Protocol - Hismith v4")] 407 411 #[test_case("test_hismith_wildolo.yaml" ; "Hismith Protocol - Wildolo")]
+64
crates/buttplug_tests/tests/util/device_test/device_test_case/test_hismith_sinloli_aston.yaml
··· 1 + devices: 2 + - identifier: 3 + name: "Sinloli Aston" 4 + expected_name: "Sinloli Aston" 5 + device_init: 6 + - !Events 7 + device_index: 0 8 + events: 9 + - !Reads 10 + - endpoint: rxblemodel 11 + data: [0x22, 0x05] 12 + device_commands: 13 + # Commands 14 + - !Messages 15 + device_index: 0 16 + messages: 17 + - !Rotate 18 + - Index: 0 19 + Speed: 0.5 20 + Clockwise: true 21 + - !Commands 22 + device_index: 0 23 + commands: 24 + - !Write 25 + endpoint: tx 26 + data: [0xCC, 0x03, 0x32, 0x35] 27 + write_with_response: false 28 + - !Write 29 + endpoint: tx 30 + data: [0xCC, 0x01, 0xc0, 0xc1] 31 + write_with_response: false 32 + - !Messages 33 + device_index: 0 34 + messages: 35 + - !Rotate 36 + - Index: 0 37 + Speed: 1 38 + Clockwise: false 39 + - !Commands 40 + device_index: 0 41 + commands: 42 + - !Write 43 + endpoint: tx 44 + data: [0xCC, 0x03, 0x64, 0x67] 45 + write_with_response: false 46 + - !Write 47 + endpoint: tx 48 + data: [0xCC, 0x01, 0xc1, 0xc2] 49 + write_with_response: false 50 + - !Messages 51 + device_index: 0 52 + messages: 53 + - !Stop 54 + - !Commands 55 + device_index: 0 56 + commands: 57 + - !Write 58 + endpoint: tx 59 + data: [0xCC, 0x03, 0x00, 0x03] 60 + write_with_response: false 61 + - !Write 62 + endpoint: tx 63 + data: [0xCC, 0x01, 0xc0, 0xc1] 64 + write_with_response: false