diff --git a/crates/buttplug_server/src/device/protocol_impl/mod.rs b/crates/buttplug_server/src/device/protocol_impl/mod.rs index 4e3a275d1..872b3a3af 100644 --- a/crates/buttplug_server/src/device/protocol_impl/mod.rs +++ b/crates/buttplug_server/src/device/protocol_impl/mod.rs @@ -76,6 +76,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; @@ -381,6 +382,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 b4f915192..c4ca52c56 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 @@ -1,7 +1,7 @@ { "version": { "major": 4, - "minor": 95 + "minor": 96 }, "protocols": { "activejoy": { @@ -11872,7 +11872,7 @@ { "id": "5ae8bb6f-6280-4a8d-9e08-a3d5e5fb89a8", "output": { - "sscillate": { + "oscillate": { "value": [ 0, 255 @@ -14004,6 +14004,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/luvmazer.yml b/crates/buttplug_server_device_config/device-config-v4/protocols/luvmazer.yml index 0a60cb879..6581dc7d4 100644 --- a/crates/buttplug_server_device_config/device-config-v4/protocols/luvmazer.yml +++ b/crates/buttplug_server_device_config/device-config-v4/protocols/luvmazer.yml @@ -31,7 +31,7 @@ configurations: - 255 - id: 5ae8bb6f-6280-4a8d-9e08-a3d5e5fb89a8 output: - sscillate: + oscillate: value: - 0 - 255 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 000000000..ea7669a3e --- /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 diff --git a/crates/buttplug_server_device_config/device-config-v4/version.yaml b/crates/buttplug_server_device_config/device-config-v4/version.yaml index 37c4801fe..e8d3b38e0 100644 --- a/crates/buttplug_server_device_config/device-config-v4/version.yaml +++ b/crates/buttplug_server_device_config/device-config-v4/version.yaml @@ -1,3 +1,3 @@ version: major: 4 - minor: 95 + minor: 96