Skip to content

Commit 169d181

Browse files
committed
feat: add address() and group() getters
1 parent 26c92fe commit 169d181

File tree

3 files changed

+15
-1
lines changed

3 files changed

+15
-1
lines changed

library.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
"maintainer": true
1616
}
1717
],
18-
"version": "1.0.2",
18+
"version": "1.1.0",
1919
"frameworks": ["espidf", "arduino"],
2020
"platforms": "espressif32",
2121
"build": {

src/simple_radio.cpp

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -375,6 +375,15 @@ void SimpleRadioImpl::setGroup(uint8_t group) {
375375
}
376376
}
377377

378+
uint8_t SimpleRadioImpl::group() const {
379+
return m_data[0] & 0x0F;
380+
}
381+
382+
esp_err_t SimpleRadioImpl::address(esp_bd_addr_t out_address) const {
383+
uint8_t addr_type;
384+
return esp_ble_gap_get_local_used_addr(out_address, &addr_type);
385+
}
386+
378387
void SimpleRadioImpl::setData(PacketDataType dtype, const uint8_t* data, size_t len) {
379388
if (len == 0) {
380389
m_data_size = 0;

src/simple_radio.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,11 @@ class SimpleRadioImpl {
4646
// group in range <0,16)
4747
void setGroup(uint8_t group);
4848

49+
uint8_t group() const;
50+
51+
// Returns local address others see this device as. Works only after begin() is called.
52+
esp_err_t address(esp_bd_addr_t out_address) const;
53+
4954
// len must be <= 30
5055
void setData(PacketDataType dtype, const uint8_t* data, size_t len);
5156

0 commit comments

Comments
 (0)