Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
P
pissirSmartHome
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Package Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Alfredo Chissotti
pissirSmartHome
Commits
d6425ea7
Commit
d6425ea7
authored
2 years ago
by
A C
Browse files
Options
Downloads
Patches
Plain Diff
lucimicro
parent
6c15485e
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
LuciMicro/src/code/Subscriber.java
+19
-4
19 additions, 4 deletions
LuciMicro/src/code/Subscriber.java
with
19 additions
and
4 deletions
LuciMicro/src/code/Subscriber.java
+
19
−
4
View file @
d6425ea7
...
...
@@ -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
());
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment