gapm_cmp_evt_handler中的一个错误?

15个帖子/ 0新
Last post
achao1104
离线
Last seen:5年4个月前
Master
Joined:2015-12-24 10:56
gapm_cmp_evt_handler中的一个错误?

SDK5

我的意思是如何通过扫描完成来获取结果?
案例Gapm_scan_active:
案例GAPM_SCAN_PASSIVE:
{
EXECUTE_CALLBACK_VOID(app_on_scanning_completed);
}

Device:
Joe.Brackman.
离线
Last seen:4年8月前
Joined:2015-05-29 18:47
你读过里维埃拉吗?

你读过里维埃拉吗?Waves GAP spec (RW-BLE-GAP-IS.pdf)? Copy and paste:

4.2通用界面
Generic Gap Manager提供了一组完成的命令,其中包含以下命令完成的事件
信息。
4.2.1 GAPM_CMP_EVT
Parameters:
Type Parameters Description
UINT8_T操作GAPM操作代码(见表23)
uint8_t操作状态状态(见表39)
Description:
这是GAP操作的通用完整事件。操作时所有操作都触发此事件
完成的
-----------------------------------------------------------------

Thus, the GAPM_CMP_EVT message has two arguments: operation and status. The operation argument is what command just completed, and status is how/why it completed.

状态代码:

Value Error Description
0x00 GAP_ERR_NO_ERROR No error
0x40 GAP_ERR_INVALID_PARAM无效的参数集
0x41 GAP_ERR_PROTOCOL_PROBLAB与协议交换的问题,获取意外响应
0x42 GAP_ERR_NOT_SUPPORTED请求软件配置不支持
0x43间隙_erm_command_disallowed请求在当前状态下不允许。
0x44 GAP_ERR_CANCELED Requested operation canceled.
0x45 GAP_ERR_TIMEOUT请求的操作超时。
0x46 GAP_ERR_DISCONCONCONCETTICTED在操作期间丢失的链接连接。
0x47 GAP_ERR_NOT_FOUND Search algorithm finished, but no result found
0x48 GAP_ERR_REJECTED Request rejected by peer device
0x49 GAP_ERR_PRIVACY_CFG_PB具有隐私配置的问题
0x4a gap_err_add_data_invalid复制或无效的广告数据
表39:间隙错误代码

除此之外,GAPM_CMP_EVT消息不会提供更多信息。

如果您对已收到的广告活动感兴趣,那就是GapM_Adv_Report_ind。

Your question is a bit vague; perhaps you could explain what you mean by "fetch the result..". What result?

谢谢。

achao1104
离线
Last seen:5年4个月前
Master
Joined:2015-12-24 10:56
thanks for the reply.

thanks for the reply.
扫描后,我想获得找到的设备列表,此外,获取设备名称,RSSI,地址等。
顺便说一下,我在gapm_adv_report_ind中设置了一个断点,但没有看到它被达到。

achao1104
离线
Last seen:5年4个月前
Master
Joined:2015-12-24 10:56
please note, the scanning is

please note, the scanning is observer mode.
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;

MT_dialog
离线
Last seen:3个月4天前
Staff
Joined:2015-06-08 11:34
Hi achao1104,

Hi achao1104,

将休息点放在App_Task.c文件中的GapM_Adv_Report_ind_Handler()处,您将能够提取Adv_Report Struct的成员。如果您仍然没有进行指示,您可以使用DSP主机实现(使您需要的更改)并将断点放在相同的函数中,只是为了确保您成功配置了主机应用程序。

Thanks MT_dialog

achao1104
离线
Last seen:5年4个月前
Master
Joined:2015-12-24 10:56
actually, I have placed a

actually, I have placed a breakpoint at the gapm_adv_report_ind_handler() in the app_task.c file, but it wasn't reached. by the way, I am using the latest sdk5, could you please point me to "DSPS host implementation" ( the folder path), just make sure we are talking the same thing.

achao1104
离线
Last seen:5年4个月前
Master
Joined:2015-12-24 10:56
我下载了DSP,

我下载了DSP,区别在于我使用最新的SD5,而** msg-> mode = gap_observer_mode **模式,我没有看到达到断点。请帮忙。

achao1104
离线
Last seen:5年4个月前
Master
Joined:2015-12-24 10:56
I also changed role from GAP

我也将角色从Gap_observer_sca更改为Gap_Central_mst和向后,但仍然不起作用。请帮忙,它带来了几天,请帮忙。
static const结构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},
/// Device Appearance (0x0000 - Unknown appearance)
//根据填写https://developer.bluetooth.org/gatt/characteristics/Pages/Characteristi...
.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;
msg->窗口= 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->operation = GAPM_SCAN_PASSIVE; // Set GAPM_SCAN_PASSIVE
KE_MSG_SEND(CMD); //发送消息

}

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)
};

achao1104
离线
Last seen:5年4个月前
Master
Joined:2015-12-24 10:56
在广告方面:

在广告方面:

//-------------------------------------------------------------
// -------------不可连接和无向广告相关常见 -
/// Advertising service data
///广告广告类型标志,不得在广告数据中设置
#define USER_ADVERTISE_DATA "\x03"\
adv_type_complete_list_16bit_service_ids \
avad_uuid_device_information_service.

///广告数据长度 - 最多28个字节,保留3个字节以设置
#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 advertis_configuration user_directed_advertise_conf = {
///宣传操作类型。
.Advertise_operation = Adv_Direct,
///自己的BD地址源:
.address_src=GAPM_PUBLIC_ADDR,
///广告频道地图
.channel_map = 0x7,
};

static const struct directed_advertise_configuration user_directed_advertise_target_address_conf={
///设备的BD地址
.addr = {0x1,0x2,0x3,0x4,0x5,0x6},
/// Address type of the device 0=public/1=private random
.addr_type = 0.
};

