Datastreams

Datastreams Getters, Setters and Events

The datastreams are the basic entity to model data inside a device. Datastreams are divided in:

public interface DatastreamsGetter {
    String getDatastreamIdSatisfied();
    List<String> getDevicesIdManaged();
    CompletableFuture<CollectedValue> get(String device);
}
public interface DatastreamsSetter {
    String getDatastreamIdSatisfied();
    Type getDatastreamType();
    List<String> getDevicesIdManaged();
    CompletableFuture<Void> set(String device, Object value);
}
public interface DatastreamsEvent {
    void registerToEventSource();
    void unregisterFromEventSource();
    void publish(String deviceId, List<String> path, Map<String, Map<String, Map<Long, Object>>> events);
}

This layer abstract different data sources modelling them as datastreams, easing the access to read, write and send events.

::: tip When a new data source is identified try to abstract the hardware access in a new API in the hardware layer and create a new datastreams abstraction using the defined hardware API :::

Implemented datastreams data sources

The following data sources are implemented and abstracted as datamodels:

  • ADC: Device ADC pins.
  • Device Info: Information about the device as CPU, Memory, Clock, Software…
  • GPIO: Device GPIO pins.
  • I2C: Data inside I2C devices (sensors and microcontrollers).
  • Modbus: Data measured by connected devices through Modbus protocol.
  • MQTT: Data measured by connected devices through MQTT protocol.
  • IEC104: Data measured by connected devices through Iec104 protocol.
  • OPC UA: Data measured by connected devices through OPC UA protocol.

Simulator

A simulator datastreams implementation is provided to simulate data with debugging and demonstration purposes.