Implement GetGATTChildren

This commit is contained in:
Attila Dusnoki 2016-12-15 08:06:42 +01:00
parent 0bc8415485
commit b0103682fa
6 changed files with 258 additions and 705 deletions

View file

@ -26,6 +26,14 @@ pub enum BluetoothError {
InvalidState,
}
#[derive(Deserialize, Serialize)]
pub enum GATTType {
PrimaryService,
Characteristic,
IncludedService,
Descriptor,
}
#[derive(Deserialize, Serialize)]
pub struct BluetoothDeviceMsg {
// Bluetooth Device properties
@ -78,14 +86,7 @@ pub enum BluetoothRequest {
RequestDevice(RequestDeviceoptions, IpcSender<BluetoothResponseResult>),
GATTServerConnect(String, IpcSender<BluetoothResponseResult>),
GATTServerDisconnect(String, 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>),
GetGATTChildren(String, Option<String>, bool, GATTType, IpcSender<BluetoothResponseResult>),
ReadValue(String, IpcSender<BluetoothResponseResult>),
WriteValue(String, Vec<u8>, IpcSender<BluetoothResponseResult>),
EnableNotification(String, bool, IpcSender<BluetoothResponseResult>),
@ -98,14 +99,10 @@ pub enum BluetoothRequest {
pub enum BluetoothResponse {
RequestDevice(BluetoothDeviceMsg),
GATTServerConnect(bool),
GetPrimaryService(BluetoothServiceMsg),
GetPrimaryServices(BluetoothServicesMsg),
GetIncludedService(BluetoothServiceMsg),
GetIncludedServices(BluetoothServicesMsg),
GetCharacteristic(BluetoothCharacteristicMsg),
GetCharacteristics(BluetoothCharacteristicsMsg),
GetDescriptor(BluetoothDescriptorMsg),
GetDescriptors(BluetoothDescriptorsMsg),
GetPrimaryServices(BluetoothServicesMsg, bool),
GetIncludedServices(BluetoothServicesMsg, bool),
GetCharacteristics(BluetoothCharacteristicsMsg, bool),
GetDescriptors(BluetoothDescriptorsMsg, bool),
ReadValue(Vec<u8>),
WriteValue(Vec<u8>),
EnableNotification(()),