esp-nimble-cpp / NimBLE-Arduino  1.3.1
NimBLEUtils.h
1 /*
2  * NimBLEUtils.h
3  *
4  * Created: on Jan 25 2020
5  * Author H2zero
6  *
7  */
8 
9 #ifndef COMPONENTS_NIMBLEUTILS_H_
10 #define COMPONENTS_NIMBLEUTILS_H_
11 #include "sdkconfig.h"
12 #if defined(CONFIG_BT_ENABLED)
13 
14 #include "host/ble_gap.h"
15 
16 /**** FIX COMPILATION ****/
17 #undef min
18 #undef max
19 /**************************/
20 
21 #include <string>
22 
23 typedef struct {
24  void *pATT;
25  TaskHandle_t task;
26  int rc;
27  std::string *buf;
28 } ble_task_data_t;
29 
30 
34 class NimBLEUtils {
35 public:
36  static void dumpGapEvent(ble_gap_event *event, void *arg);
37  static const char* gapEventToString(uint8_t eventType);
38  static char* buildHexData(uint8_t* target, const uint8_t* source, uint8_t length);
39  static const char* advTypeToString(uint8_t advType);
40  static const char* returnCodeToString(int rc);
41  static int checkConnParams(ble_gap_conn_params* params);
42 };
43 
44 
45 #endif // CONFIG_BT_ENABLED
46 #endif // COMPONENTS_NIMBLEUTILS_H_
A BLE Utility class with methods for debugging and general purpose use.
Definition: NimBLEUtils.h:34
static void dumpGapEvent(ble_gap_event *event, void *arg)
Utility function to log the gap event info.
Definition: NimBLEUtils.cpp:418
static char * buildHexData(uint8_t *target, const uint8_t *source, uint8_t length)
Create a hex representation of data.
Definition: NimBLEUtils.cpp:385
static const char * advTypeToString(uint8_t advType)
Convert the advertising type flag to a string.
Definition: NimBLEUtils.cpp:355
static const char * returnCodeToString(int rc)
Converts a return code from the NimBLE stack to a text string.
Definition: NimBLEUtils.cpp:62
static int checkConnParams(ble_gap_conn_params *params)
A function for checking validity of connection parameters.
Definition: NimBLEUtils.cpp:24
static const char * gapEventToString(uint8_t eventType)
Convert a GAP event type to a string representation.
Definition: NimBLEUtils.cpp:430