您是否阅读过Riviera Waves Gap Spec(RW-BLE-GAP-IS.PDF)?复制和粘贴:
4.2通用接口 通用间隙管理器提供一组命令,这些命令通过以下命令完成事件完成 信息。 4.2.1 GAPM_CMP_EVT. 参数: 类型参数说明 uint8\t操作GAPM操作代码(见表23) uint8_t status Status of the operation (see Table 39) 描述: This is the generic complete event for GAP operations. All operations trigger this event when operation is finished --------------------------------------剪断--------------------------------------
/// Advertising data length - maximum 28 bytes, 3 bytes are reserved to set #定义用户\广告\数据\长度(sizeof(USER\广告\数据)-1) ///广告名称 #定义用户\设备\名称(“a”) ///广告名称长度 #定义用户\设备\名称\长度(sizeof(USER\设备\名称)-1) ///扫描响应数据 #定义用户\u播发\u扫描\u响应\u数据“” ///扫描响应数据长度-最大31字节 #定义用户\广告\扫描\响应\数据\长度(sizeof(用户\广告\扫描\响应\数据)-1)
static const struct connection_param_configuration user_connection_param_conf = { ///在BLE双槽(1.25ms)中测量的连接间隔最小值 /// use the macro MS_TO_DOUBLESLOTS to convert from milliseconds (ms) to double slots .intv_min = ms_to_doubleslots(10), ///在BLE双槽(1.25ms)中测量的连接间隔最大值 /// use the macro MS_TO_DOUBLESLOTS to convert from milliseconds (ms) to double slots .intv_max = MS_TO_DOUBLESLOTS(20), ///在连接事件中测量的延迟 .latency = 0, ///以计时器单位测量的监控超时(10毫秒) ///使用宏观MS_TO_TIMERUNITS从毫秒(MS)转换为定时器单位 .time_out = ms_to_timerUnits(1250), ///在ble双插槽中测量的最小连接事件持续时间(1.25ms) /// use the macro MS_TO_DOUBLESLOTS to convert from milliseconds (ms) to double slots .ce\u len\u min=MS\u到\u双插槽(0), ///在ble双插槽中测量的最大连接事件持续时间(1.25ms) /// use the macro MS_TO_DOUBLESLOTS to convert from milliseconds (ms) to double slots .ce\u len\u max=MS\u到\u双插槽(0), };
谢谢,最后,得到它的工作。 one more question: if I changed " msg->window = 5;" (setting to 5, works) to " msg->window = 50;" or " msg->window = 500", it didn't catch adv indication, but call user_scanning_completed(defined in user callback file) immediately, why? what is the meaning of window here?
您是否阅读过Riviera Waves Gap Spec(RW-BLE-GAP-IS.PDF)?复制和粘贴:
4.2通用接口
通用间隙管理器提供一组命令,这些命令通过以下命令完成事件完成
信息。
4.2.1 GAPM_CMP_EVT.
参数:
类型参数说明
uint8\t操作GAPM操作代码(见表23)
uint8_t status Status of the operation (see Table 39)
描述:
This is the generic complete event for GAP operations. All operations trigger this event when operation is
finished
--------------------------------------剪断--------------------------------------
因此,GAPM_CMP_EVT消息有两个参数:操作和状态。操作参数是刚刚完成的命令,并且状态是如何/为何完成。
状态代码:
价值错误描述
0x00 gap_err_no_error没有错误
0x40 GAP_ERR_INVALID_PARAM Invalid parameters set
0x41 GAP\u ERR\u PROTOCOL\u协议交换有问题,得到意外响应
0x42 GAP_ERR_NOT_SUPPORTED Request not supported by software configuration
0x43当前状态下不允许的GAP\ U ERR\ U COMMAND\ U DISALLOWED Request not allowed。
0x44 GAP_ERR_CANCELED请求的操作取消。
0x45 GAP\u ERR\u TIMEOUT请求的操作超时。
0x46 GAP_ERR_DISCONNECTED Link connection lost during operation.
0x47 GAP_ERR_NOT_FOUND搜索算法完成,但找不到结果
0x48 GAP_ERR_REJECT请求由对等设备拒绝
0x49 GAP\u ERR\u PRIVACY\u CFG\u PB隐私配置有问题
0x4A GAP_ERR_ADV_DATA_INVALID Duplicate or invalid advertising data
表39:间隙错误代码
除此之外,GAPM\u CMP\u EVT消息没有提供更多信息。
If you're interested in received advertising events, that's GAPM_ADV_REPORT_IND.
你的问题有点模糊;也许你可以解释你的意思是“获取结果。”。结果是什么?
谢谢。
谢谢回复。
扫描之后,我想得到一个找到的设备的列表,此外,得到设备名称,rssi,地址等。
顺便说一下,我设置一个断点in GAPM_ADV_REPORT_IND, but didn't see it is reached.
请注意,扫描是观察者模式。
msg->mode=间隙\观察者\模式//GAP\u GEN\u发现
msg->op.code=GAPM\u SCAN\u ACTIVE;
msg-> op.addr_src = gapm_public_addr;
msg->filter_duplic = SCAN_FILT_DUPLIC_EN;
嗨Achao1104,
将休息点放在App_Task.c文件中的GapM_Adv_Report_ind_Handler()处,您将能够提取Adv_Report Struct的成员。如果您仍然没有进行指示,您可以使用DSP主机实现(使您需要的更改)并将断点放在相同的函数中,只是为了确保您成功配置了主机应用程序。
谢谢mt_dialog.
实际上,我在app_task.c文件中的GapM_Adv_Report_ind_Handler()中放置了一个断点,但尚未达到。顺便说一下,我正在使用最新的SDK5,你能把我指向“DSPS主机实现”(文件夹路径),只需确保我们正在谈论同样的事情。
我下载了DSP,不同的是我使用的是最新的sd5,并且**msg->mode=GAP\u observator\u mode**mode,我没有看到断点被到达。请帮忙。
我还将角色从GAP\u observator\u SCA改为GAP\u CENTRAL\u MST,并向后,但仍然不起作用。请帮帮我,这花了我好几天时间,请帮帮我。
static const struct gapm_configuration user_gapm_conf = {
//.ROLE = GAP_OBSERVER_SCA,
.role=GAP\u CENTRAL\u MST,
.irk={0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},
///设备外观(0x0000 - 未知外观)
//填写依据https://developer.bluetooth.org/gatt/characteristics/pages/charracteristi ...
.appearance = 0,
.appearance_write_perm = gapm_write_disable,
.name_write_perm = gapm_write_disable,
/// Maximal MTU
最大值=23,
这里是发送:
应用程序简易定时器(300,扫描cb);
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);
//最大对等连接
//msg->mode=GAP\u GEN\u发现//
msg-> mode = gap_observer_mode;
msg-> op.code = gapm_scan_passive;
msg-> op.addr_src = gapm_public_addr;
msg->filter_duplic = SCAN_FILT_DUPLIC_EN;
消息->间隔=100;
味精- >窗口= 5000;
发送消息(msg);
无效扫描\u cb(void)
{
struct gapm\u cancel\u cmd*cmd=(struct gapm\u cancel\u cmd*)KE\u MSG\u ALLOC(gapm\u cancel\u cmd,TASK\u gapm,TASK\u APP,gapm\u cancel\u cmd);
cmd->操作= gapm_scan_passive;//设置GAPM_SCAN_PASSIVE.
ke_msg_send(cmd);// Send the message
}
static const struct app_callbacks user_app_callbacks = {
.app_on_connection = NULL,
.app\u on\u disconnect=空,
.app\u on\u update\u params\u rejected=NULL,
.app_on_update_params_complete = null,
.app_on_set_dev_config_complete = default_app_on_set_dev_config_complete,
.app_on_adv_undirect_complete = NULL,
.app\u on\u adv\u direct\u complete=空,
.app \u on \u db \u init \u complete=默认的\u app \u on \u db \u init \u complete,
.app_on_scanning_completed = user_scanning_completed,
.app_on_adv_report_ind = user_adv_report_ind,
#if(ble_app_sec)
.app_on_pairing_request = null,
.app_on_tk_exch_nomitm = null,
.app_on_irk_exch = NULL,
.app_on_csrk_exch = null,
.app_on_ltk_exch = NULL,
.app\u on\u pairing\u succeeded=空,
.app\u on\u encrypt\u ind=空,
.app_on_mitm_passcode_req = null,
.app\u on\u encrypt\u req\u ind=空,
#endif//(表\应用\秒)
};
在广告侧:
// ---------------------------------------------------------------------------
//-------------不可连接和无向公共--
///广告服务数据
///广告数据中不得设置广告类型标志
#define user_advertise_data“\ x03”\
高级类型完整列表16位服务ID\
高级设备信息服务
/// Advertising data length - maximum 28 bytes, 3 bytes are reserved to set
#定义用户\广告\数据\长度(sizeof(USER\广告\数据)-1)
///广告名称
#定义用户\设备\名称(“a”)
///广告名称长度
#定义用户\设备\名称\长度(sizeof(USER\设备\名称)-1)
///扫描响应数据
#定义用户\u播发\u扫描\u响应\u数据“”
///扫描响应数据长度-最大31字节
#定义用户\广告\扫描\响应\数据\长度(sizeof(用户\广告\扫描\响应\数据)-1)
// ---------------------------------------------------------------------------
//-------------定向广告相关----------------------------
static const struct advertise_configuration user_directed_advertise_conf ={
///播发操作类型。
.advertise_operation=ADV_DIRECT,
/// Own BD address source of the device:
.address_src = gapm_public_addr,
///广告渠道图
.channel_map = 0x7,
};
static const struct inction_advertise_configuration user_directed_advertise_target_address_conf = {
///设备的BD地址
.ddr = {0x1,0x2,0x3,0x4,0x5,0x6},
///设备的地址类型0 = public / 1 =私有随机
.addr_type=0
};
// ---------------------------------------------------------------------------
// ------------------- param更新--------------------------
static const struct connection_param_configuration user_connection_param_conf = {
///在BLE双槽(1.25ms)中测量的连接间隔最小值
/// use the macro MS_TO_DOUBLESLOTS to convert from milliseconds (ms) to double slots
.intv_min = ms_to_doubleslots(10),
///在BLE双槽(1.25ms)中测量的连接间隔最大值
/// use the macro MS_TO_DOUBLESLOTS to convert from milliseconds (ms) to double slots
.intv_max = MS_TO_DOUBLESLOTS(20),
///在连接事件中测量的延迟
.latency = 0,
///以计时器单位测量的监控超时(10毫秒)
///使用宏观MS_TO_TIMERUNITS从毫秒(MS)转换为定时器单位
.time_out = ms_to_timerUnits(1250),
///在ble双插槽中测量的最小连接事件持续时间(1.25ms)
/// use the macro MS_TO_DOUBLESLOTS to convert from milliseconds (ms) to double slots
.ce\u len\u min=MS\u到\u双插槽(0),
///在ble双插槽中测量的最大连接事件持续时间(1.25ms)
/// use the macro MS_TO_DOUBLESLOTS to convert from milliseconds (ms) to double slots
.ce\u len\u max=MS\u到\u双插槽(0),
};
// ---------------------------------------------------------------------------
// ------------------- - - GAPM ---相关-----------------------------------
static const struct 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,0x00},
///设备外观(0x0000 - 未知外观)
//填写依据https://developer.bluetooth.org/gatt/characteristics/pages/charracteristi ...
.appearance = 0,
.appearance_write_perm = gapm_write_disable,
.name_write_perm = gapm_write_disable,
/// Maximal MTU
最大值=23,
///仅限外围设备:*******************************************************************
///在BLE双槽(1.25ms)中测量的连接间隔的从属的最低限度
/// use the macro MS_TO_DOUBLESLOTS to convert from milliseconds (ms) to double slots
.con_intv_min = MS_TO_DOUBLESLOTS(10),
///从位于BLE双槽(1.25ms)中测量的连接间隔的最优选的最大值
/// use the macro MS_TO_DOUBLESLOTS to convert from milliseconds (ms) to double slots
.con_intv_max=MS_到_双插槽(20),
///从属首选连接延迟。它是在跳过的连接事件中度量的
.con_latency = 0,
///从机首选链路监控超时(以计时器单位测量)(10 ms)
///使用宏观MS_TO_TIMERUNITS从毫秒(MS)转换为定时器单位
.superv\u to=毫秒\u to \u计时器(1000),
/// Privacy settings bit field (0b1 = enabled, 0b0 = disabled)
///-[位0]:隐私支持
///-[位1]:多键支持(仅限外围设备);如果启用,则显示隐私标志
/// read only.
/// - [bit 2]: Reconnection address visible.
.flags=0
};
请帮忙
Hi achao,
DSP在SDK 3中实现,在SDK 5中没有实现扫描仪,I VE更改了App_scanning()函数以在GAP_OBSEREVER_MODE下运行,我能够捕获广告指示。请您在if语句中将断点放在eAvm_adv_report_ind_handler()中并再次检查。另外请尝试禁用重复的数据包过滤以检查是否为您提供任何问题。关于扫描仪的行为除了设置扫描参数,您是否设置了设备的配置(角色)以充当中央?如果您无法使用DSP应用程序捕获广告指示,则广告可能出现问题。请尝试使用DSPS主机应用程序运行简单的外设应用程序并捕获广告字符串。
这是我用SDK5模板测试的内容:
1) 转到user\u config.h并将.role更改为GAP\u observator\u SCA
2)在user_callback_config中更改默认on_config_complete函数,使用将开始扫描的自定义函数。
3) 直接从dsps应用程序获取扫描功能。
4) I was able to catch the advertising indication
You can also use the Smart Snippets tool to check if your application is scanning.
谢谢mt_dialog.
谢谢,你能把你的密码发邮件给我吗?
bld2014@sohu.com.
顺便说一下,我可以通过使用嗅探器工具获得广告消息,所以这不应该是广告方面的问题,我会检查代码片段工具,周末快乐,谢谢
谢谢,最后,得到它的工作。
one more question:
if I changed " msg->window = 5;" (setting to 5, works) to " msg->window = 50;" or " msg->window = 500", it didn't catch adv indication, but call user_scanning_completed(defined in user callback file) immediately, why? what is the meaning of window here?
应用程序简易定时器(300,扫描cb);
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);
//最大对等连接
msg-> mode = gap_observer_mode;
msg-> op.code = gapm_scan_passive;
msg-> op.addr_src = gapm_public_addr;
//msg->filter\u duplic=扫描\u FILT\u duplic\u EN;
msg->filter\u duplic=扫描\u FILT\u duplic\u DIS;
msg->间隔= 10;
消息->窗口=5;
发送消息(msg);
嗨Achao1104,
窗口指示扫描仪将扫描多长时间,并且必须小于间隔(设备扫描的频率),如果将窗口设置为大于间隔(间隔10、窗口50或500),则不会得到任何结果。间隔是扫描窗口加上设备在扫描不同频道之间保持空闲的时间。
谢谢mt_dialog.