jvconnected.interfaces.base

class jvconnected.interfaces.base.Interface(*args, **kwargs)[source]

Bases: pydispatch.dispatch.Dispatcher

Base interface class

Subclasses must override the open() and close() methods. In order to operate with the Engine, the class should be added to the registry

Properties
running: bool Property(bool)

Run state

config: None Property(None)

Instance of jvconnected.config.Config. This is gathered from the engine after set_engine() has been called.

interface_name: ClassVar[str] = ''

Unique name for the interface. Must be defined by subclasses

loop: asyncio.base_events.BaseEventLoop

The asyncio.BaseEventLoop associated with the instance

property engine jvconnected.engine.Engine   [read-only]

Instance of jvconnected.engine.Engine

async set_engine(engine: jvconnected.engine.Engine)[source]

Attach the interface to a running instance of jvconnected.engine.Engine

This will be called automatically by the engine if the class is in the jvconnected.interfaces.registry.

If the engine is running, the interface will start (using the open() method). Otherwise it will automatically start when the engine does.

async open()[source]

Open all communication methods

async close()[source]

Stop communication

get_config_section() Optional[Dict][source]

Get or create a section within the config specific to this interface.

The returned dict can be used to retreive or store interface-specific configuration data.

Returns None if config has not been set.