26 #include "BluetoothObject.hpp" 27 #include "BluetoothEvent.hpp" 38 friend class BluetoothEventManager;
41 std::unique_ptr<BluetoothAdapter> default_adapter;
43 std::list<std::shared_ptr<BluetoothEvent>> event_list;
50 void handle_event(BluetoothType type, std::string *name,
55 static std::string java_class() {
56 return std::string(JAVA_PACKAGE
"/BluetoothManager");
59 static std::string get_api_version();
60 static std::string get_library_version();
76 void add_event(std::shared_ptr<BluetoothEvent> &event) {
77 event_list.push_back(event);
83 event_list.remove(event);
87 for(
auto it = event_list.begin(); it != event_list.end(); ++it) {
88 if ((*it).get() == &event) {
89 event_list.remove(*it);
113 std::unique_ptr<T>
find(std::string *name,
115 std::chrono::milliseconds timeout = std::chrono::milliseconds::zero())
117 std::unique_ptr<BluetoothObject> obj =
find(T::class_type(), name, identifier, parent, timeout);
118 T *t =
dynamic_cast<T *
>(obj.release());
119 return std::unique_ptr<T>(t);
141 std::unique_ptr<BluetoothObject>
find(BluetoothType type, std::string *name,
143 std::chrono::milliseconds timeout = std::chrono::milliseconds::zero());
162 std::weak_ptr<BluetoothEvent>
find(BluetoothType type, std::string *name,
163 std::string* identifier,
BluetoothObject *parent, BluetoothCallback cb,
164 bool execute_once =
true,
165 std::chrono::milliseconds timeout = std::chrono::milliseconds::zero());
181 std::unique_ptr<BluetoothObject>
get_object(BluetoothType type,
198 std::vector<std::unique_ptr<BluetoothObject>>
get_objects(
199 BluetoothType type = BluetoothType::NONE,
200 std::string *name =
nullptr, std::string *identifier =
nullptr,
206 std::vector<std::unique_ptr<BluetoothAdapter>>
get_adapters(
212 std::vector<std::unique_ptr<BluetoothDevice>>
get_devices(
218 std::vector<std::unique_ptr<BluetoothGattService>>
get_services(
228 std::unique_ptr<BluetoothAdapter> get_default_adapter();
Definition: BluetoothObject.hpp:63
std::unique_ptr< BluetoothObject > get_object(BluetoothType type, std::string *name, std::string *identifier, BluetoothObject *parent)
std::vector< std::unique_ptr< BluetoothDevice > > get_devices()
virtual BluetoothType get_bluetooth_type() const
virtual std::string get_class_name() const
Definition: BluetoothAdapter.hpp:41
static BluetoothManager * get_bluetooth_manager()
std::unique_ptr< T > find(std::string *name, std::string *identifier, BluetoothObject *parent, std::chrono::milliseconds timeout=std::chrono::milliseconds::zero())
Definition: BluetoothManager.hpp:113
void add_event(std::shared_ptr< BluetoothEvent > &event)
Definition: BluetoothManager.hpp:76
Definition: BluetoothGattService.hpp:41
virtual std::string get_java_class() const
virtual std::string get_object_path() const
Definition: BluetoothManager.hpp:31
std::vector< std::unique_ptr< BluetoothGattService > > get_services()
void remove_event(std::shared_ptr< BluetoothEvent > &event)
Definition: BluetoothManager.hpp:82
bool set_default_adapter(BluetoothAdapter &adapter)
std::vector< std::unique_ptr< BluetoothObject > > get_objects(BluetoothType type=BluetoothType::NONE, std::string *name=nullptr, std::string *identifier=nullptr, BluetoothObject *parent=nullptr)
Definition: BluetoothGattCharacteristic.hpp:44
Definition: BluetoothDevice.hpp:45
Definition: BluetoothEvent.hpp:36
Definition: BluetoothGattDescriptor.hpp:40
std::vector< std::unique_ptr< BluetoothAdapter > > get_adapters()