# MQTT Application ## Table of Contents - [Table of Contents](#Table-of-Contents) - [Initialisation](#Initialisation) - [Changing Settings](#changing-settings) - [Server Settings](#server-settings) - [Publish Settings](#publish-settings) - [Text and image position](#text-and-image-position) - [Changing settings](#Changing-Settings) - [Getting started](#Getting-started) - [Set up](#setting-up) - [Topics](#topics) - [Colors](#colors) ## Initialisation The MQTT application should be initialised in the main function: ```c mqtt_application_init(); ``` In case a check for success is wanted, the function will return a '1' on failure and a '0' on success. ## Changing Settings ### Server Settings Depending on how the MQTT broker is set up on the pc some settings might need to be changed in the mqtt_application.c file. Make sure you change the corresponding defines to how you have set everything up: ```c #define SERVER_IP4_A 192 #define SERVER_IP4_B 168 #define SERVER_IP4_C 69 #define SERVER_IP4_D 11 #define SERVER_PORT 1883 ``` ### Publish Settings In case you want to change the QOS and retain attributes of the pulbish done by the application, change the corresponding defines: ```c #define PUBLISH_QOS 2 #define PUBLISH_RETAIN 1 ``` ### Text and image position If you want to display the text and images on a different location you can change the following defines(the starting point is the same for both text and images): ```c #define PRINT_XPOS 50 #define PRINT_YPOS 50 ``` ## Getting started In order to use this application you are going to need an MQTT broker: use this version: mosquitto 1.16.1a: https://mosquitto.org/files/binary/win64/mosquitto-1.6.12a-install-windows-x64.exe A publisher/subscriber is also required to have: recommended are: https://mqttx.app/ or https://github.com/eclipse/paho.mqtt-spy/wiki/Downloads ### Setting up Before testing the application make sure to run the mosquitto broker before starting and connecting the microcontroller. ### Topics The used topics are: - getImageList Upon start up a list of available images will get published here. - getGifList Upon start up a list of available gifs will get published here. - input/setText Text published here will be displayed on the LCD. - input/setImage Publish the correct name + extention for the image/gif you want to display here. - input/setColor Publish the color you want the backgroundcolor to be here. This will take effect after changing the text or image/gif. - input/setTextColor Publish the color you want the text to be here. ### Colors Colors should be published using the same format as listed below. Available colors are: "LCD_BLUE, LCD_GREEN, LCD_RED, LCD_CYAN, LCD_MAGENTA, LCD_YELLOW, LCD_LIGHTBLUE, LCD_LIGHTGREEN, LCD_LIGHTRED, LCD_LIGHTCYAN, LCD_LIGHTMAGENTA, LCD_LUGHTYELLOW, LCD_DARKBLUE, LCD_DARKGREEN, LCD_DARKRED, LCD_DARKCYAN, LCD_DARKMAGENTA, LCD_DARKYELLOW, LCD_WHITE, LCD_LIGHTGRAY, LCD_GRAY, LCD_DARKGRAY, LCD_BLACK, LCD_BROWN, LCD_ORANGE, LCD_TRANSPARENT"