aboutsummaryrefslogtreecommitdiff
path: root/apps/ble-inspect-device.cpp
diff options
context:
space:
mode:
authorTrygve Laugstøl <trygvis@inamo.no>2015-07-26 18:33:15 +0200
committerTrygve Laugstøl <trygvis@inamo.no>2015-07-26 18:41:40 +0200
commitd720fa36ad4768ed1b948a92ba5287c30093fbec (patch)
tree3d566e0d4ab47981af85a783f81ebbd363d57f15 /apps/ble-inspect-device.cpp
parent33c537c84fea53c899fb5275256518598f66101e (diff)
downloadble-toys-d720fa36ad4768ed1b948a92ba5287c30093fbec.tar.gz
ble-toys-d720fa36ad4768ed1b948a92ba5287c30093fbec.tar.bz2
ble-toys-d720fa36ad4768ed1b948a92ba5287c30093fbec.tar.xz
ble-toys-d720fa36ad4768ed1b948a92ba5287c30093fbec.zip
o Overhaul of the bluetooth code.
- Adding support for reading FLOAT (specified in IEEE 11073-20601) values from a bluetooth device. - More shared pointers to help keep track of the object's lifecycle. Makes sure that the connections are released back to Linux, Linux is way to sensitive with crashing applications. o Adding support for reading the temperature sensors from the SoilMoisture device.
Diffstat (limited to 'apps/ble-inspect-device.cpp')
-rw-r--r--apps/ble-inspect-device.cpp10
1 files changed, 5 insertions, 5 deletions
diff --git a/apps/ble-inspect-device.cpp b/apps/ble-inspect-device.cpp
index 6330512..2140e03 100644
--- a/apps/ble-inspect-device.cpp
+++ b/apps/ble-inspect-device.cpp
@@ -22,10 +22,10 @@ public:
options("device", po::value<string>()->required(), "The MAC of the device to inspect");
}
- void scan_callback(BluetoothDevice &device) {
- cout << "Inspecting device: " << device.getMac().str() << endl;
+ void scan_callback(const shared_ptr<BluetoothDevice> &device) {
+ cout << "Inspecting device: " << device->getMac().str() << endl;
- auto gatt = device.connectGatt();
+ auto gatt = device->connectGatt();
gatt->discoverServices();
@@ -53,9 +53,9 @@ public:
try {
Mac mac = Mac::parseMac(mac_str);
- shared_ptr<BluetoothAdapter> adapter = getAdapter(0);
+ auto adapter = bluetoothSystem.getAdapter("0");
- BluetoothDevice &device = adapter->getDevice(mac);
+ auto device = adapter->getDevice(mac);
scan_callback(device);