From c56840f03cf139d60c6d90b55cf16e70f6ae2bc2 Mon Sep 17 00:00:00 2001 From: Trygve Laugstøl Date: Sun, 21 Jun 2015 00:15:04 +0200 Subject: o Going all header file based and single-executable to launch all apps. o Ading CMake magic to generate the launcher --- apps/ble-inspect-device.cpp | 58 --------------------------------------------- 1 file changed, 58 deletions(-) delete mode 100644 apps/ble-inspect-device.cpp (limited to 'apps/ble-inspect-device.cpp') diff --git a/apps/ble-inspect-device.cpp b/apps/ble-inspect-device.cpp deleted file mode 100644 index e4e7113..0000000 --- a/apps/ble-inspect-device.cpp +++ /dev/null @@ -1,58 +0,0 @@ -#include -#include -#include -#include -#include "ble/Bluetooth.h" - -using namespace std; -using namespace trygvis::bluetooth; - -void scan_callback(BluetoothDevice &device) { - cout << "Inspecting device: " << device.getMac().str() << endl; - - auto &gatt = device.connectGatt(); - - gatt.discoverServices(); - - vector services = gatt.getServices(); - cout << "Device has " << services.size() << " services" << endl; - - for (auto &s: services) { - const vector characteristics = s->getCharacteristics(); - - cout << "Service: UUID: " << s->getUuid() << ", has " << characteristics.size() << " characteristics" << endl; - - for (auto &c: characteristics) { - cout << "Characteristic: UUID: " << c->getUuid() << ", properties: " << (int) c->getProperties() << endl; - } - } - - gatt.disconnect(); -} - -int main(int argc, char *argv[]) { - if (argc != 2) { - cerr << "usage: " << argv[0] << " [mac]" << endl; - return EXIT_FAILURE; - } - - BluetoothSystem bluetoothSystem; - - try { - Mac mac = Mac::parseMac(argv[1]); - - BluetoothAdapter &adapter = getAdapter(0); - - BluetoothDevice &device = adapter.getDevice(mac); - - scan_callback(device); - - return EXIT_SUCCESS; - } catch (std::runtime_error ex) { - cout << "std::runtime_error: " << ex.what() << endl; - return EXIT_FAILURE; - } catch (std::exception ex) { - cout << "std::exception: " << ex.what() << endl; - return EXIT_FAILURE; - } -} -- cgit v1.2.3