generated from pufereq/python-template
Compare commits
3 Commits
a805ccf38e
...
0.9.0
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
3d5a1e95da | ||
|
4bba344e8a
|
|||
|
29bf802356
|
@@ -2,6 +2,13 @@
|
|||||||
|
|
||||||
All notable changes to this project will be documented in this file.
|
All notable changes to this project will be documented in this file.
|
||||||
|
|
||||||
|
## [0.9.0] - 2026-03-05
|
||||||
|
|
||||||
|
### Features
|
||||||
|
|
||||||
|
- [`4bba344`](https://gitea.pufereq.pl/judas/judas_protocol/commit/4bba344e8abcd64947c06b371ae84ca8f0591a9c) **message.py**: add `Message.Telemetry` factory class
|
||||||
|
- [`29bf802`](https://gitea.pufereq.pl/judas/judas_protocol/commit/29bf80235631f069be519e3e3ac0772c9a9d44db) **types.py**: add `TELEMETRY` category
|
||||||
|
|
||||||
## [0.8.0] - 2026-03-03
|
## [0.8.0] - 2026-03-03
|
||||||
|
|
||||||
### Features
|
### Features
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ build-backend = "uv_build"
|
|||||||
|
|
||||||
[project]
|
[project]
|
||||||
name = "judas_protocol"
|
name = "judas_protocol"
|
||||||
version = "0.8.0"
|
version = "0.9.0"
|
||||||
description = "The judas protocol"
|
description = "The judas protocol"
|
||||||
readme = "README.md"
|
readme = "README.md"
|
||||||
authors = []
|
authors = []
|
||||||
|
|||||||
@@ -5,7 +5,12 @@ import json
|
|||||||
import uuid
|
import uuid
|
||||||
from typing import Any, override
|
from typing import Any, override
|
||||||
|
|
||||||
from judas_protocol.types import ActionType, Category, ControlAction
|
from judas_protocol.types import (
|
||||||
|
ActionType,
|
||||||
|
Category,
|
||||||
|
ControlAction,
|
||||||
|
TelemetryAction,
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
class Message:
|
class Message:
|
||||||
@@ -108,6 +113,66 @@ class Message:
|
|||||||
ack_required=True,
|
ack_required=True,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
class Telemetry:
|
||||||
|
"""TELEMETRY category message factory methods."""
|
||||||
|
|
||||||
|
@staticmethod
|
||||||
|
def initial(payload: dict[str, Any]) -> Message:
|
||||||
|
"""Create an INITIAL telemetry message.
|
||||||
|
|
||||||
|
Args:
|
||||||
|
payload (dict[str, Any]): The payload of the message.
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
Message: The created INITIAL telemetry message.
|
||||||
|
"""
|
||||||
|
return Message(
|
||||||
|
id_=None,
|
||||||
|
category=Category.TELEMETRY,
|
||||||
|
action=TelemetryAction.INITIAL,
|
||||||
|
payload=payload,
|
||||||
|
acknowledged=False,
|
||||||
|
ack_required=True,
|
||||||
|
)
|
||||||
|
|
||||||
|
@staticmethod
|
||||||
|
def update(payload: dict[str, Any]) -> Message:
|
||||||
|
"""Create an UPDATE telemetry message.
|
||||||
|
|
||||||
|
Args:
|
||||||
|
payload (dict[str, Any]): The payload of the message.
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
Message: The created UPDATE telemetry message.
|
||||||
|
"""
|
||||||
|
return Message(
|
||||||
|
id_=None,
|
||||||
|
category=Category.TELEMETRY,
|
||||||
|
action=TelemetryAction.UPDATE,
|
||||||
|
payload=payload,
|
||||||
|
acknowledged=False,
|
||||||
|
ack_required=False,
|
||||||
|
)
|
||||||
|
|
||||||
|
@staticmethod
|
||||||
|
def on_demand(payload: dict[str, Any]) -> Message:
|
||||||
|
"""Create an ON_DEMAND telemetry message.
|
||||||
|
|
||||||
|
Args:
|
||||||
|
payload (dict[str, Any]): The payload of the message.
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
Message: The created ON_DEMAND telemetry message.
|
||||||
|
"""
|
||||||
|
return Message(
|
||||||
|
id_=None,
|
||||||
|
category=Category.TELEMETRY,
|
||||||
|
action=TelemetryAction.ON_DEMAND,
|
||||||
|
payload=payload,
|
||||||
|
acknowledged=False,
|
||||||
|
ack_required=True,
|
||||||
|
)
|
||||||
|
|
||||||
def to_dict(self) -> dict[str, Any]:
|
def to_dict(self) -> dict[str, Any]:
|
||||||
"""Convert the message to a dictionary.
|
"""Convert the message to a dictionary.
|
||||||
|
|
||||||
|
|||||||
@@ -5,14 +5,21 @@ from __future__ import annotations
|
|||||||
|
|
||||||
from enum import Enum
|
from enum import Enum
|
||||||
|
|
||||||
type ActionType = ControlAction
|
type ActionType = ControlAction | TelemetryAction
|
||||||
|
|
||||||
|
|
||||||
class Category(str, Enum):
|
class Category(str, Enum):
|
||||||
CONTROL = "control"
|
CONTROL = "control"
|
||||||
|
TELEMETRY = "telemetry"
|
||||||
|
|
||||||
|
|
||||||
class ControlAction(str, Enum):
|
class ControlAction(str, Enum):
|
||||||
HELLO = "hello"
|
HELLO = "hello"
|
||||||
ACK = "ack"
|
ACK = "ack"
|
||||||
CLOSE = "close"
|
CLOSE = "close"
|
||||||
|
|
||||||
|
|
||||||
|
class TelemetryAction(str, Enum):
|
||||||
|
INITIAL = "initial"
|
||||||
|
UPDATE = "update"
|
||||||
|
ON_DEMAND = "on_demand"
|
||||||
|
|||||||
Reference in New Issue
Block a user