mirror of
https://github.com/servo/servo.git
synced 2025-07-24 07:40:27 +01:00
Webbluetooth Async behaviour
This commit is contained in:
parent
4a7ea72429
commit
e7e7c74c9e
19 changed files with 806 additions and 729 deletions
|
@ -75,21 +75,43 @@ pub type BluetoothDescriptorsMsg = Vec<BluetoothDescriptorMsg>;
|
|||
|
||||
pub type BluetoothResult<T> = Result<T, BluetoothError>;
|
||||
|
||||
pub type BluetoothResponseResult = Result<BluetoothResponse, BluetoothError>;
|
||||
|
||||
#[derive(Deserialize, Serialize)]
|
||||
pub enum BluetoothMethodMsg {
|
||||
RequestDevice(RequestDeviceoptions, IpcSender<BluetoothResult<BluetoothDeviceMsg>>),
|
||||
GATTServerConnect(String, IpcSender<BluetoothResult<bool>>),
|
||||
pub enum BluetoothRequest {
|
||||
RequestDevice(RequestDeviceoptions, IpcSender<BluetoothResponseResult>),
|
||||
GATTServerConnect(String, IpcSender<BluetoothResponseResult>),
|
||||
GATTServerDisconnect(String, IpcSender<BluetoothResult<bool>>),
|
||||
GetPrimaryService(String, String, IpcSender<BluetoothResult<BluetoothServiceMsg>>),
|
||||
GetPrimaryServices(String, Option<String>, IpcSender<BluetoothResult<BluetoothServicesMsg>>),
|
||||
GetIncludedService(String, String, IpcSender<BluetoothResult<BluetoothServiceMsg>>),
|
||||
GetIncludedServices(String, Option<String>, IpcSender<BluetoothResult<BluetoothServicesMsg>>),
|
||||
GetCharacteristic(String, String, IpcSender<BluetoothResult<BluetoothCharacteristicMsg>>),
|
||||
GetCharacteristics(String, Option<String>, IpcSender<BluetoothResult<BluetoothCharacteristicsMsg>>),
|
||||
GetDescriptor(String, String, IpcSender<BluetoothResult<BluetoothDescriptorMsg>>),
|
||||
GetDescriptors(String, Option<String>, IpcSender<BluetoothResult<BluetoothDescriptorsMsg>>),
|
||||
ReadValue(String, IpcSender<BluetoothResult<Vec<u8>>>),
|
||||
WriteValue(String, Vec<u8>, IpcSender<BluetoothResult<bool>>),
|
||||
GetPrimaryService(String, String, IpcSender<BluetoothResponseResult>),
|
||||
GetPrimaryServices(String, Option<String>, IpcSender<BluetoothResponseResult>),
|
||||
GetIncludedService(String, String, IpcSender<BluetoothResponseResult>),
|
||||
GetIncludedServices(String, Option<String>, IpcSender<BluetoothResponseResult>),
|
||||
GetCharacteristic(String, String, IpcSender<BluetoothResponseResult>),
|
||||
GetCharacteristics(String, Option<String>, IpcSender<BluetoothResponseResult>),
|
||||
GetDescriptor(String, String, IpcSender<BluetoothResponseResult>),
|
||||
GetDescriptors(String, Option<String>, IpcSender<BluetoothResponseResult>),
|
||||
ReadValue(String, IpcSender<BluetoothResponseResult>),
|
||||
WriteValue(String, Vec<u8>, IpcSender<BluetoothResponseResult>),
|
||||
Test(String, IpcSender<BluetoothResult<()>>),
|
||||
Exit,
|
||||
}
|
||||
|
||||
#[derive(Deserialize, Serialize)]
|
||||
pub enum BluetoothResponse {
|
||||
RequestDevice(BluetoothDeviceMsg),
|
||||
GATTServerConnect(bool),
|
||||
GetPrimaryService(BluetoothServiceMsg),
|
||||
GetPrimaryServices(BluetoothServicesMsg),
|
||||
GetIncludedService(BluetoothServiceMsg),
|
||||
GetIncludedServices(BluetoothServicesMsg),
|
||||
GetCharacteristic(BluetoothCharacteristicMsg),
|
||||
GetCharacteristics(BluetoothCharacteristicsMsg),
|
||||
GetDescriptor(BluetoothDescriptorMsg),
|
||||
GetDescriptors(BluetoothDescriptorsMsg),
|
||||
ReadValue(Vec<u8>),
|
||||
WriteValue(Vec<u8>),
|
||||
}
|
||||
|
||||
pub trait BluetoothResponseListener {
|
||||
fn response(&mut self, response: BluetoothResponseResult);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue