The device I’m working on previously used a combination of FreeRTOS, FreeRTOS-Cellular-TCP Sockets and coreMQTT to send and receive data using the MQTT protocol to the cloud. It uses the Quectel BG96 cellular module for its network connection.
Now the BG96 (and several other cellular/network modules) has its own MQTT client that helps remove the requirement of managing the MQTT protocol on the device side - by using a series of relatively simple AT commands an MQTT connection can be established and data sent and received over it.
I’ve successfully made the changes required to use the BG96 MQTT client in my code, however I was wondering if there was a recommended way to integrate it with coreMQTT and/or FreeRTOS-Cellular-TCP to provide a generic interface for this, in a similar way to how TCP sockets work currently?
That way we can provide a port/wrapper implementation for the network module MQTT Client and consume it using a generic FreeRTOS interface.
Hi @azeater,
I must admit that I haven’t had personal experience with the BG96 MQTT interface. Based on the information you’ve provided, it appears that the BG96 offers AT commands to facilitate MQTT transmission, which is similar to the functionality provided by coreMQTT.
To create a generic interface that accommodates both options, you might consider implementing a wrapper layer that sits above these two libraries. This approach could potentially offer the flexibility needed to work with either system. For now, we don’t have any reference implemented as this wrapper.
For clarity, I’ve included a simple diagram below to illustrate this concept:
What problem do you want to solve by adding this extra layer? You are using a different MQTT client than coreMQTT and it should be fine to use whatever interface is provided by that MQTT client.
Perhaps I wasn’t clear enough in my initial post. The FreeRTOS Cellular Interface provides a really nice way of interfacing with any cellular module, including handling of AT commands, URC events etc. The BG96 (and other network modules) have inbuilt MQTT clients that are accessed via AT commands in a similar fashion to sending data over sockets and I was wondering if there was a recommended way I might go about extending FreeRTOS Cellular Interface to support this in a generic way.
At the moment all of my changes live in the BG96 port layer but there’s no real “interface” defined to comply with so that it can be made generic across different network modules with inbuilt clients.
The aim for the cellular interface was to support generic 3GPP AT commands and make it extendable so that specific implementations (such as BG96) can add module specific AT commands. Assuming MQTT AT commands are not 3GPP, port is the best place to keep them.