You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@streampipes.apache.org by ze...@apache.org on 2021/12/14 13:07:57 UTC

[incubator-streampipes] branch dev updated: [hotfix] Add date types to PLC4X S7 adapter

This is an automated email from the ASF dual-hosted git repository.

zehnder pushed a commit to branch dev
in repository https://gitbox.apache.org/repos/asf/incubator-streampipes.git


The following commit(s) were added to refs/heads/dev by this push:
     new 5c577a2  [hotfix] Add date types to PLC4X S7 adapter
5c577a2 is described below

commit 5c577a28f736ac72706eec98ab84cc956b7f8d72
Author: Philipp Zehnder <ze...@fzi.de>
AuthorDate: Tue Dec 14 14:07:41 2021 +0100

    [hotfix] Add date types to PLC4X S7 adapter
---
 .../connect/iiot/adapters/plc4x/s7/Plc4xS7Adapter.java     | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/streampipes-extensions/streampipes-connect-adapters-iiot/src/main/java/org/apache/streampipes/connect/iiot/adapters/plc4x/s7/Plc4xS7Adapter.java b/streampipes-extensions/streampipes-connect-adapters-iiot/src/main/java/org/apache/streampipes/connect/iiot/adapters/plc4x/s7/Plc4xS7Adapter.java
index 19224d1..46d69a2 100644
--- a/streampipes-extensions/streampipes-connect-adapters-iiot/src/main/java/org/apache/streampipes/connect/iiot/adapters/plc4x/s7/Plc4xS7Adapter.java
+++ b/streampipes-extensions/streampipes-connect-adapters-iiot/src/main/java/org/apache/streampipes/connect/iiot/adapters/plc4x/s7/Plc4xS7Adapter.java
@@ -116,7 +116,7 @@ public class Plc4xS7Adapter extends PullAdapter {
                         StaticProperties.stringFreeTextProperty(Labels.withId(PLC_NODE_RUNTIME_NAME)),
                         StaticProperties.stringFreeTextProperty(Labels.withId(PLC_NODE_NAME)),
                         StaticProperties.singleValueSelection(Labels.withId(PLC_NODE_TYPE),
-                                Options.from("Bool",  "Byte", "Int", "Word", "Real", "Char", "String")))
+                                Options.from("Bool",  "Byte", "Int", "Word", "Real", "Char", "String", "Date", "Time of day", "Date and Time")))
                 .build();
         description.setAppId(ID);
 
@@ -145,7 +145,7 @@ public class Plc4xS7Adapter extends PullAdapter {
         List<EventProperty> allProperties = new ArrayList<>();
 
         for (Map<String, String> node : this.nodes) {
-            Datatypes datatype = getStreamPipesDataType(node.get(PLC_NODE_TYPE).toUpperCase());
+            Datatypes datatype = getStreamPipesDataType(node.get(PLC_NODE_TYPE).toUpperCase().replaceAll(" ", "_"));
 
             allProperties.add(
                     PrimitivePropertyBuilder
@@ -299,16 +299,16 @@ public class Plc4xS7Adapter extends PullAdapter {
             case "BOOL":
                 return Datatypes.Boolean;
             case "BYTE":
+            case "REAL":
                 return Datatypes.Float;
             case "INT":
                 return Datatypes.Integer;
             case "WORD":
-                return Datatypes.String;
-            case "REAL":
-                return Datatypes.Float;
-            case "CHAR":
-                return Datatypes.String;
+            case "TIME_OF_DAY":
+            case "DATE":
+            case "DATE_AND_TIME":
             case "STRING":
+            case "CHAR":
                 return Datatypes.String;
             default:
                 throw new AdapterException("Datatype " + plcType + " is not supported");