⚠️
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.
18 posts / 0 new
Last post
lewuyouc
Offline
Last seen:1 year 7 months ago
加入:2016-07-18 01:38
indication and notify

Hi

I modify DA1458x_SDK\5.0.4\projects\target_apps\ble_examples\prox_reporter.

Please explain the difference between indication and notify in prox_reporter project.

Indication is how to solve the problem of packet loss.

Please tell me the calling process of the indication function.

Thanks!

Keywords:
Device:
PW_Dialog
Offline
Last seen:3 weeks 17 hours ago
Staff
加入:2019-04-03 02:54
Hi lewuyouc,

Hi lewuyouc,

The difference is indication has confirmation of data receiving, but notify does not.

lewuyouc
Offline
Last seen:1 year 7 months ago
加入:2016-07-18 01:38
Hi PW_Dialog

Hi PW_Dialog

DA1458x_SDK\5.0.4\projects\target_apps\ble_examples\prox_reporter how to confirmation of data receiving ?

if send fail,how to solve it?

Thanks

PW_Dialog
Offline
Last seen:3 weeks 17 hours ago
Staff
加入:2019-04-03 02:54
Hi lewuyouc,

Hi lewuyouc,

To confirm the data is well received, data receiver could send back ack to sender, and sender may send the data again if can't get the ack after certain period.

lewuyouc
Offline
Last seen:1 year 7 months ago
加入:2016-07-18 01:38
Hi PW_Dialog

Hi PW_Dialog

Thank you for your support.

if disconnect,the sender send data to phone is always fail, so the slave will aiways send data again? or disconnect,the slave use indication is wrong?

" To confirm the data is well received, data receiver could send back ack to sender, and sender may repeat sending the data if can't get the ack after certain period. " can you give me some source code reference?

PW_Dialog
Offline
Last seen:3 weeks 17 hours ago
Staff
加入:2019-04-03 02:54
Hi lewuyouc,

Hi lewuyouc,

That could be regarded as a state machine flow, if disconnect the state will be changed as well, then corresponding actions (instead of resending data) will be taken in the disconnect state (e.g. preparing to be reconnected).

lewuyouc
Offline
Last seen:1 year 7 months ago
加入:2016-07-18 01:38
Hi PW_Dialog

Hi PW_Dialog

Thanks,But I need a indication complete example.

DA1458x_SDK\5.0.4\projects\target_apps\ble_examples\ble_app_all_in_one about indication is incomplete .

Thanks!

CYibin
Offline
Last seen:6 months 6 days ago
Staff
加入:2017-12-14 02:48
Hi lewuyouc,

Hi lewuyouc,

From user's point of view, there are not any differences between IND and NOTF. What user can do is just to send a command to SDK and waiting for its feedback. User cannot see the source code of the process.

To send a NOTF, the GATTC_SEND_EVT_CMD with GATTC_NOTIFY parameter is sent from user layer to SDK layer.

发送一个印第安纳州,theGATTC_SEND_EVT_CMD with GATTC_INDICATE parameter is sent from user layer to SDK layer.

After above command has been sent, SDK layer would feedback the result to the user layer:

For NOTF, the NO_ERROR status means data has been sent from BLE peripheral. We don't know whether the BLE central has received or not.

For IND, the NO_ERROR status means data has been sent from BLE peripheral to central. There is no doubt that data has been received by central.

Br

Yibin

lewuyouc
Offline
Last seen:1 year 7 months ago
加入:2016-07-18 01:38
Hi

Hi

I use infication send my data to phone.

struct custs1_val_ind_req* req = KE_MSG_ALLOC_DYN(CUSTS1_VAL_IND_REQ, TASK_CUSTS1, TASK_APP, custs1_val_ind_req, DEF_CUST1_INDICATEABLE_CHAR_LEN); req->conhdl = app_env->conhdl; req->handle = CUST1_IDX_INDICATEABLE_VAL; req->length = DEF_CUST1_INDICATEABLE_CHAR_LEN; memcpy(req->value, &status_value, DEF_CUST1_INDICATEABLE_CHAR_LEN); ke_msg_send(req);

" After above command has been sent, SDK layer would feedback the result to the user layer: " I do not know how to get the result.

Thanks!

CYibin
Offline
Last seen:6 months 6 days ago
Staff
加入:2017-12-14 02:48
Hi lewuyouc,

Hi lewuyouc,

To send the data to sdk layer, you can find the below API in SDK:

void prf_server_send_event(prf_env_struct *p_env, bool indication, uint16_t handle) { // Allocate the GATT notification message struct gattc_send_evt_cmd *req = KE_MSG_ALLOC(GATTC_SEND_EVT_CMD, KE_BUILD_ID(TASK_GATTC,p_env->con_info.conidx), p_env->con_info.prf_id, gattc_send_evt_cmd); // Fill in the parameter structure req->req_type = ((indication) ? GATTC_INDICATE : GATTC_NOTIFY); req->handle = handle; // Send the event ke_msg_send(req); }

To get the result from SDK layer after sending the data, you can handler the gattc_cmp evet in the callback function:

static int gattc_cmp_evt_handler(ke_msg_id_t const msgid, struct gattc_cmp_evt const *param, ke_task_id_t const dest_id, ke_task_id_t const src_id) { if (param->req_type == GATTC_NOTIFY) { // Inform the application that the notification PDU has been sent over the air. struct custs1_val_ntf_cfm *cfm = KE_MSG_ALLOC(CUSTS1_VAL_NTF_CFM, custs1_env.con_info.appid, custs1_env.con_info.prf_id, custs1_val_ntf_cfm); cfm->handle = custs1_env.ntf_handle; cfm->conhdl = gapc_get_conhdl(custs1_env.con_info.conidx); cfm->status = param->status; ke_msg_send(cfm); } else if (param->req_type == GATTC_INDICATE) { // Inform the application that the indication has been confirmed by the peer device. struct custs1_val_ind_cfm *cfm = KE_MSG_ALLOC(CUSTS1_VAL_IND_CFM, custs1_env.con_info.appid, custs1_env.con_info.prf_id, custs1_val_ind_cfm); cfm->handle = custs1_env.ind_handle; cfm->conhdl = gapc_get_conhdl(custs1_env.con_info.conidx); cfm->status = param->status; ke_msg_send(cfm); } return (KE_MSG_CONSUMED); }

BR

CYibin

lewuyouc
Offline
Last seen:1 year 7 months ago
加入:2016-07-18 01:38
Hi CYibin

Hi CYibin

Thanks for your support.

void user_catch_rest_hndl(ke_msg_id_t const msgid,
void const *param,
ke_task_id_t const dest_id,
ke_task_id_t const src_id)

case CUSTS1_VAL_IND_CFM: in user_catch_rest_hndl() can get the feedback result.

Thanks!

CYibin
Offline
Last seen:6 months 6 days ago
Staff
加入:2017-12-14 02:48
Hi lewuyouc, 不客气 BR CYibin

Hi lewuyouc,

不客气

BR

CYibin

lewuyouc
Offline
Last seen:1 year 7 months ago
加入:2016-07-18 01:38
Hi

Hi

“不同之处在于指示已经确认data receiving, but notify does not. "

but the function void user_catch_rest_hndl(ke_msg_id_t const msgid, void const *param, ke_task_id_t const dest_id,ke_task_id_t const src_id)

case CUSTS1_VAL_NTF_CFM:
struct custs1_val_ntf_cfm const *msg_param = (struct custs1_val_ntf_cfm const *)(param);

/// Parameters of the @ref CUSTS1_VAL_NTF_CFM massage
struct custs1_val_ntf_cfm
{
/// Connection handle
uint16_t conhdl;
/// Handle of the attribute that has been updated
uint16_t handle;
/// Confirmation status
uint8_t status;
};

why we can get notify feedback status?

if notify send success,the msg_param->status=0x00,else the msg_param->status=0x8B.

notify also can confirmation of data receiving?

PM_Dialog
Offline
Last seen:1 day 14 hours ago
Staff
加入:2018-02-08 11:03
Hi lewuyouc

Hi lewuyouc

Yes, PW_Dialog is correct, and the difference is that the indication has confirmation of data receiving but notify does not. The CUSTS1_VAL_NTF_CFM is a confirmation from the stack that you pushed successfully a CUSTS1_VAL_NTF_REQ message to the BLE stack. It is not a confirmation from the central that the data have successfully been received. Whenever you send a notification you will get a CUSTS1_VAL_NTF_CFM (for the custom profile), as soon as you get this you will know that the notification just send will be delivered to the central, so you can directly place the second notification. You will have to wait for the CUSTS1_VAL_NTF_CFM to arrive before sending the next notification for the same characteristic, if not you will update the value's database with the latter value and when the kernel pushes the notification into the buffer it will push two notifications with the same value, since the values of the notifications are acquired from the database. If you found any of the answers useful, please mark it as “accepted”.

Thanks, PM_Dialog

lewuyouc
Offline
Last seen:1 year 7 months ago
加入:2016-07-18 01:38
Hi PW_Dialog

Hi PW_Dialog

Thank you for your reply.

So CUSTS1_VAL_IND_CFM same as CUSTS1_VAL_NTF_CFM? the CUSTS1_VAL_IND_CFM make sure send next event.

Please tell me, my ble device how to know the phone received data successfully?

Looking forward to your reply!

PM_Dialog
Offline
Last seen:1 day 14 hours ago
Staff
加入:2018-02-08 11:03
Hi lewuyouc,

Hi lewuyouc,

You could use indications instead of notifications in order to have a confirmation of data receiving. To start with the indications are initiated from the peripheral (just like notifications but with application confirmation when the value reaches the peripheral) and not the central, the peripheral can only send indications towards the central and not the other way around. So in order to send an indication from a peripheral you just have to send that message from your application, the central doesn't read the indicatable value, it is just the peripheral that indicates that value to the central, the central just confirms that he received the message sent from the peripheral. When you send an indication, you should issue a GATTC_SEND_EVT_CMD and that message should have as a response a GATTC_CMP_EVT. After that, the GATTC_CMP_EVT will trigger the gattc_cmp_evt_handler() from the custs1_task.c. Be aware that the indication will be triggered when there is a confirmation from the central that the indication is correctly received by the central. In order to see how to declare an indictable characteristic, please take a look at the ble_app_peripheral example of the SDK.

Thanks, PM_Dialog

lewuyouc
Offline
Last seen:1 year 7 months ago
加入:2016-07-18 01:38
Hi PW_Dialog

Hi PW_Dialog

谢谢,我会试着这样做。

Can we use malloc() function? I need to create a long link.

PM_Dialog
Offline
Last seen:1 day 14 hours ago
Staff
加入:2018-02-08 11:03
Hi lewuyouc,

Hi lewuyouc,

I am in position to understand what you are trying to accomplish, but yes you can use it. You can use the ke_malloc as well.

Thanks, PM_Dialog