⚠️ This code needs a review: Reveiw with nyfelix needed and then merge into SmartFactory_MQTTCommunication
The SmartFactroy_MQTTCommunication is an modular part of the SmartFactory project. MQTTCommunication establishes a WLAN-connection and allows you to connect with an MQTT-Broker to send and receive message.
Incomming messages have to be in a known JSON-format and will be serialized with the SmartFactory_Messages library.
This library is an redundant library with SmartFacotry_MQTTCommunication. It uses the WiFi.h library to work with an Esp32 DevKitC. In addition the callback function and the buffers are no longer implemented in this class.
The Source-code is written in C++. To achieve this project, the following tools and technologies were used.
Doxygen is used for the documentation of the source code.
An intorduction to Doxygen and how to install it can be found in the ArdFSM-Repo.
The used IDE is VSCode with the PlatformIO-extension.
MQTT (Message Queuing Telemetry Transport) is a lightweight publish-subscribe messaging protocol and requires a broker to relay the messages. It's used for M2M (machine-to-machine) communication.
An MQTT-system always consist of a broker and one or multiple clients, which can be either subscriber or publisher.
[Image: MQTT101 - Eclispe Foundation]
A client can subscribe and publish to one or multiple topics. Topics are organized in a tree similar to a folder-structure in Windows. Here's an example of how such a topic-tree and published message can look like:
This images also illustrates the scalability of MQTT appropriately.
For more Infos about MQTT and MQTT-topics check out the MQTT-Wiki on Github.
[Source: Wiki:MQTT, MQTT ]
This code needs a WLAN-shield to function properly.
It's tested with a Esp32 DevKitC from Espressif.
All functions and files are documented on the GitHub-Page with Doxygen
The figure below shows the data model in UML notation.
Click on the image to open doxygen-documentation.
Click on the image to open doxygen-documentation.
External libraries:
The MQTTCommunication.h-file serves as interface. It provides the functions for:
- Network-connection
- MQTT-functionalities
- access the message-storage (circular buffer)
In the CommunicationConfiguration.h-file are all important settings defined:
- WLAN SSID
- WLAN password
- MQTT Broker IP
- JSON parse size
All you need to do is add the GitHub-Link to this Repo under lib_deps in your platformio.ini File and you're set up. All dependencies are downloaded automatic.
All the Configuration data is stored in the CommunicationConfiguration.h file and can be edited there.
All the ToDo's are documented in the source code with Doxygen.
- Philip Zellweger
- Luca Mazzoleni
- Luciano Bettinaglio
V 1.0 - Release BA FS19 - Luca Mazzoleni
V 2.0 - Release SA HS20 - Philip Zellweger
MIT License
- SmartFactory-Sortic
- SmartFactory_Box-Sortic
- SmartFactory_Vehicle-Sortic
- SmartFactory_Vehicle-Basis
- SmartFactory_SorticRoboter
- SmartFactory_SorticRoboter_CommunicationHub
- SmartFactory_MQTTCommunication for Adafruit Feather M0 Wifi
- SmartFactory_MQTTCommunication for Esp32 DevKitC
- SmartFactory_I2cCommunication
- SmartFactory_Messages

