Learn MoreFAQsTutorials

2 posts / 0 new
Last post
MADHUSF
Offline
Last seen:1 month 3 weeks ago
加入:2018-01-15 09:22
User custom handlers

Hi Dialog,

I m using app_ble_peripheral.i have seen file user_custs1_impl.c and user_peripheral.c

there are app handlers i think..can you explain the code please..i know its catching request from app.

but i want to know how ur mapped and flow of the handlers

for example,

void user_catch_rest_hndl(ke_msg_id_t const msgid,
空白const *相提并论am,
ke_task_id_t const dest_id,
ke_task_id_t const src_id)
{
switch(msgid)
{
case CUSTS1_VAL_WRITE_IND:
{
struct custs1_val_write_ind const *msg_param = (struct custs1_val_write_ind const *)(param);

switch (msg_param->handle)
{

case SVC1_IDX_ADC_VAL_1_NTF_CFG:
user_svc1_adc_val_1_cfg_ind_handler(msgid, msg_param, dest_id, src_id);
break;

""case SVC1_IDX_ADC_VAL_1_NTF_CFG: "" what does it doing..

can you please explain the functionality and how it is mapped

Device:
PM_Dialog
Offline
Last seen:15 hours 3 min ago
工作人员
加入:2018-02-08 11:03
Hi MADHUSF,

Hi MADHUSF,

In user_peripheral.c source code file, the application specific code such as creating the advertising packet, managing the timers to control the advertising period and handling connection events are implemented. In addition it provides user_catch_rest_hndl() which is the handler for the requests to the custom 1 service such as read, write, confirm and notify. These Custom profile messages are application specific and their handling is transferred to user application. The SDK is agnostic of the specific Custom profile messages and it is the user’s application responsibility to handle them. For example, in ble_app_peripheral example of the SDK, when writing to the Control point characteristic, you will get a CUSTS1_VAL_WRITE_IND in the application level. The CUSTS1_VAL_WRITE_IND means that any of the writable characteristics is written by the peer device and it is defined custs1_task.h. In case of the Control point characteristic, the handler is equal to SVC1_IDX_CONTROL_POINT_VAL, so the user_svc1_ctrl_wr_ind_handler. I would suggest you to run the ble_app_peripheral example of the SDK in debug mode, add a break point into the user_catch_rest_hndl() and step in the application code.

Thanks, PM_Dialog