您是否阅读过Riviera Waves Gap Spec(RW-BLE-GAP-IS.PDF)?复制和粘贴:
4.2通用界面 Generic Gap Manager提供了一组完成的命令,其中包含以下命令完成的事件 信息。 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 -----------------------------------------------------------------
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, ///在定时器单元(10ms)中测量的监控超时 ///使用宏观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_len_min = ms_to_doubleslots(0), ///在BLE双槽(1.25ms)中测量的最大连接事件持续时间 /// use the macro MS_TO_DOUBLESLOTS to convert from milliseconds (ms) to double slots .ce_len_max = ms_to_doubleslots(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通用界面
Generic Gap Manager提供了一组完成的命令,其中包含以下命令完成的事件
信息。
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_ERR_PROTOCOL_PROBLAB与协议交换的问题,获取意外响应
0x42 GAP_ERR_NOT_SUPPORTED Request not supported by software configuration
0x43间隙_erm_command_disallowed请求在当前状态下不允许。
0x44 GAP_ERR_CANCELED请求的操作取消。
0x45 GAP_ERR_TIMEOUT请求的操作超时。
0x46 GAP_ERR_DISCONNECTED Link connection lost during operation.
0x47 GAP_ERR_NOT_FOUND搜索算法完成,但找不到结果
0x48 GAP_ERR_REJECT请求由对等设备拒绝
0x49 GAP_ERR_PRIVACY_CFG_PB具有隐私配置的问题
0x4A GAP_ERR_ADV_DATA_INVALID Duplicate or invalid advertising data
表39:间隙错误代码
除此之外,GAPM_CMP_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_observer_mode;// gap_gen_discovery.
msg-> op.code = gapm_scan_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_observer_mode **模式,我没有看到达到断点。请帮忙。
我也将角色从Gap_observer_sca更改为Gap_Central_mst和向后,但仍然不起作用。请帮忙,它带来了几天,请帮忙。
static const struct gapm_configuration user_gapm_conf = {
//.ROLE = GAP_OBSERVER_SCA,
。role = gap_central_mst,
.irk = {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
.max_mtu = 23,
在这里发送:
app_easy_timer(300,scan_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_gen_discovery;//
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;
msg->间隔= 100;
味精- >窗口= 5000;
KE_MSG_SEND(MSG);
void scan_cb(void)
{
struct gapm_cancel_cmd * cmd =(struct gapm_cancel_cmd *)ke_msg_alloc(gapm_cancel_cmd,task_gapm,task_app,gapm_cancel_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_on_disconnect = null,
.app_on_update_params_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_on_adv_direct_complete = null,
.app_on_db_init_complete = default_app_on_db_init_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_on_pairing_succeded = null,
.app_on_encrypt_ind = null,
.app_on_mitm_passcode_req = null,
.app_on_encrypt_req_ind = null,
#endif //(ble_app_sec)
};
在广告方面:
// ---------------------------------------------------------------------------
// -------------不可连接和无向广告相关常见 -
///广告服务数据
///广告广告类型标志,不得在广告数据中设置
#define user_advertise_data“\ x03”\
adv_type_complete_list_16bit_service_ids \
avad_uuid_device_information_service.
/// Advertising data length - maximum 28 bytes, 3 bytes are reserved to set
#define user_advertise_data_len(sizeof(user_advertise_data)-1)
///广告名称
#define user_device_name(“a”)
///广告名称长度
#define user_device_name_len(sizeof(user_device_name)-1)
///扫描响应数据
#define user_advertise_scan_response_data“”
///扫描响应数据长度 - 最多31个字节
#define user_advertise_scan_response_data_len(sizeof(user_advertise_scan_response_data)-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,
///在定时器单元(10ms)中测量的监控超时
///使用宏观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_len_min = ms_to_doubleslots(0),
///在BLE双槽(1.25ms)中测量的最大连接事件持续时间
/// use the macro MS_TO_DOUBLESLOTS to convert from milliseconds (ms) to double slots
.ce_len_max = ms_to_doubleslots(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},
///设备外观(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
.max_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_to_doubleslots(20),
///从属喜欢连接延迟。它在跳过的连接事件中测量
.con_latency = 0,
///从机器单元(10 ms)测量的Slave优选链接监控超时
///使用宏观MS_TO_TIMERUNITS从毫秒(MS)转换为定时器单位
.superv_to = ms_to_timerUnits(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_config.h并将.thole更改为gap_observer_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?
app_easy_timer(300,scan_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_duplic = scan_filt_duplic_en;
msg-> filter_duplic = scan_filt_duplic_dis;
msg->间隔= 10;
msg->窗口= 5;
KE_MSG_SEND(MSG);
嗨Achao1104,
窗口指示扫描仪将扫描的时间长度,它必须小于间隔(您的设备将扫描的频率),如果将窗口设置为大于间隔(间隔10,窗口50或500),则不会得到任何东西。间隔是您的扫描窗口加上您的设备将在扫描不同通道之间保持空闲的时间。
谢谢mt_dialog.