diff options
Diffstat (limited to 'main.cpp')
-rw-r--r-- | main.cpp | 16 |
1 files changed, 7 insertions, 9 deletions
@@ -3,9 +3,9 @@ #include "Bluetooth.h" using namespace std; -using namespace trygvis; +using namespace trygvis::bluetooth; -static Mac *targetMac; +Mac *targetMac; void scan_callback(BluetoothDevice &device) { device.adapter().stopScan(); @@ -30,14 +30,14 @@ int main(int argc, char *argv[]) { return EXIT_FAILURE; } - BluetoothAdapter *adapter = nullptr; int e; // try { - targetMac = Mac::parseMac(argv[1]); + Mac mac = Mac::parseMac(argv[1]); + targetMac = &mac; - adapter = trygvis::getAdapter(0); + BluetoothAdapter &adapter = getAdapter(0); - BluetoothDevice &device = adapter->getDevice(*targetMac); + BluetoothDevice &device = adapter.getDevice(mac); scan_callback(device); @@ -52,8 +52,6 @@ int main(int argc, char *argv[]) { // e = EXIT_FAILURE; // } - if (adapter != nullptr) { - delete adapter; - } + shutdown(); return e; } |