File tree 5 files changed +34
-12
lines changed
5 files changed +34
-12
lines changed Original file line number Diff line number Diff line change @@ -72,7 +72,7 @@ class BLEAddress : private ble_addr_t {
72
72
// Compatibility with old API
73
73
[[deprecated(" Use getBase() instead" )]]
74
74
const uint8_t *getNative () const {
75
- return &( getBase ()->val ) ;
75
+ return getBase ()->val ;
76
76
}
77
77
};
78
78
Original file line number Diff line number Diff line change 20
20
#include " soc/soc_caps.h"
21
21
#if SOC_BLE_SUPPORTED
22
22
23
+ typedef enum {
24
+ BLE_UNKNOWN_FRAME,
25
+ BLE_EDDYSTONE_UUID_FRAME,
26
+ BLE_EDDYSTONE_URL_FRAME,
27
+ BLE_EDDYSTONE_TLM_FRAME,
28
+ BLE_FRAME_MAX
29
+ } ble_frame_type_t ;
30
+
23
31
#include " btconfig.h"
24
32
#if defined(CONFIG_NIMBLE_ENABLED) && defined(CONFIG_BT_NIMBLE_ROLE_OBSERVER)
25
33
@@ -95,6 +103,9 @@ class BLEAdvertisedDevice {
95
103
const std::vector<uint8_t >::const_iterator begin () const ;
96
104
const std::vector<uint8_t >::const_iterator end () const ;
97
105
106
+ // Compatibility with Bluedroid
107
+ [[deprecated]] ble_frame_type_t getFrameType () const ;
108
+
98
109
/* *
99
110
* @brief A template to convert the service data to <type\>.
100
111
* @tparam T The type to convert the data to.
@@ -190,14 +201,6 @@ class BLEAdvertisedDevice {
190
201
#include " BLEScan.h"
191
202
#include " BLEUUID.h"
192
203
193
- typedef enum {
194
- BLE_UNKNOWN_FRAME,
195
- BLE_EDDYSTONE_UUID_FRAME,
196
- BLE_EDDYSTONE_URL_FRAME,
197
- BLE_EDDYSTONE_TLM_FRAME,
198
- BLE_FRAME_MAX
199
- } ble_frame_type_t ;
200
-
201
204
class BLEScan ;
202
205
/* *
203
206
* @brief A representation of a %BLE advertised device found by a scan.
Original file line number Diff line number Diff line change @@ -81,7 +81,7 @@ class BLEExtAdvertisement {
81
81
void setDirected (bool enable, bool high_duty = true );
82
82
void setAnonymous (bool enable);
83
83
void setPrimaryChannels (bool ch37, bool ch38, bool ch39);
84
- void setTxPower (int8_t dbm);
84
+ void setTXPower (int8_t dbm);
85
85
void setAddress (const BLEAddress &addr);
86
86
void enableScanRequestCallback (bool enable);
87
87
void clearData ();
Original file line number Diff line number Diff line change @@ -782,4 +782,23 @@ const std::vector<uint8_t>::const_iterator BLEAdvertisedDevice::end() const {
782
782
return m_payload.cend ();
783
783
}
784
784
785
+ // API compatibility with Bluedroid
786
+
787
+ ble_frame_type_t BLEAdvertisedDevice::getFrameType () {
788
+ size_t m_payloadLength = m_payload.size ();
789
+ for (int i = 0 ; i < m_payloadLength; ++i) {
790
+ log_d (" check [%d]=0x%02X" , i, m_payload[i]);
791
+ if (m_payload[i] == 0x16 && m_payloadLength >= i + 3 && m_payload[i + 1 ] == 0xAA && m_payload[i + 2 ] == 0xFE && m_payload[i + 3 ] == 0x00 ) {
792
+ return BLE_EDDYSTONE_UUID_FRAME;
793
+ }
794
+ if (m_payload[i] == 0x16 && m_payloadLength >= i + 3 && m_payload[i + 1 ] == 0xAA && m_payload[i + 2 ] == 0xFE && m_payload[i + 3 ] == 0x10 ) {
795
+ return BLE_EDDYSTONE_URL_FRAME;
796
+ }
797
+ if (m_payload[i] == 0x16 && m_payloadLength >= i + 3 && m_payload[i + 1 ] == 0xAA && m_payload[i + 2 ] == 0xFE && m_payload[i + 3 ] == 0x20 ) {
798
+ return BLE_EDDYSTONE_TLM_FRAME;
799
+ }
800
+ }
801
+ return BLE_UNKNOWN_FRAME;
802
+ }
803
+
785
804
#endif /* CONFIG_NIMBLE_ENABLED && CONFIG_BT_NIMBLE_ROLE_CENTRAL */
Original file line number Diff line number Diff line change @@ -370,9 +370,9 @@ void BLEExtAdvertisement::setScannable(bool enable) {
370
370
* @param [in] dbm the transmission power to use in dbm.
371
371
* @details The allowable value range depends on device hardware.
372
372
*/
373
- void BLEExtAdvertisement::setTxPower (int8_t dbm) {
373
+ void BLEExtAdvertisement::setTXPower (int8_t dbm) {
374
374
m_params.tx_power = dbm;
375
- } // setTxPower
375
+ } // setTXPower
376
376
377
377
/* *
378
378
* @brief Sets wether this advertisement should advertise as a connectable device.
You can’t perform that action at this time.
0 commit comments