pub struct Clock {
logical_name: ObisCode,
time: DateTime,
time_zone: i16,
status: u8,
daylight_savings_begin: DateTime,
daylight_savings_end: DateTime,
daylight_savings_deviation: i8,
daylight_savings_enabled: bool,
clock_base: u8,
}Expand description
The Clock interface class (class_id = 8) managing time and date
per IEC 62056-6-2.
Attributes (IEC 62056-6-2, Table 15):
- attr 1: logical_name (octet-string) — OBIS code
- attr 2: time (date-time) — current date and time
- attr 3: time_zone (long) — deviation from GMT in minutes
- attr 4: status (bit-string) — clock status flags
- attr 5: daylight_savings_begin (date-time)
- attr 6: daylight_savings_end (date-time)
- attr 7: daylight_savings_deviation (integer) — offset in minutes
- attr 8: daylight_savings_enabled (boolean)
- attr 9: clock_base (enum) — clock source
Fields§
§logical_name: ObisCode§time: DateTime§time_zone: i16§status: u8§daylight_savings_begin: DateTime§daylight_savings_end: DateTime§daylight_savings_deviation: i8§daylight_savings_enabled: bool§clock_base: u8Implementations§
Source§impl Clock
impl Clock
Sourcepub fn new(config: ClockConfig) -> Self
pub fn new(config: ClockConfig) -> Self
Sourcepub fn clock_base(&self) -> u8
pub fn clock_base(&self) -> u8
Returns the clock_base attribute (attr 9).
Sourcefn adjust_to_quarter(&mut self) -> CosemDataType
fn adjust_to_quarter(&mut self) -> CosemDataType
Adjusts the time to the nearest quarter hour (minute 0, 15, 30 or 45).
Sourcefn adjust_to_measuring_period(&mut self) -> CosemDataType
fn adjust_to_measuring_period(&mut self) -> CosemDataType
Adjusts the time to the measuring period (stub — C++ parity).
Sourcefn adjust_to_minute(&mut self) -> CosemDataType
fn adjust_to_minute(&mut self) -> CosemDataType
Adjusts the time to the nearest minute.
Sourcefn adjust_to_preset_time(
&mut self,
params: Option<CosemDataType>,
) -> Result<CosemDataType, String>
fn adjust_to_preset_time( &mut self, params: Option<CosemDataType>, ) -> Result<CosemDataType, String>
Sets a preset time.
Sourcefn preset_adjusting_time() -> CosemDataType
fn preset_adjusting_time() -> CosemDataType
Preset-time adjustment (stub).
Sourcefn shift_time(_params: Option<CosemDataType>) -> CosemDataType
fn shift_time(_params: Option<CosemDataType>) -> CosemDataType
Shifts the clock by a relative offset in seconds (Blue Book method 6). Parameter is ignored for success/failure — C++ returns null without applying.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Clock
impl<'de> Deserialize<'de> for Clock
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 Clock
impl InterfaceClass for Clock
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 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
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
Auto Trait Implementations§
impl Freeze for Clock
impl RefUnwindSafe for Clock
impl Send for Clock
impl Sync for Clock
impl Unpin for Clock
impl UnsafeUnpin for Clock
impl UnwindSafe for Clock
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