forked from buttplugio/buttplug
-
Notifications
You must be signed in to change notification settings - Fork 0
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 Mizz Zee V2 models
Thanks to @Spazzwanjunk at their friend for doing the hard work on this one: buttplugio/stpihkal#136 (comment)
- Loading branch information
1 parent
c834542
commit 52e5adb
Showing
10 changed files
with
231 additions
and
51 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
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,43 @@ | ||
// Buttplug Rust Source Code File - See https://buttplug.io for more info. | ||
// | ||
// Copyright 2016-2022 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!(MizzZeeV2, "mizzzee-v2"); | ||
|
||
#[derive(Default)] | ||
pub struct MizzZeeV2 {} | ||
|
||
impl ProtocolHandler for MizzZeeV2 { | ||
fn handle_scalar_vibrate_cmd( | ||
&self, | ||
_index: u32, | ||
scalar: u32, | ||
) -> Result<Vec<HardwareCommand>, ButtplugDeviceError> { | ||
Ok(vec![HardwareWriteCmd::new( | ||
Endpoint::Tx, | ||
vec![ | ||
0x69, | ||
0x96, | ||
0x04, | ||
0x02, | ||
scalar as u8, | ||
0x2c, | ||
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
38 changes: 38 additions & 0 deletions
38
buttplug/tests/device_test_case/test_mizzzee_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,38 @@ | ||
devices: | ||
- identifier: | ||
name: "NFY008" | ||
address: null | ||
identifier: "Default" | ||
expected_name: "Mizz Zee Device" | ||
device_commands: | ||
# Commands | ||
- !Messages | ||
device_index: 0 | ||
messages: | ||
- !ScalarCmd | ||
Id: 1 | ||
DeviceIndex: 0 | ||
Scalars: | ||
- Index: 0 | ||
Scalar: 0.5 | ||
ActuatorType: Vibrate | ||
- !Commands | ||
device_index: 0 | ||
commands: | ||
- !Write | ||
endpoint: tx | ||
data: [0x69, 0x96, 0x03, 0x01, 0x01, 0x22] | ||
write_with_response: false | ||
- !Messages | ||
device_index: 0 | ||
messages: | ||
- !StopDeviceCmd | ||
Id: 1 | ||
DeviceIndex: 0 | ||
- !Commands | ||
device_index: 0 | ||
commands: | ||
- !Write | ||
endpoint: tx | ||
data: [0x69, 0x96, 0x03, 0x01, 0x00, 0x00] | ||
write_with_response: false |
38 changes: 38 additions & 0 deletions
38
buttplug/tests/device_test_case/test_mizzzee_v2_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,38 @@ | ||
devices: | ||
- identifier: | ||
name: "XHT" | ||
address: null | ||
identifier: "Default" | ||
expected_name: "Mizz Zee Device" | ||
device_commands: | ||
# Commands | ||
- !Messages | ||
device_index: 0 | ||
messages: | ||
- !ScalarCmd | ||
Id: 1 | ||
DeviceIndex: 0 | ||
Scalars: | ||
- Index: 0 | ||
Scalar: 0.5 | ||
ActuatorType: Vibrate | ||
- !Commands | ||
device_index: 0 | ||
commands: | ||
- !Write | ||
endpoint: tx | ||
data: [0x69, 0x96, 0x04, 0x02, 0x22, 0x2c, 0x22 ] | ||
write_with_response: false | ||
- !Messages | ||
device_index: 0 | ||
messages: | ||
- !StopDeviceCmd | ||
Id: 1 | ||
DeviceIndex: 0 | ||
- !Commands | ||
device_index: 0 | ||
commands: | ||
- !Write | ||
endpoint: tx | ||
data: [0x69, 0x96, 0x04, 0x02, 0x00, 0x2c, 0x00 ] | ||
write_with_response: false |
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
30 changes: 30 additions & 0 deletions
30
buttplug/tests/util/device_test/device_test_case/test_mizzzee_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,30 @@ | ||
devices: | ||
- identifier: | ||
name: "NFY008" | ||
expected_name: "Mizz Zee Device" | ||
device_commands: | ||
# Commands | ||
- !Messages | ||
device_index: 0 | ||
messages: | ||
- !Vibrate | ||
- Index: 0 | ||
Speed: 0.5 | ||
- !Commands | ||
device_index: 0 | ||
commands: | ||
- !Write | ||
endpoint: tx | ||
data: [105, 150, 3, 1, 1, 34] | ||
write_with_response: false | ||
- !Messages | ||
device_index: 0 | ||
messages: | ||
- !Stop | ||
- !Commands | ||
device_index: 0 | ||
commands: | ||
- !Write | ||
endpoint: tx | ||
data: [105, 150, 3, 1, 0, 0] | ||
write_with_response: false |
30 changes: 30 additions & 0 deletions
30
buttplug/tests/util/device_test/device_test_case/test_mizzzee_v2_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,30 @@ | ||
devices: | ||
- identifier: | ||
name: "XHT" | ||
expected_name: "Mizz Zee Device" | ||
device_commands: | ||
# Commands | ||
- !Messages | ||
device_index: 0 | ||
messages: | ||
- !Vibrate | ||
- Index: 0 | ||
Speed: 0.5 | ||
- !Commands | ||
device_index: 0 | ||
commands: | ||
- !Write | ||
endpoint: tx | ||
data: [105, 150, 4, 2, 34, 44, 34] | ||
write_with_response: false | ||
- !Messages | ||
device_index: 0 | ||
messages: | ||
- !Stop | ||
- !Commands | ||
device_index: 0 | ||
commands: | ||
- !Write | ||
endpoint: tx | ||
data: [105, 150, 4, 2, 0, 44, 0] | ||
write_with_response: false |