how to use the White List for scanning

19个帖子/ 0新
最后一篇
liuluan002
Offline
最后一次露面:6 months 4 days ago
加入:2015-11-27 14:24
how to use the White List for scanning

Hi Dialog,

I am trying to define my function for the scanning the package over the air, I have checked the document and made my function as the following. My question, where and how should I degine my White List for the scanning?

void scanner(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 = GAPM_SCAN_PASSIVE;
cmd->interval = 4000; //10s
cmd->window = 4000; //10s
cmd->mode = GAP_GEN_DISCOVERY;
cmd-> filt_policy = scan_allow_adv_wlst;
cmd->filter_duplic = SCAN_FILT_DUPLIC_DIS;
ke_msg_send(cmd);
}

设备:
MT_dialog
Offline
最后一次露面:2个月2周前
Staff
加入:2015-06-08 11:34
Hi liuluan002,

Hi liuluan002,

Please have a look at the RW-BLE-GAP-IS for the GAPM_WHITE_LIST_MGT_CMD this way you can manage the devices you have in your with list. You can use something like the following snippet

void manage_white_list(void)
{
uint8_t white_addr[6] = {0x01, 0x00, 0x00, 0xCA, 0xEA, 0x80};
struct gapm_white_list_mgt_cmd * cmd = ke_msg_alloc_dyn(gapm_white_list_mgt_cmd,
TASK_GAPM,
TASK_APP,
gapm_white_list_mgt_cmd,
sizeof(struct gap_bdaddr));
cmd->操作= gapm_add_dev_in_wlist;
cmd->nb = 1;
memcpy((void *) &cmd->devices[0].addr, (void *)white_addr, BD_ADDR_LEN);
ke_msg_send(cmd);
}

谢谢mt_dialog.

liuluan002
Offline
最后一次露面:6 months 4 days ago
加入:2015-11-27 14:24
thank you. One more questions

thank you. One more questions.
When I try to make the broadcasting from the following functions: by broadcasting different package into the air each 10ms. Is it possible to make the broadcasting different package faster than 10ms? Is there any influence to make the broadcasting process fails, if I make it broadcasting out quite quickly? Is it a problem for the receiving side scan to get it?

void set_adv_func(struct gapm_start_advertise_cmd *cmd,uint8_t *data, uint8_t len)
{
if ( len > 26 )
{
len = 26;
}

cmd-> op.code = gapm_adv_undirect;
cmd->op.addr_src = GAPM_PUBLIC_ADDR;
cmd->intv_min = 16; // 32*0.625 =20ms;
cmd-> intv_max = 16;//
cmd->channel_map = 0x01;//channel 37

cmd->info.host.mode = GAP_GEN_DISCOVERABLE; //General Discoverable Mode

// / * ----------------------------------------------------------------------------------
//*Set the Advertising Data and the Scan Response Data
// * -------------------------------------------------------------------- * /
cmd->info.host.adv_data_len = APP_ADV_DATA_MAX_SIZE;
cmd-> info.host.scan_rsp_data_len = 0;//没有响应扫描

if((数据!= null)&&(len> 0))
{

memcpy (cmd - > info.host.adv_data +2, data, len);
cmd->info.host.adv_data_len = len+2;
cmd->info.host.adv_data[0] = len + 1;
}

else
{
#if debug_log2.
printf_string("\r\nEmpty input so load Data1:");
UART2_INIT(UART_BAUDRATE_115K2,3);
#endif

memcpy (cmd - > info.host.adv_data +2, data, 26);
cmd-> info.host.adv_data_len = len + 2;
cmd->info.host.adv_data[0] = len + 1;
}
//update the data for broadcasting each 10*1ms
ke_timer_set(APP_DYNAMIC_ADV_DATA, TASK_APP, 1);
返回;
}

liuluan002
Offline
最后一次露面:6 months 4 days ago
加入:2015-11-27 14:24
嗨对话框,

嗨对话框,

我用以下代码测试了白色列表
In the app_task.c, I have write the following:

void app_scan(void)
{
manage_white_list();
struct gapm_start_scan_cmd * cmd = ke_msg_alloc(gapm_start_scan_cmd,
task_gapm,task_app,
gapm_start_scan_cmd);

cmd->op.code = GAPM_SCAN_PASSIVE;
cmd->间隔= 4800;
cmd->窗口= 4800;
cmd->mode = GAP_GEN_DISCOVERY;
cmd-> filt_policy = scan_allow_adv_wlst,
cmd->filter_duplic = SCAN_FILT_DUPLIC_DIS;
//Send the message
ke_msg_send(cmd);
}

