Skip to main content

GattConnection

Trait GattConnection 

Source
pub trait GattConnection: Send + Sync {
    // Required methods
    fn write<'life0, 'life1, 'life2, 'async_trait>(
        &'life0 self,
        char_uuid: &'life1 str,
        value: &'life2 [u8],
    ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait;
    fn read<'life0, 'life1, 'async_trait>(
        &'life0 self,
        char_uuid: &'life1 str,
    ) -> Pin<Box<dyn Future<Output = Result<Vec<u8>>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn subscribe<'life0, 'life1, 'async_trait>(
        &'life0 self,
        char_uuid: &'life1 str,
    ) -> Pin<Box<dyn Future<Output = Result<Receiver<Vec<u8>>>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn instance_id<'life0, 'life1, 'async_trait>(
        &'life0 self,
        char_uuid: &'life1 str,
    ) -> Pin<Box<dyn Future<Output = Result<u16>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn enumerate<'life0, 'async_trait>(
        &'life0 self,
    ) -> Pin<Box<dyn Future<Output = Result<Vec<GattService>>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;

    // Provided methods
    fn max_write<'life0, 'async_trait>(
        &'life0 self,
    ) -> Pin<Box<dyn Future<Output = usize> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait { ... }
    fn generation<'life0, 'async_trait>(
        &'life0 self,
    ) -> Pin<Box<dyn Future<Output = u64> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait { ... }
}
Expand description

The transport seam: read/write/subscribe a characteristic and enumerate the GATT database. One real impl (bluest), one mock (tests).

Required Methods§

Source

fn write<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, char_uuid: &'life1 str, value: &'life2 [u8], ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Write a value to a characteristic identified by its UUID.

Source

fn read<'life0, 'life1, 'async_trait>( &'life0 self, char_uuid: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<Vec<u8>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Read a characteristic’s current value by UUID.

Source

fn subscribe<'life0, 'life1, 'async_trait>( &'life0 self, char_uuid: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<Receiver<Vec<u8>>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Subscribe to notifications on a characteristic; the receiver yields raw notification payloads.

Source

fn instance_id<'life0, 'life1, 'async_trait>( &'life0 self, char_uuid: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<u16>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Read one characteristic’s HAP instance id (its Instance-ID descriptor) without walking the whole tree — used to address the pairing characteristics before the (slow) full database sweep.

Source

fn enumerate<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<Vec<GattService>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Enumerate the accessory’s services and characteristics (with iids).

Provided Methods§

Source

fn max_write<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = usize> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

The maximum bytes that fit in a single GATT write — the HAP-BLE PDU fragment size. Backends that can’t determine the negotiated MTU return a conservative default.

Source

fn generation<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = u64> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

A monotonically increasing link-generation counter that advances on every reconnect. A secure session minted at generation g is invalidated when the accessory drops the link (the count moves past g), so the holder must re-run Pair Verify before its next encrypted operation. Backends without a reconnect supervisor never invalidate sessions and return 0.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§