You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@plc4x.apache.org by sr...@apache.org on 2022/02/28 15:20:34 UTC

[plc4x] branch develop updated: fix(cbus/plc4j): fix compile issues

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

sruehl 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 115f0e1  fix(cbus/plc4j): fix compile issues
115f0e1 is described below

commit 115f0e1ec04197f7a46e859da92b724008a2e91c
Author: Sebastian Rühl <sr...@apache.org>
AuthorDate: Mon Feb 28 16:20:24 2022 +0100

    fix(cbus/plc4j): fix compile issues
---
 plc4j/drivers/c-bus/pom.xml                        |  8 +--
 .../org/apache/plc4x/java/cbus/CBusDriver.java     | 39 ++++++++++++++
 .../src/main/resources/protocols/cbus/c-bus.mspec  | 62 +++++++++++++++-------
 3 files changed, 85 insertions(+), 24 deletions(-)

diff --git a/plc4j/drivers/c-bus/pom.xml b/plc4j/drivers/c-bus/pom.xml
index 69575d9..6f71fd7 100644
--- a/plc4j/drivers/c-bus/pom.xml
+++ b/plc4j/drivers/c-bus/pom.xml
@@ -124,16 +124,16 @@
       <version>0.10.0-SNAPSHOT</version>
     </dependency>
 
-    <dependency>
+    <!--dependency>
       <groupId>org.apache.plc4x</groupId>
       <artifactId>plc4j-transport-tcp</artifactId>
       <version>0.10.0-SNAPSHOT</version>
-    </dependency>
+    </dependency-->
 
-    <dependency>
+    <!--dependency>
       <groupId>io.netty</groupId>
       <artifactId>netty-buffer</artifactId>
-    </dependency>
+    </dependency-->
 
     <dependency>
       <groupId>org.apache.plc4x</groupId>
diff --git a/plc4j/drivers/c-bus/src/main/java/org/apache/plc4x/java/cbus/CBusDriver.java b/plc4j/drivers/c-bus/src/main/java/org/apache/plc4x/java/cbus/CBusDriver.java
index 5b6870d..bcb41f8 100644
--- a/plc4j/drivers/c-bus/src/main/java/org/apache/plc4x/java/cbus/CBusDriver.java
+++ b/plc4j/drivers/c-bus/src/main/java/org/apache/plc4x/java/cbus/CBusDriver.java
@@ -18,7 +18,46 @@
  */
 package org.apache.plc4x.java.cbus;
 
+import org.apache.plc4x.java.api.value.PlcValueHandler;
+import org.apache.plc4x.java.cbus.readwrite.CBusCommand;
+import org.apache.plc4x.java.spi.configuration.Configuration;
 import org.apache.plc4x.java.spi.connection.GeneratedDriverBase;
+import org.apache.plc4x.java.spi.connection.PlcFieldHandler;
+import org.apache.plc4x.java.spi.connection.ProtocolStackConfigurer;
 
 public class CBusDriver extends GeneratedDriverBase<CBusCommand> {
+    @Override
+    public String getProtocolCode() {
+        return null;
+    }
+
+    @Override
+    public String getProtocolName() {
+        return null;
+    }
+
+    @Override
+    protected Class<? extends Configuration> getConfigurationType() {
+        return null;
+    }
+
+    @Override
+    protected PlcFieldHandler getFieldHandler() {
+        return null;
+    }
+
+    @Override
+    protected PlcValueHandler getValueHandler() {
+        return null;
+    }
+
+    @Override
+    protected String getDefaultTransport() {
+        return null;
+    }
+
+    @Override
+    protected ProtocolStackConfigurer<CBusCommand> getStackConfigurer() {
+        return null;
+    }
 }
diff --git a/protocols/c-bus/src/main/resources/protocols/cbus/c-bus.mspec b/protocols/c-bus/src/main/resources/protocols/cbus/c-bus.mspec
index 2fb8cfa..22e43b2 100644
--- a/protocols/c-bus/src/main/resources/protocols/cbus/c-bus.mspec
+++ b/protocols/c-bus/src/main/resources/protocols/cbus/c-bus.mspec
@@ -33,6 +33,18 @@
     ]
 ]
 
