diff options
Diffstat (limited to 'apps/ble-inspect-device.cpp')
-rw-r--r-- | apps/ble-inspect-device.cpp | 10 |
1 files changed, 7 insertions, 3 deletions
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<string>()->required(), "The MAC of the device to inspect"); } - void scan_callback(const shared_ptr<BluetoothDevice> &device) { + void with_device(const shared_ptr<BluetoothDevice> &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) { |