initial virtual sensor with protobuf
This commit is contained in:
commit
cbee09be85
7 changed files with 326 additions and 0 deletions
44
sensor.proto
Normal file
44
sensor.proto
Normal file
|
@ -0,0 +1,44 @@
|
|||
syntax = "proto3";
|
||||
|
||||
message Energy {
|
||||
uint32 mAh = 1;
|
||||
}
|
||||
message TimePoint {
|
||||
uint64 millis_since_epoch = 1;
|
||||
}
|
||||
message Duration {
|
||||
uint32 millis = 1;
|
||||
}
|
||||
message Temperature {
|
||||
double celsius = 1;
|
||||
}
|
||||
|
||||
message StatusRequest {}
|
||||
message SensorStatus {
|
||||
string name = 1;
|
||||
TimePoint online_since = 2;
|
||||
Energy battery_charge = 3;
|
||||
Energy battery_capacity = 4;
|
||||
Duration max_sampling_period = 5;
|
||||
Duration cur_sampling_period = 6;
|
||||
uint32 max_chunk_size = 7;
|
||||
uint32 cur_chunk_size = 8;
|
||||
uint32 n_chunk_capacity = 9;
|
||||
uint32 n_full_data_chunks = 10;
|
||||
uint32 n_empty_data_chunks = 11;
|
||||
}
|
||||
|
||||
message DataChunkRequest {}
|
||||
message DataChunk {
|
||||
TimePoint begin = 1;
|
||||
Duration period = 2;
|
||||
repeated Temperature data = 3;
|
||||
}
|
||||
|
||||
message SetSamplingPeriodResult {}
|
||||
|
||||
service Sensor {
|
||||
rpc get_status (StatusRequest) returns (SensorStatus) {}
|
||||
rpc set_sampling_period (Duration) returns (SetSamplingPeriodResult) {}
|
||||
rpc pop_data_chunk (DataChunkRequest) returns (DataChunk) {}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue