diff options
author | Trygve Laugstøl <trygvis@inamo.no> | 2015-06-30 14:37:06 +0200 |
---|---|---|
committer | Trygve Laugstøl <trygvis@inamo.no> | 2015-06-30 14:37:06 +0200 |
commit | 441cd0b11186d66493798551e1102eb246f1af9f (patch) | |
tree | 3cdb5b1dea6b782cbf59e172807f9dc15e7bd418 /ble/Bluetooth.cpp | |
parent | af63bd5688731b57551ac161c0dad26a0b4557d7 (diff) | |
download | ble-toys-441cd0b11186d66493798551e1102eb246f1af9f.tar.gz ble-toys-441cd0b11186d66493798551e1102eb246f1af9f.tar.bz2 ble-toys-441cd0b11186d66493798551e1102eb246f1af9f.tar.xz ble-toys-441cd0b11186d66493798551e1102eb246f1af9f.zip |
Getting started on a port to OSX.
Diffstat (limited to 'ble/Bluetooth.cpp')
-rw-r--r-- | ble/Bluetooth.cpp | 25 |
1 files changed, 19 insertions, 6 deletions
diff --git a/ble/Bluetooth.cpp b/ble/Bluetooth.cpp index 14a8cda..48fc87c 100644 --- a/ble/Bluetooth.cpp +++ b/ble/Bluetooth.cpp @@ -4,6 +4,12 @@ #include <sstream> #include <iomanip> +#if defined(IS_LINUX) +#include "LinuxBluetooth.h" +#elif defined(IS_APPLE) +#include "OsxBluetooth.h" +#endif + namespace trygvis { namespace bluetooth { using namespace std; @@ -201,19 +207,26 @@ BluetoothAdapter::BluetoothAdapter() { BluetoothAdapter::~BluetoothAdapter() { } +// ----------------------------------------------------------------------- +// BluetoothSystem +// ----------------------------------------------------------------------- + BluetoothSystem::BluetoothSystem() { } BluetoothSystem::~BluetoothSystem() { - shutdown(); } -shared_ptr<BluetoothAdapter> getAdapter(int hciDevice) { - return getAdapterImpl(hciDevice); -} +shared_ptr<BluetoothAdapter> BluetoothSystem::getAdapter(string adapter_name) { +#if defined(IS_LINUX) + typedef linux::LinuxBluetoothAdapter Impl; +#elif defined(IS_APPLE) + typedef osx::OsxBluetoothAdapter Impl; + + shared_ptr<Impl> adapter = osx::getAdapterImpl(); +#endif -void shutdown() { - shutdownImpl(); + return std::static_pointer_cast<BluetoothAdapter>(std::move(adapter)); } uuid_t makeUuid(const uuid_t base, uint8_t a, uint8_t b) { |