esp-nimble-cpp  1.4.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 
12 #include "nimconfig.h"
13 #if defined(CONFIG_BT_ENABLED)
14 
15 #if defined(CONFIG_NIMBLE_CPP_IDF)
16 #include "host/ble_gap.h"
17 #else
18 #include "nimble/nimble/host/include/host/ble_gap.h"
19 #endif
20 
21 /**** FIX COMPILATION ****/
22 #undef min
23 #undef max
24 /**************************/
25 
26 #include <string>
27 
28 typedef struct {
29  void *pATT;
30  TaskHandle_t task;
31  int rc;
32  void *buf;
33 } ble_task_data_t;
34 
35 
39 class NimBLEUtils {
40 public:
41  static void dumpGapEvent(ble_gap_event *event, void *arg);
42  static const char* gapEventToString(uint8_t eventType);
43  static char* buildHexData(uint8_t* target, const uint8_t* source, uint8_t length);
44  static const char* advTypeToString(uint8_t advType);
45  static const char* returnCodeToString(int rc);
46  static int checkConnParams(ble_gap_conn_params* params);
47 };
48 
49 
50 #endif // CONFIG_BT_ENABLED
51 #endif // COMPONENTS_NIMBLEUTILS_H_
A BLE Utility class with methods for debugging and general purpose use.
Definition: NimBLEUtils.h:39
static void dumpGapEvent(ble_gap_event *event, void *arg)
Utility function to log the gap event info.
Definition: NimBLEUtils.cpp:421
static char * buildHexData(uint8_t *target, const uint8_t *source, uint8_t length)
Create a hex representation of data.
Definition: NimBLEUtils.cpp:388
static const char * advTypeToString(uint8_t advType)
Convert the advertising type flag to a string.
Definition: NimBLEUtils.cpp:357
static const char * returnCodeToString(int rc)
Converts a return code from the NimBLE stack to a text string.
Definition: NimBLEUtils.cpp:63
static int checkConnParams(ble_gap_conn_params *params)
A function for checking validity of connection parameters.
Definition: NimBLEUtils.cpp:25
static const char * gapEventToString(uint8_t eventType)
Convert a GAP event type to a string representation.
Definition: NimBLEUtils.cpp:436