elkpy.NotificationController

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

Bases: object

Class to manage subscriptions to Sushi notifications (changes, updates, …) It allows the User, through simple API calls, to subscribe to any notification stream implemented in Sushi, and to attach call-back functions to each subscribed stream.

(See the API section at the bottom of this class.)

Attributes:
address: gRPC server IP (str: ip:port) loop: an asynchronous event loop
Notes:
close() should ALWAYS be called as part of an application housekeeping/cleanup-before-shutdown routine as it ensure proper releasing of resources and clean joining of concurrent threads.
__init__(address='localhost:51051', sushi_proto_def='/usr/share/sushi/sushi_rpc.proto')[source]

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

Parameters:
address (str): ‘ip-address:port’ The ip-address and port at which to connect to sushi. sushi_proto_def (str): path to .proto file with SUSHI’s gRPC services definition.
close()[source]
process_parameter_update_notifications(call_back=None, param_list=None)[source]
process_processor_change_notifications(call_back=None)[source]
process_timing_update_notifications(call_back=None)[source]
process_track_change_notifications(call_back=None)[source]
process_transport_change_notifications(call_back=None)[source]
subscribe_to_parameter_updates(cb, param_blocklist=None)[source]

Subscribes to Parameter update notification stream from Sushi User needs to implement their own logic to process these notification in the placeholder methods below

Parameters:
cb: a callable that will be called for each notification received from the stream. param_blocklist: a list of parameter identifiers for which to block update notifications. A parameter identifier is itself a list of [processor_id: int, parameter_id: int] If no param_blocklist is passed, all parameter notifications will be subscribed to.
Notes to write useful callbacks:
Notification objects have 2 attributes: parameter and value; Parameter itself has 2 attributes: processor_id and _parameter_id; ex: notification.parameter.parameter_id (gets the parameter ID) ex: notification.parameter.processor_id (gets the processor ID) ex: notification.value (gets the value)
subscribe_to_processor_changes(cb)[source]

Subscribes to Processor change notification stream from Sushi. User needs to implement their own stream consumer logic and pass it as cb.

Parameters:
cb: a callable that will be called for each notification received from the stream.
subscribe_to_timing_updates(cb)[source]

Subscribes to Timing update notification stream from Sushi User needs to implement their own stream consumer logic and pass it as cb.

Parameters:
cb: a callable that will be called for each notification received from the stream.
subscribe_to_track_changes(cb)[source]

Subscribes to Track change notification stream from Sushi. User needs to implement their own stream consumer logic and pass it as cb.

Parameters:
cb: a callable that will be called for each notification received from the stream.
subscribe_to_transport_changes(cb) → None[source]

Subscribes to Transport changes notification stream from Sushi User needs to implement their own stream consumer logic and pass it as cb.

Parameters:
cb: a callable that will be called for each notification received from the stream.