#[non_exhaustive]pub enum Event {
DeviceConnection(DeviceConnection),
DeviceDiscoveryStatus {
discovery_enabled: bool,
},
DeviceDiscoveryDeviceDetails {
counter: u16,
kind: DeviceKind,
wpid: u16,
address: [u8; 6],
authentication: u8,
},
DeviceDiscoveryDeviceName {
counter: u16,
name: String,
},
PairingStatus {
device_address: [u8; 6],
pairing_error: Option<PairingError>,
slot: Option<u8>,
},
PairingPasskeyRequest {
device_address: [u8; 6],
passkey: String,
},
PairingPasskeyPressed {
device_address: [u8; 6],
press_type: PairingPasskeyPressType,
},
}Expand description
Represents an event emitted by the receiver.
You can listen to these events using Receiver::listen. Only enabled
notifications as indicated by Receiver::get_notification_state are
emitted.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
DeviceConnection(DeviceConnection)
Is emitted whenever a device connects to or disconnects from the
receiver, but only if NotificationState::wireless_notifications is
enabled.
Can be triggered for all paired devices using
Receiver::trigger_device_arrival to allow easy device enumeration.
Receiver::collect_paired_devices implements a simple mechanism to
collect all paired devices.
DeviceDiscoveryStatus
Is emitted whenever the device discovery status changes.
DeviceDiscoveryDeviceDetails
Is emitted many times for every device discovered using
Receiver::discover_devices.
This event contains device details, including its address required to
start pairing. The Event::DeviceDiscoveryDeviceName event will also
be emitted and contains the device name.
Fields
counter: u16The incrementing event counter. This can be used to map
Event::DeviceDiscoveryDeviceDetails and
Event::DeviceDiscoveryDeviceName events.
kind: DeviceKindaddress: [u8; 6]The address of the device required to pair it using
Receiver::pair_device.
This can also be used as the unique device identifier when collecting discovered devices.
DeviceDiscoveryDeviceName
Is emitted many times for every device discovered using
Receiver::discover_devices.
This event only contains the device name. Device details will be
provided using the Event::DeviceDiscoveryDeviceDetails event.
Fields
counter: u16The incrementing event counter. This can be used to map
Event::DeviceDiscoveryDeviceDetails and
Event::DeviceDiscoveryDeviceName events.
PairingStatus
Is emitted whenever the status of a pairing process changes.
Fields
pairing_error: Option<PairingError>PairingPasskeyRequest
Is emitted once the receiver requests a passkey to be entered on a device that should be paired to it.
Fields
passkey: StringThe passkey the user has to enter in order to pair the device.
Depending on the device and authentication type, this value has different implications.
For mice, this value will be a valid 6-digit number. After parsing
this into an integer, the (least significant) bits represent
the sequence of mouse presses (0 = left, 1 = right) the
user has to perform, with an additional press of both mouse
buttons simultaneously.
The amount of bits significant to this equals to the entropy
passed to Receiver::pair_device.
PairingPasskeyPressed
Is emitted for every keypress a user performs while entering a pairing passkey.
Fields
press_type: PairingPasskeyPressTypeThe type of the keypress the user performed.
Every passkey sequence starts with an event where this value is set
to PairingPasskeyPressType::Initialization. Each time the user
presses a key, an event with a press type of
PairingPasskeyPressType::Keypress is emitted. Once the user
submits their passkey, this value will be
PairingPasskeyPressType::Submit.