[riot-notifications] [RIOT-OS/RIOT] Proposal: eSAUL - Extended Sensor Actuator Uber Layer (#14121)

Marian Buschsieweke notifications at github.com
Mon May 25 15:28:27 CEST 2020

Let's start with the bikeshedding :-D Why not just add a submodule to SAUL? The name "Sensor and Actuator Uber Layer" remains still accurate. A distinct submodule however makes sense, as this is a distinct feature with additional resource requirements. Maybe something like `saul_observe`, `saul_notify`, `saul_subscribe`, ...?

The choice of the message bus seems a perfect fit for this. IMO, a global `msg_bus_t saul_bus` that is initialized from `auto_init()` fits the bill. The notifications for actuators can easily be done from within SAUL (this would ignore low level accesses from the driver specific API, but would free actuators from even caring about notifications). For sensors, I would just leave it up to the sensor drivers to implement the notification.

The interesting point is what should the message contain? My ideas are the following:

1. Just a pointer to the `saul_reg_t` entry of the sensor/actuator that has a change in value
    1. Pro: Trivial to implement, no additional memory required, as the `saul_reg_t` is allocated anyway
    2. Con: Subscribers would than have to explicitly call `saul_reg_read()` to get the new value, if they are interested. 
2. A new type that already contains the value
    1. Pro: Multiple calls to `saul_reg_read()` are avoided
    2. Con: Where would that be allocated? One static allocated value per driver? What happens if the subscriber accesses that value *after* the driver has posted the next event (and, thus, overwritten the old value)?

Also, the filtering feature of the message bus would be nice to exploit. However, there are way more sensor and actuator types than 32. Maybe just filter by class (so subscription needs to be done separately for sensors and actuators)? Some convenience function could be provided that filter the received messages by `saul_driver_t::type` on the calling side. 

You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.riot-os.org/pipermail/notifications/attachments/20200525/1d574978/attachment.htm>

More information about the notifications mailing list