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 @@ -60,6 +60,15 @@ int BLELocalDevice::begin()
60
60
* Force both MSB bits to b00 in order to define Static Random Address
61
61
*/
62
62
randomNumber[5 ] |= 0xC0 ;
63
+
64
+ // Copy the random address in private variable as it will be sent to the BLE chip
65
+ randomAddress [0 ] = randomNumber[0 ];
66
+ randomAddress [1 ] = randomNumber[1 ];
67
+ randomAddress [2 ] = randomNumber[2 ];
68
+ randomAddress [3 ] = randomNumber[3 ];
69
+ randomAddress [4 ] = randomNumber[4 ];
70
+ randomAddress [5 ] = randomNumber[5 ];
71
+
63
72
if (HCI.leSetRandomAddress ((uint8_t *)randomNumber) != 0 ) {
64
73
end ();
65
74
return 0 ;
@@ -105,6 +114,16 @@ void BLELocalDevice::end()
105
114
HCI.end ();
106
115
}
107
116
117
+ void BLELocalDevice::getRandomAddress (uint8_t buff[6 ])
118
+ {
119
+ buff [0 ] = randomAddress[0 ];
120
+ buff [1 ] = randomAddress[1 ];
121
+ buff [2 ] = randomAddress[2 ];
122
+ buff [3 ] = randomAddress[3 ];
123
+ buff [4 ] = randomAddress[4 ];
124
+ buff [5 ] = randomAddress[5 ];
125
+ }
126
+
108
127
void BLELocalDevice::poll ()
109
128
{
110
129
HCI.poll ();
Original file line number Diff line number Diff line change @@ -84,6 +84,8 @@ class BLELocalDevice {
84
84
85
85
virtual void setTimeout (unsigned long timeout);
86
86
87
+ virtual void getRandomAddress (uint8_t buff[6 ]);
88
+
87
89
virtual void debug (Stream& stream);
88
90
virtual void noDebug ();
89
91
@@ -92,6 +94,7 @@ class BLELocalDevice {
92
94
virtual BLEAdvertisingData& getScanResponseData ();
93
95
94
96
private:
97
+ uint8_t randomAddress[6 ];
95
98
HCITransportInterface *_HCITransport;
96
99
BLEAdvertisingData _advertisingData;
97
100
BLEAdvertisingData _scanResponseData;
You can’t perform that action at this time.
0 commit comments