A model of a BLE client.
More...
#include <BLEClient.hpp>
◆ connect()
Add overloaded function to ease connect to peer device with not public address
77 BLEAddress::Type_t type = device->getAddressType();
◆ getPeerAddress()
Retrieve the address of the peer.
Returns the Bluetooth device address of the BLE peer to which this client is connected.
◆ getService() [1/2]
Get the service object corresponding to the uuid.
- Parameters
-
[in] | uuid | The UUID of the service being sought. |
- Returns
- A reference to the Service or nullptr if don't know about it.
- Exceptions
-
110 _debug_print_s(TAG,
">> getService: uuid", uuid.
toString().c_str());
117 if (!m_haveServices) {
120 std::string uuidStr = uuid.
toString();
121 for (
auto &myPair : m_servicesMap) {
122 if (myPair.first == uuidStr) {
123 _debug_print_s(TAG,
"<< getService: found the service with uuid", uuid.
toString().c_str());
124 return myPair.second;
127 _debug_print(TAG,
"<< getService: not found");
◆ getService() [2/2]
Get the service BLE Remote Service instance corresponding to the uuid.
- Parameters
-
[in] | uuid | The UUID of the service being sought. |
- Returns
- A reference to the Service or nullptr if don't know about it.
◆ isConnected()
bool BLEClient::isConnected |
( |
| ) |
|
Are we connected to a partner?
- Returns
- True if we are connected and false if we are not connected.
148 return m_isConnected;
◆ setValue()
void BLEClient::setValue |
( |
BLEUUID |
serviceUUID, |
|
|
BLEUUID |
characteristicUUID, |
|
|
std::string |
value |
|
) |
| |
Set the value of a specific characteristic associated with a specific service.
- Parameters
-
[in] | serviceUUID | The service that owns the characteristic. |
[in] | characteristicUUID | The characteristic whose value we wish to write. |
- Exceptions
-
170 void *logCtx __attribute__((unused)) =
nullptr;
171 _debug_print_s(TAG,
">> setValue: serviceUUID", serviceUUID.
toString().c_str());
172 _debug_print_s(TAG,
", characteristicUUID", characteristicUUID.
toString().c_str());
174 _debug_print(TAG,
"<< setValue");
The documentation for this class was generated from the following files:
BLERemoteService * getService(const char *uuid)
Get the service BLE Remote Service instance corresponding to the uuid.
Definition: BLEClient.cpp:98
BLERemoteCharacteristic * getCharacteristic(const char *uuid)
Get the remote characteristic object for the characteristic UUID.
Definition: BLERemoteService.cpp:54