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 2023/01/23 19:48:16 UTC

[plc4x] branch develop updated (b79e1d9b19 -> d8300da06a)

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

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


    from b79e1d9b19 chore(infra): Redirected the issue notifications to dev for testing.
     new 11d6cdee49 feat(example/ads): Continued working on the ADS EtherCAT Browser
     new d8300da06a feat(protocol/open-protocol): Started implementing the Open-Protocol mspec

The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 .../plc4x/java/ads/protocol/AdsProtocolLogic.java  |  12 +-
 .../telemetry/HelloAdsEtherCatTelemetry.java       | 190 ++++++---
 .../spi/codegen/fields/FieldReaderOptional.java    |   2 +-
 .../java/spi/generation/ReadBufferByteBased.java   |  25 +-
 .../protocols/openprotocol/open-protocol.mspec     | 455 +++++++++++++++++++++
 5 files changed, 616 insertions(+), 68 deletions(-)


[plc4x] 02/02: feat(protocol/open-protocol): Started implementing the Open-Protocol mspec

Posted by cd...@apache.org.
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

commit d8300da06ae9dd6a24aa8fbd1f3044381a5dd285
Author: Christofer Dutz <ch...@c-ware.de>
AuthorDate: Mon Jan 23 20:46:53 2023 +0100

    feat(protocol/open-protocol): Started implementing the Open-Protocol mspec
---
 .../protocols/openprotocol/open-protocol.mspec     | 455 +++++++++++++++++++++
 1 file changed, 455 insertions(+)

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
index 44cc9d84a2..3b3697f21d 100644
--- a/protocols/open-protocol/src/main/resources/protocols/openprotocol/open-protocol.mspec
+++ b/protocols/open-protocol/src/main/resources/protocols/openprotocol/open-protocol.mspec
@@ -19,3 +19,458 @@
 
 // Spec available from here:
 // https://de.scribd.com/document/428086428/OpenProtocol-Specification-R-2-8-0-9836-4415-01
+
+[type Constants
+    [const          uint 16     tcpDefaultPort 4545]
+]
+
+[discriminatedType OpenProtocolMessage
+    [implicit      uint 32              length               'lengthInBytes'      encoding="AsciiUint"]
+    [discriminator MID                  mid                                                           ]
+    [simple        OpenProtocolRevision revision                                                      ]
+    [simple        uint 8               noAckFlag                                                     ]
+    [simple        uint 16              stationId                                 encoding="AsciiUint"]
+    [simple        uint 16              spindleId                                 encoding="AsciiUint"]
+    [simple        uint 16              sequenceNumber                            encoding="AsciiUint"]
+    [simple        uint 8               numberOfMessageParts                      encoding="AsciiUint"]
+    [simple        uint 8               messagePartNumber                         encoding="AsciiUint"]
+    [typeSwitch mid
+        ['ApplicationCommunicationStart' *ApplicationCommunicationStart
+        ]
+        ['ApplicationCommunicationStartAcknowledge' *ApplicationCommunicationStartAcknowledge(revision)
+            [array ApplicationCommunicationStartAcknowledgeBlock blocks           count 'revision.numCommunicationStartAcknowledgeBlocks']
+        ]
+        ['ApplicationCommunicationStop' *ApplicationCommunicationStop
+        ]
+        ['ApplicationCommandError' *ApplicationCommandError
+            [simple MID                  requestMid]
+            [simple Error                error     ]
+        ]
+        ['ApplicationCommandAccepted' *ApplicationCommandAccepted
+            [simple MID                  requestMid]
+        ]
+        ['ApplicationGenericDataRequest' *ApplicationGenericDataRequest
+            [simple   MID                  requestMid                             ]
+            [simple   OpenProtocolRevision wantedRevision                         ]
+            [implicit uint 16              extraDataLength 'LEN(extraData)'       ]
+            [array    byte                 extraData       count 'extraDataLength']
+        ]
+    ]
+    [const         uint 8  end                  0x00                                     ]
+]
+
+[discriminatedType ApplicationCommunicationStartAcknowledgeBlock
+    [discriminator uint 16 blockType encoding="AsciiUint"]
+    [typeSwitch blockType
+        // Revision 1
+        ['01' *CellId
+            [simple   uint 32    cellId                    encoding="AsciiUint"]
+        ]
+        ['02' *ChannelId
+            [simple   uint 16    channelId                 encoding="AsciiUint"]
+        ]
+        ['03' *ControllerName
+            [simple   string 200 controllerName            encoding="ASCII"    ]
+        ]
+
+        // Additional Blocks for Revision 2
+        ['04' *SupplierCode
+            [simple   uint 24    supplierCode              encoding="AsciiUint"]
+        ]
+
+        // Additional Blocks for Revision 3
+        ['05' *OpenProtocolVersion
+            [simple   string 152 openProtocolVersion       encoding="ASCII"    ]
+        ]
+        ['06' *ControllerSoftwareVersion
+            [simple   string 152 controllerSoftwareVersion encoding="ASCII"    ]
+        ]
+        ['07' *ToolSoftwareVersion
+            [simple   string 152 toolSoftwareVersion       encoding="ASCII"    ]
+        ]
+
+        // Additional Blocks for Revision 4
+        ['08' *RbuType
+            [simple   string 192 rbuType                   encoding="ASCII"    ]
+        ]
+        ['09' *ControllerSerialNumber
+            [simple   string 80  controllerSerialNumber    encoding="ASCII"    ]
+        ]
+
+        // Additional Blocks for Revision 5
+        ['10' *SystemType
+            [simple   string 24  systemType                encoding="ASCII"    ]
+        ]
+        ['11' *SystemSubtype
+            [simple   string 24  systemSubtype             encoding="ASCII"    ]
+        ]
+
+        // Additional Blocks for Revision 6
+        ['12' *SequenceNumberSupport
+            [reserved uint 7     0                                             ]
+            [simple   bit        sequenceNumberSupport                         ]
+        ]
+        ['13' *LinkingHandlingSupport
+            [reserved uint 7     0                                             ]
+            [simple   bit        linkingHandlingSupport                        ]
+        ]
+        ['14' *StationId
+            [simple   string 80  stationId                 encoding="ASCII"    ]
+        ]
+        ['15' *StationName
+            [simple   string 200 stationName               encoding="ASCII"    ]
+        ]
+        ['16' *ClientId
+            [simple   uint 8     clientId                  encoding="AsciiUint"]
+        ]
+    ]
+]
+
+// Depending on the revision of the device, a different number of blocks are supported.
+[enum uint 24 OpenProtocolRevision(uint 8 numCommunicationStartAcknowledgeBlocks) encoding="AsciiUint"
+    ['1' Revision1                (       3                                     )]
+    ['2' Revision2                (       4                                     )]
+    ['3' Revision3                (       7                                     )]
+    ['4' Revision4                (       9                                     )]
+    ['5' Revision5                (       11                                    )]
+    ['6' Revision6                (       16                                    )]
+]
+
+[enum MidTypes
+    [JobMessage                         ] //  600 -  699
+    [ToolMessage                        ] //  700 -  799
+    [VinMessage                         ] //  800 -  899
+    [TighteningResultMessage            ] //  900 -  999
+    [AlarmMessage                       ] // 1000 - 1099
+    [TimeMessage                        ] // 1100 - 1199
+    [MultiSpindleStatusMessage          ] // 1200 - 1299
+    [MultiSpindleResultMessage          ] // 1300 - 1399
+    [UserInterfaceMessage               ] // 1400 - 1499
+    [JobMessageAdvanced                 ] // 1500 - 1599
+    [MultipleIdentifiersMessage         ] // 1600 - 1699
+    [IOInterfaceMessage                 ] // 1700 - 1799
+    [PlcUserDataMessage                 ] // 1800 - 1899
+    [SelectorMessage                    ] // 1900 - 1999
+    [ToolLocationSystemMessage          ] // 2000 - 2099
+    [ControllerMessage                  ] // 2100 - 2199
+    [StatisticMessage                   ] // 2200 - 2299
+    [AutomaticManualModeMessage         ] // 2300 - 2399
+    [OpenProtocolCommandsDisabledMessage] // 2400 - 2499
+    [ParameterSetMessage                ] // 2500 - 2599
+    [NewGroupsMessage                   ] // 2600 - 9999
+]
+
+[enum uint 32 Mid   encoding="AsciiUint"
+    ['0001' ApplicationCommunicationStart               ] // *
+    ['0002' ApplicationCommunicationStartAcknowledge    ] // *
+    ['0003' ApplicationCommunicationStop                ]
+    ['0004' ApplicationCommandError                     ] // *
+    ['0005' ApplicationCommandAccepted                  ] // *
+    ['0006' ApplicationGenericDataRequest               ]
+    ['0007' Reserved                                    ]
+    ['0008' ApplicationGenericSubscription              ] // *
+    ['0009' ApplicationGenericUnsubscribe               ] // *
+    ['0010' ParameterSetIdUploadRequest                 ] // *
+    ['0011' ParameterSetIdUploadReply                   ] // *
+    ['0012' ParameterSetDataUploadRequest               ] // *
+    ['0013' ParameterSetDataUploadReply                 ] // *
+    ['0014' ParameterSetSelectedSubscribe               ]
+    ['0015' ParameterSetSelected                        ]
+    ['0016' ParameterSetSelectedAcknowledge             ]
+    ['0017' ParameterSetSelectedUnsubscribe             ]
+    ['0018' SelectParameterSet                          ] // *
+    ['0019' SetParameterSetBatchSize                    ]
+    ['0020' ResetParameterSetBatchCounter               ]
+    ['0021' LockAtBatchDoneSubscribe                    ]
+    ['0022' LockAtBatchDoneUpload                       ]
+    ['0023' LockAtBatchDoneUploadAcknowledge            ]
+    ['0024' LockAtBatchDoneUnsubscribe                  ]
+    ['0025' ReservedForFord                             ]
+
+    ['0030' JobIdUploadRequest                          ]
+    ['0031' JobIdUploadReply                            ]
+    ['0032' JobDataUploadRequest                        ]
+    ['0033' JobDataUploadReply                          ]
+    ['0034' JobInfoSubscribe                            ]
+    ['0035' JobInfo                                     ]
+    ['0036' JobInfoAcknowledge                          ]
+    ['0037' JobInfoUnsubscribe                          ]
+    ['0038' SelectJob                                   ]
+    ['0039' JobRestart                                  ]
+    ['0040' ToolDataUploadRequest                       ]
+    ['0041' ToolDataUploadReply                         ]
+    ['0042' DisableTool                                 ] // *
+    ['0043' EnableTool                                  ] // *
+    ['0044' DisconnectToolRequest                       ]
+    ['0045' SetCalibrationValueRequest                  ]
+    ['0046' SetPrimaryToolRequest                       ]
+    ['0047' PairingHandling                             ]
+    ['0048' PairingStatus                               ]
+    ['0049' PairingStatusAcknowledge                    ]
+    ['0050' VehicleIdNumberDownloadRequest              ]
+    ['0051' VehicleIdNumberSubscribe                    ]
+    ['0052' VehicleIdNumber                             ]
+    ['0053' VehicleIdNumberAcknowledge                  ]
+    ['0054' VehicleIdNumberUnsubscribe                  ]
+
+    ['0060' LastTighteningResultDataSubscribe           ] // *
+    ['0061' LastTighteningResultData                    ] // *
+    ['0062' LastTighteningResultDataAcknowledge         ]
+    ['0063' LastTighteningResultDataUnsubscribe         ]
+    ['0064' OldTighteningResultUploadRequest            ]
+    ['0065' OldTighteningResultUploadReply              ]
+
+    ['0070' AlarmSubscribe                              ] // *
+    ['0071' Alarm                                       ] // *
+    ['0072' AlarmAcknowledge                            ] // *
+    ['0073' AlarmUnsubscribe                            ] // *
+    ['0074' AlarmAcknowledgedOnController               ]
+    ['0075' AlarmAcknowledgedOnControllerAcknowledge    ]
+    ['0076' AlarmStatus                                 ] // *
+    ['0077' AlarmStatusAcknowledge                      ] // *
+    ['0078' AcknowledgeAlarmRemotelyOnController        ]
+
+    ['0080' ReadTimeUploadRequest                       ]
+    ['0081' ReadTimeUploadReply                         ]
+    ['0082' SetTime                                     ] // *
+
+    ['0090' MultiSpindleStatusSubscribe                 ]
+    ['0091' MultiSpindleStatus                          ]
+    ['0092' MultiSpindleStatusAcknowledge               ]
+    ['0093' MultiSpindleStatusUnsubscribe               ]
+
+    ['0100' MultiSpindleResultSubscribe                 ]
+    ['0101' MultiSpindleResult                          ]
+    ['0102' MultiSpindleResultAcknowledge               ]
+    ['0103' MultiSpindleResultUnsubscribe               ]
+
+    ['0105' LastPowerMacsTighteningResultDataSubscribe  ]
+    ['0106' LastPowerMacsTighteningResultStationData    ]
+    ['0107' LastPowerMacsTighteningResultBoltData       ]
+    ['0108' LastPowerMacsTighteningResultDataAcknowledge]
+    ['0109' LastPowerMacsTighteningResultDataUnsubscribe]
+    ['0110' DisplayUserTextOnCompact                    ]
+    ['0111' DisplayUserTextOnGraph                      ]
+
+    ['0113' FlashGreenLightOnTool                       ]
+
+    ['0120' JobLineControlInfoSubscribe                 ]
+    ['0121' JobLineControlStarted                       ]
+    ['0122' JobLineControlAlert1                        ]
+    ['0123' JobLineControlAlert2                        ]
+    ['0124' JobLineControlDone                          ]
+    ['0125' JobLineControlInfoAcknowledge               ]
+    ['0126' JobLineControlUnsubscribe                   ]
+    ['0127' AbortJob                                    ]
+    ['0128' JobBatchIncrement                           ]
+    ['0129' JobBatchDecrement                           ]
+    ['0130' JobOff                                      ]
+    ['0131' SetJobLineControlStart                      ]
+    ['0132' SetJobLineControlAlert1                     ]
+    ['0133' SetJobLineControlAlert2                     ]
+
+    ['0140' ExecuteDynamicJobRequest                    ] // *
+
+    ['0150' IdentifierDownloadRequest                   ] // *
+    ['0151' MultipleIdentifiersWorkOrderSubscribe       ]
+    ['0152' MultipleIdentifiersWorkOrder                ]
+    ['0153' MultipleIdentifiersWorkOrderAcknowledge     ]
+    ['0154' MultipleIdentifiersWorkOrderUnsubscribe     ]
+    ['0155' BypassIdentifier                            ]
+    ['0156' ResetLatestIdentifier                       ]
+    ['0157' ResetAllIdentifiers                         ]
+
+    ['0200' SetExternalControlledRelays                 ]
+
+    ['0210' StatusExternalMonitoredInputsSubscribe      ]
+    ['0211' StatusExternalMonitoredInputs               ]
+    ['0212' StatusExternalMonitoredInputsAcknowledge    ]
+    ['0213' StatusExternalMonitoredInputsUnsubscribe    ]
+    ['0214' IoDeviceStatusRequest                       ]
+    ['0215' IoDeviceStatusReply                         ]
+    ['0216' RelayFunctionSubscribe                      ]
+    ['0217' RelayFunction                               ]
+    ['0218' RelayFunctionAcknowledge                    ]
+    ['0219' RelayFunctionUnsubscribe                    ]
+    ['0220' DigitalInputFunctionSubscribe               ]
+    ['0221' DigitalInputFunction                        ]
+    ['0222' DigitalInputFunctionAcknowledge             ]
+    ['0223' DigitalInputFunctionUnsubscribe             ]
+    ['0224' SetDigitalInputFunction                     ]
+    ['0225' ResetDigitalInputFunction                   ]
+
+    ['0240' UserDataDownload                            ]
+    ['0241' UserDataSubscribe                           ]
+    ['0242' UserData                                    ]
+    ['0243' UserDataAcknowledge                         ]
+    ['0244' UserDataUnsubscribe                         ]
+    ['0245' UserDataDownloadWithOffset                  ]
+
+    ['0250' SelectorSocketInfoSubscribe                 ]
+    ['0251' SelectorSocketInfo                          ]
+    ['0252' SelectorSocketInfoAcknowledge               ]
+    ['0253' SelectorSocketInfoUnsubscribe               ]
+    ['0254' SelectorControlGreenLights                  ]
+    ['0255' SelectorControlRedLights                    ]
+
+    ['0260' ToolTagIdRequest                            ]
+    ['0261' ToolTagIdSubscribe                          ]
+    ['0262' ToolTagId                                   ]
+    ['0263' ToolTagIdAcknowledge                        ]
+    ['0264' ToolTagIdUnsubscribe                        ]
+
+    ['0270' ControllerRebootRequest                     ]
+
+    ['0300' HistogramUploadRequest                      ]
+    ['0301' HistogramUploadReply                        ]
+
+    ['0400' AutomaticManualModeSubscribe                ]
+    ['0401' AutomaticManualMode                         ]
+    ['0402' AutomaticManualModeAcknowledge              ]
+    ['0403' AutomaticManualModeUnsubscribe              ]
+
+    ['0410' AutoDisableSettingsRequest                  ]
+    ['0411' AutoDisableSettingsReply                    ]
+
+    ['0420' OpenProtocolCommandsDisabledSubscribe       ]
+    ['0421' OpenProtocolCommandsDisabled                ]
+    ['0422' OpenProtocolCommandsDisabledAcknowledge     ]
+    ['0423' OpenProtocolCommandsDisabledUnsubscribe     ]
+
+    ['0500' MotorTuningResultDataSubscribe              ]
+    ['0501' MotorTuningResultData                       ]
+    ['0502' MotorTuningResultDataAcknowledge            ]
+    ['0503' MotorTuningResultDataUnsubscribe            ]
+    ['0504' MotorTuningRequest                          ]
+
+    ['0700' TighteningDataDownloadStatusForRadioTools   ]
+
+    ['0900' ResultTracesCurve                           ] // *
+    ['0901' ResultTracesCurvePlotData                   ] // *
+
+    ['1201' LastOperationResultOverallData              ]
+    ['1202' LastOperationResultObjectData               ]
+    ['1203' LastOperationResultDataAcknowledge          ]
+
+    ['2100' DeviceCommand                               ]
+
+    ['2500' ProgramDataDownload                         ]
+    ['2501' ProgramDataUploadReply                      ]
+    ['2502' PasswordRequest                             ]
+    ['2503' PasswordReply                               ] // PasswordResponse in the documentation
+    ['2504' ProgramPsetSelectionInDynamicJob            ]
+    ['2505' DynamicPsetSelection                        ]
+
+    ['2600' ModeIdUploadRequest                         ]
+    ['2601' ModeIdUploadReply                           ]
+    ['2602' ModeDataUploadRequest                       ]
+    ['2603' ModeDataUploadReply                         ]
+    ['2604' ModeSelected                                ]
+    ['2605' ModeSelectedAcknowledge                     ]
+    ['2606' SelectMode                                  ]
+
+    ['8000' AudiEmergencyStatusSubscribe                ]
+    ['8001' AudiEmergencyStatus                         ]
+    ['8002' AudiEmergencyStatusAcknowledge              ]
+    ['8003' AudiEmergencyStatusUnsubscribe              ]
+
+    ['9997' LinkLevelPositiveAcknowledge                ]
+    ['9998' LinkLevelNegativeAcknowledge                ]
+    ['9999' KeepAliveOpenProtocolCommunication          ] // *
+]
+
+[enum uint 16 Error encoding="AsciiUint"
+    ['00' NoError]
+    ['01' InvalidData]
+    ['02' ParameterSetIdNotPresent]
+    ['03' ParameterSetCanNotBeSet]
+    ['04' ParameterSetNotRunning]
+
+    ['06' VinUploadSubscriptionAlreadyExists]
+    ['07' VinUploadSubscriptionDoesNotExist]
+    ['08' VinInputSourceNotGranted]
+    ['09' LastTighteningResultSubscriptionAlreadyExists]
+    ['10' LastTighteningResultSubscriptionDoesNowExist]
+    ['11' AlarmSubscriptionAlreadyExists]
+    ['12' AlarmSubscriptionDoesNotExist]
+    ['13' ParameterSetSubscriptionAlreadyExists]
+    ['14' ParameterSetSubscriptionDoesNotExist]
+    ['15' TighteningIdRequestedNotFound]
+    ['16' ConnectionRejectedProtocolBusy]
+    ['17' JobIdNotPresent]
+    ['18' JobInfoSubscriptionAlreadyExists]
+    ['19' JobInfoSubscriptionDoesNotExist]
+    ['20' JobCanNotBeSet]
+    ['21' JobNotRunning]
+    ['22' NotPossibleToExecuteDynamicJobRequest]
+    ['23' JobBatchDecrementFailed]
+    ['24' NotPossibleToCreatePset]
+    ['25' ProgrammingControlNotGranted]
+    ['26' WrongToolTypeToPsetDownloadConnected]
+    ['27' ToolIsInaccessible]
+    ['28' JobAbortionIsInProgress]
+
+    ['30' ControllerIdNotASyncMasterOrStationController]
+    ['31' MultiSpindleStatusSubscriptionAlreadyExists]
+    ['32' MultiSpindleStatusSubscriptionDoesNotExist]
+    ['33' MultiSpindleResultSubscriptionAlreadyExists]
+    ['34' MultiSpindleResultSubscriptionDoesNotExist]
+    ['35' OtherMasterClientAlreadyConnected]
+
+    ['40' JobLineControlInfoSubscriptionAlreadyExists]
+    ['41' JobLineControlInfoSubscriptionDoesNotExist]
+    ['42' IdentifierInputSourceNotGranted]
+    ['43' MultipleIdentifiersWorkOrderSubscriptionAlreadyExists]
+    ['44' MultipleIdentifiersWorkOrderSubscriptionDoesNotExist]
+
+    ['50' StatusExternalMonitoredInputsSubscriptionAlreadyExists]
+    ['51' StatusExternalMonitoredInputsSubscriptionDoesNotExist]
+    ['52' IoDeviceNotConnected]
+    ['53' FaultyIoDeviceId]
+    ['54' ToolTagIdUnknown]
+    ['55' ToolTagIdSubscriptionAlreadyExists]
+    ['56' ToolTagIdSubscriptionDoesNotExist]
+    ['57' ToolMotorTuningFailed]
+    ['58' NoAlarmPresent]
+    ['59' ToolCurrentlyInUse]
+    ['60' NoHistogramAvailable]
+    ['61' PairingFailed]
+    ['62' PairingDenied]
+    ['63' PairingOrPairingAbortionAttemptOrWrongToolType]
+    ['64' PairingAbortionDenied]
+    ['65' PairingAbortionFailed]
+    ['66' PairingDisconnectionFailed]
+    ['67' PairingInProgressOrAlreadyDone]
+    ['68' PairingDeniedNoProgramControl]
+    ['69' UnsupportedExtraDataRevision]
+    ['70' CalibrationFailed]
+    ['71' SubscriptionAlreadyExists]
+    ['72' SubscriptionDoesNotExist]
+    ['73' SubscribedMidUnsupported]
+    ['74' SubscribedMidRevisionUnsupported]
+    ['75' RequestedMidUnsupported]
+    ['76' RequestedMidRevisionUnsupported]
+    ['77' RequestedOnSpecificDataNotSupported]
+    ['78' SubscriptionOnSpecificDataNotSupported]
+    ['79' CommandFailed]
+    ['80' AudiEmergencyStatusSubscriptionAlreadyExists] // AudiEmergencyStatusSubscriptionExists
+    ['81' AudiEmergencyStatusSubscriptionDoesNotExist]
+    ['82' AutomaticOrManualModeSubscriptionAlreadyExists] // AutomaticOrManualModeSubscribeAlreadyExists
+    ['83' AutomaticOrManualModeSubscriptionDoesNotExist] // AutomaticOrManualModeSubscribeDoesNotExist
+    ['84' TheRelayFunctionSubscriptionAlreadyExists]
+    ['85' TheRelayFunctionSubscriptionDoesNotExist]
+    ['86' TheSelectorSocketInfoSubscriptionAlreadyExists]
+    ['87' TheSelectorSocketInfoSubscriptionDoesNotExist]
+    ['88' TheDiginInfoSubscriptionAlreadyExists]
+    ['89' TheDiginInfoSubscriptionDoesNotExist]
+    ['90' LockAtBatchDoneSubscriptionAlreadyExists]
+    ['91' LockAtBatchDoneSubscriptionDoesNotExist]
+    ['92' OpenProtocolCommendsDisabled]
+    ['93' OpenProtocolCommendsDisabledSubscriptionAlreadyExists]
+    ['94' OpenProtocolCommendsDisabledSubscriptionDoesNotExist]
+    ['95' RejectRequestPowerMacsIsInManualMode]
+    ['96' RejectConnectionClientAlreadyConnected]
+    ['97' MidRevisionUnsupported]
+    ['98' ControllerInternalRequestTimeout]
+    ['99' UnknownMid]
+]
\ No newline at end of file


