aboutsummaryrefslogtreecommitdiff
path: root/apps/ble-read-characteristic.cpp
diff options
context:
space:
mode:
authorTrygve Laugstøl <trygvis@inamo.no>2018-11-23 09:40:48 +0100
committerTrygve Laugstøl <trygvis@inamo.no>2018-11-23 09:40:48 +0100
commit2034b1bb10720a2f0e6cc97427346f2320c115bc (patch)
treec382c6e404d48078aac71e2fd3f7f34587b99e7b /apps/ble-read-characteristic.cpp
parent0e2228fae626ec617a6a1f042ceb6dbdbd774558 (diff)
downloadble-toys-2034b1bb10720a2f0e6cc97427346f2320c115bc.tar.gz
ble-toys-2034b1bb10720a2f0e6cc97427346f2320c115bc.tar.bz2
ble-toys-2034b1bb10720a2f0e6cc97427346f2320c115bc.tar.xz
ble-toys-2034b1bb10720a2f0e6cc97427346f2320c115bc.zip
o Starting to handle notifications and indications
Cleaning up: o Using more of the shared_ptr typedefs. o Adding code styles used by CLion.
Diffstat (limited to 'apps/ble-read-characteristic.cpp')
-rw-r--r--apps/ble-read-characteristic.cpp8
1 files changed, 6 insertions, 2 deletions
diff --git a/apps/ble-read-characteristic.cpp b/apps/ble-read-characteristic.cpp
index 8efcb3b..ecdb471 100644
--- a/apps/ble-read-characteristic.cpp
+++ b/apps/ble-read-characteristic.cpp
@@ -109,8 +109,12 @@ public:
cccd->setValue(ByteBuffer::wrapInitialized(BluetoothGattDescriptor::ENABLE_NOTIFICATION_VALUE));
gatt->write(cccd);
- cout << "sleeping" << endl;
- std::this_thread::sleep_for(10s);
+ auto end = std::chrono::system_clock::now() + 10s;
+
+ do {
+ cerr << "Processing messages" << endl;
+ gatt->process(2s);
+ } while(std::chrono::system_clock::now() < end);
}
} else {
cout << "Unsupported op mode." << endl;