Build with idf v5.1

This commit is contained in:
h2zero 2023-05-24 15:47:14 -06:00
parent d0eaf6c1e0
commit 3145319581
8 changed files with 74 additions and 74 deletions

View file

@ -12,7 +12,7 @@ jobs:
# See https://hub.docker.com/r/espressif/idf/tags and # See https://hub.docker.com/r/espressif/idf/tags and
# https://docs.espressif.com/projects/esp-idf/en/latest/esp32/api-guides/tools/idf-docker-image.html # https://docs.espressif.com/projects/esp-idf/en/latest/esp32/api-guides/tools/idf-docker-image.html
# for details. # for details.
idf_ver: ["release-v4.4"] idf_ver: ["release-v4.4", "release-v5.1"]
idf_target: ["esp32", "esp32s3", "esp32c3"] idf_target: ["esp32", "esp32s3", "esp32c3"]
example: example:
- Advanced/NimBLE_Client - Advanced/NimBLE_Client
@ -36,7 +36,7 @@ jobs:
container: espressif/idf:${{ matrix.idf_ver }} container: espressif/idf:${{ matrix.idf_ver }}
steps: steps:
- name: Checkout - name: Checkout
uses: actions/checkout@v2 uses: actions/checkout@v3
with: with:
path: components/esp-nimble-cpp path: components/esp-nimble-cpp
- name: Build examples - name: Build examples
@ -51,8 +51,8 @@ jobs:
build_docs: build_docs:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- uses: actions/checkout@v2 - uses: actions/checkout@v3
- name: Doxygen Action - name: Doxygen Action
uses: mattnotmitt/doxygen-action@v1.9.1 uses: mattnotmitt/doxygen-action@v1.9.5
with: with:
working-directory: 'docs/' working-directory: 'docs/'

View file

@ -46,7 +46,7 @@ class ClientCallbacks : public NimBLEClientCallbacks {
} }
bool onConfirmPIN(uint32_t pass_key){ bool onConfirmPIN(uint32_t pass_key){
printf("The passkey YES/NO number: %d\n", pass_key); printf("The passkey YES/NO number: %" PRIu32"\n", pass_key);
/** Return false if passkeys don't match. */ /** Return false if passkeys don't match. */
return true; return true;
} }

View file

