I mean how to fetch the result from scanning completion? case GAPM_SCAN_ACTIVE: case GAPM_SCAN_PASSIVE: { Execute_callback_void(app_on_scanning_completed); }
您是否阅读过Riviera Waves Gap Spec(RW-BLE-GAP-IS.PDF)?复制和粘贴:
4.2 Generic Interface The generic GAP Manager offers a set of commands that are completed with following command completed event message. 4.2.1 GAPM_CMP_EVT. 参数: 类型参数说明 uint8_t operation GAPM operation code (see Table 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 ---------------------------------------snip --------------------------------------
价值错误描述 0x00 gap_err_no_error没有错误 0x40 GAP_ERR_INVALID_PARAM Invalid parameters set 0x41 GAP_ERR_PROTOCOL_PROBLEM Problem with protocol exchange, get unexpected response 0x42 GAP_ERR_NOT_SUPPORTED Request not supported by software configuration 0x43 GAP_ERR_COMMAND_DISALLOWED Request not allowed in current state. 0x44 GAP_ERR_CANCELED请求的操作取消。 0x45 GAP_ERR_TIMEOUT Requested operation 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 Problem with privacy configuration 0x4A GAP_ERR_ADV_DATA_INVALID Duplicate or invalid advertising data Table 39: GAP Error Codes
Beyond that, the GAPM_CMP_EVT message doesn't give any more info.
If you're interested in received advertising events, that's GAPM_ADV_REPORT_IND.
谢谢回复。 after scanning, I want to get a list of devices which are found, furthermore , get the device name, rssi, address etc. by the way, I set a breakpoint in GAPM_ADV_REPORT_IND, but didn't see it is reached.
把你在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.
I downloaded dsps, the difference is that I am using latest sd5, and **msg->mode = GAP_OBSERVER_MODE** mode, I didn't see the break point was reached. PLEASE help.
我也改变了差距的角色_OBSERVER_SCA to GAP_CENTRAL_MST and backwards, but still not work. please help, it has taken me days, please help. 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,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,
// --------------------------------------------------------------------------- //-------------NON-CONNECTABLE & UNDIRECTED ADVERTISE RELATED COMMON -- ///广告服务数据 /// Advertising AD type flags, shall not be set in advertising data #define user_advertise_data“\ x03”\ ADV_TYPE_COMPLETE_LIST_16BIT_SERVICE_IDS\ ADV_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) /// Advertising name #define USER_DEVICE_NAME ("a") /// Advertising name Length #define USER_DEVICE_NAME_LEN (sizeof(USER_DEVICE_NAME)-1) /// Scan response data #define USER_ADVERTISE_SCAN_RESPONSE_DATA "" /// Scan response data length- maximum 31 bytes #define USER_ADVERTISE_SCAN_RESPONSE_DATA_LEN (sizeof(USER_ADVERTISE_SCAN_RESPONSE_DATA)-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 measured in connection events .latency = 0, /// Supervision timeout measured in timer units (10 ms) ///使用宏观MS_TO_TIMERUNITS从毫秒(MS)转换为定时器单位 .time_out = ms_to_timerUnits(1250), /// Minimum Connection Event Duration measured in ble double slots (1.25ms) /// use the macro MS_TO_DOUBLESLOTS to convert from milliseconds (ms) to double slots .ce_len_min = MS_TO_DOUBLESLOTS(0), /// Maximum Connection Event Duration measured in ble double slots (1.25ms) /// use the macro MS_TO_DOUBLESLOTS to convert from milliseconds (ms) to double slots .ce_len_max = MS_TO_DOUBLESLOTS(0), };
by the way,i can get advertise message by using sniffer tool,so it shouldnot be advertise side problem, i will check the snippet tool,happy weekend and thanks
谢谢,最后,得到它的工作。 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?
The window indicates how long the scanner will scan and it must less than the interval (how often your device will scan), if you set your window larger than your interval (interval 10, window 50 or 500) wont get anything. The interval is your scan window plus the time that your device will stay idle between scanning different channels.
您是否阅读过Riviera Waves Gap Spec(RW-BLE-GAP-IS.PDF)?复制和粘贴:
4.2 Generic Interface
The generic GAP Manager offers a set of commands that are completed with following command completed event
message.
4.2.1 GAPM_CMP_EVT.
参数:
类型参数说明
uint8_t operation GAPM operation code (see Table 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
---------------------------------------snip --------------------------------------
因此,GAPM_CMP_EVT消息有两个参数:操作和状态。操作参数是刚刚完成的命令,并且状态是如何/为何完成。
Status codes:
价值错误描述
0x00 gap_err_no_error没有错误
0x40 GAP_ERR_INVALID_PARAM Invalid parameters set
0x41 GAP_ERR_PROTOCOL_PROBLEM Problem with protocol exchange, get unexpected response
0x42 GAP_ERR_NOT_SUPPORTED Request not supported by software configuration
0x43 GAP_ERR_COMMAND_DISALLOWED Request not allowed in current state.
0x44 GAP_ERR_CANCELED请求的操作取消。
0x45 GAP_ERR_TIMEOUT Requested operation 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 Problem with privacy configuration
0x4A GAP_ERR_ADV_DATA_INVALID Duplicate or invalid advertising data
Table 39: GAP Error Codes
Beyond that, the GAPM_CMP_EVT message doesn't give any more info.
If you're interested in received advertising events, that's GAPM_ADV_REPORT_IND.
你的问题有点模糊;也许你可以解释你的意思是“获取结果。”。结果是什么?
Thanks.
谢谢回复。
after scanning, I want to get a list of devices which are found, furthermore , get the device name, rssi, address etc.
by the way, I set a breakpoint 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,
把你在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.
谢谢mt_dialog.
实际上,我在app_task.c文件中的GapM_Adv_Report_ind_Handler()中放置了一个断点,但尚未达到。顺便说一下,我正在使用最新的SDK5,你能把我指向“DSPS主机实现”(文件夹路径),只需确保我们正在谈论同样的事情。
I downloaded dsps, the difference is that I am using latest sd5, and **msg->mode = GAP_OBSERVER_MODE** mode, I didn't see the break point was reached. PLEASE help.
我也改变了差距的角色_OBSERVER_SCA to GAP_CENTRAL_MST and backwards, but still not work. please help, it has taken me days, please help.
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,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,
here is sending:
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);
// Maximal peer connection
//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->interval = 100;
msg->window = 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)
};
in advertise side:
// ---------------------------------------------------------------------------
//-------------NON-CONNECTABLE & UNDIRECTED ADVERTISE RELATED COMMON --
///广告服务数据
/// Advertising AD type flags, shall not be set in advertising data
#define user_advertise_data“\ x03”\
ADV_TYPE_COMPLETE_LIST_16BIT_SERVICE_IDS\
ADV_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)
/// Advertising name
#define USER_DEVICE_NAME ("a")
/// Advertising name Length
#define USER_DEVICE_NAME_LEN (sizeof(USER_DEVICE_NAME)-1)
/// Scan response data
#define USER_ADVERTISE_SCAN_RESPONSE_DATA ""
/// Scan response data length- maximum 31 bytes
#define USER_ADVERTISE_SCAN_RESPONSE_DATA_LEN (sizeof(USER_ADVERTISE_SCAN_RESPONSE_DATA)-1)
// ---------------------------------------------------------------------------
//-------------DIRECTED ADVERTIZE---RELATED----------------------------
static const struct advertise_configuration user_directed_advertise_conf ={
/// Advertise operation type.
.advertise_operation=ADV_DIRECT,
/// Own BD address source of the device:
.address_src = gapm_public_addr,
///Advertising channel map
.channel_map = 0x7,
};
static const struct inction_advertise_configuration user_directed_advertise_target_address_conf = {
/// BD Address of device
.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 measured in connection events
.latency = 0,
/// Supervision timeout measured in timer units (10 ms)
///使用宏观MS_TO_TIMERUNITS从毫秒(MS)转换为定时器单位
.time_out = ms_to_timerUnits(1250),
/// Minimum Connection Event Duration measured in ble double slots (1.25ms)
/// use the macro MS_TO_DOUBLESLOTS to convert from milliseconds (ms) to double slots
.ce_len_min = MS_TO_DOUBLESLOTS(0),
/// Maximum Connection Event Duration measured in ble double slots (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,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,
///仅限外围设备:*******************************************************************
///在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),
/// Slave preferred Connection latency. It is measured in connection events skipped
.con_latency = 0,
/// Slave preferred Link supervision timeout measured in timer units (10 ms)
///使用宏观MS_TO_TIMERUNITS从毫秒(MS)转换为定时器单位
.superv_to = MS_TO_TIMERUNITS(1000),
/// Privacy settings bit field (0b1 = enabled, 0b0 = disabled)
/// - [bit 0]: Privacy Support
/ / / -[1]:多重键支持(外围only); If enabled, privacy flag is
/// read only.
/// - [bit 2]: Reconnection address visible.
.flags = 0
};
please help
Hi achao,
DSP在SDK 3中实现,在SDK 5中没有实现扫描仪,I VE更改了App_scanning()函数以在GAP_OBSEREVER_MODE下运行,我能够捕获广告指示。请您在if语句中将断点放在eAvm_adv_report_ind_handler()中并再次检查。另外请尝试禁用重复的数据包过滤以检查是否为您提供任何问题。关于扫描仪的行为除了设置扫描参数,您是否设置了设备的配置(角色)以充当中央?如果您无法使用DSP应用程序捕获广告指示,则广告可能出现问题。请尝试使用DSPS主机应用程序运行简单的外设应用程序并捕获广告字符串。
This is what i ve tested with the SDK5 template:
1) Go to user_config.h and change the .role to GAP_OBSERVER_SCA
2)在user_callback_config中更改默认on_config_complete函数,使用将开始扫描的自定义函数。
3) Take the scanning function directly from dsps application.
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.
谢谢,你能给我发电子邮件吗?codes?
bld2014@sohu.com.
by the way,i can get advertise message by using sniffer tool,so it shouldnot be advertise side problem, i will check the snippet tool,happy weekend and thanks
谢谢,最后,得到它的工作。
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);
// Maximal peer connection
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->window = 5;
ke_msg_send(msg);
嗨Achao1104,
The window indicates how long the scanner will scan and it must less than the interval (how often your device will scan), if you set your window larger than your interval (interval 10, window 50 or 500) wont get anything. The interval is your scan window plus the time that your device will stay idle between scanning different channels.
谢谢mt_dialog.