From d399ece9a16d2c9fe053a07912037a770f9fe1e5 Mon Sep 17 00:00:00 2001
From: guowenxue <guowenxue@gmail.com>
Date: Thu, 08 Aug 2019 13:06:23 +0800
Subject: [PATCH] Merge branch 'master' of ssh://master.iot-yun.club:2280/raspberrypi

---
 mqttd/main.c |   14 +++++++++++---
 1 files changed, 11 insertions(+), 3 deletions(-)

diff --git a/mqttd/main.c b/mqttd/main.c
index 1692422..f021966 100644
--- a/mqttd/main.c
+++ b/mqttd/main.c
@@ -275,7 +275,7 @@
         else 
             snprintf(msg, sizeof(msg), "{ \"id\":%s, \"temp\":\"%.2f\" }", ctx->id, temp);
 
-        rv = mosquitto_publish(mosq, NULL, ctx->pubTopic, strlen(msg)+1, msg, ctx->pubQos, retain);
+        rv = mosquitto_publish(mosq, NULL, ctx->pubTopic, strlen(msg), msg, ctx->pubQos, retain);
         if( rv )
         {
             log_err("Publisher broadcast message '%s' failure: %d\n", msg, rv);
@@ -295,7 +295,7 @@
         else 
             snprintf(msg, sizeof(msg), "{ \"id\":%s, \"temp\":\"%.2f\", \"RH\":\"%.2f\" }", ctx->id, temp, rh);
 
-        rv = mosquitto_publish(mosq, NULL, ctx->pubTopic, strlen(msg)+1, msg, ctx->pubQos, retain);
+        rv = mosquitto_publish(mosq, NULL, ctx->pubTopic, strlen(msg), msg, ctx->pubQos, retain);
         if( rv )
         {
             log_err("Publisher broadcast message '%s' failure: %d\n", msg, rv);
@@ -464,7 +464,15 @@
             {
                 if( strcasestr(value, "on") )
                 {
-                    log_nrml("Turn buzzer on [%d] times\n", hwconf->beep_times);
+		    turn_passive_beep(ON, BEEP_FREQ);
+                }
+		else if( strcasestr(value, "off") )
+                {
+		    turn_passive_beep(OFF, BEEP_FREQ);
+                }
+		else if( strcasestr(value, "music") )
+                { 
+		    play_little_star();
                 }
             }
 

--
Gitblit v1.9.1