Skip to content
Merged
Show file tree
Hide file tree
Changes from 5 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
33 changes: 28 additions & 5 deletions protos/ni/pythonpanel/v1/python_panel_service.proto
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,18 @@ option ruby_package = "NI::PythonPanel::V1";
service PythonPanelService {
// Start a panel (or connect to if it has already been started)
// Status Codes for errors:
// - INVALID_ARGUMENT: The specified identifier contains invalid characters. Only alphanumeric characters and underscores are allowed.
// - NOT_FOUND: the file for the panel was not found
// - INVALID_ARGUMENT:
// - The panel script filename doesn't end in .py.
// - The panel identifier contains invalid characters. Only alphanumeric characters and underscores are allowed.
// - NOT_FOUND:
// - The panel script file was not found.
// - The python executable file was not found.
rpc StartPanel(StartPanelRequest) returns (StartPanelResponse);

// Stop a panel
// Status Codes for errors:
// - INVALID_ARGUMENT: The specified identifier contains invalid characters. Only alphanumeric characters and underscores are allowed.
// - INVALID_ARGUMENT:
// - The panel identifier contains invalid characters. Only alphanumeric characters and underscores are allowed.
rpc StopPanel(StopPanelRequest) returns (StopPanelResponse);

// Enumerate the panels available in the system, including information about the state of the panels and what values they have.
Expand All @@ -33,12 +38,25 @@ service PythonPanelService {

// Get a value for a control on the panel
// Status Codes for errors:
// - INVALID_ARGUMENT: The specified identifier contains invalid characters. Only alphanumeric characters and underscores are allowed.
// - INVALID_ARGUMENT:
// - The panel identifier contains invalid characters. Only alphanumeric characters and underscores are allowed.
// - The value identifier contains invalid characters. Only alphanumeric characters and underscores are allowed.
// - NOT_FOUND:
// - The value with the specified identifier was not found.
rpc GetValue(GetValueRequest) returns (GetValueResponse);

// Try to get a value for a control on the panel
// Status Codes for errors:
// - INVALID_ARGUMENT:
// - The panel identifier contains invalid characters. Only alphanumeric characters and underscores are allowed.
// - The value identifier contains invalid characters. Only alphanumeric characters and underscores are allowed.
rpc TryGetValue(GetValueRequest) returns (TryGetValueResponse);

// Set a value for a control on the panel
// Status Codes for errors:
// - INVALID_ARGUMENT: The specified identifier contains invalid characters. Only alphanumeric characters and underscores are allowed.
// - INVALID_ARGUMENT:
// - The panel identifier contains invalid characters. Only alphanumeric characters and underscores are allowed.
// - The value identifier contains invalid characters. Only alphanumeric characters and underscores are allowed.
rpc SetValue(SetValueRequest) returns (SetValueResponse);
}

Expand Down Expand Up @@ -98,6 +116,11 @@ message GetValueRequest {

message GetValueResponse {
// The value
google.protobuf.Any value = 1;
}

message TryGetValueResponse {
// The value, if it was found
optional google.protobuf.Any value = 1;
}

Expand Down
18 changes: 10 additions & 8 deletions src/ni/pythonpanel/v1/python_panel_service_pb2.py

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

21 changes: 20 additions & 1 deletion src/ni/pythonpanel/v1/python_panel_service_pb2.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,25 @@ class GetValueResponse(google.protobuf.message.Message):
def value(self) -> google.protobuf.any_pb2.Any:
"""The value"""

def __init__(
self,
*,
value: google.protobuf.any_pb2.Any | None = ...,
) -> None: ...
def HasField(self, field_name: typing.Literal["value", b"value"]) -> builtins.bool: ...
def ClearField(self, field_name: typing.Literal["value", b"value"]) -> None: ...

global___GetValueResponse = GetValueResponse

@typing.final
class TryGetValueResponse(google.protobuf.message.Message):
DESCRIPTOR: google.protobuf.descriptor.Descriptor

VALUE_FIELD_NUMBER: builtins.int
@property
def value(self) -> google.protobuf.any_pb2.Any:
"""The value, if it was found"""

def __init__(
self,
*,
Expand All @@ -175,7 +194,7 @@ class GetValueResponse(google.protobuf.message.Message):
def ClearField(self, field_name: typing.Literal["_value", b"_value", "value", b"value"]) -> None: ...
def WhichOneof(self, oneof_group: typing.Literal["_value", b"_value"]) -> typing.Literal["value"] | None: ...

global___GetValueResponse = GetValueResponse
global___TryGetValueResponse = TryGetValueResponse

@typing.final
class SetValueRequest(google.protobuf.message.Message):
Expand Down
59 changes: 54 additions & 5 deletions src/ni/pythonpanel/v1/python_panel_service_pb2_grpc.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,11 @@ def __init__(self, channel):
request_serializer=ni_dot_pythonpanel_dot_v1_dot_python__panel__service__pb2.GetValueRequest.SerializeToString,
response_deserializer=ni_dot_pythonpanel_dot_v1_dot_python__panel__service__pb2.GetValueResponse.FromString,
)
self.TryGetValue = channel.unary_unary(
'/ni.pythonpanel.v1.PythonPanelService/TryGetValue',
request_serializer=ni_dot_pythonpanel_dot_v1_dot_python__panel__service__pb2.GetValueRequest.SerializeToString,
response_deserializer=ni_dot_pythonpanel_dot_v1_dot_python__panel__service__pb2.TryGetValueResponse.FromString,
)
self.SetValue = channel.unary_unary(
'/ni.pythonpanel.v1.PythonPanelService/SetValue',
request_serializer=ni_dot_pythonpanel_dot_v1_dot_python__panel__service__pb2.SetValueRequest.SerializeToString,
Expand All @@ -49,8 +54,12 @@ class PythonPanelServiceServicer(object):
def StartPanel(self, request, context):
"""Start a panel (or connect to if it has already been started)
Status Codes for errors:
- INVALID_ARGUMENT: The specified identifier contains invalid characters. Only alphanumeric characters and underscores are allowed.
- NOT_FOUND: the file for the panel was not found
- INVALID_ARGUMENT:
- The panel script filename doesn't end in .py.
- The panel identifier contains invalid characters. Only alphanumeric characters and underscores are allowed.
- NOT_FOUND:
- The panel script file was not found.
- The python executable file was not found.
"""
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
context.set_details('Method not implemented!')
Expand All @@ -59,7 +68,8 @@ def StartPanel(self, request, context):
def StopPanel(self, request, context):
"""Stop a panel
Status Codes for errors:
- INVALID_ARGUMENT: The specified identifier contains invalid characters. Only alphanumeric characters and underscores are allowed.
- INVALID_ARGUMENT:
- The panel identifier contains invalid characters. Only alphanumeric characters and underscores are allowed.
"""
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
context.set_details('Method not implemented!')
Expand All @@ -76,7 +86,22 @@ def EnumeratePanels(self, request, context):
def GetValue(self, request, context):
"""Get a value for a control on the panel
Status Codes for errors:
- INVALID_ARGUMENT: The specified identifier contains invalid characters. Only alphanumeric characters and underscores are allowed.
- INVALID_ARGUMENT:
- The panel identifier contains invalid characters. Only alphanumeric characters and underscores are allowed.
- The value identifier contains invalid characters. Only alphanumeric characters and underscores are allowed.
- NOT_FOUND:
- The value with the specified identifier was not found.
"""
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
context.set_details('Method not implemented!')
raise NotImplementedError('Method not implemented!')

def TryGetValue(self, request, context):
"""Try to get a value for a control on the panel
Status Codes for errors:
- INVALID_ARGUMENT:
- The panel identifier contains invalid characters. Only alphanumeric characters and underscores are allowed.
- The value identifier contains invalid characters. Only alphanumeric characters and underscores are allowed.
"""
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
context.set_details('Method not implemented!')
Expand All @@ -85,7 +110,9 @@ def GetValue(self, request, context):
def SetValue(self, request, context):
"""Set a value for a control on the panel
Status Codes for errors:
- INVALID_ARGUMENT: The specified identifier contains invalid characters. Only alphanumeric characters and underscores are allowed.
- INVALID_ARGUMENT:
- The panel identifier contains invalid characters. Only alphanumeric characters and underscores are allowed.
- The value identifier contains invalid characters. Only alphanumeric characters and underscores are allowed.
"""
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
context.set_details('Method not implemented!')
Expand Down Expand Up @@ -114,6 +141,11 @@ def add_PythonPanelServiceServicer_to_server(servicer, server):
request_deserializer=ni_dot_pythonpanel_dot_v1_dot_python__panel__service__pb2.GetValueRequest.FromString,
response_serializer=ni_dot_pythonpanel_dot_v1_dot_python__panel__service__pb2.GetValueResponse.SerializeToString,
),
'TryGetValue': grpc.unary_unary_rpc_method_handler(
servicer.TryGetValue,
request_deserializer=ni_dot_pythonpanel_dot_v1_dot_python__panel__service__pb2.GetValueRequest.FromString,
response_serializer=ni_dot_pythonpanel_dot_v1_dot_python__panel__service__pb2.TryGetValueResponse.SerializeToString,
),
'SetValue': grpc.unary_unary_rpc_method_handler(
servicer.SetValue,
request_deserializer=ni_dot_pythonpanel_dot_v1_dot_python__panel__service__pb2.SetValueRequest.FromString,
Expand Down Expand Up @@ -198,6 +230,23 @@ def GetValue(request,
options, channel_credentials,
insecure, call_credentials, compression, wait_for_ready, timeout, metadata)

@staticmethod
def TryGetValue(request,
target,
options=(),
channel_credentials=None,
call_credentials=None,
insecure=False,
compression=None,
wait_for_ready=None,
timeout=None,
metadata=None):
return grpc.experimental.unary_unary(request, target, '/ni.pythonpanel.v1.PythonPanelService/TryGetValue',
ni_dot_pythonpanel_dot_v1_dot_python__panel__service__pb2.GetValueRequest.SerializeToString,
ni_dot_pythonpanel_dot_v1_dot_python__panel__service__pb2.TryGetValueResponse.FromString,
options, channel_credentials,
insecure, call_credentials, compression, wait_for_ready, timeout, metadata)

@staticmethod
def SetValue(request,
target,
Expand Down
Loading