diff options
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) { |