bt_gap_le_set_scan causes wifi disconnect, does anyone know how to resolve?
native sdk 4.6.1, see below log output....
static void BT_StartScan()
{
//scan for beacons (next to do is do something with the scan data when it arrives, and look into white filtering ussid's)
bt_hci_cmd_le_set_scan_enable_t enbleSetting;
enbleSetting.le_scan_enable = BT_HCI_ENABLE;
enbleSetting.filter_duplicates = BT_HCI_ENABLE;
bt_hci_cmd_le_set_scan_parameters_t scan_para;
scan_para.own_address_type = BT_HCI_SCAN_ADDR_RANDOM;
scan_para.le_scan_type = BT_HCI_SCAN_TYPE_PASSIVE; //BT_HCI_SCAN_TYPE_ACTIVE xmts a request for advertising data, passive just listens
scan_para.scanning_filter_policy = BT_HCI_SCAN_FILTER_ACCEPT_ALL_ADVERTISING_PACKETS;
scan_para.le_scan_interval = 0x0024; // Interval between scans
scan_para.le_scan_window = 0x0011; // How long a scan keeps
if(bt_gap_le_set_scan(&enbleSetting,&scan_para) != BT_STATUS_SUCCESS)
{ LOG_I(alog,"bt_gap_le_set_scan SCAN FAILED\n"); }
else
{ LOG_I(alog,"bt_gap_le_set_scan SCAN ENABLED\n"); }
}
// called by bt_app_event_callback@bt_common.c
bt_status_t app_bt_event_callback(bt_msg_type_t msg, bt_status_t status, void *buff)
{
LOG_I(alog, "---> bt_event_callback(0x%08X,%d)", msg, status);
switch(msg)
{
case BT_POWER_ON_CNF:
LOG_I(alog, "[BT_POWER_ON_CNF](%d)", status);
// set random address before advertising
LOG_I(alog, "bt_gap_le_set_random_address()");
bt_gap_le_set_random_address((bt_bd_addr_ptr_t)local_public_addr);
break;
case BT_GAP_LE_SET_SCAN_CNF:{
LOG_I(alog,"BT_GAP_LE_SET_SCAN_CNF occured\n");
}break;
case BT_GAP_LE_ADVERTISING_REPORT_IND:{
const bt_gap_le_advertising_report_ind_t* pReport = (bt_gap_le_advertising_report_ind_t*)buff;
LOG_I(alog,"BT_GAP_LE_ADVERTISING_REPORT_IND occured, event was %d\n",pReport->event_type);
#define AR(x) pReport->address.addr[x]
#define DR(x) pReport->direct_address.addr[x]
#define DA(x) pReport->data[x]
LOG_I(alog,"\nBT Scan Info...");
LOG_I(alog,"Address Type = %d\n",pReport->address.type);
LOG_I(alog,"Address = %02X %02X %02X %02X %02X %02X",AR(0),AR(1),AR(2),AR(3),AR(4),AR(5));
LOG_I(alog,"Direct Address Type = %d",pReport->direct_address.type);
LOG_I(alog,"Direct Address = %02X %02X %02X %02X %02X %02X",DR(0),DR(1),DR(2),DR(3),DR(4),DR(5));
LOG_I(alog,"rssi = %d",pReport->rssi);
LOG_I(alog,"data_length = %d",pReport->data_length);
if(pReport->data_length >= 0x1F)
{LOG_I(alog,"data_length error; %d > 30 bytes",pReport->data_length);}
else
{
LOG_I(alog,"%02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X",
DA(0),DA(1),DA(2),DA(3),DA(4),DA(5),DA(6),DA(7),DA(8),DA(9),DA(10),DA(11),DA(12),DA(13),DA(14),DA(15),DA(16),DA(17),DA(18),DA(19),DA(20),DA(21),DA(22),DA(23),DA(24),DA(25),DA(26),DA(27),DA(28),DA(29));
}
LOG_I(alog,"\n");
}break;//end BT_GAP_LE_ADVERTISING_REPORT_IND
case BT_GAP_LE_SET_RANDOM_ADDRESS_CNF:
LOG_I(alog, "[BT_GAP_LE_SET_RANDOM_ADDRESS_CNF](%d)", status);
// start advertising
//app_start_advertising();
break;
case BT_GAP_LE_SET_ADVERTISING_CNF:
LOG_I(alog, "[BT_GAP_LE_SET_ADVERTISING_CNF](%d)", status);
break;
case BT_GAP_LE_DISCONNECT_IND:
LOG_I(alog, "[BT_GAP_LE_DISCONNECT_IND](%d)", status);
// start advertising
//app_start_advertising();
break;
case BT_GAP_LE_CONNECT_IND:
LOG_I(alog, "[BT_GAP_LE_CONNECT_IND](%d)", status);
break;
}
LOG_I(alog, "<--- bt_event_callback(0x%08X,%d)", msg, status);
return BT_STATUS_SUCCESS;
}
BT Scan Info...
[T: 44189 M: alog C: info F: app_bt_event_callback L: 199]: Address Type = 1
[T: 44197 M: alog C: info F: app_bt_event_callback L: 200]: Address = 46 64 1B D6 DA 42
[T: 44206 M: alog C: info F: app_bt_event_callback L: 201]: Direct Address Type = 0
[T: 44215 M: alog C: info F: app_bt_event_callback L: 202]: Direct Address = 00 00 00 00 00 00
[T: 44223 M: alog C: info F: app_bt_event_callback L: 203]: rssi = -89
[T: 44232 M: alog C: info F: app_bt_event_callback L: 204]: data_length = 28
[T: 44241 M: alog C: info F: app_bt_event_callback L: 210]: 03 03 9F FE 17 16 9F FE 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
[T: 44250 M: alog C: info F: app_bt_event_callback L: 212]:
[T: 44260 M: alog C: info F: app_bt_event_callback L: 251]: <--- bt_event_callback(0x10000008,0)
[T: 44267 M: alog C: info F: app_bt_event_callback L: 165]: ---> bt_event_callback(0x08010001,0)
[T: 44275 M: alog C: info F: app_bt_event_callback L: 251]: <--- bt_event_callback(0x08010001,0)
[T: 44284 M: alog C: info F: app_bt_event_callback L: 165]: ---> bt_event_callback(0x08010001,0)
[T: 44291 M: alog C: info F: app_bt_event_callback L: 251]: <--- bt_event_callback(0x08010001,0)
[T: 58915 M: common C: info F: wifi_station_disconnected_event_handler L: 153]: wifi disconnected
[T: 60273 M: inband C: warning F: inband_queue_evt_handler L: 791]: u2PacketType(0xe000), ucEID(0x76), ucSeqNum(0x0) not handled!
[T: 60381 M: common C: info F: wifi_station_port_secure_event_handler L: 118]: wifi connected
[T: 60413 M: common C: info F: ip_ready_callback L: 79]: ************************
[T: 60413 M: common C: info F: ip_ready_callback L: 80]: DHCP got IP:192.168.1.122
[T: 60413 M: common C: info F: ip_ready_callback L: 81]: ************************
[T: 61885 M: common C: info F: wifi_station_disconnected_event_handler L: 153]: wifi disconnected
[T: 63135 M: inband C: warning F: inband_queue_evt_handler L: 791]: u2PacketType(0xe000), ucEID(0x76), ucSeqNum(0x0) not handled!
[T: 63242 M: common C: info F: wifi_station_port_secure_event_handler L: 118]: wifi connected
[T: 63281 M: common C: info F: ip_ready_callback L: 79]: ************************
[T: 63281 M: common C: info F: ip_ready_callback L: 80]: DHCP got IP:192.168.1.122
[T: 63281 M: common C: info F: ip_ready_callback L: 81]: ************************
[T: 71921 M: common C: info F: wifi_station_disconnected_event_handler L: 153]: wifi disconnected
[T: 73300 M: inband C: warning F: inband_queue_evt_handler L: 791]: u2PacketType(0xe000), ucEID(0x76), ucSeqNum(0x0) not handled!
[T: 73411 M: common C: info F: wifi_station_port_secure_event_handler L: 118]: wifi connected
[T: 73446 M: common C: info F: ip_ready_callback L: 79]: ************************
[T: 73446 M: common C: info F: ip_ready_callback L: 80]: DHCP got IP:192.168.1.122
[T: 73446 M: common C: info F: ip_ready_callback L: 81]: ************************
[T: 81956 M: common C: info F: wifi_station_disconnected_event_handler L: 153]: wifi disconnected
[T: 83206 M: inband C: warning F: inband_queue_evt_handler L: 791]: u2PacketType(0xe000), ucEID(0x76), ucSeqNum(0x0) not handled!
[T: 83310 M: common C: info F: wifi_station_port_secure_event_handler L: 118]: wifi connected
[T: 83347 M: common C: info F: ip_ready_callback L: 79]: ************************
[T: 83347 M: common C: info F: ip_ready_callback L: 80]: DHCP got IP:192.168.1.122
[T: 83347 M: common C: info F: ip_ready_callback L: 81]: ************************
[T: 91992 M: common C: info F: wifi_station_disconnected_event_handler L: 153]: wifi disconnected
[T: 93242 M: inband C: warning F: inband_queue_evt_handler L: 791]: u2PacketType(0xe000), ucEID(0x76), ucSeqNum(0x0) not handled!
[T: 93347 M: common C: info F: wifi_station_port_secure_event_handler L: 118]: wifi connected
[T: 93374 M: common C: info F: ip_ready_callback L: 79]: ************************
[T: 93374 M: common C: info F: ip_ready_callback L: 80]: DHCP got IP:192.168.1.122
[T: 93374 M: common C: info F: ip_ready_callback L: 81]: ************************