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

Cannot construct RSCPData with data type NONE #1

Closed
bvotteler opened this issue Jan 17, 2021 · 1 comment
Closed

Cannot construct RSCPData with data type NONE #1

bvotteler opened this issue Jan 17, 2021 · 1 comment
Assignees
Labels
bug Something isn't working

Comments

@bvotteler
Copy link
Owner

Validation fails when attempting to build a RSCPData instance with data type of RSCPDataType.NONE via

RSCPData.builder().tag(RSCPTag.TAG_EMS_REQ_POWER_PV).valueOfType(RSCPDataType.NONE, new byte[0]).build();

Expected: Can build an instance.
Actual: It throws an IllegalStateException with the message: Data must not be empty.

@bvotteler bvotteler self-assigned this Jan 17, 2021
@bvotteler bvotteler added the bug Something isn't working label Jan 17, 2021
@bvotteler
Copy link
Owner Author

Fixed with version 1.0.1

Also added a helper method in the builder called noneValue() to add an empty byte array with data type NONE.

For example, the following two ways of constructing a RSCPData instance holding NONE are equivalent:

RSCPData.builder().tag(RSCPTag.TAG_EMS_REQ_POWER_PV).valueOfType(RSCPDataType.NONE, new byte[0]).build();
// same as
RSCPData.builder().tag(RSCPTag.TAG_EMS_REQ_POWER_PV).noneValue().build();

Thank you to bjoernbrings for pointing this out!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant