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
4 changes: 3 additions & 1 deletion crates/buttplug_core/src/connector/transport/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,9 @@
pub mod stream;

use crate::connector::{
ButtplugConnectorError, ButtplugConnectorResultFuture, ButtplugSerializedMessage,
ButtplugConnectorError,
ButtplugConnectorResultFuture,
ButtplugSerializedMessage,
};
use displaydoc::Display;
use futures::future::BoxFuture;
Expand Down
4 changes: 3 additions & 1 deletion crates/buttplug_core/src/errors.rs
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,9 @@ pub enum ButtplugHandshakeError {
#[error("Expected either a ServerInfo or Error message, received {0}")]
UnexpectedHandshakeMessageReceived(String),
/// Expected a RequestServerInfo message to start connection.
#[error("Expected a RequestServerInfo message to start connection. Message either not received or wrong message received.")]
#[error(
"Expected a RequestServerInfo message to start connection. Message either not received or wrong message received."
)]
RequestServerInfoExpected,
/// Handshake already happened, cannot run handshake again.
#[error("Handshake already happened, cannot run handshake again.")]
Expand Down
4 changes: 2 additions & 2 deletions crates/buttplug_server/src/device/protocol_impl/itoys.rs
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ impl ProtocolHandler for IToys {
],
false,
)
.into(),
.into(),
])
}

