- Controllers: classes derived from
ControlerBase
, implementing API endpointsServerEventsController
: responsible for opening an SSE channel and sending tagged data to the client. Provides the following endpoint for subscribing to SSE:api/sse
. All data sent will be collected from objects marked withEventFinalizerAttribute
, which will be automatically registered at startup.
- Models: classes defining data models for the app to work with
GPSCoords
: represents GPS coordinates (latitude, longitude, altitude)DataStamp
: general metadata attached to all data sent, e.g., timestamp and coordinatesEventData
: wrapper for data flowing through the app, packs the main data with aDataStamp
object
- Services: Modular classes implementing internal functionality
DataProviders
: classes responsible for emitting data. All data providers must implementIDataProvider
. A consumer class can subscribe to a provider'sOnDataProvided
to be notified whenever new data is available.RandomProvider
: provides random floats on a configurable interval.SerialProvider
: provides string arrays from a serial port.
DataProcessors
: classes responsible for transforming data. Notably, every processor both subscribes to a provider to get new data to transform, and is itself a provider, emiting a new event after it has transformed the data.DataExtractors
: classes responsible for extracting a specific piece of data fromSerialProvider
data.
EventFinalizers
: classes responsible for finalizing an event, i.e., collecting the necessary data and tagging it properly. Finalizers must beIDataProviders
(though they'll usually be processors) marked withEventFinalizerAttribute
. Each finalizer is responsible for only one tagged events. The following tags are (or will be) provided, along with their respective finalizers.primary/pressure
byPressureFinalizer
primary/temperature
byTemperatureFinalizer
primary/altitude
byAltitudeFinalizer
secondary/raw
seconddary/ndvi
general/acceleration
general/position
general/raw
- All data is encapsulated in
EventData
objects, which pack the actual data together with aDataStamp
, which in turn contains mandatory information (like timestamp and GPS coordinates) IDataProvider
s emit an event when they get dataIDataProcessor
s subscribe to providers, process their data and send a new event- The main controller finds and subscribes to finalizers and communicates their data to the client through Server Sent Events (SSE)
Most browsers have a limit of 6 connections per domain. Since each SSE endpoint represents a connection that stays open indeterminatly, we have to be very careful when subscribing to SSEs. However, response bodies consist of data
tags and event
tags, so we can have a single endpoint which sends all the data. Thus the endpoints specified above become internal spearations which all write to the same endpoint.