NimBLE-Arduino 2.1.2
Loading...
Searching...
No Matches
NimBLEUtils Class Reference

A BLE Utility class with methods for debugging and general purpose use. More...

#include <NimBLEUtils.h>

Static Public Member Functions

static const char * gapEventToString (uint8_t eventType)
 Convert a GAP event type to a string representation.
 
static std::string dataToHexString (const uint8_t *source, uint8_t length)
 Create a hexadecimal string representation of the input data.
 
static const char * advTypeToString (uint8_t advType)
 Convert the advertising type flag to a string.
 
static const char * returnCodeToString (int rc)
 Converts a return code from the NimBLE stack to a text string.
 
static NimBLEAddress generateAddr (bool nrpa)
 Generate a random BLE address.
 
static bool taskWait (const NimBLETaskData &taskData, uint32_t timeout)
 Blocks the calling task until released or timeout.
 
static void taskRelease (const NimBLETaskData &taskData, int rc=0)
 Release a task.
 

Detailed Description

A BLE Utility class with methods for debugging and general purpose use.

Member Function Documentation

◆ advTypeToString()

const char * NimBLEUtils::advTypeToString ( uint8_t  advType)
static

Convert the advertising type flag to a string.

Parameters
advTypeThe type to convert.
Returns
A string representation of the advertising flags.

◆ dataToHexString()

std::string NimBLEUtils::dataToHexString ( const uint8_t *  source,
uint8_t  length 
)
static

Create a hexadecimal string representation of the input data.

Parameters
[in]sourceThe start of the binary data.
[in]lengthThe length of the data to convert.
Returns
A string representation of the data.

◆ gapEventToString()

const char * NimBLEUtils::gapEventToString ( uint8_t  eventType)
static

Convert a GAP event type to a string representation.

Parameters
[in]eventTypeThe type of event.
Returns
A string representation of the event type.

◆ generateAddr()

NimBLEAddress NimBLEUtils::generateAddr ( bool  nrpa)
static

Generate a random BLE address.

Parameters
[in]nrpaTrue to generate a non-resolvable private address, false to generate a random static address
Returns
The generated address or a NULL address if there was an error.

◆ returnCodeToString()

const char * NimBLEUtils::returnCodeToString ( int  rc)
static

Converts a return code from the NimBLE stack to a text string.

Parameters
[in]rcThe return code to convert.
Returns
A string representation of the return code.

◆ taskRelease()

void NimBLEUtils::taskRelease ( const NimBLETaskData taskData,
int  flags = 0 
)
static

Release a task.

Parameters
[in]taskDataA pointer to the task data structure.
[in]flagsA return value to set in the task data structure.

◆ taskWait()

bool NimBLEUtils::taskWait ( const NimBLETaskData taskData,
uint32_t  timeout 
)
static

Blocks the calling task until released or timeout.

Parameters
[in]taskDataA pointer to the task data structure.
[in]timeoutThe time to wait in milliseconds.
Returns
True if the task completed, false if the timeout was reached.