26 #include <condition_variable> 29 #include "BluetoothObject.hpp" 32 using namespace tinyb;
34 typedef std::function<void (BluetoothObject &, void *)> BluetoothCallback;
39 std::string *identifier;
47 class BluetoothConditionVariable {
51 std::condition_variable cv;
54 std::atomic_bool triggered;
55 std::atomic_uint waiting;
57 BluetoothConditionVariable() : cv(), lock() {
64 if (result !=
nullptr)
68 std::unique_lock<std::mutex> lk(lock);
78 if (result !=
nullptr)
83 std::unique_lock<std::mutex> lk(lock);
84 cv.wait_for(lk, timeout);
97 ~BluetoothConditionVariable() {
103 BluetoothConditionVariable cv;
108 BluetoothEvent(BluetoothType type, std::string *name, std::string *identifier,
110 BluetoothCallback cb =
nullptr,
void *data = NULL);
113 BluetoothType get_type()
const {
117 std::string *get_name()
const {
121 std::string *get_identifier()
const {
130 bool has_callback() {
140 void wait(std::chrono::milliseconds timeout = std::chrono::milliseconds::zero());
Definition: BluetoothObject.hpp:63
Definition: BluetoothObject.hpp:32
Definition: BluetoothEvent.hpp:36