ArduinoBLE - bleCharacteristic.subscribed()

Query if the characteristic has been subscribed to by another Bluetooth® Low Energy device.

Syntax

bleCharacteristic.subscribed()

Parameters

None

Returns

  • true if the characteristic value has been subscribed to by another Bluetooth® Low Energy device,
  • false otherwise

Example


// Bluetooth® Low Energy Battery Level Characteristic
BLEUnsignedCharCharacteristic batteryLevelChar("2A19",  // standard 16-bit characteristic UUID
    BLERead | BLENotify); // remote clients will be able to get notifications if this characteristic changes





  if (batteryLevelChar.subscribed()) {
     // set a new value , that well be pushed to subscribed Bluetooth® Low Energy devices
    batteryLevelChar.writeValue(0xab);
  }