This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

API call to retrieve current taskid?

When implementing ZCL based devices, it is sometimes necessary to know the task ID of the current thread so that an event timer can be enabled.  When an implementation has multiple endpoints of the same type ( as does mine ) then it can be problematic to determine the task context within a zcl callback function such as those related to the identify cluster. 

Is there an API call into the OSAL layer that would return the current taskid?  

  • Hello -

    It looks like there had been an API for this if you look in OSAL.h you'll see this:

      /*
       * Get the active task ID
       */
      extern uint8 osal_self( void );

    I will use your request to propose re-implementing this API (I imagine it may have been removed a long time ago on a smaller part during a code and ram size reduction scourge when it was determined that there was no use for it).

    But in the meanwhile, it would be very easy for you to implement it yourself - I've attached a possible solution.