I’m in the process of implementing coreMQTT-agent following the demos repository coreMQTT-Agent-Demos (sorry can’t post links)
I understand the concept of the MQTTAgentMessageInterface_t, and can see this has been implemented in freertos_agent_message.c and freertos_command_pool.c. The later specifically defines an xQueue in the initializer to store these agent commands.
I’m therefore confused why a secondary MQTTAgentCommand_t queue has been created in the prvMQTTInit function in mqtt-agent-task.c. What is the difference between these two queues? Any help here would be really appreciated
The queue created in Agent_InitializePool is used to hold a pool of free MQTTAgentCommand_t. This pool ensures a static list of MQTTAgentCommand_t buffers available whenever commands need to be crafted instead of dynamically allocating them every time.
Whereas the queue of type MQTTAgentCommand_t created in the prvMQTTInit function in mqtt-agent-task.c is the actual queue that is used to deliver information from the public facing APIs to the MQTT agent task by demos.