-
-
Notifications
You must be signed in to change notification settings - Fork 65
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
19 changed files
with
2,192 additions
and
165 deletions.
There are no files selected for viewing
912 changes: 834 additions & 78 deletions
912
buttplug/buttplug-device-config/build-config/buttplug-device-config-v3.json
Large diffs are not rendered by default.
Oops, something went wrong.
505 changes: 469 additions & 36 deletions
505
buttplug/buttplug-device-config/device-config-v3/buttplug-device-config-v3.yml
Large diffs are not rendered by default.
Oops, something went wrong.
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,69 @@ | ||
// Buttplug Rust Source Code File - See https://buttplug.io for more info. | ||
// | ||
// Copyright 2016-2024 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::{ | ||
configuration::{UserDeviceDefinition, UserDeviceIdentifier}, | ||
hardware::{Hardware, HardwareCommand, HardwareWriteCmd}, | ||
protocol::{ | ||
generic_protocol_initializer_setup, | ||
ProtocolCommunicationSpecifier, | ||
ProtocolHandler, | ||
ProtocolIdentifier, | ||
ProtocolInitializer, | ||
}, | ||
}, | ||
}; | ||
use async_trait::async_trait; | ||
use std::sync::Arc; | ||
|
||
generic_protocol_initializer_setup!(AmorelieJoy, "amorelie-joy"); | ||
|
||
#[derive(Default)] | ||
pub struct AmorelieJoyInitializer {} | ||
|
||
#[async_trait] | ||
impl ProtocolInitializer for AmorelieJoyInitializer { | ||
async fn initialize( | ||
&mut self, | ||
hardware: Arc<Hardware>, | ||
_: &UserDeviceDefinition, | ||
) -> Result<Arc<dyn ProtocolHandler>, ButtplugDeviceError> { | ||
hardware | ||
.write_value(&HardwareWriteCmd::new(Endpoint::Tx, vec![0x03], false)) | ||
.await?; | ||
Ok(Arc::new(AmorelieJoy::default())) | ||
} | ||
} | ||
|
||
#[derive(Default)] | ||
pub struct AmorelieJoy {} | ||
|
||
impl ProtocolHandler for AmorelieJoy { | ||
fn keepalive_strategy(&self) -> super::ProtocolKeepaliveStrategy { | ||
super::ProtocolKeepaliveStrategy::RepeatLastPacketStrategy | ||
} | ||
|
||
fn handle_scalar_vibrate_cmd( | ||
&self, | ||
_index: u32, | ||
scalar: u32, | ||
) -> Result<Vec<HardwareCommand>, ButtplugDeviceError> { | ||
Ok(vec![HardwareWriteCmd::new( | ||
Endpoint::Tx, | ||
[ | ||
0x01, // static header | ||
0x01, // pattern (1 = steady), | ||
scalar as u8, // speed 0-100 | ||
] | ||
.to_vec(), | ||
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
// Buttplug Rust Source Code File - See https://buttplug.io for more info. | ||
// | ||
// Copyright 2016-2024 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::{ | ||
configuration::{ProtocolCommunicationSpecifier, UserDeviceDefinition, UserDeviceIdentifier}, | ||
hardware::{Hardware, HardwareCommand, HardwareWriteCmd}, | ||
protocol::{ | ||
generic_protocol_initializer_setup, | ||
ProtocolHandler, | ||
ProtocolIdentifier, | ||
ProtocolInitializer, | ||
}, | ||
}, | ||
util::sleep, | ||
}; | ||
use async_trait::async_trait; | ||
use std::{sync::Arc, time::Duration}; | ||
|
||
generic_protocol_initializer_setup!(CowgirlCone, "cowgirl-cone"); | ||
|
||
#[derive(Default)] | ||
pub struct CowgirlConeInitializer {} | ||
|
||
#[async_trait] | ||
impl ProtocolInitializer for CowgirlConeInitializer { | ||
async fn initialize( | ||
&mut self, | ||
hardware: Arc<Hardware>, | ||
_: &UserDeviceDefinition, | ||
) -> Result<Arc<dyn ProtocolHandler>, ButtplugDeviceError> { | ||
hardware | ||
.write_value(&HardwareWriteCmd::new( | ||
Endpoint::Tx, | ||
vec![0xaa, 0x56, 0x00, 0x00], | ||
false, | ||
)) | ||
.await?; | ||
sleep(Duration::from_millis(3000)).await; | ||
Ok(Arc::new(CowgirlCone::default())) | ||
} | ||
} | ||
|
||
#[derive(Default)] | ||
pub struct CowgirlCone {} | ||
|
||
impl ProtocolHandler for CowgirlCone { | ||
fn keepalive_strategy(&self) -> super::ProtocolKeepaliveStrategy { | ||
super::ProtocolKeepaliveStrategy::RepeatLastPacketStrategy | ||
} | ||
|
||
fn handle_scalar_vibrate_cmd( | ||
&self, | ||
_index: u32, | ||
scalar: u32, | ||
) -> Result<Vec<HardwareCommand>, ButtplugDeviceError> { | ||
Ok(vec![HardwareWriteCmd::new( | ||
Endpoint::Tx, | ||
vec![0xf1, 0x01, scalar as u8, 0x00], | ||
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
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
Oops, something went wrong.