gapm_cmp_evt_handler中的一个错误?

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

SDK5

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

Device:
Joe.Brackman.
离线
Last seen:4 years 8 months ago
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 status Status of the operation (see Table 39)
Description:
This is the generic complete event for GAP operations. All operations trigger this event when operation is
finished
-----------------------------------------------------------------

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 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 Requested operation canceled.
0x45 GAP_ERR_TIMEOUT请求的操作超时。
0x46 GAP_ERR_DISCONNECTED Link connection lost during operation.
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_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.

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

谢谢。

achao1104
离线
Last seen:5 years 4 months ago
Master
Joined:2015-12-24 10:56
thanks for the reply.

thanks for the reply.
扫描后,我想获得找到的设备列表,此外,获取设备名称,RSSI,地址等。
顺便说一下,我设置一个断点in GAPM_ADV_REPORT_IND, but didn't see it is reached.

achao1104
离线
Last seen:5 years 4 months ago
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个月3天前
Staff
Joined:2015-06-08 11:34
Hi achao1104,

Hi achao1104,

Place your break point at the gapm_adv_report_ind_handler() in the app_task.c file and you will be able to extract the members of the adv_report struct. If you still dont get an indication you can take the DSPS host implementation (make the changes you require) and place a break point at the same function, just to make sure that you successfully configured your host application.

Thanks MT_dialog

achao1104
离线
Last seen:5 years 4 months ago
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 years 4 months ago
Master
Joined:2015-12-24 10:56
我下载了DSP,

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

achao1104
离线
Last seen:5 years 4 months ago
Master
Joined:2015-12-24 10:56
I also changed role from GAP

我也将角色从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},
/// 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;
味精- >窗口= 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);// 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)
};

achao1104
离线
Last seen:5 years 4 months ago
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.

/// 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 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)
/// use the macro MS_TO_DOUBLESLOTS to convert from milliseconds (ms) to double slots
.intv_min = MS_TO_DOUBLESLOTS(10),
/// Connection interval maximum measured in ble double slots (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)中测量的监控超时
/// use the macro MS_TO_TIMERUNITS to convert from milliseconds (ms) to timer units
.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---RELATED----------------------------------

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},
/// 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)
/// 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,
///从机器单元(10 ms)测量的Slave优选链接监控超时
/// use the macro MS_TO_TIMERUNITS to convert from milliseconds (ms) to timer units
.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.
};

achao1104
离线
Last seen:5 years 4 months ago
Master
Joined:2015-12-24 10:56
请帮忙

请帮忙

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

Hi 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) I was able to catch the advertising indication

You can also use the Smart Snippets tool to check if your application is scanning.

Thanks MT_dialog

achao1104
离线
Last seen:5 years 4 months ago
Master
Joined:2015-12-24 10:56
thanks,can you email me your

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

achao1104
离线
Last seen:5 years 4 months ago
Master
Joined:2015-12-24 10:56
顺便说一下,我可以得到

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

achao1104
离线
Last seen:5 years 4 months ago
Master
Joined:2015-12-24 10:56
thanks, finally, gets it work

thanks, finally, gets it work.
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->interval = 10;
msg->窗口= 5;
KE_MSG_SEND(MSG);

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

Hi achao1104,

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

Thanks MT_dialog