From fcf96a168ab6b0749244e5e13fdaaacc91238ce1 Mon Sep 17 00:00:00 2001 From: Kevron Rees Date: Wed, 15 Jan 2014 14:35:47 -0800 Subject: [PATCH] beginnings of bluez5 compat --- plugins/common/CMakeLists.txt | 4 +- plugins/common/bluetooth.hpp | 2 +- plugins/common/bluetooth5.cpp | 93 +++++++++++++++++++++++++++++++++++++++++++ plugins/common/bluetooth5.h | 13 ++++++ 4 files changed, 109 insertions(+), 3 deletions(-) create mode 100644 plugins/common/bluetooth5.cpp create mode 100644 plugins/common/bluetooth5.h diff --git a/plugins/common/CMakeLists.txt b/plugins/common/CMakeLists.txt index c9da1de..032379d 100644 --- a/plugins/common/CMakeLists.txt +++ b/plugins/common/CMakeLists.txt @@ -1,5 +1,5 @@ -set(plugins_common_sources abstractio.hpp serialport.hpp bluetoothadapterproxy.c bluetooth.hpp bluetoothmanagerproxy.c bluetoothserialproxy.c) -set(plugins_common_headers_install abstractio.hpp serialport.hpp bluetooth.hpp bluetoothadapterproxy.h bluetoothmanagerproxy.h bluetoothserialproxy.h) +set(plugins_common_sources abstractio.hpp serialport.hpp bluetoothadapterproxy.c bluetooth.hpp bluetoothmanagerproxy.c bluetoothserialproxy.c bluetooth5.cpp) +set(plugins_common_headers_install abstractio.hpp serialport.hpp bluetooth.hpp bluetoothadapterproxy.h bluetoothmanagerproxy.h bluetoothserialproxy.h bluetooth5.h) add_library(amb-plugins-common SHARED ${plugins_common_sources}) diff --git a/plugins/common/bluetooth.hpp b/plugins/common/bluetooth.hpp index ddc5f27..8886e3c 100644 --- a/plugins/common/bluetooth.hpp +++ b/plugins/common/bluetooth.hpp @@ -11,7 +11,7 @@ class BluetoothDevice { public: - std::string getDeviceForAddress( std::string address,std::string adapterAddy = "") + std::string getDeviceForAddress(std::string address, std::string adapterAddy = "") { GError* error = NULL; OrgBluezManager* manager = org_bluez_manager_proxy_new_for_bus_sync(G_BUS_TYPE_SYSTEM, diff --git a/plugins/common/bluetooth5.cpp b/plugins/common/bluetooth5.cpp new file mode 100644 index 0000000..fd6a644 --- /dev/null +++ b/plugins/common/bluetooth5.cpp @@ -0,0 +1,93 @@ +#include "bluetooth5.h" +#include "debugout.h" +#include +#include + +std::string findAdapterPath(std::string adapterAddy) +{ + std::string adapterObjectPath; + + GError * error = nullptr; + GDBusProxy * managerProxy = g_dbus_proxy_new_for_bus_sync(G_BUS_TYPE_SYSTEM, G_DBUS_PROXY_FLAGS_NONE, NULL, + "org.freedesktop.DBus", + "/", + "org.freedesktop.DBus.ObjectManager", + nullptr,&error); + + if(error) + { + DebugOut(DebugOut::Error)<<"Could not create ObjectManager proxy for Bluez: "<message<message< + +class Bluetooth5 +{ +public: + std::string getDeviceForAddress(std::string address, std::string adapterAddy = ""); + void disconnect(std::string address, std::string adapterAddy = ""); +}; + +#endif -- 2.7.4