buttplug 0.2.0

Buttplug Intimate Hardware Control Library
Documentation
use crate::{
    create_buttplug_protocol
};

create_buttplug_protocol!(
    // Protocol name
    Picobong,
    // Use the default protocol creator implementation. No special init needed.
    true,
    // No extra members
    (),
    // Only implements VibrateCmd
    (
        (VibrateCmd, {
            // TODO Convert to using generic command manager
            let speed = (msg.speeds[0].speed * 10.0) as u8;
            let mode: u8 = if speed == 0 { 0xff } else { 0x01 };
            let msg = DeviceWriteCmd::new(Endpoint::Tx, [0x01, mode, speed].to_vec(), false);
            device.write_value(msg.into()).await?;
            Ok(messages::Ok::default().into())
        })
    )
);

// TODO Write tests for protocol