Skip to content
Open
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions crates/buttplug_server/src/device/protocol_impl/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -381,6 +382,7 @@ pub fn get_default_protocol_map() -> HashMap<String, Arc<dyn ProtocolIdentifierF
);
add_to_protocol_map(&mut map, nobra::setup::NobraIdentifierFactory::default());
add_to_protocol_map(&mut map, omobo::setup::OmoboIdentifierFactory::default());
add_to_protocol_map(&mut map, ossm::setup::OSSMIdentifierFactory::default());
add_to_protocol_map(&mut map, patoo::setup::PatooIdentifierFactory::default());
add_to_protocol_map(
&mut map,
Expand Down
81 changes: 81 additions & 0 deletions crates/buttplug_server/src/device/protocol_impl/ossm.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
// Buttplug Rust Source Code File - See https://buttplug.io for more info.
//
// Copyright 2016-2025 Nonpolynomial Labs LLC. All rights reserved.
//
// Licensed under the BSD 3-Clause license. See LICENSE file in the project root
// for full license information.


use crate::device::{
hardware::{Hardware, HardwareCommand, HardwareWriteCmd},
protocol::{
ProtocolHandler,
ProtocolIdentifier,
ProtocolInitializer,
generic_protocol_initializer_setup
},
};
use buttplug_core::errors::ButtplugDeviceError;
use buttplug_server_device_config::{
Endpoint,
ServerDeviceDefinition,
UserDeviceIdentifier,
ProtocolCommunicationSpecifier,
};
use std::sync::Arc;
use uuid::{Uuid, uuid};
use async_trait::async_trait;

const OSSM_PROTOCOL_UUID: Uuid = uuid!("a817e40d-acda-439d-bebf-420badbabe69");
generic_protocol_initializer_setup!(OSSM, "ossm");

#[derive(Default)]
pub struct OSSMInitializer {}

#[async_trait]
impl ProtocolInitializer for OSSMInitializer {
async fn initialize(
&mut self,
hardware: Arc<Hardware>,
_: &ServerDeviceDefinition,
) -> Result<Arc<dyn ProtocolHandler>, 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<Vec<HardwareCommand>, 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(),
])
}
}
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"version": {
"major": 4,
"minor": 95
"minor": 96
},
"protocols": {
"activejoy": {
Expand Down Expand Up @@ -11872,7 +11872,7 @@
{
"id": "5ae8bb6f-6280-4a8d-9e08-a3d5e5fb89a8",
"output": {
"sscillate": {
"oscillate": {
"value": [
0,
255
Expand Down Expand Up @@ -14004,6 +14004,40 @@
"name": "Omobo ViVegg Vibrator"
}
},
"ossm": {
"communication": [
{
"btle": {
"names": [
"OSSM"
],
"services": {
"522b443a-4f53-534d-0001-420badbabe69": {
"tx": "522b443a-4f53-534d-0002-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": [
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ configurations:
- 255
- id: 5ae8bb6f-6280-4a8d-9e08-a3d5e5fb89a8
output:
sscillate:
oscillate:
value:
- 0
- 255
Expand Down
Original file line number Diff line number Diff line change
@@ -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-0002-420badbabe69
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
version:
major: 4
minor: 95
minor: 96