fn write_rfcomm(state: Arc<RwLock<ProfileState>>, args: &Vec<String>) -> Result<(), Error> {
    if args.len() != 2 {
        return Err(anyhow!("Invalid number of arguments"));
    }

    let server_channel =
        args[0].parse::<u8>().map_err(|_| anyhow!("Server channel must be a u8"))?;
    let server_channel = ServerChannelNumber::try_from(server_channel)?;
    let bytes = args[1].as_bytes().to_vec();
    state.write().rfcomm.send_user_data(server_channel, bytes)
}
/// Sends a user data payload to the ServerChannelNumber specified in `args`.
Sends a user data payload to the ServerChannelNumber specified in `args`.
Sends a user data payload to the ServerChannelNumber specified in ` args ` .
fn write_rfcomm(state: Arc<RwLock<ProfileState>>, args: &Vec<String>) -> Result<(), Error> {
    if args.len() != 2 {
        return Err(anyhow!("Invalid number of arguments"));
    }
    let server_channel =
        args[0].parse::<u8>().map_err(|_| anyhow!("Server channel must be a u8"))?;
    let server_channel = ServerChannelNumber::try_from(server_channel)?;
    let bytes = args[1].as_bytes().to_vec();
    state.write().rfcomm.send_user_data(server_channel, bytes)
}
fn write_rfcomm ( state : Arc < RwLock < ProfileState > > , args : & Vec < String > ) -> Result < ( ) , Error > { if args . len ( ) != 2 { return Err ( anyhow ! ( " " ) ) ; } let server_channel = args [ 0 ] . parse :: < u8 > ( ) . map_err ( | _ | anyhow ! ( " " ) ) ? ; let server_channel = ServerChannelNumber :: try_from ( server_channel ) ? ; let bytes = args [ 1 ] . as_bytes ( ) . to_vec ( ) ; state . write ( ) . rfcomm . send_user_data ( server_channel , bytes ) }
Sends a user data payload to the ServerChannelNumber specified in `args`.
Sends a user data payload to the ServerChannelNumber specified in ` args ` .
state
Arc<RwLock<ProfileState>>
args
&Vec<String>
state
Arc<RwLock<ProfileState>>
args
&Vec<String>