-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbt_connection.h
More file actions
41 lines (28 loc) · 988 Bytes
/
Copy pathbt_connection.h
File metadata and controls
41 lines (28 loc) · 988 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
#ifndef LINUX_BT_CALLS_H
#define LINUX_BT_CALLS_H
#include "bt_enums.h"
#include <binc/adapter.h>
#include <functional>
#include <future>
#include <mutex>
class bt_connection {
public:
static bt_connection& instance();
bt_connection(const bt_connection&) = delete;
bt_connection& operator=(const bt_connection&) = delete;
std::future<bool> is_ble_secure_connection_available();
std::future<bool> is_peripheral_role_supported();
std::future<bool> is_bluetooth_active();
std::future<void> register_bt_listener(const std::function<void(bool)>& callback);
void unregister_bt_listener();
static bt_request_enable_status request_bt_enable();
private:
bt_connection();
~bt_connection();
static void on_adapter_powered_changed(Adapter* adapter, gboolean is_powered);
std::mutex m_mutex;
Adapter* m_adapter = nullptr;
std::function<void(bool)> m_onStatusChange;
bool m_isListenerRegistered = false;
};
#endif