hii....
i implemented ble scanning. The problem i faced here when i change Scan window and Scan interval there is no change in window and interval .ie, when i fixed this window and interval to 10 sec or any other i get scanning complete in 7 seconds always
void user_scan_start(void)
{
struct gapm_start_scan_cmd* cmd = KE_MSG_ALLOC(GAPM_START_SCAN_CMD,
TASK_GAPM, TASK_APP,
gapm_start_scan_cmd);
cmd->op.code = user_scan_conf.code;
cmd->op.addr_src = user_scan_conf.addr_src;
cmd->interval = 4000; // 10 sec
cmd->window = 4000; // 10 sec
cmd - >模式= user_scan_conf.mode;
cmd->filt_policy = user_scan_conf.filt_policy;
cmd->filter_duplic = user_scan_conf.filter_duplic;
// Send the message
ke_msg_send(cmd);
// We are now connectable
ke_state_set(TASK_APP, APP_CONNECTABLE);
}
static const struct scan_configuration user_scan_conf ={
/// Operation code.
.code = GAPM_SCAN_PASSIVE,
/// Own BD address source of the device
.addr_src = GAPM_PUBLIC_ADDR,
/// Scan interval
.interval = 4000,
/ / /扫描窗口大小
.window = 4000,
/// Scanning mode
.mode = GAP_GEN_DISCOVERY,
/// Scan filter policy
.filt_policy = SCAN_ALLOW_ADV_ALL,
/// Scan duplicate filtering policy
.filter_duplic = SCAN_FILT_DUPLIC_EN,
};
1. why this scan window and scan interval not changing. i need some help to resolve this
2. what is the maximum scan window and interval i can fix?
Hi alan.a,
When operating in a scanning mode GAP_GEN_DISCOVERY the scan procedure will automatically timeout in about 7 seconds, so if you set a scan window and a scan interval summing in a total of 7 seconds that means that you will only scan in channel 37 for 7 seconds since the procedure will timeout before changing the channel. The interval and the channel do not set how long the scan procedure will last but what will be your actual window and interval. Set smaller amounts of time for the window and the interval and in GAP_GEN_DISCOVERY you will rotate through the advertising channels for about 7 seconds. If you would like to get rid of the timeout you can scan using the GAP_OBSERVER_MODE mode where the operation doesn't timeout and you will have to explicity cancel the specific air operation in order to stop the scan. The maximum values for the window and the interval is 16384 which corresponds to about 10.24 sec.
Thanks MT_dialog