recording.py 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. # -*- coding: utf-8 -*-
  2. """
  3. Recording-bezogene Netzwerk-Befehle.
  4. """
  5. from dataclasses import dataclass
  6. from trixy_core.network.cmd.base import CommandMessage
  7. @dataclass
  8. class RecordingStart(CommandMessage):
  9. """
  10. Aufnahme starten.
  11. Wird vom Server zum Satellite gesendet, um die Audio-Aufnahme zu starten.
  12. """
  13. conversation_id: str = ""
  14. max_duration_seconds: float = 60.0
  15. silence_timeout_seconds: float = 3.0
  16. @dataclass
  17. class RecordingStop(CommandMessage):
  18. """
  19. Aufnahme stoppen.
  20. Wird vom Server zum Satellite gesendet, um die Aufnahme zu beenden.
  21. """
  22. conversation_id: str = ""
  23. reason: str = "" # timeout, command, error
  24. @dataclass
  25. class RecordingDone(CommandMessage):
  26. """
  27. Aufnahme abgeschlossen.
  28. Wird vom Satellite zum Server gesendet, wenn die Aufnahme beendet wurde.
  29. """
  30. conversation_id: str = ""
  31. duration_seconds: float = 0.0
  32. total_samples: int = 0
  33. ended_by: str = "" # silence, timeout, user, error
  34. @dataclass
  35. class SatelliteRecordStart(CommandMessage):
  36. """Server-gesteuerte Aufnahme starten (Server → Satellite)."""
  37. recording_id: str = ""
  38. timeout_seconds: float = 300.0
  39. @dataclass
  40. class SatelliteRecordStop(CommandMessage):
  41. """Server-gesteuerte Aufnahme stoppen (Server → Satellite)."""
  42. recording_id: str = ""
  43. reason: str = "" # "manual", "timeout"
  44. @dataclass
  45. class SatelliteRecordStopped(CommandMessage):
  46. """Bestätigung: Aufnahme beendet (Satellite → Server)."""
  47. recording_id: str = ""
  48. reason: str = "" # "manual", "wakeword", "timeout"
  49. duration_seconds: float = 0.0