pub mod async_manager;
#[cfg(feature = "server")]
pub mod device_configuration;
pub mod future;
pub mod json;
pub mod logging;
pub mod stream;
#[cfg(not(feature = "wasm"))]
pub use tokio::time::sleep;
#[cfg(feature = "wasm")]
pub use wasmtimer::tokio::sleep;
#[cfg(all(feature = "server", feature = "client"))]
use crate::{
client::ButtplugClient,
core::connector::ButtplugInProcessClientConnectorBuilder,
server::ButtplugServerBuilder,
};
#[cfg(all(feature = "server", feature = "client"))]
pub async fn in_process_client(client_name: &str, allow_raw_messages: bool) -> ButtplugClient {
let mut server_builder = ButtplugServerBuilder::default();
#[cfg(all(
feature = "btleplug-manager",
any(
target_os = "windows",
target_os = "macos",
target_os = "linux",
target_os = "ios",
target_os = "android"
)
))]
{
use crate::server::device::hardware::communication::btleplug::BtlePlugCommunicationManagerBuilder;
server_builder.comm_manager(BtlePlugCommunicationManagerBuilder::default());
}
#[cfg(feature = "websocket-server-manager")]
{
use crate::server::device::hardware::communication::websocket_server::websocket_server_comm_manager::WebsocketServerDeviceCommunicationManagerBuilder;
server_builder.comm_manager(
WebsocketServerDeviceCommunicationManagerBuilder::default().listen_on_all_interfaces(true),
);
}
#[cfg(all(
feature = "serial-manager",
any(target_os = "windows", target_os = "macos", target_os = "linux")
))]
{
use crate::server::device::hardware::communication::serialport::SerialPortCommunicationManagerBuilder;
server_builder.comm_manager(SerialPortCommunicationManagerBuilder::default());
}
#[cfg(feature = "lovense-connect-service-manager")]
{
use crate::server::device::hardware::communication::lovense_connect_service::LovenseConnectServiceCommunicationManagerBuilder;
server_builder.comm_manager(LovenseConnectServiceCommunicationManagerBuilder::default());
}
#[cfg(all(
feature = "lovense-dongle-manager",
any(target_os = "windows", target_os = "macos", target_os = "linux")
))]
{
use crate::server::device::hardware::communication::lovense_dongle::{
LovenseHIDDongleCommunicationManagerBuilder,
LovenseSerialDongleCommunicationManagerBuilder,
};
server_builder.comm_manager(LovenseHIDDongleCommunicationManagerBuilder::default());
server_builder.comm_manager(LovenseSerialDongleCommunicationManagerBuilder::default());
}
#[cfg(all(feature = "xinput-manager", target_os = "windows"))]
{
use crate::server::device::hardware::communication::xinput::XInputDeviceCommunicationManagerBuilder;
server_builder.comm_manager(XInputDeviceCommunicationManagerBuilder::default());
}
if allow_raw_messages {
server_builder.allow_raw_messages();
}
let server = server_builder.finish().unwrap();
let connector = ButtplugInProcessClientConnectorBuilder::default()
.server(server)
.finish();
let client = ButtplugClient::new(client_name);
client.connect(connector).await.unwrap();
client
}