forked from h2zero/esp-nimble-cpp
Add CMakeLists.txt.
Fix compilation in strict enviroments. Fix compliation in IDF v4.0.
This commit is contained in:
@@ -261,7 +261,11 @@ void FreeRTOS::Semaphore::setName(std::string name) {
|
||||
* @param [in] length The amount of storage to allocate for the ring buffer.
|
||||
* @param [in] type The type of buffer. One of RINGBUF_TYPE_NOSPLIT, RINGBUF_TYPE_ALLOWSPLIT, RINGBUF_TYPE_BYTEBUF.
|
||||
*/
|
||||
#if ESP_IDF_VERSION >= ESP_IDF_VERSION_VAL(4, 0, 0)
|
||||
Ringbuffer::Ringbuffer(size_t length, RingbufferType_t type) {
|
||||
#else
|
||||
Ringbuffer::Ringbuffer(size_t length, ringbuf_type_t type) {
|
||||
#endif
|
||||
m_handle = ::xRingbufferCreate(length, type);
|
||||
} // Ringbuffer
|
||||
|
||||
|
||||
@@ -61,7 +61,11 @@ public:
|
||||
*/
|
||||
class Ringbuffer {
|
||||
public:
|
||||
#if ESP_IDF_VERSION >= ESP_IDF_VERSION_VAL(4, 0, 0)
|
||||
Ringbuffer(size_t length, RingbufferType_t type = RINGBUF_TYPE_NOSPLIT);
|
||||
#else
|
||||
Ringbuffer(size_t length, ringbuf_type_t type = RINGBUF_TYPE_NOSPLIT);
|
||||
#endif
|
||||
~Ringbuffer();
|
||||
|
||||
void* receive(size_t* size, TickType_t wait = portMAX_DELAY);
|
||||
|
||||
@@ -504,7 +504,7 @@ std::string NimBLEAdvertisedDevice::toString() {
|
||||
}
|
||||
|
||||
if (haveTXPower()) {
|
||||
char val[4];
|
||||
char val[5];
|
||||
snprintf(val, sizeof(val), "%d", getTXPower());
|
||||
res += ", txPower: ";
|
||||
res += val;
|
||||
|
||||
@@ -18,6 +18,10 @@
|
||||
#if defined(CONFIG_BT_ENABLED)
|
||||
|
||||
#include "host/ble_gap.h"
|
||||
/**** FIX COMPILATION ****/
|
||||
#undef min
|
||||
#undef max
|
||||
/**************************/
|
||||
|
||||
#include "NimBLEUUID.h"
|
||||
#include "FreeRTOS.h"
|
||||
|
||||
@@ -17,6 +17,10 @@
|
||||
#if defined(CONFIG_BT_ENABLED)
|
||||
|
||||
#include "host/ble_hs.h"
|
||||
/**** FIX COMPILATION ****/
|
||||
#undef min
|
||||
#undef max
|
||||
/**************************/
|
||||
|
||||
typedef enum {
|
||||
READ = BLE_GATT_CHR_F_READ,
|
||||
|
||||
@@ -346,13 +346,13 @@ std::string NimBLERemoteCharacteristic::readValue() {
|
||||
switch(rc){
|
||||
case 0:
|
||||
break;
|
||||
|
||||
|
||||
case BLE_HS_ATT_ERR(BLE_ATT_ERR_INSUFFICIENT_AUTHEN):
|
||||
case BLE_HS_ATT_ERR(BLE_ATT_ERR_INSUFFICIENT_AUTHOR):
|
||||
case BLE_HS_ATT_ERR(BLE_ATT_ERR_INSUFFICIENT_ENC):
|
||||
if (retryCount && pClient->secureConnection())
|
||||
break;
|
||||
|
||||
/* Else falls through. */
|
||||
default:
|
||||
return "";
|
||||
}
|
||||
@@ -545,13 +545,13 @@ bool NimBLERemoteCharacteristic::writeValue(uint8_t* data, size_t length, bool r
|
||||
switch(rc){
|
||||
case 0:
|
||||
break;
|
||||
|
||||
|
||||
case BLE_HS_ATT_ERR(BLE_ATT_ERR_INSUFFICIENT_AUTHEN):
|
||||
case BLE_HS_ATT_ERR(BLE_ATT_ERR_INSUFFICIENT_AUTHOR):
|
||||
case BLE_HS_ATT_ERR(BLE_ATT_ERR_INSUFFICIENT_ENC):
|
||||
if (retryCount && pClient->secureConnection())
|
||||
break;
|
||||
|
||||
/* Else falls through. */
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -134,13 +134,13 @@ std::string NimBLERemoteDescriptor::readValue() {
|
||||
switch(rc){
|
||||
case 0:
|
||||
break;
|
||||
|
||||
|
||||
case BLE_HS_ATT_ERR(BLE_ATT_ERR_INSUFFICIENT_AUTHEN):
|
||||
case BLE_HS_ATT_ERR(BLE_ATT_ERR_INSUFFICIENT_AUTHOR):
|
||||
case BLE_HS_ATT_ERR(BLE_ATT_ERR_INSUFFICIENT_ENC):
|
||||
if (retryCount && pClient->secureConnection())
|
||||
break;
|
||||
|
||||
/* Else falls through. */
|
||||
default:
|
||||
return "";
|
||||
}
|
||||
@@ -265,13 +265,13 @@ bool NimBLERemoteDescriptor::writeValue(uint8_t* data, size_t length, bool respo
|
||||
switch(rc){
|
||||
case 0:
|
||||
break;
|
||||
|
||||
|
||||
case BLE_HS_ATT_ERR(BLE_ATT_ERR_INSUFFICIENT_AUTHEN):
|
||||
case BLE_HS_ATT_ERR(BLE_ATT_ERR_INSUFFICIENT_AUTHOR):
|
||||
case BLE_HS_ATT_ERR(BLE_ATT_ERR_INSUFFICIENT_ENC):
|
||||
if (retryCount && pClient->secureConnection())
|
||||
break;
|
||||
|
||||
/* Else falls through. */
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -18,6 +18,10 @@
|
||||
#if defined(CONFIG_BT_ENABLED)
|
||||
|
||||
#include "host/ble_uuid.h"
|
||||
/**** FIX COMPILATION ****/
|
||||
#undef min
|
||||
#undef max
|
||||
/**************************/
|
||||
|
||||
#include <string>
|
||||
|
||||
|
||||
+2
-2
@@ -490,7 +490,7 @@ const char* NimBLEUtils::gapEventToString(uint8_t eventType) {
|
||||
|
||||
case BLE_GAP_EVENT_EXT_DISC: //19
|
||||
return "BLE_GAP_EVENT_EXT_DISC";
|
||||
|
||||
#ifdef BLE_GAP_EVENT_PERIODIC_SYNC // IDF 4.0 does not support these
|
||||
case BLE_GAP_EVENT_PERIODIC_SYNC: //20
|
||||
return "BLE_GAP_EVENT_PERIODIC_SYNC";
|
||||
|
||||
@@ -502,7 +502,7 @@ const char* NimBLEUtils::gapEventToString(uint8_t eventType) {
|
||||
|
||||
case BLE_GAP_EVENT_SCAN_REQ_RCVD: //23
|
||||
return "BLE_GAP_EVENT_SCAN_REQ_RCVD";
|
||||
|
||||
#endif
|
||||
default:
|
||||
NIMBLE_LOGD(LOG_TAG, "gapEventToString: Unknown event type %d 0x%.2x", eventType, eventType);
|
||||
return "Unknown event type";
|
||||
|
||||
Reference in New Issue
Block a user