-
-
Notifications
You must be signed in to change notification settings - Fork 62
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Adding support for Foreo Luna Fofo
- Loading branch information
1 parent
929e0b8
commit 49aa2e1
Showing
6 changed files
with
121 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
// Buttplug Rust Source Code File - See https://buttplug.io for more info. | ||
// | ||
// Copyright 2016-2023 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::{ | ||
core::{errors::ButtplugDeviceError, message::Endpoint}, | ||
server::device::{ | ||
hardware::{HardwareCommand, HardwareWriteCmd}, | ||
protocol::{generic_protocol_setup, ProtocolHandler}, | ||
}, | ||
}; | ||
|
||
generic_protocol_setup!(Foreo, "foreo"); | ||
|
||
#[derive(Default)] | ||
pub struct Foreo {} | ||
|
||
impl ProtocolHandler for Foreo { | ||
fn handle_scalar_vibrate_cmd( | ||
&self, | ||
_: u32, | ||
scalar: u32, | ||
) -> Result<Vec<HardwareCommand>, ButtplugDeviceError> { | ||
Ok(vec![HardwareWriteCmd::new( | ||
Endpoint::Tx, | ||
vec![0x01, 0x01, scalar as u8], | ||
false, | ||
) | ||
.into()]) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
42 changes: 42 additions & 0 deletions
42
buttplug/tests/util/device_test/device_test_case/test_foreo_protocol.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
devices: | ||
- identifier: | ||
name: "FOFO" | ||
expected_name: "Foreo Luna Fofo" | ||
device_commands: | ||
- !Messages | ||
device_index: 0 | ||
messages: | ||
- !Vibrate | ||
- Index: 0 | ||
Speed: 0.5 | ||
- !Commands | ||
device_index: 0 | ||
commands: | ||
- !Write | ||
endpoint: tx | ||
data: [0x01, 0x01, 0x05] | ||
write_with_response: false | ||
- !Messages | ||
device_index: 0 | ||
messages: | ||
- !Vibrate | ||
- Index: 0 | ||
Speed: 0.75 | ||
- !Commands | ||
device_index: 0 | ||
commands: | ||
- !Write | ||
endpoint: tx | ||
data: [0x01, 0x01, 0x08] | ||
write_with_response: false | ||
- !Messages | ||
device_index: 0 | ||
messages: | ||
- !Stop | ||
- !Commands | ||
device_index: 0 | ||
commands: | ||
- !Write | ||
endpoint: tx | ||
data: [0x01, 0x01, 0x00] | ||
write_with_response: false |