Skip to content

Commit f63a6dd

Browse files
committed
Fix example / docs build
1 parent 629763d commit f63a6dd

5 files changed

Lines changed: 33 additions & 35 deletions

File tree

.github/workflows/build.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ jobs:
3636
container: espressif/idf:${{ matrix.idf_ver }}
3737
steps:
3838
- name: Checkout
39-
uses: actions/checkout@v2
39+
uses: actions/checkout@v3
4040
with:
4141
path: components/esp-nimble-cpp
4242
- name: Build examples
@@ -51,7 +51,7 @@ jobs:
5151
build_docs:
5252
runs-on: ubuntu-latest
5353
steps:
54-
- uses: actions/checkout@v2
54+
- uses: actions/checkout@v3
5555
- name: Doxygen Action
5656
uses: mattnotmitt/doxygen-action@v1.9.1
5757
with:

examples/Advanced/NimBLE_Server/main/main.cpp

Lines changed: 29 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@
22
/** NimBLE_Server Demo:
33
*
44
* Demonstrates many of the available features of the NimBLE server library.
5-
*
5+
*
66
* Created: on March 22 2020
77
* Author: H2zero
8-
*
8+
*
99
*/
1010
#include "NimBLEDevice.h"
1111
#include "NimBLELog.h"
@@ -17,23 +17,23 @@ extern "C" {void app_main(void);}
1717
static NimBLEServer* pServer;
1818

