mirror of
https://github.com/h2zero/esp-nimble-cpp.git
synced 2024-11-24 22:20:55 +01:00
Remove const from NimBLEConnInfo references in callbacks.
The use of const is a unnecessary breaking change as there is nothing that can be changed in the class.
This commit is contained in:
parent
2d3ff4922e
commit
031ba8f437
19 changed files with 113 additions and 112 deletions
1
.github/workflows/build.yml
vendored
1
.github/workflows/build.yml
vendored
|
@ -6,6 +6,7 @@ on:
|
|||
push:
|
||||
branches:
|
||||
- master
|
||||
- remove-conninfo-const
|
||||
|
||||
jobs:
|
||||
build-esp-idf-component:
|
||||
|
|
|
@ -383,13 +383,13 @@ The security callback methods are now incorporated in the `NimBLEServerCallbacks
|
|||
|
||||
The callback methods are:
|
||||
|
||||
> `bool onConfirmPIN(const NimBLEConnInfo& connInfo, uint32_t pin)`
|
||||
> `bool onConfirmPIN(NimBLEConnInfo& connInfo, uint32_t pin)`
|
||||
|
||||
Receives the pin when using numeric comparison authentication.
|
||||
Call `NimBLEDevice::injectConfirmPIN(connInfo, true);` to accept or `NimBLEDevice::injectConfirmPIN(connInfo, false);` to reject.
|
||||
<br/>
|
||||
|
||||
> `void onPassKeyEntry(const NimBLEConnInfo& connInfo)`
|
||||
> `void onPassKeyEntry(NimBLEConnInfo& connInfo)`
|
||||
|
||||
Client callback; client should respond with the passkey (pin) by calling `NimBLEDevice::injectPassKey(connInfo, 123456);`
|
||||
<br/>
|
||||
|
@ -399,7 +399,7 @@ Client callback; client should respond with the passkey (pin) by calling `NimBLE
|
|||
Server callback; should return the passkey (pin) expected from the client.
|
||||
<br/>
|
||||
|
||||
> `void onAuthenticationComplete(const NimBLEConnInfo& connInfo)`
|
||||
> `void onAuthenticationComplete(NimBLEConnInfo& connInfo)`
|
||||
|
||||
Authentication complete, success or failed information is available from the `NimBLEConnInfo` methods.
|
||||
<br/>
|
||||
|
|
|
@ -39,7 +39,7 @@ class ClientCallbacks : public NimBLEClientCallbacks {
|
|||
|
||||
/********************* Security handled here **********************
|
||||
****** Note: these are the same return values as defaults ********/
|
||||
void onPassKeyEntry(const NimBLEConnInfo& connInfo){
|
||||
void onPassKeyEntry(NimBLEConnInfo& connInfo){
|
||||
printf("Server Passkey Entry\n");
|
||||
/** This should prompt the user to enter the passkey displayed
|
||||
* on the peer device.
|
||||
|
@ -47,14 +47,14 @@ class ClientCallbacks : public NimBLEClientCallbacks {
|
|||
NimBLEDevice::injectPassKey(connInfo, 123456);
|
||||
};
|
||||
|
||||
void onConfirmPIN(const NimBLEConnInfo& connInfo, uint32_t pass_key){
|
||||
void onConfirmPIN(NimBLEConnInfo& connInfo, uint32_t pass_key){
|
||||
printf("The passkey YES/NO number: %" PRIu32 "\n", pass_key);
|
||||
/** Inject false if passkeys don't match. */
|
||||
NimBLEDevice::injectConfirmPIN(connInfo, true);
|
||||
};
|
||||
|
||||
/** Pairing process complete, we can check the results in connInfo */
|
||||
void onAuthenticationComplete(const NimBLEConnInfo& connInfo){
|
||||
void onAuthenticationComplete(NimBLEConnInfo& connInfo){
|
||||
if(!connInfo.isEncrypted()) {
|
||||
printf("Encrypt connection failed - disconnecting\n");
|
||||
/** Find the client with the connection handle provided in desc */
|
||||
|
|
|
@ -52,13 +52,13 @@ class ServerCallbacks: public NimBLEServerCallbacks {
|
|||
return 123456;
|
||||
};
|
||||
|
||||
void onConfirmPIN(const NimBLEConnInfo& connInfo, uint32_t pass_key){
|
||||
void onConfirmPIN(NimBLEConnInfo& connInfo, uint32_t pass_key){
|
||||
printf("The passkey YES/NO number: %" PRIu32 "\n", pass_key);
|
||||
/** Inject false if passkeys don't match. */
|
||||
NimBLEDevice::injectConfirmPIN(connInfo, true);
|
||||
};
|
||||
|
||||
void onAuthenticationComplete(const NimBLEConnInfo& connInfo){
|
||||
void onAuthenticationComplete(NimBLEConnInfo& connInfo){
|
||||
/** Check that encryption was successful, if not we disconnect the client */
|
||||
if(!connInfo.isEncrypted()) {
|
||||
NimBLEDevice::getServer()->disconnect(connInfo.getConnHandle());
|
||||
|
|
|
@ -25,7 +25,7 @@ class ServerCallbacks : public NimBLEServerCallbacks {
|
|||
}
|
||||
|
||||
// Same as before but now includes the name parameter
|
||||
void onAuthenticationComplete(const NimBLEConnInfo& connInfo, const std::string& name) override {
|
||||
void onAuthenticationComplete(NimBLEConnInfo& connInfo, const std::string& name) override {
|
||||
if (!connInfo.isEncrypted()) {
|
||||
NimBLEDevice::getServer()->disconnect(connInfo.getConnHandle());
|
||||
printf("Encrypt connection failed - disconnecting client\n");
|
||||
|
|
|
@ -51,7 +51,7 @@ class MyClientCallback : public BLEClientCallbacks {
|
|||
}
|
||||
/***************** New - Security handled here ********************
|
||||
****** Note: these are the same return values as defaults ********/
|
||||
void onPassKeyEntry(const NimBLEConnInfo& connInfo){
|
||||
void onPassKeyEntry(NimBLEConnInfo& connInfo){
|
||||
printf("Server Passkey Entry\n");
|
||||
/** This should prompt the user to enter the passkey displayed
|
||||
* on the peer device.
|
||||
|
@ -59,14 +59,14 @@ class MyClientCallback : public BLEClientCallbacks {
|
|||
NimBLEDevice::injectPassKey(connInfo, 123456);
|
||||
};
|
||||
|
||||
void onConfirmPIN(const NimBLEConnInfo& connInfo, uint32_t pass_key){
|
||||
void onConfirmPIN(NimBLEConnInfo& connInfo, uint32_t pass_key){
|
||||
printf("The passkey YES/NO number: %" PRIu32 "\n", pass_key);
|
||||
/** Inject false if passkeys don't match. */
|
||||
NimBLEDevice::injectConfirmPIN(connInfo, true);
|
||||
};
|
||||
|
||||
/** Pairing process complete, we can check the results in connInfo */
|
||||
void onAuthenticationComplete(const NimBLEConnInfo& connInfo){
|
||||
void onAuthenticationComplete(NimBLEConnInfo& connInfo){
|
||||
if(!connInfo.isEncrypted()) {
|
||||
printf("Encrypt connection failed - disconnecting\n");
|
||||
/** Find the client with the connection handle provided in desc */
|
||||
|
|
|
@ -65,13 +65,13 @@ class MyServerCallbacks: public BLEServerCallbacks {
|
|||
return 123456;
|
||||
};
|
||||
|
||||
void onConfirmPIN(const NimBLEConnInfo& connInfo, uint32_t pass_key){
|
||||
void onConfirmPIN(NimBLEConnInfo& connInfo, uint32_t pass_key){
|
||||
printf("The passkey YES/NO number: %" PRIu32 "\n", pass_key);
|
||||
/** Inject false if passkeys don't match. */
|
||||
NimBLEDevice::injectConfirmPIN(connInfo, true);
|
||||
};
|
||||
|
||||
void onAuthenticationComplete(const NimBLEConnInfo& connInfo){
|
||||
void onAuthenticationComplete(NimBLEConnInfo& connInfo){
|
||||
/** Check that encryption was successful, if not we disconnect the client */
|
||||
if(!connInfo.isEncrypted()) {
|
||||
NimBLEDevice::getServer()->disconnect(connInfo.getConnHandle());
|
||||
|
|
|
@ -67,13 +67,13 @@ class MyServerCallbacks: public BLEServerCallbacks {
|
|||
return 123456;
|
||||
};
|
||||
|
||||
void onConfirmPIN(const NimBLEConnInfo& connInfo, uint32_t pass_key){
|
||||
void onConfirmPIN(NimBLEConnInfo& connInfo, uint32_t pass_key){
|
||||
printf("The passkey YES/NO number: %" PRIu32 "\n", pass_key);
|
||||
/** Inject false if passkeys don't match. */
|
||||
NimBLEDevice::injectConfirmPIN(connInfo, true);
|
||||
};
|
||||
|
||||
void onAuthenticationComplete(const NimBLEConnInfo& connInfo){
|
||||
void onAuthenticationComplete(NimBLEConnInfo& connInfo){
|
||||
/** Check that encryption was successful, if not we disconnect the client */
|
||||
if(!connInfo.isEncrypted()) {
|
||||
NimBLEDevice::getServer()->disconnect(connInfo.getConnHandle());
|
||||
|
|
|
@ -203,7 +203,7 @@ size_t NimBLECharacteristic::getSubscribedCount() const {
|
|||
* @brief Set the subscribe status for this characteristic.\n
|
||||
* This will maintain a vector of subscribed clients and their indicate/notify status.
|
||||
*/
|
||||
void NimBLECharacteristic::setSubscribe(const ble_gap_event* event, const NimBLEConnInfo& connInfo) {
|
||||
void NimBLECharacteristic::setSubscribe(const ble_gap_event* event, NimBLEConnInfo& connInfo) {
|
||||
uint16_t subVal = 0;
|
||||
if (event->subscribe.cur_notify > 0 && (m_properties & NIMBLE_PROPERTY::NOTIFY)) {
|
||||
subVal |= NIMBLE_SUB_NOTIFY;
|
||||
|
@ -379,11 +379,11 @@ void NimBLECharacteristic::sendValue(const uint8_t* value, size_t length, bool i
|
|||
NIMBLE_LOGD(LOG_TAG, "<< sendValue");
|
||||
} // sendValue
|
||||
|
||||
void NimBLECharacteristic::readEvent(const NimBLEConnInfo& connInfo) {
|
||||
void NimBLECharacteristic::readEvent(NimBLEConnInfo& connInfo) {
|
||||
m_pCallbacks->onRead(this, connInfo);
|
||||
}
|
||||
|
||||
void NimBLECharacteristic::writeEvent(const uint8_t* val, uint16_t len, const NimBLEConnInfo& connInfo) {
|
||||
void NimBLECharacteristic::writeEvent(const uint8_t* val, uint16_t len, NimBLEConnInfo& connInfo) {
|
||||
setValue(val, len);
|
||||
m_pCallbacks->onWrite(this, connInfo);
|
||||
}
|
||||
|
@ -432,7 +432,7 @@ std::string NimBLECharacteristic::toString() const {
|
|||
* @param [in] pCharacteristic The characteristic that is the source of the event.
|
||||
* @param [in] connInfo A reference to a NimBLEConnInfo instance containing the peer info.
|
||||
*/
|
||||
void NimBLECharacteristicCallbacks::onRead(NimBLECharacteristic* pCharacteristic, const NimBLEConnInfo& connInfo) {
|
||||
void NimBLECharacteristicCallbacks::onRead(NimBLECharacteristic* pCharacteristic, NimBLEConnInfo& connInfo) {
|
||||
NIMBLE_LOGD("NimBLECharacteristicCallbacks", "onRead: default");
|
||||
} // onRead
|
||||
|
||||
|
@ -441,7 +441,7 @@ void NimBLECharacteristicCallbacks::onRead(NimBLECharacteristic* pCharacteristic
|
|||
* @param [in] pCharacteristic The characteristic that is the source of the event.
|
||||
* @param [in] connInfo A reference to a NimBLEConnInfo instance containing the peer info.
|
||||
*/
|
||||
void NimBLECharacteristicCallbacks::onWrite(NimBLECharacteristic* pCharacteristic, const NimBLEConnInfo& connInfo) {
|
||||
void NimBLECharacteristicCallbacks::onWrite(NimBLECharacteristic* pCharacteristic, NimBLEConnInfo& connInfo) {
|
||||
NIMBLE_LOGD("NimBLECharacteristicCallbacks", "onWrite: default");
|
||||
} // onWrite
|
||||
|
||||
|
@ -467,7 +467,7 @@ void NimBLECharacteristicCallbacks::onStatus(NimBLECharacteristic* pCharacterist
|
|||
* * 3 = Notifications and Indications
|
||||
*/
|
||||
void NimBLECharacteristicCallbacks::onSubscribe(NimBLECharacteristic* pCharacteristic,
|
||||
const NimBLEConnInfo& connInfo,
|
||||
NimBLEConnInfo& connInfo,
|
||||
uint16_t subValue) {
|
||||
NIMBLE_LOGD("NimBLECharacteristicCallbacks", "onSubscribe: default");
|
||||
}
|
||||
|
|
|
@ -114,9 +114,9 @@ class NimBLECharacteristic : public NimBLELocalValueAttribute {
|
|||
friend class NimBLEService;
|
||||
|
||||
void setService(NimBLEService* pService);
|
||||
void setSubscribe(const ble_gap_event* event, const NimBLEConnInfo& connInfo);
|
||||
void readEvent(const NimBLEConnInfo& connInfo) override;
|
||||
void writeEvent(const uint8_t* val, uint16_t len, const NimBLEConnInfo& connInfo) override;
|
||||
void setSubscribe(const ble_gap_event* event, NimBLEConnInfo& connInfo);
|
||||
void readEvent(NimBLEConnInfo& connInfo) override;
|
||||
void writeEvent(const uint8_t* val, uint16_t len, NimBLEConnInfo& connInfo) override;
|
||||
void sendValue(const uint8_t* value,
|
||||
size_t length,
|
||||
bool is_notification = true,
|
||||
|
@ -138,10 +138,10 @@ class NimBLECharacteristic : public NimBLELocalValueAttribute {
|
|||
class NimBLECharacteristicCallbacks {
|
||||
public:
|
||||
virtual ~NimBLECharacteristicCallbacks() {}
|
||||
virtual void onRead(NimBLECharacteristic* pCharacteristic, const NimBLEConnInfo& connInfo);
|
||||
virtual void onWrite(NimBLECharacteristic* pCharacteristic, const NimBLEConnInfo& connInfo);
|
||||
virtual void onRead(NimBLECharacteristic* pCharacteristic, NimBLEConnInfo& connInfo);
|
||||
virtual void onWrite(NimBLECharacteristic* pCharacteristic, NimBLEConnInfo& connInfo);
|
||||
virtual void onStatus(NimBLECharacteristic* pCharacteristic, int code);
|
||||
virtual void onSubscribe(NimBLECharacteristic* pCharacteristic, const NimBLEConnInfo& connInfo, uint16_t subValue);
|
||||
virtual void onSubscribe(NimBLECharacteristic* pCharacteristic, NimBLEConnInfo& connInfo, uint16_t subValue);
|
||||
};
|
||||
|
||||
#endif /* CONFIG_BT_ENABLED && CONFIG_BT_NIMBLE_ROLE_PERIPHERAL */
|
||||
|
|
|
@ -1327,20 +1327,20 @@ bool NimBLEClientCallbacks::onConnParamsUpdateRequest(NimBLEClient* pClient, con
|
|||
return true;
|
||||
}
|
||||
|
||||
void NimBLEClientCallbacks::onPassKeyEntry(const NimBLEConnInfo& connInfo){
|
||||
void NimBLEClientCallbacks::onPassKeyEntry(NimBLEConnInfo& connInfo){
|
||||
NIMBLE_LOGD("NimBLEClientCallbacks", "onPassKeyEntry: default: 123456");
|
||||
NimBLEDevice::injectPassKey(connInfo, 123456);
|
||||
} //onPassKeyEntry
|
||||
|
||||
void NimBLEClientCallbacks::onAuthenticationComplete(const NimBLEConnInfo& connInfo){
|
||||
void NimBLEClientCallbacks::onAuthenticationComplete(NimBLEConnInfo& connInfo){
|
||||
NIMBLE_LOGD("NimBLEClientCallbacks", "onAuthenticationComplete: default");
|
||||
}
|
||||
|
||||
void NimBLEClientCallbacks::onIdentity(const NimBLEConnInfo& connInfo){
|
||||
void NimBLEClientCallbacks::onIdentity(NimBLEConnInfo& connInfo){
|
||||
NIMBLE_LOGD("NimBLEClientCallbacks", "onIdentity: default");
|
||||
} // onIdentity
|
||||
|
||||
void NimBLEClientCallbacks::onConfirmPIN(const NimBLEConnInfo& connInfo, uint32_t pin){
|
||||
void NimBLEClientCallbacks::onConfirmPIN(NimBLEConnInfo& connInfo, uint32_t pin){
|
||||
NIMBLE_LOGD("NimBLEClientCallbacks", "onConfirmPIN: default: true");
|
||||
NimBLEDevice::injectConfirmPIN(connInfo, true);
|
||||
}
|
||||
|
|
|
@ -148,27 +148,27 @@ public:
|
|||
* @brief Called when server requests a passkey for pairing.
|
||||
* @param [in] connInfo A reference to a NimBLEConnInfo instance containing the peer info.
|
||||
*/
|
||||
virtual void onPassKeyEntry(const NimBLEConnInfo& connInfo);
|
||||
virtual void onPassKeyEntry(NimBLEConnInfo& connInfo);
|
||||
|
||||
/**
|
||||
* @brief Called when the pairing procedure is complete.
|
||||
* @param [in] connInfo A reference to a NimBLEConnInfo instance containing the peer info.\n
|
||||
* This can be used to check the status of the connection encryption/pairing.
|
||||
*/
|
||||
virtual void onAuthenticationComplete(const NimBLEConnInfo& connInfo);
|
||||
virtual void onAuthenticationComplete(NimBLEConnInfo& connInfo);
|
||||
|
||||
/**
|
||||
* @brief Called when using numeric comparision for pairing.
|
||||
* @param [in] connInfo A reference to a NimBLEConnInfo instance containing the peer info.
|
||||
* @param [in] pin The pin to compare with the server.
|
||||
*/
|
||||
virtual void onConfirmPIN(const NimBLEConnInfo& connInfo, uint32_t pin);
|
||||
virtual void onConfirmPIN(NimBLEConnInfo& connInfo, uint32_t pin);
|
||||
|
||||
/**
|
||||
* @brief Called when the peer identity address is resolved.
|
||||
* @param [in] connInfo A reference to a NimBLEConnInfo instance with information
|
||||
*/
|
||||
virtual void onIdentity(const NimBLEConnInfo& connInfo);
|
||||
virtual void onIdentity(NimBLEConnInfo& connInfo);
|
||||
};
|
||||
|
||||
#endif /* CONFIG_BT_ENABLED && CONFIG_BT_NIMBLE_ROLE_CENTRAL */
|
||||
|
|
|
@ -118,11 +118,11 @@ std::string NimBLEDescriptor::toString() const {
|
|||
return res;
|
||||
} // toString
|
||||
|
||||
void NimBLEDescriptor::readEvent(const NimBLEConnInfo& connInfo) {
|
||||
void NimBLEDescriptor::readEvent(NimBLEConnInfo& connInfo) {
|
||||
m_pCallbacks->onRead(this, connInfo);
|
||||
} // readEvent
|
||||
|
||||
void NimBLEDescriptor::writeEvent(const uint8_t* val, uint16_t len, const NimBLEConnInfo& connInfo) {
|
||||
void NimBLEDescriptor::writeEvent(const uint8_t* val, uint16_t len, NimBLEConnInfo& connInfo) {
|
||||
setValue(val, len);
|
||||
m_pCallbacks->onWrite(this, connInfo);
|
||||
} // writeEvent
|
||||
|
@ -132,7 +132,7 @@ void NimBLEDescriptor::writeEvent(const uint8_t* val, uint16_t len, const NimBLE
|
|||
* @param [in] pDescriptor The descriptor that is the source of the event.
|
||||
* @param [in] connInfo A reference to a NimBLEConnInfo instance containing the peer info.
|
||||
*/
|
||||
void NimBLEDescriptorCallbacks::onRead(NimBLEDescriptor* pDescriptor, const NimBLEConnInfo& connInfo) {
|
||||
void NimBLEDescriptorCallbacks::onRead(NimBLEDescriptor* pDescriptor, NimBLEConnInfo& connInfo) {
|
||||
NIMBLE_LOGD("NimBLEDescriptorCallbacks", "onRead: default");
|
||||
} // onRead
|
||||
|
||||
|
@ -141,7 +141,7 @@ void NimBLEDescriptorCallbacks::onRead(NimBLEDescriptor* pDescriptor, const NimB
|
|||
* @param [in] pDescriptor The descriptor that is the source of the event.
|
||||
* @param [in] connInfo A reference to a NimBLEConnInfo instance containing the peer info.
|
||||
*/
|
||||
void NimBLEDescriptorCallbacks::onWrite(NimBLEDescriptor* pDescriptor, const NimBLEConnInfo& connInfo) {
|
||||
void NimBLEDescriptorCallbacks::onWrite(NimBLEDescriptor* pDescriptor, NimBLEConnInfo& connInfo) {
|
||||
NIMBLE_LOGD("NimBLEDescriptorCallbacks", "onWrite: default");
|
||||
} // onWrite
|
||||
|
||||
|
|
|
@ -51,8 +51,8 @@ class NimBLEDescriptor : public NimBLELocalValueAttribute {
|
|||
friend class NimBLEService;
|
||||
|
||||
void setCharacteristic(NimBLECharacteristic* pChar);
|
||||
void readEvent(const NimBLEConnInfo& connInfo) override;
|
||||
void writeEvent(const uint8_t* val, uint16_t len, const NimBLEConnInfo& connInfo) override;
|
||||
void readEvent(NimBLEConnInfo& connInfo) override;
|
||||
void writeEvent(const uint8_t* val, uint16_t len, NimBLEConnInfo& connInfo) override;
|
||||
|
||||
NimBLEDescriptorCallbacks* m_pCallbacks{nullptr};
|
||||
NimBLECharacteristic* m_pCharacteristic{nullptr};
|
||||
|
@ -68,8 +68,8 @@ class NimBLEDescriptor : public NimBLELocalValueAttribute {
|
|||
class NimBLEDescriptorCallbacks {
|
||||
public:
|
||||
virtual ~NimBLEDescriptorCallbacks() = default;
|
||||
virtual void onRead(NimBLEDescriptor* pDescriptor, const NimBLEConnInfo& connInfo);
|
||||
virtual void onWrite(NimBLEDescriptor* pDescriptor, const NimBLEConnInfo& connInfo);
|
||||
virtual void onRead(NimBLEDescriptor* pDescriptor, NimBLEConnInfo& connInfo);
|
||||
virtual void onWrite(NimBLEDescriptor* pDescriptor, NimBLEConnInfo& connInfo);
|
||||
};
|
||||
|
||||
# include "NimBLE2904.h"
|
||||
|
|
|
@ -1142,7 +1142,7 @@ int NimBLEDevice::startSecurity(uint16_t conn_id) {
|
|||
* @param [in] pin The 6-digit pin to inject
|
||||
* @return true if the passkey was injected successfully.
|
||||
*/
|
||||
bool NimBLEDevice::injectPassKey(const NimBLEConnInfo& peerInfo, uint32_t pin) {
|
||||
bool NimBLEDevice::injectPassKey(NimBLEConnInfo& peerInfo, uint32_t pin) {
|
||||
int rc = 0;
|
||||
struct ble_sm_io pkey = {0,0};
|
||||
|
||||
|
@ -1160,7 +1160,7 @@ bool NimBLEDevice::injectPassKey(const NimBLEConnInfo& peerInfo, uint32_t pin) {
|
|||
* @param [in] peerInfo Connection information for the peer
|
||||
* @param [in] accept Whether the user confirmed or declined the comparison
|
||||
*/
|
||||
bool NimBLEDevice::injectConfirmPIN(const NimBLEConnInfo& peerInfo, bool accept) {
|
||||
bool NimBLEDevice::injectConfirmPIN(NimBLEConnInfo& peerInfo, bool accept) {
|
||||
int rc = 0;
|
||||
struct ble_sm_io pkey = {0,0};
|
||||
|
||||
|
|
|
@ -135,8 +135,8 @@ public:
|
|||
static void setSecurityPasskey(uint32_t pin);
|
||||
static uint32_t getSecurityPasskey();
|
||||
static int startSecurity(uint16_t conn_id);
|
||||
static bool injectConfirmPIN(const NimBLEConnInfo& peerInfo, bool accept);
|
||||
static bool injectPassKey(const NimBLEConnInfo& peerInfo, uint32_t pin);
|
||||
static bool injectConfirmPIN(NimBLEConnInfo& peerInfo, bool accept);
|
||||
static bool injectPassKey(NimBLEConnInfo& peerInfo, uint32_t pin);
|
||||
static int setMTU(uint16_t mtu);
|
||||
static uint16_t getMTU();
|
||||
static bool isIgnored(const NimBLEAddress &address);
|
||||
|
|
|
@ -124,7 +124,7 @@ class NimBLELocalValueAttribute : public NimBLELocalAttribute {
|
|||
* @param [in] connInfo A reference to a NimBLEConnInfo instance containing the peer info.
|
||||
* @details This function is called by NimBLEServer when a read request is received.
|
||||
*/
|
||||
virtual void readEvent(const NimBLEConnInfo& connInfo) = 0;
|
||||
virtual void readEvent(NimBLEConnInfo& connInfo) = 0;
|
||||
|
||||
/**
|
||||
* @brief Callback function to support a write request.
|
||||
|
@ -133,7 +133,7 @@ class NimBLELocalValueAttribute : public NimBLELocalAttribute {
|
|||
* @param [in] connInfo A reference to a NimBLEConnInfo instance containing the peer info.
|
||||
* @details This function is called by NimBLEServer when a write request is received.
|
||||
*/
|
||||
virtual void writeEvent(const uint8_t* val, uint16_t len, const NimBLEConnInfo& connInfo) = 0;
|
||||
virtual void writeEvent(const uint8_t* val, uint16_t len, NimBLEConnInfo& connInfo) = 0;
|
||||
|
||||
/**
|
||||
* @brief Get a pointer to value of the attribute.
|
||||
|
|
|
@ -460,7 +460,7 @@ std::string NimBLEServer::getPeerNameInternal(uint16_t conn_handle, TaskHandle_t
|
|||
* @returns A string containing the name.
|
||||
* @note This is a blocking call and should NOT be called from any callbacks!
|
||||
*/
|
||||
std::string NimBLEServer::getPeerName(const NimBLEConnInfo& connInfo) {
|
||||
std::string NimBLEServer::getPeerName(NimBLEConnInfo& connInfo) {
|
||||
std::string name = getPeerNameInternal(connInfo.getConnHandle(), xTaskGetCurrentTaskHandle());
|
||||
return name;
|
||||
}
|
||||
|
@ -1073,20 +1073,20 @@ uint32_t NimBLEServerCallbacks::onPassKeyDisplay(){
|
|||
return 123456;
|
||||
} //onPassKeyDisplay
|
||||
|
||||
void NimBLEServerCallbacks::onConfirmPIN(const NimBLEConnInfo& connInfo, uint32_t pin){
|
||||
void NimBLEServerCallbacks::onConfirmPIN(NimBLEConnInfo& connInfo, uint32_t pin){
|
||||
NIMBLE_LOGD("NimBLEServerCallbacks", "onConfirmPIN: default: true");
|
||||
NimBLEDevice::injectConfirmPIN(connInfo, true);
|
||||
} // onConfirmPIN
|
||||
|
||||
void NimBLEServerCallbacks::onIdentity(const NimBLEConnInfo& connInfo){
|
||||
void NimBLEServerCallbacks::onIdentity(NimBLEConnInfo& connInfo){
|
||||
NIMBLE_LOGD("NimBLEServerCallbacks", "onIdentity: default");
|
||||
} // onIdentity
|
||||
|
||||
void NimBLEServerCallbacks::onAuthenticationComplete(const NimBLEConnInfo& connInfo){
|
||||
void NimBLEServerCallbacks::onAuthenticationComplete(NimBLEConnInfo& connInfo){
|
||||
NIMBLE_LOGD("NimBLEServerCallbacks", "onAuthenticationComplete: default");
|
||||
} // onAuthenticationComplete
|
||||
|
||||
void NimBLEServerCallbacks::onAuthenticationComplete(const NimBLEConnInfo& connInfo, const std::string& name){
|
||||
void NimBLEServerCallbacks::onAuthenticationComplete(NimBLEConnInfo& connInfo, const std::string& name){
|
||||
NIMBLE_LOGD("NimBLEServerCallbacks", "onAuthenticationComplete: default");
|
||||
} // onAuthenticationComplete
|
||||
|
||||
|
|
|
@ -78,7 +78,7 @@ public:
|
|||
NimBLEConnInfo getPeerInfo(size_t index);
|
||||
NimBLEConnInfo getPeerInfo(const NimBLEAddress& address);
|
||||
NimBLEConnInfo getPeerIDInfo(uint16_t id);
|
||||
std::string getPeerName(const NimBLEConnInfo& connInfo);
|
||||
std::string getPeerName(NimBLEConnInfo& connInfo);
|
||||
void getPeerNameOnConnect(bool enable);
|
||||
#if !CONFIG_BT_NIMBLE_EXT_ADV || defined(_DOXYGEN_)
|
||||
void advertiseOnDisconnect(bool);
|
||||
|
@ -183,14 +183,14 @@ public:
|
|||
* Should be passed back to NimBLEDevice::injectConfirmPIN
|
||||
* @param [in] pin The pin to compare with the client.
|
||||
*/
|
||||
virtual void onConfirmPIN(const NimBLEConnInfo& connInfo, uint32_t pin);
|
||||
virtual void onConfirmPIN(NimBLEConnInfo& connInfo, uint32_t pin);
|
||||
|
||||
/**
|
||||
* @brief Called when the pairing procedure is complete.
|
||||
* @param [in] connInfo A reference to a NimBLEConnInfo instance with information
|
||||
* about the peer connection parameters.
|
||||
*/
|
||||
virtual void onAuthenticationComplete(const NimBLEConnInfo& connInfo);
|
||||
virtual void onAuthenticationComplete(NimBLEConnInfo& connInfo);
|
||||
|
||||
/**
|
||||
* @brief Called when the pairing procedure is complete.
|
||||
|
@ -198,13 +198,13 @@ public:
|
|||
* @param [in] name The name of the connected peer device.
|
||||
* about the peer connection parameters.
|
||||
*/
|
||||
virtual void onAuthenticationComplete(const NimBLEConnInfo& connInfo, const std::string& name);
|
||||
virtual void onAuthenticationComplete(NimBLEConnInfo& connInfo, const std::string& name);
|
||||
|
||||
/**
|
||||
* @brief Called when the peer identity address is resolved.
|
||||
* @param [in] connInfo A reference to a NimBLEConnInfo instance with information
|
||||
*/
|
||||
virtual void onIdentity(const NimBLEConnInfo& connInfo);
|
||||
virtual void onIdentity(NimBLEConnInfo& connInfo);
|
||||
}; // NimBLEServerCallbacks
|
||||
|
||||
#endif /* CONFIG_BT_ENABLED && CONFIG_BT_NIMBLE_ROLE_PERIPHERAL */
|
||||
|
|
Loading…
Reference in a new issue