@ -2,10 +2,10 @@
/** NimBLE_Server Demo: /** NimBLE_Server Demo:
* *
* Demonstrates many of the available features of the NimBLE server library. * Demonstrates many of the available features of the NimBLE server library.
* *
* Created: on March 22 2020 * Created: on March 22 2020
* Author: H2zero * Author: H2zero
* *
*/ */
#include "NimBLEDevice.h" #include "NimBLEDevice.h"
#include "NimBLELog.h" #include "NimBLELog.h"
@ -17,21 +17,21 @@ extern "C" {void app_main(void);}
static NimBLEServer* pServer; static NimBLEServer* pServer;
/** None of these are required as they will be handled by the library with defaults. ** /** None of these are required as they will be handled by the library with defaults. **
** Remove as you see fit for your needs */ ** Remove as you see fit for your needs */
class ServerCallbacks: public NimBLEServerCallbacks { class ServerCallbacks: public NimBLEServerCallbacks {
void onConnect(NimBLEServer* pServer, NimBLEConnInfo& connInfo) { void onConnect(NimBLEServer* pServer, NimBLEConnInfo& connInfo) {
printf("Client address: %s\n", connInfo.getAddress().toString().c_str()); printf("Client address: %s\n", connInfo.getAddress().toString().c_str());
/** We can use the connection handle here to ask for different connection parameters. /** We can use the connection handle here to ask for different connection parameters.
* Args: connection handle, min connection interval, max connection interval * Args: connection handle, min connection interval, max connection interval
* latency, supervision timeout. * latency, supervision timeout.
* Units; Min/Max Intervals: 1.25 millisecond increments. * Units; Min/Max Intervals: 1.25 millisecond increments.
* Latency: number of intervals allowed to skip. * Latency: number of intervals allowed to skip.
* Timeout: 10 millisecond increments, try for 3x interval time for best results. * Timeout: 10 millisecond increments, try for 3x interval time for best results.
*/ */
pServer->updateConnParams(connInfo.getConnHandle(), 24, 48, 0, 18); pServer->updateConnParams(connInfo.getConnHandle(), 24, 48, 0, 18);
}; };
void onDisconnect(NimBLEServer* pServer, NimBLEConnInfo& connInfo, int reason) { void onDisconnect(NimBLEServer* pServer, NimBLEConnInfo& connInfo, int reason) {
printf("Client disconnected - start advertising\n"); printf("Client disconnected - start advertising\n");
NimBLEDevice::startAdvertising(); NimBLEDevice::startAdvertising();
@ -41,25 +41,25 @@ class ServerCallbacks: public NimBLEServerCallbacks {
printf("MTU updated: %u for connection ID: %u\n", MTU, connInfo.getConnHandle()); printf("MTU updated: %u for connection ID: %u\n", MTU, connInfo.getConnHandle());
pServer->updateConnParams(connInfo.getConnHandle(), 24, 48, 0, 60); pServer->updateConnParams(connInfo.getConnHandle(), 24, 48, 0, 60);
}; };
/********************* Security handled here ********************** /********************* Security handled here **********************
****** Note: these are the same return values as defaults ********/ ****** Note: these are the same return values as defaults ********/
uint32_t onPassKeyRequest(){ uint32_t onPassKeyRequest(){
printf("Server Passkey Request\n"); printf("Server Passkey Request\n");
/** This should return a random 6 digit number for security /** This should return a random 6 digit number for security
* or make your own static passkey as done here. * or make your own static passkey as done here.
*/ */
return 123456; return 123456;
}; };
bool onConfirmPIN(uint32_t pass_key){ bool onConfirmPIN(uint32_t pass_key){
printf("The passkey YES/NO number: %d\n", pass_key); printf("The passkey YES/NO number: %" PRIu32"\n", pass_key);
/** Return false if passkeys don't match. */ /** Return false if passkeys don't match. */
return true; return true;
}; };
void onAuthenticationComplete(NimBLEConnInfo& connInfo){ void onAuthenticationComplete(NimBLEConnInfo& connInfo){
/** Check that encryption was successful, if not we disconnect the client */ /** Check that encryption was successful, if not we disconnect the client */
if(!connInfo.isEncrypted()) { if(!connInfo.isEncrypted()) {
NimBLEDevice::getServer()->disconnect(connInfo.getConnHandle()); NimBLEDevice::getServer()->disconnect(connInfo.getConnHandle());
printf("Encrypt connection failed - disconnecting client\n"); printf("Encrypt connection failed - disconnecting client\n");
@ -72,18 +72,18 @@ class ServerCallbacks: public NimBLEServerCallbacks {
/** Handler class for characteristic actions */ /** Handler class for characteristic actions */
class CharacteristicCallbacks: public NimBLECharacteristicCallbacks { class CharacteristicCallbacks: public NimBLECharacteristicCallbacks {
void onRead(NimBLECharacteristic* pCharacteristic, NimBLEConnInfo& connInfo) { void onRead(NimBLECharacteristic* pCharacteristic, NimBLEConnInfo& connInfo) {
printf("%s : onRead(), value: %s\n", printf("%s : onRead(), value: %s\n",
pCharacteristic->getUUID().toString().c_str(), pCharacteristic->getUUID().toString().c_str(),
pCharacteristic->getValue().c_str()); pCharacteristic->getValue().c_str());
} }
void onWrite(NimBLECharacteristic* pCharacteristic, NimBLEConnInfo& connInfo) { void onWrite(NimBLECharacteristic* pCharacteristic, NimBLEConnInfo& connInfo) {
printf("%s : onWrite(), value: %s\n", printf("%s : onWrite(), value: %s\n",
pCharacteristic->getUUID().toString().c_str(), pCharacteristic->getUUID().toString().c_str(),
pCharacteristic->getValue().c_str()); pCharacteristic->getValue().c_str());
} }
/** Called before notification or indication is sent, /** Called before notification or indication is sent,
* the value can be changed here before sending if desired. * the value can be changed here before sending if desired.
*/ */
void onNotify(NimBLECharacteristic* pCharacteristic) { void onNotify(NimBLECharacteristic* pCharacteristic) {
@ -117,8 +117,8 @@ class CharacteristicCallbacks: public NimBLECharacteristicCallbacks {
printf("%s\n", str.c_str()); printf("%s\n", str.c_str());
} }
}; };
/** Handler class for descriptor actions */ /** Handler class for descriptor actions */
class DescriptorCallbacks : public NimBLEDescriptorCallbacks { class DescriptorCallbacks : public NimBLEDescriptorCallbacks {
void onWrite(NimBLEDescriptor* pDescriptor, NimBLEConnInfo& connInfo) { void onWrite(NimBLEDescriptor* pDescriptor, NimBLEConnInfo& connInfo) {
std::string dscVal = pDescriptor->getValue(); std::string dscVal = pDescriptor->getValue();
@ -131,7 +131,7 @@ class DescriptorCallbacks : public NimBLEDescriptorCallbacks {
}; };
/** Define callback instances globally to use for multiple Charateristics \ Descriptors */ /** Define callback instances globally to use for multiple Charateristics \ Descriptors */
static DescriptorCallbacks dscCallbacks; static DescriptorCallbacks dscCallbacks;
static CharacteristicCallbacks chrCallbacks; static CharacteristicCallbacks chrCallbacks;
@ -148,7 +148,7 @@ void notifyTask(void * parameter){
} }
vTaskDelay(2000/portTICK_PERIOD_MS); vTaskDelay(2000/portTICK_PERIOD_MS);
} }
vTaskDelete(NULL); vTaskDelete(NULL);
} }
@ -168,10 +168,10 @@ void app_main(void) {
/** 2 different ways to set security - both calls achieve the same result. /** 2 different ways to set security - both calls achieve the same result.
* no bonding, no man in the middle protection, secure connections. * no bonding, no man in the middle protection, secure connections.
* *
* These are the default values, only shown here for demonstration. * These are the default values, only shown here for demonstration.
*/ */
//NimBLEDevice::setSecurityAuth(false, false, true); //NimBLEDevice::setSecurityAuth(false, false, true);
NimBLEDevice::setSecurityAuth(/*BLE_SM_PAIR_AUTHREQ_BOND | BLE_SM_PAIR_AUTHREQ_MITM |*/ BLE_SM_PAIR_AUTHREQ_SC); NimBLEDevice::setSecurityAuth(/*BLE_SM_PAIR_AUTHREQ_BOND | BLE_SM_PAIR_AUTHREQ_MITM |*/ BLE_SM_PAIR_AUTHREQ_SC);
pServer = NimBLEDevice::createServer(); pServer = NimBLEDevice::createServer();
@ -186,7 +186,7 @@ void app_main(void) {
NIMBLE_PROPERTY::READ_ENC | // only allow reading if paired / encrypted NIMBLE_PROPERTY::READ_ENC | // only allow reading if paired / encrypted
NIMBLE_PROPERTY::WRITE_ENC // only allow writing if paired / encrypted NIMBLE_PROPERTY::WRITE_ENC // only allow writing if paired / encrypted
); );
pBeefCharacteristic->setValue("Burger"); pBeefCharacteristic->setValue("Burger");
pBeefCharacteristic->setCallbacks(&chrCallbacks); pBeefCharacteristic->setCallbacks(&chrCallbacks);
@ -195,10 +195,10 @@ void app_main(void) {
* and sizes. However we must cast the returned reference to the correct type as the method * and sizes. However we must cast the returned reference to the correct type as the method
* only returns a pointer to the base NimBLEDescriptor class. * only returns a pointer to the base NimBLEDescriptor class.
*/ */
NimBLE2904* pBeef2904 = (NimBLE2904*)pBeefCharacteristic->createDescriptor("2904"); NimBLE2904* pBeef2904 = (NimBLE2904*)pBeefCharacteristic->createDescriptor("2904");
pBeef2904->setFormat(NimBLE2904::FORMAT_UTF8); pBeef2904->setFormat(NimBLE2904::FORMAT_UTF8);
pBeef2904->setCallbacks(&dscCallbacks); pBeef2904->setCallbacks(&dscCallbacks);
NimBLEService* pBaadService = pServer->createService("BAAD"); NimBLEService* pBaadService = pServer->createService("BAAD");
NimBLECharacteristic* pFoodCharacteristic = pBaadService->createCharacteristic( NimBLECharacteristic* pFoodCharacteristic = pBaadService->createCharacteristic(
@ -214,7 +214,7 @@ void app_main(void) {
/** Custom descriptor: Arguments are UUID, Properties, max length in bytes of the value */ /** Custom descriptor: Arguments are UUID, Properties, max length in bytes of the value */
NimBLEDescriptor* pC01Ddsc = pFoodCharacteristic->createDescriptor( NimBLEDescriptor* pC01Ddsc = pFoodCharacteristic->createDescriptor(
"C01D", "C01D",
NIMBLE_PROPERTY::READ | NIMBLE_PROPERTY::READ |
NIMBLE_PROPERTY::WRITE| NIMBLE_PROPERTY::WRITE|
NIMBLE_PROPERTY::WRITE_ENC, // only allow writing if paired / encrypted NIMBLE_PROPERTY::WRITE_ENC, // only allow writing if paired / encrypted
20 20
@ -222,7 +222,7 @@ void app_main(void) {
pC01Ddsc->setValue("Send it back!"); pC01Ddsc->setValue("Send it back!");
pC01Ddsc->setCallbacks(&dscCallbacks); pC01Ddsc->setCallbacks(&dscCallbacks);
/** Start the services when finished creating all Characteristics and Descriptors */ /** Start the services when finished creating all Characteristics and Descriptors */
pDeadService->start(); pDeadService->start();
pBaadService->start(); pBaadService->start();
@ -237,6 +237,6 @@ void app_main(void) {
pAdvertising->start(); pAdvertising->start();
printf("Advertising Started\n"); printf("Advertising Started\n");
xTaskCreate(notifyTask, "notifyTask", 5000, NULL, 1, NULL); xTaskCreate(notifyTask, "notifyTask", 5000, NULL, 1, NULL);
} }

View file

@ -42,7 +42,7 @@ class ServerCallbacks: public NimBLEServerCallbacks {
}; };
void onDisconnect(NimBLEServer* pServer, NimBLEConnInfo& connInfo, int reason) { void onDisconnect(NimBLEServer* pServer, NimBLEConnInfo& connInfo, int reason) {
printf("Client disconnected - sleeping for %u seconds\n", sleepSeconds); printf("Client disconnected - sleeping for %" PRIu32" seconds\n", sleepSeconds);
esp_deep_sleep_start(); esp_deep_sleep_start();
}; };
}; };
@ -57,7 +57,7 @@ class advertisingCallbacks: public NimBLEExtAdvertisingCallbacks {
printf("Client connecting\n"); printf("Client connecting\n");
return; return;
case BLE_HS_ETIMEOUT: case BLE_HS_ETIMEOUT:
printf("Time expired - sleeping for %u seconds\n", sleepSeconds); printf("Time expired - sleeping for %" PRIu32" seconds\n", sleepSeconds);
break; break;
default: default:
break; break;

View file

@ -45,7 +45,7 @@ class ServerCallbacks: public NimBLEServerCallbacks {
printf("Client disconnected\n"); printf("Client disconnected\n");
// if still advertising we won't sleep yet. // if still advertising we won't sleep yet.
if (!pServer->getAdvertising()->isAdvertising()) { if (!pServer->getAdvertising()->isAdvertising()) {
printf("Sleeping for %u seconds\n", sleepTime); printf("Sleeping for %" PRIu32" seconds\n", sleepTime);
esp_deep_sleep_start(); esp_deep_sleep_start();
} }
}; };
@ -61,7 +61,7 @@ class advCallbacks: public NimBLEExtAdvertisingCallbacks {
printf(" client connecting\n"); printf(" client connecting\n");
return; return;
case BLE_HS_ETIMEOUT: case BLE_HS_ETIMEOUT:
printf("Time expired - sleeping for %u seconds\n", sleepTime); printf("Time expired - sleeping for %" PRIu32" seconds\n", sleepTime);
break; break;
default: default:
break; break;

View file

@ -56,7 +56,7 @@ class MyClientCallback : public BLEClientCallbacks {
return 123456; return 123456;
} }
bool onConfirmPIN(uint32_t pass_key){ bool onConfirmPIN(uint32_t pass_key){
printf("The passkey YES/NO number: %d\n", pass_key); printf("The passkey YES/NO number: %" PRIu32"\n", pass_key);
return true; return true;
} }

View file

@ -46,7 +46,7 @@ uint32_t value = 0;
#define CHARACTERISTIC_UUID "beb5483e-36e1-4688-b7f5-ea07361b26a8" #define CHARACTERISTIC_UUID "beb5483e-36e1-4688-b7f5-ea07361b26a8"
/** None of these are required as they will be handled by the library with defaults. ** /** None of these are required as they will be handled by the library with defaults. **
** Remove as you see fit for your needs */ ** Remove as you see fit for your needs */
class MyServerCallbacks: public BLEServerCallbacks { class MyServerCallbacks: public BLEServerCallbacks {
void onConnect(BLEServer* pServer, BLEConnInfo& connInfo) { void onConnect(BLEServer* pServer, BLEConnInfo& connInfo) {
deviceConnected = true; deviceConnected = true;
@ -59,12 +59,12 @@ class MyServerCallbacks: public BLEServerCallbacks {
****** Note: these are the same return values as defaults ********/ ****** Note: these are the same return values as defaults ********/
uint32_t onPassKeyRequest(){ uint32_t onPassKeyRequest(){
printf("Server PassKeyRequest\n"); printf("Server PassKeyRequest\n");
return 123456; return 123456;
} }
bool onConfirmPIN(uint32_t pass_key){ bool onConfirmPIN(uint32_t pass_key){
printf("The passkey YES/NO number: %d\n", pass_key); printf("The passkey YES/NO number: %" PRIu32"\n", pass_key);
return true; return true;
} }
void onAuthenticationComplete(BLEConnInfo& connInfo){ void onAuthenticationComplete(BLEConnInfo& connInfo){
@ -94,13 +94,13 @@ void connectedTask (void * parameter){
// do stuff here on connecting // do stuff here on connecting
oldDeviceConnected = deviceConnected; oldDeviceConnected = deviceConnected;
} }
vTaskDelay(10/portTICK_PERIOD_MS); // Delay between loops to reset watchdog timer vTaskDelay(10/portTICK_PERIOD_MS); // Delay between loops to reset watchdog timer
} }
vTaskDelete(NULL); vTaskDelete(NULL);
} }
void app_main(void) { void app_main(void) {
// Create the BLE Device // Create the BLE Device
BLEDevice::init("ESP32"); BLEDevice::init("ESP32");
@ -115,13 +115,13 @@ void app_main(void) {
// Create a BLE Characteristic // Create a BLE Characteristic
pCharacteristic = pService->createCharacteristic( pCharacteristic = pService->createCharacteristic(
CHARACTERISTIC_UUID, CHARACTERISTIC_UUID,
/******* Enum Type NIMBLE_PROPERTY now ******* /******* Enum Type NIMBLE_PROPERTY now *******
BLECharacteristic::PROPERTY_READ | BLECharacteristic::PROPERTY_READ |
BLECharacteristic::PROPERTY_WRITE | BLECharacteristic::PROPERTY_WRITE |
BLECharacteristic::PROPERTY_NOTIFY | BLECharacteristic::PROPERTY_NOTIFY |
BLECharacteristic::PROPERTY_INDICATE BLECharacteristic::PROPERTY_INDICATE
); );
**********************************************/ **********************************************/
NIMBLE_PROPERTY::READ | NIMBLE_PROPERTY::READ |
NIMBLE_PROPERTY::WRITE | NIMBLE_PROPERTY::WRITE |
NIMBLE_PROPERTY::NOTIFY | NIMBLE_PROPERTY::NOTIFY |
@ -130,11 +130,11 @@ void app_main(void) {
// https://www.bluetooth.com/specifications/gatt/viewer?attributeXmlFile=org.bluetooth.descriptor.gatt.client_characteristic_configuration.xml // https://www.bluetooth.com/specifications/gatt/viewer?attributeXmlFile=org.bluetooth.descriptor.gatt.client_characteristic_configuration.xml
// Create a BLE Descriptor // Create a BLE Descriptor
/*************************************************** /***************************************************
NOTE: DO NOT create a 2902 descriptor. NOTE: DO NOT create a 2902 descriptor.
it will be created automatically if notifications it will be created automatically if notifications
or indications are enabled on a characteristic. or indications are enabled on a characteristic.
pCharacteristic->addDescriptor(new BLE2902()); pCharacteristic->addDescriptor(new BLE2902());
****************************************************/ ****************************************************/
// Start the service // Start the service
@ -147,9 +147,9 @@ void app_main(void) {
/** This method had been removed ** /** This method had been removed **
pAdvertising->setMinPreferred(0x0); // set value to 0x00 to not advertise this parameter pAdvertising->setMinPreferred(0x0); // set value to 0x00 to not advertise this parameter
**/ **/
xTaskCreate(connectedTask, "connectedTask", 5000, NULL, 1, NULL); xTaskCreate(connectedTask, "connectedTask", 5000, NULL, 1, NULL);
BLEDevice::startAdvertising(); BLEDevice::startAdvertising();
printf("Waiting a client connection to notify...\n"); printf("Waiting a client connection to notify...\n");
} }

View file

@ -6,7 +6,7 @@
Create a BLE server that, once we receive a connection, will send periodic notifications. Create a BLE server that, once we receive a connection, will send periodic notifications.
The service advertises itself as: 6E400001-B5A3-F393-E0A9-E50E24DCCA9E The service advertises itself as: 6E400001-B5A3-F393-E0A9-E50E24DCCA9E
Has a characteristic of: 6E400002-B5A3-F393-E0A9-E50E24DCCA9E - used for receiving data with "WRITE" Has a characteristic of: 6E400002-B5A3-F393-E0A9-E50E24DCCA9E - used for receiving data with "WRITE"
Has a characteristic of: 6E400003-B5A3-F393-E0A9-E50E24DCCA9E - used to send data with "NOTIFY" Has a characteristic of: 6E400003-B5A3-F393-E0A9-E50E24DCCA9E - used to send data with "NOTIFY"
The design of creating the BLE server is: The design of creating the BLE server is:
@ -18,7 +18,7 @@
6. Start advertising. 6. Start advertising.
In this example rxValue is the data received (only accessible inside that function). In this example rxValue is the data received (only accessible inside that function).
And txValue is the data to be sent, in this example just a byte incremented every second. And txValue is the data to be sent, in this example just a byte incremented every second.
*/ */
/** NimBLE differences highlighted in comment blocks **/ /** NimBLE differences highlighted in comment blocks **/
@ -48,7 +48,7 @@ uint8_t txValue = 0;
/** None of these are required as they will be handled by the library with defaults. ** /** None of these are required as they will be handled by the library with defaults. **
** Remove as you see fit for your needs */ ** Remove as you see fit for your needs */
class MyServerCallbacks: public BLEServerCallbacks { class MyServerCallbacks: public BLEServerCallbacks {
void onConnect(BLEServer* pServer, BLEConnInfo& connInfo) { void onConnect(BLEServer* pServer, BLEConnInfo& connInfo) {
deviceConnected = true; deviceConnected = true;
@ -61,12 +61,12 @@ class MyServerCallbacks: public BLEServerCallbacks {
****** Note: these are the same return values as defaults ********/ ****** Note: these are the same return values as defaults ********/
uint32_t onPassKeyRequest(){ uint32_t onPassKeyRequest(){
printf("Server PassKeyRequest\n"); printf("Server PassKeyRequest\n");
return 123456; return 123456;
} }
bool onConfirmPIN(uint32_t pass_key){ bool onConfirmPIN(uint32_t pass_key){
printf("The passkey YES/NO number: %d\n", pass_key); printf("The passkey YES/NO number: %" PRIu32"\n", pass_key);
return true; return true;
} }
void onAuthenticationComplete(BLEConnInfo& connInfo){ void onAuthenticationComplete(BLEConnInfo& connInfo){
@ -84,7 +84,7 @@ class MyCallbacks: public BLECharacteristicCallbacks {
printf("Received Value: "); printf("Received Value: ");
for (int i = 0; i < rxValue.length(); i++) for (int i = 0; i < rxValue.length(); i++)
printf("%d", rxValue[i]); printf("%d", rxValue[i]);
printf("\n*********\n"); printf("\n*********\n");
} }
} }
@ -109,10 +109,10 @@ void connectedTask (void * parameter){
// do stuff here on connecting // do stuff here on connecting
oldDeviceConnected = deviceConnected; oldDeviceConnected = deviceConnected;
} }
vTaskDelay(10/portTICK_PERIOD_MS); // Delay between loops to reset watchdog timer vTaskDelay(10/portTICK_PERIOD_MS); // Delay between loops to reset watchdog timer
} }
vTaskDelete(NULL); vTaskDelete(NULL);
} }
@ -130,27 +130,27 @@ void app_main(void) {
// Create a BLE Characteristic // Create a BLE Characteristic
pTxCharacteristic = pService->createCharacteristic( pTxCharacteristic = pService->createCharacteristic(
CHARACTERISTIC_UUID_TX, CHARACTERISTIC_UUID_TX,
/******* Enum Type NIMBLE_PROPERTY now ******* /******* Enum Type NIMBLE_PROPERTY now *******
BLECharacteristic::PROPERTY_NOTIFY BLECharacteristic::PROPERTY_NOTIFY
); );
**********************************************/ **********************************************/
NIMBLE_PROPERTY::NOTIFY NIMBLE_PROPERTY::NOTIFY
); );
/*************************************************** /***************************************************
NOTE: DO NOT create a 2902 descriptor NOTE: DO NOT create a 2902 descriptor
it will be created automatically if notifications it will be created automatically if notifications
or indications are enabled on a characteristic. or indications are enabled on a characteristic.
pCharacteristic->addDescriptor(new BLE2902()); pCharacteristic->addDescriptor(new BLE2902());
****************************************************/ ****************************************************/
BLECharacteristic * pRxCharacteristic = pService->createCharacteristic( BLECharacteristic * pRxCharacteristic = pService->createCharacteristic(
CHARACTERISTIC_UUID_RX, CHARACTERISTIC_UUID_RX,
/******* Enum Type NIMBLE_PROPERTY now ******* /******* Enum Type NIMBLE_PROPERTY now *******
BLECharacteristic::PROPERTY_WRITE BLECharacteristic::PROPERTY_WRITE
); );
*********************************************/ *********************************************/
NIMBLE_PROPERTY::WRITE NIMBLE_PROPERTY::WRITE
); );
@ -160,7 +160,7 @@ void app_main(void) {
pService->start(); pService->start();
xTaskCreate(connectedTask, "connectedTask", 5000, NULL, 1, NULL); xTaskCreate(connectedTask, "connectedTask", 5000, NULL, 1, NULL);
// Start advertising // Start advertising
pServer->getAdvertising()->start(); pServer->getAdvertising()->start();
printf("Waiting a client connection to notify...\n"); printf("Waiting a client connection to notify...\n");