Buttplug sex toy control library

chore: Fix use issues after splitting up protocol impls

+66 -67
+1
crates/buttplug_server/src/device/mod.rs
··· 97 97 98 98 pub mod hardware; 99 99 pub mod protocol; 100 + pub mod protocol_impl; 100 101 pub mod server_device; 101 102 mod server_device_manager; 102 103 mod server_device_manager_event_loop;
+1 -1
crates/buttplug_server/src/device/protocol_impl/amorelie_joy.rs
··· 12 12 hardware::{Hardware, HardwareCommand, HardwareWriteCmd}, 13 13 protocol::{ 14 14 generic_protocol_initializer_setup, 15 - ProtocolCommunicationSpecifier, 16 15 ProtocolHandler, 17 16 ProtocolIdentifier, 18 17 ProtocolInitializer, 19 18 }, 20 19 }; 20 + use buttplug_server_device_config::ProtocolCommunicationSpecifier; 21 21 use async_trait::async_trait; 22 22 use std::sync::Arc; 23 23 use uuid::{uuid, Uuid};
+1 -1
crates/buttplug_server/src/device/protocol_impl/hismith.rs
··· 5 5 // Licensed under the BSD 3-Clause license. See LICENSE file in the project root 6 6 // for full license information. 7 7 8 - use crate::device::protocol::hismith_mini::HismithMiniInitializer; 8 + use super::hismith_mini::HismithMiniInitializer; 9 9 use crate::device::{ 10 10 hardware::{Hardware, HardwareCommand, HardwareReadCmd, HardwareWriteCmd}, 11 11 protocol::{ProtocolHandler, ProtocolIdentifier, ProtocolInitializer},
+1 -1
crates/buttplug_server/src/device/protocol_impl/kiiroo_v2.rs
··· 5 5 // Licensed under the BSD 3-Clause license. See LICENSE file in the project root 6 6 // for full license information. 7 7 8 + use super::fleshlight_launch_helper::calculate_speed; 8 9 use crate::device::{ 9 10 hardware::{Hardware, HardwareCommand, HardwareWriteCmd}, 10 11 protocol::{ 11 - fleshlight_launch_helper::calculate_speed, 12 12 generic_protocol_initializer_setup, 13 13 ProtocolHandler, 14 14 ProtocolIdentifier,
+2 -1
crates/buttplug_server/src/device/protocol_impl/kiiroo_v21_initialized.rs
··· 5 5 // Licensed under the BSD 3-Clause license. See LICENSE file in the project root 6 6 // for full license information. 7 7 8 + use super::fleshlight_launch_helper::calculate_speed; 9 + 8 10 use crate::device::{ 9 11 hardware::{Hardware, HardwareCommand, HardwareWriteCmd}, 10 12 protocol::{ 11 - fleshlight_launch_helper::calculate_speed, 12 13 generic_protocol_initializer_setup, 13 14 ProtocolHandler, 14 15 ProtocolIdentifier,
+4 -2
crates/buttplug_server/src/device/protocol_impl/lelof1sv2.rs
··· 5 5 // Licensed under the BSD 3-Clause license. See LICENSE file in the project root 6 6 // for full license information. 7 7 8 + use super::{ 9 + lelo_harmony::LeloHarmony, 10 + lelof1s::LeloF1s, 11 + }; 8 12 use crate::device::{ 9 13 hardware::{ 10 14 Hardware, ··· 15 19 }, 16 20 protocol::{ 17 21 generic_protocol_initializer_setup, 18 - lelo_harmony::LeloHarmony, 19 - lelof1s::LeloF1s, 20 22 ProtocolHandler, 21 23 ProtocolIdentifier, 22 24 ProtocolInitializer,
+3 -3
crates/buttplug_server/src/device/protocol_impl/leten.rs
··· 11 11 generic_protocol_initializer_setup, 12 12 ProtocolHandler, 13 13 ProtocolIdentifier, 14 - ProtocolInitializer, 14 + ProtocolInitializer, ProtocolKeepaliveStrategy, 15 15 }, 16 16 }; 17 17 use async_trait::async_trait; ··· 59 59 pub struct Leten {} 60 60 61 61 impl ProtocolHandler for Leten { 62 - fn keepalive_strategy(&self) -> super::ProtocolKeepaliveStrategy { 62 + fn keepalive_strategy(&self) -> ProtocolKeepaliveStrategy { 63 63 // Leten keepalive is shorter 64 - super::ProtocolKeepaliveStrategy::RepeatLastPacketStrategyWithTiming(Duration::from_millis( 64 + ProtocolKeepaliveStrategy::RepeatLastPacketStrategyWithTiming(Duration::from_millis( 65 65 LETEN_COMMAND_DELAY_MS, 66 66 )) 67 67 }
+1 -4
crates/buttplug_server/src/device/protocol_impl/lovehoney_desire.rs
··· 17 17 hardware::{Hardware, HardwareCommand, HardwareWriteCmd}, 18 18 protocol::{ 19 19 generic_protocol_initializer_setup, 20 - DeviceDefinition, 21 - ProtocolCommunicationSpecifier, 22 20 ProtocolHandler, 23 21 ProtocolIdentifier, 24 22 ProtocolInitializer, 25 - UserDeviceIdentifier, 26 23 }, 27 24 }; 28 25 use buttplug_core::{errors::ButtplugDeviceError, message::Endpoint}; 29 - 26 + use buttplug_server_device_config::{DeviceDefinition, ProtocolCommunicationSpecifier, UserDeviceIdentifier}; 30 27 const LOVEHONEY_DESIRE_PROTOCOL_UUID: Uuid = uuid!("5dcd8487-4814-44cb-a768-13bf81d545c0"); 31 28 const LOVEHONEY_DESIRE_VIBE2_PROTOCOL_UUID: Uuid = uuid!("d44a99fe-903b-4fff-bee7-1141767c9cca"); 32 29
+1 -1
crates/buttplug_server/src/device/protocol_impl/lovense/lovense_max.rs
··· 5 5 // Licensed under the BSD 3-Clause license. See LICENSE file in the project root 6 6 // for full license information. 7 7 8 + use super::{form_lovense_command, form_vibrate_command}; 8 9 use crate::device::{ 9 10 hardware::{Hardware, HardwareCommand}, 10 11 protocol::{ 11 - lovense::{form_lovense_command, form_vibrate_command}, 12 12 ProtocolHandler, 13 13 ProtocolKeepaliveStrategy, 14 14 },
+2 -1
crates/buttplug_server/src/device/protocol_impl/lovense/lovense_multi_actuator.rs
··· 5 5 // Licensed under the BSD 3-Clause license. See LICENSE file in the project root 6 6 // for full license information. 7 7 8 + use super::form_vibrate_command; 8 9 use crate::device::{ 9 10 hardware::{Hardware, HardwareCommand, HardwareWriteCmd}, 10 - protocol::{lovense::form_vibrate_command, ProtocolHandler, ProtocolKeepaliveStrategy}, 11 + protocol::{ProtocolHandler, ProtocolKeepaliveStrategy}, 11 12 }; 12 13 use buttplug_core::{ 13 14 errors::ButtplugDeviceError,
+2 -1
crates/buttplug_server/src/device/protocol_impl/lovense/lovense_rotate_vibrator.rs
··· 5 5 // Licensed under the BSD 3-Clause license. See LICENSE file in the project root 6 6 // for full license information. 7 7 8 + use super::{form_rotate_with_direction_command, form_vibrate_command}; 9 + 8 10 use crate::device::{ 9 11 hardware::{Hardware, HardwareCommand}, 10 12 protocol::{ 11 - lovense::{form_rotate_with_direction_command, form_vibrate_command}, 12 13 ProtocolHandler, 13 14 ProtocolKeepaliveStrategy, 14 15 },
+2 -1
crates/buttplug_server/src/device/protocol_impl/lovense/lovense_single_actuator.rs
··· 5 5 // Licensed under the BSD 3-Clause license. See LICENSE file in the project root 6 6 // for full license information. 7 7 8 + use super::form_vibrate_command; 8 9 use crate::device::{ 9 10 hardware::{Hardware, HardwareCommand}, 10 - protocol::{lovense::form_vibrate_command, ProtocolHandler, ProtocolKeepaliveStrategy}, 11 + protocol::{ProtocolHandler, ProtocolKeepaliveStrategy}, 11 12 }; 12 13 use buttplug_core::{errors::ButtplugDeviceError, message::InputReadingV4}; 13 14 use futures::future::BoxFuture;
+10 -10
crates/buttplug_server/src/device/protocol_impl/lovense/mod.rs
··· 11 11 mod lovense_single_actuator; 12 12 mod lovense_stroker; 13 13 14 + 15 + use lovense_max::LovenseMax; 16 + use lovense_multi_actuator::LovenseMultiActuator; 17 + use lovense_rotate_vibrator::LovenseRotateVibrator; 18 + use lovense_single_actuator::LovenseSingleActuator; 19 + use lovense_stroker::LovenseStroker; 20 + 14 21 use crate::device::{ 15 22 hardware::{Hardware, HardwareCommand, HardwareEvent, HardwareSubscribeCmd, HardwareWriteCmd}, 16 23 protocol::{ 17 - lovense::{ 18 - lovense_max::LovenseMax, 19 - lovense_multi_actuator::LovenseMultiActuator, 20 - lovense_rotate_vibrator::LovenseRotateVibrator, 21 - lovense_single_actuator::LovenseSingleActuator, 22 - lovense_stroker::LovenseStroker, 23 - }, 24 24 ProtocolHandler, 25 25 ProtocolIdentifier, 26 - ProtocolInitializer, 26 + ProtocolInitializer, ProtocolKeepaliveStrategy, 27 27 }, 28 28 }; 29 29 use async_trait::async_trait; ··· 493 493 .boxed() 494 494 } 495 495 496 - pub(super) fn keepalive_strategy() -> super::ProtocolKeepaliveStrategy { 496 + pub(super) fn keepalive_strategy() -> ProtocolKeepaliveStrategy { 497 497 // For Lovense, we'll just repeat the device type packet and drop the result. 498 - super::ProtocolKeepaliveStrategy::HardwareRequiredRepeatPacketStrategy(HardwareWriteCmd::new( 498 + ProtocolKeepaliveStrategy::HardwareRequiredRepeatPacketStrategy(HardwareWriteCmd::new( 499 499 &[LOVENSE_PROTOCOL_UUID], 500 500 Endpoint::Tx, 501 501 b"DeviceType;".to_vec(),
+1 -2
crates/buttplug_server/src/device/protocol_impl/luvmazer.rs
··· 9 9 10 10 use crate::device::{ 11 11 hardware::{HardwareCommand, HardwareWriteCmd}, 12 - protocol::ProtocolHandler, 12 + protocol::{ProtocolHandler, generic_protocol_setup} 13 13 }; 14 14 use buttplug_core::{errors::ButtplugDeviceError, message::Endpoint}; 15 15 16 - use super::generic_protocol_setup; 17 16 18 17 generic_protocol_setup!(Luvmazer, "luvmazer"); 19 18
+2 -4
crates/buttplug_server/src/device/protocol_impl/magic_motion_v4.rs
··· 13 13 use async_trait::async_trait; 14 14 use uuid::{uuid, Uuid}; 15 15 16 + use buttplug_server_device_config::DeviceDefinition; 16 17 use crate::device::{ 17 18 hardware::{Hardware, HardwareCommand, HardwareWriteCmd}, 18 19 protocol::{ 19 20 generic_protocol_initializer_setup, 20 - DeviceDefinition, 21 - ProtocolCommunicationSpecifier, 22 21 ProtocolHandler, 23 22 ProtocolIdentifier, 24 23 ProtocolInitializer, 25 - UserDeviceIdentifier, 26 24 }, 27 25 }; 28 26 use buttplug_core::{errors::ButtplugDeviceError, message::Endpoint}; 29 - 27 + use buttplug_server_device_config::{ProtocolCommunicationSpecifier, UserDeviceIdentifier}; 30 28 const MAGICMOTIONV4_PROTOCOL_UUID: Uuid = uuid!("d4d62d09-c3e1-44c9-8eba-caa15de5b2a7"); 31 29 32 30 generic_protocol_initializer_setup!(MagicMotionV4, "magic-motion-4");
+1 -2
crates/buttplug_server/src/device/protocol_impl/metaxsire.rs
··· 15 15 errors::ButtplugDeviceError, 16 16 message::{Endpoint, OutputType}, 17 17 }; 18 - use buttplug_server_device_config::{DeviceDefinition, UserDeviceIdentifier}; 18 + use buttplug_server_device_config::{ProtocolCommunicationSpecifier, DeviceDefinition, UserDeviceIdentifier}; 19 19 20 20 use crate::device::{ 21 21 hardware::{Hardware, HardwareCommand, HardwareWriteCmd}, 22 22 protocol::{ 23 23 generic_protocol_initializer_setup, 24 - ProtocolCommunicationSpecifier, 25 24 ProtocolHandler, 26 25 ProtocolIdentifier, 27 26 ProtocolInitializer,
+3 -3
crates/buttplug_server/src/device/protocol_impl/metaxsire_v3.rs
··· 7 7 8 8 use crate::device::{ 9 9 hardware::{HardwareCommand, HardwareWriteCmd}, 10 - protocol::{generic_protocol_setup, ProtocolHandler}, 10 + protocol::{generic_protocol_setup, ProtocolHandler, ProtocolKeepaliveStrategy}, 11 11 }; 12 12 use buttplug_core::{errors::ButtplugDeviceError, message::Endpoint}; 13 13 use std::time::Duration; ··· 38 38 } 39 39 40 40 impl ProtocolHandler for MetaXSireV3 { 41 - fn keepalive_strategy(&self) -> super::ProtocolKeepaliveStrategy { 42 - super::ProtocolKeepaliveStrategy::RepeatLastPacketStrategyWithTiming(Duration::from_millis( 41 + fn keepalive_strategy(&self) -> ProtocolKeepaliveStrategy { 42 + ProtocolKeepaliveStrategy::RepeatLastPacketStrategyWithTiming(Duration::from_millis( 43 43 METAXSIRE_COMMAND_DELAY_MS, 44 44 )) 45 45 }
+3 -3
crates/buttplug_server/src/device/protocol_impl/mizzzee_v3.rs
··· 7 7 8 8 use crate::device::{ 9 9 hardware::{HardwareCommand, HardwareWriteCmd}, 10 - protocol::{generic_protocol_setup, ProtocolHandler}, 10 + protocol::{generic_protocol_setup, ProtocolHandler, ProtocolKeepaliveStrategy}, 11 11 }; 12 12 use buttplug_core::{errors::ButtplugDeviceError, message::Endpoint}; 13 13 use std::time::Duration; ··· 56 56 pub struct MizzZeeV3 {} 57 57 58 58 impl ProtocolHandler for MizzZeeV3 { 59 - fn keepalive_strategy(&self) -> super::ProtocolKeepaliveStrategy { 60 - super::ProtocolKeepaliveStrategy::RepeatLastPacketStrategyWithTiming(Duration::from_millis( 59 + fn keepalive_strategy(&self) -> ProtocolKeepaliveStrategy { 60 + ProtocolKeepaliveStrategy::RepeatLastPacketStrategyWithTiming(Duration::from_millis( 61 61 MIZZZEE3_COMMAND_DELAY_MS, 62 62 )) 63 63 }
+3 -3
crates/buttplug_server/src/device/protocol_impl/mysteryvibe.rs
··· 11 11 generic_protocol_initializer_setup, 12 12 ProtocolHandler, 13 13 ProtocolIdentifier, 14 - ProtocolInitializer, 14 + ProtocolInitializer, ProtocolKeepaliveStrategy, 15 15 }, 16 16 }; 17 17 use async_trait::async_trait; ··· 83 83 } 84 84 85 85 impl ProtocolHandler for MysteryVibe { 86 - fn keepalive_strategy(&self) -> super::ProtocolKeepaliveStrategy { 87 - super::ProtocolKeepaliveStrategy::RepeatLastPacketStrategyWithTiming(Duration::from_millis( 86 + fn keepalive_strategy(&self) -> ProtocolKeepaliveStrategy { 87 + ProtocolKeepaliveStrategy::RepeatLastPacketStrategyWithTiming(Duration::from_millis( 88 88 MYSTERYVIBE_COMMAND_DELAY_MS, 89 89 )) 90 90 }
+1 -1
crates/buttplug_server/src/device/protocol_impl/mysteryvibe_v2.rs
··· 5 5 // Licensed under the BSD 3-Clause license. See LICENSE file in the project root 6 6 // for full license information. 7 7 8 + use super::mysteryvibe::MysteryVibe; 8 9 use crate::device::{ 9 10 hardware::{Hardware, HardwareWriteCmd}, 10 11 protocol::{ 11 12 generic_protocol_initializer_setup, 12 - mysteryvibe::MysteryVibe, 13 13 ProtocolHandler, 14 14 ProtocolIdentifier, 15 15 ProtocolInitializer,
+3 -3
crates/buttplug_server/src/device/protocol_impl/satisfyer.rs
··· 7 7 8 8 use crate::device::{ 9 9 hardware::{Hardware, HardwareCommand, HardwareReadCmd, HardwareWriteCmd}, 10 - protocol::{ProtocolHandler, ProtocolIdentifier, ProtocolInitializer}, 10 + protocol::{ProtocolHandler, ProtocolIdentifier, ProtocolInitializer, ProtocolKeepaliveStrategy}, 11 11 }; 12 12 use async_trait::async_trait; 13 13 use buttplug_core::{errors::ButtplugDeviceError, message::Endpoint}; ··· 155 155 } 156 156 157 157 impl ProtocolHandler for Satisfyer { 158 - fn keepalive_strategy(&self) -> super::ProtocolKeepaliveStrategy { 159 - super::ProtocolKeepaliveStrategy::RepeatLastPacketStrategyWithTiming(Duration::from_secs(3)) 158 + fn keepalive_strategy(&self) -> ProtocolKeepaliveStrategy { 159 + ProtocolKeepaliveStrategy::RepeatLastPacketStrategyWithTiming(Duration::from_secs(3)) 160 160 } 161 161 162 162 fn handle_output_vibrate_cmd(
+1 -2
crates/buttplug_server/src/device/protocol_impl/svakom/svakom_v6.rs
··· 17 17 hardware::{Hardware, HardwareCommand, HardwareWriteCmd}, 18 18 protocol::{ 19 19 generic_protocol_initializer_setup, 20 - ProtocolCommunicationSpecifier, 21 20 ProtocolHandler, 22 21 ProtocolIdentifier, 23 22 ProtocolInitializer, 24 23 ProtocolKeepaliveStrategy, 25 24 }, 26 25 }; 27 - use buttplug_server_device_config::{DeviceDefinition, UserDeviceIdentifier}; 26 + use buttplug_server_device_config::{DeviceDefinition, UserDeviceIdentifier, ProtocolCommunicationSpecifier}; 28 27 use std::sync::{ 29 28 atomic::{AtomicU8, Ordering}, 30 29 Arc,
+3 -3
crates/buttplug_server/src/device/protocol_impl/thehandy/mod.rs
··· 13 13 generic_protocol_initializer_setup, 14 14 ProtocolHandler, 15 15 ProtocolIdentifier, 16 - ProtocolInitializer, 16 + ProtocolInitializer, ProtocolKeepaliveStrategy, 17 17 }, 18 18 }; 19 19 use async_trait::async_trait; ··· 108 108 pub struct TheHandy {} 109 109 110 110 impl ProtocolHandler for TheHandy { 111 - fn keepalive_strategy(&self) -> super::ProtocolKeepaliveStrategy { 111 + fn keepalive_strategy(&self) -> ProtocolKeepaliveStrategy { 112 112 let ping_payload = handyplug::Payload { 113 113 messages: vec![handyplug::Message { 114 114 message: Some(handyplug::message::Message::Ping(Ping { id: 999 })), ··· 119 119 .encode(&mut ping_buf) 120 120 .expect("Infallible encode."); 121 121 122 - super::ProtocolKeepaliveStrategy::HardwareRequiredRepeatPacketStrategy(HardwareWriteCmd::new( 122 + ProtocolKeepaliveStrategy::HardwareRequiredRepeatPacketStrategy(HardwareWriteCmd::new( 123 123 &[THEHANDY_PROTOCOL_UUID], 124 124 Endpoint::Tx, 125 125 ping_buf,
+3 -1
crates/buttplug_server/src/device/protocol_impl/vorze_sa/dual_rotator.rs
··· 7 7 8 8 use uuid::{uuid, Uuid}; 9 9 10 + use super::VorzeDevice; 11 + 10 12 use crate::device::{ 13 + protocol::ProtocolHandler, 11 14 hardware::{HardwareCommand, HardwareWriteCmd}, 12 - protocol::{vorze_sa::VorzeDevice, ProtocolHandler}, 13 15 }; 14 16 use buttplug_core::{errors::ButtplugDeviceError, message::Endpoint}; 15 17 use std::sync::atomic::{AtomicI8, Ordering};
+3 -1
crates/buttplug_server/src/device/protocol_impl/vorze_sa/piston.rs
··· 1 + use super::VorzeDevice; 2 + 1 3 use crate::device::{ 2 4 hardware::{HardwareCommand, HardwareWriteCmd}, 3 - protocol::{vorze_sa::VorzeDevice, ProtocolHandler}, 5 + protocol::ProtocolHandler, 4 6 }; 5 7 use buttplug_core::{errors::ButtplugDeviceError, message::Endpoint}; 6 8 use std::sync::{
+3 -4
crates/buttplug_server/src/device/protocol_impl/vorze_sa/single_rotator.rs
··· 5 5 // Licensed under the BSD 3-Clause license. See LICENSE file in the project root 6 6 // for full license information. 7 7 8 + use super::{VorzeActions, VorzeDevice}; 9 + 8 10 use crate::device::{ 9 11 hardware::{HardwareCommand, HardwareWriteCmd}, 10 - protocol::{ 11 - vorze_sa::{VorzeActions, VorzeDevice}, 12 - ProtocolHandler, 13 - }, 12 + protocol::ProtocolHandler 14 13 }; 15 14 use buttplug_core::{errors::ButtplugDeviceError, message::Endpoint}; 16 15
+3 -4
crates/buttplug_server/src/device/protocol_impl/vorze_sa/vibrator.rs
··· 5 5 // Licensed under the BSD 3-Clause license. See LICENSE file in the project root 6 6 // for full license information. 7 7 8 + use super::{VorzeActions, VorzeDevice}; 9 + 8 10 use crate::device::{ 9 11 hardware::{HardwareCommand, HardwareWriteCmd}, 10 - protocol::{ 11 - vorze_sa::{VorzeActions, VorzeDevice}, 12 - ProtocolHandler, 13 - }, 12 + protocol::ProtocolHandler, 14 13 }; 15 14 use buttplug_core::{errors::ButtplugDeviceError, message::Endpoint}; 16 15
+1 -2
crates/buttplug_server/src/device/protocol_impl/wevibe8bit.rs
··· 17 17 hardware::{Hardware, HardwareCommand, HardwareWriteCmd}, 18 18 protocol::{ 19 19 generic_protocol_initializer_setup, 20 - ProtocolCommunicationSpecifier, 21 20 ProtocolHandler, 22 21 ProtocolIdentifier, 23 22 ProtocolInitializer, ··· 27 26 errors::ButtplugDeviceError, 28 27 message::{Endpoint, OutputType}, 29 28 }; 30 - use buttplug_server_device_config::{DeviceDefinition, UserDeviceIdentifier}; 29 + use buttplug_server_device_config::{DeviceDefinition, UserDeviceIdentifier, ProtocolCommunicationSpecifier}; 31 30 32 31 generic_protocol_initializer_setup!(WeVibe8Bit, "wevibe-8bit"); 33 32
+1 -2
crates/buttplug_server/src/device/protocol_impl/wevibe_chorus.rs
··· 17 17 hardware::{Hardware, HardwareCommand, HardwareWriteCmd}, 18 18 protocol::{ 19 19 generic_protocol_initializer_setup, 20 - ProtocolCommunicationSpecifier, 21 20 ProtocolHandler, 22 21 ProtocolIdentifier, 23 22 ProtocolInitializer, ··· 27 26 errors::ButtplugDeviceError, 28 27 message::{Endpoint, OutputType}, 29 28 }; 30 - use buttplug_server_device_config::{DeviceDefinition, UserDeviceIdentifier}; 29 + use buttplug_server_device_config::{DeviceDefinition, UserDeviceIdentifier, ProtocolCommunicationSpecifier}; 31 30 32 31 generic_protocol_initializer_setup!(WeVibeChorus, "wevibe-chorus"); 33 32