无法从iPhone App(LightBlue)读取公务价值

9 posts / 0 new
最后一篇
muxf
离线
最后一次露面:3年2个月前
加入:2016-07-25 09:15
无法从iPhone App(LightBlue)读取公务价值

嗨对话小组,

我是新人在BLE中,并尝试根据SDK5.0.4在DA14580上运行BLE_APP_PERITELAL项目。(EVK Pro)中央设备是iPhone App LightBlue。我的最终目标是阅读由iPhone控制的加速度传感器值。

As the first step, I want to see if I can catch the events on the DA14580, to do it, several break points are set in the callback functions, like gattc_write_cmd_ind_handler, custs1_val_ind_req_handler and custs1_val_ntf_req_handler in the file custs1_task.c.

之后,如果我在闪烁中推送“写新值”,那么我可以看到程序停止在Gattc_write_cmd_ind_handler函数中,这也是预期的。但如果我在闪烁中推动“读”,则程序中的任何事情都不会发生任何事情。LightBlue也显示出“没有价值”的原因是什么?

例如,我知道已经有几个关于这个问题的线程,例如

- 使用通知而不是读取,因为读访问直接BLE堆栈
- SDK 5.0.4将解决它
- 将ble_app_peripheral作为参考
等等

我尝试了所有这些,但没有成功。所以

1. Would you please tell me which example code can deal with "read" from LightBlue
如果没有这样的例子,你会告诉我我应该做哪些步骤?更多细节对我来说非常有帮助
3.闪烁的右移动应用程序用于测试“读”?如果没有,你会推荐哪个应用程序?

非常感谢你

安东

Keywords:
Device:
muxf
离线
最后一次露面:3年2个月前
加入:2016-07-25 09:15
我读了发行说明

我读取了SDK5.0.4的发行说明,并发现SDK 5.0.4中也支持GattC_Read_cmd_ind。所以我试图做下面的模数到gattc_write_cmd_ind:

1.在Custs1_task.c中添加gattc_read_cmd_ind的处理程序定义
{gattc_read_cmd_ind,(ke_msg_func_t)gattc_read_cmd_ind_handler}

2. implement gattc_read_cmd_ind_handler in custs1_task.c
在此步骤中,我只需使用消息ID Custs1_Val_Read_ind发送Custs1_Val_Read_ind消息(模拟到Custs1_Val_Write_ind)

