diff options
author | Trygve Laugstøl <trygvis@inamo.no> | 2018-11-19 23:13:50 +0100 |
---|---|---|
committer | Trygve Laugstøl <trygvis@inamo.no> | 2018-11-19 23:13:50 +0100 |
commit | e8aa2eadf309fbc0c0e1418c6bee482e505fa09b (patch) | |
tree | e93292292834b8d8959301cd8d02b27090e7e0ca /apps/ble-read-characteristic.cpp | |
parent | d6f16958eaa966332b911eb9257b8524c2efd772 (diff) | |
download | ble-toys-e8aa2eadf309fbc0c0e1418c6bee482e505fa09b.tar.gz ble-toys-e8aa2eadf309fbc0c0e1418c6bee482e505fa09b.tar.bz2 ble-toys-e8aa2eadf309fbc0c0e1418c6bee482e505fa09b.tar.xz ble-toys-e8aa2eadf309fbc0c0e1418c6bee482e505fa09b.zip |
ble-read-characteristic: working READ mode, starting on NOTIFY.
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; |