New Handler Function for New characteristic

7 posts / 0 new
Last post
Sam123
Offline
Last seen:5 years 9 months ago
Joined:2015-02-19 05:43
New Handler Function for New characteristic

Hi Dialog,

I have one handler function for four characteristics which are used to turn on LEDs . Each characteristic should turn on only one LED . However, each characteristic can turn on all the 4 LEDs.
How do i rectify this?

How to add 4 different handler functions for the 4 different characteristics?

Device:
VesaN
Offline
Last seen:5 years 6 months ago
Guru Master
Joined:2014-06-26 08:49
Hello Sam123,

Hello Sam123,

share your code (the current handler function that turns on every LED) so it is possible to contribute, thanks

Sam123
Offline
Last seen:5 years 9 months ago
Joined:2015-02-19 05:43
Hi Vesa,

Hi Vesa,

我使用的处理函数是:

int sample128_val_ind_handler(ke_msg_id_t const msgid,
struct sample128_val_ind const *param,
ke_task_id_t const dest_id,
ke_task_id_t const src_id)
{
//Characteristic 1
memcpy(&sample128_my_new,¶m->val,sizeof(my_new_t));
get_value1=(*sample128_my_new);
if(get_value1 == set_value1)
{
GPIO_SetActive(GPIO_PORT_0, GPIO_PIN_7 );
}
else
{
GPIO_SetInactive(GPIO_PORT_0, GPIO_PIN_7 );
}

//2nd write characteristic
memcpy(&sample128_my_newer,¶m->val,sizeof(my_newer_t));
get_value2=(*sample128_my_newer);
if(get_value2 == set_value2)
{
GPIO_SetActive(GPIO_PORT_1, GPIO_PIN_0 );
}
else
{
GPIO_SetInactive(GPIO_PORT_1, GPIO_PIN_0 );
}

//3rd write characteristic
memcpy(&sample128_my_new3,¶m->val,sizeof(my_new_t3));
get_value3=(*sample128_my_new3);
if(get_value3 == set_value3)
{
GPIO_SetActive(GPIO_PORT_1, GPIO_PIN_2 );
}
else
{
GPIO_SetInactive(GPIO_PORT_1, GPIO_PIN_2 );
}

//4th write characteristic
memcpy(&sample128_my_newer4,¶m->val,sizeof(my_newer_t4));
get_value4=(*sample128_my_newer4);
if(get_value4 == set_value4)
{
GPIO_SetActive(GPIO_PORT_1, GPIO_PIN_3 );
}
else
{
GPIO_SetInactive(GPIO_PORT_1, GPIO_PIN_3 );
}

return (KE_MSG_CONSUMED);
}

Sam123
Offline
Last seen:5 years 9 months ago
Joined:2015-02-19 05:43
Hi Dialog Team,

Hi Dialog Team,

I am waiting for your reply. I am unable to solve this. Please help.

Sam123
Offline
Last seen:5 years 9 months ago
Joined:2015-02-19 05:43
Hi Dialog Team,

Hi Dialog Team,

I am waiting for your reply.

WI_Dialog
Offline
Last seen:2 days 22 hours ago
Staff
Joined:2014-01-03 16:21
Hi, the snapshot of portion

Hi, the snapshot of portion of your source doesn't help to understand your issue. Could you please give more details your observation in your experiment ?
1. Are all your defined characteristics reported correctly in the "LightBlue" or equivalent tool ?
2. When you modify all characteristics in the "LighltBlue" tool, what are the values obtained in the "sample128_val_ind_handler" function ? And what has been observed when you changed each characteristic in turn. Suggest to disconnect and connect again to flash the content cache in the tool's memory.
3. Please state what the changes you made in "static int gattc_write_cmd_ind_handler" function.
For quicker response, please leave your email address and will arrange our team to assist you to solve the issue.
Regards, WI_Dialog

WI_Dialog
Offline
Last seen:2 days 22 hours ago
Staff
Joined:2014-01-03 16:21
Hi, the snapshot of portion

Hi, the snapshot of portion of your source doesn't help to understand your issue. Could you please give more details your observation in your experiment ?
1. Are all your defined characteristics reported correctly in the "LightBlue" or equivalent tool ?
2. When you modify all characteristics in the "LighltBlue" tool, what are the values obtained in the "sample128_val_ind_handler" function ? And what has been observed when you changed each characteristic in turn. Suggest to disconnect and connect again to flash the content cache in the tool's memory.
3. Please state what the changes you made in "static int gattc_write_cmd_ind_handler" function.
For quicker response, please leave your email address and will arrange our team to assist you to solve the issue.
Regards, WI_Dialog