Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(ble_gatt_server): fix ble gatt server compile fail when BLE disabled #185

Merged
merged 1 commit into from
Mar 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions components/ble_gatt_server/src/ble_gatt_server.cpp
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
#include "ble_gatt_server.hpp"
#include "ble_gatt_server_callbacks.hpp"

using namespace espp;

#if CONFIG_BT_NIMBLE_ENABLED || defined(_DOXYGEN_)

#if !CONFIG_BT_NIMBLE_EXT_ADV

using namespace espp;

// LEGACY ADV

void BleGattServer::set_advertisement_data(const AdvertisedData &advertising_data) {
Expand Down
22 changes: 12 additions & 10 deletions components/ble_gatt_server/src/ble_gatt_server_callbacks.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,32 +3,34 @@

#if CONFIG_BT_NIMBLE_ENABLED || defined(_DOXYGEN_)

void espp::BleGattServerCallbacks::onConnect(NimBLEServer *server, NimBLEConnInfo &conn_info) {
using namespace espp;

void BleGattServerCallbacks::onConnect(NimBLEServer *server, NimBLEConnInfo &conn_info) {
if (server_ && server_->callbacks_.connect_callback) {
server_->callbacks_.connect_callback(conn_info);
}
}

void espp::BleGattServerCallbacks::onDisconnect(NimBLEServer *server, NimBLEConnInfo &conn_info,
int reason) {
void BleGattServerCallbacks::onDisconnect(NimBLEServer *server, NimBLEConnInfo &conn_info,
int reason) {
if (server_ && server_->callbacks_.disconnect_callback) {
server_->callbacks_.disconnect_callback(conn_info);
}
}

void espp::BleGattServerCallbacks::onAuthenticationComplete(NimBLEConnInfo &conn_info) {
void BleGattServerCallbacks::onAuthenticationComplete(NimBLEConnInfo &conn_info) {
if (server_ && server_->callbacks_.authentication_complete_callback) {
server_->callbacks_.authentication_complete_callback(conn_info);
}
}
uint32_t espp::BleGattServerCallbacks::onPassKeyRequest() {
uint32_t BleGattServerCallbacks::onPassKeyRequest() {
if (server_ && server_->callbacks_.get_passkey_callback) {
return server_->callbacks_.get_passkey_callback();
} else {
return NimBLEDevice::getSecurityPasskey();
}
}
bool espp::BleGattServerCallbacks::onConfirmPIN(uint32_t pass_key) {
bool BleGattServerCallbacks::onConfirmPIN(uint32_t pass_key) {
if (server_ && server_->callbacks_.confirm_passkey_callback) {
return server_->callbacks_.confirm_passkey_callback(pass_key);
} else {
Expand All @@ -38,15 +40,15 @@ bool espp::BleGattServerCallbacks::onConfirmPIN(uint32_t pass_key) {

#if CONFIG_BT_NIMBLE_EXT_ADV || defined(_DOXYGEN_)

void espp::BleGattServerAdvertisingCallbacks::onStopped(NimBLEExtAdvertising *pAdv, int reason,
uint8_t inst_id) {
void BleGattServerAdvertisingCallbacks::onStopped(NimBLEExtAdvertising *pAdv, int reason,
uint8_t inst_id) {
if (server_ && server_->callbacks_.advertisement_stopped_callback) {
server_->callbacks_.advertisement_stopped_callback(pAdv, reason, inst_id);
}
}

void espp::BleGattServerAdvertisingCallbacks::onScanRequest(NimBLEExtAdvertising *pAdv,
uint8_t inst_id, NimBLEAddress addr) {
void BleGattServerAdvertisingCallbacks::onScanRequest(NimBLEExtAdvertising *pAdv, uint8_t inst_id,
NimBLEAddress addr) {
if (server_ && server_->callbacks_.scan_request_callback) {
server_->callbacks_.scan_request_callback(pAdv, inst_id, addr);
}
Expand Down
4 changes: 2 additions & 2 deletions components/ble_gatt_server/src/ble_gatt_server_ext_adv.cpp
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
#include "ble_gatt_server.hpp"
#include "ble_gatt_server_callbacks.hpp"

using namespace espp;

#if CONFIG_BT_NIMBLE_ENABLED || defined(_DOXYGEN_)

#if CONFIG_BT_NIMBLE_EXT_ADV || defined(_DOXYGEN_)

using namespace espp;

// EXTENDED ADV

void BleGattServer::set_advertisement_data(const AdvertisedData &advertising_data,
Expand Down
Loading