BLEUtils¶
A set of general BLE utilities.
詳細情報¶
メンバー¶
addressTypeToString()¶
Convert an esp_ble_addr_type_t to a string representation.
const char * BLEUtils::addressTypeToString(esp_ble_addr_type_t type)
引数
- esp_ble_addr_type_t
type
戻り値
constchar *
adFlagsToString()¶
Convert the BLE Advertising Data flags to a string.
std::string BLEUtils::adFlagsToString(uint8_t adFlags)
引数
- uint8_t
adFlags
The flags to convert
戻り値
std::string std::string A string representation of the advertising flags.
advTypeToString()¶
Given an advertising type, return a string representation of the type.
const char * BLEUtils::advTypeToString(uint8_t advType)
引数
- uint8_t
advType
戻り値
constchar *
buildHexData()¶
Create a hex representation of data.
char * BLEUtils::buildHexData(uint8_t *target, uint8_t *source, uint8_t length)
引数
- uint8_t*
target
Where to write the hex string. If this is null, we malloc storage. - uint8_t*
source
The start of the binary data. - uint8_t
length
The length of the data to convert.
戻り値
char * A pointer to the formatted buffer.
buildPrintData()¶
Build a printable string of memory range. Create a string representation of a piece of memory. Only printable characters will be included while those that are not printable will be replaced with '.'.
std::string BLEUtils::buildPrintData(uint8_t *source, size_t length)
引数
- uint8_t*
source
Start of memory. - size_t
length
Length of memory.
戻り値
std::string A string representation of a piece of memory.
characteristicPropertiesToString()¶
Convert characteristic properties into a string representation.
std::string BLEUtils::characteristicPropertiesToString(esp_gatt_char_prop_t prop)
引数
- esp_gatt_char_prop_t
prop
Characteristic properties.
戻り値
std::string A string representation of characteristic properties.
devTypeToString()¶
Convert a BLE device type to a string.
const char * BLEUtils::devTypeToString(esp_bt_dev_type_t type)
引数
- esp_bt_dev_type_t
type
The device type.
戻り値
constchar *
buildGattId()¶
esp_gatt_id_t BLEUtils::buildGattId(esp_bt_uuid_t uuid, uint8_t inst_id=0)
引数
- esp_bt_uuid_t
uuid
- uint8_t
inst_id
戻り値
esp_gatt_id_t
buildGattSrvcId()¶
esp_gatt_srvc_id_t BLEUtils::buildGattSrvcId(esp_gatt_id_t gattId, bool is_primary=true)
引数
- esp_gatt_id_t
gattId
- bool
is_primary
戻り値
esp_gatt_srvc_id_t
dumpGapEvent()¶
Dump the GAP event to the log.
void BLEUtils::dumpGapEvent(esp_gap_ble_cb_event_t event, esp_ble_gap_cb_param_t *param)
引数
- esp_gap_ble_cb_event_t
event
- esp_ble_gap_cb_param_t*
param
dumpGattClientEvent()¶
Decode and dump a GATT client event
void BLEUtils::dumpGattClientEvent(esp_gattc_cb_event_t event, esp_gatt_if_t gattc_if, esp_ble_gattc_cb_param_t *evtParam)
引数
- esp_gattc_cb_event_t
event
The type of event received. - esp_gatt_if_t
gattc_if
- esp_ble_gattc_cb_param_t*
evtParam
The data associated with the event.
dumpGattServerEvent()¶
Dump the details of a GATT server event. A GATT event is a callback received from the BLE subsystem when we are acting as a BLE server. The callback indicates the type of event in the field. The is a union of structures where we can use the to indicate which of the structures has been populated and hence is valid.
void BLEUtils::dumpGattServerEvent(esp_gatts_cb_event_t event, esp_gatt_if_t gatts_if, esp_ble_gatts_cb_param_t *evtParam)
引数
- esp_gatts_cb_event_t
event
The event type that was posted. - esp_gatt_if_t
gatts_if
- esp_ble_gatts_cb_param_t*
evtParam
A union of structures only one of which is populated.
eventTypeToString()¶
Convert a BLE event type to a string.
const char * BLEUtils::eventTypeToString(esp_ble_evt_type_t eventType)
引数
- esp_ble_evt_type_t
eventType
The event type.
戻り値
constchar * The event type as a string.
findByAddress()¶
static BLEClient* BLEUtils::findByAddress(BLEAddress address)
引数
- BLEAddress
address
戻り値
BLEClient*
findByConnId()¶
static BLEClient* BLEUtils::findByConnId(uint16_t conn_id)
引数
- uint16_t
conn_id
戻り値
BLEClient*
gapEventToString()¶
Convert a BT GAP event type to a string representation.
const char * BLEUtils::gapEventToString(uint32_t eventType)
引数
- uint32_t
eventType
The type of event.
戻り値
constchar * A string representation of the event type.
gattCharacteristicUUIDToString()¶
std::string BLEUtils::gattCharacteristicUUIDToString(uint32_t characteristicUUID)
引数
- uint32_t
characteristicUUID
戻り値
std::string
gattClientEventTypeToString()¶
std::string BLEUtils::gattClientEventTypeToString(esp_gattc_cb_event_t eventType)
引数
- esp_gattc_cb_event_t
eventType
戻り値
std::string
gattCloseReasonToString()¶
Convert a close/disconnect reason to a string.
std::string BLEUtils::gattCloseReasonToString(esp_gatt_conn_reason_t reason)
引数
- esp_gatt_conn_reason_t
reason
The close reason.
戻り値
std::string A string representation of the reason.
gattcServiceElementToString()¶
Return a string representation of an .
std::string BLEUtils::gattcServiceElementToString(esp_gattc_service_elem_t *pGATTCServiceElement)
引数
- esp_gattc_service_elem_t*
pGATTCServiceElement
戻り値
std::string A string representation of an .
gattDescriptorUUIDToString()¶
Given the UUID for a BLE defined descriptor, return its string representation.
std::string BLEUtils::gattDescriptorUUIDToString(uint32_t descriptorUUID)
引数
- uint32_t
descriptorUUID
UUID of the descriptor to be returned as a string.
戻り値
std::string The string representation of a descriptor UUID.
gattServerEventTypeToString()¶
Return a string representation of a GATT server event code.
std::string BLEUtils::gattServerEventTypeToString(esp_gatts_cb_event_t eventType)
引数
- esp_gatts_cb_event_t
eventType
A GATT server event code.
戻り値
std::string A string representation of the GATT server event code.
gattServiceIdToString()¶
Convert an esp_gatt_srvc_id_t to a string.
std::string BLEUtils::gattServiceIdToString(esp_gatt_srvc_id_t srvcId)
引数
- esp_gatt_srvc_id_t
srvcId
戻り値
std::string
gattServiceToString()¶
std::string BLEUtils::gattServiceToString(uint32_t serviceId)
引数
- uint32_t
serviceId
戻り値
std::string
gattStatusToString()¶
Convert a GATT status to a string.
std::string BLEUtils::gattStatusToString(esp_gatt_status_t status)
引数
- esp_gatt_status_t
status
The status to convert.
戻り値
std::string A string representation of the status.
getMember()¶
std::string BLEUtils::getMember(uint32_t memberId)
引数
- uint32_t
memberId
戻り値
std::string
registerByAddress()¶
static void BLEUtils::registerByAddress(BLEAddress address, BLEClient *pDevice)
引数
- BLEAddress
address
- BLEClient*
pDevice
registerByConnId()¶
static void BLEUtils::registerByConnId(uint16_t conn_id, BLEClient *pDevice)
引数
- uint16_t
conn_id
- BLEClient*
pDevice
searchEventTypeToString()¶
convert a GAP search event to a string.
const char * BLEUtils::searchEventTypeToString(esp_gap_search_evt_t searchEvt)
引数
- esp_gap_search_evt_t
searchEvt
戻り値
constchar * The search event type as a string.