diff options
Diffstat (limited to 'apps/ble-read-characteristic.cpp')
-rw-r--r-- | apps/ble-read-characteristic.cpp | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/apps/ble-read-characteristic.cpp b/apps/ble-read-characteristic.cpp index 19bbfa3..8a0a7b6 100644 --- a/apps/ble-read-characteristic.cpp +++ b/apps/ble-read-characteristic.cpp @@ -67,7 +67,7 @@ public: } int with_device(const shared_ptr<BluetoothDevice> &device, const Uuid &service_uuid, - const Uuid &characteristic_uuid) { + const Uuid &characteristic_uuid) { cout << "Connecting to device: " << device->getMac().str() << endl; auto gatt = device->connectGatt(); @@ -98,6 +98,12 @@ public: auto response = gatt->readValue(characteristic, buf); cout << "Got data, size=" << response.getSize() << endl; + } else if (op_mode == op::NOTIFY) { + auto cccd = characteristic.get()->getDescriptor(trygvis::bluetooth::uuids::CLIENT_CHARACTERISTIC_CONFIG); +// cccd->setValue(BluetoothGattDescriptor::ENABLE_NOTIFICATION_VALUE); + gatt->setCharacteristicNotification(cccd, true); + } else { + cout << "Unsupported op mode." << endl; } return EXIT_SUCCESS; |