-
Notifications
You must be signed in to change notification settings - Fork 13
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support for Enums, OptStructs and Unions (+ bugfixes) #167
Open
dirk-zimoch
wants to merge
13
commits into
epics-modules:master
Choose a base branch
from
dirk-zimoch:dirks_new_stuff
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Value would appear frozen when installing monitoredItem failed for example because the server has reached the limit of monitored items or if an item cannot be monitored because it used invalid filters like a deadband filter on a string. show connectionLoss/COMM_ALARM when monitoredItem setup failed Value would simply appear frozen otherwise. Needed to revert order of initial read and montior setup so that errors in monitor setup are not cleared by successful initial read.
When updating records from the driver, disable FLNK unless SCAN="I/O Intr". Otherwise if the (output) record is a structure element and the FLNK causes the parent opcuaItem record to process, an inifnite processing loop is created. Also, the user probably only expects the FLNK to process when actively writing to the output record, not when updating it from the server.
Commit 56cb080 "fix connection state handling" had a bug: For UaSDK, the item was not setting the state for is own itemRecord.
outgoingData may still contain old yet unsent data that needs to be discarded to avoid a memory leak
Read enum type info with strings at connect Identify enum types during intial read and assign string maps Update enum strings in mbbi/mbbo records at intial read Convert enums to and from strings for string records and char waveforms
…tten If writing to an optstruct or union, processing the records for all elements, not only the one that has been written to, with a writeComplete callback would clear errors for non-existing options and not selected choices. This clears the INVALID alarm for those elements. This becomes visible only if the value did not change and thus the optsruct or union did not send back a monitor update.
dirk-zimoch
force-pushed
the
dirks_new_stuff
branch
from
October 24, 2024 09:04
bf941fb
to
b4d2cdb
Compare
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
All the following features have been implemented for both, the UaSdk and the open62541 implementation.
There are no tests for the new features.
Enum
During initialRead, the data type is read from the server. (This mechanism can also be used later to support write-only Nodes where initialRead currently fails.) If it is an enum type, then the string map is stored. mbbi and mbbo records that have no *ST and *VL fields set by the user get updated with this string map during intialRead processing and post a DBE_PROPERTY event to inform CA clients of the change.
String and CHAR array records connected to an enum translate the received Int32 value to the corresponding choice string. Writing to a string output record converts the string to the corresponding Int32 value to be sent to the server. The string is first matched against each enum string and then, if no match was found, the string is converted to an integer and matched against each enum value. If both fails, writing to the record fails with INVALID/WRITE alarm, just as any other out-of-range write attempt.
OptStruct
Records connected to an absent optional element of an OptStruct opcuaItem record are set to INVALID/READ alarm to show that no data is available for this element. Writing to such an absent element creates it and adds it to the optStruct before sending it to the server. There is currently no way to remove an existing optional element via EPICS.
Union
Records connected to not selected choices of a Union opcuaItem record are set to INVALID/READ alarm just like absent OptStruct elements. Writing to either element sets the selected type of the Union to whichever element has been written last and makes the other elements INVALID.
String records connected to a Union NodeId are set to a string consisting of the selected element name, a colon, and the selected choice value converted to a string. Writing a similarly formatted string to a string output record can change the selected choice of the Union if the element name changes. Writing an empty string selects "None" in the Union.
Writing a string fails if it does not start with a valid element name and a colon or when the value part cannot be converted to the type of the selected choice.
String records connected to Unions with Enum elements are not yet supported (due to missing test cases) and will handle the enum as an integer.
The string conversion is mainly meant for easy debugging.
Bugfixes
Some of these have already been part of other pull requests but have not yet been merged.