Read ADC1 Value in ble_app_peripheral example

⚠️
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.wsdof.com/support. We’ll be fixing bugs / optimising the searching and tagging over the coming days.
4 posts / 0 new
Last post
jwpearce
Offline
Last seen:5 months 2 weeks ago
Joined:2016-10-13 18:51
Read ADC1 Value in ble_app_peripheral example

Please help me understand how to communicate characteristic values using READ as opposed to NOTIFY. For example, in ble_app_peripheral the NOTIFY message starts a callback timer that makes the measurements and sends the results into the database. I cannot find where simple READs get handled. Please show me code where a characteristic value is accesed using a READ message.

Thank you.

PM_Dialog
Offline
Last seen:2 days 22 hours ago
Staff
Joined:2018-02-08 11:03
Hi jwpearce,

Hi jwpearce,

Could you please clarify your question? If I am not mistaken, you would like trigger gattc_read_req_ind_handler() as soon as the characteristic is read by the Central device? Please correct me if I misunderstood your question.

If my assumption is correct, you can apply the RI option in the database definition in the user_custs1_def.c file. For instance, you could use the below configuration in order to activate this feature:

// ADC Value 1 Characteristic Value [SVC1_IDX_ADC_VAL_1_VAL] = {SVC1_ADC_VAL_1_UUID_128, ATT_UUID_128_LEN, PERM(RD, ENABLE) | PERM(NTF, ENABLE), PERM(RI, ENABLE)|DEF_SVC1_ADC_VAL_1_CHAR_LEN, 0, NULL},

By doing that you will get the gattc_read_req_ind_handler() function to execute as soon as a central tries to read a ADC characteristic.

Thanks PM_Dialog

jwpearce
Offline
Last seen:5 months 2 weeks ago
Joined:2016-10-13 18:51
Thank you, I knew that it

谢谢你,我知道这将是很容易一旦它佤邦s pointed out. I assume RI means "Read Immediate", correct?

As an aside, there are numerous abbreviations in the code that are obvious to the author but not necesssarily to us unwashed massses. A glossary of all the partial words used in the function names would go a long way to helping your customers (at least this one). Just for example, what does "rest" mean in "user_rest_hndl"?

Thanks!

PM_Dialog
Offline
Last seen:2 days 22 hours ago
Staff
Joined:2018-02-08 11:03
Hi jwpearce,

Hi jwpearce,

RI stands for Read Indication. So, the applications indicated you once a readable characteristic is read by a peer device. Please take a look at the attm.gh header file.

Thanks, PM_Dialog