Skip to content
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

Merged
merged 8 commits into from
May 15, 2024
Merged

Version 1.15.14 (dev/alha) #94

merged 8 commits into from
May 15, 2024

Conversation

alexjhawk
Copy link
Collaborator

No description provided.

@alexjhawk alexjhawk added the enhancement New feature or request label May 13, 2024
@alexjhawk alexjhawk self-assigned this May 13, 2024
@alexjhawk alexjhawk force-pushed the dev/alha branch 2 times, most recently from 510b4fa to 863996b Compare May 13, 2024 17:21
@alexjhawk alexjhawk requested review from TomKimsey and it-hms May 13, 2024 17:22
@alexjhawk alexjhawk marked this pull request as ready for review May 13, 2024 17:22
Copy link
Contributor

@it-hms it-hms left a 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

Added a stream utility class in the `util` package
which assists with parsing/processing a specified
InputStream to byte array or String.
@alexjhawk alexjhawk force-pushed the dev/alha branch 2 times, most recently from ab8f1f1 to a047fa3 Compare May 14, 2024 13:12
@alexjhawk alexjhawk requested a review from it-hms May 14, 2024 13:12
it-hms
it-hms previously approved these changes May 14, 2024
Comment on lines 128 to 139
int majorQuality = (opcuaQuality >> 6) & 0x03;
switch (majorQuality) {
case 3:
return DataQuality.GOOD;
case 0:
return DataQuality.BAD;
case 1:
default:
return DataQuality.UNCERTAIN;
}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
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.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

does 2 mean anything?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

does 2 mean anything?

No
image

Copy link
Collaborator Author

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
Copy link
Collaborator

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?

Copy link
Collaborator Author

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.

alexjhawk added 7 commits May 15, 2024 10:44
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.
@alexjhawk alexjhawk merged commit c0f8c78 into main May 15, 2024
5 checks passed
@alexjhawk alexjhawk deleted the dev/alha branch May 15, 2024 17:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants