-
Notifications
You must be signed in to change notification settings - Fork 3
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
Version 1.15.14 (dev/alha) #94
Conversation
510b4fa
to
863996b
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
did not get to do a full review of code
src/main/java/com/hms_networks/americas/sc/extensions/util/StreamUtils.java
Show resolved
Hide resolved
src/main/java/com/hms_networks/americas/sc/extensions/util/StreamUtils.java
Show resolved
Hide resolved
src/main/java/com/hms_networks/americas/sc/extensions/util/StreamUtils.java
Show resolved
Hide resolved
src/main/java/com/hms_networks/americas/sc/extensions/util/StreamUtils.java
Outdated
Show resolved
Hide resolved
src/main/java/com/hms_networks/americas/sc/extensions/datapoint/DataQuality.java
Show resolved
Hide resolved
src/main/java/com/hms_networks/americas/sc/extensions/datapoint/DataPointNumber.java
Show resolved
Hide resolved
src/main/java/com/hms_networks/americas/sc/extensions/datapoint/DataPointNumber.java
Show resolved
Hide resolved
src/main/java/com/hms_networks/americas/sc/extensions/datapoint/DataPointNumber.java
Outdated
Show resolved
Hide resolved
Added a stream utility class in the `util` package which assists with parsing/processing a specified InputStream to byte array or String.
ab8f1f1
to
a047fa3
Compare
int majorQuality = (opcuaQuality >> 6) & 0x03; | ||
switch (majorQuality) { | ||
case 3: | ||
return DataQuality.GOOD; | ||
case 0: | ||
return DataQuality.BAD; | ||
case 1: | ||
default: | ||
return DataQuality.UNCERTAIN; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
int majorQuality = (opcuaQuality >> 6) & 0x03; | |
switch (majorQuality) { | |
case 3: | |
return DataQuality.GOOD; | |
case 0: | |
return DataQuality.BAD; | |
case 1: | |
default: | |
return DataQuality.UNCERTAIN; | |
} | |
final int qualityMask = 0x03; | |
final int qualityPos = 6; | |
final int qualityGood = 3; | |
final int qualityBad = 0; | |
final int qualityUncertain = 1; | |
int majorQuality = (opcuaQuality >> qualityPos) & qualityMask; | |
switch (majorQuality) { | |
case qualityGood: | |
return DataQuality.GOOD; | |
case qualityBad: | |
return DataQuality.BAD; | |
case qualityUncertain: | |
default: | |
return DataQuality.UNCERTAIN; | |
} |
The constants dont have to live in the method here but i think they add value to explain what is going on even though the comments document the values.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
does 2 mean anything?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The constants dont have to live in the method here but i think they add value to explain what is going on even though the comments document the values.
Made changes. I used existing constants for the 0/1/3 values and added in-method constants for 6 and 0x03.
Personally, though, I feel that these constants are not necessary here and ultimately make the code more difficult to follow because they introduce the need to jump around the code. The method Javadoc already thoroughly explains the intent and function of the method and identifies which bits correspond to each component of the quality value.
transformations) | ||
- Added clone method to each DataPoint class to allow for deep copying of data points (useful for | ||
creating derived tag data points from their parent data point) | ||
- Added DataType#NUMBER to support DataPointNumber class type |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is there supposed to be a space after DataType?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No - DataType#NUMBER
is reference to the NUMBER field in the DataType class.
Updated DataQuality.java to include versioning, which allows for better identification for portions of the class which are new or already existed. Support for getting the String equivalent of the data quality value has also been added. Lastly, a method was added to allow for retrieving the corresponding quality object from a specified OPCUA quality value.
Added the overrideTagUnit(String tagUnit) method to the DataPoint class. This allows for overriding the tag unit specified by the Ewon tag configuration. It is particularly useful in scenarios where the tag value is also being transformed or changed.
Added the abstract #clone(String tagName) method to the DataPoint classes. This allows for cloning data points to a different tag name, which is useful when a new tag (and value) is being derived from the original.
Added the enum-like value of NUMBER which is used by the new DataPointNumber class to identify its type.
Added the DataPointNumber class which provides a generic DataPoint implementation for all number types, including long (dword), float, integer, etc. This class is intended to supplement existing functionality and provide a more flexible interface for working with numerical values. In the future, it could be expanded to be the superclass of current numeric DataPoint classes.
Updated the Javadoc of the DataPoint#valueEquals method so that it identifies that true is only returned when the data point type is also the same.
No description provided.