forked from genewildish/Mainline
- Add EventBus class with pub/sub messaging (thread-safe) - Add emitter Protocol classes (EventEmitter, Startable, Stoppable) - Add event emission to NtfyPoller (NtfyMessageEvent) - Add event emission to MicMonitor (MicLevelEvent) - Update StreamController to publish stream start/end events - Add comprehensive tests for eventbus and emitters modules
26 lines
618 B
Python
26 lines
618 B
Python
"""
|
|
Event emitter protocols - abstract interfaces for event-producing components.
|
|
"""
|
|
|
|
from collections.abc import Callable
|
|
from typing import Any, Protocol
|
|
|
|
|
|
class EventEmitter(Protocol):
|
|
"""Protocol for components that emit events."""
|
|
|
|
def subscribe(self, callback: Callable[[Any], None]) -> None: ...
|
|
def unsubscribe(self, callback: Callable[[Any], None]) -> None: ...
|
|
|
|
|
|
class Startable(Protocol):
|
|
"""Protocol for components that can be started."""
|
|
|
|
def start(self) -> Any: ...
|
|
|
|
|
|
class Stoppable(Protocol):
|
|
"""Protocol for components that can be stopped."""
|
|
|
|
def stop(self) -> None: ...
|