From 52450ed3034b0ba058ea2c9f9baa2d5f78df6a94 Mon Sep 17 00:00:00 2001 From: Trygve Laugstøl Date: Sat, 17 Nov 2018 22:38:32 +0100 Subject: apps/ble-bts: o Adding start of health termometer service tool. apps/ble-read-characteristic: o Sart of new tool. apps/ble-inspect-device o Make adapter configurable. other: o UUID fixes and tests. --- apps/ble-inspect-device.cpp | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'apps/ble-inspect-device.cpp') diff --git a/apps/ble-inspect-device.cpp b/apps/ble-inspect-device.cpp index 883faed..a06d86a 100644 --- a/apps/ble-inspect-device.cpp +++ b/apps/ble-inspect-device.cpp @@ -18,11 +18,15 @@ public: ~ble_inspect_device() override = default; + string adapter_name; + void add_options(po::options_description_easy_init &options) override { + auto adapter_value = po::value<>(&adapter_name)->default_value("0"); + options("adapter", adapter_value, "Which adapter to use."); options("device", po::value()->required(), "The MAC of the device to inspect"); } - void scan_callback(const shared_ptr &device) { + void with_device(const shared_ptr &device) { cout << "Inspecting device: " << device->getMac().str() << endl; auto gatt = device->connectGatt(); @@ -54,11 +58,11 @@ public: try { Mac mac = Mac::parseMac(mac_str); - auto adapter = bluetoothSystem.getAdapter("0"); + auto adapter = bluetoothSystem.getAdapter(adapter_name); auto device = adapter->getDevice(mac); - scan_callback(device); + with_device(device); return EXIT_SUCCESS; } catch (std::runtime_error &ex) { -- cgit v1.2.3