pub struct BluetoothConnection {
pub peripheral: Peripheral,
pub system_tx: Characteristic,
pub system_rx: Characteristic,
pub user_tx: Characteristic,
pub user_rx: Characteristic,
pub pairing: Characteristic,
/* private fields */
}
Fields§
§peripheral: Peripheral
§system_tx: Characteristic
§system_rx: Characteristic
§user_tx: Characteristic
§user_rx: Characteristic
§pairing: Characteristic
Implementations§
Source§impl BluetoothConnection
impl BluetoothConnection
pub const MAX_PACKET_SIZE: usize = 244usize
pub async fn open(device: BluetoothDevice) -> Result<Self, BluetoothError>
pub async fn is_paired(&self) -> Result<bool, BluetoothError>
pub async fn request_pairing(&mut self) -> Result<(), BluetoothError>
pub async fn authenticate_pairing( &mut self, pin: [u8; 4], ) -> Result<(), BluetoothError>
Trait Implementations§
Source§impl Connection for BluetoothConnection
impl Connection for BluetoothConnection
type Error = BluetoothError
fn connection_type(&self) -> ConnectionType
Source§async fn recv<P: Decode + CheckHeader>(
&mut self,
timeout: Duration,
) -> Result<P, BluetoothError>
async fn recv<P: Decode + CheckHeader>( &mut self, timeout: Duration, ) -> Result<P, BluetoothError>
Receives a packet.
Source§async fn read_user(&mut self, buf: &mut [u8]) -> Result<usize, BluetoothError>
async fn read_user(&mut self, buf: &mut [u8]) -> Result<usize, BluetoothError>
Read user program output.
Source§async fn write_user(&mut self, buf: &[u8]) -> Result<usize, BluetoothError>
async fn write_user(&mut self, buf: &[u8]) -> Result<usize, BluetoothError>
Write to user program stdio.
Source§impl From<BluetoothConnection> for GenericConnection
impl From<BluetoothConnection> for GenericConnection
Source§fn from(c: BluetoothConnection) -> Self
fn from(c: BluetoothConnection) -> Self
Converts to this type from the input type.
Auto Trait Implementations§
impl Freeze for BluetoothConnection
impl !RefUnwindSafe for BluetoothConnection
impl Send for BluetoothConnection
impl !Sync for BluetoothConnection
impl Unpin for BluetoothConnection
impl !UnwindSafe for BluetoothConnection
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more