(&mut self)
| 1298 | } |
| 1299 | |
| 1300 | async fn wait_for_message(&mut self) { |
| 1301 | select! { |
| 1302 | delegate_msg = self.delegate_receiver.select_next_some() => { |
| 1303 | match delegate_msg { |
| 1304 | // TODO We should probably also register some sort of |
| 1305 | // "ready" variable in our adapter that will cause scans/etc |
| 1306 | // to fail if this hasn't updated. |
| 1307 | CentralDelegateEvent::DidUpdateState{state} => { |
| 1308 | if state == CBManagerState::PoweredOff { |
| 1309 | self.on_adapter_powered_off().await; |
| 1310 | } |
| 1311 | self.dispatch_event(CoreBluetoothEvent::DidUpdateState{state}).await |
| 1312 | } |
| 1313 | CentralDelegateEvent::DiscoveredPeripheral{cbperipheral, advertisement_name} => { |
| 1314 | self.on_discovered_peripheral(cbperipheral, advertisement_name).await |
| 1315 | } |
| 1316 | CentralDelegateEvent::DiscoveredServices{peripheral_uuid, services} => { |
| 1317 | self.on_discovered_services(peripheral_uuid, services) |
| 1318 | } |
| 1319 | CentralDelegateEvent::DiscoveredCharacteristics{peripheral_uuid, service_uuid, characteristics} => { |
| 1320 | self.on_discovered_characteristics(peripheral_uuid, service_uuid, characteristics) |
| 1321 | } |
| 1322 | CentralDelegateEvent::DiscoveredCharacteristicDescriptors{peripheral_uuid, service_uuid, characteristic_uuid, descriptors} => { |
| 1323 | self.on_discovered_characteristic_descriptors(peripheral_uuid, service_uuid, characteristic_uuid, descriptors) |
| 1324 | } |
| 1325 | CentralDelegateEvent::ConnectedDevice{peripheral_uuid} => { |
| 1326 | self.on_peripheral_connect(peripheral_uuid) |
| 1327 | }, |
| 1328 | CentralDelegateEvent::ConnectionFailed{peripheral_uuid, error_description} => { |
| 1329 | self.on_peripheral_connection_failed(peripheral_uuid, error_description) |
| 1330 | }, |
| 1331 | CentralDelegateEvent::DisconnectedDevice{peripheral_uuid} => { |
| 1332 | self.on_peripheral_disconnect(peripheral_uuid).await |
| 1333 | } |
| 1334 | CentralDelegateEvent::CharacteristicSubscribed{ |
| 1335 | peripheral_uuid, |
| 1336 | service_uuid, |
| 1337 | characteristic_uuid, |
| 1338 | } => self.on_characteristic_subscribed(peripheral_uuid, service_uuid, characteristic_uuid), |
| 1339 | CentralDelegateEvent::CharacteristicUnsubscribed{ |
| 1340 | peripheral_uuid, |
| 1341 | service_uuid, |
| 1342 | characteristic_uuid, |
| 1343 | } => self.on_characteristic_unsubscribed(peripheral_uuid, service_uuid,characteristic_uuid), |
| 1344 | CentralDelegateEvent::CharacteristicNotified{ |
| 1345 | peripheral_uuid, |
| 1346 | service_uuid, |
| 1347 | characteristic_uuid, |
| 1348 | data, |
| 1349 | } => self.on_characteristic_read(peripheral_uuid, service_uuid,characteristic_uuid, data).await, |
| 1350 | CentralDelegateEvent::CharacteristicWritten{ |
| 1351 | peripheral_uuid, |
| 1352 | service_uuid, |
| 1353 | characteristic_uuid, |
| 1354 | } => self.on_characteristic_written(peripheral_uuid, service_uuid, characteristic_uuid), |
| 1355 | CentralDelegateEvent::ManufacturerData{peripheral_uuid, manufacturer_id, data, rssi} => { |
| 1356 | self.on_manufacturer_data(peripheral_uuid, manufacturer_id, data, rssi).await |
| 1357 | }, |
no outgoing calls
no test coverage detected