@@ -355,8 +355,8 @@ BLEUUID BLERemoteCharacteristic::getUUID() {
355
355
* @brief Read an unsigned 16 bit value
356
356
* @return The unsigned 16 bit value.
357
357
*/
358
- uint16_t BLERemoteCharacteristic::readUInt16 () {
359
- std::string value = readValue ();
358
+ uint16_t BLERemoteCharacteristic::readUInt16 (esp_gatt_auth_req_t auth ) {
359
+ std::string value = readValue (auth );
360
360
if (value.length () >= 2 ) {
361
361
return *(uint16_t *)(value.data ());
362
362
}
@@ -368,8 +368,8 @@ uint16_t BLERemoteCharacteristic::readUInt16() {
368
368
* @brief Read an unsigned 32 bit value.
369
369
* @return the unsigned 32 bit value.
370
370
*/
371
- uint32_t BLERemoteCharacteristic::readUInt32 () {
372
- std::string value = readValue ();
371
+ uint32_t BLERemoteCharacteristic::readUInt32 (esp_gatt_auth_req_t auth ) {
372
+ std::string value = readValue (auth );
373
373
if (value.length () >= 4 ) {
374
374
return *(uint32_t *)(value.data ());
375
375
}
@@ -381,8 +381,8 @@ uint32_t BLERemoteCharacteristic::readUInt32() {
381
381
* @brief Read a byte value
382
382
* @return The value as a byte
383
383
*/
384
- uint8_t BLERemoteCharacteristic::readUInt8 () {
385
- std::string value = readValue ();
384
+ uint8_t BLERemoteCharacteristic::readUInt8 (esp_gatt_auth_req_t auth ) {
385
+ std::string value = readValue (auth );
386
386
if (value.length () >= 1 ) {
387
387
return (uint8_t )value[0 ];
388
388
}
@@ -393,8 +393,8 @@ uint8_t BLERemoteCharacteristic::readUInt8() {
393
393
* @brief Read a float value.
394
394
* @return the float value.
395
395
*/
396
- float BLERemoteCharacteristic::readFloat () {
397
- std::string value = readValue ();
396
+ float BLERemoteCharacteristic::readFloat (esp_gatt_auth_req_t auth ) {
397
+ std::string value = readValue (auth );
398
398
if (value.length () >= 4 ) {
399
399
return *(float *)(value.data ());
400
400
}
@@ -405,7 +405,7 @@ float BLERemoteCharacteristic::readFloat() {
405
405
* @brief Read the value of the remote characteristic.
406
406
* @return The value of the remote characteristic.
407
407
*/
408
- std::string BLERemoteCharacteristic::readValue () {
408
+ std::string BLERemoteCharacteristic::readValue (esp_gatt_auth_req_t auth ) {
409
409
log_v (" >> readValue(): uuid: %s, handle: %d 0x%.2x" , getUUID ().toString ().c_str (), getHandle (), getHandle ());
410
410
411
411
// Check to see that we are connected.
@@ -423,7 +423,7 @@ std::string BLERemoteCharacteristic::readValue() {
423
423
m_pRemoteService->getClient ()->getGattcIf (),
424
424
m_pRemoteService->getClient ()->getConnId (), // The connection ID to the BLE server
425
425
getHandle (), // The handle of this characteristic
426
- ESP_GATT_AUTH_REQ_NONE); // Security
426
+ auth); // Security
427
427
428
428
if (errRc != ESP_OK) {
429
429
log_e (" esp_ble_gattc_read_char: rc=%d %s" , errRc, GeneralUtils::errorToString (errRc));
@@ -531,8 +531,8 @@ std::string BLERemoteCharacteristic::toString() {
531
531
* @param [in] response Do we expect a response?
532
532
* @return N/A.
533
533
*/
534
- void BLERemoteCharacteristic::writeValue (std::string newValue, bool response) {
535
- writeValue ((uint8_t *)newValue.c_str (), strlen (newValue.c_str ()), response);
534
+ void BLERemoteCharacteristic::writeValue (std::string newValue, bool response, esp_gatt_auth_req_t auth ) {
535
+ writeValue ((uint8_t *)newValue.c_str (), strlen (newValue.c_str ()), response, auth );
536
536
} // writeValue
537
537
538
538
@@ -544,8 +544,8 @@ void BLERemoteCharacteristic::writeValue(std::string newValue, bool response) {
544
544
* @param [in] response Whether we require a response from the write.
545
545
* @return N/A.
546
546
*/
547
- void BLERemoteCharacteristic::writeValue (uint8_t newValue, bool response) {
548
- writeValue (&newValue, 1 , response);
547
+ void BLERemoteCharacteristic::writeValue (uint8_t newValue, bool response, esp_gatt_auth_req_t auth ) {
548
+ writeValue (&newValue, 1 , response, auth );
549
549
} // writeValue
550
550
551
551
@@ -555,7 +555,7 @@ void BLERemoteCharacteristic::writeValue(uint8_t newValue, bool response) {
555
555
* @param [in] length The length of the data in the data buffer.
556
556
* @param [in] response Whether we require a response from the write.
557
557
*/
558
- void BLERemoteCharacteristic::writeValue (uint8_t * data, size_t length, bool response) {
558
+ void BLERemoteCharacteristic::writeValue (uint8_t * data, size_t length, bool response, esp_gatt_auth_req_t auth ) {
559
559
// writeValue(std::string((char*)data, length), response);
560
560
log_v (" >> writeValue(), length: %d" , length);
561
561
@@ -574,7 +574,7 @@ void BLERemoteCharacteristic::writeValue(uint8_t* data, size_t length, bool resp
574
574
length,
575
575
data,
576
576
response?ESP_GATT_WRITE_TYPE_RSP:ESP_GATT_WRITE_TYPE_NO_RSP,
577
- ESP_GATT_AUTH_REQ_NONE
577
+ auth
578
578
);
579
579
580
580
if (errRc != ESP_OK) {
0 commit comments