diff --git a/crates/buttplug_server/src/device/protocol_impl/mod.rs b/crates/buttplug_server/src/device/protocol_impl/mod.rs index 3b802a83..99c25aeb 100644 --- a/crates/buttplug_server/src/device/protocol_impl/mod.rs +++ b/crates/buttplug_server/src/device/protocol_impl/mod.rs @@ -84,6 +84,7 @@ pub mod nexus_revo; pub mod nintendo_joycon; pub mod nobra; pub mod omobo; +pub mod ossm; pub mod patoo; pub mod picobong; pub mod pink_punch; @@ -374,6 +375,7 @@ pub fn get_default_protocol_map() -> HashMap, + _: &ServerDeviceDefinition, + ) -> Result, ButtplugDeviceError> { + let msg = HardwareWriteCmd::new( + &[OSSM_PROTOCOL_UUID], + Endpoint::Tx, + format!("go:strokeEngine").into_bytes(), + false, + ); + hardware.write_value(&msg).await?; + Ok(Arc::new(OSSM::default())) + } +} + +#[derive(Default)] +pub struct OSSM {} + +impl ProtocolHandler for OSSM { + fn handle_output_oscillate_cmd( + &self, + feature_index: u32, + feature_id: Uuid, + value: u32, + ) -> Result, ButtplugDeviceError> { + let param = if feature_index == 0 { + "speed" + } else { + return Err(ButtplugDeviceError::DeviceFeatureMismatch( + format!("OSSM command received for unknown feature index: {}", feature_index), + )); + }; + + Ok(vec![ + HardwareWriteCmd::new( + &[feature_id], + Endpoint::Tx, + format!("set:{param}:{value}").into_bytes(), + false, + ) + .into(), + ]) + } +} diff --git a/crates/buttplug_server_device_config/build-config/buttplug-device-config-v4.json b/crates/buttplug_server_device_config/build-config/buttplug-device-config-v4.json index 0efb4802..bd0c13ca 100644 --- a/crates/buttplug_server_device_config/build-config/buttplug-device-config-v4.json +++ b/crates/buttplug_server_device_config/build-config/buttplug-device-config-v4.json @@ -15513,6 +15513,40 @@ "name": "Omobo ViVegg Vibrator" } }, + "ossm": { + "communication": [ + { + "btle": { + "names": [ + "OSSM" + ], + "services": { + "522b443a-4f53-534d-0001-420badbabe69": { + "tx": "522b443a-4f53-534d-1000-420badbabe69" + } + } + } + } + ], + "defaults": { + "features": [ + { + "description": "Stroke Speed", + "id": "6ff53ba2-a5c0-462e-b2d6-420badbabe69", + "output": { + "oscillate": { + "value": [ + 0, + 100 + ] + } + } + } + ], + "id": "6beebf46-3dfd-4e11-b0f9-420badbabe69", + "name": "OSSM" + } + }, "patoo": { "communication": [ { diff --git a/crates/buttplug_server_device_config/device-config-v4/protocols/ossm.yml b/crates/buttplug_server_device_config/device-config-v4/protocols/ossm.yml new file mode 100644 index 00000000..ea7669a3 --- /dev/null +++ b/crates/buttplug_server_device_config/device-config-v4/protocols/ossm.yml @@ -0,0 +1,18 @@ +defaults: + name: OSSM + features: + - description: Stroke Speed + id: 6ff53ba2-a5c0-462e-b2d6-420badbabe69 + output: + oscillate: + value: + - 0 + - 100 + id: 6beebf46-3dfd-4e11-b0f9-420badbabe69 +communication: + - btle: + names: + - OSSM + services: + 522b443a-4f53-534d-0001-420badbabe69: + tx: 522b443a-4f53-534d-1000-420badbabe69