MCPcopy Create free account
hub / github.com/deviceplug/btleplug / value_notification

Function value_notification

src/bluez/peripheral.rs:307–327  ·  view source on GitHub ↗
(
    event: BluetoothEvent,
    device_id: &DeviceId,
    services: Arc<Mutex<HashMap<Uuid, ServiceInternal>>>,
)

Source from the content-addressed store, hash-verified

305}
306
307fn value_notification(
308 event: BluetoothEvent,
309 device_id: &DeviceId,
310 services: Arc<Mutex<HashMap<Uuid, ServiceInternal>>>,
311) -> Option<ValueNotification> {
312 match event {
313 BluetoothEvent::Characteristic {
314 id,
315 event: CharacteristicEvent::Value { value },
316 } if id.service().device() == *device_id => {
317 let services = services.lock().unwrap();
318 let (charac, service) = find_characteristic_by_id(&services, id.clone())?;
319 Some(ValueNotification {
320 uuid: charac.uuid,
321 service_uuid: service.uuid,
322 value,
323 })
324 }
325 _ => None,
326 }
327}
328
329fn find_characteristic_by_id(
330 services: &HashMap<Uuid, ServiceInternal>,

Callers 1

notificationsMethod · 0.85

Calls 1

Tested by

no test coverage detected