Hi Dialog , I need update value while a central tries to read value on specific characteristic,I already apply the RI option in the database definition in the user_custs1_def.c file like this:
//时间特征值
[SVC1_IDX_TIME_VAL] = {
SVC1_TIME_UUID_128,ATT_UUID_128_LEN,PERM(RD,ENABLE)| PERM(WR,ENABLE)| PERM(WRITE_REQ,ENABLE),
PERM(RI, ENABLE)|DEF_SVC1_TIME_CHAR_LEN
},
但是我仍然没有在cust1\u task.c文件中捕捉到gattc\u read\u req\u ind\u handler()函数的消息。
Besides, I find that if i apply the RI option ,I can not write value succeed.
Keywords:
Device:

Hi hm,
Could you please check the following previous post on the forum?
https://support.dialog semiconductor.com/forums/post/dialog smartbond蓝牙低能耗-%E2%80%93软件/更改价值数据库
I followed that post and I added PERM(RI, ENABLE) into the value of the ADC1 characteristic. By doing that, I was able to get the gattc_read_req_ind_handler() function of cust1_task.h triggered when I tried to read the ADC Value 1 Characteristic. I suggest you to check the implementation of the DISS profile which is using a similar option and if the gattc_read_req_ind_handler() function of diss_task.h is triggered when reading a diss characteristic.
谢谢,下午好
嗨对话框:
I have a further study, and i find if i add PERM(RI, ENABLE) ,the problem is that I can only getonce triggeredof the gattc_read_req_ind_handler() function, and it do not triggered if i read again. And the more important problem is that if I try to exec theattmdb\ att\ set\值(…)函数,它将返回0x06状态(不支持附件错误请求). 这意味着如果我的性格像这个:烫发(RD,ENABLE)| PERM(WR,ENABLE)| PERM(WRITE,REQ,ENABLE),我无法设置字符值。
Hi hm,
在我的设置和修改了ADC值特点tic and added the extra permissions that you mentioned, I don’t see what you are mentioning on the post. 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, length);
cfm->handle=param->handle;
cfm->status=GAP\u ERR\u NO\u ERROR(状态=间隙\u错误\u无错误);
cfm->length = 2;
如果(状态==间隙\u错误\u无错误)
{
测试++;
memcpy(cfm->value, &test, 2);
}
发送消息(cfm);
The test is a global variable that should be increased every time you read a specific characteristic.
谢谢,下午好
Hi ,Dialog:
我们作为您的代码进行测试,发现只需更新客户机特征配置值(在lightblue进行测试),属性值总是“No value”。
And by the code in gattc_read_req_ind_handler(custs1_task ), the value to update comes from custs1_get_ccc_value(conidx, att_idx),and it's length is always 2,but the length of
属性值可以长达20。有什么问题吗?
gattc\u read\u req\u ind\u处理程序的一些代码:
// If the attribute has been found, status is GAP_ERR_NO_ERROR
如果(状态==间隙\u错误\u无错误)
{
const struct cust\u prf\u func\u callbacks*callbacks=custs\u get\u func\u callbacks(TASK\u ID\u CUSTS1);
if (callbacks->att_db[att_idx].uuid_size == ATT_UUID_16_LEN &&
*(uint16\u t*)回调->att\u db[att\u idx].uuid==att\u DESC\u CLIENT\u CHAR\u CFG)
{
ccc\u val=custs1\u get\u ccc\u value(conidx,att\u idx);
长度=2;
}
其他的
{
状态=PRF\应用程序\错误;
}
}
// Send read response
cfm = KE_MSG_ALLOC_DYN(GATTC_READ_CFM, src_id, dest_id, gattc_read_cfm, length);
cfm->handle=param->handle;
cfm->status=状态;
cfm->length = length;
如果(状态==间隙\u错误\u无错误)
{
memcpy(cfm->value,&ccc\u val,length);
}
发送消息(cfm);
Hi hm,
让我试着检查和复制你的问题,我会让你尽快知道。
谢谢,下午好
Hi hm,
客户端特征配置长度为2字节,用于启用通知或指示。我不明白你说的属性总是“没有价值”是什么意思。在属性值特性的情况下,最大长度为20字节(23-3=20字节),没有MTU交换。没有什么问题,但是请注意属性值是20,因为您没有使用MTU交换。
谢谢,下午好
嗨,对话:
I mean that I use lightblue to read a charactoristic,If I set a value for the charactoristic( attmdb_att_set_value (...)) ,I will get a hex value otherwise it will return 'No value' , and then if I press the Read again button, it will read the remote again, now it will return a value again,but the value equals to the first one.I want to set or change the return value while light blue read the charactoristic value every time.