Skip to content

Conversation

@jembishop
Copy link
Member

Hi there, in the process of doing another pull request I found that it would be a good idea to refactor the Utilities.toRawValue method in the save-and-restore ui code into the shared vtype library. This is because converting a VType to a native java object was useful in my usecase and sounds like a generally useful thing to want to do.

I also thought it would be best to take the associated VDisconnectedData type into the vtype library as well, given it shows up in the Utilities.toRawValue tests.

Another minor change when making the modifications to the tests was to use wildcard import for the V types as they now pretty much import all the classes into the file.

Copy link
Collaborator

@georgweiss georgweiss left a comment

Choose a reason for hiding this comment

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

Agree, enum array should be converted to list of ints.

@jembishop
Copy link
Member Author

jembishop commented Jan 24, 2024

Enum array is now list of ints. Think I might have broken a test in the process, which I will fix.

@jembishop
Copy link
Member Author

@kasemir I think this is ready to merge now. The returned datatype for the enumarray is now int [].

@kasemir
Copy link
Collaborator

kasemir commented Jan 25, 2024

The VDisconnectedData should carry a disconnected alarm state to be compatible with the current expected behavior, see

public static boolean isDisconnected(final VType value)
{
if (value == null)
return true;
// VTable does not implement alarm,
// but receiving a table means we're not disconnected
if (value instanceof VTable)
return false;
final Alarm alarm = Alarm.alarmOf(value);
return Alarm.disconnected().equals(alarm);
}

Copy link
Collaborator

@kasemir kasemir left a comment

Choose a reason for hiding this comment

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

Looks good, thanks!

@shroffk shroffk merged commit e895960 into ControlSystemStudio:master Jan 25, 2024
@jembishop jembishop deleted the refactor-vtypehelper branch January 25, 2024 15:41
@georgweiss
Copy link
Collaborator

@jembishop, I'm afraid this PR was approved a bit too quickly. I suspect your development branch was not quite up-to-date, and I did not notice.
Thing is code to handle VTable PVs in save&restore evaporated in the merge. Can you please check this?

@jembishop
Copy link
Member Author

@georgweiss I didn't realize that sorry. I will raise another PR to fix this.

@jembishop
Copy link
Member Author

@georgweiss This is fixed here #2937

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants