Files
pilotclient/src/blackcore/voice_channel.h
2014-12-27 11:08:43 +01:00

104 lines
3.0 KiB
C++

/* Copyright (C) 2014
* swift project community / contributors
*
* This file is part of swift project. It is subject to the license terms in the LICENSE file found in the top-level
* directory of this distribution and at http://www.swift-project.org/license.html. No part of swift project,
* including this file, may be copied, modified, propagated, or distributed except according to the terms
* contained in the LICENSE file.
*/
//! \file
#ifndef BLACKCORE_VOICE_CHANNEL_H
#define BLACKCORE_VOICE_CHANNEL_H
#include "blackmisc/statusmessage.h"
#include "blackmisc/voiceroomlist.h"
#include "blackmisc/avcallsignlist.h"
#include <QObject>
#include <QScopedPointer>
//! \file
namespace BlackCore
{
//! Interface to a voice channel
class IVoiceChannel : public QObject
{
Q_OBJECT
public:
//! Com status
enum ConnectionStatus
{
Disconnected = 0, //!< Not connected
Disconnecting, //!< In transition to disconnected
DisconnectedError, //!< Disconnected due to socket error
Connecting, //!< Connection initiated but not established
Connected, //!< Connection established
ConnectingFailed, //!< Failed to connect
};
//! Constructor
IVoiceChannel(QObject *parent = nullptr) : QObject(parent) {}
//! Destructor
virtual ~IVoiceChannel() {}
//! Join voice room
virtual void joinVoiceRoom(const BlackMisc::Audio::CVoiceRoom &voiceRoom) = 0;
//! Leave voice room
virtual void leaveVoiceRoom() = 0;
//! Get voice room callsings
virtual BlackMisc::Aviation::CCallsignList getVoiceRoomCallsigns() const = 0;
//! Set own aircraft's callsign
virtual void setMyAircraftCallsign(const BlackMisc::Aviation::CCallsign &callsign) = 0;
//! Get voice room
virtual BlackMisc::Audio::CVoiceRoom getVoiceRoom() const = 0;
//! Is channel muted?
virtual bool isMuted() const = 0;
//! Set channel volume 0..100
virtual void setVolume(int volume) = 0;
//! Get channel volume 0..100
virtual int getVolume() const = 0;
signals:
//! We sent a message about the status of the network connection, for the attention of the user.
void statusMessage(const BlackMisc::CStatusMessage &message);
//! The status of a room has changed.
void connectionStatusChanged(ConnectionStatus oldStatus, ConnectionStatus newStatus);
// Signals about users joining and leaving
//! User with callsign joined room
void userJoinedRoom(const BlackMisc::Aviation::CCallsign &callsign);
//! User with callsign left room
void userLeftRoom(const BlackMisc::Aviation::CCallsign &callsign);
// Audio signals
//! Audio for given unit started
void audioStarted();
//! Audio for given unit stopped
void audioStopped();
protected:
};
}
Q_DECLARE_METATYPE(BlackCore::IVoiceChannel::ConnectionStatus)
#endif // guard