3.然后我实现了用于读取文件user_peripheral.c中的user_catch_rest_hndl函数中的2nd adc值的切换情况
......
案例custs1_val_read_ind:
{
struct custs1_val_read_ind const *msg_param = (struct custs1_val_read_ind const *)(param);
switch(msg_param->handle)
{
案例cust1_idx_adc_val_2_val:
int sta = 0;
break;
默认:
break;
}
}break;
......
4.我将断点设置为int sta = 0,然后运行LightBlue以将ADC第二值的“再次读取”。(iPhone和DA14580之间的连接可以很好地建立,此时我没有看到程序跳转到断点,并在LightBlue中显示“没有值”。
但是对于“写入”,我可以看到程序跳入写处理程序,没有断点,它可以打开/关闭LED。

所以it shows me that GATTC_READ_CMD_IND still doesn't work. What's wrong with the "read" handling? Would you please give me more details?
Thanks

安东

JK_DIALOG.
离线
最后一次露面:2 months 1 day ago
职员
加入:2016-08-22 23:07
你好,

你好,

请参考RW-BLE-GATE。gattc_read_cmd_ind不是有效命令。请参阅接口规范的第21页,并使用GattC_Read_ind进行回调。

此外,没有任何内容写入ble_app_peripheral的鞍骨版本中的值特征。但是,描述属性由浅蓝色应用程序写入并读取。在应用程序的连接上,iPhone将读取所有描述特征,您应该在此处收到回调。

尝试替换那里的小变化,然后在580上,尝试更改值特性并验证您可以读取该值。

使用此处理程序设置值:

static int custs1_val_set_req_handler(ke_msg_id_t const msgid,
struct custs1_val_set_req const *param,
ke_task_id_t const dest_id,
ke_task_id_t const src_id)

muxf
离线
最后一次露面:3年2个月前
加入:2016-07-25 09:15
你好,

你好,
根据您的建议,我试图首先在哪里读取描述特征,但没有成功:

- search for example "CUST1_ADC_VAL_2_USER_DESC" in the whole project ---> show only in customer DB definition (user_custs1_def.c)

- search for "GATTC_READ_IND" in the whole project ---> "GATTC_READ_IND" could be called by the function prf_client_att_info_rsp() in file prf_utils.c
---> but it (prf_client_att_info_rsp()) is never called by other functions.

- 在函数prf_client_att_info_rsp()中设置断点,然后运行浅蓝色,可以很好地建立连接,但程序不会跳转
进入函数prf_client_att_info_rsp()

概括:

Up to now I understand with your help that
- gattc_read_ind是“读取”激活浅蓝色之后的事件
- Custs1_val_set_req_handler()应用于设置值
But with the help of the ble_app_peripheral project, I still can not catch the read flow

would you please tell me what is the read flow between Light Blue and DA14580 a little more in details regarding description characteristic?

Thanks

muxf
离线
最后一次露面:3年2个月前
加入:2016-07-25 09:15
看来读书

似乎从浅蓝色的读取请求从不传递到DA14580用户应用层,这就是我无法捕获此类事件的原因。(但为什么写作?)如果是真的,请您告诉我我在外围侧的用户应用层中处理中央设备的工作流程是什么?我已经在这个问题上度过了一周,请帮我解决它。非常感谢你

安东

JK_DIALOG.
离线
最后一次露面:2 months 1 day ago
职员
加入:2016-08-22 23:07
我验证了我可以设置

我验证了我可以设置ADC_VAL2_CHAR,我可以使用CUSTS1_VAL_SET_REQ从LIGHTBLUE OS读取它。

I've also confirmed what you found, about the message not being delivered to the application layer. I am digging into this and will respond as soon as I find a solution.

muxf
离线
最后一次露面:3年2个月前
加入:2016-07-25 09:15
我不知道如何使用

我不知道如何使用custs1_val_set_req(), but after studying the DSPS example, I confirmed also that one can set value with custs1_val_set_req. This value can then be read by LightBlue. I am waiting for your solution regarding to the read indication for user application layer. Thanks

JK_DIALOG.
离线
最后一次露面:2 months 1 day ago
职员
加入:2016-08-22 23:07
所以rry for the delay, just

所以rry for the delay, just getting some answers on thsi. Also, can I ask why you would need this functionality for your application? Also, have you read farther into the software release notes, that describes registering for the event? Here is the basic principle on how to implement this feature:

***********************************************************************************************************************

The ATTS_READ_REQ_IND message is introduced. The message contains the handle of the attribute that a peer device has requested to read.

A task that requires this mechanism will typically register for ATTS_READ_REQ_IND messages at DB creation time using the dg_register_task_for_read_request() C API.

在接收到ATTS_READ_REQ_IND消息后,任务可以修改ATT DB,然后它必须通过调用dg_atts_read_cfm()回复。有两种用例:

The task decides that the request request is valid, (optionaly) modifies the value in the DB and finally replies by passing ATT_ERR_NO_ERROR in the status_code argument of dg_atts_read_cfm(). This results to sending the ATT read respone to the peer device.

The task decides that the read request is invalid and responds by passing an ATT error code to dg_atts_read_cfm(). This results to sending the ATT error respone to the peer device.

muxf
离线
最后一次露面:3年2个月前
加入:2016-07-25 09:15
我想展示我们的

我想展示我们的customer that reading sensor data can be controlled by his iPhone. I though since there is GATTC_WRITE_CMD_IND for write, then there must be an analog indication for read. The part mentioned in release note seems more complex than GATTC_WRITE_CMD_IND, so that I am not sure if it was correct way to do it. Thank you for the hints, at lease I know now the part in release note is the right way. The ticket can be closed.