Principles & Concepts
Cocotte starts with two main concepts: Configuration and State. Once
defined, those entities can be stored to disk, updated and exposed to
the outside world (USB, BLE, BACnet, Modbus, MQTT) through Renderers.
Application
The central point of interaction for the system. The application holds the
configuration and the state. It reacts to Event and send Action when it
needs to interact with hardware. It also controls what is exposed through the
communication protocols.
All those elements are explained in the following sections.
Configuration
The configuration is the set of parameters that configures the application. In most situation, a configuration does not change frequently (if ever). The user might set it up at one point in time and never touch it again.
Ideally, any exposed medium can change the configuration (e.g, USB and BLE). Cocotte ensures that the configuration is updated in an atomic manner and write access is protected.
TODO: Compose configuration with subconfiguration TODO: AuthN/AuthZ on configuration access and changes (session-based system?)
State
The state is the current known state of the application or the hardware below it. The state can changes (very) frequently. It can be read by the user and updated by the application from within.
The state is read-only for the user. Only the application itself can update it. Cocotte provides ways to listen for state updates and act on them.
TODO: Define lazy state: state that we don't care of until we do (eg., a sensor value) TODO: Compose state with substate TODO: Define alarms on state
Controllers
Controllers can perform actions on something external. That something can be a board, a simulator or anything that the application will interact with.
The application applies Action(s) on the controller went it needs to interact
with it.
System
As system can handle events coming from the outside world. In most cases, an application is a system.
Renderer
A renderer is a way to expose the configuration or state to the outside world. Cocotte provides many renderers out of the box: USB, BLE, MQTT, BACnet, Modbus.
Renderers have sane defaults and can be customized elements by element.