⚠️
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
TMiranda
Offline
Last seen:2 years 5 months ago
Joined:2017-11-16 18:00
Reading a dummy value

Hi.
我使用SDK 6.0.6 DA14585套装,和我m currently trying to store a dummy value (let's pretend the value is 1) to a variable and read it using a service on my application. I'm trying to do it based on the ble_app_peripheral project, but no luck so far - as I've understood, by activating the Control Point (user_svc1_ctrl_wr_ind_handler), it calls a timer function (app_adcval1_timer_cb_handler) that will notify the central when the timer expires... the problem is that this only works for notification process, since when I press the 'read' option, a No Value answer is given. The other problem is that this is not what I want, since I don't want to update a value, but only display a single one.

So, my question is: how do I use the READ command to display a pre-loaded value in central device? (in my case, LightBlue iOS app).

Thanks

Keywords:
Device:
MT_dialog
Offline
Last seen:1 month 2 weeks ago
Staff
Joined:2015-06-08 11:34
Hi TMiranda,

Hi TMiranda,

You will have to set the value of that specific characteristic to whatever value you would like, the custom profile uses a message in order to do so, for example, if you would like to set the value of a specific characteristic you can send the CUSTS1_VAL_SET_REQ, the handler function that will handle that message will trigger the custs1_val_set_req_handler() and that will use the attmdb_att_set_value() which is the actual function that sets the characteristic's value. So, as soon as you have set the characteristic's value, you will be able to read it from the central.

Thanks MT_dialog

TMiranda
Offline
Last seen:2 years 5 months ago
Joined:2017-11-16 18:00
I don't think I've understood

I don't think I've understood enough. Regarding to the ble_app_peripheral example, I'm trying to read a dummy value on the ADC Value 2 read property.

On the @user_peripheral.c file, I'm, there is no CUSTS1_VAL_SET_REQ on the user_catch_rest_hndl, so I'm creating a new one this way

case CUSTS1_VAL_SET_REQ:
{
struct custs1_val_set_req const *msg_param = (struct custs1_val_set_req const *) (param);
switch (msg_param->handle)
{
case SVC1_IDX_ADC_VAL_2_VAL:
user_svcl_adc_2_val_set_req_handler(msgid, msg_param, dest_id, src_id);
break;
}

}

On the @user_custs1_impl.c file I'm doing:
void user_svcl_adc_2_val_set_req_handler(ke_msg_id_t const msgid,
struct custs1_val_set_req const *param,
ke_task_id_t const dest_id,
ke_task_id_t const src_id)
{
//static uint8_t val = 2;
// memcpy(param->value, &val, param->length);
GPIO_SetActive(GPIO_LED_PORT, GPIO_LED_PIN);
}

As you can see, I'm just trying to toggle a LED port, since my previous try was giving me an error. Unfortunately, nothing is happening whenever I try to REaD from the ADC Value 2 characteristic. Where am I wrong?

MT_dialog
Offline
Last seen:1 month 2 weeks ago
Staff
Joined:2015-06-08 11:34
Hi TMiranda,

Hi TMiranda,

When you send a read command from the central side the 580 will reply with the value that is allready in the database, so you will have to set the value that you would like to read before the central actually reads the value, you will have to issue the CUSTS1_VAL_SET_REQ, which is a request towards to SDK in order to set the value and not an indication that someone wants to read that value. So at somepoint in your fw you will have to issue that command CUSTS1_VAL_SET_REQ and then when the central reads that characteristic it will return the value that you have stored. As said the CUSTS1_VAL_SET_REQ is a request issued from the application towards the profile, what you have written will never be triggered. Also in order to get indicated that someone is trying to read your characteristic you will have to implement the ATTS_READ_REQ_IND, for implementing this please check the following posts:

https://support.dialog-semiconductor.com/forums/post/dialog-smartbond-bl...

https://support.dialog-semiconductor.com/gattcreadcmdind-da14580

Thanks MT_dialog