Skip to content

Commit

Permalink
fix(cbus/plc4j): fix compile issues
Browse files Browse the repository at this point in the history
  • Loading branch information
sruehl committed Feb 28, 2022
1 parent ed71d06 commit 115f0e1
Show file tree
Hide file tree
Showing 3 changed files with 85 additions and 24 deletions.
8 changes: 4 additions & 4 deletions plc4j/drivers/c-bus/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
}
62 changes: 42 additions & 20 deletions protocols/c-bus/src/main/resources/protocols/cbus/c-bus.mspec
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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 ]
Expand All @@ -99,27 +111,27 @@
]
[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
[simple Application application ]
[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>"
]
]
Expand All @@ -128,22 +140,22 @@
[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
[simple Application application ]
[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>"
]
]
Expand Down Expand Up @@ -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
]
]
]
Expand All @@ -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 ]
Expand All @@ -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>"
]
Expand All @@ -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
Expand All @@ -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>"
]
Expand Down Expand Up @@ -298,3 +316,7 @@
[array BridgeAddress additionalBridgeAddresses count 'routeType.additionalBridges']
[simple UnitAddress unitAddress ]
]

[type Checksum
[simple byte crc]
]

0 comments on commit 115f0e1

Please sign in to comment.