Skip to content

Commit 475b50c

Browse files
authored
Merge pull request #184 from iot-dsa-v2/develop
0.75.1
2 parents 7fa8709 + 12af47f commit 475b50c

File tree

4 files changed

+44
-2
lines changed

4 files changed

+44
-2
lines changed

build.gradle

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ subprojects {
55
apply plugin: 'maven'
66

77
group 'org.iot-dsa'
8-
version '0.75.0'
8+
version '0.75.1'
99

1010
targetCompatibility = JavaVersion.VERSION_1_8
1111
sourceCompatibility = JavaVersion.VERSION_1_8

dslink-v2-api/src/main/java/org/iot/dsa/node/DSInfo.java

+13
Original file line numberDiff line numberDiff line change
@@ -201,6 +201,19 @@ public void getMetadata(DSMap bucket) {
201201
if (metadata != null) {
202202
bucket.putAll(metadata);
203203
}
204+
if (isNode()) {
205+
DSNode node = getNode();
206+
DSInfo<?> info = node.getFirstInfo();
207+
while (info != null) {
208+
if (info.isValue()) {
209+
char ch = info.getName().charAt(0);
210+
if ((ch == '$') || (ch == '@')) {
211+
bucket.put(info.getName(), info.getElement());
212+
}
213+
}
214+
info = info.next;
215+
}
216+
}
204217
}
205218

206219
/**

dslink-v2/src/main/java/com/acuity/iot/dsa/dslink/protocol/responder/DSInboundList.java

+20-1
Original file line numberDiff line numberDiff line change
@@ -142,14 +142,33 @@ public void onEvent(DSEvent event, DSNode node, DSInfo<?> child, DSIValue data)
142142
return;
143143
}
144144
switch (event.getEventId()) {
145+
case DSNode.METADATA_CHANGED:
146+
if (target.getTarget() == node) {
147+
cacheMap.clear();
148+
node.getInfo().getMetadata(cacheMap);
149+
encodeTargetMetadata(cacheMap);
150+
cacheMap.clear();
151+
}
152+
break;
153+
case DSNode.VALUE_CHANGED:
154+
char ch = child.getName().charAt(0);
155+
if ((ch == '@') || (ch == '$')) {
156+
send(child.getName(), child.getElement());
157+
}
158+
break;
145159
case DSNode.CHILD_RENAMED:
146160
if (target.getTarget() == node) {
147161
sendRemove(data.toString());
148162
}
149163
//fall through to add the child
150164
case DSNode.CHILD_ADDED:
151165
if (target.getTarget() == node) {
152-
encodeChild(child);
166+
char c = child.getName().charAt(0);
167+
if ((c == '@') || (c == '$')) {
168+
send(child.getName(), child.getElement());
169+
} else {
170+
encodeChild(child);
171+
}
153172
}
154173
break;
155174
case DSNode.CHILD_REMOVED:

dslink-v2/src/main/java/com/acuity/iot/dsa/dslink/sys/backup/SysBackupService.java

+10
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ public class SysBackupService extends DSNode implements Runnable {
4747
private Object lock = new Object();
4848
private DSInfo<?> maximum = getInfo(MAXIMUM);
4949
private Timer nextSave;
50+
private boolean saving = false;
5051

5152
public boolean isEnabled() {
5253
return enabled.getElement().toBoolean();
@@ -102,6 +103,12 @@ public void save() {
102103
if (!isEnabled()) {
103104
return;
104105
}
106+
synchronized (this) {
107+
if (saving) {
108+
return;
109+
}
110+
saving = true;
111+
}
105112
ZipOutputStream zos = null;
106113
InputStream in = null;
107114
try {
@@ -173,6 +180,9 @@ public void save() {
173180
} catch (IOException x) {
174181
error("Closing output", x);
175182
}
183+
synchronized (this) {
184+
saving = false;
185+
}
176186
}
177187

178188
@Override

0 commit comments

Comments
 (0)