+// TODO: check if that can be used in combination with srchk
+[type CBusOptions
+    [simple bit connect]
+    [simple bit smart]
+    [simple bit idmon]
+    [simple bit exstat]
+    [simple bit monitor]
+    [simple bit monall]
+    [simple bit pun]
+    [simple bit pcn]
+]
+
 [type CBusHeader
     [simple   PriorityClass          priorityClass         ]
     [reserved bit                    'false'               ] // Reserved for internal C-Bus management purposes
@@ -86,7 +98,7 @@
 
 [discriminatedType CBusPointToPointCommand(bit srchk)
     [peek    uint 16     bridgeAddressCountPeek ]
-    [virtual bit         isDirect  'bridgeAddressCountPeek && 0x00FF == 0x0000']
+    [virtual bit         isDirect  '(bridgeAddressCountPeek & 0x00FF) == 0x0000']
     [typeSwitch isDirect
         ['true'  CBusPointToPointCommandDirect
             [simple UnitAddress   unitAddress                                                   ]
@@ -99,19 +111,19 @@
     ]
     [simple   CALData calData                                                                   ]
     [optional Checksum      crc      'srchk'                                                    ] // checksum is optional but mspec checksum isn't
-    [optional Alpha         alpha    'curPos <= lengthInBytes'                                  ] // TODO:Read if there's still two bytes left
+    [optional Alpha         alpha    'curPos <= 123123'                                  ] // TODO:Read if there's still two bytes left (was lengthInBytes but that didn't compile here)
     [const    byte          cr       0xD                                                        ] // 0xD == "<cr>"
 ]
 
 [discriminatedType CBusPointToMultiPointCommand(bit srchk)
-    [peek    byte     application             ]
-    [typeSwitch application
+    [peek    byte     peekedApplication             ]
+    [typeSwitch peekedApplication
         ['0xFF'   CBusPointToMultiPointCommandStatus
             [reserved byte          '0xFF'                                                     ]
             [reserved byte          '0x00'                                                     ]
             [simple   StatusRequest statusRequest                                              ]
             [optional Checksum      crc           'srchk'                                      ] // checksum is optional but mspec checksum isn't
-            [optional Alpha         alpha         'curPos <= lengthInBytes'                    ] // TODO:Read if there's still two bytes left
+            [optional Alpha         alpha         'curPos <= 123123'                    ] // TODO:Read if there's still two bytes left (was lengthInBytes but that didn't compile here)
             [const    byte          cr            0xD                                          ] // 0xD == "<cr>"
         ]
         [         CBusPointToMultiPointCommandNormal
@@ -119,7 +131,7 @@
             [reserved byte          '0x00'                                                     ]
             [simple   SALData       salData                                                    ]
             [optional Checksum      crc         'srchk'                                        ] // crc      is optional but mspec crc      isn't
-            [optional Alpha         alpha       'curPos <= lengthInBytes'                      ] // TODO:Read if there's still two bytes left
+            [optional Alpha         alpha       'curPos <= 123123'                      ] // TODO:Read if there's still two bytes left (was lengthInBytes but that didn't compile here)
             [const    byte          cr          0xD                                            ] // 0xD == "<cr>"
         ]
     ]
@@ -128,14 +140,14 @@
 [discriminatedType CBusPointToPointToMultipointCommand(bit srchk)
     [simple BridgeAddress bridgeAddress                                                        ]
     [simple NetworkRoute  networkRoute                                                         ]
-    [peek    byte     application                                                              ]
-    [typeSwitch application
+    [peek    byte       peekedApplication                                                      ]
+    [typeSwitch peekedApplication
             ['0xFF'   CBusCommandPointToPointToMultiPointStatus
                 [reserved byte        '0xFF'                                                   ]
                 [reserved byte        '0x00'                                                   ]
                 [simple StatusRequest statusRequest                                            ]
                 [optional Checksum    crc           'srchk'                                    ] // crc      is optional but mspec crc      isn't
-                [optional Alpha       alpha         'curPos <= lengthInBytes'                  ] // TODO:Read if there's still two bytes left
+                [optional Alpha       alpha         'curPos <= 123123'                  ] // TODO:Read if there's still two bytes left (was lengthInBytes but that didn't compile here)
                 [const    byte        cr            0xD                                        ] // 0xD == "<cr>"
             ]
             [         CBusCommandPointToPointToMultiPointNormal
@@ -143,7 +155,7 @@
                 [reserved byte        '0x00'                                                   ]
                 [simple SALData       salData                                                  ]
                 [optional Checksum    crc      'srchk'                                         ] // crc      is optional but mspec crc      isn't
-                [optional Alpha       alpha    'curPos <= lengthInBytes'                       ] // TODO:Read if there's still two bytes left
+                [optional Alpha       alpha    'curPos <= 123123'                       ] // TODO:Read if there's still two bytes left (was lengthInBytes but that didn't compile here)
                 [const    byte        cr       0xD                                             ] // 0xD == "<cr>"
             ]
         ]
@@ -189,12 +201,18 @@
 [type Reply
     [peek   byte magicByte]
     [typeSwitch magicByte
-        ['0x0' CALReply]
-        ['0x0' MonitoredSAL]
-        ['0x0' Confirmation]
-        ['0x0' PowerUp]
-        ['0x0' ParameterChange]
-        ['0x0' ExclamationMark]
+        ['0x0' CALReplyReply
+        ]
+        ['0x0' MonitoredSALReply
+        ]
+        ['0x0' ConfirmationReply
+        ]
+        ['0x0' PowerUpReply
+        ]
+        ['0x0' ParameterChangeReply
+        ]
+        ['0x0' ExclamationMarkReply
+        ]
     ]
 ]
 
@@ -205,7 +223,7 @@
             [reserved   byte                   '0x86'                                          ]
             [peek       uint 24                terminatingByte                                 ]
             // TODO: this should be subSub type but mspec doesn't support that yet directly
-            [virtual    bit                    isUnitAddress   'terminatingByte & 0xff == 0x00']
+            [virtual    bit                    isUnitAddress   '(terminatingByte & 0xff) == 0x00']
             [optional   UnitAddress            unitAddress     'isUnitAddress'                 ]
             [optional   BridgeAddress          bridgeAddress   '!isUnitAddress'                ]
             [simple     SerialInterfaceAddress serialInterfaceAddress                          ]
@@ -217,7 +235,7 @@
         ]
     ]
     [simple   CALData   calData                                                                ]
-    [checksum byte crc   '0x00'                                                                ]// TODO: Fix this
+    //[checksum byte crc   '0x00'                                                                ] // TODO: Fix this
     [const    byte      cr      0x0D                                                           ] // 0xD == "<cr>"
     [const    byte      lf      0x0A                                                           ] // 0xA == "<lf>"
 ]
@@ -237,7 +255,7 @@
             [reserved byte '0x05']
             [peek    uint 24     terminatingByte                        ]
             // TODO: this should be subSub type but mspec doesn't support that yet directly
-            [virtual bit isUnitAddress 'terminatingByte & 0xff == 0x00' ]
+            [virtual bit isUnitAddress '(terminatingByte & 0xff) == 0x00' ]
             [optional   UnitAddress
                          unitAddress     'isUnitAddress'                ]
             [optional   BridgeAddress
@@ -257,7 +275,7 @@
         ]
     ]
     [optional SALData salData                                               ]
-    [checksum byte crc   '0x00'                                                                ]// TODO: Fix this
+    //[checksum byte crc   '0x00'                                                                ] // TODO: Fix this
     [const    byte        cr 0x0D                                                     ] // 0xD == "<cr>"
     [const    byte        lf 0x0A                                                     ] // 0xA == "<lf>"
 ]
@@ -298,3 +316,7 @@
      [array  BridgeAddress additionalBridgeAddresses count 'routeType.additionalBridges']
      [simple UnitAddress   unitAddress                                                  ]
 ]
+
+[type Checksum
+    [simple byte crc]
+]
\ No newline at end of file