read data in sample128 profile.

11 posts / 0 new
Last post
craftwizard
Offline
Last seen:3 years 2 months ago
加入:2014-12-17 05:34
read data in sample128 profile.

Hi

I succeeded in getting "sample128 profile".
It is possible "read / write" in the Android app.
I would like to know how to send data from one part reads when "read" in the Android app.
sample128.c, sample128_task.c .....
I want to send the GPIO status value when "read" in the Android app.
When you 'write' in the Android app now GPIO control is possible.
Please help me.

VesaN
Offline
Last seen:5 years 7 months ago
Guru Master
加入:2014-06-26 08:49
Hi craftwizard,

Hi craftwizard,

It is a very good question that how one can check a pin value directly on characteristic read operation. Maybe one should create own gattc_cmp_evt_handler in the profile_task.c file and manage it that way somehow, but I don't really know.. I'll try to see this issue later this week.

Dialog team, can you give a quick description of how to check some pin state and send it back to client, when client performs read operation on some characteristic. Does it make sense to do this "outside the attribute server"?

Thanks!

craftwizard
Offline
Last seen:3 years 2 months ago
加入:2014-12-17 05:34
Thank VesaN.

Thank VesaN.

I'll expect a good response from the Dialog team.
But can't understand the 'Does it make sense to do this "outside the attribute server"?'.

VesaN
Offline
Last seen:5 years 7 months ago
Guru Master
加入:2014-06-26 08:49
对不起,我是nt if it would be

对不起,我是nt if it would be possible to read pin state directly without involving attribute server in this process, and would it make sense

gl_dialog (not verified)
Hi all,

Hi all,

Please have a look at in the Beacon SW (http://support.dialog-semiconductor.com/da14580-reference-design-beacon).

In the app_adc_notify_task.c, there is one handler which returns the ADC value. For your case, you can return the GPIO status.

This is done thanks to:

#if BLE_ADC_NOTIFY
{ADC_NOTIFY_DISABLE_IND, (ke_msg_func_t)app_adc_notify_disable_ind_handler},
{ADC_NOTIFY_CREATE_DB_CFM, (ke_msg_func_t)app_adc_notify_create_db_cfm_handler},
{ADC_NOTIFY_CFG_IND, (ke_msg_func_t)app_adc_notify_cfg_ind_handler},
{APP_ADC_SAMPLING_TIMER, (ke_msg_func_t)app_adc_sampling_timer_handler},
#endif

For further details, the beacon application note (http://support.dialog-semiconductor.com/system/files/UM-B-019_DA14580_Be...) describes all the handlers.

regards,

DIALOG TEAM.

craftwizard
Offline
Last seen:3 years 2 months ago
加入:2014-12-17 05:34
thank dialog team.

thank dialog team.

The sample code you gave was helpful to me.
The sample code is a way of reading the storage gpio state periodically using a timer.
However, the status value is only necessary if you want to 'read' on Android.
'read' event happens let me know where.
I need a sample code for a 'read' events.
请帮助我。

VesaN
Offline
Last seen:5 years 7 months ago
Guru Master
加入:2014-06-26 08:49
Hello,

Hello,

Not sure about this, but seems that GATTC_READ_CMD_IND should be triggered. I tried to add handler for that message type but nothing happens. It seems to me that message isn't emitted on read operation.gattc_task.hsays following:

/* Indicate that a read operation is requested. */
/// Read command indicated to upper layers.
GATTC_READ_CMD_IND,

It is difficult to say more since only header fields are public

craftwizard
Offline
Last seen:3 years 2 months ago
加入:2014-12-17 05:34
Hi VesaN

Hi VesaN

I have to try to add a GATTC_READ_CMD_IND events as you like.
The result is there was no response, just like you.
Will not the other way?

ADC sample code is a method of storing gpio status on a periodic basis.
This is an inefficient way.

gl_dialog (not verified)
Hi all,

Hi all,

This is the handler which can do what you need:

{GATTC_READ_CMD_IND, (ke_msg_func_t)gattc_read_cmd_ind_handler} from the dk_apps\src\ip\ble\hl\src\profiles\wpt\wpts\wpts_task.c.

This is only supported using the DA14581 silicon.

regards,

DIALOG TEAM.

iamadog3333
Offline
Last seen:5 years 10 months ago
加入:2014-07-30 03:56
嗨gl_dialog,

嗨gl_dialog,
I registered the handler in sample128.c
{GATTC_READ_CMD_IND, (ke_msg_func_t)gattc_read_cmd_ind_handler}

But when App read the Char, the handler was not called.
I am using DA14580.
Is there a solution?

VesaN
Offline
Last seen:5 years 7 months ago
Guru Master
加入:2014-06-26 08:49
Hi iamadog3333,

Hi iamadog3333,

This might be helpful