1#ifndef WAVELENGTH_MESSAGE_PROCESSOR_H
2#define WAVELENGTH_MESSAGE_PROCESSOR_H
51 return frequency1 == frequency2;
90 void ProcessMessageContent(
const QJsonObject &message_object,
const QString &frequency,
const QString &message_id);
107 void ProcessUserJoined(
const QJsonObject &message_object,
const QString &frequency);
115 void ProcessUserLeft(
const QJsonObject &message_object,
const QString &frequency);
~MessageProcessor() override=default
Private destructor.
void pttStartReceiving(QString frequency, QString sender_id)
Emitted when another user starts transmitting audio on the frequency.
static MessageProcessor * GetInstance()
Gets the singleton instance of the MessageProcessor.
Definition message_processor.h:28
void ProcessMessageContent(const QJsonObject &message_object, const QString &frequency, const QString &message_id)
Processes messages of type "message" or "send_message". Checks for duplicates, handles attachments (s...
Definition message_processor.cpp:99
void messageReceived(QString frequency, const QString &formatted_message)
Emitted when a regular chat message (text or attachment placeholder) is processed.
void systemMessage(QString frequency, const QString &formatted_message)
Emitted when a system event message (e.g., user join/leave) is processed.
static bool AreFrequenciesEqual(const QString &frequency1, const QString &frequency2)
Compares two frequency strings for equality. Simple string comparison.
Definition message_processor.h:50
void pttStopReceiving(QString frequency)
Emitted when the currently transmitting user stops sending audio.
void wavelengthClosed(QString frequency)
Emitted when a wavelength is closed (either by host or server command).
MessageProcessor & operator=(const MessageProcessor &)=delete
Deleted assignment operator to prevent assignment.
void pttDenied(QString frequency, QString reason)
Emitted when the server denies permission to transmit audio (Push-to-Talk).
void audioDataReceived(QString frequency, const QByteArray &audio_data)
Emitted when raw audio data is received via a binary WebSocket message.
void ProcessWavelengthClosed(const QString &frequency)
Processes messages indicating a wavelength was closed (e.g., "wavelength_closed", "close_wavelength" ...
Definition message_processor.cpp:148
void userKicked(QString frequency, const QString &reason)
Emitted when the current user is kicked from a frequency.
void ProcessSystemCommand(const QJsonObject &message_object, const QString &frequency)
Processes messages of type "system_command". Handles commands like "ping", "close_wavelength",...
Definition message_processor.cpp:126
void ProcessUserJoined(const QJsonObject &message_object, const QString &frequency)
Processes messages of type "user_joined". Formats a system message indicating a user joined and emits...
Definition message_processor.cpp:134
void ProcessUserLeft(const QJsonObject &message_object, const QString &frequency)
Processes messages of type "user_left". Formats a system message indicating a user left and emits the...
Definition message_processor.cpp:141
void pttGranted(QString frequency)
Emitted when the server grants permission to transmit audio (Push-to-Talk).
void ProcessIncomingMessage(const QString &message, const QString &frequency)
Processes an incoming text message (JSON) received from the WebSocket. Parses the JSON,...
Definition message_processor.cpp:9
void ProcessIncomingBinaryMessage(const QByteArray &message, const QString &frequency)
Processes an incoming binary message (expected to be audio data) received from the WebSocket....
Definition message_processor.cpp:60
void SetSocketMessageHandlers(QWebSocket *socket, QString frequency)
Connects the appropriate slots of this processor to the signals of a given QWebSocket....
Definition message_processor.cpp:64
MessageProcessor(const MessageProcessor &)=delete
Deleted copy constructor to prevent copying.
void remoteAudioAmplitudeUpdate(QString frequency, qreal amplitude)
Emitted when the server sends an update about the remote audio amplitude (optional).
Singleton service responsible for sending messages and files over WebSocket connections.
Definition message_service.h:18