From 10772ef19875f239fa8df0a7e6e2bc41e8eac26b Mon Sep 17 00:00:00 2001 From: Andrew Rutherfoord Date: Mon, 12 May 2025 16:56:50 +0200 Subject: [PATCH 1/2] Added PEBC Message classes to the S2 Parser TYPE_TO_MESSAGE_CLASS dict --- src/s2python/s2_parser.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/s2python/s2_parser.py b/src/s2python/s2_parser.py index e5b7ea1..04376ce 100644 --- a/src/s2python/s2_parser.py +++ b/src/s2python/s2_parser.py @@ -24,6 +24,9 @@ FRBCTimerStatus, FRBCUsageForecast, ) +from s2python.pebc import ( + PEBCPowerConstraints, +) from s2python.ppbc import PPBCScheduleInstruction from s2python.message import S2Message @@ -48,6 +51,7 @@ "FRBC.TimerStatus": FRBCTimerStatus, "FRBC.UsageForecast": FRBCUsageForecast, "PPBC.ScheduleInstruction": PPBCScheduleInstruction, + "PEBC.PowerConstraints": PEBCPowerConstraints, "Handshake": Handshake, "HandshakeResponse": HandshakeResponse, "InstructionStatusUpdate": InstructionStatusUpdate, @@ -90,7 +94,9 @@ def parse_as_any_message(unparsed_message: Union[dict, str, bytes]) -> S2Message return TYPE_TO_MESSAGE_CLASS[message_type].model_validate(message_json) @staticmethod - def parse_as_message(unparsed_message: Union[dict, str, bytes], as_message: Type[M]) -> M: + def parse_as_message( + unparsed_message: Union[dict, str, bytes], as_message: Type[M] + ) -> M: """Parse the message to a specific S2 python message. :param unparsed_message: The message as a JSON-formatted string or as a JSON-parsed dictionary. From b732ac6282271019e3664b41b52f3ad50ea7b9fe Mon Sep 17 00:00:00 2001 From: Andrew Rutherfoord Date: Wed, 14 May 2025 15:36:24 +0200 Subject: [PATCH 2/2] Added PEBC.EnergyConstraint and PEBC.Instruction message types to S2 parser --- src/s2python/s2_parser.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/s2python/s2_parser.py b/src/s2python/s2_parser.py index 04376ce..c5f6c14 100644 --- a/src/s2python/s2_parser.py +++ b/src/s2python/s2_parser.py @@ -24,9 +24,7 @@ FRBCTimerStatus, FRBCUsageForecast, ) -from s2python.pebc import ( - PEBCPowerConstraints, -) +from s2python.pebc import PEBCPowerConstraints, PEBCEnergyConstraint, PEBCInstruction from s2python.ppbc import PPBCScheduleInstruction from s2python.message import S2Message @@ -52,6 +50,8 @@ "FRBC.UsageForecast": FRBCUsageForecast, "PPBC.ScheduleInstruction": PPBCScheduleInstruction, "PEBC.PowerConstraints": PEBCPowerConstraints, + "PEBC.Instruction": PEBCInstruction, + "PEBC.EnergyConstraint": PEBCEnergyConstraint, "Handshake": Handshake, "HandshakeResponse": HandshakeResponse, "InstructionStatusUpdate": InstructionStatusUpdate,