Skip to main content

Event

Enum Event 

Source
pub enum Event {
Show 21 variants Discovered { address: String, name: Option<String>, rssi: i32, service_uuids: Vec<String>, manufacturer_data: Vec<(u16, Vec<u8>)>, service_data: Vec<(String, Vec<u8>)>, class_of_device: Option<u32>, connectable: bool, }, ScanFailed { code: i32, }, ConnectionStateChanged { gatt: Ref, status: i32, connected: bool, }, ServicesDiscovered { gatt: Ref, status: i32, }, CharacteristicRead { gatt: Ref, characteristic: Ref, value: Vec<u8>, status: i32, }, CharacteristicWritten { gatt: Ref, characteristic: Ref, status: i32, }, CharacteristicChanged { gatt: Ref, characteristic: Ref, value: Vec<u8>, }, DescriptorRead { gatt: Ref, descriptor: Ref, value: Vec<u8>, status: i32, }, DescriptorWritten { gatt: Ref, descriptor: Ref, status: i32, }, PhyChanged { gatt: Ref, tx: i32, rx: i32, status: i32, }, MtuChanged { gatt: Ref, mtu: i32, status: i32, }, RssiRead { gatt: Ref, rssi: i32, status: i32, }, ServicesChanged { gatt: Ref, }, ServerConnectionStateChanged { device: Ref, connected: bool, }, ServiceAdded { status: i32, }, ReadRequest { device: Ref, request_id: i32, offset: i32, characteristic: Ref, }, WriteRequest { device: Ref, request_id: i32, characteristic: Ref, prepared: bool, response_needed: bool, offset: i32, value: Vec<u8>, }, DescriptorReadRequest { device: Ref, request_id: i32, offset: i32, descriptor: Ref, }, DescriptorWriteRequest { device: Ref, request_id: i32, descriptor: Ref, response_needed: bool, offset: i32, value: Vec<u8>, }, NotificationSent { device: Ref, status: i32, }, AdvertisingStarted { error: Option<i32>, },
}
Expand description

What Android tells us.

Variants§

§

Discovered

A scan result. record is the raw advertising payload when Android supplies one.

Fields

§address: String
§rssi: i32
§service_uuids: Vec<String>
§manufacturer_data: Vec<(u16, Vec<u8>)>
§service_data: Vec<(String, Vec<u8>)>
§class_of_device: Option<u32>
§connectable: bool
§

ScanFailed

Fields

§code: i32
§

ConnectionStateChanged

onConnectionStateChange. status is a GATT_* code; 0 is success.

Fields

§gatt: Ref
§status: i32
§connected: bool
§

ServicesDiscovered

Fields

§gatt: Ref
§status: i32
§

CharacteristicRead

Fields

§gatt: Ref
§characteristic: Ref
§value: Vec<u8>
§status: i32
§

CharacteristicWritten

Fields

§gatt: Ref
§characteristic: Ref
§status: i32
§

CharacteristicChanged

A subscription delivering a value.

Fields

§gatt: Ref
§characteristic: Ref
§value: Vec<u8>
§

DescriptorRead

Fields

§gatt: Ref
§descriptor: Ref
§value: Vec<u8>
§status: i32
§

DescriptorWritten

Fields

§gatt: Ref
§descriptor: Ref
§status: i32
§

PhyChanged

The link’s PHY, as reported by onPhyUpdate or onPhyRead.

One event for both because they carry the same thing and a caller only ever has one outstanding: the difference is whether it was asked to change or merely to report.

Fields

§gatt: Ref
§tx: i32
§rx: i32
§status: i32
§

MtuChanged

Fields

§gatt: Ref
§mtu: i32
§status: i32
§

RssiRead

Fields

§gatt: Ref
§rssi: i32
§status: i32
§

ServicesChanged

The peer’s attribute table changed; every handle into it is stale.

Fields

§gatt: Ref
§

ServerConnectionStateChanged

Fields

§device: Ref
§connected: bool
§

ServiceAdded

Fields

§status: i32
§

ReadRequest

Fields

§device: Ref
§request_id: i32
§offset: i32
§characteristic: Ref
§

WriteRequest

Fields

§device: Ref
§request_id: i32
§characteristic: Ref
§prepared: bool
§response_needed: bool
§offset: i32
§value: Vec<u8>
§

DescriptorReadRequest

Fields

§device: Ref
§request_id: i32
§offset: i32
§descriptor: Ref
§

DescriptorWriteRequest

Fields

§device: Ref
§request_id: i32
§descriptor: Ref
§response_needed: bool
§offset: i32
§value: Vec<u8>
§

NotificationSent

Fields

§device: Ref
§status: i32
§

AdvertisingStarted

Fields

§error: Option<i32>

Trait Implementations§

Source§

impl Debug for Event

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl Forget for Event

§

impl Freeze for Event

§

impl Move for Event

§

impl RefUnwindSafe for Event

§

impl Send for Event

§

impl Sync for Event

§

impl Unpin for Event

§

impl UnsafeUnpin for Event

§

impl UnwindSafe for Event

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.