From 441cd0b11186d66493798551e1102eb246f1af9f Mon Sep 17 00:00:00 2001 From: Trygve Laugstøl Date: Tue, 30 Jun 2015 14:37:06 +0200 Subject: Getting started on a port to OSX. --- ble/Bluetooth.cpp | 25 +++++++++++++++++++------ 1 file changed, 19 insertions(+), 6 deletions(-) (limited to 'ble/Bluetooth.cpp') 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 #include +#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 getAdapter(int hciDevice) { - return getAdapterImpl(hciDevice); -} +shared_ptr BluetoothSystem::getAdapter(string adapter_name) { +#if defined(IS_LINUX) + typedef linux::LinuxBluetoothAdapter Impl; +#elif defined(IS_APPLE) + typedef osx::OsxBluetoothAdapter Impl; + + shared_ptr adapter = osx::getAdapterImpl(); +#endif -void shutdown() { - shutdownImpl(); + return std::static_pointer_cast(std::move(adapter)); } uuid_t makeUuid(const uuid_t base, uint8_t a, uint8_t b) { -- cgit v1.2.3