如何在中央尝试读取特定特征时更改值?

⚠️
嗨,...感谢您来论坛。令人兴奋的消息!我们现在正在迁至我们的新论坛平台,将提供更好的功能,并包含在主对话框网站中。所有帖子和帐户都已迁移。我们现在只接受新论坛上的流量 - 请发布任何新线程https://www.dialog-seminile.com/support.。我们将在未来几天修复错误/优化搜索和标记。
8个帖子/ 0新
最后一篇
HM.
离线
最后一次露面:7个月4周前
加入:2018-04-19 13:53
如何在中央尝试读取特定特征时更改值?

嗨对话框,我需要更新值,而中央尝试读取特定特性的值,我已经在user_custs1_def.c文件中的数据库定义中应用了RI选项:
//时间特征值
[svc1_idx_time_val] = {
svc1_time_uuid_128,att_uuid_128_len,perm(rd,启用)| perm(wr,启用)|perm(write_req,启用),
perm(ri,启用)| def_svc1_time_char_len
},
但我仍然没有在cust1_task.c文件中捕获gattc_read_req_ind_handler()函数上的msg。
此外,我发现如果我应用RI选项,我不能写入值成功。

设备:
PM_DIALOG.
离线
最后一次露面:21小时46分钟前
职员
加入:2018-02-08 11:03
嗨HM,

嗨HM,

您能否在论坛上查看以下上一篇之前的帖子?

https://support.dialog-semicondiondiondimicon.com/forums/post/dialog-smartbond-bluetooth-low-energy-%2%80%93-software/changing-value-database-dinamamly

我遵循该帖子,我添加了perm(ri,启用)到ADC1特征的值。通过这样做,我能够在尝试读取ADC值1特征时触发CUST1_TASK.h的GATTC_READ_REQ_IND_HANDLER()函数。我建议您检查使用类似选项的普通配置文件的实现,也可以在读取倾斜的特性时触发vist_task.h的gattc_read_req_ind_handler()函数。

谢谢,PM_DIALOG.

HM.
离线
最后一次露面:7个月4周前
加入:2018-04-19 13:53
嗨对话框:

嗨对话框:
我有一个进一步的研究,我发现我是否添加了烫发(RI,启用),问题是我只能得到一旦触发gattc_read_req_ind_handler()函数,如果我再次读取,则不会触发。更重要的问题是,如果我试图execattmdb_att_set_value(...)函数,它将返回0x06的状态(att_err_request_not_supported.)。这意味着,如果我的CharoStory应用程序写入权限如此:PERM(RD,ENABLE)| PERM(WR,ENABLE)|perm(write_req,启用),我无法设置charodoratival值。

PM_DIALOG.
离线
最后一次露面:21小时46分钟前
职员
加入:2018-02-08 11:03
嗨HM,

嗨HM,

在我的设置和修改ADC值特征上并添加了您提到的额外权限,我没有看到帖子中提到的内容。Just to be clear on that, there is no implementation on the SDK side that will handle this kind of transaction, that means that you will have to take care of the code in the gattc_read_req_ind_handler() since the SDK profile doesn’t convey any message towards the application in order to be aware that somebody read from that specific characteristic. So, regarding the fact that the callback occurs only once, how you are able to determine this ? Are you using breakpoints ? In case the break point hits once, then the link will be lost, and the central on the other side will delay as long as the supervision timeout until it realizes that he is not able to find the slave and issue a disconnection. In the case that the gattc_read_req_ind_handler() didn’t occur after one read the device would be disconnected after 30 seconds (which I don’t think is the case on your side), the reason for the disconnection would be that the confirmation message from the slave wouldn’t be sent. In the case of the SDK this is not the case since when you have the RI feature enabled you always get a slave response even if this is an error due to the incomplete custom profile for handling the RI case. So I trust that the callback occurs, tested that on my side. Regarding the attmdb_att_set_value(), you won’t need this, I suppose that what you would like to implement is that every time you get a read indication you would like to send a different value to the master, so in order to do that you will have to implement it on the gattc_read_req_ind_handler() callback, that means that as soon as the gattc_read_req_ind_handler() is triggered you should perform whatever tasks you would like to compute the value and then allocate and send a GATTC_READ_CFM message that will contain the value that you would like to send to the master (the value should be copied to the cfm->value struct). Please check the example below.

cfm = ke_msg_alloc_dyn(gattc_read_cfm,src_id,dest_id,gattc_read_cfm,长度);

cfm-> handle = param->手柄;

cfm-> status = gap_err_no_error;

CFM->长度= 2;

if(status == gap_err_no_error)

{

测试++;

Memcpy(CFM->值,和测试,2);

}

KE_MSG_SEND(CFM);

测试是每次读取特定特性时应该增加的全局变量。

谢谢,PM_DIALOG.

HM.
离线
最后一次露面:7个月4周前
加入:2018-04-19 13:53
嗨,对话框:

嗨,对话框:
我们测试为您的代码,并发现只需更新客户端特征配置值(在LightBlue时测试)和属性值始终“无值”。
并且通过Gattc_Read_Req_ind_Handler(Custs1_Task)的代码,更新的值来自custs1_get_ccc_value(conidx,att_idx),它的长度始终为2,但长度
属性值可以只要20.IS有问题?
gattc_read_req_ind_handler的一些代码:
//如果已找到属性,则状态为GAP_ERR_NO_ERROR
if(status == gap_err_no_error)
{
const struct cust_prf_func_callbacks * callbacks = custs_get_func_callbacks(task_id_custs1);

if(回调 - > att_db [att_idx] .uuid_size == att_uuid_16_len &&
*(UINT16_T *)回调 - > ATT_DB [ATT_IDX] .uuuid == ATT_DESC_CLIENT_CHAR_CHAR_CHAR_CHAR)
{
ccc_val = custs1_get_ccc_value(conidx,att_idx);
长度= 2;
}
别的
{
status = prf_app_error;
}
}
//发送读取响应
cfm = ke_msg_alloc_dyn(gattc_read_cfm,src_id,dest_id,gattc_read_cfm,长度);
cfm-> handle = param->手柄;
cfm-> status = status;
CFM->长度=长度;

if(status == gap_err_no_error)
{
Memcpy(CFM->值,&CCC_Val,长度);
}
KE_MSG_SEND(CFM);

PM_DIALOG.
离线
最后一次露面:21小时46分钟前
职员
加入:2018-02-08 11:03
嗨HM,

嗨HM,

让我试着检查并复制你的问题,我会尽快通知你。

谢谢,PM_DIALOG.

PM_DIALOG.
离线
最后一次露面:21小时46分钟前
职员
加入:2018-02-08 11:03
嗨HM,

嗨HM,

客户端特性配置长度为2个字节,它们用于启用通知或指示。我无法理解你的意思是该属性总是有“没有价值”。如果属性值特性,最大长度为20字节(23 - 3 = 20bytes),没有MTU交换。没有问题,但请注意,属性值为20,因为您不使用MTU Exchange。

谢谢,PM_DIALOG.

HM.
离线
最后一次露面:7个月4周前
加入:2018-04-19 13:53
嗨,对话框:

嗨,对话框:
我的意思是我使用LightBlue来读取一个Charostory,如果我为CharoSorativer(Attmdb_att_set_value(...)设置)设置了一个十六进制值,否则它将返回'没有值',然后如果我按读取再次按钮,它将再次读取遥控器,现在它将再次返回值,但值等于第一个值。我想要设置或更改返回值,而浅蓝色读取每次的Charostory值。