#[non_exhaustive]pub enum Message {
Show 36 variants
Handshake(Handshake),
HandshakeResponse(HandshakeResponse),
ResourceManagerDetails(Box<ResourceManagerDetails>),
SelectControlType(SelectControlType),
SessionRequest(SessionRequest),
ReceptionStatus(ReceptionStatus),
InstructionStatusUpdate(InstructionStatusUpdate),
PowerMeasurement(PowerMeasurement),
PowerForecast(Box<PowerForecast>),
RevokeObject(RevokeObject),
PebcPowerConstraints(Box<PowerConstraints>),
PebcEnergyConstraint(Box<EnergyConstraint>),
PebcInstruction(Box<Instruction>),
PpbcPowerProfileDefinition(Box<PowerProfileDefinition>),
PpbcPowerProfileStatus(Box<PowerProfileStatus>),
PpbcScheduleInstruction(Box<ScheduleInstruction>),
PpbcStartInterruptionInstruction(Box<StartInterruptionInstruction>),
PpbcEndInterruptionInstruction(Box<EndInterruptionInstruction>),
OmbcSystemDescription(Box<SystemDescription>),
OmbcStatus(Box<Status>),
OmbcTimerStatus(TimerStatus),
OmbcInstruction(Box<Instruction>),
FrbcSystemDescription(Box<SystemDescription>),
FrbcStorageStatus(StorageStatus),
FrbcActuatorStatus(Box<ActuatorStatus>),
FrbcTimerStatus(Box<TimerStatus>),
FrbcLeakageBehaviour(Box<LeakageBehaviour>),
FrbcUsageForecast(Box<UsageForecast>),
FrbcFillLevelTargetProfile(Box<FillLevelTargetProfile>),
FrbcInstruction(Box<Instruction>),
DdbcSystemDescription(Box<SystemDescription>),
DdbcActuatorStatus(Box<ActuatorStatus>),
DdbcTimerStatus(Box<TimerStatus>),
DdbcAverageDemandRateForecast(Box<AverageDemandRateForecast>),
DdbcPresentDemandStatus(PresentDemandStatus),
DdbcInstruction(Box<Instruction>),
}Expand description
Any S2 message.
The enum is internally tagged by message_type, exactly as the wire is, so
serialising a Message produces a complete S2 message and deserialising one accepts
any of the 36.
use s2_kit::{Message, types::frbc};
let json = r#"{"message_type":"FRBC.StorageStatus",
"message_id":"aaaaaaaa-0000-0000-0000-000000000001",
"present_fill_level":52.0}"#;
let message: Message = serde_json::from_str(json)?;
match &message {
Message::FrbcStorageStatus(s) => assert_eq!(s.present_fill_level, 52.0),
_ => unreachable!(),
}Large payloads are boxed so that the enum stays small enough to pass by value and to
keep a queue of pending messages compact; From is implemented for every payload
type and does the boxing for you.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Handshake(Handshake)
A node announcing its role and the versions it speaks.
HandshakeResponse(HandshakeResponse)
The CEM’s choice of version.
ResourceManagerDetails(Box<ResourceManagerDetails>)
Everything static about a resource.
SelectControlType(SelectControlType)
The CEM activating a control type.
SessionRequest(SessionRequest)
Either side asking for the session to end or restart.
ReceptionStatus(ReceptionStatus)
The answer every other message gets.
InstructionStatusUpdate(InstructionStatusUpdate)
What became of an instruction.
PowerMeasurement(PowerMeasurement)
A measured power.
PowerForecast(Box<PowerForecast>)
An expected power.
RevokeObject(RevokeObject)
Withdrawing an object published earlier.
PebcPowerConstraints(Box<PowerConstraints>)
The bounds within which the CEM may set an envelope.
PebcEnergyConstraint(Box<EnergyConstraint>)
How much energy must still flow over a period.
PebcInstruction(Box<Instruction>)
The envelope the CEM wants followed.
PpbcPowerProfileDefinition(Box<PowerProfileDefinition>)
The task, its window, and every way of performing it.
PpbcPowerProfileStatus(Box<PowerProfileStatus>)
How every container of a profile is getting on.
PpbcScheduleInstruction(Box<ScheduleInstruction>)
The CEM choosing a sequence and a start time.
PpbcStartInterruptionInstruction(Box<StartInterruptionInstruction>)
The CEM pausing a running sequence.
PpbcEndInterruptionInstruction(Box<EndInterruptionInstruction>)
The CEM resuming an interrupted sequence.
OmbcSystemDescription(Box<SystemDescription>)
The state machine.
OmbcStatus(Box<Status>)
Which mode the device is in.
OmbcTimerStatus(TimerStatus)
When one of its timers finishes.
OmbcInstruction(Box<Instruction>)
The CEM asking for a mode change.
FrbcSystemDescription(Box<SystemDescription>)
The storage and every actuator that can move it.
FrbcStorageStatus(StorageStatus)
How full the store is.
FrbcActuatorStatus(Box<ActuatorStatus>)
Which mode an actuator is in.
FrbcTimerStatus(Box<TimerStatus>)
When one of an actuator’s timers finishes.
FrbcLeakageBehaviour(Box<LeakageBehaviour>)
The store’s standing losses.
FrbcUsageForecast(Box<UsageForecast>)
What the user is expected to take out of the store.
FrbcFillLevelTargetProfile(Box<FillLevelTargetProfile>)
Fill levels the CEM should aim for.
FrbcInstruction(Box<Instruction>)
The CEM asking an actuator to change mode.
DdbcSystemDescription(Box<SystemDescription>)
Every actuator that can meet the demand.
DdbcActuatorStatus(Box<ActuatorStatus>)
Which mode an actuator is in.
DdbcTimerStatus(Box<TimerStatus>)
When one of an actuator’s timers finishes.
DdbcAverageDemandRateForecast(Box<AverageDemandRateForecast>)
What the system expects to be asked for.
DdbcPresentDemandStatus(PresentDemandStatus)
The demand that must be satisfied right now. New in S2 JSON v1.0.0.
DdbcInstruction(Box<Instruction>)
The CEM asking an actuator to change mode.
Implementations§
Source§impl Message
impl Message
Sourcepub fn id(&self) -> Option<Id>
pub fn id(&self) -> Option<Id>
This message’s own identifier.
None for ReceptionStatus, which has none — it names the message it is about
instead, via subject_message_id.
Sourcepub fn subject_message_id(&self) -> Option<Id>
pub fn subject_message_id(&self) -> Option<Id>
The message a ReceptionStatus is about, if this is one.
Sourcepub fn instruction_id(&self) -> Option<Id>
pub fn instruction_id(&self) -> Option<Id>
The instruction’s own identifier, if this message is an instruction.
This is not the message_id: an InstructionStatusUpdate names this one.
Sourcepub fn revokable_id(&self) -> Option<(RevokableObjects, Id)>
pub fn revokable_id(&self) -> Option<(RevokableObjects, Id)>
The identifier of the object this message publishes, if it is one a
RevokeObject could later withdraw.
Sourcepub const fn control_type(&self) -> Option<ControlType>
pub const fn control_type(&self) -> Option<ControlType>
The control type this message belongs to, if any.
Sourcepub const fn is_instruction(&self) -> bool
pub const fn is_instruction(&self) -> bool
Whether this message is an instruction.