pub struct SenMLResolvedRecord {
pub name: String,
pub unit: Option<String>,
pub value: Option<SenMLValueField>,
pub sum: Option<f64>,
pub time: DateTime<Utc>,
pub update_time: Option<f64>,
pub base_version: Option<u64>,
pub extra_fields: Option<HashMap<String, Value>>,
}Expand description
SenML Resolved Record.
A SenML Record that is extracted from a SenML Pack and has all the fields resolved, meaning that all the base fields are applied to the record.
This can be serialised to JSON using serde.
Please note that this is not the most compact SenML representation, but it is a compatible one. https://www.rfc-editor.org/rfc/rfc8428#section-4.6
Fields§
§name: StringThe name of the record.
This is the concatenation of the base name and the name. The name is always present and cannot be an empty string.
unit: Option<String>The unit of the record.
The unit is optional and is preferably present. It should be a SI unit if possible and use the units defined in the SenML unit registries. https://www.rfc-editor.org/rfc/rfc8428.html#section-12.1 https://www.rfc-editor.org/rfc/rfc8798.html
value: Option<SenMLValueField>The value of the record.
The value is optional as the record can also contain a sum.
The value defaults to 0.0 if both the sum and the value are missing.
sum: Option<f64>Integrated sum of the values over time.
This field should have been named “integral” according to the RFC but is named “sum” for historical reasons. Optional.
time: DateTime<Utc>Time when the value was recorded.
This is a UTC DateTime that is always present. It defaults to the current time of the system.
update_time: Option<f64>Period of time in seconds that represents the maximum time before the sensor will provided and updated reading for a measurement.
Optional. This can be used to detect the failure of sensors or the communications path from the sensor.
base_version: Option<u64>Version number of the media type format.
This field is an optional positive integer and defaults to 10 if not present.
extra_fields: Option<HashMap<String, Value>>Extra fields that are not part of the SenML specification but are allowed to be present and were in the JSON records.
Implementations§
Source§impl SenMLResolvedRecord
impl SenMLResolvedRecord
pub fn get_bool_value(&self) -> Option<bool>
pub fn get_string_value(&self) -> Option<&String>
pub fn get_data_value(&self) -> Option<&Vec<u8>>
pub fn get_float_value(&self) -> Option<f64>
Trait Implementations§
Source§impl Clone for SenMLResolvedRecord
impl Clone for SenMLResolvedRecord
Source§fn clone(&self) -> SenMLResolvedRecord
fn clone(&self) -> SenMLResolvedRecord
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more