diff options
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; - } -} |