2011-04-25 12:51:57 +02:00
|
|
|
/******************************************************************************\
|
2020-01-01 15:41:43 +01:00
|
|
|
* Copyright (c) 2004-2020
|
2011-04-25 12:51:57 +02:00
|
|
|
*
|
|
|
|
* Author(s):
|
|
|
|
* Volker Fischer
|
|
|
|
*
|
|
|
|
******************************************************************************
|
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or modify it under
|
|
|
|
* the terms of the GNU General Public License as published by the Free Software
|
|
|
|
* Foundation; either version 2 of the License, or (at your option) any later
|
|
|
|
* version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful, but WITHOUT
|
|
|
|
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
|
|
|
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
|
|
|
|
* details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License along with
|
|
|
|
* this program; if not, write to the Free Software Foundation, Inc.,
|
2020-06-08 22:58:11 +02:00
|
|
|
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
2011-04-25 12:51:57 +02:00
|
|
|
*
|
|
|
|
\******************************************************************************/
|
|
|
|
|
2019-07-09 08:52:38 +02:00
|
|
|
#pragma once
|
2011-04-25 12:51:57 +02:00
|
|
|
|
2013-01-02 21:41:04 +01:00
|
|
|
#include <QObject>
|
|
|
|
#include <QTimer>
|
|
|
|
#include <QDateTime>
|
|
|
|
#include <QHostAddress>
|
2020-06-13 18:15:52 +02:00
|
|
|
#include <QFileInfo>
|
2020-04-04 23:57:16 +02:00
|
|
|
#include <algorithm>
|
2014-07-26 07:58:01 +02:00
|
|
|
#ifdef USE_OPUS_SHARED_LIB
|
|
|
|
# include "opus/opus_custom.h"
|
|
|
|
#else
|
|
|
|
# include "opus_custom.h"
|
|
|
|
#endif
|
2011-04-25 12:51:57 +02:00
|
|
|
#include "global.h"
|
2020-04-10 12:07:23 +02:00
|
|
|
#include "buffer.h"
|
2020-05-08 18:16:27 +02:00
|
|
|
#include "signalhandler.h"
|
2011-04-25 12:51:57 +02:00
|
|
|
#include "socket.h"
|
|
|
|
#include "channel.h"
|
|
|
|
#include "util.h"
|
|
|
|
#include "serverlogging.h"
|
|
|
|
#include "serverlist.h"
|
2020-04-22 21:19:55 +02:00
|
|
|
#include "multicolorledbar.h"
|
2019-04-03 19:12:45 +02:00
|
|
|
#include "recorder/jamrecorder.h"
|
|
|
|
|
2011-04-25 12:51:57 +02:00
|
|
|
|
|
|
|
/* Definitions ****************************************************************/
|
|
|
|
// no valid channel number
|
|
|
|
#define INVALID_CHANNEL_ID ( MAX_NUM_CHANNELS + 1 )
|
|
|
|
|
|
|
|
|
|
|
|
/* Classes ********************************************************************/
|
2013-03-03 22:32:42 +01:00
|
|
|
#if ( defined ( WIN32 ) || defined ( _WIN32 ) )
|
|
|
|
// using QTimer for Windows
|
|
|
|
class CHighPrecisionTimer : public QObject
|
2011-04-25 12:51:57 +02:00
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
public:
|
2020-04-04 19:03:19 +02:00
|
|
|
CHighPrecisionTimer ( const bool bNewUseDoubleSystemFrameSize );
|
2011-04-25 12:51:57 +02:00
|
|
|
|
|
|
|
void Start();
|
|
|
|
void Stop();
|
2013-03-03 22:32:42 +01:00
|
|
|
bool isActive() const { return Timer.isActive(); }
|
2011-04-25 12:51:57 +02:00
|
|
|
|
|
|
|
protected:
|
2013-03-03 22:32:42 +01:00
|
|
|
QTimer Timer;
|
|
|
|
CVector<int> veciTimeOutIntervals;
|
|
|
|
int iCurPosInVector;
|
|
|
|
int iIntervalCounter;
|
2020-04-04 19:03:19 +02:00
|
|
|
bool bUseDoubleSystemFrameSize;
|
2011-04-25 12:51:57 +02:00
|
|
|
|
2013-03-03 22:32:42 +01:00
|
|
|
public slots:
|
|
|
|
void OnTimer();
|
2011-04-25 12:51:57 +02:00
|
|
|
|
|
|
|
signals:
|
|
|
|
void timeout();
|
|
|
|
};
|
|
|
|
#else
|
2013-03-03 22:32:42 +01:00
|
|
|
// using mach timers for Mac and nanosleep for Linux
|
2013-12-27 17:01:35 +01:00
|
|
|
# if defined ( __APPLE__ ) || defined ( __MACOSX )
|
|
|
|
# include <mach/mach.h>
|
|
|
|
# include <mach/mach_error.h>
|
|
|
|
# include <mach/mach_time.h>
|
|
|
|
# else
|
|
|
|
# include <sys/time.h>
|
|
|
|
# endif
|
2013-03-03 22:32:42 +01:00
|
|
|
|
|
|
|
class CHighPrecisionTimer : public QThread
|
2011-04-25 12:51:57 +02:00
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
public:
|
2020-04-04 19:03:19 +02:00
|
|
|
CHighPrecisionTimer ( const bool bUseDoubleSystemFrameSize );
|
2011-04-25 12:51:57 +02:00
|
|
|
|
|
|
|
void Start();
|
|
|
|
void Stop();
|
2013-03-03 22:32:42 +01:00
|
|
|
bool isActive() { return bRun; }
|
2011-04-25 12:51:57 +02:00
|
|
|
|
|
|
|
protected:
|
2013-03-03 22:32:42 +01:00
|
|
|
virtual void run();
|
2011-04-25 12:51:57 +02:00
|
|
|
|
2013-03-03 22:32:42 +01:00
|
|
|
bool bRun;
|
|
|
|
|
2013-12-27 17:01:35 +01:00
|
|
|
# if defined ( __APPLE__ ) || defined ( __MACOSX )
|
2013-03-03 22:32:42 +01:00
|
|
|
uint64_t Delay;
|
|
|
|
uint64_t NextEnd;
|
2013-12-27 17:01:35 +01:00
|
|
|
# else
|
2013-03-04 17:11:37 +01:00
|
|
|
long Delay;
|
2013-03-03 22:32:42 +01:00
|
|
|
timespec NextEnd;
|
2013-12-27 17:01:35 +01:00
|
|
|
# endif
|
2011-04-25 12:51:57 +02:00
|
|
|
|
|
|
|
signals:
|
|
|
|
void timeout();
|
|
|
|
};
|
|
|
|
#endif
|
|
|
|
|
2020-05-21 11:47:39 +02:00
|
|
|
|
2020-04-18 12:20:31 +02:00
|
|
|
template<unsigned int slotId>
|
|
|
|
class CServerSlots : public CServerSlots<slotId - 1>
|
|
|
|
{
|
|
|
|
public:
|
2020-05-21 11:47:39 +02:00
|
|
|
void OnSendProtMessCh ( CVector<uint8_t> mess ) { SendProtMessage ( slotId - 1, mess ); }
|
2020-04-18 12:20:31 +02:00
|
|
|
void OnReqConnClientsListCh() { CreateAndSendChanListForThisChan ( slotId - 1 ); }
|
|
|
|
|
2020-05-21 11:47:39 +02:00
|
|
|
void OnChatTextReceivedCh ( QString strChatText )
|
2020-04-18 12:20:31 +02:00
|
|
|
{
|
|
|
|
CreateAndSendChatTextForAllConChannels ( slotId - 1, strChatText );
|
|
|
|
}
|
|
|
|
|
2020-05-21 11:47:39 +02:00
|
|
|
void OnMuteStateHasChangedCh ( int iChanID, bool bIsMuted )
|
2020-04-18 12:20:31 +02:00
|
|
|
{
|
2020-05-21 11:47:39 +02:00
|
|
|
CreateOtherMuteStateChanged ( slotId - 1, iChanID, bIsMuted );
|
|
|
|
}
|
|
|
|
|
|
|
|
void OnServerAutoSockBufSizeChangeCh ( int iNNumFra )
|
|
|
|
{
|
|
|
|
CreateAndSendJitBufMessage ( slotId - 1, iNNumFra );
|
2020-04-18 12:20:31 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
protected:
|
|
|
|
virtual void SendProtMessage ( int iChID,
|
|
|
|
CVector<uint8_t> vecMessage ) = 0;
|
|
|
|
|
|
|
|
virtual void CreateAndSendChanListForThisChan ( const int iCurChanID ) = 0;
|
|
|
|
|
|
|
|
virtual void CreateAndSendChatTextForAllConChannels ( const int iCurChanID,
|
|
|
|
const QString& strChatText ) = 0;
|
|
|
|
|
2020-05-21 11:47:39 +02:00
|
|
|
virtual void CreateOtherMuteStateChanged ( const int iCurChanID,
|
|
|
|
const int iOtherChanID,
|
|
|
|
const bool bIsMuted ) = 0;
|
|
|
|
|
2020-04-18 12:20:31 +02:00
|
|
|
virtual void CreateAndSendJitBufMessage ( const int iCurChanID,
|
|
|
|
const int iNNumFra ) = 0;
|
|
|
|
};
|
|
|
|
|
|
|
|
template<>
|
|
|
|
class CServerSlots<0> {};
|
|
|
|
|
|
|
|
class CServer :
|
|
|
|
public QObject,
|
|
|
|
public CServerSlots<MAX_NUM_CHANNELS>
|
2011-04-25 12:51:57 +02:00
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
public:
|
2015-01-23 20:43:18 +01:00
|
|
|
CServer ( const int iNewMaxNumChan,
|
2020-03-21 19:57:18 +01:00
|
|
|
const int iMaxDaysHistory,
|
2015-01-23 20:43:18 +01:00
|
|
|
const QString& strLoggingFileName,
|
|
|
|
const quint16 iPortNumber,
|
|
|
|
const QString& strHTMLStatusFileName,
|
|
|
|
const QString& strHistoryFileName,
|
|
|
|
const QString& strServerNameForHTMLStatusFile,
|
|
|
|
const QString& strCentralServer,
|
|
|
|
const QString& strServerInfo,
|
|
|
|
const QString& strNewWelcomeMessage,
|
2019-04-03 19:12:45 +02:00
|
|
|
const QString& strRecordingDirName,
|
2015-01-23 20:43:18 +01:00
|
|
|
const bool bNCentServPingServerInList,
|
2020-05-12 22:40:59 +02:00
|
|
|
const bool bNDisconnectAllClientsOnQuit,
|
2020-04-04 19:03:19 +02:00
|
|
|
const bool bNUseDoubleSystemFrameSize,
|
2015-01-23 20:43:18 +01:00
|
|
|
const ELicenceType eNLicenceType );
|
2011-04-25 12:51:57 +02:00
|
|
|
|
|
|
|
void Start();
|
|
|
|
void Stop();
|
|
|
|
bool IsRunning() { return HighPrecisionTimer.isActive(); }
|
|
|
|
|
2014-02-16 09:12:07 +01:00
|
|
|
bool PutAudioData ( const CVector<uint8_t>& vecbyRecBuf,
|
|
|
|
const int iNumBytesRead,
|
|
|
|
const CHostAddress& HostAdr,
|
|
|
|
int& iCurChanID );
|
2011-04-25 12:51:57 +02:00
|
|
|
|
|
|
|
void GetConCliParam ( CVector<CHostAddress>& vecHostAddresses,
|
|
|
|
CVector<QString>& vecsName,
|
|
|
|
CVector<int>& veciJitBufNumFrames,
|
|
|
|
CVector<int>& veciNetwFrameSizeFact );
|
|
|
|
|
2020-05-30 17:24:52 +02:00
|
|
|
bool GetRecorderInitialised() { return bRecorderInitialised; }
|
2020-05-15 23:04:55 +02:00
|
|
|
bool GetRecordingEnabled() { return bEnableRecording; }
|
2020-05-30 17:24:52 +02:00
|
|
|
void RequestNewRecording();
|
|
|
|
void SetEnableRecording ( bool bNewEnableRecording );
|
2011-04-30 15:01:26 +02:00
|
|
|
|
|
|
|
// Server list management --------------------------------------------------
|
|
|
|
void UpdateServerList() { ServerListManager.Update(); }
|
|
|
|
|
2011-05-04 09:15:50 +02:00
|
|
|
void UnregisterSlaveServer() { ServerListManager.SlaveServerUnregister(); }
|
|
|
|
|
2011-04-30 15:01:26 +02:00
|
|
|
void SetServerListEnabled ( const bool bState )
|
|
|
|
{ ServerListManager.SetEnabled ( bState ); }
|
|
|
|
|
|
|
|
bool GetServerListEnabled() { return ServerListManager.GetEnabled(); }
|
|
|
|
|
|
|
|
void SetServerListCentralServerAddress ( const QString& sNCentServAddr )
|
|
|
|
{ ServerListManager.SetCentralServerAddress ( sNCentServAddr ); }
|
|
|
|
|
|
|
|
QString GetServerListCentralServerAddress()
|
|
|
|
{ return ServerListManager.GetCentralServerAddress(); }
|
|
|
|
|
2020-04-11 14:27:50 +02:00
|
|
|
void SetCentralServerAddressType ( const ECSAddType eNCSAT )
|
|
|
|
{ ServerListManager.SetCentralServerAddressType ( eNCSAT ); }
|
2011-04-30 21:51:49 +02:00
|
|
|
|
2020-04-11 14:27:50 +02:00
|
|
|
ECSAddType GetCentralServerAddressType()
|
|
|
|
{ return ServerListManager.GetCentralServerAddressType(); }
|
2011-04-30 21:51:49 +02:00
|
|
|
|
2011-04-25 18:16:31 +02:00
|
|
|
void SetServerName ( const QString& strNewName )
|
|
|
|
{ ServerListManager.SetServerName ( strNewName ); }
|
|
|
|
|
|
|
|
QString GetServerName() { return ServerListManager.GetServerName(); }
|
|
|
|
|
|
|
|
void SetServerCity ( const QString& strNewCity )
|
|
|
|
{ ServerListManager.SetServerCity ( strNewCity ); }
|
|
|
|
|
|
|
|
QString GetServerCity() { return ServerListManager.GetServerCity(); }
|
|
|
|
|
|
|
|
void SetServerCountry ( const QLocale::Country eNewCountry )
|
|
|
|
{ ServerListManager.SetServerCountry ( eNewCountry ); }
|
|
|
|
|
|
|
|
QLocale::Country GetServerCountry()
|
|
|
|
{ return ServerListManager.GetServerCountry(); }
|
|
|
|
|
2020-04-14 22:00:08 +02:00
|
|
|
ESvrRegStatus GetSvrRegStatus() { return ServerListManager.GetSvrRegStatus(); }
|
2011-05-08 17:01:20 +02:00
|
|
|
|
2020-04-18 08:39:08 +02:00
|
|
|
|
2011-05-08 17:01:20 +02:00
|
|
|
// GUI settings ------------------------------------------------------------
|
2020-04-08 15:30:32 +02:00
|
|
|
void SetAutoRunMinimized ( const bool NAuRuMin ) { bAutoRunMinimized = NAuRuMin; }
|
2011-05-08 17:01:20 +02:00
|
|
|
bool GetAutoRunMinimized() { return bAutoRunMinimized; }
|
|
|
|
|
2020-04-08 15:30:32 +02:00
|
|
|
void SetLicenceType ( const ELicenceType NLiType ) { eLicenceType = NLiType; }
|
|
|
|
ELicenceType GetLicenceType() { return eLicenceType; }
|
|
|
|
|
2020-06-14 08:49:58 +02:00
|
|
|
// window position/state settings
|
|
|
|
QByteArray vecWindowPosMain;
|
|
|
|
|
2011-04-25 12:51:57 +02:00
|
|
|
protected:
|
|
|
|
// access functions for actual channels
|
|
|
|
bool IsConnected ( const int iChanNum )
|
|
|
|
{ return vecChannels[iChanNum].IsConnected(); }
|
|
|
|
|
|
|
|
void StartStatusHTMLFileWriting ( const QString& strNewFileName,
|
|
|
|
const QString& strNewServerNameWithPort );
|
|
|
|
|
|
|
|
int GetFreeChan();
|
2014-01-08 22:24:37 +01:00
|
|
|
int FindChannel ( const CHostAddress& CheckAddr );
|
2011-04-25 12:51:57 +02:00
|
|
|
int GetNumberOfConnectedClients();
|
2013-02-11 16:21:53 +01:00
|
|
|
CVector<CChannelInfo> CreateChannelList();
|
2020-04-18 12:20:31 +02:00
|
|
|
|
|
|
|
virtual void CreateAndSendChanListForAllConChannels();
|
|
|
|
virtual void CreateAndSendChanListForThisChan ( const int iCurChanID );
|
2020-05-14 21:12:06 +02:00
|
|
|
|
2020-04-18 12:20:31 +02:00
|
|
|
virtual void CreateAndSendChatTextForAllConChannels ( const int iCurChanID,
|
|
|
|
const QString& strChatText );
|
|
|
|
|
2020-05-21 11:47:39 +02:00
|
|
|
virtual void CreateOtherMuteStateChanged ( const int iCurChanID,
|
|
|
|
const int iOtherChanID,
|
|
|
|
const bool bIsMuted );
|
|
|
|
|
2020-04-18 12:20:31 +02:00
|
|
|
virtual void CreateAndSendJitBufMessage ( const int iCurChanID,
|
|
|
|
const int iNNumFra );
|
|
|
|
|
|
|
|
virtual void SendProtMessage ( int iChID,
|
|
|
|
CVector<uint8_t> vecMessage );
|
|
|
|
|
|
|
|
template<unsigned int slotId>
|
|
|
|
inline void connectChannelSignalsToServerSlots();
|
|
|
|
|
2011-04-25 12:51:57 +02:00
|
|
|
void WriteHTMLChannelList();
|
|
|
|
|
2014-01-12 10:48:49 +01:00
|
|
|
void ProcessData ( const CVector<CVector<int16_t> >& vecvecsData,
|
2014-01-08 22:24:37 +01:00
|
|
|
const CVector<double>& vecdGains,
|
2020-04-26 00:55:28 +02:00
|
|
|
const CVector<double>& vecdPannings,
|
2014-01-08 22:24:37 +01:00
|
|
|
const CVector<int>& vecNumAudioChannels,
|
2014-01-12 10:48:49 +01:00
|
|
|
CVector<int16_t>& vecsOutData,
|
|
|
|
const int iCurNumAudChan,
|
|
|
|
const int iNumClients );
|
2011-04-25 12:51:57 +02:00
|
|
|
|
2014-01-08 22:24:37 +01:00
|
|
|
virtual void customEvent ( QEvent* pEvent );
|
2011-04-25 12:51:57 +02:00
|
|
|
|
2020-04-04 19:03:19 +02:00
|
|
|
// if server mode is normal or double system frame size
|
|
|
|
bool bUseDoubleSystemFrameSize;
|
2020-04-08 18:51:51 +02:00
|
|
|
int iServerFrameSizeSamples;
|
2020-04-04 19:03:19 +02:00
|
|
|
|
2020-06-07 12:09:30 +02:00
|
|
|
bool CreateLevelsForAllConChannels ( const int iNumClients,
|
2020-04-04 23:57:16 +02:00
|
|
|
const CVector<int>& vecNumAudioChannels,
|
|
|
|
const CVector<CVector<int16_t> > vecvecsData,
|
|
|
|
CVector<uint16_t>& vecLevelsOut );
|
|
|
|
|
2011-04-25 12:51:57 +02:00
|
|
|
// do not use the vector class since CChannel does not have appropriate
|
|
|
|
// copy constructor/operator
|
2014-01-12 10:48:49 +01:00
|
|
|
CChannel vecChannels[MAX_NUM_CHANNELS];
|
|
|
|
int iMaxNumChannels;
|
|
|
|
CProtocol ConnLessProtocol;
|
|
|
|
QMutex Mutex;
|
2011-04-25 12:51:57 +02:00
|
|
|
|
|
|
|
// audio encoder/decoder
|
2020-04-04 19:03:19 +02:00
|
|
|
OpusCustomMode* Opus64Mode[MAX_NUM_CHANNELS];
|
|
|
|
OpusCustomEncoder* Opus64EncoderMono[MAX_NUM_CHANNELS];
|
|
|
|
OpusCustomDecoder* Opus64DecoderMono[MAX_NUM_CHANNELS];
|
|
|
|
OpusCustomEncoder* Opus64EncoderStereo[MAX_NUM_CHANNELS];
|
|
|
|
OpusCustomDecoder* Opus64DecoderStereo[MAX_NUM_CHANNELS];
|
2014-01-12 10:48:49 +01:00
|
|
|
OpusCustomMode* OpusMode[MAX_NUM_CHANNELS];
|
|
|
|
OpusCustomEncoder* OpusEncoderMono[MAX_NUM_CHANNELS];
|
|
|
|
OpusCustomDecoder* OpusDecoderMono[MAX_NUM_CHANNELS];
|
|
|
|
OpusCustomEncoder* OpusEncoderStereo[MAX_NUM_CHANNELS];
|
|
|
|
OpusCustomDecoder* OpusDecoderStereo[MAX_NUM_CHANNELS];
|
2020-04-10 12:07:23 +02:00
|
|
|
CConvBuf<int16_t> DoubleFrameSizeConvBufIn[MAX_NUM_CHANNELS];
|
|
|
|
CConvBuf<int16_t> DoubleFrameSizeConvBufOut[MAX_NUM_CHANNELS];
|
2014-01-12 10:48:49 +01:00
|
|
|
|
|
|
|
CVector<QString> vstrChatColors;
|
|
|
|
CVector<int> vecChanIDsCurConChan;
|
|
|
|
|
|
|
|
CVector<CVector<double> > vecvecdGains;
|
2020-04-26 00:55:28 +02:00
|
|
|
CVector<CVector<double> > vecvecdPannings;
|
2014-01-12 10:48:49 +01:00
|
|
|
CVector<CVector<int16_t> > vecvecsData;
|
|
|
|
CVector<int> vecNumAudioChannels;
|
2020-04-05 17:35:40 +02:00
|
|
|
CVector<int> vecNumFrameSizeConvBlocks;
|
2020-04-10 12:07:23 +02:00
|
|
|
CVector<int> vecUseDoubleSysFraSizeConvBuf;
|
2020-04-05 09:34:00 +02:00
|
|
|
CVector<EAudComprType> vecAudioComprType;
|
2014-01-12 10:48:49 +01:00
|
|
|
CVector<int16_t> vecsSendData;
|
|
|
|
CVector<uint8_t> vecbyCodedData;
|
2011-04-25 12:51:57 +02:00
|
|
|
|
2020-04-04 23:57:16 +02:00
|
|
|
// Channel levels
|
|
|
|
CVector<uint16_t> vecChannelLevels;
|
|
|
|
|
2011-04-25 12:51:57 +02:00
|
|
|
// actual working objects
|
2014-02-16 09:12:07 +01:00
|
|
|
CHighPrioSocket Socket;
|
2011-04-25 12:51:57 +02:00
|
|
|
|
|
|
|
// logging
|
2014-01-12 10:48:49 +01:00
|
|
|
CServerLogging Logging;
|
2011-04-25 12:51:57 +02:00
|
|
|
|
2020-04-04 23:57:16 +02:00
|
|
|
// channel level update frame interval counter
|
2020-06-07 12:09:30 +02:00
|
|
|
int iFrameCount;
|
2020-04-04 23:57:16 +02:00
|
|
|
|
2019-04-03 19:12:45 +02:00
|
|
|
// recording thread
|
2019-04-12 18:48:20 +02:00
|
|
|
recorder::CJamRecorder JamRecorder;
|
2020-05-30 17:24:52 +02:00
|
|
|
bool bRecorderInitialised;
|
2019-04-11 22:25:36 +02:00
|
|
|
bool bEnableRecording;
|
2019-04-03 19:12:45 +02:00
|
|
|
|
2011-04-25 12:51:57 +02:00
|
|
|
// HTML file server status
|
2014-01-12 10:48:49 +01:00
|
|
|
bool bWriteStatusHTMLFile;
|
|
|
|
QString strServerHTMLFileListName;
|
|
|
|
QString strServerNameWithPort;
|
2011-04-25 12:51:57 +02:00
|
|
|
|
2014-01-12 10:48:49 +01:00
|
|
|
CHighPrecisionTimer HighPrecisionTimer;
|
2011-04-25 12:51:57 +02:00
|
|
|
|
|
|
|
// server list
|
2014-01-12 10:48:49 +01:00
|
|
|
CServerListManager ServerListManager;
|
2011-04-25 12:51:57 +02:00
|
|
|
|
2011-05-08 17:01:20 +02:00
|
|
|
// GUI settings
|
2014-01-12 10:48:49 +01:00
|
|
|
bool bAutoRunMinimized;
|
2011-05-08 17:01:20 +02:00
|
|
|
|
2013-02-11 21:24:38 +01:00
|
|
|
// messaging
|
2014-01-12 10:48:49 +01:00
|
|
|
QString strWelcomeMessage;
|
2015-01-23 20:43:18 +01:00
|
|
|
ELicenceType eLicenceType;
|
2020-05-12 22:40:59 +02:00
|
|
|
bool bDisconnectAllClientsOnQuit;
|
2013-02-11 21:24:38 +01:00
|
|
|
|
2020-05-11 21:12:16 +02:00
|
|
|
CSignalHandler* pSignalHandler;
|
2013-02-11 21:24:38 +01:00
|
|
|
|
2011-05-06 22:18:20 +02:00
|
|
|
signals:
|
|
|
|
void Started();
|
|
|
|
void Stopped();
|
2019-04-11 22:25:36 +02:00
|
|
|
void ClientDisconnected ( const int iChID );
|
2020-04-14 22:00:08 +02:00
|
|
|
void SvrRegStatusChanged();
|
2019-04-11 22:25:36 +02:00
|
|
|
void AudioFrame ( const int iChID,
|
|
|
|
const QString stChName,
|
|
|
|
const CHostAddress RecHostAddr,
|
|
|
|
const int iNumAudChan,
|
|
|
|
const CVector<int16_t> vecsData );
|
2020-05-15 22:52:13 +02:00
|
|
|
void RestartRecorder();
|
2020-05-30 17:24:52 +02:00
|
|
|
void StopRecorder();
|
2020-05-15 23:04:55 +02:00
|
|
|
void RecordingSessionStarted ( QString sessionDir );
|
2011-05-06 22:18:20 +02:00
|
|
|
|
2011-04-25 12:51:57 +02:00
|
|
|
public slots:
|
|
|
|
void OnTimer();
|
|
|
|
|
2014-02-16 09:12:07 +01:00
|
|
|
void OnNewConnection ( int iChID,
|
|
|
|
CHostAddress RecHostAddr );
|
|
|
|
|
|
|
|
void OnServerFull ( CHostAddress RecHostAddr );
|
|
|
|
|
|
|
|
void OnSendCLProtMessage ( CHostAddress InetAddr,
|
|
|
|
CVector<uint8_t> vecMessage );
|
|
|
|
|
|
|
|
void OnProtcolCLMessageReceived ( int iRecID,
|
|
|
|
CVector<uint8_t> vecbyMesBodyData,
|
|
|
|
CHostAddress RecHostAddr );
|
|
|
|
|
|
|
|
void OnProtcolMessageReceived ( int iRecCounter,
|
|
|
|
int iRecID,
|
|
|
|
CVector<uint8_t> vecbyMesBodyData,
|
|
|
|
CHostAddress RecHostAddr );
|
2011-05-23 21:06:02 +02:00
|
|
|
|
2011-05-24 21:40:57 +02:00
|
|
|
void OnCLPingReceived ( CHostAddress InetAddr, int iMs )
|
|
|
|
{ ConnLessProtocol.CreateCLPingMes ( InetAddr, iMs ); }
|
|
|
|
|
2011-05-24 20:44:51 +02:00
|
|
|
void OnCLPingWithNumClientsReceived ( CHostAddress InetAddr,
|
|
|
|
int iMs,
|
|
|
|
int )
|
2011-04-25 12:51:57 +02:00
|
|
|
{
|
|
|
|
ConnLessProtocol.CreateCLPingWithNumClientsMes ( InetAddr,
|
|
|
|
iMs,
|
|
|
|
GetNumberOfConnectedClients() );
|
|
|
|
}
|
|
|
|
|
|
|
|
void OnCLSendEmptyMes ( CHostAddress TargetInetAddr )
|
|
|
|
{
|
|
|
|
// only send empty message if server list is enabled and this is not
|
|
|
|
// the central server
|
|
|
|
if ( ServerListManager.GetEnabled() &&
|
|
|
|
!ServerListManager.GetIsCentralServer() )
|
|
|
|
{
|
|
|
|
ConnLessProtocol.CreateCLEmptyMes ( TargetInetAddr );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void OnCLReqServerList ( CHostAddress InetAddr )
|
2011-05-04 09:00:43 +02:00
|
|
|
{ ServerListManager.CentralServerQueryServerList ( InetAddr ); }
|
2011-04-25 12:51:57 +02:00
|
|
|
|
2014-02-21 22:25:26 +01:00
|
|
|
void OnCLReqVersionAndOS ( CHostAddress InetAddr )
|
|
|
|
{ ConnLessProtocol.CreateCLVersionAndOSMes ( InetAddr ); }
|
|
|
|
|
2015-12-09 16:50:30 +01:00
|
|
|
void OnCLReqConnClientsList ( CHostAddress InetAddr )
|
|
|
|
{ ConnLessProtocol.CreateCLConnClientsListMes ( InetAddr, CreateChannelList() ); }
|
2015-12-06 18:51:06 +01:00
|
|
|
|
2011-04-25 12:51:57 +02:00
|
|
|
void OnCLRegisterServerReceived ( CHostAddress InetAddr,
|
2020-04-09 20:06:34 +02:00
|
|
|
CHostAddress LInetAddr,
|
2011-04-25 12:51:57 +02:00
|
|
|
CServerCoreInfo ServerInfo )
|
|
|
|
{
|
2020-04-09 20:06:34 +02:00
|
|
|
ServerListManager.CentralServerRegisterServer ( InetAddr, LInetAddr, ServerInfo );
|
2011-04-25 12:51:57 +02:00
|
|
|
}
|
|
|
|
|
2020-04-14 22:00:08 +02:00
|
|
|
void OnCLRegisterServerResp ( CHostAddress /* unused */,
|
|
|
|
ESvrRegResult eResult )
|
|
|
|
{
|
|
|
|
ServerListManager.StoreRegistrationResult ( eResult );
|
|
|
|
}
|
|
|
|
|
2011-05-03 22:37:06 +02:00
|
|
|
void OnCLUnregisterServerReceived ( CHostAddress InetAddr )
|
|
|
|
{
|
2011-05-04 09:00:43 +02:00
|
|
|
ServerListManager.CentralServerUnregisterServer ( InetAddr );
|
2011-05-03 22:37:06 +02:00
|
|
|
}
|
|
|
|
|
2011-05-22 11:47:09 +02:00
|
|
|
void OnCLDisconnection ( CHostAddress InetAddr );
|
|
|
|
|
2020-05-08 18:16:27 +02:00
|
|
|
void OnAboutToQuit();
|
|
|
|
|
2020-05-15 21:01:57 +02:00
|
|
|
void OnHandledSignal ( int sigNum );
|
2011-04-25 12:51:57 +02:00
|
|
|
};
|