Skip to content

Commit

Permalink
Merge branch '3.x' into master-3.x
Browse files Browse the repository at this point in the history
  • Loading branch information
wes-johnson committed Jun 20, 2024
2 parents 6d11a06 + 69ebd53 commit 57846ff
Show file tree
Hide file tree
Showing 43 changed files with 6,777 additions and 4,473 deletions.
2 changes: 1 addition & 1 deletion java/compat_impl/edge/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
<parent>
<groupId>org.eclipse.tahu</groupId>
<artifactId>tahu</artifactId>
<version>1.0.8</version>
<version>1.0.10</version>
<relativePath>../../pom.xml</relativePath>
</parent>

Expand Down
2 changes: 1 addition & 1 deletion java/compat_impl/host/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
<parent>
<groupId>org.eclipse.tahu</groupId>
<artifactId>tahu</artifactId>
<version>1.0.8</version>
<version>1.0.10</version>
<relativePath>../../pom.xml</relativePath>
</parent>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ public SparkplugHostApplication() {
try {
hostApplication = new HostApplication(this, HOST_ID,
new ArrayList<>(Arrays.asList(SparkplugMeta.SPARKPLUG_B_TOPIC_PREFIX + "/#")),
mqttServerDefinitions, null, new SparkplugBPayloadDecoder());
mqttServerDefinitions, null, new SparkplugBPayloadDecoder(), true);
} catch (Exception e) {
logger.error("Failed to create the HostApplication", e);
}
Expand All @@ -110,7 +110,7 @@ public SparkplugHostApplication() {
public void start() throws TahuException {
commandListener = new CommandListener(hostApplication, COMMAND_LISTENER_DIRECTORY, COMMAND_LISTENER_POLL_RATE);
commandListener.start();
hostApplication.start();
hostApplication.start(true);
}

public void shutdown() {
Expand Down
2 changes: 1 addition & 1 deletion java/examples/device_timestamp/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
<parent>
<groupId>org.eclipse.tahu</groupId>
<artifactId>tahu-examples</artifactId>
<version>1.0.8</version>
<version>1.0.10</version>
<relativePath>../pom.xml</relativePath>
</parent>

Expand Down
2 changes: 1 addition & 1 deletion java/examples/edge_node_control/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
<parent>
<groupId>org.eclipse.tahu</groupId>
<artifactId>tahu-examples</artifactId>
<version>1.0.8</version>
<version>1.0.10</version>
<relativePath>../pom.xml</relativePath>
</parent>

Expand Down
2 changes: 1 addition & 1 deletion java/examples/host_file/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
<parent>
<groupId>org.eclipse.tahu</groupId>
<artifactId>tahu-examples</artifactId>
<version>1.0.8</version>
<version>1.0.10</version>
<relativePath>../pom.xml</relativePath>
</parent>

Expand Down
2 changes: 1 addition & 1 deletion java/examples/listener/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
<parent>
<groupId>org.eclipse.tahu</groupId>
<artifactId>tahu-examples</artifactId>
<version>1.0.8</version>
<version>1.0.10</version>
<relativePath>../pom.xml</relativePath>
</parent>

Expand Down
2 changes: 1 addition & 1 deletion java/examples/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@

<groupId>org.eclipse.tahu</groupId>
<artifactId>tahu-examples</artifactId>
<version>1.0.8</version>
<version>1.0.10</version>
<packaging>pom</packaging>

<name>Eclipse Tahu</name>
Expand Down
2 changes: 1 addition & 1 deletion java/examples/raspberry_pi/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
<parent>
<groupId>org.eclipse.tahu</groupId>
<artifactId>tahu-examples</artifactId>
<version>1.0.8</version>
<version>1.0.10</version>
<relativePath>../pom.xml</relativePath>
</parent>

Expand Down
2 changes: 1 addition & 1 deletion java/examples/records/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
<parent>
<groupId>org.eclipse.tahu</groupId>
<artifactId>tahu-examples</artifactId>
<version>1.0.8</version>
<version>1.0.10</version>
<relativePath>../pom.xml</relativePath>
</parent>

Expand Down
2 changes: 1 addition & 1 deletion java/examples/simple/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
<parent>
<groupId>org.eclipse.tahu</groupId>
<artifactId>tahu-examples</artifactId>
<version>1.0.8</version>
<version>1.0.10</version>
<relativePath>../pom.xml</relativePath>
</parent>

Expand Down
2 changes: 1 addition & 1 deletion java/examples/udt/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
<parent>
<groupId>org.eclipse.tahu</groupId>
<artifactId>tahu-examples</artifactId>
<version>1.0.8</version>
<version>1.0.10</version>
<relativePath>../pom.xml</relativePath>
</parent>

Expand Down
4 changes: 2 additions & 2 deletions java/lib/core/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
<parent>
<groupId>org.eclipse.tahu</groupId>
<artifactId>tahu</artifactId>
<version>1.0.8</version>
<version>1.0.10</version>
<relativePath>../../pom.xml</relativePath>
</parent>

Expand All @@ -35,7 +35,7 @@
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-compress</artifactId>
<version>1.21</version>
<version>1.26.0</version>
</dependency>
</dependencies>

Expand Down
3 changes: 2 additions & 1 deletion java/lib/core/readme.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
# To generate the base protobuf sparkplug_b Java library
protoc --proto_path=../../ --java_out=src/main/java ../../sparkplug_b/sparkplug_b.proto
cd ~/dev/gitflow/Tahu/java/lib/core
protoc --proto_path=../../../sparkplug_b/ --java_out=src/main/java ../../../sparkplug_b/sparkplug_b.proto
Original file line number Diff line number Diff line change
Expand Up @@ -163,34 +163,35 @@ private Value<?> getValueFromNode(JsonNode nodeValue, DataSetDataType type) {
logger.debug("Getting value: type={} and nodeValue={}", type, nodeValue);
}

switch (type) {
case Boolean:
return new Value<Boolean>(type, (boolean) nodeValue.asBoolean());
case DateTime:
return new Value<Date>(type, new Date(nodeValue.asLong()));
case Double:
return new Value<Double>(type, nodeValue.asDouble());
case Float:
return new Value<Float>(type, (float) nodeValue.asDouble());
case Int8:
return new Value<Byte>(type, (byte) nodeValue.asInt());
case UInt8:
case Int16:
return new Value<Short>(type, (short) nodeValue.asInt());
case UInt16:
case Int32:
return new Value<Integer>(type, nodeValue.asInt());
case UInt32:
case Int64:
return new Value<Long>(type, (long) nodeValue.asLong());
case Text:
case String:
return new Value<String>(type, nodeValue.asText());
case UInt64:
return new Value<BigInteger>(type, BigInteger.valueOf(nodeValue.asLong()));
case Unknown:
default:
return null;
if (type.toIntValue() == DataSetDataType.Boolean.toIntValue()) {
return new Value<Boolean>(type, (boolean) nodeValue.asBoolean());
} else if (type.toIntValue() == DataSetDataType.DateTime.toIntValue()) {
return new Value<Date>(type, new Date(nodeValue.asLong()));
} else if (type.toIntValue() == DataSetDataType.Double.toIntValue()) {
return new Value<Double>(type, nodeValue.asDouble());
} else if (type.toIntValue() == DataSetDataType.Float.toIntValue()) {
return new Value<Float>(type, (float) nodeValue.asDouble());
} else if (type.toIntValue() == DataSetDataType.Int8.toIntValue()) {
return new Value<Byte>(type, (byte) nodeValue.asInt());
} else if (type.toIntValue() == DataSetDataType.Int16.toIntValue()) {
return new Value<Short>(type, (short) nodeValue.asInt());
} else if (type.toIntValue() == DataSetDataType.Int32.toIntValue()) {
return new Value<Integer>(type, nodeValue.asInt());
} else if (type.toIntValue() == DataSetDataType.Int64.toIntValue()) {
return new Value<Long>(type, (long) nodeValue.asLong());
} else if (type.toIntValue() == DataSetDataType.UInt8.toIntValue()) {
return new Value<Short>(type, (short) nodeValue.asInt());
} else if (type.toIntValue() == DataSetDataType.UInt16.toIntValue()) {
return new Value<Integer>(type, nodeValue.asInt());
} else if (type.toIntValue() == DataSetDataType.UInt32.toIntValue()) {
return new Value<Long>(type, (long) nodeValue.asLong());
} else if (type.toIntValue() == DataSetDataType.UInt64.toIntValue()) {
return new Value<BigInteger>(type, BigInteger.valueOf(nodeValue.asLong()));
} else if (type.toIntValue() == DataSetDataType.String.toIntValue()
|| type.toIntValue() == DataSetDataType.Text.toIntValue()) {
return new Value<String>(type, nodeValue.asText());
} else {
return null;
}
}
}
Loading

0 comments on commit 57846ff

Please sign in to comment.