When I try to call the app_scan, the first time it works, the second time it does not works, the third time works.... I have found it only works for the odd times. For the even times, it does not works. Could you please help?

MT_dialog
Offline
最后一次露面:2个月2周前
Staff
加入:2015-06-08 11:34
Hi liuluan002,

Hi liuluan002,

What do you mean when you say that "it doesn't work", it retruns any device advertising at the moment or it doesn't return anything ? I am issuing scans via external interrupts using a button using your scan configuration, the device seems to be returning the device in the white list in every press (please check it by using a break point in the advertising indication user_on_adv_report_ind() function). Also i would advice you, not to place the addition of the a new device in the scan request function. Every time you are issuing a scan i suppose that you are adding the same device (i am not aware if this can cause you any trouble). Please have a look at the keyboard reference design in the app_white_list.c file, it uses the white list feature, perhaps you will find it usefull.

谢谢mt_dialog.

liuluan002
Offline
最后一次露面:6 months 4 days ago
加入:2015-11-27 14:24
Hi Dialog,

Hi Dialog,

我的意思是“没有工作”是扫描不返回任何东西。如果我在每次运行时将函数“manage_white_list()”放入我的“app_scan()”,第一次扫描正常,计时器重置后的第二次“ke_timer_set(app_switch_role_timer,task_app,250);和ke_timer_set(app_switch_role_timer,task_app,20);“似乎扫描没有返回任何东西。此外,这保持继续返回下次用于扫描的工作,下次下一次没有用于扫描(这种现象继续持续)。

如果我只使用“manage_white_list()函数“for once, the next time after I GAPM_RESET by the timer"ke_timer_set(APP_SWITCH_ROLE_TIMER, TASK_APP, 250);"and reload the "app_scan()" function, it will return back nothing. The next, when I do the GAPM_RESET again, then use the "app_scan" still return back nothing.

这是我的代码的一些部分

In the app_task.c:

//device configuration updated
CASE GAPM_SET_DEV_CONFIG:
{
if(param-> status!= gap_err_no_error)
{
assert_err(0);// 意外的错误
}
else
{
if( 0 == current_role)
{
//Advertisement
EXECUTE_CALLBACK_VOID(app_on_set_dev_config_complete);
}

else
{
//扫描
app_scan();
}

if( 0 == current_role)
{
ke_timer_set(APP_SWITCH_ROLE_TIMER, TASK_APP, 20);
}
if( 1 == current_role)
{
ke_timer_set(APP_SWITCH_ROLE_TIMER, TASK_APP, 250);
}
}
}
break;

void manage_white_list(void)
{

struct gapm_white_list_mgt_cmd * cmd = ke_msg_alloc_dyn(gapm_white_list_mgt_cmd,
TASK_GAPM,
TASK_APP,
gapm_white_list_mgt_cmd,
sizeof(struct gap_bdaddr));
cmd->操作= gapm_add_dev_in_wlist;
cmd->nb = 1;
memcpy((void *) &cmd->devices[0].addr, (void *)white_addr, BD_ADDR_LEN);
ke_msg_send(cmd);
}

volatile uint8_t white_flag;
void app_scan(void)
{
if(0 == white_flag)
{
manage_white_list();
white_flag = 5;
}
struct gapm_start_scan_cmd * cmd = ke_msg_alloc(gapm_start_scan_cmd,
task_gapm,task_app,
gapm_start_scan_cmd);
cmd->op.code = GAPM_SCAN_PASSIVE;
cmd->间隔= 4800;
cmd->窗口= 4800;
cmd->mode = GAP_GEN_DISCOVERY;
cmd-> filt_policy = scan_allow_adv_wlst,
cmd->filter_duplic = SCAN_FILT_DUPLIC_DIS;
ke_msg_send(cmd);
}

In app.c, we have:

volatile uint8_t current_role = 1; //0±íʾÔÚ×ö¹ã²¥£¬1±íʾÔÚ×öɨÃè
static struct gapm_set_dev_config_cmd* app_easy_gap_dev_config_create_msg(void)
{
//Allocate a message for GAP
if(set_dev_config_cmd == null)
{
struct gapm_set_dev_config_cmd* cmd;
cmd = app_gapm_configure_msg_create();
set_dev_config_cmd = cmd;

if(USER_CONFIG)
{
cmd->操作= gapm_set_dev_config;

if( 1 == current_role ){

cmd->角色= user_gapm_conf.role;
current_role = 0;

}别的{
cmd->角色= gap_central_mst;
current_role = 1;
}
cmd->appearance = user_gapm_conf.appearance;
cmd->appearance_write_perm = user_gapm_conf.appearance_write_perm;
cmd->name_write_perm = user_gapm_conf.name_write_perm;
cmd->max_mtu = user_gapm_conf.max_mtu;
cmd-> con_intv_min = user_gapm_conf.con_intv_min;
cmd->con_intv_max = user_gapm_conf.con_intv_max;
cmd->con_latency = user_gapm_conf.con_latency;
cmd->superv_to = user_gapm_conf.superv_to;
cmd->标志= user_gapm_conf.flags;
memcpy(cmd->irk.key,user_gapm_conf.irk,KEY_LEN);
}
else
memcpy((void *)cmd,(void *)和default_set_dev_config,sizeof(struct gapm_set_dev_config_cmd));
}
return (set_dev_config_cmd);
}

MT_dialog
Offline
最后一次露面:2个月2周前
Staff
加入:2015-06-08 11:34
Hi liuluan002,

Hi liuluan002,

由于您在角色之间交替,我不确定这是由白色列表引起的东西,请删除白色列表管理并尝试扫描并返回您可以找到的BD地址。当您在第二次尝试时,您无法找到您的设备的任何广告,您根本可以扫描吗?我的代码意味着您的设备配置为每秒钟和外设无法扫描的外设(如果)user_gapm_conf.role是A.GAP_PERIPHERAL_SLV).

谢谢mt_dialog.

liuluan002
Offline
最后一次露面:6 months 4 days ago
加入:2015-11-27 14:24
Hi Dialog,

Hi Dialog,

I did not use the GAP_PERIPHERAL_SLV, when it is scanning, My role switching function is written as the following:

volatile uint8_t current_role = 1; //0±íʾÔÚ×ö¹ã²¥£¬1±íʾÔÚ×öɨÃè
static struct gapm_set_dev_config_cmd* app_easy_gap_dev_config_create_msg(void)
{
//Allocate a message for GAP
if(set_dev_config_cmd == null)
{
struct gapm_set_dev_config_cmd* cmd;
cmd = app_gapm_configure_msg_create();
set_dev_config_cmd = cmd;

if(USER_CONFIG)
{
cmd->操作= gapm_set_dev_config;

if( 1 == current_role ){
cmd->角色= user_gapm_conf.role;
current_role = 0;

}别的
{
cmd->角色= gap_central_mst;
current_role = 1;
}
cmd->appearance = user_gapm_conf.appearance;
cmd->appearance_write_perm = user_gapm_conf.appearance_write_perm;
cmd->name_write_perm = user_gapm_conf.name_write_perm;
cmd->max_mtu = user_gapm_conf.max_mtu;
cmd-> con_intv_min = user_gapm_conf.con_intv_min;
cmd->con_intv_max = user_gapm_conf.con_intv_max;
cmd->con_latency = user_gapm_conf.con_latency;
cmd->superv_to = user_gapm_conf.superv_to;
cmd->标志= user_gapm_conf.flags;
memcpy(cmd->irk.key,user_gapm_conf.irk,KEY_LEN);
}
else
memcpy((void *)cmd,(void *)和default_set_dev_config,sizeof(struct gapm_set_dev_config_cmd));
}
return (set_dev_config_cmd);
}

现在我试图改变只运行扫描的代码,但有时它在扫描期间无法获得任何东西。然而,大多数时间都可以从扫描中获得结果。

CASE GAPM_SET_DEV_CONFIG:
{
if(param-> status!= gap_err_no_error)
{
assert_err(0);// 意外的错误
}
else
{
if( 0 == current_role)
{
EXECUTE_CALLBACK_VOID(app_on_set_dev_config_complete);
}
else
{
app_scan();
position11++;
}

if( 0 == current_role)
{

ke_timer_set(app_switch_role_timer,task_app,0);
}
if( 1 == current_role)
{
ke_timer_set(APP_SWITCH_ROLE_TIMER, TASK_APP, 250);
}
}
}
break;

以下是日志

开始扫描H.

尺寸白色s
Size white L=00000009

