-
Notifications
You must be signed in to change notification settings - Fork 11
/
Copy pathble_gatt_server_callbacks.hpp
48 lines (39 loc) · 1.78 KB
/
ble_gatt_server_callbacks.hpp
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
42
43
44
45
46
47
48
#pragma once
#include <sdkconfig.h>
#if CONFIG_BT_NIMBLE_ENABLED || defined(_DOXYGEN_)
#include "NimBLEDevice.h"
namespace espp {
class BleGattServer;
/// Class for handling GATT server callbacks, as required by NimBLE
/// \note This class is not intended to be used directly by the user
class BleGattServerCallbacks : public NimBLEServerCallbacks {
public:
virtual void onConnect(NimBLEServer *server, NimBLEConnInfo &conn_info) override;
virtual void onDisconnect(NimBLEServer *server, NimBLEConnInfo &conn_info, int reason) override;
virtual void onAuthenticationComplete(NimBLEConnInfo &conn_info) override;
virtual uint32_t onPassKeyDisplay() override;
virtual void onConfirmPassKey(NimBLEConnInfo &conn_info, uint32_t pass_key) override;
protected:
friend class BleGattServer;
explicit BleGattServerCallbacks(BleGattServer *server)
: server_(server) {}
BleGattServer *server_{nullptr};
};
#if CONFIG_BT_NIMBLE_EXT_ADV || defined(_DOXYGEN_)
/// Class for handling GATT server advertising callbacks, as required by NimBLE
/// \note This class is not intended to be used directly by the user
/// \note This class is only available if CONFIG_BT_NIMBLE_EXT_ADV is enabled
class BleGattServerAdvertisingCallbacks : public NimBLEExtAdvertisingCallbacks {
public:
virtual void onStopped(NimBLEExtAdvertising *pAdv, int reason, uint8_t inst_id) override;
virtual void onScanRequest(NimBLEExtAdvertising *pAdv, uint8_t inst_id,
NimBLEAddress addr) override;
protected:
friend class BleGattServer;
explicit BleGattServerAdvertisingCallbacks(BleGattServer *server)
: server_(server) {}
BleGattServer *server_{nullptr};
};
#endif // CONFIG_BT_NIMBLE_EXT_ADV || defined(_DOXYGEN_)
} // namespace espp
#endif // CONFIG_BT_NIMBLE_ENABLED || defined(_DOXYGEN_)