Not getting data in read command

⚠️
Hi there.. thanks for coming to the forums. Exciting news! we’re now in the process of moving to our new forum platform that will offer better functionality and is contained within the main Dialog website. All posts and accounts have been migrated. We’re now accepting traffic on the new forum only - please POST any new threads at//www.xmece.com/support. We’ll be fixing bugs / optimising the searching and tagging over the coming days.
10 posts / 0 new
Last post
rajan22
Offline
Last seen:1 year 4 months ago
加入:2017-12-29 05:09
Not getting data in read command

Hello Dialog,

Recently I started working with SDK 6.0.10, here I notice some issue.

In exampleble_app_peripheral,没有在read命令中获取数据,而能够在通知命令中读取数据。

Thanks

Device:
PM_Dialog
Offline
Last seen:1 day 8 hours ago
Staff
加入:2018-02-08 11:03
Hi rajan22,

Hi rajan22,

与我们的SKK高兴你开始工作6 and with DA14585 product, but can you please try to clarify your issue? It would be very helpful if you were able to provide more inputs about you issue.

Thanks, PM_Dialog

rajan22
Offline
Last seen:1 year 4 months ago
加入:2017-12-29 05:09
Hi,

Hi,

Testing ble_app_peripheral example by using SDK 6.0.10.511 with DA14586.

Step 1. Debug the ble_app_peripheral program

Step 2. Connected to BLG-PRPH

步骤3.在主要服务def_svc1_uuid_128写入0x01表单特征def_svc1_ctrl_point_uuid_128

Step 4. Reading data by notification command form characteristic DEF_SVC1_ADC_VAL_1_UUID_128 and getting counter data (dummy ADC data) successfully, as default with the program.

步骤5.尝试通过读取命令表单特征def_svc1_adc_val_1_uuid_128读取数据,但不会将数据作为获取数据在SDK 6.0.4中获取数据。

我们正在使用具有第6.0.10.511版的新产品使用新的SDK开始。

Why we unable to get data in reading command.

In our application, using read command to get sensor info and using notify command for reading sensor data. This is why we need to read and notification both commands.

Thanks

rajan22
Offline
Last seen:1 year 4 months ago
加入:2017-12-29 05:09
Some more details,

Some more details,

As per the application implemented

First, we need to enable from the control point then user_custs1_ctrl_wr_ind_handler will be called and it will start the timer and timer event app_adcval1_timer_cb_handler will keep sending data to the kernel whether we are reading data or not and continuing until disabled by the control point.

void app_adcval1_timer_cb_handler() { struct custs1_val_ntf_ind_req *req = KE_MSG_ALLOC_DYN(CUSTS1_VAL_NTF_REQ, prf_get_task_from_id(TASK_ID_CUSTS1), TASK_APP, custs1_val_ntf_ind_req, DEF_CUST1_ADC_VAL_1_CHAR_LEN); // ADC value to be sampled static uint16_t sample; sample = (sample <= 0xffff) ? (sample + 1) : 0; //req->conhdl = app_env->conhdl; req->handle = CUST1_IDX_ADC_VAL_1_VAL; req->length = DEF_CUST1_ADC_VAL_1_CHAR_LEN; req->notification = true; memcpy(req->value, &sample, DEF_CUST1_ADC_VAL_1_CHAR_LEN); ke_msg_send(req); if (ke_state_get(TASK_APP) == APP_CONNECTED) { // Set it once again until Stop command is received in Control Characteristic timer_used = app_easy_timer(APP_PERIPHERAL_CTRL_TIMER_DELAY, app_adcval1_timer_cb_handler); } }

A similar question askedhereand I am sure they using 6.0.6 and above.

PM_Dialog
Offline
Last seen:1 day 8 hours ago
Staff
加入:2018-02-08 11:03
Hi rajan22,

Hi rajan22,

The ADC 1 characteristic in the ble_app_peripheral example of SDK6.0.10 has both read and notify permissions enabled. Please check the custs1_att_db in user_custs1_def.c. When trying to read the characteristic form the peer device, what you are expecting to get? When having enabled the notification in the peer device, are you able to see the ADC 1 updating?

Thanks, PM_Dialog

rajan22
Offline
Last seen:1 year 4 months ago
加入:2017-12-29 05:09
Hi,

Hi,

在对等设备中启用通知时,您是否能够看到ADC 1更新?Yes,I am able to get dummy ADC data (a counter value).

When trying to read the characteristic form the peer device, what you are expecting to get?I am expecting to get ongoing counter data when阅读command.

Thanks

PM_Dialog
Offline
Last seen:1 day 8 hours ago
Staff
加入:2018-02-08 11:03
Hi rajan22,

Hi rajan22,

Let me check it and i will get back to you.

Thanks, PM_Dialog

PM_Dialog
Offline
Last seen:1 day 8 hours ago
Staff
加入:2018-02-08 11:03
Hi rajan22,

Hi rajan22,

The reason why you cannot read the ADC data is because when sending data over notifications, the CUST1_IDX_ADC_VAL_1_VAL is not updated in the data base. This is not a SKD bug! In order to update the data base, except from the CUSTS1_VAL_NTF_REQ, you should send a CUSTS1_VAL_SET_REQ as well in order to trigger the custs1_val_set_req_handler(). If you check the source code of this handler, you will find that the attmdb_att_set_value() is executed. Please try the below code snippet:

void app_adcval1_timer_cb_handler(){struct custs1_val_ntf_ind_req * req = ke_msg_alloc_dyn(custs1_val_ntf_req,prf_get_task_from_id(task_id_custs1),task_app,custs1_val_ntf_ind_req,def_svc1_adc_val_1_char_len);struct musts1_val_set_req * req_set = ke_msg_alloc_dyn(custs1_val_set_req,prf_get_task_from_id(task_id_custs1),task_app,custs1_val_set_req,def_svc1_adc_val_1_char_len);// adc值是采样的静态uint16_t样本__attribute __((部分(“保留_mem_area0”),zero_init));Sample =(Sample <= 0xFFFF)?(样品+ 1):0;// req-> conhdl = app_env-> conhdl;req-> handle = svc1_dx_adc_val_1_val;req-> length = def_svc1_adc_val_1_char_len;req-> notification = true;memcpy(req->值,&sample,def_svc1_adc_val_1_char_len); req_set->handle = SVC1_IDX_ADC_VAL_1_VAL; req_set->length = DEF_SVC1_ADC_VAL_1_CHAR_LEN; memcpy(req_set->value, &sample, DEF_SVC1_ADC_VAL_1_CHAR_LEN); ke_msg_send(req); ke_msg_send(req_set); if (ke_state_get(TASK_APP) == APP_CONNECTED) { // Set it once again until Stop command is received in Control Characteristic timer_used = app_easy_timer(APP_PERIPHERAL_CTRL_TIMER_DELAY, app_adcval1_timer_cb_handler); } }

Thanks, PM_Dialog

bojanpotocnik
Offline
Last seen:3 months 2 weeks ago
加入:2019-11-26 11:41
Dear Dialog team,

Dear Dialog team,

when using struct custs1_val_set_req, the req_set->conidx parameter is not relevant? If it is, then how to set the value "for all connections" - using GAP_INVALID_CONIDX triggers hard fault.

PM_Dialog
Offline
Last seen:1 day 8 hours ago
Staff
加入:2018-02-08 11:03
Hi bojanpotocnik,

Hi bojanpotocnik,

Thanks for your comment. Could you please raise a new forum ticket with your question as this one is old and closed? Additionally it would be very helpful if you could clarify your question.

Thanks, PM_Dialog