File tree Expand file tree Collapse file tree 2 files changed +31
-1
lines changed
features/FEATURE_BLE/targets/TARGET_CORDIO/driver Expand file tree Collapse file tree 2 files changed +31
-1
lines changed Original file line number Diff line number Diff line change 17
17
#include < stddef.h>
18
18
#include < string.h>
19
19
20
+ #include " CordioBLE.h"
20
21
#include " CordioHCIDriver.h"
21
22
#include " hci_api.h"
22
23
#include " hci_cmd.h"
@@ -139,10 +140,26 @@ void CordioHCIDriver::handle_reset_sequence(uint8_t *pMsg)
139
140
HciReadBdAddrCmd ();
140
141
break ;
141
142
142
- case HCI_OPCODE_READ_BD_ADDR:
143
+ case HCI_OPCODE_READ_BD_ADDR: {
143
144
/* parse and store event parameters */
144
145
BdaCpy (hciCoreCb.bdAddr , pMsg);
145
146
147
+ ble::address_t static_address;
148
+
149
+ if (get_random_static_address (static_address)) {
150
+ // note: will send the HCI command to send the random address
151
+ cordio::BLE::deviceInstance ().getGap ().setAddress (
152
+ BLEProtocol::AddressType::RANDOM_STATIC,
153
+ static_address.data ()
154
+ );
155
+ } else {
156
+ /* send next command in sequence */
157
+ HciLeReadBufSizeCmd ();
158
+ }
159
+ break ;
160
+ }
161
+
162
+ case HCI_OPCODE_LE_SET_RAND_ADDR:
146
163
/* send next command in sequence */
147
164
HciLeReadBufSizeCmd ();
148
165
break ;
@@ -246,6 +263,11 @@ void CordioHCIDriver::handle_reset_sequence(uint8_t *pMsg)
246
263
}
247
264
}
248
265
266
+ bool CordioHCIDriver::get_random_static_address (ble::address_t & address)
267
+ {
268
+ return false ;
269
+ }
270
+
249
271
void CordioHCIDriver::signal_reset_sequence_done ()
250
272
{
251
273
hci_mbed_os_signal_reset_sequence_done ();
Original file line number Diff line number Diff line change 19
19
20
20
#include < stddef.h>
21
21
#include < stdint.h>
22
+ #include < BLETypes.h>
22
23
#include " wsf_buf.h"
23
24
#include " CordioHCITransportDriver.h"
24
25
@@ -108,6 +109,13 @@ class CordioHCIDriver {
108
109
*/
109
110
virtual void handle_reset_sequence (uint8_t *msg);
110
111
112
+ /* *
113
+ * Get the random static address of the controller
114
+ *
115
+ * @return false if the address has not been set and true otherwise.
116
+ */
117
+ virtual bool get_random_static_address (ble::address_t & address);
118
+
111
119
/* *
112
120
* Signal to the stack that the reset sequence has been done.
113
121
*/
You can’t perform that action at this time.
0 commit comments