1919
/** None of these are required as they will be handled by the library with defaults. **
20-
** Remove as you see fit for your needs */
20+
** Remove as you see fit for your needs */
2121
class ServerCallbacks: public NimBLEServerCallbacks {
2222
void onConnect(NimBLEServer* pServer) {
2323
printf("Client connected\n");
2424
NimBLEDevice::startAdvertising();
2525
};
26-
/** Alternative onConnect() method to extract details of the connection.
26+
/** Alternative onConnect() method to extract details of the connection.
2727
* See: src/ble_gap.h for the details of the ble_gap_conn_desc struct.
28-
*/
28+
*/
2929
void onConnect(NimBLEServer* pServer, ble_gap_conn_desc* desc) {
3030
printf("Client address: %s\n", NimBLEAddress(desc->peer_ota_addr).toString().c_str());
3131
/** We can use the connection handle here to ask for different connection parameters.
3232
* Args: connection handle, min connection interval, max connection interval
3333
* latency, supervision timeout.
3434
* Units; Min/Max Intervals: 1.25 millisecond increments.
3535
* Latency: number of intervals allowed to skip.
36-
* Timeout: 10 millisecond increments, try for 3x interval time for best results.
36+
* Timeout: 10 millisecond increments, try for 3x interval time for best results.
3737
*/
3838
pServer->updateConnParams(desc->conn_handle, 24, 48, 0, 18);
3939
};
@@ -44,25 +44,25 @@ class ServerCallbacks: public NimBLEServerCallbacks {
4444
void onMTUChange(uint16_t MTU, ble_gap_conn_desc* desc) {
4545
printf("MTU updated: %u for connection ID: %u\n", MTU, desc->conn_handle);
4646
};
47-
47+
4848
/********************* Security handled here **********************
4949
****** Note: these are the same return values as defaults ********/
5050
uint32_t onPassKeyRequest(){
5151
printf("Server Passkey Request\n");
52-
/** This should return a random 6 digit number for security
52+
/** This should return a random 6 digit number for security
5353
* or make your own static passkey as done here.
5454
*/
55-
return 123456;
55+
return 123456;
5656
};
5757

5858
bool onConfirmPIN(uint32_t pass_key){
5959
printf("The passkey YES/NO number: %d\n", pass_key);
6060
/** Return false if passkeys don't match. */
61-
return true;
61+
return true;
6262
};
6363

6464
void onAuthenticationComplete(ble_gap_conn_desc* desc){
65-
/** Check that encryption was successful, if not we disconnect the client */
65+
/** Check that encryption was successful, if not we disconnect the client */
6666
if(!desc->sec_state.encrypted) {
6767
/** NOTE: createServer returns the current server reference unless one is not already created */
6868
NimBLEDevice::createServer()->disconnect(desc->conn_handle);
@@ -76,17 +76,17 @@ class ServerCallbacks: public NimBLEServerCallbacks {
7676
/** Handler class for characteristic actions */
7777
class CharacteristicCallbacks: public NimBLECharacteristicCallbacks {
7878
void onRead(NimBLECharacteristic* pCharacteristic){
79-
printf("%s : onRead(), value: %s\n",
79+
printf("%s : onRead(), value: %s\n",
8080
pCharacteristic->getUUID().toString().c_str(),
8181
pCharacteristic->getValue().c_str());
8282
};
8383

8484
void onWrite(NimBLECharacteristic* pCharacteristic) {
85-
printf("%s : onWrite(), value: %s\n",
85+
printf("%s : onWrite(), value: %s\n",
8686
pCharacteristic->getUUID().toString().c_str(),
8787
pCharacteristic->getValue().c_str());
8888
};
89-
/** Called before notification or indication is sent,
89+
/** Called before notification or indication is sent,
9090
* the value can be changed here before sending if desired.
9191
*/
9292
void onNotify(NimBLECharacteristic* pCharacteristic) {
@@ -104,11 +104,11 @@ class CharacteristicCallbacks: public NimBLECharacteristicCallbacks {
104104
NimBLEUtils::returnCodeToString(code));
105105
};
106106
};
107-
108-
/** Handler class for descriptor actions */
107+
108+
/** Handler class for descriptor actions */
109109
class DescriptorCallbacks : public NimBLEDescriptorCallbacks {
110110
void onWrite(NimBLEDescriptor* pDescriptor) {
111-
std::string dscVal((char*)pDescriptor->getValue(), pDescriptor->getLength());
111+
std::string dscVal = pDescriptor->getValue();
112112
printf("Descriptor witten value: %s\n", dscVal.c_str());
113113
};
114114

@@ -118,7 +118,7 @@ class DescriptorCallbacks : public NimBLEDescriptorCallbacks {
118118
};
119119

120120

121-
/** Define callback instances globally to use for multiple Charateristics \ Descriptors */
121+
/** Define callback instances globally to use for multiple Charateristics \ Descriptors */
122122
static DescriptorCallbacks dscCallbacks;
123123
static CharacteristicCallbacks chrCallbacks;
124124

@@ -135,7 +135,7 @@ void notifyTask(void * parameter){
135135
}
136136
vTaskDelay(2000/portTICK_PERIOD_MS);
137137
}
138-
138+
139139
vTaskDelete(NULL);
140140
}
141141

@@ -155,10 +155,10 @@ void app_main(void) {
155155

156156
/** 2 different ways to set security - both calls achieve the same result.
157157
* no bonding, no man in the middle protection, secure connections.
158-
*
159-
* These are the default values, only shown here for demonstration.
160-
*/
161-
//NimBLEDevice::setSecurityAuth(false, false, true);
158+
*
159+
* These are the default values, only shown here for demonstration.
160+
*/
161+
//NimBLEDevice::setSecurityAuth(false, false, true);
162162
NimBLEDevice::setSecurityAuth(/*BLE_SM_PAIR_AUTHREQ_BOND | BLE_SM_PAIR_AUTHREQ_MITM |*/ BLE_SM_PAIR_AUTHREQ_SC);
163163

164164
pServer = NimBLEDevice::createServer();
@@ -173,7 +173,7 @@ void app_main(void) {
173173
NIMBLE_PROPERTY::READ_ENC | // only allow reading if paired / encrypted
174174
NIMBLE_PROPERTY::WRITE_ENC // only allow writing if paired / encrypted
175175
);
176-
176+
177177
pBeefCharacteristic->setValue("Burger");
178178
pBeefCharacteristic->setCallbacks(&chrCallbacks);
179179

@@ -182,10 +182,10 @@ void app_main(void) {
182182
* and sizes. However we must cast the returned reference to the correct type as the method
183183
* only returns a pointer to the base NimBLEDescriptor class.
184184
*/
185-
NimBLE2904* pBeef2904 = (NimBLE2904*)pBeefCharacteristic->createDescriptor("2904");
185+
NimBLE2904* pBeef2904 = (NimBLE2904*)pBeefCharacteristic->createDescriptor("2904");
186186
pBeef2904->setFormat(NimBLE2904::FORMAT_UTF8);
187187
pBeef2904->setCallbacks(&dscCallbacks);
188-
188+
189189

190190
NimBLEService* pBaadService = pServer->createService("BAAD");
191191
NimBLECharacteristic* pFoodCharacteristic = pBaadService->createCharacteristic(
@@ -201,15 +201,15 @@ void app_main(void) {
201201
/** Custom descriptor: Arguments are UUID, Properties, max length in bytes of the value */
202202
NimBLEDescriptor* pC01Ddsc = pFoodCharacteristic->createDescriptor(
203203
"C01D",
204-
NIMBLE_PROPERTY::READ |
204+
NIMBLE_PROPERTY::READ |
205205
NIMBLE_PROPERTY::WRITE|
206206
NIMBLE_PROPERTY::WRITE_ENC, // only allow writing if paired / encrypted
207207
20
208208
);
209209
pC01Ddsc->setValue("Send it back!");
210210
pC01Ddsc->setCallbacks(&dscCallbacks);
211211

212-
/** Start the services when finished creating all Characteristics and Descriptors */
212+
/** Start the services when finished creating all Characteristics and Descriptors */
213213
pDeadService->start();
214214
pBaadService->start();
215215

@@ -224,6 +224,6 @@ void app_main(void) {
224224
pAdvertising->start();
225225

226226
printf("Advertising Started\n");
227-
227+
228228
xTaskCreate(notifyTask, "notifyTask", 5000, NULL, 1, NULL);
229229
}

src/NimBLEClient.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,6 @@ class NimBLEClientCallbacks {
130130
/**
131131
* @brief Called when disconnected from the server.
132132
* @param [in] pClient A pointer to the calling client object.
133-
* @param [in] reason Contains the reason code for the disconnection.
134133
*/
135134
virtual void onDisconnect(NimBLEClient* pClient);
136135

@@ -153,7 +152,7 @@ class NimBLEClientCallbacks {
153152

154153
/**
155154
* @brief Called when the pairing procedure is complete.
156-
* @param [in] connInfo A reference to a NimBLEConnInfo instance containing the peer info.\n
155+
* @param [in] desc A reference to a NimBLEConnInfo instance containing the peer info.\n
157156
* This can be used to check the status of the connection encryption/pairing.
158157
*/
159158
virtual void onAuthenticationComplete(ble_gap_conn_desc* desc);

src/NimBLEDescriptor.cpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -285,7 +285,6 @@ NimBLEDescriptorCallbacks::~NimBLEDescriptorCallbacks() {}
285285
/**
286286
* @brief Callback function to support a read request.
287287
* @param [in] pDescriptor The descriptor that is the source of the event.
288-
* @param [in] connInfo A reference to a NimBLEConnInfo instance containing the peer info.
289288
*/
290289
void NimBLEDescriptorCallbacks::onRead(NimBLEDescriptor* pDescriptor) {
291290
(void)pDescriptor;
@@ -296,7 +295,6 @@ void NimBLEDescriptorCallbacks::onRead(NimBLEDescriptor* pDescriptor) {
296295
/**
297296
* @brief Callback function to support a write request.
298297
* @param [in] pDescriptor The descriptor that is the source of the event.
299-
* @param [in] connInfo A reference to a NimBLEConnInfo instance containing the peer info.
300298
*/
301299
void NimBLEDescriptorCallbacks::onWrite(NimBLEDescriptor* pDescriptor) {
302300
(void)pDescriptor;

src/NimBLERemoteCharacteristic.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -624,6 +624,7 @@ bool NimBLERemoteCharacteristic::setNotify(uint16_t val, notify_callback notifyC
624624
* @brief Subscribe for notifications or indications.
625625
* @param [in] notifications If true, subscribe for notifications, false subscribe for indications.
626626
* @param [in] notifyCallback A callback to be invoked for a notification.
627+
* @param [in] response If true, require a write response from the descriptor write operation.
627628
* If NULL is provided then no callback is performed.
628629
* @return false if writing to the descriptor failed.
629630
*/

0 commit comments

Comments
 (0)