@@ -355,8 +355,8 @@ BLEUUID BLERemoteCharacteristic::getUUID() {
355355 * @brief Read an unsigned 16 bit value
356356 * @return The unsigned 16 bit value.
357357 */
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 );
360360 if (value.length () >= 2 ) {
361361 return *(uint16_t *)(value.data ());
362362 }
@@ -368,8 +368,8 @@ uint16_t BLERemoteCharacteristic::readUInt16() {
368368 * @brief Read an unsigned 32 bit value.
369369 * @return the unsigned 32 bit value.
370370 */
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 );
373373 if (value.length () >= 4 ) {
374374 return *(uint32_t *)(value.data ());
375375 }
@@ -381,8 +381,8 @@ uint32_t BLERemoteCharacteristic::readUInt32() {
381381 * @brief Read a byte value
382382 * @return The value as a byte
383383 */
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 );
386386 if (value.length () >= 1 ) {
387387 return (uint8_t )value[0 ];
388388 }
@@ -393,8 +393,8 @@ uint8_t BLERemoteCharacteristic::readUInt8() {
393393 * @brief Read a float value.
394394 * @return the float value.
395395 */
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 );
398398 if (value.length () >= 4 ) {
399399 return *(float *)(value.data ());
400400 }
@@ -405,7 +405,7 @@ float BLERemoteCharacteristic::readFloat() {
405405 * @brief Read the value of the remote characteristic.
406406 * @return The value of the remote characteristic.
407407 */
408- std::string BLERemoteCharacteristic::readValue () {
408+ std::string BLERemoteCharacteristic::readValue (esp_gatt_auth_req_t auth ) {
409409 log_v (" >> readV
8000
alue(): uuid: %s, handle: %d 0x%.2x" , getUUID ().toString ().c_str (), getHandle (), getHandle ());
410410
411411 // Check to see that we are connected.
@@ -423,7 +423,7 @@ std::string BLERemoteCharacteristic::readValue() {
423423 m_pRemoteService->getClient ()->getGattcIf (),
424424 m_pRemoteService->getClient ()->getConnId (), // The connection ID to the BLE server
425425 getHandle (), // The handle of this characteristic
426- ESP_GATT_AUTH_REQ_NONE); // Security
426+ auth); // Security
427427
428428 if (errRc != ESP_OK) {
429429 log_e (" esp_ble_gattc_read_char: rc=%d %s" , errRc, GeneralUtils::errorToString (errRc));
@@ -531,8 +531,8 @@ std::string BLERemoteCharacteristic::toString() {
531531 * @param [in] response Do we expect a response?
532532 * @return N/A.
533533 */
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 );
536536} // writeValue
537537
538538
@@ -544,8 +544,8 @@ void BLERemoteCharacteristic::writeValue(std::string newValue, bool response) {
544544 * @param [in] response Whether we require a response from the write.
545545 * @return N/A.
546546 */
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 );
549549} // writeValue
550550
551551
@@ -555,7 +555,7 @@ void BLERemoteCharacteristic::writeValue(uint8_t newValue, bool response) {
555555 * @param [in] length The length of the data in the data buffer.
556556 * @param [in] response Whether we require a response from the write.
557557 */
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 ) {
559559 // writeValue(std::string((char*)data, length), response);
560560 log_v (" >> writeValue(), length: %d" , length);
561561
@@ -574,7 +574,7 @@ void BLERemoteCharacteristic::writeValue(uint8_t* data, size_t length, bool resp
574574 length,
575575 data,
576576 response?ESP_GATT_WRITE_TYPE_RSP:ESP_GATT_WRITE_TYPE_NO_RSP,
577- ESP_GATT_AUTH_REQ_NONE
577+ auth
578578 );
579579
580580 if (errRc != ESP_OK) {
0 commit comments