|
Wavelength
Privacy-focused, cross-platform, and open-source communication application
|
Singleton coordinator class acting as a facade for Wavelength session management. More...
#include <session_coordinator.h>
Signals | |
| void | activeWavelengthChanged (QString frequency) |
| Emitted when the active wavelength changes. Relayed from WavelengthStateManager. | |
| void | audioDataReceived (QString frequency, const QByteArray &audio_data) |
| Emitted when raw audio data is received. Relayed from WavelengthMessageService. | |
| void | authenticationFailed (QString frequency) |
| Emitted when authentication fails during join. Relayed from WavelengthJoiner. | |
| void | connectionError (const QString &error_message) |
| Emitted when a connection error occurs. Relayed from WavelengthCreator/Joiner. | |
| void | messageReceived (QString frequency, const QString &message) |
| Emitted when a message is received. Relayed from WavelengthMessageProcessor/Joiner. | |
| void | messageSent (QString frequency, const QString &message) |
| Emitted when a message is successfully sent. Relayed from WavelengthMessageService. | |
| void | pttDenied (QString frequency, QString reason) |
| Emitted when PTT transmission is denied. Relayed from WavelengthMessageService. | |
| void | pttGranted (QString frequency) |
| Emitted when PTT transmission is granted. Relayed from WavelengthMessageService. | |
| void | pttStartReceiving (QString frequency, QString sender_id) |
| Emitted when another user starts PTT transmission. Relayed from WavelengthMessageService. | |
| void | pttStopReceiving (QString frequency) |
| Emitted when another user stops PTT transmission. Relayed from WavelengthMessageService. | |
| void | remoteAudioAmplitudeUpdate (QString frequency, qreal amplitude) |
| Emitted when remote audio amplitude updates are received. Relayed from WavelengthMessageService. | |
| void | userKicked (QString frequency, const QString &reason) |
| Emitted when the current user is kicked from a frequency. Relayed from WavelengthMessageProcessor. | |
| void | wavelengthClosed (QString frequency) |
| Emitted when a wavelength is closed (by host or server). Relayed from multiple components. | |
| void | wavelengthCreated (QString frequency) |
| Emitted when a wavelength is successfully created. Relayed from WavelengthCreator. | |
| void | wavelengthJoined (QString frequency) |
| Emitted when a wavelength is successfully joined. Relayed from WavelengthJoiner. | |
| void | wavelengthLeft (QString frequency) |
| Emitted when the user leaves the active wavelength. Relayed from WavelengthLeaver. | |
Public Member Functions | |
| void | Initialize () |
| Initializes the coordinator and its underlying components. Connects signals between various Wavelength services and loads the application configuration. | |
| SessionCoordinator & | operator= (const SessionCoordinator &)=delete |
| Deleted assignment operator to prevent assignment. | |
| SessionCoordinator (const SessionCoordinator &)=delete | |
| Deleted copy constructor to prevent copying. | |
Static Public Member Functions | |
| static void | CloseWavelength (const QString &frequency) |
| Closes a specific wavelength (only if the current user is the host). Unregisters the wavelength locally and delegates the call to WavelengthLeaver. | |
| static bool | CreateWavelength (const QString &frequency, bool is_password_protected, const QString &password) |
| Initiates the creation of a new wavelength. Delegates the call to WavelengthCreator and registers the wavelength as joined locally upon initiation. | |
| static QString | GetActiveWavelength () |
| Gets the frequency identifier of the currently active wavelength. Delegates the call to WavelengthStateManager. | |
| static SessionCoordinator * | GetInstance () |
| Gets the singleton instance of the WavelengthSessionCoordinator. | |
| static int | GetJoinedWavelengthCount () |
| Gets the count of wavelengths the user is currently joined to. Delegates the call to WavelengthStateManager. | |
| static QList< QString > | GetJoinedWavelengths () |
| Gets a list of frequencies the user is currently joined to. Delegates the call to WavelengthStateManager. | |
| static QString | GetRelayServerAddress () |
| Gets the configured relay server address. Delegates the call to WavelengthConfig. | |
| static QString | GetRelayServerUrl () |
| Gets the full URL (ws://address:port) of the relay server. Delegates the call to WavelengthConfig. | |
| static WavelengthInfo | GetWavelengthInfo (const QString &frequency, bool *is_host=nullptr) |
| Retrieves detailed information about a specific wavelength. Delegates the call to WavelengthStateManager. | |
| static bool | IsActiveWavelengthHost () |
| Checks if the current user is the host of the currently active wavelength. Delegates the call to WavelengthStateManager. | |
| static bool | IsWavelengthConnected (const QString &frequency) |
| Checks if the WebSocket connection for a specific wavelength is established and valid. Delegates the call to WavelengthStateManager. | |
| static bool | IsWavelengthHost (const QString &frequency) |
| Checks if the current user is the host of a specific wavelength. Delegates the call to WavelengthStateManager. | |
| static bool | IsWavelengthJoined (const QString &frequency) |
| Checks if the user is considered joined to a specific wavelength (based on registry presence). Delegates the call to WavelengthStateManager. | |
| static bool | IsWavelengthPasswordProtected (const QString &frequency) |
| Checks if a specific wavelength is password protected. Delegates the call to WavelengthStateManager. | |
| static bool | JoinWavelength (const QString &frequency, const QString &password=QString()) |
| Initiates joining an existing wavelength. Delegates the call to WavelengthJoiner and registers the wavelength as joined locally upon initiation. | |
| static void | LeaveWavelength () |
| Leaves the currently active wavelength. Unregisters the wavelength locally and delegates the call to WavelengthLeaver. | |
| static bool | SendFile (const QString &file_path) |
| Sends a file to the currently active wavelength. Delegates the call to WavelengthMessageService. | |
| static bool | SendMessage (const QString &message) |
| Sends a text message to the currently active wavelength. Delegates the call to WavelengthMessageService. | |
| static void | SetActiveWavelength (const QString &frequency) |
| Sets the specified frequency as the currently active wavelength. Delegates the call to WavelengthStateManager. | |
| static void | SetRelayServerAddress (const QString &address) |
| Sets the relay server address in the configuration. Delegates the call to WavelengthConfig. | |
Private Slots | |
| void | onActiveWavelengthChanged (const QString &frequency) |
| Slot triggered when the active wavelength changes. Relays the signal and publishes the event via WavelengthEventBroker. | |
| void | onAudioDataReceived (const QString &frequency, const QByteArray &audio_data) |
| Relays the audioDataReceived signal. | |
| void | onAuthenticationFailed (const QString &frequency) |
| Slot triggered when authentication fails during join. Relays the signal and publishes the event via WavelengthEventBroker. | |
| static void | onConfigChanged (const QString &key) |
| Slot triggered when a configuration setting changes. Logs the change. | |
| void | onConnectionError (const QString &errorMessage) |
| Slot triggered when a connection error occurs. Relays the signal and publishes the event via WavelengthEventBroker. | |
| void | onMessageReceived (const QString &frequency, const QString &message) |
| Slot triggered when a message is received. Relays the signal and publishes the event via WavelengthEventBroker. | |
| void | onMessageSent (const QString &frequency, const QString &message) |
| Slot triggered when a message is sent. Relays the signal and publishes the event via WavelengthEventBroker. | |
| void | onPttDenied (const QString &frequency, const QString &reason) |
| Relays the pttDenied signal. | |
| void | onPttGranted (const QString &frequency) |
| Relays the pttGranted signal. | |
| void | onPttStartReceiving (const QString &frequency, const QString &sender_id) |
| Relays the pttStartReceiving signal. | |
| void | onPttStopReceiving (const QString &frequency) |
| Relays the pttStopReceiving signal. | |
| void | onRemoteAudioAmplitudeUpdate (const QString &frequency, const qreal amplitude) |
| Relays the remoteAudioAmplitudeUpdate signal. | |
| void | onWavelengthClosed (const QString &frequency) |
| Slot triggered when a wavelength is closed. Relays the signal and publishes the event via WavelengthEventBroker. | |
| void | onWavelengthCreated (const QString &frequency) |
| Slot triggered when a wavelength is created. Relays the signal and publishes the event via WavelengthEventBroker. | |
| void | onWavelengthJoined (const QString &frequency) |
| Slot triggered when a wavelength is joined. Relays the signal and publishes the event via WavelengthEventBroker. | |
| void | onWavelengthLeft (const QString &frequency) |
| Slot triggered when the active wavelength is left. Relays the signal and publishes the event via WavelengthEventBroker. | |
Private Member Functions | |
| void | ConnectSignals () |
| Connects signals between the various Wavelength components. Called during Initialize(). | |
| SessionCoordinator (QObject *parent=nullptr) | |
| Private constructor to enforce the singleton pattern. | |
| ~SessionCoordinator () override=default | |
| Private destructor. | |
Static Private Member Functions | |
| static void | LoadConfig () |
| Loads the application configuration using WavelengthConfig. Sets default values if the configuration file doesn't exist. Called during Initialize(). | |
Singleton coordinator class acting as a facade for Wavelength session management.
This class simplifies interactions with various Wavelength components (Creator, Joiner, Leaver, MessageService, StateManager, Config, EventBroker) by providing a unified interface. It handles the initialization sequence, connects signals between components, and forwards events and actions. It also publishes events to the WavelengthEventBroker for decoupling.
|
delete |
Deleted copy constructor to prevent copying.
|
inlineexplicitprivate |
Private constructor to enforce the singleton pattern.
| parent | Optional parent QObject. |
|
overrideprivatedefault |
Private destructor.
|
signal |
Emitted when the active wavelength changes. Relayed from WavelengthStateManager.
|
signal |
Emitted when raw audio data is received. Relayed from WavelengthMessageService.
|
signal |
Emitted when authentication fails during join. Relayed from WavelengthJoiner.
|
static |
Closes a specific wavelength (only if the current user is the host). Unregisters the wavelength locally and delegates the call to WavelengthLeaver.
| frequency | The frequency name to close. |
|
signal |
Emitted when a connection error occurs. Relayed from WavelengthCreator/Joiner.
|
private |
Connects signals between the various Wavelength components. Called during Initialize().
|
static |
Initiates the creation of a new wavelength. Delegates the call to WavelengthCreator and registers the wavelength as joined locally upon initiation.
| frequency | The desired frequency name. |
| is_password_protected | True if the wavelength should require a password. |
| password | The password to set (if protected). |
|
static |
Gets the frequency identifier of the currently active wavelength. Delegates the call to WavelengthStateManager.
|
inlinestatic |
Gets the singleton instance of the WavelengthSessionCoordinator.
|
static |
Gets the count of wavelengths the user is currently joined to. Delegates the call to WavelengthStateManager.
|
static |
Gets a list of frequencies the user is currently joined to. Delegates the call to WavelengthStateManager.
|
static |
Gets the configured relay server address. Delegates the call to WavelengthConfig.
|
static |
Gets the full URL (ws://address:port) of the relay server. Delegates the call to WavelengthConfig.
|
static |
Retrieves detailed information about a specific wavelength. Delegates the call to WavelengthStateManager.
| frequency | The frequency identifier. |
| is_host | Optional output parameter; set to true if the current user is the host. |
| void SessionCoordinator::Initialize | ( | ) |
Initializes the coordinator and its underlying components. Connects signals between various Wavelength services and loads the application configuration.
|
static |
Checks if the current user is the host of the currently active wavelength. Delegates the call to WavelengthStateManager.
|
static |
Checks if the WebSocket connection for a specific wavelength is established and valid. Delegates the call to WavelengthStateManager.
| frequency | The frequency identifier. |
|
static |
Checks if the current user is the host of a specific wavelength. Delegates the call to WavelengthStateManager.
| frequency | The frequency identifier. |
|
static |
Checks if the user is considered joined to a specific wavelength (based on registry presence). Delegates the call to WavelengthStateManager.
| frequency | The frequency identifier. |
|
static |
Checks if a specific wavelength is password protected. Delegates the call to WavelengthStateManager.
| frequency | The frequency identifier. |
|
static |
Initiates joining an existing wavelength. Delegates the call to WavelengthJoiner and registers the wavelength as joined locally upon initiation.
| frequency | The frequency name to join. |
| password | Optional password for the wavelength. |
|
static |
Leaves the currently active wavelength. Unregisters the wavelength locally and delegates the call to WavelengthLeaver.
|
staticprivate |
Loads the application configuration using WavelengthConfig. Sets default values if the configuration file doesn't exist. Called during Initialize().
|
signal |
Emitted when a message is received. Relayed from WavelengthMessageProcessor/Joiner.
|
signal |
Emitted when a message is successfully sent. Relayed from WavelengthMessageService.
|
privateslot |
Slot triggered when the active wavelength changes. Relays the signal and publishes the event via WavelengthEventBroker.
| frequency | The new active frequency. |
|
inlineprivateslot |
Relays the audioDataReceived signal.
|
privateslot |
Slot triggered when authentication fails during join. Relays the signal and publishes the event via WavelengthEventBroker.
| frequency | The frequency for which authentication failed. |
|
inlinestaticprivateslot |
Slot triggered when a configuration setting changes. Logs the change.
| key | The configuration key that changed. |
|
privateslot |
Slot triggered when a connection error occurs. Relays the signal and publishes the event via WavelengthEventBroker.
| errorMessage | Description of the error. |
|
privateslot |
Slot triggered when a message is received. Relays the signal and publishes the event via WavelengthEventBroker.
| frequency | The frequency the message belongs to. |
| message | The formatted message content. |
|
privateslot |
Slot triggered when a message is sent. Relays the signal and publishes the event via WavelengthEventBroker.
| frequency | The frequency the message was sent to. |
| message | The formatted message content. |
|
inlineprivateslot |
Relays the pttDenied signal.
|
inlineprivateslot |
Relays the pttGranted signal.
|
inlineprivateslot |
Relays the pttStartReceiving signal.
|
inlineprivateslot |
Relays the pttStopReceiving signal.
|
inlineprivateslot |
Relays the remoteAudioAmplitudeUpdate signal.
|
privateslot |
Slot triggered when a wavelength is closed. Relays the signal and publishes the event via WavelengthEventBroker.
| frequency | The frequency closed. |
|
privateslot |
Slot triggered when a wavelength is created. Relays the signal and publishes the event via WavelengthEventBroker.
| frequency | The frequency created. |
|
privateslot |
Slot triggered when a wavelength is joined. Relays the signal and publishes the event via WavelengthEventBroker.
| frequency | The frequency joined. |
|
privateslot |
Slot triggered when the active wavelength is left. Relays the signal and publishes the event via WavelengthEventBroker.
| frequency | The frequency left. |
|
delete |
Deleted assignment operator to prevent assignment.
|
signal |
Emitted when PTT transmission is denied. Relayed from WavelengthMessageService.
|
signal |
Emitted when PTT transmission is granted. Relayed from WavelengthMessageService.
|
signal |
Emitted when another user starts PTT transmission. Relayed from WavelengthMessageService.
|
signal |
Emitted when another user stops PTT transmission. Relayed from WavelengthMessageService.
|
signal |
Emitted when remote audio amplitude updates are received. Relayed from WavelengthMessageService.
|
static |
Sends a file to the currently active wavelength. Delegates the call to WavelengthMessageService.
| file_path | The local path to the file. |
|
static |
Sends a text message to the currently active wavelength. Delegates the call to WavelengthMessageService.
| message | The text message content. |
|
static |
Sets the specified frequency as the currently active wavelength. Delegates the call to WavelengthStateManager.
| frequency | The frequency identifier to set as active. |
|
static |
Sets the relay server address in the configuration. Delegates the call to WavelengthConfig.
| address | The new server address string. |
|
signal |
Emitted when the current user is kicked from a frequency. Relayed from WavelengthMessageProcessor.
|
signal |
Emitted when a wavelength is closed (by host or server). Relayed from multiple components.
|
signal |
Emitted when a wavelength is successfully created. Relayed from WavelengthCreator.
|
signal |
Emitted when a wavelength is successfully joined. Relayed from WavelengthJoiner.
|
signal |
Emitted when the user leaves the active wavelength. Relayed from WavelengthLeaver.