ELEC-C7222
Libraries for ELEC C7222 Course Work
Loading...
Searching...
No Matches
gap_event_handler.hpp
Go to the documentation of this file.
1
18#pragma once
19
20#include <cstdint>
21#include <cstdio>
22
23#include "attribute_server.hpp"
24#include "gap.hpp"
25
37 public:
45 c7222::AttributeServer* attribute_server = nullptr);
46
53 void SetAttributeServer(c7222::AttributeServer* attribute_server);
54
56 void OnScanRequestReceived(uint8_t advertising_handle,
57 const c7222::BleAddress& scanner_address) const override;
59 void OnAdvertisingStart(uint8_t status) const override;
61 void OnAdvertisingEnd(uint8_t status,
62 c7222::ConnectionHandle connection_handle) const override;
64 void OnAdvertisingReport(const c7222::Gap::AdvertisingReport& report) const override;
67 const c7222::Gap::ExtendedAdvertisingReport& report) const override;
69 void OnScanTimeout(uint8_t status) const override;
71 void OnPeriodicAdvertisingSyncEstablished(uint8_t status,
72 c7222::ConnectionHandle sync_handle) const override;
75 int8_t tx_power,
76 int8_t rssi,
77 uint8_t data_status,
78 const uint8_t* data,
79 uint8_t data_length) const override;
81 void OnPeriodicAdvertisingSyncLoss(c7222::ConnectionHandle sync_handle) const override;
83 void OnConnectionComplete(uint8_t status,
84 c7222::ConnectionHandle con_handle,
85 const c7222::BleAddress& address,
86 uint16_t conn_interval,
87 uint16_t conn_latency,
88 uint16_t supervision_timeout) const override;
91 uint16_t min_interval,
92 uint16_t max_interval,
93 uint16_t latency,
94 uint16_t supervision_timeout) const override;
96 void OnConnectionParametersUpdateComplete(uint8_t status,
97 c7222::ConnectionHandle con_handle,
98 uint16_t conn_interval,
99 uint16_t conn_latency,
100 uint16_t supervision_timeout) const override;
102 void OnDisconnectionComplete(uint8_t status,
103 c7222::ConnectionHandle con_handle,
104 uint8_t reason) const override;
106 void OnReadPhy(uint8_t status,
107 c7222::ConnectionHandle con_handle,
108 c7222::Gap::Phy tx_phy,
109 c7222::Gap::Phy rx_phy) const override;
111 void OnPhyUpdateComplete(uint8_t status,
112 c7222::ConnectionHandle con_handle,
113 c7222::Gap::Phy tx_phy,
114 c7222::Gap::Phy rx_phy) const override;
117 uint16_t tx_size,
118 uint16_t rx_size) const override;
120 void OnPrivacyEnabled() const override;
123 uint8_t security_level) const override;
125 void OnDedicatedBondingCompleted(uint8_t status,
126 const c7222::BleAddress& address) const override;
128 void OnInquiryResult(const c7222::Gap::InquiryResult& result) const override;
130 void OnInquiryComplete(uint8_t status) const override;
132 void OnRssiMeasurement(c7222::ConnectionHandle con_handle, int8_t rssi) const override;
134 void OnLocalOobData(bool oob_data_present,
135 const uint8_t* c_192,
136 const uint8_t* r_192,
137 const uint8_t* c_256,
138 const uint8_t* r_256) const override;
141 const c7222::BleAddress& address,
142 bool ssp,
143 bool initiator) const override;
146 const c7222::BleAddress& address,
147 uint8_t status) const override;
148
149 private:
150 c7222::Gap* gap_ = nullptr;
151 c7222::AttributeServer* attribute_server_ = nullptr;
152};
Minimal GAP event handler for example applications.
Definition gap_event_handler.hpp:36
void OnInquiryResult(const c7222::Gap::InquiryResult &result) const override
Logs inquiry results.
Definition gap_event_handler.cpp:215
void OnConnectionParametersUpdateComplete(uint8_t status, c7222::ConnectionHandle con_handle, uint16_t conn_interval, uint16_t conn_latency, uint16_t supervision_timeout) const override
Logs completion of connection parameter updates.
Definition gap_event_handler.cpp:114
void OnSecurityLevel(c7222::ConnectionHandle con_handle, uint8_t security_level) const override
Logs the negotiated security level.
Definition gap_event_handler.cpp:178
void OnPairingComplete(c7222::ConnectionHandle con_handle, const c7222::BleAddress &address, uint8_t status) const override
Logs completion of pairing.
Definition gap_event_handler.cpp:254
void OnDisconnectionComplete(uint8_t status, c7222::ConnectionHandle con_handle, uint8_t reason) const override
Logs disconnections and restarts advertising.
Definition gap_event_handler.cpp:130
void OnPrivacyEnabled() const override
Logs that privacy mode has been enabled.
Definition gap_event_handler.cpp:174
void OnPairingStarted(c7222::ConnectionHandle con_handle, const c7222::BleAddress &address, bool ssp, bool initiator) const override
Logs the start of pairing.
Definition gap_event_handler.cpp:243
void OnAdvertisingStart(uint8_t status) const override
Logs the start of advertising.
Definition gap_event_handler.cpp:18
void OnScanRequestReceived(uint8_t advertising_handle, const c7222::BleAddress &scanner_address) const override
Logs scan requests received by the advertiser.
Definition gap_event_handler.cpp:12
void SetAttributeServer(c7222::AttributeServer *attribute_server)
Attach an attribute server after construction.
Definition gap_event_handler.cpp:7
void OnLocalOobData(bool oob_data_present, const uint8_t *c_192, const uint8_t *r_192, const uint8_t *c_256, const uint8_t *r_256) const override
Logs presence of local OOB data.
Definition gap_event_handler.cpp:231
void OnDedicatedBondingCompleted(uint8_t status, const c7222::BleAddress &address) const override
Logs completion of dedicated bonding.
Definition gap_event_handler.cpp:209
void OnDataLengthChange(c7222::ConnectionHandle con_handle, uint16_t tx_size, uint16_t rx_size) const override
Logs data length changes.
Definition gap_event_handler.cpp:165
void OnPeriodicAdvertisingReport(c7222::ConnectionHandle sync_handle, int8_t tx_power, int8_t rssi, uint8_t data_status, const uint8_t *data, uint8_t data_length) const override
Logs a periodic advertising report.
Definition gap_event_handler.cpp:55
void OnPeriodicAdvertisingSyncLoss(c7222::ConnectionHandle sync_handle) const override
Logs loss of periodic advertising sync.
Definition gap_event_handler.cpp:71
void OnPeriodicAdvertisingSyncEstablished(uint8_t status, c7222::ConnectionHandle sync_handle) const override
Logs periodic advertising sync establishment.
Definition gap_event_handler.cpp:47
void OnRssiMeasurement(c7222::ConnectionHandle con_handle, int8_t rssi) const override
Logs RSSI measurements.
Definition gap_event_handler.cpp:225
void OnUpdateConnectionParametersRequest(c7222::ConnectionHandle con_handle, uint16_t min_interval, uint16_t max_interval, uint16_t latency, uint16_t supervision_timeout) const override
Logs a request to update connection parameters.
Definition gap_event_handler.cpp:99
void OnAdvertisingEnd(uint8_t status, c7222::ConnectionHandle connection_handle) const override
Logs the end of advertising.
Definition gap_event_handler.cpp:23
void OnPhyUpdateComplete(uint8_t status, c7222::ConnectionHandle con_handle, c7222::Gap::Phy tx_phy, c7222::Gap::Phy rx_phy) const override
Logs PHY update completion.
Definition gap_event_handler.cpp:154
void OnReadPhy(uint8_t status, c7222::ConnectionHandle con_handle, c7222::Gap::Phy tx_phy, c7222::Gap::Phy rx_phy) const override
Logs PHY read results.
Definition gap_event_handler.cpp:143
void OnConnectionComplete(uint8_t status, c7222::ConnectionHandle con_handle, const c7222::BleAddress &address, uint16_t conn_interval, uint16_t conn_latency, uint16_t supervision_timeout) const override
Logs new connections and updates the attribute server handle.
Definition gap_event_handler.cpp:76
void OnExtendedAdvertisingReport(const c7222::Gap::ExtendedAdvertisingReport &report) const override
Logs extended advertising reports.
Definition gap_event_handler.cpp:36
void OnScanTimeout(uint8_t status) const override
Logs a scan timeout event.
Definition gap_event_handler.cpp:43
void OnInquiryComplete(uint8_t status) const override
Logs completion of inquiry.
Definition gap_event_handler.cpp:221
void OnAdvertisingReport(const c7222::Gap::AdvertisingReport &report) const override
Logs legacy advertising reports.
Definition gap_event_handler.cpp:29
Encapsulates the ATT attribute server for the Pico W BLE stack.
Definition attribute_server.hpp:138
BLE address container with an associated address type.
Definition ble_address.hpp:43
Manages Generic Access Profile (GAP) functionality for BLE.
Definition gap.hpp:210
static Gap * GetInstance()
Get the singleton instance.
Phy
LE PHY values reported in extended advertising reports.
Definition gap.hpp:385
Provides a C++ wrapper for the BTstack Generic Access Profile (GAP).
uint16_t ConnectionHandle
Definition gap.hpp:23
Definition gap.hpp:484
Definition gap.hpp:617
Definition gap.hpp:556