Skip to content
Open
Show file tree
Hide file tree
Changes from all 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
5 changes: 5 additions & 0 deletions crates/buttplug_server/src/device/protocol_impl/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,7 @@ pub mod thehandy_v3;
pub mod tryfun;
pub mod tryfun_blackhole;
pub mod tryfun_meta2;
pub mod tryfun_rock;
pub mod vibcrafter;
pub mod vibratissimo;
pub mod vorze_sa;
Expand Down Expand Up @@ -531,6 +532,10 @@ pub fn get_default_protocol_map() -> HashMap<String, Arc<dyn ProtocolIdentifierF
add_to_protocol_map(
&mut map,
tryfun_meta2::setup::TryFunMeta2IdentifierFactory::default(),
);
add_to_protocol_map(
&mut map,
tryfun_rock::setup::TryFunRockIdentifierFactory::default(),
);
add_to_protocol_map(
&mut map,
Expand Down
53 changes: 53 additions & 0 deletions crates/buttplug_server/src/device/protocol_impl/tryfun_rock.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
// Buttplug Rust Source Code File - See https://buttplug.io for more info.
//
// Copyright 2016-2026 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 uuid::Uuid;

use buttplug_core::errors::ButtplugDeviceError;
use buttplug_server_device_config::Endpoint;

use crate::device::{
hardware::{HardwareCommand, HardwareWriteCmd},
protocol::{ProtocolHandler, generic_protocol_setup},
};
use std::sync::atomic::{AtomicU8, Ordering};

generic_protocol_setup!(TryFunRock, "tryfun-rock");

#[derive(Default)]
pub struct TryFunRock {
packet_id: AtomicU8,
}

impl ProtocolHandler for TryFunRock {
fn handle_output_vibrate_cmd(
&self,
_feature_index: u32,
feature_id: Uuid,
speed: u32,
) -> Result<Vec<HardwareCommand>, ButtplugDeviceError> {
let mut sum: u8 = 0xff;
let mut data = vec![
self.packet_id.fetch_add(1, Ordering::Relaxed),
0x02,
0x00,
0x03,
0x09,
speed as u8,
];
let mut count = 1;
for item in data.iter().skip(1) {
sum -= item;
count += 1;
}
sum += count;
data.push(sum);
Ok(vec![
HardwareWriteCmd::new(&[feature_id], Endpoint::Tx, data, false).into(),
])
}
}
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"version": {
"major": 4,
"minor": 179
"minor": 180
},
"protocols": {
"activejoy": {
Expand Down Expand Up @@ -21655,6 +21655,40 @@
"name": "TryFun Meta 2"
}
},
"tryfun-rock": {
"communication": [
{
"btle": {
"names": [
"TF-ROCK"
],
"services": {
"0000ffac-0000-1000-8000-00805f9b34fb": {
"tx": "0000ffb7-0000-1000-8000-00805f9b34fb"
}
}
}
}
],
"defaults": {
"features": [
{
"id": "e27b1f9c-8a34-4d12-b76e-9f8c2a5d176b",
"index": 0,
"output": {
"vibrate": {
"value": [
0,
50
]
}
}
}
],
"id": "d2e5f7a9-1b3c-4680-bf5d-7c9a2e4f6d8b",
"name": "TryFun Rock"
}
},
"twerkingbutt": {
"communication": [
{
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
---
defaults:
name: TryFun Rock
features:
- id: e27b1f9c-8a34-4d12-b76e-9f8c2a5d176b
output:
vibrate:
value:
- 0
- 50
index: 0
id: d2e5f7a9-1b3c-4680-bf5d-7c9a2e4f6d8b
communication:
- btle:
names:
- TF-ROCK
services:
0000ffac-0000-1000-8000-00805f9b34fb:
tx: 0000ffb7-0000-1000-8000-00805f9b34fb
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
version:
major: 4
minor: 179
minor: 180