You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@plc4x.apache.org by cd...@apache.org on 2022/10/21 13:10:37 UTC

[plc4x] branch develop updated: chore(protocols): Added a pointer to a possibly interesting protocol specification.

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

cdutz pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/plc4x.git


The following commit(s) were added to refs/heads/develop by this push:
     new 7590b0166 chore(protocols): Added a pointer to a possibly interesting protocol specification.
7590b0166 is described below

commit 7590b0166264f3583ed2f5f32a97a7ae292481f2
Author: Christofer Dutz <ch...@c-ware.de>
AuthorDate: Fri Oct 21 15:10:12 2022 +0200

    chore(protocols): Added a pointer to a possibly interesting protocol specification.
---
 protocols/open-protocol/pom.xml                    | 43 ++++++++++++++++++++++
 .../openprotocol/OpenProtocolProtocol.java         | 42 +++++++++++++++++++++
 ...e.plc4x.plugins.codegenerator.protocol.Protocol | 19 ++++++++++
 .../protocols/openprotocol/open-protocol.mspec     | 21 +++++++++++
 protocols/pom.xml                                  |  1 +
 5 files changed, 126 insertions(+)

diff --git a/protocols/open-protocol/pom.xml b/protocols/open-protocol/pom.xml
new file mode 100644
index 000000000..6ba8760a0
--- /dev/null
+++ b/protocols/open-protocol/pom.xml
@@ -0,0 +1,43 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  Licensed to the Apache Software Foundation (ASF) under one
+  or more contributor license agreements.  See the NOTICE file
+  distributed with this work for additional information
+  regarding copyright ownership.  The ASF licenses this file
+  to you under the Apache License, Version 2.0 (the
+  "License"); you may not use this file except in compliance
+  with the License.  You may obtain a copy of the License at
+
+      https://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing,
+  software distributed under the License is distributed on an
+  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+  KIND, either express or implied.  See the License for the
+  specific language governing permissions and limitations
+  under the License.
+  -->
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+
+  <modelVersion>4.0.0</modelVersion>
+
+  <parent>
+    <groupId>org.apache.plc4x</groupId>
+    <artifactId>plc4x-protocols</artifactId>
+    <version>0.11.0-SNAPSHOT</version>
+  </parent>
+
+  <artifactId>plc4x-protocols-open-protocol</artifactId>
+
+  <name>Protocols: Open-Protocol</name>
+  <description>Protocol specifications for the Atlas Copco: Open Protocol protocol</description>
+
+  <dependencies>
+    <dependency>
+      <groupId>org.apache.plc4x</groupId>
+      <artifactId>plc4x-code-generation-protocol-base-mspec</artifactId>
+      <version>0.11.0-SNAPSHOT</version>
+    </dependency>
+  </dependencies>
+
+</project>
\ No newline at end of file
diff --git a/protocols/open-protocol/src/main/java/org/apache/plc4x/protocol/openprotocol/OpenProtocolProtocol.java b/protocols/open-protocol/src/main/java/org/apache/plc4x/protocol/openprotocol/OpenProtocolProtocol.java
new file mode 100644
index 000000000..268ca0b47
--- /dev/null
+++ b/protocols/open-protocol/src/main/java/org/apache/plc4x/protocol/openprotocol/OpenProtocolProtocol.java
@@ -0,0 +1,42 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.plc4x.protocol.openprotocol;
+
+import org.apache.plc4x.plugins.codegenerator.language.mspec.parser.MessageFormatParser;
+import org.apache.plc4x.plugins.codegenerator.language.mspec.protocol.ProtocolHelpers;
+import org.apache.plc4x.plugins.codegenerator.language.mspec.protocol.ValidatableTypeContext;
+import org.apache.plc4x.plugins.codegenerator.protocol.Protocol;
+import org.apache.plc4x.plugins.codegenerator.protocol.TypeContext;
+import org.apache.plc4x.plugins.codegenerator.types.exceptions.GenerationException;
+
+public class OpenProtocolProtocol implements Protocol, ProtocolHelpers {
+
+    @Override
+    public String getName() {
+        return "open-protocol";
+    }
+
+    @Override
+    public TypeContext getTypeContext() throws GenerationException {
+        ValidatableTypeContext typeContext = new MessageFormatParser().parse(getMspecStream());
+        typeContext.validate();
+        return typeContext;
+    }
+
+}
diff --git a/protocols/open-protocol/src/main/resources/META-INF/services/org.apache.plc4x.plugins.codegenerator.protocol.Protocol b/protocols/open-protocol/src/main/resources/META-INF/services/org.apache.plc4x.plugins.codegenerator.protocol.Protocol
new file mode 100644
index 000000000..f0e409251
--- /dev/null
+++ b/protocols/open-protocol/src/main/resources/META-INF/services/org.apache.plc4x.plugins.codegenerator.protocol.Protocol
@@ -0,0 +1,19 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#     https://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+#
+org.apache.plc4x.protocol.openprotocol.OpenProtocolProtocol
diff --git a/protocols/open-protocol/src/main/resources/protocols/openprotocol/open-protocol.mspec b/protocols/open-protocol/src/main/resources/protocols/openprotocol/open-protocol.mspec
new file mode 100644
index 000000000..3f54d7e11
--- /dev/null
+++ b/protocols/open-protocol/src/main/resources/protocols/openprotocol/open-protocol.mspec
@@ -0,0 +1,21 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+// Spec available from here:
+// https://de.scribd.com/document/428086428/OpenProtocol-Specification-R-2-8-0-9836-4415-01
diff --git a/protocols/pom.xml b/protocols/pom.xml
index ea6c23318..e076a77ff 100644
--- a/protocols/pom.xml
+++ b/protocols/pom.xml
@@ -47,6 +47,7 @@
     <module>modbus</module>
     <module>mqtt</module>
     <module>opcua</module>
+    <module>open-protocol</module>
     <module>plc4x</module>
     <module>plc4x-api</module>
     <module>profinet</module>