Skip to content

Commit

Permalink
Add pause-satellite
Browse files Browse the repository at this point in the history
  • Loading branch information
synesthesiam committed Jan 18, 2024
1 parent 4300a19 commit ceab124
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 2 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

- Add `version` to info artifacts
- Use Python package version in Wyoming JSON header
- Add `pause-satellite` message

## 1.5.0

Expand Down
11 changes: 11 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -214,6 +214,17 @@ Play audio stream.

* `played` - response when audio finishes playing

### Voice Satellite

Control of one or more remote voice satellites connected to a central server.

* `run-satellite` - informs satellite that server is ready to run pipelines
* `pause-satellite` - informs satellite that server is not ready anymore to run pipelines
* `satellite-connected` - satellite has connected to the server
* `satellite-disconnected` - satellite has been disconnected from the server
* `streaming-started` - satellite has started streaming audio to the server
* `streaming-stopped` - satellite has stopped streaming audio to the server


## Event Flow

Expand Down
1 change: 0 additions & 1 deletion tests/test_event.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
read_event,
write_event,
)
from wyoming.info import Satellite, Attribution

PAYLOAD = b"test\npayload"
DATA = {"test": "data"}
Expand Down
19 changes: 18 additions & 1 deletion wyoming/satellite.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
from .event import Event, Eventable

_RUN_SATELLITE_TYPE = "run-satellite"
_PAUSE_SATELLITE_TYPE = "pause-satellite"
_STREAMING_STARTED_TYPE = "streaming-started"
_STREAMING_STOPPED_TYPE = "streaming-stopped"
_SATELLITE_CONNECTED_TYPE = "satellite-connected"
Expand All @@ -12,7 +13,7 @@

@dataclass
class RunSatellite(Eventable):
"""Tell satellite to start running."""
"""Informs the satellite that the server is ready to run a pipeline."""

@staticmethod
def is_type(event_type: str) -> bool:
Expand All @@ -26,6 +27,22 @@ def from_event(event: Event) -> "RunSatellite":
return RunSatellite()


@dataclass
class PauseSatellite(Eventable):
"""Informs the satellite that the server is not ready to run a pipeline."""

@staticmethod
def is_type(event_type: str) -> bool:
return event_type == _PAUSE_SATELLITE_TYPE

def event(self) -> Event:
return Event(type=_PAUSE_SATELLITE_TYPE)

@staticmethod
def from_event(event: Event) -> "PauseSatellite":
return PauseSatellite()


@dataclass
class StreamingStarted(Eventable):
"""Satellite has started streaming audio to server."""
Expand Down

0 comments on commit ceab124

Please sign in to comment.