mirror of
https://github.com/h2zero/esp-nimble-cpp.git
synced 2024-11-23 21:50:55 +01:00
ccea428b9e
* Sets macros to allow compiling when Central role is enabled and Observer disabled, or Peripheral enabled and Broadcaster disabled. * Adds a macro definition for CONFIG_NIMBLE_CPP_IDF to enable different include paths/functionality for IDF / Arduino.
51 lines
1.2 KiB
C++
51 lines
1.2 KiB
C++
/*
|
|
* NimBLEUtils.h
|
|
*
|
|
* Created: on Jan 25 2020
|
|
* Author H2zero
|
|
*
|
|
*/
|
|
|
|
#ifndef COMPONENTS_NIMBLEUTILS_H_
|
|
#define COMPONENTS_NIMBLEUTILS_H_
|
|
|
|
#include "nimconfig.h"
|
|
#if defined(CONFIG_BT_ENABLED)
|
|
|
|
#if defined(CONFIG_NIMBLE_CPP_IDF)
|
|
#include "host/ble_gap.h"
|
|
#else
|
|
#include "nimble/nimble/host/include/host/ble_gap.h"
|
|
#endif
|
|
|
|
/**** FIX COMPILATION ****/
|
|
#undef min
|
|
#undef max
|
|
/**************************/
|
|
|
|
#include <string>
|
|
|
|
typedef struct {
|
|
void *pATT;
|
|
TaskHandle_t task;
|
|
int rc;
|
|
std::string *buf;
|
|
} ble_task_data_t;
|
|
|
|
|
|
/**
|
|
* @brief A BLE Utility class with methods for debugging and general purpose use.
|
|
*/
|
|
class NimBLEUtils {
|
|
public:
|
|
static void dumpGapEvent(ble_gap_event *event, void *arg);
|
|
static const char* gapEventToString(uint8_t eventType);
|
|
static char* buildHexData(uint8_t* target, const uint8_t* source, uint8_t length);
|
|
static const char* advTypeToString(uint8_t advType);
|
|
static const char* returnCodeToString(int rc);
|
|
static int checkConnParams(ble_gap_conn_params* params);
|
|
};
|
|
|
|
|
|
#endif // CONFIG_BT_ENABLED
|
|
#endif // COMPONENTS_NIMBLEUTILS_H_
|