| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112 |
- """
- Audio Streaming Command Classes
- This module implements commands for audio streaming in the Trixy system.
- """
- from typing import Optional, Dict, Any
- from dataclasses import dataclass, field
- from .base import TrixyCommand, CommandResponse, ValidationError
- @dataclass
- class AudioStreamStartCommand(TrixyCommand):
- """Command to start audio streaming."""
-
- stream_type: str = field(default="input") # input, output, music
- satellite_id: str = field(default="")
- audio_format: Dict[str, Any] = field(default_factory=dict)
-
- def validate(self) -> bool:
- if self.stream_type not in ["input", "output", "music"]:
- raise ValidationError("Invalid stream_type")
- return True
-
- def get_command_name(self) -> str:
- return "AudioStreamStartCommand"
- @dataclass
- class AudioStreamStopCommand(TrixyCommand):
- """Command to stop audio streaming."""
-
- stream_type: str = field(default="input")
- satellite_id: str = field(default="")
-
- def validate(self) -> bool:
- return True
-
- def get_command_name(self) -> str:
- return "AudioStreamStopCommand"
- @dataclass
- class AudioDataCommand(TrixyCommand):
- """Command containing audio data."""
-
- audio_data: bytes = field(default=b"")
- format_info: Dict[str, Any] = field(default_factory=dict)
-
- def validate(self) -> bool:
- return True
-
- def get_command_name(self) -> str:
- return "AudioDataCommand"
- @dataclass
- class AudioConfigCommand(TrixyCommand):
- """Command to configure audio settings."""
-
- config_changes: Dict[str, Any] = field(default_factory=dict)
-
- def validate(self) -> bool:
- return True
-
- def get_command_name(self) -> str:
- return "AudioConfigCommand"
- @dataclass
- class AudioStreamStartResponse(CommandResponse):
- """Response to audio stream start command."""
-
- stream_started: bool = field(default=False)
-
- def validate(self) -> bool:
- return True
-
- def get_response_name(self) -> str:
- return "AudioStreamStartResponse"
- @dataclass
- class AudioStreamStopResponse(CommandResponse):
- """Response to audio stream stop command."""
-
- stream_stopped: bool = field(default=False)
-
- def validate(self) -> bool:
- return True
-
- def get_response_name(self) -> str:
- return "AudioStreamStopResponse"
- @dataclass
- class AudioConfigResponse(CommandResponse):
- """Response to audio config command."""
-
- config_applied: bool = field(default=False)
-
- def validate(self) -> bool:
- return True
-
- def get_response_name(self) -> str:
- return "AudioConfigResponse"
- __all__ = [
- "AudioStreamStartCommand", "AudioStreamStopCommand", "AudioDataCommand", "AudioConfigCommand",
- "AudioStreamStartResponse", "AudioStreamStopResponse", "AudioConfigResponse"
- ]
|