App

class olaf.App[source]

The application class that manages the CANopen node and resources.

Use the global olaf.app obect.

setup(network: CanNetwork, od: ObjectDictionary, master_od_db: dict | None = None, load_core: bool = True)[source]

Setup the app. Will be called by olaf_setup automatically.

Parameters:
  • network (CanNetwork) – The CAN network to use.

  • od (canopen.ObjectDictionary) – The nodes object dictionary.

  • master_od_db (dict) – Master node od database. Only for the C3.

  • load_core (bool) – Load the core olaf services and resources

Raises:

ValueError – Invalid parameter(s)

add_resource(resource: Resource)[source]

Add a resource for the app

Parameters:

resource (Resource) – The resource to add.

add_service(service: Service)[source]

Add a resource for the app

Parameters:

service (Service) – The service to add.

run()[source]

Run the app.

stop()[source]

End the run loop

property node: Node

The CANopen node.

Type:

Node

set_factory_reset_callback(cb_func)[source]

Set a custom factory reset callback function.

property od: ObjectDictionary

The node’s Object Dictionary.

Type:

canopen.ObjectDictionary

olaf.olaf_setup(name: str, args: Namespace | None = None) tuple[Namespace, dict][source]

Parse runtime args and setup the app and REST API.

Parameters:
  • name (str) – The card’s node name.

  • args (Namespace) – Optional runtime args. If not set, the default from olaf_parser will be used.

Returns:

  • Namespace – The runtime args.

  • dict – The OreSat configs.

olaf.olaf_run()[source]

Start the app and REST API.