otSetStateChangedCallback () doesnt seem to register the callback.

Hi,

In my app I have been using the following to register my state change callback. This works. Only issue is it seem to only pass ot_instance, I cant pass a user data to the callback. 

openthread_set_state_changed_cb (on_thread_state_changed)
To pass user data, I tried 
error = otSetStateChangedCallback (openthread_get_default_context(), on_thread_state_changed, &aUserData)
The error returned is error_none. But then my callback function, on_thread_state_changed(), is not get invoked. 
my callback signature is 
static void on_thread_state_changed(uint32_t flags, void *context, void *aContex)
I have also tried 
static void on_thread_state_changed(uint32_t flags, void *context)
But both yield the same result, callback not being invoked. 
I can see the thread state changes by cli. 
What is going wrong here?
Cheers,
Kaushalya
Related