Hi,all.
In dsps project "DA14580_DSPS_3.150.2", The host is send scan cmd but not scan any perpheral device.
But in phone app can scan perpheral device.
why ?
please help me.
the code is not change but add some tips by uart.the place is follow:
void app_scanning(void)
{
ke_state_set(TASK_APP, APP_CONNECTABLE);
// create a kernel message to start the scanning
struct gapm_start_scan_cmd *msg = (struct gapm_start_scan_cmd *)KE_MSG_ALLOC(GAPM_START_SCAN_CMD, TASK_GAPM, TASK_APP, gapm_start_scan_cmd);
// Maximal peer connection
msg->mode = GAP_GEN_DISCOVERY;
msg->op.code = GAPM_SCAN_PASSIVE;
msg->op.addr_src = GAPM_PUBLIC_ADDR;
msg->filter_duplic = SCAN_FILT_DUPLIC_EN;
msg->interval = APP_SCAN_INTERVAL;
msg->window = APP_SCAN_WINDOW;
uart_write("\r\nS7\r\n", 6, NULL); //////add by me
// Send the message
ke_msg_send(msg);
}
in gapm_cmp_evt_handler function add tips:
case GAPM_SCAN_PASSIVE:
case GAPM_SCAN_ACTIVE:
{
if (param->status == GAP_ERR_CANCELED)
{
uart_write("\r\nS6\r\n", 6, NULL); //add by me
app_connect();
}
else
{
uart_write("\r\nS7\r\n", 6, NULL); //add by me
app_scanning();
}
}
break;
in app_set_dev_config_complete_func function:
void app_set_dev_config_complete_func(void)
{
// We are now in Initialization State
ke_state_set(TASK_APP, APP_DB_INIT);
// Add the first required service in the database
if (app_db_init())
{
// When the data base is already made start advertising
uart_write("\r\nS1\r\n", 6, NULL); //add by me
app_scanning();
}
}
In gapm_adv_report_ind_handler function :
int gapm_adv_report_ind_handler(ke_msg_id_t const msgid,
const struct gapm_adv_report_ind *param,
ke_task_id_t const dest_id,
ke_task_id_t const src_id)
{
/*
if(!memcmp(¶m->report.data[3], APP_DFLT_ADV_DATA, APP_DFLT_ADV_DATA_LEN))
{
//Save found bd_addr to global variable
memcpy(&connect_bdaddr, param->report.adv_addr.addr, sizeof(struct bd_addr));
uart_write("\r\nS5\r\n", 6, NULL); //add by me
app_cancel_scanning();
}
else
*/
uart_write("\r\nS6\r\n", 6, NULL); //add by me
return (KE_MSG_CONSUMED);
}
I close the sleep mode in da14580_config.h.
not change any thing.
the result is :
S1
S7
S7
S7
S7
every S7 tip is about 10 second gap.
I used "DA14580_DSPS_3.150.2", The sps_device and sps_host.
but not go in to gapm_adv_report_ind_handler function.
the phone app can scan 14580's perpheral device. .
why not go into gapm_adv_report_ind_handler function?
wait for your help.