fastcs.methods.command#

fastcs.methods.command.UnboundCommandCallback#

A Command callback that is unbound and must be called with a Controller instance

alias of Callable[[Controller_T], Coroutine[None, None, None]]

fastcs.methods.command.CommandCallback#

A Command callback that is bound and can be called without self

alias of Callable[[], Coroutine[None, None, None]]

class fastcs.methods.command.Command(fn: Callable[[], Coroutine[None, None, None]], *, group: str | None = None)[source]#

A Controller Method that performs a single action when called.

This class contains a function that is bound to a specific Controller instance and is callable outside of the class context, without an explicit self parameter. Calling an instance of this class will call the bound Controller method.

class fastcs.methods.command.UnboundCommand(fn: Callable[[Controller_T], Coroutine[None, None, None]], *, group: str | None = None)[source]#

A wrapper of an unbound Controller method to be bound into a Command.

This generic class stores an unbound Controller method - effectively a function that takes an instance of a specific Controller type (Controller_T). Instances of this class can be added at Controller definition, either manually or with use of the command wrapper, to register the method to be included in the API of the Controller. When the Controller is instantiated, these instances will be bound to the instance, creating a Command instance.

fastcs.methods.command.command(*, group: str | None = None) Callable[[Callable[[Controller_T], Coroutine[None, None, None]]], Callable[[Controller_T], Coroutine[None, None, None]]][source]#

Decorator to register a Controller method as a Command

The Command will be passed to the transport layer to expose in the API

Param:

group: Group to display this command under in the transport layer