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

Add "get_multiple_channel_values" and "set_multiple_channel_values" methods #83

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 39 additions & 0 deletions src/niveristand/clientapi/_workspace2.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,26 @@ def get_single_channel_value(self, name):
)
return value

def get_multiple_channel_values(self, names):
"""
Gets the values of multiple scalar channels running on the target. To get the values of vector channels, use
the GetChannelVectorValues method.

Args:
names (List[str]): The names of the channels. You must enter the full path to each channel as specified in
the system definition file.

Returns:
values (List[float]): The values of the specified channels.
"""
err, values = self._dot_net_instance.GetMultipleChannelValues(names, [])
err = _Error(err)
if err.is_error:
raise errors.VeristandError(
_errormessages.csharp_call_failed % (err.error_code, err.resolved_error_message)
)
return list(values)

def set_channel_vector_values(self, channel, new_values):
"""
Sets the vector values of a channel on the target.
Expand Down Expand Up @@ -124,3 +144,22 @@ def set_single_channel_value(self, name, new_val):
raise errors.VeristandError(
_errormessages.csharp_call_failed % (err.error_code, err.resolved_error_message)
)

def set_multiple_channel_values(self, names, values):
"""
Sets the values of multiple channels on the target.

Args:
names (List[str]): The names of the channels. You must enter the full path to each channel as specified in
the system definition file.
values (List[float]): The values to set.

Returns:
None:
"""
err = self._dot_net_instance.SetMultipleChannelValues(names, values)
err = _Error(err)
if err.is_error:
raise errors.VeristandError(
_errormessages.csharp_call_failed % (err.error_code, err.resolved_error_message)
)