Skip to content
Merged
Show file tree
Hide file tree
Changes from 4 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
44 changes: 37 additions & 7 deletions protos/ni/pythonpanel/v1/python_panel_service.proto
Original file line number Diff line number Diff line change
Expand Up @@ -16,20 +16,39 @@ option ruby_package = "NI::PythonPanel::V1";

// Service interface for interacting with python panels
service PythonPanelService {
// Enumerate the panels available in the system
// Status Codes for errors:
rpc EnumeratePanels(EnumeratePanelsRequest) returns (EnumeratePanelsResponse);

// Open a panel
// 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
rpc OpenPanel(OpenPanelRequest) returns (OpenPanelResponse);

// Get a value for a control on the panel
// Status Codes for errors:
// - NOT_FOUND: the panel with the specified id was not found
// - INVALID_ARGUMENT: The specified 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);

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

// Close a panel
// Status Codes for errors:
// - INVALID_ARGUMENT: The specified identifier contains invalid characters. Only alphanumeric characters and underscores are allowed.
rpc ClosePanel(ClosePanelRequest) returns (ClosePanelResponse);
}

message EnumeratePanelsRequest {
}

message EnumeratePanelsResponse {
// The list of panels available in the system
repeated string panel_ids = 1;
}

message OpenPanelRequest {
Expand All @@ -40,12 +59,12 @@ message OpenPanelRequest {
string panel_uri = 2;
}

message OpenPanelResponse {
message OpenPanelResponse {
}

message GetValueRequest {
// Unique ID of the panel
string panel_id = 1;
string panel_id = 1;

// Unique ID of value
string value_id = 2;
Expand All @@ -58,14 +77,25 @@ message GetValueResponse {

message SetValueRequest {
// Unique ID of the panel
string panel_id = 1;
string panel_id = 1;

// Unique ID of the value
string value_id = 2;

// The value
google.protobuf.Any value = 3;
}

message SetValueResponse {
message SetValueResponse {
}

message ClosePanelRequest {
// Unique ID of the panel
string panel_id = 1;

// Reset all storage associated with panel
bool reset = 2;
}

message ClosePanelResponse {
}
38 changes: 23 additions & 15 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.

60 changes: 60 additions & 0 deletions src/ni/pythonpanel/v1/python_panel_service_pb2.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,43 @@ isort:skip_file
"""

import builtins
import collections.abc
import google.protobuf.any_pb2
import google.protobuf.descriptor
import google.protobuf.internal.containers
import google.protobuf.message
import typing

DESCRIPTOR: google.protobuf.descriptor.FileDescriptor

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

def __init__(
self,
) -> None: ...

global___EnumeratePanelsRequest = EnumeratePanelsRequest

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

PANEL_IDS_FIELD_NUMBER: builtins.int
@property
def panel_ids(self) -> google.protobuf.internal.containers.RepeatedScalarFieldContainer[builtins.str]:
"""The list of panels available in the system"""

def __init__(
self,
*,
panel_ids: collections.abc.Iterable[builtins.str] | None = ...,
) -> None: ...
def ClearField(self, field_name: typing.Literal["panel_ids", b"panel_ids"]) -> None: ...

global___EnumeratePanelsResponse = EnumeratePanelsResponse

@typing.final
class OpenPanelRequest(google.protobuf.message.Message):
DESCRIPTOR: google.protobuf.descriptor.Descriptor
Expand Down Expand Up @@ -116,3 +146,33 @@ class SetValueResponse(google.protobuf.message.Message):
) -> None: ...

global___SetValueResponse = SetValueResponse

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

PANEL_ID_FIELD_NUMBER: builtins.int
RESET_FIELD_NUMBER: builtins.int
panel_id: builtins.str
"""Unique ID of the panel"""
reset: builtins.bool
"""Reset all storage associated with panel"""
def __init__(
self,
*,
panel_id: builtins.str = ...,
reset: builtins.bool = ...,
) -> None: ...
def ClearField(self, field_name: typing.Literal["panel_id", b"panel_id", "reset", b"reset"]) -> None: ...

global___ClosePanelRequest = ClosePanelRequest

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

def __init__(
self,
) -> None: ...

global___ClosePanelResponse = ClosePanelResponse
77 changes: 75 additions & 2 deletions src/ni/pythonpanel/v1/python_panel_service_pb2_grpc.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,11 @@ def __init__(self, channel):
Args:
channel: A grpc.Channel.
"""
self.EnumeratePanels = channel.unary_unary(
'/ni.pythonpanel.v1.PythonPanelService/EnumeratePanels',
request_serializer=ni_dot_pythonpanel_dot_v1_dot_python__panel__service__pb2.EnumeratePanelsRequest.SerializeToString,
response_deserializer=ni_dot_pythonpanel_dot_v1_dot_python__panel__service__pb2.EnumeratePanelsResponse.FromString,
)
self.OpenPanel = channel.unary_unary(
'/ni.pythonpanel.v1.PythonPanelService/OpenPanel',
request_serializer=ni_dot_pythonpanel_dot_v1_dot_python__panel__service__pb2.OpenPanelRequest.SerializeToString,
Expand All @@ -30,15 +35,29 @@ def __init__(self, channel):
request_serializer=ni_dot_pythonpanel_dot_v1_dot_python__panel__service__pb2.SetValueRequest.SerializeToString,
response_deserializer=ni_dot_pythonpanel_dot_v1_dot_python__panel__service__pb2.SetValueResponse.FromString,
)
self.ClosePanel = channel.unary_unary(
'/ni.pythonpanel.v1.PythonPanelService/ClosePanel',
request_serializer=ni_dot_pythonpanel_dot_v1_dot_python__panel__service__pb2.ClosePanelRequest.SerializeToString,
response_deserializer=ni_dot_pythonpanel_dot_v1_dot_python__panel__service__pb2.ClosePanelResponse.FromString,
)


class PythonPanelServiceServicer(object):
"""Service interface for interacting with python panels
"""

def EnumeratePanels(self, request, context):
"""Enumerate the panels available in the system
Status Codes for errors:
"""
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
context.set_details('Method not implemented!')
raise NotImplementedError('Method not implemented!')

def OpenPanel(self, request, context):
"""Open a panel
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
"""
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
Expand All @@ -48,7 +67,8 @@ def OpenPanel(self, request, context):
def GetValue(self, request, context):
"""Get a value for a control on the panel
Status Codes for errors:
- NOT_FOUND: the panel with the specified id was not found
- INVALID_ARGUMENT: The specified 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!')
Expand All @@ -57,7 +77,16 @@ def GetValue(self, request, context):
def SetValue(self, request, context):
"""Set a value for a control on the panel
Status Codes for errors:
- NOT_FOUND: the panel with the specified id was not found
- INVALID_ARGUMENT: The specified identifier contains invalid characters. Only alphanumeric characters and underscores are allowed.
"""
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
context.set_details('Method not implemented!')
raise NotImplementedError('Method not implemented!')

def ClosePanel(self, request, context):
"""Close a panel
Status Codes for errors:
- INVALID_ARGUMENT: The specified 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 @@ -66,6 +95,11 @@ def SetValue(self, request, context):

def add_PythonPanelServiceServicer_to_server(servicer, server):
rpc_method_handlers = {
'EnumeratePanels': grpc.unary_unary_rpc_method_handler(
servicer.EnumeratePanels,
request_deserializer=ni_dot_pythonpanel_dot_v1_dot_python__panel__service__pb2.EnumeratePanelsRequest.FromString,
response_serializer=ni_dot_pythonpanel_dot_v1_dot_python__panel__service__pb2.EnumeratePanelsResponse.SerializeToString,
),
'OpenPanel': grpc.unary_unary_rpc_method_handler(
servicer.OpenPanel,
request_deserializer=ni_dot_pythonpanel_dot_v1_dot_python__panel__service__pb2.OpenPanelRequest.FromString,
Expand All @@ -81,6 +115,11 @@ def add_PythonPanelServiceServicer_to_server(servicer, server):
request_deserializer=ni_dot_pythonpanel_dot_v1_dot_python__panel__service__pb2.SetValueRequest.FromString,
response_serializer=ni_dot_pythonpanel_dot_v1_dot_python__panel__service__pb2.SetValueResponse.SerializeToString,
),
'ClosePanel': grpc.unary_unary_rpc_method_handler(
servicer.ClosePanel,
request_deserializer=ni_dot_pythonpanel_dot_v1_dot_python__panel__service__pb2.ClosePanelRequest.FromString,
response_serializer=ni_dot_pythonpanel_dot_v1_dot_python__panel__service__pb2.ClosePanelResponse.SerializeToString,
),
}
generic_handler = grpc.method_handlers_generic_handler(
'ni.pythonpanel.v1.PythonPanelService', rpc_method_handlers)
Expand All @@ -92,6 +131,23 @@ class PythonPanelService(object):
"""Service interface for interacting with python panels
"""

@staticmethod
def EnumeratePanels(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/EnumeratePanels',
ni_dot_pythonpanel_dot_v1_dot_python__panel__service__pb2.EnumeratePanelsRequest.SerializeToString,
ni_dot_pythonpanel_dot_v1_dot_python__panel__service__pb2.EnumeratePanelsResponse.FromString,
options, channel_credentials,
insecure, call_credentials, compression, wait_for_ready, timeout, metadata)

@staticmethod
def OpenPanel(request,
target,
Expand Down Expand Up @@ -142,3 +198,20 @@ def SetValue(request,
ni_dot_pythonpanel_dot_v1_dot_python__panel__service__pb2.SetValueResponse.FromString,
options, channel_credentials,
insecure, call_credentials, compression, wait_for_ready, timeout, metadata)

@staticmethod
def ClosePanel(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/ClosePanel',
ni_dot_pythonpanel_dot_v1_dot_python__panel__service__pb2.ClosePanelRequest.SerializeToString,
ni_dot_pythonpanel_dot_v1_dot_python__panel__service__pb2.ClosePanelResponse.FromString,
options, channel_credentials,
insecure, call_credentials, compression, wait_for_ready, timeout, metadata)
Loading