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

BLE_EVT_TX_COMPLETE and which characteristic sent a notifiation

Hi all! It`s possible to know in event BLE_EVT_TX_COMPLETE which characteristic sent a notifiation? I have 2 characteristic and depending on which one of them sent notification, it is necessary to produce different action. This is a pseudocode:

static void on_ble_evt(ble_evt_t *p_ble_evt)
{
...
   case BLE_EVT_TX_COMPLETE:
   {
   if (characterictic1_sent)
     do_sums1();
   else if (characterictic2_sent)
    do_sums2();
   }
...
}

Thanks!

Parents
  • /**
     * @brief Event structure for @ref BLE_EVT_TX_COMPLETE.
     */
    typedef struct
    {
      uint8_t count;                        /**< Number of packets transmitted. */
    } ble_evt_tx_complete_t;
    

    It is only the count that is included in this event. So you would need to handle this in the application code.

    Maybe you can have a flag for each type of notification? Each is set when you tell the SoftDevice to send a notification? Then you can check them in BLE_EVT_TX_COMPLETE and take appropriate action?

  • Petter,

    In the suggestion for using a flag, are you suggesting to have a flag in the application that we set before ask softdevice to send a notification? If so, I am not sure this will work either, because when you have multiple characteristics sending notifications, there can BLE_EVT_COMPLETE_TX happening at any given time. In other words we cannot synchronize the action of setting the flag with the event of BLE_EVT_TX_COMPLETE because the softdevice is running in a different context. Unless we send only one notification at a time and block until the flag is reset.which is not desired.

    As Vyachelsav suggested I thought that there would be some sort of reference to the sender in the p_ble_evt when BLE_EVT_COMPLETE_TX happens but there doesn't seem to be such a thing.

Reply
  • Petter,

    In the suggestion for using a flag, are you suggesting to have a flag in the application that we set before ask softdevice to send a notification? If so, I am not sure this will work either, because when you have multiple characteristics sending notifications, there can BLE_EVT_COMPLETE_TX happening at any given time. In other words we cannot synchronize the action of setting the flag with the event of BLE_EVT_TX_COMPLETE because the softdevice is running in a different context. Unless we send only one notification at a time and block until the flag is reset.which is not desired.

    As Vyachelsav suggested I thought that there would be some sort of reference to the sender in the p_ble_evt when BLE_EVT_COMPLETE_TX happens but there doesn't seem to be such a thing.

Children
No Data
Related