@@ -22,7 +22,6 @@ static void start_scan(void);
2222static struct ble_hs_adv_fields fields ;
2323static bool synced = false;
2424
25- uint8_t rsp_slot_idx = 0 ;
2625static int
2726gap_event_cb (struct ble_gap_event * event , void * arg )
2827{
@@ -57,12 +56,11 @@ gap_event_cb(struct ble_gap_event *event, void *arg)
5756 event -> periodic_report .event_counter ,
5857 event -> periodic_report .subevent );
5958
60- rsp_slot_idx += 1 ;
6159 struct ble_gap_periodic_adv_response_params param = {
6260 .request_event = event -> periodic_report .event_counter ,
6361 .request_subevent = event -> periodic_report .subevent ,
6462 .response_subevent = event -> periodic_report .subevent ,
65- .response_slot = rsp_slot_idx ,
63+ .response_slot = 2 ,
6664 };
6765
6866 struct os_mbuf * data = os_msys_get_pkthdr (BLE_PAWR_RSP_DATA_LEN , 0 );
@@ -129,8 +127,9 @@ static int
129127create_periodic_sync (struct ble_gap_ext_disc_desc * disc )
130128{
131129 int rc ;
132- struct ble_gap_periodic_sync_params params ;
130+ struct ble_gap_periodic_sync_params params = { 0 } ;
133131
132+ memset (& params , 0 , sizeof (params ));
134133 params .skip = 0 ;
135134 params .sync_timeout = 4000 ;
136135 params .reports_disabled = 0 ;
@@ -159,9 +158,11 @@ start_scan(void)
159158 int rc ;
160159 struct ble_gap_ext_disc_params disc_params ;
161160
161+
162162 /* Perform a passive scan. I.e., don't send follow-up scan requests to
163163 * each advertiser.
164164 */
165+ memset (& disc_params , 0 , sizeof (disc_params ));
165166 disc_params .itvl = BLE_GAP_SCAN_ITVL_MS (600 );
166167 disc_params .window = BLE_GAP_SCAN_ITVL_MS (300 );
167168 disc_params .passive = 1 ;
@@ -182,23 +183,6 @@ on_reset(int reason)
182183 ESP_LOGE (TAG , "Resetting state; reason=%d\n" , reason );
183184}
184185
185- /* Cnnot find `ble_single_xxxx()`, workaround */
186- // static void
187- // on_sync(void)
188- // {
189- // int ble_single_env_init(void);
190- // int ble_single_init(void);
191-
192- // int rc;
193-
194- // rc = ble_single_env_init();
195- // assert(!rc);
196- // rc = ble_single_init();
197- // assert(!rc);
198-
199- // start_scan();
200- // }
201-
202186static void
203187on_sync (void )
204188{
0 commit comments