File tree 2 files changed +22
-0
lines changed
2 files changed +22
-0
lines changed Original file line number Diff line number Diff line change @@ -133,6 +133,15 @@ int BLELocalDevice::begin()
133
133
* Force both MSB bits to b00 in order to define Static Random Address
134
134
*/
135
135
randomNumber[5 ] |= 0xC0 ;
136
+
137
+ // Copy the random address in private variable as it will be sent to the BLE chip
138
+ randomAddress [0 ] = randomNumber[0 ];
139
+ randomAddress [1 ] = randomNumber[1 ];
140
+ randomAddress [2 ] = randomNumber[2 ];
141
+ randomAddress [3 ] = randomNumber[3 ];
142
+ randomAddress [4 ] = randomNumber[4 ];
143
+ randomAddress [5 ] = randomNumber[5 ];
144
+
136
145
if (HCI.leSetRandomAddress ((uint8_t *)randomNumber) != 0 ) {
137
146
end ();
138
147
return 0 ;
@@ -247,6 +256,16 @@ void BLELocalDevice::end()
247
256
_scanResponseData.clear ();
248
257
}
249
258
259
+ void BLELocalDevice::getRandomAddress (uint8_t buff[6 ])
260
+ {
261
+ buff [0 ] = randomAddress[0 ];
262
+ buff [1 ] = randomAddress[1 ];
263
+ buff [2 ] = randomAddress[2 ];
264
+ buff [3 ] = randomAddress[3 ];
265
+ buff [4 ] = randomAddress[4 ];
266
+ buff [5 ] = randomAddress[5 ];
267
+ }
268
+
250
269
void BLELocalDevice::poll ()
251
270
{
252
271
HCI.poll ();
Original file line number Diff line number Diff line change @@ -91,6 +91,8 @@ class BLELocalDevice {
91
91
92
92
virtual void setTimeout (unsigned long timeout);
93
93
94
+ virtual void getRandomAddress (uint8_t buff[6 ]);
95
+
94
96
virtual void debug (Stream& stream);
95
97
virtual void noDebug ();
96
98
@@ -122,6 +124,7 @@ class BLELocalDevice {
122
124
virtual BLEAdvertisingData& getScanResponseData ();
123
125
124
126
private:
127
+ uint8_t randomAddress[6 ];
125
128
BLEAdvertisingData _advertisingData;
126
129
BLEAdvertisingData _scanResponseData;
127
130
uint8_t _ownBdaddrType;
You can’t perform that action at this time.
0 commit comments