mirror of
https://github.com/FreeRTOS/FreeRTOS.git
synced 2026-10-07 02:53:32 +08:00
MQTT Lightweight demo (#119)
This commit is contained in:
+921
-11
File diff suppressed because it is too large
Load Diff
+64
-1
@@ -43,7 +43,7 @@
|
||||
|
||||
/* Logging configuration for the Demo. */
|
||||
#ifndef LIBRARY_LOG_NAME
|
||||
#define LIBRARY_LOG_NAME "DEMO"
|
||||
#define LIBRARY_LOG_NAME "MQTTLWDemo"
|
||||
#endif
|
||||
|
||||
#ifndef LIBRARY_LOG_LEVEL
|
||||
@@ -53,4 +53,67 @@
|
||||
|
||||
/************ End of logging configuration ****************/
|
||||
|
||||
/**
|
||||
* @brief The MQTT client identifier used in this example. Each client identifier
|
||||
* must be unique so edit as required to ensure no two clients connecting to the
|
||||
* same broker use the same client identifier.
|
||||
*
|
||||
* #define democonfigCLIENT_IDENTIFIER "insert here."
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* @brief MQTT broker end point to connect to.
|
||||
*
|
||||
* @note For running this demo an MQTT broker, which can be run locally on
|
||||
* the same host is recommended. Any MQTT broker, which can be run on a Windows
|
||||
* host can be used for this demo. However, the instructions below are for
|
||||
* setting up a local Mosquitto broker on a Windows host.
|
||||
* 1. Download Mosquitto from https://mosquitto.org/download/
|
||||
* 2. Install Mosquitto as a Windows service by running the installer.
|
||||
* More details about installing as a Windows service can be found at
|
||||
* https://github.com/eclipse/mosquitto/blob/master/readme-windows.txt and
|
||||
* https://github.com/eclipse/mosquitto/blob/master/readme.md
|
||||
* 3. Verify that Mosquitto server is running locally and listening on port
|
||||
* 1883 by
|
||||
* a. Opening Power Shell.
|
||||
* b. Typing in command `netstat -a -p TCP | grep 1883` to check if there
|
||||
* is an active connection listening on port 1883.
|
||||
* c. Verify that there is an output as shown below
|
||||
* `TCP 0.0.0.0:1883 <HOST-NAME>:0 LISTENING`
|
||||
* d. If there is no output please go through the Mosquitto documentation
|
||||
* listed above to check if the installation was successful.
|
||||
* 4.After verifying that a Mosquitto broker is running successfully, update
|
||||
* the config democonfigMQTT_BROKER_ENDPOINT to the local IP address of the
|
||||
* Windows host machine. Please note that "localhost" or address "127.0.0.1"
|
||||
* will not work as this example is running on a Windows Simulator and not on
|
||||
* Windows host natively.
|
||||
*
|
||||
* As an alternative option, a publicly hosted Mosquitto broker can also be
|
||||
* used as an MQTT broker end point. This can be done by updating the config
|
||||
* democonfigMQTT_BROKER_ENDPOINT to "test.mosquitto.org". However, this is not
|
||||
* recommended due the possible downtimes of the broker as indicated by the
|
||||
* documentation in https://test.mosquitto.org/.
|
||||
*
|
||||
* #define democonfigMQTT_BROKER_ENDPOINT "insert here."
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* @brief The port to use for the demo.
|
||||
*
|
||||
* #define democonfigMQTT_BROKER_PORT ( insert here. )
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* @brief Set the stack size of the main demo task.
|
||||
*
|
||||
* In the Windows port, this stack only holds a structure. The actual
|
||||
* stack is created by an operating system thread.
|
||||
*/
|
||||
#define democonfigDEMO_STACKSIZE configMINIMAL_STACK_SIZE
|
||||
|
||||
|
||||
|
||||
#endif /* DEMO_CONFIG_H */
|
||||
|
||||
+1
-1
@@ -46,7 +46,7 @@
|
||||
#endif
|
||||
|
||||
#ifndef LIBRARY_LOG_LEVEL
|
||||
#define LIBRARY_LOG_LEVEL LOG_INFO
|
||||
#define LIBRARY_LOG_LEVEL LOG_NONE
|
||||
#endif
|
||||
|
||||
#include "logging_stack.h"
|
||||
|
||||
Reference in New Issue
Block a user