Expand All @@ -81,7 +81,7 @@ impl ProtocolHandler for IToys {
],
false,
)
.into(),
.into(),
])
}
}
4 changes: 2 additions & 2 deletions crates/buttplug_server/src/device/protocol_impl/luvmazer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ impl ProtocolHandler for Luvmazer {
vec![0xa0, 0x0c, 0x00, 0x00, 0x64, speed as u8],
false,
)
.into(),
.into(),
])
} else {
Ok(vec![
Expand All @@ -45,7 +45,7 @@ impl ProtocolHandler for Luvmazer {
vec![0xa0, 0x01, 0x00, feature_index as u8, 0x64, speed as u8],
false,
)
.into(),
.into(),
])
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ impl Satisfyer {

impl ProtocolHandler for Satisfyer {
fn keepalive_strategy(&self) -> ProtocolKeepaliveStrategy {
ProtocolKeepaliveStrategy::RepeatLastPacketStrategyWithTiming(Duration::from_secs(3))
ProtocolKeepaliveStrategy::RepeatLastPacketStrategyWithTiming(Duration::from_millis(500))
}

fn handle_output_vibrate_cmd(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -381,10 +381,7 @@ impl TryFromDeviceAttributes<RotateCmdV1> for CheckedOutputVecCmdV4 {
mod tests {
use super::*;
use crate::message::v1::VibrateSubcommandV1;
use buttplug_core::util::{
range::RangeInclusive,
small_vec_enum_map::SmallVecEnumMap,
};
use buttplug_core::util::{range::RangeInclusive, small_vec_enum_map::SmallVecEnumMap};
use buttplug_server_device_config::{
RangeWithLimit,
ServerDeviceFeature,
Expand Down
5 changes: 1 addition & 4 deletions crates/buttplug_tests/tests/test_device_config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,7 @@ use buttplug_server_device_config::load_protocol_configs;
use futures::StreamExt;
use std::time::Duration;
use tokio_test::assert_ok;
use util::{
test_client_with_device_and_custom_dcm,
test_device_manager::TestDeviceIdentifier,
};
use util::{test_client_with_device_and_custom_dcm, test_device_manager::TestDeviceIdentifier};

const BASE_CONFIG_JSON: &str = r#"
{
Expand Down
25 changes: 8 additions & 17 deletions crates/buttplug_tests/tests/test_disabled_device_features.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,17 +33,14 @@ const USER_CONFIG_DISABLED_HW_POSITION: &str = include_str!(
"util/device_test/device_test_case/config/tcode_disabled_hw_position_user_config.json"
);

const USER_CONFIG_DISABLED_POSITION: &str = include_str!(
"util/device_test/device_test_case/config/tcode_disabled_position_user_config.json"
);
const USER_CONFIG_DISABLED_POSITION: &str =
include_str!("util/device_test/device_test_case/config/tcode_disabled_position_user_config.json");

const USER_CONFIG_DISABLED_BOTH: &str = include_str!(
"util/device_test/device_test_case/config/tcode_disabled_both_outputs_user_config.json"
);

fn load_dcm_with_config(
config: &str,
) -> buttplug_server_device_config::DeviceConfigurationManager {
fn load_dcm_with_config(config: &str) -> buttplug_server_device_config::DeviceConfigurationManager {
load_protocol_configs(&None, &Some(config.to_string()), false)
.expect("Test, assuming infallible.")
.finish()
Expand All @@ -58,9 +55,7 @@ fn test_identifier() -> TestDeviceIdentifier {
}

/// Helper: connect a client, scan, and return the first DeviceAdded event.
async fn get_client_device_from_config(
config: &str,
) -> buttplug_client::ButtplugClientDevice {
async fn get_client_device_from_config(config: &str) -> buttplug_client::ButtplugClientDevice {
let dcm = load_dcm_with_config(config);
let (client, _device_channel) =
test_client_with_device_and_custom_dcm(&test_identifier(), dcm).await;
Expand Down Expand Up @@ -246,8 +241,7 @@ async fn test_disabled_position_not_in_device_list() {
/// Verify the DeviceList structure when Position is disabled.
#[tokio::test]
async fn test_disabled_position_device_list_structure() {
let (_server, _device_index, list) =
get_server_device_list(USER_CONFIG_DISABLED_POSITION).await;
let (_server, _device_index, list) = get_server_device_list(USER_CONFIG_DISABLED_POSITION).await;

let device_info = list.devices().values().next().expect("One device expected");
let feature = device_info
Expand All @@ -268,8 +262,7 @@ async fn test_disabled_position_device_list_structure() {
/// Verify that Position commands are rejected when Position is disabled.
#[tokio::test]
async fn test_disabled_position_command_rejected() {
let (server, device_index, _list) =
get_server_device_list(USER_CONFIG_DISABLED_POSITION).await;
let (server, device_index, _list) = get_server_device_list(USER_CONFIG_DISABLED_POSITION).await;

let result = server
.parse_message(ButtplugClientMessageVariant::V4(
Expand All @@ -291,8 +284,7 @@ async fn test_disabled_position_command_rejected() {
/// Verify that HwPositionWithDuration commands are still accepted when only Position is disabled.
#[tokio::test]
async fn test_disabled_position_allows_hw_position_commands() {
let (server, device_index, _list) =
get_server_device_list(USER_CONFIG_DISABLED_POSITION).await;
let (server, device_index, _list) = get_server_device_list(USER_CONFIG_DISABLED_POSITION).await;

let result = server
.parse_message(ButtplugClientMessageVariant::V4(
Expand Down Expand Up @@ -320,8 +312,7 @@ async fn test_disabled_position_allows_hw_position_commands() {
/// neither outputs nor inputs.
#[tokio::test]
async fn test_disabled_both_outputs_feature_absent() {
let (_server, _device_index, list) =
get_server_device_list(USER_CONFIG_DISABLED_BOTH).await;
let (_server, _device_index, list) = get_server_device_list(USER_CONFIG_DISABLED_BOTH).await;

let device_info = list.devices().values().next().expect("One device expected");
assert!(
Expand Down
7 changes: 5 additions & 2 deletions crates/buttplug_tests/tests/test_lovense_solace_pro_stop.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
mod util;

use buttplug_client::{
ButtplugClient, ButtplugClientEvent,
ButtplugClient,
ButtplugClientEvent,
device::{ClientDeviceCommandValue, ClientDeviceOutputCommand},
};
use buttplug_client_in_process::ButtplugInProcessClientConnectorBuilder;
Expand All @@ -16,7 +17,9 @@ use futures::StreamExt;
use std::time::Duration;
use tokio::time::timeout;
use util::{
TestDeviceChannelHost, TestDeviceCommunicationManagerBuilder, TestHardwareEvent,
TestDeviceChannelHost,
TestDeviceCommunicationManagerBuilder,
TestHardwareEvent,
test_device_manager::TestDeviceIdentifier,
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,11 @@

use buttplug_core::{
connector::{
ButtplugConnectorError, ButtplugConnectorResultFuture,
ButtplugConnectorError,
ButtplugConnectorResultFuture,
transport::{
ButtplugConnectorTransport, ButtplugConnectorTransportSpecificError,
ButtplugConnectorTransport,
ButtplugConnectorTransportSpecificError,
ButtplugTransportIncomingMessage,
},
},
Expand Down Expand Up @@ -325,7 +327,8 @@ mod test {
connector::{
ButtplugConnectorError,
transport::{
ButtplugConnectorTransport, ButtplugConnectorTransportSpecificError,
ButtplugConnectorTransport,
ButtplugConnectorTransportSpecificError,
ButtplugTransportIncomingMessage,
},
},
Expand Down
Loading