Skip to content
Snippets Groups Projects
Commit d6425ea7 authored by A C's avatar A C
Browse files

lucimicro

parent 6c15485e
No related branches found
No related tags found
No related merge requests found
......@@ -69,7 +69,13 @@ public class Subscriber implements MqttCallback{
if(topic.equals(Luci.getMqttTree("rpc/","luci"))) {
Helper.print("invio la mia configurazione");
sendRequested(Luci.getMqttTree("from/","luci"),true);
sendFile(Luci.getMqttTree("from/","luci"),true);
return;
}
if(topic.equals("to/all")) {
Helper.print("invio il mio stato");
sendStatus(Luci.getMqttTree("from/","luci"),true);
return;
}
......@@ -170,11 +176,20 @@ public class Subscriber implements MqttCallback{
Helper.print("Impossibile");
}
private void sendRequested(String topic,boolean moreInfo) throws MqttException, JSONException, IOException {
private void sendFile(String topic,boolean moreInfo) throws MqttException, JSONException, IOException {
JSONObject j = new JSONObject(luci.FILE_ZONA);
//System.out.println(luci.FILE_ZONA);
//j.put("stato", luci.luciList.toString());
luci.sendMqttMessage(topic, j.toString());
}
private void sendStatus(String topic,boolean moreInfo) throws MqttException, JSONException, IOException {
JSONObject j = new JSONObject(luci.FILE_ZONA);
System.out.println(luci.FILE_ZONA);
j.remove("sensM");
//System.out.println(luci.FILE_ZONA);
j.put("stato", luci.luciList.toString());
//j.put("stato", luci.luciList.toString());
luci.sendMqttMessage(topic, j.toString());
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment