This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

Hardfault ble_nus_send_data - SDK 17

Hi,

I've noticed that there was an issue with ble_nus in SDK 15.3 - detailed in this post.

I'm using SDK 17, and in my application, I don't check data_handler != NULL. When BLE_GATTS_EVT_HVN_TX_COMPLETE occurs, I just define ble_nus_evt_t evt and calls p_nus->data_handler. Probably took it from an example, I can't remember.

Is it safe? Should I use something else?

Thanks!

Parents Reply
  • Hi,

    I've provided an handler during initialization, but events handler takes ble_nut_t pointer from an argument to the function, as following:

    void OnBleNusEvent(ble_evt_t const * p_ble_evt, void * p_context)

    if ((p_context == NULL) || (p_ble_evt == NULL))
    {
       return;
    }

    ble_nus_t * p_nus = (ble_nus_t *)p_context;

    After that, I'm using p_nus->data_handler.

    Is it safe to use p_context?

    Thanks!

Children
Related