ADDR:80EACA000049 A0 0201061B007F100000000003CF1003CO01FF3C01FF3E02FF3E
T2=00000CFC
地址:80EACA000049 A0 0201061B00801000000001003D00013F01FE3D01003E02003E01003D01FE3C
T2=00000D0D
addr:80EACA000049 A0 0201061B00811000000001FF3D01013E00003E01003D02FE3E01FF3D02003E
T2=00000D1D
ADDR:80EACA000049 A0 0201061B00821000000000000000000/201F00000000003D01FF3D01F0000
T2=00000D2E
GAPM_RESET:

start adv A

BCT1= 06

GAPM_RESET:

开始扫描H.

尺寸白色s
Size white L=00000009

地址:80EACA000049 A0 0201061B00831000000001003E01FF3E02FF3E01003E01003D01003E01003E
T2=00000CE4
addr:80EACA000049 A0 0201061B00841000000001003D01003E02FF3F02013E01FF3E01003D01FF3E
T2=00000CF4
addr:80EACA000049 9F 0201061B00851000000001003D01003E01003F02FF3F01003D01003D02003D
T2=00000D05
addr:80EACA000049 A0 0201061B00861000000002FF3D01003D02FF3C01003D01003D000000000000
T2=00000D16
GAPM_RESET:

start adv A

BCT1= 07

GAPM_RESET:

开始扫描H.

尺寸白色s
Size white L=00000009

addr:80EACA000049 9F 0201061B00871000000001003D02FF3E02FF3E01003D01FF3E01003E01FF3E
t2 = 00000ccc.
addr:80EACA000049 9F 0201061B00881000000001FF3D01FF3D01FF3E01013D02003D01FF3D01FF3E
t2 = 00000cdc.
ADDR:80EACA000049 9F 0201061B008910000003D01003D02003D02003D02003D02003D02003D02003D02003D01003D
T2=00000CED
addr:80EACA000049 9F 0201061B008A1000000001013D02003E01FF3F01003D01FF3C000000000000
T2=00000CFD
GAPM_RESET:

start adv A

BCT1= 08

GAPM_RESET:

开始扫描H.

尺寸白色s
Size white L=00000009

GAPM_RESET:

start adv A

Hello Message

BCT1 = 09年

GAPM_RESET:

开始扫描H.

尺寸白色s
Size white L=00000009

addr:80EACA000049 A0 0201061B008F1000000001003D01003D01FF3E01FF3D02003C02FF3E01003D
t2 = 00000c98.
addr:80EACA000049 A0 0201061B00901000000001003E01FF3E01FF3F01FF3D01003D01003E01003E
t2 = 00000ca9.
addr:80EACA000049 A0 0201061B00911000000002003D01003E01003E02FF3D02FF3F02FF3D01013D
t2 = 00000cb9.
addr:80EACA000049 A0 0201061B00921000000002003E01003D00003E02003F00013D000000000000
t2 = 00000cca.
GAPM_RESET:

start adv A

BCT1= 0A

GAPM_RESET:

开始扫描H.

尺寸白色s
Size white L=00000009

addr:80EACA000049 A0 0201061B00931000000000013D02013D02FF3E02FE3E02003E01003E00003E
T2=00000C80
ADDR:80EACA000049 A0 0201061FF3E01003D02004002FF3D01FF3E02FF3F01FF3E
t2 = 00000c90.
ADDR:80EACA000049 A0 0201061B0095100000000/303CY3D01003D02003D01003D02003D02003E0253D02003E02FF3E
t2 = 00000ca1.
ADDR:80EACA000049 A0 0201061B0096100000000001FF3F01003D01003D01003D02FE3B00000000000000
t2 = 00000cb2.
GAPM_RESET:

start adv A

BCT1= 0B

GAPM_RESET:

开始扫描H.

尺寸白色s
Size white L=00000009

ADDR:80EACA000049 A2 0201061B0097100003D01003E02003D01003F01003E
T2=00000C68
ADDR:80EACA000049 A2 0201061003F01FF3E02003E02003D01FF3E01FF3E01003E
T2=00000C78
ADDR:80EACA000049 A2 0201061B0099100000000003D02003D01003D02003D01003D02003D01003D02003D01003D02003D01003D02003D01003D02003D01003E01003D
T2=00000C89
addr:80EACA000049 A2 0201061B009A1000000001003E01003D02003E02FF3E02003E000000000000
t2 = 00000c99.
GAPM_RESET:

start adv A

BCT1= 0C

GAPM_RESET:

开始扫描H.

尺寸白色s
Size white L=00000009

