elkpy.ProgramController

class elkpy.programcontroller.ProgramController(address='localhost:51051', sushi_proto_def='/usr/share/sushi/sushi_rpc.proto')[source]

Bases: object

A class to control the program in sushi via gRPC. It controls the programs for the processors and can set programs and the get the current program as well as other programs availble.

Attributes:
_stub (ProgramControllerStub): Connection stubs to the gRPC program interface implemented in sushi.
__init__(address='localhost:51051', sushi_proto_def='/usr/share/sushi/sushi_rpc.proto')[source]

The constructor for the ProgramController class setting up the gRPC connection with sushi.

Parameters:
address (str): ‘ip-addres:port’ The ip-addres and port at which to connect to sushi. sushi_proto_def (str): path to .proto file with SUSHI’s gRPC services definition
get_processor_current_program(processor_identifier: int) → int[source]

Get the id of the current program of the specified processor.

Parameters:
processor_identifier (int): The id of the processor to get the current program id from.
Returns:
int: The id of the processors current program.
get_processor_current_program_name(processor_identifier: int) → str[source]

Get the name of the current program of the specified processor.

Parameters:
processor_identifier (int): The id of the processor to get the current program name from.
Returns:
str: The name of the processors current program.
get_processor_program_name(processor_identifier: int, program_identifier: int) → str[source]

Get the name of the specified program on the specified processor.

Parameters:
processor_identifier (int): The id of the processor to get the program name from. program_identifier (int): The id of the program to get the name of.
Returns:
str: The name of the program matching the processor and program id.
get_processor_programs(processor_identifier: int) → List[elkpy.sushi_info_types.ProgramInfo][source]

Get a list of the available programs of the specified processor.

Parameters:
processor_identifier (int): The id of the processor to get the programs from.
Returns:
List[info_types.ProgramInfo]: A list of the programs available to the processor matching the id.
set_processor_program(processor_identifier: int, program_identifier: int) → None[source]

Set the program of the specified processor to the one matching the specified program id.

Parameters:
processor_identifier (int): The id of the processor to set the program of. program_identifier (int): The id of the program to set.