2025-03-17 10:14:41 +01:00
|
|
|
|
|
|
|
|
|
trait SensorStatus = {
|
|
|
|
|
name : [ Char ] ;
|
|
|
|
|
online_since : TimePoint ;
|
|
|
|
|
battery_charge : Energy ;
|
|
|
|
|
battery_capacity : Energy ;
|
|
|
|
|
min_sampling_period : Duration ;
|
|
|
|
|
cur_sampling_period : Duration ;
|
|
|
|
|
max_chunk_size : ℤ ;
|
|
|
|
|
cur_chunk_size : ℤ ;
|
|
|
|
|
n_chunk_capacity : ℤ ;
|
|
|
|
|
n_full_data_chunks : ℤ ;
|
|
|
|
|
n_empty_data_chunks : ℤ ;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
trait DataChunk = {
|
|
|
|
|
begin : TimePoint ;
|
2025-03-19 17:29:57 +01:00
|
|
|
|
sampling_period: Duration ;
|
2025-03-17 10:14:41 +01:00
|
|
|
|
data : [ Temperature ] ;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
trait Sensor = {
|
|
|
|
|
get_status : {} -> SensorStatus ;
|
|
|
|
|
set_sampling_period : Duration -> (Ok | OutOfRange);
|
|
|
|
|
pop_data_chunk : {} -> DataChunk ;
|
|
|
|
|
}
|