[plc4x] 01/02: feat(example/ads): Continued working on the ADS EtherCAT Browser

Posted by cd...@apache.org.
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

commit 11d6cdee490564f045b9f7b07d91e6d85bc935c5
Author: Christofer Dutz <ch...@c-ware.de>
AuthorDate: Mon Jan 23 20:46:20 2023 +0100

    feat(example/ads): Continued working on the ADS EtherCAT Browser
    
    - Needed minor fixes in the ADS driver
---
 .../plc4x/java/ads/protocol/AdsProtocolLogic.java  |  12 +-
 .../telemetry/HelloAdsEtherCatTelemetry.java       | 190 +++++++++++++++------
 .../spi/codegen/fields/FieldReaderOptional.java    |   2 +-
 .../java/spi/generation/ReadBufferByteBased.java   |  25 +--
 4 files changed, 161 insertions(+), 68 deletions(-)

diff --git a/plc4j/drivers/ads/src/main/java/org/apache/plc4x/java/ads/protocol/AdsProtocolLogic.java b/plc4j/drivers/ads/src/main/java/org/apache/plc4x/java/ads/protocol/AdsProtocolLogic.java
index bfd1dad176..8552ea126a 100644
--- a/plc4j/drivers/ads/src/main/java/org/apache/plc4x/java/ads/protocol/AdsProtocolLogic.java
+++ b/plc4j/drivers/ads/src/main/java/org/apache/plc4x/java/ads/protocol/AdsProtocolLogic.java
@@ -25,6 +25,7 @@ import org.apache.plc4x.java.ads.model.AdsSubscriptionHandle;
 import org.apache.plc4x.java.ads.readwrite.*;
 import org.apache.plc4x.java.ads.readwrite.DataItem;
 import org.apache.plc4x.java.ads.tag.AdsTag;
