diff options
author | Trygve Laugstøl <trygvis@inamo.no> | 2015-06-21 00:15:04 +0200 |
---|---|---|
committer | Trygve Laugstøl <trygvis@inamo.no> | 2015-06-21 00:15:43 +0200 |
commit | c56840f03cf139d60c6d90b55cf16e70f6ae2bc2 (patch) | |
tree | c9f19ab065496ac704fbf855da031ef5643eefa3 /apps/ble-inspect-device.cpp | |
parent | d91e500592790f1ef22ebfe921f273a61ff6252f (diff) | |
download | ble-toys-c56840f03cf139d60c6d90b55cf16e70f6ae2bc2.tar.gz ble-toys-c56840f03cf139d60c6d90b55cf16e70f6ae2bc2.tar.bz2 ble-toys-c56840f03cf139d60c6d90b55cf16e70f6ae2bc2.tar.xz ble-toys-c56840f03cf139d60c6d90b55cf16e70f6ae2bc2.zip |
o Going all header file based and single-executable to launch all apps.
o Ading CMake magic to generate the launcher
Diffstat (limited to 'apps/ble-inspect-device.cpp')
-rw-r--r-- | apps/ble-inspect-device.cpp | 58 |
1 files changed, 0 insertions, 58 deletions
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 <exception> -#include <iostream> -#include <vector> -#include <boost/uuid/uuid_io.hpp> -#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<BluetoothGattService *> services = gatt.getServices(); - cout << "Device has " << services.size() << " services" << endl; - - for (auto &s: services) { - const vector<BluetoothGattCharacteristic *> 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; - } -} |