Crate tosca_esp32c3

Crate tosca_esp32c3 

Source
Expand description

tosca-esp32c3 is a library crate for building firmware for tosca devices using an ESP32-C3 microcontroller.

It provides APIs to:

  • Connect a device to a Wi-Fi access point
  • Build the network stack
  • Configure the mDNS-SD discovery service
  • Define events for specific route tasks
  • Initialize and run an HTTP server

The device APIs are designed to guide developers in defining their own devices, aiming to minimize the ambiguities that could arise during firmware development.

Device firmware consists of a description and a set of tasks, both exposed through a client-server architecture in which the firmware operates as the server and its controller as the client.

A device description is defined as a sequence of fields, such as the device name, the device kind, and other data used to establish a connection with a controller.

When a controller makes a request to the firmware through a route, the firmware executes the corresponding task and sends a response! back to the controller. Routes may also accept parameters to configure tasks

An event can be associated with a route to monitor data produced by a sensor. Both integer and floating-point values are supported, as well as events triggered by changes in the device state configuration.

Each route can define zero or more associated hazards, representing potential risks during task execution. Even if no hazards are declared, a route may still pose unknown risks to the device. In such cases, the controller must decide whether to allow or block the request based on its privacy policy.

This crate cannot determine the outcome of device tasks at compile time, as they depend on the runtime environment. Therefore, hazards only informs a controller of the possible risks that might arise.

Modulesยง

device
General device definition along with its methods.
devices
All supported device types.
error
Error management.
events
Events and their data.
mdns
The mDNS-SD discovery service.
net
The network stack builder.
parameters
All route parameters.
response
All responses kinds along with their payloads.
server
The firmware server.
state
The device state.
wifi
The Wi-Fi controller.