Closed boraozgen closed 2 years ago
Hello, this callback is actually used, when we receive the callback from mqtt init. as the current implementation assumes
pMqttAgentContext->pIncomingCallbackContext
is the first element in the MQTTAgentContext_t structure, and a cast is performed where the callback is received.
the transformation is done here: https://github.com/FreeRTOS/coreMQTT-Agent/blob/8df94cec1b05eca9862a66705685617ba178bcb0/source/core_mqtt_agent.c#L622 it is not perfect and we should use a different way to do that like using member of.
As far as I see, the callback itself is used but not pIncomingCallbackContext
. I suppose as pAgentContext
is passed with the callback, it is expected that the users should extract pIncomingCallbackContext
themselves.
Hi, we are aware of the issue with the agent callback and are looking into it. As you mentioned, users of the library can currently get pIncomingCallbackContext
in the callback by getting it from the pAgentContext
.
The incoming callback context parameter passed to MQTTAgent_Init gets stored but not used afterwards. Should be removed or passed to the callback.
https://github.com/FreeRTOS/coreMQTT-Agent/blob/8df94cec1b05eca9862a66705685617ba178bcb0/source/core_mqtt_agent.c#L986