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.
Connected
ConnectFailed
Disconnected
ServicesDiscovered
IncludedServicesDiscovered
discoverIncludedServices:forService: finished for one service.
ServicesModified
The peripheral’s service set changed; every handle into it is now stale.
CharacteristicsDiscovered
DescriptorsDiscovered
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
CharacteristicWritten
NotifyStateChanged
DescriptorValue
Fields
DescriptorWritten
RssiRead
NameChanged
ReadyToWrite
The write-without-response queue drained and can take more.
L2capChannelOpened
An openL2CAPChannel: completed. channel is None on failure.
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.