reading a characteristic from da14580

Learn MoreFAQsTutorials

7 posts / 0 new
Last post
Thanhtu131
Offline
Last seen:4 weeks 1 day ago
加入:2018-09-18 17:44
reading a characteristic from da14580

Hi, i had written to a characteristic successfully. As i understood, when a gatt connection is established between my android phone and DA114580. if i send a write request to CUST1_LONG_VALUE characteristic(using UUID) from my phone, da14580 ble stack will create a message and send to my application, and functionuser_catch_rest_hndl()(in fileuser_peripheral.c) will be called to handle the message. Because the themgidis CUST1_IDX_LONG_VALUE_VAL so the functionuser_custs1_long_val_wr_ind_handler ()(in fileuser_custs1_impl.c) will be called. i've check the result by logging the data using putty. It works well. Did i understand it right?

Now i send a read request to CUST1_LONG_VALUE characteristic(using UUID) from my phone. How can i access to the CUST1_LONG_VALUE characteristic data and send the data back to my phone? what function must be used? is there any example? Thanks!!!!

Attachment:
Device:
PM_Dialog
Offline
Last seen:12 hours 16 min ago
Staff
加入:2018-02-08 11:03
Hi Thanhtu131,

Hi Thanhtu131,

Not sure if I understood completely what you are trying to accomplish. I guess that you want to send data from the DA14580 to the mobile phone. This can be done either indications or notifications. The user_custs1_long_val_wr_ind_handler is getting triggered once the specific characteristic is written by the peer device. Please check out app_adcval1_timer_cb_handler() in ordo to understand how to send notifications to the peer device. Off course the characteristic should be notifiable.

Thanks, PM_Dialog

Thanhtu131
Offline
Last seen:4 weeks 1 day ago
加入:2018-09-18 17:44
If i write 0x01 to the

If i write 0x01 to the control point charateristic, app_adcval1_timer_cb_handler() is called and send a CUST1 message to task_cust1. the message id is CUSTS1_VAL_NTF_REQ so this is notifications.Then task_cust1 will handle the message and update the characteristic value(message contain address of the characteristic value) in the database. Do i understand the operation correctly?

PM_Dialog
Offline
Last seen:12 hours 16 min ago
Staff
加入:2018-02-08 11:03
Hi Thanhtu131,

Hi Thanhtu131,

Please see 8.26 in theUM-B-050 : DA1458x Software Developers Guide (SDK5)in order to understand how it is working.

Once 0x01 is written to the “Control Point“ characteristic, you will get a CUST1_IDX_CONTROL_POINT_VAL in the user_catch_rest_hndl() and then user_custs1_ctrl_wr_ind_handler() callback function will be triggered. The app_adcval1_timer_cb_handler() is responsible for sending notifications every APP_PERIPHERAL_CTRL_TIMER_DELAY seconds.

Thanks, PM_Dialog

Thanhtu131
Offline
Last seen:4 weeks 1 day ago
加入:2018-09-18 17:44
Thnks, but i want to

Thnks, but i want to understand the code more clearly. I think the app_adcval1_timer_cb_handler() is responsible for sending a CUSTS1_VAL_NTF_REQ message to cust1 task every APP_PERIPHERAL_CTRL_TIMER_DELAY seconds. Then the handler CUSTS1_VAL_NTF_REQ message will execute, it will update the value of characterisic "ADC Value 1" in the database and send indication through GATT.

PM_Dialog
Offline
Last seen:12 hours 16 min ago
Staff
加入:2018-02-08 11:03
Hello, you are right - please

Hello, you are right - please check the custs1_val_ntf_req structure. Thanks, PM_Dialog

Thanhtu131
Offline
Last seen:4 weeks 1 day ago
加入:2018-09-18 17:44
ok, Thanks for your

ok, Thanks for your confirmation