Skip to content

BLE Notifications

The BLE Device Service implements a notification feature which sends events whenever data changes.

Note

The isNotification and deviceResource attributes must be set to enable notifications for a device resource.

When a notification is enabled, the Device Service automatically pushes the received data to core data. Event readings from the device resource are published to Edge Xpert until notifications are disabled.

The following extract from the CC2650 device profile shows how notifications are enabled:

deviceResources:
  - description: I/OConfiguration
    name: CC2650HumidityData
    properties:
      valueType: Uint64
      readWrite: R
    attributes:
      characteristicUuid: f000aa21-0451-4000-b000-000000000000
      startByte: 2

  - description: Humidity notification
    name: CC2650HumidityNotification
    isHidden: false
    properties:
      valueType: Bool
      readWrite: RW
    attributes:
      deviceResource: CC2650HumidityData
      isNotification: true

Multiple Device Resources with Identical UUID

Some devices return multiple values as a bit string for the same UUID.

The BLE Device Service supports this behavior using multiple notification device resources, each specifying a single device resource in the attributes.

The notification device resources can be activated in sequential calls to the Device Service, or in a single device command.

The following example shows two device resources with the same UUID as defined in a device profile:

deviceResources:
  - description: I/O Configuration
    name: CC2650HumidityData
    properties:
      valueType: Uint64
      readWrite: R
    attributes:
      characteristicUuid: f000aa21-0451-4000-b000-000000000000
      startByte: 2

  - description: Humidity notification
    name: CC2650HumidityNotification
    isHidden: false
    properties:
      valueType: Bool
      readWrite: RW
    attributes:
      deviceResource: CC2650HumidityData
      isNotification: true

  - description: I/O Configuration
    name: CC2650TemperatureData
    properties:
      valueType: Uint64
      readWrite: R
    attributes:
      characteristicUuid: f000aa21-0451-4000-b000-000000000000
      startByte: 1
      rawType: Uint16

  - description: Temperature notification
    name: CC2650TemperatureNotification
    isHidden: false
    properties:
      valueType: Bool
      readWrite: RW
    attributes:
      deviceResource: CC2650TemperatureData
      isNotification: true