Skip to main content

Payload

Struct Payload 

Source
pub struct Payload<'a> { /* private fields */ }
Expand description

The payload section, typed, with carry-forward resolved.

The raw JSON is kept alongside: it is the source of truth for reproduction, and the only place vendor extensions live.

Implementations§

Source§

impl<'a> Payload<'a>

Source

pub const KNOWN_KEYS: [&'static str; 20]

Keys [OCMF Tab. 1–7] defines at the top level.

Source

pub fn format_version(&self) -> Option<&str>

FV — the format version, <major>.<minor>.

Source

pub fn gateway_id(&self) -> Option<&str>

GI — identification of the signing component.

Source

pub fn gateway_serial(&self) -> Option<&str>

GS — serial number of the signing component.

Source

pub fn gateway_version(&self) -> Option<&str>

GV — software version of the signing component.

Source

pub fn meter_vendor(&self) -> Option<&str>

MV — meter manufacturer.

Source

pub fn meter_model(&self) -> Option<&str>

MM — meter model.

Source

pub fn meter_serial(&self) -> Option<&str>

MS — meter serial number. Marked 1..1 by [OCMF Tab. 3] and absent from 89 % of real records.

Source

pub fn meter_firmware(&self) -> Option<&str>

MF — meter firmware version.

Source

pub fn identification_data(&self) -> Option<&str>

ID — the identification data, formatted per IT.

Source

pub fn tariff_text(&self) -> Option<&str>

TT — the tariff text, up to 250 characters of free text.

Source

pub fn charge_controller_firmware(&self) -> Option<&str>

CF — charge-controller firmware version (OCMF 1.3+).

Source

pub fn charge_point_id(&self) -> Option<&str>

CI — the charge point’s identifier.

Source

pub const fn pagination(&self) -> Option<Pagination>

PG — pagination.

None when the record wrote no PG, or wrote one that is not a context letter followed by digits. Both are reported; neither is a reason to refuse a record whose signature is still checkable.

Source

pub const fn identification_status(&self) -> Option<bool>

IS — whether a user was successfully assigned.

Source

pub const fn identification_level(&self) -> Option<IdentificationLevel<'a>>

IL — the overall status of the user assignment.

Source

pub fn identification_flags(&self) -> Option<&[IdentificationFlag<'a>]>

IF — detail flags of the user assignment.

Source

pub const fn identification_type(&self) -> Option<IdentificationType<'a>>

IT — the type of the identification data.

Source

pub const fn loss_compensation(&self) -> Option<&LossCompensation<'a>>

LC — cable-loss compensation parameters.

Source

pub const fn charge_point_id_type(&self) -> Option<ChargePointIdType<'a>>

CT — how the charge point is identified.

Source

pub fn readings(&self) -> &[Reading<'a>]

RD — the readings, with carry-forward resolved.

Source

pub const fn object(&self) -> &Object<'a>

The payload’s raw JSON — with one hole.

RD is moved into Self::readings while parsing rather than copied, so its member here is a null placeholder holding the array’s original span. Everything else is exactly as it was written. This exists to reach vendor extensions at the top level; each reading’s own JSON is on Reading::object.

Reproduction never goes through here: that is Record::payload_text, which is a slice of the input.

Source

pub fn marks_transaction_begin(&self) -> bool

Whether any reading marks the beginning of a transaction (TX = B) [OCMF Tab. 7].

Both transports need this and neither can share the other’s answer: the OCA application note puts a record holding both markers under Transaction.End, while the S.A.F.E. transparency container treats it as a complete value with no transaction at all. So the question is answered here and the two conventions are applied where they belong.

Source

pub fn marks_transaction_end(&self) -> bool

Whether any reading marks the end of a transaction, in any of the five spellings [OCMF Tab. 7].

Source

pub fn is_transaction(&self) -> bool

Whether this record refers to a transaction at all.

Fiscal records — readings taken outside any transaction — have no TX and no user assignment [OCMF Tab. 7].

Source

pub fn by_register<'r>(&'r self) -> Vec<RegisterSeries<'r, 'a>>

The readings grouped by register, in first-seen order.

Grouping happens after carry-forward, which is the whole point: LEM meters interleave an import and an export register in one record, and a naive first/last pairing matches an import begin with an export end.

Trait Implementations§

Source§

impl<'a> Clone for Payload<'a>

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<'a> Debug for Payload<'a>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl<'a> Forget for Payload<'a>

§

impl<'a> Freeze for Payload<'a>

§

impl<'a> Move for Payload<'a>

§

impl<'a> RefUnwindSafe for Payload<'a>

§

impl<'a> Send for Payload<'a>

§

impl<'a> Sync for Payload<'a>

§

impl<'a> Unpin for Payload<'a>

§

impl<'a> UnsafeUnpin for Payload<'a>

§

impl<'a> UnwindSafe for Payload<'a>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.