addr:80EACA000049 A2 0201061B009C1000000002003E02003E01003E02003E02003E01003E02003D
T2=00000C4F
addr:80EACA000049 A2 0201061B009D1000000001003D02003E01003D01003D01003D01003D02FF3E
T2=00000C60
ADDR:80EACA000049 A2 0201061B009E100000000001FF3E01003D01FF3D01003E02FF3D02FF3E01FF3E
T2=00000C70
ADDR:80EACA000049 A2 0201061B009F10000000000000000/201F3E01003D0100000000000000
T2=00000C81
GAPM_RESET:

start adv A

BCT1= 0D

GAPM_RESET:

开始扫描H.

尺寸白色s
Size white L=00000009

addr:80EACA000049 A2 0201061B00A01000000001003D02FF3E02FF3E02003D02003E01003F01003E
T2=00000C37
addr:80EACA000049 A2 0201061B00A11000000001013D01003E01003E02FF3D02003D01003E01FF3D
T2=00000C47
addr:80EACA000049 A2 0201061B00A21000000001003D01FF3E02003E02013E01FF3E02003F01013E
T2=00000C58
addr:80EACA000049 A2 0201061B00A31000000002003E01003E01013E01003E02013D000000000000
T2=00000C69
GAPM_RESET:

start adv A

BCT1= 0E

GAPM_RESET:

开始扫描H.

尺寸白色s
Size white L=00000009

addr:80EACA000049 A2 0201061B00A41000000002013D02FF3D01003D02003E01FF3E02003D01FF3E
T2=00000C1E
addr:80EACA000049 A2 0201061B00A51000000001003E02003E01FF3E01003E01003D01003D01013E
T2=00000C2F
addr:80EACA000049 A2 0201061B00A61000000001FF3E02013E01FF3F02FF3D01013E01FF3E01FF3E
T2=00000C40
addr:80EACA000049 A2 0201061B00A71000000002003E01003D02003F02FF3E01FF3E000000000000
T2=00000C50
GAPM_RESET:

start adv A

BCT1= 0F

GAPM_RESET:

开始扫描H.

尺寸白色s
Size white L=00000009

ADDR:80EACA000049 A2 0201061B00A8100000000001FF3E02FF3D01003E02003E02003E
T2=00000C06
addr:80EACA000049 A2 0201061B00A91000000002FF3D01003E01003D01003D02003E01013E02003D
T2=00000C17
addr:80EACA000049 A2 0201061B00AA1000000002003C02003D01003D01003E01FF3E01FF3E00003E
T2=00000C27
addr:80EACA000049 A2 0201061B00AB1000000001FF3E02003D02003D01003D01003D000000000000
T2=00000C38
GAPM_RESET:

start adv A

BCT1= 10

GAPM_RESET:

开始扫描H.

尺寸白色s
Size white L=00000009

addr:80EACA000049 A2 0201061B00AC1000000001003D00003F02003D01FF3E02003D01003E02003E
T2 = 00000Bee.
addr:80EACA000049 A2 0201061B00AD1000000002FF3E02003E01FF3E02FF3E01003F02003E02003E
T2=00000BFE
addr:80EACA000049 A2 0201061B00AE1000000002003D01003E02003D01003E01FF3D02003D02003E
T2=00000C0F
ADDR:80EACA000049 A2 0201061003F01FF3E01003D01003E02FF3E0000000000000000
T2=00000C20
GAPM_RESET:

liuluan002
Offline
最后一次露面:6 months 4 days ago
加入:2015-11-27 14:24
Hi Dialog,

Hi Dialog,

您有一个例子是否在白色列表中添加了3个地址?
How to do it?

Thank you

MT_dialog
Offline
最后一次露面:2个月2周前
Staff
加入:2015-06-08 11:34
Hi liuluan002,

Hi liuluan002,

最小间隔根据广告BLE spec is 20ms, the stack wont let you advertise in 10ms. I assume that you stop the advertsing using the timer and you issue an app_adv_start when the timer elapses. That has nothing to do with the specified interval. If you want to trasmit faster (you are out of the BLE spec so we aren't able to know what problems might occur) you could wait for a BLE advertising event to finish, stop the advertising, change the string, and start once more. You can check how this is done (track the end of an advertising event) by checking the beacon reference design in the app_asynch_trm() function.

谢谢mt_dialog.

liuluan002
Offline
最后一次露面:6 months 4 days ago
加入:2015-11-27 14:24
也是当我试图用的时候

此外,当我尝试使用主动扫描测试时,系统将在扫描一段时间后重新启动。它也弹出一些全部零的包。
void app_scan(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 = GAPM_SCAN_PASSIVE;
cmd-> op.code = gapm_scan_active;
cmd->间隔= 9600;
cmd->窗口= 9600;
cmd->mode = GAP_GEN_DISCOVERY;
cmd-> filt_policy = scan_allow_adv_wlst,
cmd->filter_duplic = SCAN_FILT_DUPLIC_DIS;
ke_msg_send(cmd);
}

以下是日志:

开始扫描H.

尺寸白色s
Size white L=00000009

ADDR:80EACA000049 B5 0201061B00CF10000000FFFec300FEC2FEFEC3FFEC2FFFEC3FFEC4FFEC2
T2=000009CA
addr:80EACA000049 B5 00000000000000000000000000000000000000000000000000000000000000
T2=000009DA
ADDR:80EACA000049 B4 0201061B00D010000000FEFEC3FFFDC4FFEC3FEFEC3FEFEC3FEFEC3FEFEC3
t2 = 000009eb.
地址:80EACA000049 B4 00000000000000000000000000000000000000000000000000000000000000
t2 = 000009fc.
ADDR:80EACA000049 B5 0201061B00D1100000000000FFEC3FFEC3FFFDC3FEFEC3FEFEC3FEFFC3FEFEC3
T2=00000A0E
addr:80EACA000049 B5 00000000000000000000000000000000000000000000000000000000000000
T2=00000A1E
ADDR:80EACA000049 B5 0201061B00D210000000FEFEC3FFFDC3FFFEC2FFFDC3FFFEC300000000000000
T2=00000A2F
addr:80EACA000049 B5 00000000000000000000000000000000000000000000000000000000000000
T2=00000A40
GAPM_RESET:

start adv A

BCT1= 14

GAPM_RESET:

开始扫描H.

尺寸白色s
Size white L=00000009

addr:80EACA000049 B5 0201061B00D410000000FEFEC4FEFFC3FFFEC4FEFEC4FFFEC3FEFEC3FFFEC3
T2=000009D1
addr:80EACA000049 B5 00000000000000000000000000000000000000000000000000000000000000
T2=000009E2
ADDR:80EACA000049 B5 0201061B00D510000000FEFEC3FFEC3FEFFC4FFFEC3FEFEC4FEFDC3FEFEC4
t2 = 000009f3
地址:80EACA000049 B4 00000000000000000000000000000000000000000000000000000000000000
T2=00000A03
GAPM_RESET:

start adv A

BCT1= 15

GAPM_RESET:

开始扫描H.

尺寸白色s
Size white L=00000009

addr:80EACA000049 B5 0201061B00D710000000FFFDC3FEFFC3FFFFC3FFFDC4FEFFC2FFFEC2FFFEC3
T2=00000999
addr:80EACA000049 B5 00000000000000000000000000000000000000000000000000000000000000
T2=000009AA
addr:80EACA000049 B4 0201061B00D810000000FFFEC4FFFEC4FEFEC3FEFEC4FFFEC3FFFEC3FEFFC3
T2=000009BA
addr:80EACA000049 B5 00000000000000000000000000000000000000000000000000000000000000
T2=000009CB
addr:80EACA000049 B5 0201061B00D910000000FFFFC3FEFFC3FFFEC3FEFEC3FFFEC4FEFDC4FFFEC3
T2=000009DD
addr:80EACA000049 B5 00000000000000000000000000000000000000000000000000000000000000
t2 = 000009ee.
addr:80EACA000049 B5 0201061B00DA10000000FFFEC3FEFEC3FFFEC3FFFEC3FFFFC4000000000000
t2 = 000009FE.
addr:80EACA000049 B5 00000000000000000000000000000000000000000000000000000000000000
T2=00000A0F
GAPM_RESET:

start adv A

BCT1= 16

GAPM_RESET:

开始扫描H.

尺寸白色s
Size white L=00000009

ADDR:80EACA000049 B5 0201061B00DB1000000000FFFFC4FEFEC3FEFDC3FEFDC3FEFEC3FEFEC2FEFEC3
T2=00000981
addr:80EACA000049 B5 00000000000000000000000000000000000000000000000000000000000000
T2=00000991
ADDR:80EACA000049 B4 0201061B00DC10000000FEFEC4FEFDC3FFEC3FFFEC3FEFEC3FEFDC3FFEC3
T2=000009A2
addr:80EACA000049 B5 00000000000000000000000000000000000000000000000000000000000000
T2=000009B3
addr:80EACA000049 B4 0201061B00DD10000000FEFFC3FEFEC3FFFEC3FFFDC3FFFEC3FEFEC3FFFEC2
T2=000009C5
addr:80EACA000049 B5 00000000000000000000000000000000000000000000000000000000000000
T2=000009D5
addr:80EACA000049 B4 0201061B00DE10000000FEFDC3FFFEC2FFFEC3FEFFC4FEFEC3000000000000
T2=000009E6
addr:80EACA000049 B5 00000000000000000000000000000000000000000000000000000000000000
t2 = 000009f7.
GAPM_RESET:

start adv A

BCT1= 17

GAPM_RESET:

开始扫描H.

尺寸白色s
Size white L=00000009

addr:80EACA000049 B4 0201061B00DF10000000FEFEC3FFFEC3FFFEC3FEFEC3FEFEC4FFFEC2FFFEC3
T2=00000968
addr:80EACA000049 B5 00000000000000000000000000000000000000000000000000000000000000
T2=00000979
addr:80EACA000049 B5 0201061B00E010000000FEFEC3FFFEC3FFFEC4FFFEC3FFFEC3FFFEC3FEFEC2
T2=00000989
addr:80EACA000049 B5 00000000000000000000000000000000000000000000000000000000000000
T2=0000099A
ADDR:80EACA000049 B4 0201061B00E11000000000FFFCC3FFEC3FEFDC2FEFFC300FEC3FFFDC4FFEC4
T2=000009AC
addr:80EACA000049 B5 00000000000000000000000000000000000000000000000000000000000000
T2=000009BD
ADDR:80EACA000049 B4 0201061B00E21000000000FFC4FEFEC4FFEC3FEFEC3FEFDC4000000000000
T2=000009CE
addr:80EACA000049 B5 00000000000000000000000000000000000000000000000000000000000000
T2=000009DE
GAPM_RESET:

`device_init done

GAPM_RESET:

start adv A

GAPM_RESET:

MT_dialog
Offline
最后一次露面:2个月2周前
Staff
加入:2015-06-08 11:34
Hi liuluan002,

Hi liuluan002,

From your initial code i can see that whenever you issue a GAPM_RESET_CMD you are changing roles between the user_gapm_conf.role (what is the value of this if not GAP_PERIPHERAL_SLV ? ) and GAP_CENTRAL_MST depending on the current_role variable that changes to the opposite role every time you have a reset. You mentioned that the white list works in every odd number and you get some data back, in order to narrow down the problem please dont use the white list but try to scan all the available devices that are advertising at the moment in order to make sure that you are scanning indeed.

问题可能是您的UART打印(如果您使用Arch_printf()函数以打印数据),则在Arch_Main.c文件中的Schedule_While_ble_On()中尝试将代码放在片段中并删除如果(app_async_trm())中断;和ARCH_PRINTF_PROCESS();

if (app_asynch_trm())
{
继续;
}
else
{
arch_printf_process();
break;
}

Regarding your issue that sometimes you dont get any advertising, are you certain that your device is advertising ? and also i ve noticed that your scanning window is as long as your interval, that means that you listen to only one advertising channel for a quite long period, try to reduce your window and your interval in order to listen to all three channels of advertising frequently since there might be confilicts at that particular channel at the time you are scanning. Also as i allready mention this might occur due to UART printing, please try to catch the advertising indications using break points instead of UART printing in order to be sure. Finally perhaps at the time you are performing the scanning there is two much air activity and no advertising can reach your receiver intact so you dont get any indications.

About the zeros you are getting, are data from the scan request you are sending to the peripheral, those are the scan response data of your peripheral device.

谢谢mt_dialog.

liuluan002
Offline
最后一次露面:6 months 4 days ago
加入:2015-11-27 14:24
I have remove the white list,

我删除了白色列表,并开始扫描和检查而无需在扫描期内丢失,似乎它有效。问题我猜这是您为White List提供的功能可能导致问题。

Do you means 14583 may go into the mode not GAP_PERIPHERAL_SLV, and either not GAP_CENTRAL_MST, which do you means may triggers it can not scan anything from the broadcasting package?

If I use white list, it seems it works for the 70% of the period, some periods can not scan anything.(now it is not even and odd problem)

我今天测试了以下代码,似乎没有有助于改善扫描中丢失的包。
if (app_asynch_trm())
{
继续;
}
else
{
arch_printf_process();
break;
}

Is it possible that you can help us to check part of the code please? May I get your email and send it to you?

你的意思是gap_peripherwal_slv

MT_dialog
Offline
最后一次露面:2个月2周前
Staff
加入:2015-06-08 11:34
Hi liuluan002,

Hi liuluan002,

In your device you are changing roles, from GAP_CENTRAL_MST to something else defined in your configuration file, what is the other role that you instruct your device to turn into after it gets the reset, what is the other role user_gapm_conf.role in this variable ?

if(USER_CONFIG)
{
cmd->操作= gapm_set_dev_config;

if( 1 == current_role ){
cmd->角色= user_gapm_conf.role;
current_role = 0;

}别的
{
cmd->角色= gap_central_mst;
current_role = 1;
}

Also regarding the white list, there is an implementation of the white list in the keyboard reference design in the app_white_list.c in the send_white_list_mgt_cmd() function, you can have a look at this.

谢谢mt_dialog.

liuluan002
Offline
最后一次露面:6 months 4 days ago
加入:2015-11-27 14:24
I think it is the GAP

我认为它是Gap_peripheral_slv,我在user_config.h中找到了以下内容。
static const结构gapm_configuration user_gapm_conf = {
.role = GAP_PERIPHERAL_SLV,
.irk = {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},
///设备外观(0x0000 - 未知外观)
//Fill in according tohttps://developer.bluetooth.org/gatt/characteristics/pages/charracteristi ...
.appearance = 0,
.appearance_write_perm = GAPM_WRITE_DISABLE,
.name_write_perm = GAPM_WRITE_DISABLE,
/// Maximal MTU
.max_mtu = 23,
///仅限外围设备:*******************************************************************
/// Slave preferred Minimum of connection interval measured in ble double slots (1.25ms)
/// use the macro MS_TO_DOUBLESLOTS to convert from milliseconds (ms) to double slots
.con_intv_min = ms_to_doubleslots(10),
/// Slave preferred Maximum of connection interval measured in ble double slots (1.25ms)
/// use the macro MS_TO_DOUBLESLOTS to convert from milliseconds (ms) to double slots
.con_intv_max = MS_TO_DOUBLESLOTS(20),
///从属喜欢连接延迟。它在跳过的连接事件中测量
.con_latency = 0,
/// Slave preferred Link supervision timeout measured in timer units (10 ms)
/// use the macro MS_TO_TIMERUNITS to convert from milliseconds (ms) to timer units
.superv_to = ms_to_timerUnits(1000),
///隐私设置位字段(0b1 =启用,0b0 =禁用)
/// - [bit 0]: Privacy Support
/// - [bit 1]: Multiple Bond Support (Peripheral only); If enabled, privacy flag is
/// 只读。
/// - [bit 2]: Reconnection address visible.
.flags = 0.
};

MT_dialog
Offline
最后一次露面:2个月2周前
Staff
加入:2015-06-08 11:34
Hi liuluan002,

Hi liuluan002,

To be honest i haven't understand what you are trying to do, you are performing role switching between to roles the one is central and the other is a peripheral, the peripheral cant execute the scanning procedure. So since you are only scanning why you need this extra code of the role switching. Even with the role switching in an attemp to replicate your problem i ve made a device that issues a role switch on a button press, the scanning procedure included the white list didn't show any kind of manfunctions and always returned the proper device. Please try to make a simple scanner with no role switching based on the DSPS host application and then you can apply the white list and test it.

谢谢mt_dialog.

liuluan002
Offline
最后一次露面:6 months 4 days ago
加入:2015-11-27 14:24
Hi,

Hi,

我正在执行角色切换是因为我想制作一个用于扩展广播包的距离的转发器。当我从扫描中获取广告包时,我只需通过向下的角色交换机重复我。

liuluan002
Offline
最后一次露面:6 months 4 days ago
加入:2015-11-27 14:24
Hi Dialog,

Hi Dialog,

您有一个例子是否在白色列表中添加了3个地址?
How to do it?

Thank you

MT_dialog
Offline
最后一次露面:2个月2周前
Staff
加入:2015-06-08 11:34
Hi liuluan002,

Hi liuluan002,

使用白色列表,虚拟或实际的BLE堆栈的实际白色列表的唯一项目是键盘,没有任何示例,该示例可以添加3个设备。

谢谢mt_dialog.