Skip to main content

Event

Enum Event 

Source
pub enum Event {
Show 20 variants StateChanged(ManagerState), Discovered { peripheral: Retained, advertisement: Box<Advertisement>, rssi: i32, }, Connected { peripheral: Retained, }, ConnectFailed { peripheral: Retained, error: Option<(i64, String)>, }, Disconnected { peripheral: Retained, error: Option<(i64, String)>, }, ServicesDiscovered { peripheral: Retained, error: Option<(i64, String)>, }, IncludedServicesDiscovered { peripheral: Retained, service: Retained, error: Option<(i64, String)>, }, ServicesModified { peripheral: Retained, invalidated: Vec<Retained>, }, CharacteristicsDiscovered { peripheral: Retained, service: Retained, error: Option<(i64, String)>, }, DescriptorsDiscovered { peripheral: Retained, characteristic: Retained, error: Option<(i64, String)>, }, CharacteristicValue { peripheral: Retained, characteristic: Retained, value: Option<Vec<u8>>, error: Option<(i64, String)>, }, CharacteristicWritten { peripheral: Retained, characteristic: Retained, error: Option<(i64, String)>, }, NotifyStateChanged { peripheral: Retained, characteristic: Retained, notifying: bool, error: Option<(i64, String)>, }, DescriptorValue { peripheral: Retained, descriptor: Retained, value: Option<Vec<u8>>, error: Option<(i64, String)>, }, DescriptorWritten { peripheral: Retained, descriptor: Retained, error: Option<(i64, String)>, }, RssiRead { peripheral: Retained, rssi: i32, error: Option<(i64, String)>, }, NameChanged { peripheral: Retained, name: Option<String>, }, ReadyToWrite { peripheral: Retained, }, L2capChannelOpened { peripheral: Retained, channel: Option<Retained>, error: Option<(i64, String)>, }, WillRestoreState(Box<RestoredCentralState>),
}
Expand description

Anything CoreBluetooth tells us, normalised.

error is Some exactly when the underlying delegate method was handed a non-nil NSError, carrying its code and localizedDescription.

Variants§

§

StateChanged(ManagerState)

The central’s Bluetooth state changed. Always delivered once shortly after the manager is created — nothing else may be called before it.

§

Discovered

An advertising packet was received.

Fields

§peripheral: Retained
§advertisement: Box<Advertisement>
§rssi: i32
§

Connected

Fields

§peripheral: Retained
§

ConnectFailed

Fields

§peripheral: Retained
§error: Option<(i64, String)>
§

Disconnected

Fields

§peripheral: Retained
§error: Option<(i64, String)>
§

ServicesDiscovered

Fields

§peripheral: Retained
§error: Option<(i64, String)>
§

IncludedServicesDiscovered

discoverIncludedServices:forService: finished for one service.

Fields

§peripheral: Retained
§service: Retained
§error: Option<(i64, String)>
§

ServicesModified

The peripheral’s service set changed; every handle into it is now stale.

Fields

§peripheral: Retained
§invalidated: Vec<Retained>
§

CharacteristicsDiscovered

Fields

§peripheral: Retained
§service: Retained
§error: Option<(i64, String)>
§

DescriptorsDiscovered

Fields

§peripheral: Retained
§characteristic: Retained
§error: Option<(i64, String)>
§

CharacteristicValue

A read completed or a notification arrived — CoreBluetooth uses one callback for both and does not distinguish them, so the layer above correlates against its own outstanding reads.

Fields

§peripheral: Retained
§characteristic: Retained
§value: Option<Vec<u8>>
§error: Option<(i64, String)>
§

CharacteristicWritten

Fields

§peripheral: Retained
§characteristic: Retained
§error: Option<(i64, String)>
§

NotifyStateChanged

Fields

§peripheral: Retained
§characteristic: Retained
§notifying: bool
§error: Option<(i64, String)>
§

DescriptorValue

Fields

§peripheral: Retained
§descriptor: Retained
§value: Option<Vec<u8>>
§error: Option<(i64, String)>
§

DescriptorWritten

Fields

§peripheral: Retained
§descriptor: Retained
§error: Option<(i64, String)>
§

RssiRead

Fields

§peripheral: Retained
§rssi: i32
§error: Option<(i64, String)>
§

NameChanged

Fields

§peripheral: Retained
§

ReadyToWrite

The write-without-response queue drained and can take more.

Fields

§peripheral: Retained
§

L2capChannelOpened

An openL2CAPChannel: completed. channel is None on failure.

Fields

§peripheral: Retained
§channel: Option<Retained>
§error: Option<(i64, String)>
§

WillRestoreState(Box<RestoredCentralState>)

The system relaunched this process and is handing back what it preserved.

Delivered before the first StateChanged, and only when the manager was created with a restore identifier.

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.