mirror of
https://github.com/zephyrproject-rtos/zephyr
synced 2025-08-09 11:15:27 +00:00
$srctree for the application might not be set to be $ZEPHYR_BASE, use $ZEPHYR_BASE instead to be more explicit in the build. Change-Id: Iefa5ff59f246b584949329044f7a6531adc6ed62 Signed-off-by: Kumar Gala <kumar.gala@linaro.org> |
||
---|---|---|
.. | ||
src | ||
Kbuild | ||
Makefile | ||
prj_ethernet.conf | ||
README |
MQTT shell example ================== This sample shows how to create an interactive MQTT client using the Zephyr shell and the Paho's MQTT Library. Instructions ------------ 1. Read carefully the README file in samples/net/paho_mqtt_client. 2. Clone Paho's MQTT Library: git clone https://git.eclipse.org/r/paho/org.eclipse.paho.mqtt.embedded-c paho 3. make pristine && make are enough to build this sample. So far, IPv4 addresses are still hard-coded in the config.h file. Quick guide ----------- The Zephyr shell allows you to type commands in the debug console. To connect with the gateway, use the following command: mqtt_shell> repeat_until_ok connect zephyr_galileo repeat_until_ok will iterate until the command returns 0. To ping the gateway: mqtt_shell> ping To subscribe to any zephyr's subtopic, type the following command: mqtt_shell> subscribe zephyr/# In your host, open another terminal and publish some random messages: mosquitto_pub -t "zephyr/lamps" -m "lamp1:OK" mosquitto_pub -t "zephyr/doors" -m "door3:OPEN" To read these messages from Galileo, type: mqtt_shell> read topic: zephyr/lamps, msg: lamp1:OK mqtt_shell> read topic: zephyr/doors, msg: door3:OPEN Observe that the Galileo MQTT shell is subscribed to "zephyr/#". To publish a message: mqtt_shell> publish zephyr "Hello!" To repeat a command multiple times: mqtt_shell> repeat 5 ping This will send 5 consecutive pings to the gateway.