pub struct ExtendedRegister {
logical_name: ObisCode,
value: Choice,
scaler_unit: ScalerUnit,
status: Choice,
capture_time: DateTime,
}Expand description
The ExtendedRegister interface class (class_id = 4): the current value of a
measured quantity with extra metadata such as status and capture time, per
IEC 62056-6-2.
Attributes (IEC 62056-6-2, Table 9):
- attr 1: logical_name (octet-string) — OBIS code
- attr 2: value (CHOICE) — any numeric type
- attr 3: scaler_unit (scal_unit_type) — {scaler, unit}
- attr 4: status (CHOICE) — measurement status
- attr 5: capture_time (octet-string) — date-time
Fields§
§logical_name: ObisCode§value: Choice§scaler_unit: ScalerUnit§status: Choice§capture_time: DateTimeImplementations§
Source§impl ExtendedRegister
impl ExtendedRegister
Sourcepub fn new(
logical_name: ObisCode,
value: Choice,
scaler_unit: ScalerUnit,
status: Choice,
capture_time: DateTime,
) -> Self
pub fn new( logical_name: ObisCode, value: Choice, scaler_unit: ScalerUnit, status: Choice, capture_time: DateTime, ) -> Self
Creates a new ExtendedRegister object.
Sourcepub fn scaler_unit(&self) -> &ScalerUnit
pub fn scaler_unit(&self) -> &ScalerUnit
Returns the scaler_unit attribute (attr 3).
Sourcepub fn capture_time(&self) -> &DateTime
pub fn capture_time(&self) -> &DateTime
Returns the capture_time attribute (attr 5).
Sourcefn reset(&mut self) -> Result<CosemDataType, String>
fn reset(&mut self) -> Result<CosemDataType, String>
Resets the register value to 0 and clears the status and capture time.
§Returns
Ok(CosemDataType::Null)- On successful reset.Err(String)- If the value type does not support reset.
Sourcefn capture(&mut self) -> CosemDataType
fn capture(&mut self) -> CosemDataType
Captures the current value, updating the status and capture time.
§Returns
Ok(CosemDataType::Null)- On a successful capture.Err(String)- On error.
Trait Implementations§
Source§impl Clone for ExtendedRegister
impl Clone for ExtendedRegister
Source§fn clone(&self) -> ExtendedRegister
fn clone(&self) -> ExtendedRegister
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for ExtendedRegister
impl Debug for ExtendedRegister
Source§impl<'de> Deserialize<'de> for ExtendedRegister
impl<'de> Deserialize<'de> for ExtendedRegister
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl InterfaceClass for ExtendedRegister
impl InterfaceClass for ExtendedRegister
Source§fn logical_name(&self) -> &ObisCode
fn logical_name(&self) -> &ObisCode
Returns the object’s logical name (OBIS code).
Source§fn attributes(&self) -> Vec<(u8, CosemDataType)>
fn attributes(&self) -> Vec<(u8, CosemDataType)>
Returns the class attributes as
(attribute_id, value) pairs.Source§fn serialize_ber(&self, buf: &mut Vec<u8>) -> Result<(), BerError>
fn serialize_ber(&self, buf: &mut Vec<u8>) -> Result<(), BerError>
Serializes the object into BER. Read more
Source§fn deserialize_ber(&mut self, data: &[u8]) -> Result<(), BerError>
fn deserialize_ber(&mut self, data: &[u8]) -> Result<(), BerError>
Deserializes the object from BER data. Read more
Source§fn invoke_method(
&mut self,
method_id: u8,
_params: Option<CosemDataType>,
) -> Result<CosemDataType, String>
fn invoke_method( &mut self, method_id: u8, _params: Option<CosemDataType>, ) -> Result<CosemDataType, String>
Invokes the object method with the given id. Read more
Source§fn set_attribute(
&mut self,
attribute_id: u8,
value: CosemDataType,
) -> Result<(), String>
fn set_attribute( &mut self, attribute_id: u8, value: CosemDataType, ) -> Result<(), String>
Writes the value of a writable attribute. The default implementation
rejects the write; classes with writable attributes override it. Read more
Auto Trait Implementations§
impl Freeze for ExtendedRegister
impl RefUnwindSafe for ExtendedRegister
impl Send for ExtendedRegister
impl Sync for ExtendedRegister
impl Unpin for ExtendedRegister
impl UnsafeUnpin for ExtendedRegister
impl UnwindSafe for ExtendedRegister
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more