+import org.apache.plc4x.java.ads.tag.DirectAdsStringTag;
 import org.apache.plc4x.java.ads.tag.DirectAdsTag;
 import org.apache.plc4x.java.ads.tag.SymbolicAdsTag;
 import org.apache.plc4x.java.api.authentication.PlcUsernamePasswordAuthentication;
@@ -818,13 +819,16 @@ public class AdsProtocolLogic extends Plc4xProtocolBase<AmsTCPPacket> implements
             PlcValueType plcValueType = getPlcValueTypeForAdsDataType(adsDataTypeTableEntry);
 
             int strLen = 0;
-            if ((plcValueType == PlcValueType.STRING) || (plcValueType == PlcValueType.WSTRING)) {
-                // Extract the string length from the data type name.
-                strLen = Integer.parseInt(dataTypeName.substring(dataTypeName.indexOf("(") + 1, dataTypeName.indexOf(")")));
+            if (tag instanceof DirectAdsStringTag) {
+                strLen = ((DirectAdsStringTag) tag).getStringLength();
             }
             final int stringLength = strLen;
             if (tag.getNumberOfElements() == 1) {
-                return new ResponseItem<>(PlcResponseCode.OK, parsePlcValue(plcValueType, adsDataTypeTableEntry, stringLength, readBuffer));
+                ReadBufferByteBased readBufferByteBased = ((ReadBufferByteBased) readBuffer);
+                // Sometimes the ADS device just sends shorter strings than we asked for.
+                int remainingBytes = readBufferByteBased.getTotalBytes() - readBufferByteBased.getPos();
+                final int singleStringLength = Math.min(remainingBytes - 1, stringLength);
+                return new ResponseItem<>(PlcResponseCode.OK, parsePlcValue(plcValueType, adsDataTypeTableEntry, singleStringLength, readBuffer));
             } else {
                 // Fetch all
                 final PlcValue[] resultItems = IntStream.range(0, tag.getNumberOfElements()).mapToObj(i -> {
diff --git a/plc4j/examples/hello-ads-telemetry/src/main/java/org/apache/plc4x/java/examples/helloads/telemetry/HelloAdsEtherCatTelemetry.java b/plc4j/examples/hello-ads-telemetry/src/main/java/org/apache/plc4x/java/examples/helloads/telemetry/HelloAdsEtherCatTelemetry.java
index f828486d3f..e68de4c777 100644
--- a/plc4j/examples/hello-ads-telemetry/src/main/java/org/apache/plc4x/java/examples/helloads/telemetry/HelloAdsEtherCatTelemetry.java
+++ b/plc4j/examples/hello-ads-telemetry/src/main/java/org/apache/plc4x/java/examples/helloads/telemetry/HelloAdsEtherCatTelemetry.java
@@ -23,6 +23,7 @@ import org.apache.plc4x.java.api.PlcDriverManager;
 import org.apache.plc4x.java.api.messages.PlcReadResponse;
 import org.apache.plc4x.java.api.types.PlcResponseCode;
 import org.apache.plc4x.java.api.types.PlcValueType;
+import org.apache.plc4x.java.api.value.PlcValue;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -31,61 +32,96 @@ import java.util.Map;
 
 // Extracted from https://infosys.beckhoff.com/index.php?content=../content/1031/devicemanager/262982923.html
 
-enum EtherCatConstants {
+enum EtherCatConstant {
     DeviceType(0x10000000, PlcValueType.UDINT),
     ManufacturerDeviceName(0x10080000, PlcValueType.STRING),
-    //HardwareVersion(0x10090000, PlcValueType.),
-    //SoftwareVersion(0x100A0000, PlcValueType.),
-    //IdentityObjectNum(0x10180000, PlcValueType.),
-    IdentityObjectVendorId(0x10180000, PlcValueType.UDINT),
-    IdentityObjectProductCode(0x10180000, PlcValueType.UDINT),
-    IdentityObjectRevisionNumber(0x10180000, PlcValueType.UDINT),
-    IdentityObjectSoftwareVersion(0x10180000, PlcValueType.UDINT),
-    //ConfigurationDataNum(0x80000000, PlcValueType.), // 0x8xxx0000 xxx = device index (starting with 0)
+    HardwareVersion(0x10090000, PlcValueType.UINT),
+    SoftwareVersion(0x100A0000, PlcValueType.STRING),
+    IdentityObjectNum(0x10180000, PlcValueType.USINT),
+    IdentityObjectVendorId(0x10180001, PlcValueType.UDINT),
+    IdentityObjectProductCode(0x10180002, PlcValueType.UDINT),
+    IdentityObjectRevisionNumber(0x10180003, PlcValueType.UDINT),
+    IdentityObjectSerialNumber(0x10180004, PlcValueType.UDINT),
+    ConfigurationDataNum(0x80000000, PlcValueType.USINT), // 0x8xxx0000 xxx = device index (starting with 0)
     ConfigurationDataAddress(0x80000001, PlcValueType.UINT),
-    ConfigurationDataType(0x8000000, PlcValueType.STRING), // Not sure ...
-    ConfigurationDataName(0x8000000, PlcValueType.STRING),
-    ConfigurationDataDeviceType(0x8000000, PlcValueType.UDINT),
-    ConfigurationDataVendorId(0x8000000, PlcValueType.UDINT),
-    ConfigurationDataProductCode(0x8000000, PlcValueType.UDINT),
-    ConfigurationDataRevisionNumber(0x8000000, PlcValueType.UDINT),
-    ConfigurationDataSerialNumber(0x8000000, PlcValueType.UDINT),
-    ConfigurationDataMailboxOutSize(0x8000000, PlcValueType.UINT),
-    ConfigurationDataMailboxInSize(0x8000000, PlcValueType.UINT),
-    ConfigurationDataLinkStatus(0x8000000, PlcValueType.USINT),
-    ConfigurationDataLinkPreset(0x8000000, PlcValueType.USINT),
-    ConfigurationDataFlags(0x8000000, PlcValueType.UINT),
-//    StateMachine(0xA0000000, PlcValueType.),      // 0xAxxx0000 xxx = device index (starting with 0)
-//    ScanSlaves(0xF002000, PlcValueType.),
-    ConfiguredSlavesNum(0xF0200000, PlcValueType.USINT);
-//    FrameStatistics(0xF1200000, PlcValueType.);
-
-    final int typeNumber;
+    ConfigurationDataType(0x80000002, PlcValueType.STRING), // Not sure ...
+    ConfigurationDataName(0x80000003, PlcValueType.STRING),
+    ConfigurationDataDeviceType(0x80000004, PlcValueType.UDINT),
+    ConfigurationDataVendorId(0x80000005, PlcValueType.UDINT),
+    ConfigurationDataProductCode(0x80000006, PlcValueType.UDINT),
+    ConfigurationDataRevisionNumber(0x80000007, PlcValueType.UDINT),
+    ConfigurationDataSerialNumber(0x80000008, PlcValueType.UDINT),
+    ConfigurationDataMailboxOutSize(0x80000021, PlcValueType.UINT),
+    ConfigurationDataMailboxInSize(0x80000022, PlcValueType.UINT),
+    ConfigurationDataLinkStatus(0x80000023, PlcValueType.USINT),
+    ConfigurationDataLinkPreset(0x80000024, PlcValueType.USINT),
+    ConfigurationDataFlags(0x80000025, PlcValueType.UINT),
+    StateMachineNum(0xA0000000, PlcValueType.USINT),      // 0xAxxx0000 xxx = device index (starting with 0)
+    StateMachineAlStatus(0xA0000001, PlcValueType.UINT),
+    StateMachineAlControl(0xA0000002, PlcValueType.UINT),
+    StateMachineLastAlStatusCode(0xA0000003, PlcValueType.UINT),
+    StateMachineLinkConnectionStatus(0xA0000004, PlcValueType.USINT),
+    StateMachineLinkControl(0xA0000005, PlcValueType.USINT),
+    StateMachineFixedAddressPort0(0xA0000006, PlcValueType.UINT),
+    StateMachineFixedAddressPort1(0xA0000007, PlcValueType.UINT),
+    StateMachineFixedAddressPort2(0xA0000008, PlcValueType.UINT),
+    StateMachineFixedAddressPort3(0xA0000009, PlcValueType.UINT),
+    StateMachineCrcErrorCountPort0(0xA000000A, PlcValueType.UDINT),
+    StateMachineCrcErrorCountPort1(0xA000000B, PlcValueType.UDINT),
+    StateMachineCrcErrorCountPort2(0xA000000C, PlcValueType.UDINT),
+    StateMachineCrcErrorCountPort3(0xA000000D, PlcValueType.UDINT),
+    StateMachineCyclicWcErrorCount(0xA000000E, PlcValueType.UDINT),
+    StateMachineSlaveNotPresentCount(0xA000000F, PlcValueType.UDINT),
+    StateMachineAbnormalStateChangeCount(0xA0000010, PlcValueType.UDINT),
+    //StateMachineDisableAutomaticLinkControl(0xA0000011, PlcValueType.BOOL),
+    //ScanSlavesNum(0xF002000, PlcValueType.),
+    //ScanSlavesScanCommand(0xF002001, PlcValueType.),
+    ScanSlavesScanStatus(0xF002002, PlcValueType.USINT),
+    //ScanSlavesScanReply(0xF002003, PlcValueType.),
+    ConfiguredSlavesNum(0xF0200000, PlcValueType.USINT), // Get the EtherCAT address by looping through the modules
+//    FrameStatisticsNum(0xF1200000, PlcValueType.);
+    FrameStatisticsCyclicLostFramesCount(0xF1200001, PlcValueType.UDINT),
+    FrameStatisticsAcyclicLostFramesCount(0xF1200002, PlcValueType.UDINT);
+    //DiagnosticNum(0xF2000000, PlcValueType.),
+    //DiagnosticResetDiagnosticCounters(0xF2000001, PlcValueType.);
+
+    private static final Map<Integer, EtherCatConstant> map;
+    static {
+        map = new HashMap<>();
+        for (EtherCatConstant value : EtherCatConstant.values()) {
+            map.put(value.offset, value);
+        }
+    }
+
+    final int offset;
     final PlcValueType plcValueType;
-    EtherCatConstants(int typeNumber, PlcValueType plcValueType) {
-        this.typeNumber = typeNumber;
+    EtherCatConstant(int offset, PlcValueType plcValueType) {
+        this.offset = offset;
         this.plcValueType = plcValueType;
     }
+
+    public static EtherCatConstant enumForValue(int offset) {
+        return map.get(offset);
+    }
+
 }
 public class HelloAdsEtherCatTelemetry {
 
     private static final Logger logger = LoggerFactory.getLogger(HelloAdsTelemetry.class);
-    public static void main(String[] args) {
-        if(args.length != 2) {
-            logger.error("Usage: HelloAdsTelemetry {ip-address of PLC} {local ip-address}");
-            System.exit(1);
-        }
 
-        String remoteIp = args[0];
-        String localIp = args[1];
+    private static final int AoEGroupIndex = 0x0000F302;
+
+    protected void outputEtherCatData(String localIp, String remoteIp, String remoteAmdNetId) {
         // The AmsNetId of the PLC usually is {ip}.1.1 and that of the EtherCAT master is {ip}.3.1
         // The port number equals the EtherCAT address. For the EtherCAT master, this port is 0xFFFF = 65535
         try (PlcConnection connection = PlcDriverManager.getDefault().getConnectionManager().getConnection(String.format("ads:tcp://%s?targetAmsNetId=%s.3.1&targetAmsPort=65535&sourceAmsNetId=%s.1.1&sourceAmsPort=65534&load-symbol-and-data-type-tables=false", remoteIp, remoteIp, localIp))) {
-            int vendorId = connection.readRequestBuilder().addTagAddress("vendorId", "0x0000F302/0x10180001:UDINT").build().execute().get().getInteger("vendorId");
-            int productCode = connection.readRequestBuilder().addTagAddress("productCode", "0x0000F302/0x10180002:UDINT").build().execute().get().getInteger("productCode");
-            int revisionNumber = connection.readRequestBuilder().addTagAddress("revisionNumber", "0x0000F302/0x10180003:UDINT").build().execute().get().getInteger("revisionNumber");
-            int serialNumber = connection.readRequestBuilder().addTagAddress("serialNumber", "0x0000F302/0x10180004:UDINT").build().execute().get().getInteger("serialNumber");
-            logger.info("EtherCAT Master: Vendor Id: {}, Product Code: {}, Revision Number: {}, Serial Number {}", vendorId, productCode, revisionNumber, serialNumber);
+            String manufacturerDeviceName = connection.readRequestBuilder().addTagAddress("manufacturerDeviceName", getAddress(EtherCatConstant.ManufacturerDeviceName)).build().execute().get().getString("manufacturerDeviceName");
+            int hardwareVersion = connection.readRequestBuilder().addTagAddress("hardwareVersion", getAddress(EtherCatConstant.HardwareVersion)).build().execute().get().getInteger("hardwareVersion");
+            String softwareVersion = connection.readRequestBuilder().addTagAddress("softwareVersion", getAddress(EtherCatConstant.SoftwareVersion)).build().execute().get().getString("softwareVersion");
+            logger.info("Found Device: {} Hardware Version {}, Software Version {}", manufacturerDeviceName, hardwareVersion, softwareVersion);
+
+            logger.info("Identity Object:");
+            outputEtherCatSection(connection, EtherCatConstant.IdentityObjectNum.offset, EtherCatConstant.IdentityObjectNum.offset);
 
             // Load the number of EtherCAT slaves:
             int numSlaves = connection.readRequestBuilder().addTagAddress("numberOfSlaves", "0x0000F302/0xF0200000:USINT").build().execute().get().getInteger("numberOfSlaves");
@@ -93,21 +129,73 @@ public class HelloAdsEtherCatTelemetry {
             // Load the number of slaves and their etherCatAddresses
             // NOTE: We need to do this without using multi-item-requests as it seems that this part of the system doesn't support this.
             Map<Integer, Integer> etherCatAddresses = new HashMap<>();
-            for(int i = 1; i < numSlaves; i++) {
-                String name = "slave-" + i;
-                String address = String.format("0x0000F302/0xF020%04X:UINT", i);
-                PlcReadResponse plcReadResponse = connection.readRequestBuilder().addTagAddress(name, address).build().execute().get();
-                if (plcReadResponse.getResponseCode(name) == PlcResponseCode.OK) {
-                    int etherCatAddress = plcReadResponse.getInteger(name);
-                    logger.info("Slave {} has EtherCAT address {}", i, etherCatAddress);
-                    etherCatAddresses.put(i, etherCatAddress);
+            for(int i = 0; i < numSlaves; i++) {
+                logger.info("Slave {}", i);
+                int etherCatAddressOffset = EtherCatConstant.ConfiguredSlavesNum.offset | (i + 1);
+                int configDataOffset = EtherCatConstant.ConfigurationDataNum.offset | (i << 16);
+                int stateMachineOffset = EtherCatConstant.StateMachineNum.offset | (i << 16);
 
-                }
+                String etherCatAddressAddress = String.format("0x%08X/0x%08X:%s", AoEGroupIndex, etherCatAddressOffset, PlcValueType.UINT.name());
+                int etherCatAddress = connection.readRequestBuilder().addTagAddress("etherCatAddress", etherCatAddressAddress).build().execute().get().getInteger("etherCatAddress");
+                logger.info(" - EtherCat Address: {}", etherCatAddress);
+
+                logger.info(" - Configuration Data:");
+                outputEtherCatSection(connection, configDataOffset, EtherCatConstant.ConfigurationDataNum.offset);
+                logger.info(" - State Machine Data");
+                outputEtherCatSection(connection, stateMachineOffset, EtherCatConstant.StateMachineNum.offset);
             }
 
         } catch (Exception e) {
             throw new RuntimeException(e);
         }
+    } 
+    
+    protected void outputEtherCatSection(PlcConnection connection, int baseOffset, int baseTypeOffset) throws Exception {
+        String sectionNumAddress = String.format("0x%08X/0x%08X:%s", AoEGroupIndex, baseOffset, PlcValueType.USINT.name());
+        int identityObjectNum = connection.readRequestBuilder().addTagAddress("num", sectionNumAddress).build().execute().get().getInteger("num");
+        for (int i = 1; i < identityObjectNum; i++) {
+            int offset = baseOffset | i;
+            int typeOffset = baseTypeOffset | i;
+            EtherCatConstant etherCatConstantAddress = EtherCatConstant.enumForValue(typeOffset);
+            PlcValueType etherCatConstantType = (etherCatConstantAddress != null) ? etherCatConstantAddress.plcValueType : PlcValueType.USINT;
+            String address = String.format("0x%08X/0x%08X:%s", AoEGroupIndex, offset, etherCatConstantType.name());
+            if(etherCatConstantType == PlcValueType.STRING) {
+                address += "(255)";
+            }
+            try {
+                PlcReadResponse readResponse = connection.readRequestBuilder().addTagAddress("value", address).build().execute().get();
+                if (readResponse.getResponseCode("value") == PlcResponseCode.OK) {
+                    PlcValue value = readResponse.getPlcValue("value");
+                    if (etherCatConstantAddress != null) {
+                        logger.info("    - {}: {}", etherCatConstantAddress.name(), value.toString());
+                    } else {
+                        logger.info("    - Unknown: {}", value.toString());
+                    }
+                }
+            } catch (Exception e) {
+                // Ignore this ...
+            }
+        }
+    }
+    
+    
+    protected String getAddress(EtherCatConstant variable) {
+        String dataTypeName = variable.plcValueType.name();
+        if (variable.plcValueType == PlcValueType.STRING) {
+            dataTypeName += "(255)";
+        }
+        return String.format("0x%08X/0x%08X:%s", AoEGroupIndex, variable.offset, dataTypeName);
     }
 
-}
+    public static void main(String[] args) {
+        if(args.length != 2) {
+            logger.error("Usage: HelloAdsTelemetry {ip-address of PLC} {local ip-address}");
+            System.exit(1);
+        }
+
+        String remoteIp = args[0];
+        String localIp = args[1];
+        new HelloAdsEtherCatTelemetry().outputEtherCatData(localIp, remoteIp, remoteIp + ".3.1");
+    }
+    
+}
\ No newline at end of file
diff --git a/plc4j/spi/src/main/java/org/apache/plc4x/java/spi/codegen/fields/FieldReaderOptional.java b/plc4j/spi/src/main/java/org/apache/plc4x/java/spi/codegen/fields/FieldReaderOptional.java
index aaec0411cf..ebecac935f 100644
--- a/plc4j/spi/src/main/java/org/apache/plc4x/java/spi/codegen/fields/FieldReaderOptional.java
+++ b/plc4j/spi/src/main/java/org/apache/plc4x/java/spi/codegen/fields/FieldReaderOptional.java
@@ -46,7 +46,7 @@ public class FieldReaderOptional<T> implements FieldCommons {
             LOGGER.debug("Assertion doesn't match for field {}. Resetting read position to {}", logicalName, curPos, e);
             dataReader.setPos(curPos);
             return null;
-        } catch (ArrayIndexOutOfBoundsException e) {
+        } catch (ParseException e) {
             LOGGER.debug("Not enough bytes for {}. Resetting read position to {}", logicalName, curPos, e);
             dataReader.setPos(curPos);
             return null;
diff --git a/plc4j/spi/src/main/java/org/apache/plc4x/java/spi/generation/ReadBufferByteBased.java b/plc4j/spi/src/main/java/org/apache/plc4x/java/spi/generation/ReadBufferByteBased.java
index a98e284d6b..9c41c481c6 100644
--- a/plc4j/spi/src/main/java/org/apache/plc4x/java/spi/generation/ReadBufferByteBased.java
+++ b/plc4j/spi/src/main/java/org/apache/plc4x/java/spi/generation/ReadBufferByteBased.java
@@ -18,6 +18,7 @@
  */
 package org.apache.plc4x.java.spi.generation;
 
+import ch.qos.logback.core.encoder.EchoEncoder;
 import com.github.jinahya.bit.io.ArrayByteInput;
 import org.apache.plc4x.java.api.exceptions.PlcRuntimeException;
 import org.apache.plc4x.java.spi.generation.io.MyDefaultBitInput;
@@ -92,7 +93,7 @@ public class ReadBufferByteBased implements ReadBuffer {
             bi.getDelegate().index(oldIndex + offset);
             // Read the byte.
             return bi.readByte(false, 8);
-        } catch (IOException e) {
+        } catch (Exception e) {
             throw new ParseException("Error peeking byte", e);
         } finally {
             // Reset the delegate to the old index.
@@ -109,7 +110,7 @@ public class ReadBufferByteBased implements ReadBuffer {
     public boolean readBit(String logicalName, WithReaderArgs... readerArgs) throws ParseException {
         try {
             return bi.readBoolean();
-        } catch (IOException e) {
+        } catch (Exception e) {
             throw new ParseException("Error reading bit", e);
         }
     }
@@ -138,7 +139,7 @@ public class ReadBufferByteBased implements ReadBuffer {
         }
         try {
             return bi.readByte(true, bitLength);
-        } catch (IOException e) {
+        } catch (Exception e) {
             throw new ParseException("Error reading unsigned byte", e);
         }
     }
@@ -154,7 +155,7 @@ public class ReadBufferByteBased implements ReadBuffer {
         try {
             // No need to flip here as we're only reading one byte.
             return bi.readShort(true, bitLength);
-        } catch (IOException e) {
+        } catch (Exception e) {
             throw new ParseException("Error reading unsigned short", e);
         }
     }
@@ -173,7 +174,7 @@ public class ReadBufferByteBased implements ReadBuffer {
                 return Integer.reverseBytes(intValue) >>> 16;
             }
             return bi.readInt(true, bitLength);
-        } catch (IOException e) {
+        } catch (Exception e) {
             throw new ParseException("Error reading unsigned int", e);
         }
     }
@@ -192,7 +193,7 @@ public class ReadBufferByteBased implements ReadBuffer {
                 return Long.reverseBytes(longValue) >>> 32;
             }
             return bi.readLong(true, bitLength);
-        } catch (IOException e) {
+        } catch (Exception e) {
             throw new ParseException("Error reading unsigned long", e);
         }
     }
@@ -218,7 +219,7 @@ public class ReadBufferByteBased implements ReadBuffer {
                 BigInteger constant = BigInteger.valueOf(Long.MAX_VALUE).multiply(BigInteger.valueOf(2)).add(BigInteger.valueOf(2));
                 return BigInteger.valueOf(val).add(constant);
             }
-        } catch (IOException e) {
+        } catch (Exception e) {
             throw new ParseException("Error reading unsigned big integer", e);
         }
     }
@@ -233,7 +234,7 @@ public class ReadBufferByteBased implements ReadBuffer {
         }
         try {
             return bi.readByte(false, bitLength);
-        } catch (IOException e) {
+        } catch (Exception e) {
             throw new ParseException("Error reading signed byte", e);
         }
     }
@@ -251,7 +252,7 @@ public class ReadBufferByteBased implements ReadBuffer {
                 return Short.reverseBytes(bi.readShort(false, bitLength));
             }
             return bi.readShort(false, bitLength);
-        } catch (IOException e) {
+        } catch (Exception e) {
             throw new ParseException("Error reading signed short", e);
         }
     }
@@ -269,7 +270,7 @@ public class ReadBufferByteBased implements ReadBuffer {
                 return Integer.reverseBytes(bi.readInt(false, bitLength));
             }
             return bi.readInt(false, bitLength);
-        } catch (IOException e) {
+        } catch (Exception e) {
             throw new ParseException("Error reading signed int", e);
         }
     }
@@ -287,7 +288,7 @@ public class ReadBufferByteBased implements ReadBuffer {
                 return Long.reverseBytes(bi.readLong(false, bitLength));
             }
             return bi.readLong(false, bitLength);
-        } catch (IOException e) {
+        } catch (Exception e) {
             throw new ParseException("Error reading signed long", e);
         }
     }
@@ -307,7 +308,7 @@ public class ReadBufferByteBased implements ReadBuffer {
             } else {
                 throw new UnsupportedOperationException("unsupported bit length (only 16 and 32 supported)");
             }
-        } catch (IOException e) {
+        } catch (Exception e) {
             throw new ParseException("Error reading float", e);
         }
     }