From 1284cbb2edeb564f4b4f12c154a72c034bb2af6a Mon Sep 17 00:00:00 2001
From: guowenxue <guowenxue@gmail.com>
Date: Wed, 31 Jul 2019 01:02:27 +0800
Subject: [PATCH] Update mqttd subscribe test shell script

---
 mqttd/tools/pub_test.sh |    0 
 mqttd/tools/sub_test.sh |   35 +++++++++++++++++++++++++++++++++++
 2 files changed, 35 insertions(+), 0 deletions(-)

diff --git a/mqttd/tools/publish_test.sh b/mqttd/tools/pub_test.sh
similarity index 100%
rename from mqttd/tools/publish_test.sh
rename to mqttd/tools/pub_test.sh
diff --git a/mqttd/tools/sub_test.sh b/mqttd/tools/sub_test.sh
new file mode 100755
index 0000000..ff86b32
--- /dev/null
+++ b/mqttd/tools/sub_test.sh
@@ -0,0 +1,35 @@
+#!/bin/bash
+
+progname=mosquitto_sub
+
+hostname="master.iot-yun.club"
+port=10883
+uid="lingyun"
+pwd="lingyun-emb"
+dltopic="\$Sys/Studio/Downlink"
+uptopic="\$Sys/Studio/Uplink"
+
+sub_command="$progname -h $hostname -p $port -u $uid -P $pwd -t "
+
+topics=("" "$uptopic" "$dltopic" ) 
+
+echo ""
+echo "Please select a subscribe topic:" 
+echo "1, < Uplink Topic >: Device ---> Server message"
+echo "2, <Downlink Topic>: Server ---> Device message" 
+echo ""
+
+stty erase '^H' 
+read -p "Enter your choise [1/2] : " choice
+
+if [ $choice -gt 2 ] ; then
+    echo "ERROR: Invalid input choice, exit now..."
+    exit 1;
+fi
+
+topic=${topics[$choice]}
+
+set -x
+
+$sub_command $topic
+

--
Gitblit v1.9.1