I am wanting to send a notification with a specified set of data (not necessarily the data in the characteristic).
Is this the correct way to send a notification? Things do not seem to be working correctly. The notification works when I use prf_server_send_event, but if I am updating the characterisitc rapidly, I get multiples of the same data, not individual notifications with unique data.
void sendEventData(prf_env_struct *p_env, bool indication, uint16_t handle, uint8_t length, uint8_t *pData)
{
// Allocate the GATT notification message
struct gattc_event_ind *req = ke_msg_alloc(GATTC_EVENT_IND,
KE_BUILD_ID(TASK_GATTC, p_env->con_info.conidx), p_env->con_info.prf_id,
sizeof(struct gattc_event_ind) + length);
if(req != NULL)
{
// Fill in the parameter structure
req->type = ((indication) ? GATTC_INDICATE : GATTC_NOTIFY);
req->handle = handle;
req->length = length;
memcpy(req->value, pData, length);
// Send the event
ke_msg_send(req);
}
}
Hi ben,
您可以检查如何发送notifications from the app_ble_peripheral example in the SDK 5.
Thanks MT_dialog