Skip to content

Commit

Permalink
Add very simple "Notification" message for different specific use-cases.
Browse files Browse the repository at this point in the history
  • Loading branch information
cjavad committed Jan 29, 2025
1 parent 8b582cb commit e3b0c06
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions simplyprint_ws_client/core/ws_protocol/messages.py
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,7 @@ class ClientMsgType(StrEnum):
LOGS_SENT = "logs_sent"
FILAMENT_SENSOR = "filament_sensor"
MATERIAL_DATA = "material_data"
NOTIFICATION = "notification"

def when_pending(self) -> bool:
# Allowed messages for a pending printer connection
Expand Down Expand Up @@ -845,3 +846,8 @@ def build(cls, state: PrinterState) -> TClientMsgDataGenerator:
def reset_changes(self, state: PrinterState, v: Optional[int] = None) -> None:
for material in state.material_data:
material.model_reset_changed()


class NotificationDataMsg(ClientMsg[Literal[ClientMsgType.NOTIFICATION]]):
def __init__(self, notification_type: Literal['simple'], contents: dict):
super().__init__(data={"type": notification_type, "contents": contents})

0 comments on commit e3b0c06

Please sign in to comment.