//-------------------------------------------------------------
//---------------------PARAM UPDATE---RELATED--------------------------

static const struct connection_param_configuration user_connection_param_conf = {
/// Connection interval minimum measured in ble double slots (1.25ms)
///使用宏观MS_TO_DOUBLESLOTS从毫秒(MS)转换为双插槽
.intv_min = MS_TO_DOUBLESLOTS(10),
/// Connection interval maximum measured in ble double slots (1.25ms)
///使用宏观MS_TO_DOUBLESLOTS从毫秒(MS)转换为双插槽
.intv_max = ms_to_doubleslots(20),
///在连接事件中测量的延迟
.latency = 0,
///在定时器单元(10ms)中测量的监控超时
/// use the macro MS_TO_TIMERUNITS to convert from milliseconds (ms) to timer units
.time_out = MS_TO_TIMERUNITS(1250),
///在BLE双槽(1.25ms)中测量的最小连接事件持续时间
///使用宏观MS_TO_DOUBLESLOTS从毫秒(MS)转换为双插槽
.ce_len_min = ms_to_doubleslots(0),
///在BLE双槽(1.25ms)中测量的最大连接事件持续时间
///使用宏观MS_TO_DOUBLESLOTS从毫秒(MS)转换为双插槽
.ce_len_max = ms_to_doubleslots(0),
};

//-------------------------------------------------------------
//---------------------GAPM---RELATED----------------------------------

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},
/// Device Appearance (0x0000 - Unknown appearance)
//根据填写https://developer.bluetooth.org/gatt/characteristics/Pages/Characteristi...
.appearance = 0,
.appearance_write_perm = GAPM_WRITE_DISABLE,
.name_write_perm = GAPM_WRITE_DISABLE,
/// maximal mtu.
.max_mtu = 23,
/// Peripheral only: *****************************************************************
/// Slave preferred Minimum of connection interval measured in ble double slots (1.25ms)
///使用宏观MS_TO_DOUBLESLOTS从毫秒(MS)转换为双插槽
.con_intv_min = ms_to_doubleslots(10),
/// Slave preferred Maximum of connection interval measured in ble double slots (1.25ms)
///使用宏观MS_TO_DOUBLESLOTS从毫秒(MS)转换为双插槽
.con_intv_max = ms_to_doubleslots(20),
///从属喜欢连接延迟。它在跳过的连接事件中测量
.con_latency = 0,
///从机器单元(10 ms)测量的Slave优选链接监控超时
/// use the macro MS_TO_TIMERUNITS to convert from milliseconds (ms) to timer units
.superv_to = ms_to_timerUnits(1000),
///隐私设置位字段(0b1 =启用,0b0 =禁用)
/// - [位0]:隐私支持
/// - [位1]:多键支持(仅限外围设备);如果已启用,隐私标志是
/// 只读。
/// - [位2]:重新连接地址可见。
.flags = 0.
};

achao1104
离线
Last seen:5年4个月前
Master
Joined:2015-12-24 10:56
请帮忙

请帮忙

MT_dialog
离线
Last seen:3个月4天前
Staff
Joined:2015-06-08 11:34
嗨achao,

嗨achao,

SDK 3中的dsp实现,没有implementation of a scanner in the SDK 5, i ve changed the app_scanning() function to operate under GAP_OBSEREVER_MODE and i was able to catch the advertising indication. Can you please place your breakpoint in the gapm_adv_report_ind_handler() at the if statement and check again. Also please try to disable duplicate packets filtering to check if this gives you any trouble. About the acting as scanner besides setting your scanning parameters, have you set the configuration (role) of your device to act as a Central ? If you cant catch the advertise indication with the DSPS application maybe something is wrong with the advertising. Please try to run the a simple peripheral application and catch the advertising string with the dsps host application.

这就是我用SDK5模板测试的内容:

1)转到user_config.h并将.thole更改为gap_observer_sca

2) In the user_callback_config change the default on_config_complete function with a custom function that will start scanning.

3)直接从DSPS应用中拍摄扫描功能。

4)我能够抓住广告迹象

您还可以使用Smart Spippets工具检查您的应用程序是否扫描。

Thanks MT_dialog

achao1104
离线
Last seen:5年4个月前
Master
Joined:2015-12-24 10:56
thanks,can you email me your

谢谢,你能给我发电子邮件吗?
bld2014@sohu.com

achao1104
离线
Last seen:5年4个月前
Master
Joined:2015-12-24 10:56
顺便说一下,我可以得到

顺便说一下,我可以使用嗅探器工具来获取广告消息,所以它不应该是宣传的侧面问题,我会检查赛段工具,周末愉快,谢谢

achao1104
离线
Last seen:5年4个月前
Master
Joined:2015-12-24 10:56
谢谢,最后,得到它的工作

谢谢,最后,得到它的工作.
还有一个问题:
如果我改变了“msg->窗口= 5;”(设置为5,工作)到“msg->窗口= 50;”或者“msg-> window = 500”,它没有捕获adv指示,但立即调用user_scanning_completed(在用户回调文件中定义),为什么?窗口在这里是什么意思?

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->interval = 10;
msg->窗口= 5;
KE_MSG_SEND(MSG);

MT_dialog
离线
Last seen:3个月4天前
Staff
Joined:2015-06-08 11:34
Hi achao1104,

Hi achao1104,

窗口指示扫描仪将扫描的时间长度,它必须小于间隔(您的设备将扫描的频率),如果将窗口设置为大于间隔(间隔10,窗口50或500),则不会得到任何东西。间隔是您的扫描窗口加上您的设备将在扫描不同通道之间保持空闲的时间。

Thanks MT_dialog