8000 Merge pull request #752 from espresso-if/master · rmpalgo/esp32-snippets@25496da · GitHub
[go: up one dir, main page]

Skip to content

Commit 25496da

Browse files
authored
Merge pull request nkolban#752 from espresso-if/master
Add access to remote address in BLERemoteCharacteristic
2 parents 8a5a789 + ab386db commit 25496da

File tree

2 files changed

+9
-0
lines changed

2 files changed

+9
-0
lines changed

cpp_utils/BLERemoteCharacteristic.cpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -582,5 +582,13 @@ void BLERemoteCharacteristic::writeValue(uint8_t* data, size_t length, bool resp
582582
uint8_t* BLERemoteCharacteristic::readRawData() {
583583
return m_rawData;
584584
}
585+
/**
586+
* @brief Get the address of the remote server
587+
* @return RemoteAddress
588+
*/
589+
BLEAddress BLERemoteCharacteristic::getRemoteAddress(){
590+
return m_pRemoteService->getClient()->getPeerAddress();
591+
}
592+
585593

586594
#endif /* CONFIG_BT_ENABLED */

cpp_utils/BLERemoteCharacteristic.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ class BLERemoteCharacteristic {
5151
void writeValue(uint8_t newValue, bool response = false);
5252
std::string toString();
5353
uint8_t* readRawData();
54+
BLEAddress getRemoteAddress();
5455

5556
private:
5657
BLERemoteCharacteristic(uint16_t handle, BLEUUID uuid, esp_gatt_char_prop_t charProp, BLERemoteService* pRemoteService);

0 commit comments

Comments
 (0)
0