cleanup some 'COMPATIBILITY OLD VERSION, TO BE REMOVED'

This commit is contained in:
Volker Fischer 2019-05-17 22:06:48 +02:00
parent 78a4f52142
commit 6466a4aaf7
11 changed files with 6 additions and 272 deletions

View file

@ -634,15 +634,8 @@ void CAudioMixerBoard::ApplyNewConClientList ( CVector<CChannelInfo>& vecChanInf
// set the text in the fader
vecpChanFader[i]->SetText ( vecChanInfo[j] );
// update other channel infos (only available for new protocol
// which is not compatible with old versions -> this way we make
// sure that the protocol which transfers only the name does
// change the other client infos)
// #### COMPATIBILITY OLD VERSION, TO BE REMOVED #### -> the "if-condition" can be removed later on...
if ( !vecChanInfo[j].bOnlyNameIsUsed )
{
// update other channel infos
vecpChanFader[i]->SetChannelInfos ( vecChanInfo[j] );
}
bFaderIsUsed = true;
}

View file

@ -76,10 +76,6 @@ qRegisterMetaType<CHostAddress> ( "CHostAddress" );
SIGNAL ( ReqConnClientsList() ),
SIGNAL ( ReqConnClientsList() ) );
QObject::connect ( &Protocol,
SIGNAL ( ConClientListNameMesReceived ( CVector<CChannelInfo> ) ),
SIGNAL ( ConClientListNameMesReceived ( CVector<CChannelInfo> ) ) );
QObject::connect ( &Protocol,
SIGNAL ( ConClientListMesReceived ( CVector<CChannelInfo> ) ),
SIGNAL ( ConClientListMesReceived ( CVector<CChannelInfo> ) ) );
@ -87,9 +83,6 @@ qRegisterMetaType<CHostAddress> ( "CHostAddress" );
QObject::connect( &Protocol, SIGNAL ( ChangeChanGain ( int, double ) ),
this, SLOT ( OnChangeChanGain ( int, double ) ) );
QObject::connect( &Protocol, SIGNAL ( ChangeChanName ( QString ) ),
this, SLOT ( OnChangeChanName ( QString ) ) );
QObject::connect( &Protocol, SIGNAL ( ChangeChanInfo ( CChannelCoreInfo ) ),
this, SLOT ( OnChangeChanInfo ( CChannelCoreInfo ) ) );
@ -272,28 +265,6 @@ void CChannel::SetChanInfo ( const CChannelCoreInfo& NChanInf )
}
}
void CChannel::SetName ( const QString strNewName )
{
bool bNameHasChanged = false;
Mutex.lock();
{
// apply value (if different from previous one)
if ( ChannelInfo.strName.compare ( strNewName ) )
{
ChannelInfo.strName = strNewName;
bNameHasChanged = true;
}
}
Mutex.unlock();
// fire message that name has changed
if ( bNameHasChanged )
{
// the "emit" has to be done outside the mutexed region
emit ChanInfoHasChanged();
}
}
QString CChannel::GetName()
{
// make sure the string is not written at the same time when it is
@ -348,11 +319,6 @@ void CChannel::OnChangeChanGain ( int iChanID,
SetGain ( iChanID, dNewGain );
}
void CChannel::OnChangeChanName ( QString strName )
{
SetName ( strName );
}
void CChannel::OnChangeChanInfo ( CChannelCoreInfo ChanInfo )
{
SetChanInfo ( ChanInfo );

View file

@ -93,19 +93,13 @@ public:
const CHostAddress& GetAddress() const { return InetAddr; }
void ResetInfo() { ChannelInfo = CChannelCoreInfo(); } // reset does not emit a message
void SetName ( const QString sNNa );
QString GetName();
void SetChanInfo ( const CChannelCoreInfo& NChanInf );
CChannelCoreInfo& GetChanInfo() { return ChannelInfo; }
void SetRemoteInfo ( const CChannelCoreInfo ChInfo )
{
// because of compatibility to old versions, we also have to send the
// channel name message extra
// #### COMPATIBILITY OLD VERSION, TO BE REMOVED ####
Protocol.CreateChanNameMes ( ChInfo.strName );
Protocol.CreateChanInfoMes ( ChInfo );
}
{ Protocol.CreateChanInfoMes ( ChInfo ); }
void CreateReqChanInfoMes() { Protocol.CreateReqChanInfoMes(); }
void SetGain ( const int iChanID, const double dNewGain );
@ -156,10 +150,6 @@ Protocol.CreateChanNameMes ( ChInfo.strName );
void CreateChatTextMes ( const QString& strChatText ) { Protocol.CreateChatTextMes ( strChatText ); }
void CreateLicReqMes ( const ELicenceType eLicenceType ) { Protocol.CreateLicenceRequiredMes ( eLicenceType ); }
// #### COMPATIBILITY OLD VERSION, TO BE REMOVED ####
void CreateConClientListNameMes ( const CVector<CChannelInfo>& vecChanInfo )
{ Protocol.CreateConClientListNameMes ( vecChanInfo ); }
void CreateConClientListMes ( const CVector<CChannelInfo>& vecChanInfo )
{ Protocol.CreateConClientListMes ( vecChanInfo ); }
@ -219,7 +209,6 @@ public slots:
void OnSendProtMessage ( CVector<uint8_t> vecMessage );
void OnJittBufSizeChange ( int iNewJitBufSize );
void OnChangeChanGain ( int iChanID, double dNewGain );
void OnChangeChanName ( QString strName );
void OnChangeChanInfo ( CChannelCoreInfo ChanInfo );
void OnNetTranspPropsReceived ( CNetworkTransportProps NetworkTransportProps );
void OnReqNetTranspProps();
@ -256,7 +245,6 @@ signals:
void JittBufSizeChanged ( int iNewJitBufSize );
void ServerAutoSockBufSizeChange ( int iNNumFra );
void ReqConnClientsList();
void ConClientListNameMesReceived ( CVector<CChannelInfo> vecChanInfo );
void ConClientListMesReceived ( CVector<CChannelInfo> vecChanInfo );
void ChanInfoHasChanged();
void ReqChanInfo();

View file

@ -140,10 +140,6 @@ CClient::CClient ( const quint16 iPortNumber,
QObject::connect ( &Channel, SIGNAL ( ReqChanInfo() ),
this, SLOT ( OnReqChanInfo() ) );
QObject::connect ( &Channel,
SIGNAL ( ConClientListNameMesReceived ( CVector<CChannelInfo> ) ),
SIGNAL ( ConClientListNameMesReceived ( CVector<CChannelInfo> ) ) );
QObject::connect ( &Channel,
SIGNAL ( ConClientListMesReceived ( CVector<CChannelInfo> ) ),
SIGNAL ( ConClientListMesReceived ( CVector<CChannelInfo> ) ) );

View file

@ -388,7 +388,6 @@ public slots:
void OnSndCrdReinitRequest ( int iSndCrdResetType );
signals:
void ConClientListNameMesReceived ( CVector<CChannelInfo> vecChanInfo );
void ConClientListMesReceived ( CVector<CChannelInfo> vecChanInfo );
void ChatTextReceived ( QString strChatText );
void LicenceRequired ( ELicenceType eLicenceType );

View file

@ -442,10 +442,6 @@ CClientDlg::CClientDlg ( CClient* pNCliP,
this, SLOT ( OnReverbSelRClicked() ) );
// other
QObject::connect ( pClient,
SIGNAL ( ConClientListNameMesReceived ( CVector<CChannelInfo> ) ),
this, SLOT ( OnConClientListMesReceived ( CVector<CChannelInfo> ) ) );
QObject::connect ( pClient,
SIGNAL ( ConClientListMesReceived ( CVector<CChannelInfo> ) ),
this, SLOT ( OnConClientListMesReceived ( CVector<CChannelInfo> ) ) );

View file

@ -64,18 +64,6 @@ MESSAGES (with connection)
+-------------------+--------------+
- PROTMESSID_CONN_CLIENTS_LIST_NAME: IP number and name of connected clients
for each connected client append following data:
+-------------------+--------------------+------------------+ ...
| 1 byte channel ID | 4 bytes IP address | 2 bytes number n | ...
+-------------------+--------------------+------------------+ ...
... ----------------------+
... n bytes UTF-8 string |
... ----------------------+
- PROTMESSID_CONN_CLIENTS_LIST: Information about connected clients
for each connected client append following data:
@ -99,13 +87,6 @@ MESSAGES (with connection)
note: does not have any data -> n = 0
- PROTMESSID_CHANNEL_NAME: Name of channel
+------------------+----------------------+
| 2 bytes number n | n bytes UTF-8 string |
+------------------+----------------------+
- PROTMESSID_CHANNEL_INFOS: Information about the channel
+-----------------+--------------------+ ...
@ -537,11 +518,6 @@ if ( rand() < ( RAND_MAX / 2 ) ) return false;
bRet = EvaluateChanGainMes ( vecbyMesBodyData );
break;
// #### COMPATIBILITY OLD VERSION, TO BE REMOVED ####
case PROTMESSID_CONN_CLIENTS_LIST_NAME:
bRet = EvaluateConClientListNameMes ( vecbyMesBodyData );
break;
case PROTMESSID_CONN_CLIENTS_LIST:
bRet = EvaluateConClientListMes ( vecbyMesBodyData );
break;
@ -550,11 +526,6 @@ case PROTMESSID_CONN_CLIENTS_LIST_NAME:
bRet = EvaluateReqConnClientsList();
break;
// #### COMPATIBILITY OLD VERSION, TO BE REMOVED ####
case PROTMESSID_CHANNEL_NAME:
bRet = EvaluateChanNameMes ( vecbyMesBodyData );
break;
case PROTMESSID_CHANNEL_INFOS:
bRet = EvaluateChanInfoMes ( vecbyMesBodyData );
break;
@ -773,90 +744,6 @@ bool CProtocol::EvaluateChanGainMes ( const CVector<uint8_t>& vecData )
return false; // no error
}
void CProtocol::CreateConClientListNameMes ( const CVector<CChannelInfo>& vecChanInfo )
{
const int iNumClients = vecChanInfo.Size();
// build data vector
CVector<uint8_t> vecData ( 0 );
int iPos = 0; // init position pointer
for ( int i = 0; i < iNumClients; i++ )
{
// convert name string to utf-8
const QByteArray strUTF8Name = vecChanInfo[i].strName.toUtf8();
// size of current list entry
const int iCurListEntrLen =
1 /* chan ID */ + 4 /* IP addr. */ +
2 /* utf-8 str. size */ + strUTF8Name.size();
// make space for new data
vecData.Enlarge ( iCurListEntrLen );
// channel ID (1 byte)
PutValOnStream ( vecData, iPos,
static_cast<uint32_t> ( vecChanInfo[i].iChanID ), 1 );
// IP address (4 bytes)
PutValOnStream ( vecData, iPos,
static_cast<uint32_t> ( vecChanInfo[i].iIpAddr ), 4 );
// name string
PutStringUTF8OnStream ( vecData, iPos, strUTF8Name );
}
CreateAndSendMessage ( PROTMESSID_CONN_CLIENTS_LIST_NAME, vecData );
}
bool CProtocol::EvaluateConClientListNameMes ( const CVector<uint8_t>& vecData )
{
int iPos = 0; // init position pointer
const int iDataLen = vecData.Size();
CVector<CChannelInfo> vecChanInfo ( 0 );
while ( iPos < iDataLen )
{
// check size (the next 5 bytes)
if ( ( iDataLen - iPos ) < 5 )
{
return true; // return error code
}
// channel ID (1 byte)
const int iChanID =
static_cast<int> ( GetValFromStream ( vecData, iPos, 1 ) );
// IP address (4 bytes)
const int iIpAddr =
static_cast<int> ( GetValFromStream ( vecData, iPos, 4 ) );
// name
QString strCurStr;
if ( GetStringFromStream ( vecData,
iPos,
MAX_LEN_FADER_TAG,
strCurStr ) )
{
return true; // return error code
}
// add channel information to vector
vecChanInfo.Add ( CChannelInfo ( iChanID, iIpAddr, strCurStr ) );
}
// check size: all data is read, the position must now be at the end
if ( iPos != iDataLen )
{
return true; // return error code
}
// invoke message action
emit ConClientListNameMesReceived ( vecChanInfo );
return false; // no error
}
void CProtocol::CreateConClientListMes ( const CVector<CChannelInfo>& vecChanInfo )
{
const int iNumClients = vecChanInfo.Size();
@ -1001,53 +888,6 @@ bool CProtocol::EvaluateReqConnClientsList()
return false; // no error
}
void CProtocol::CreateChanNameMes ( const QString strName )
{
int iPos = 0; // init position pointer
// convert name string to utf-8
const QByteArray strUTF8Name = strName.toUtf8();
const int iStrUTF8Len = strUTF8Name.size(); // get utf-8 string size
// size of current list entry
const int iEntrLen = 2 /* utf-8 string size */ + iStrUTF8Len;
// build data vector
CVector<uint8_t> vecData ( iEntrLen );
// name string
PutStringUTF8OnStream ( vecData, iPos, strUTF8Name );
CreateAndSendMessage ( PROTMESSID_CHANNEL_NAME, vecData );
}
bool CProtocol::EvaluateChanNameMes ( const CVector<uint8_t>& vecData )
{
int iPos = 0; // init position pointer
// channel name
QString strName;
if ( GetStringFromStream ( vecData,
iPos,
MAX_LEN_FADER_TAG,
strName ) )
{
return true; // return error code
}
// check size: all data is read, the position must now be at the end
if ( iPos != vecData.Size() )
{
return true; // return error code
}
// invoke message action
emit ChangeChanName ( strName );
return false; // no error
}
void CProtocol::CreateChanInfoMes ( const CChannelCoreInfo ChanInfo )
{
int iPos = 0; // init position pointer

View file

@ -41,10 +41,10 @@
#define PROTMESSID_REQ_JITT_BUF_SIZE 11 // request jitter buffer size
#define PROTMESSID_NET_BLSI_FACTOR 12 // OLD (not used anymore)
#define PROTMESSID_CHANNEL_GAIN 13 // set channel gain for mix
#define PROTMESSID_CONN_CLIENTS_LIST_NAME 14 // connected client list
#define PROTMESSID_CONN_CLIENTS_LIST_NAME 14 // OLD (not used anymore)
#define PROTMESSID_SERVER_FULL 15 // OLD (not used anymore)
#define PROTMESSID_REQ_CONN_CLIENTS_LIST 16 // request connected client list
#define PROTMESSID_CHANNEL_NAME 17 // set channel name for fader tag
#define PROTMESSID_CHANNEL_NAME 17 // OLD (not used anymore)
#define PROTMESSID_CHAT_TEXT 18 // contains a chat text
#define PROTMESSID_PING_MS 19 // OLD (not used anymore)
#define PROTMESSID_NETW_TRANSPORT_PROPS 20 // properties for network transport
@ -94,10 +94,8 @@ public:
void CreateJitBufMes ( const int iJitBufSize );
void CreateReqJitBufMes();
void CreateChanGainMes ( const int iChanID, const double dGain );
void CreateConClientListNameMes ( const CVector<CChannelInfo>& vecChanInfo );
void CreateConClientListMes ( const CVector<CChannelInfo>& vecChanInfo );
void CreateReqConnClientsList();
void CreateChanNameMes ( const QString strName );
void CreateChanInfoMes ( const CChannelCoreInfo ChanInfo );
void CreateReqChanInfoMes();
void CreateChatTextMes ( const QString strChatText );
@ -211,10 +209,8 @@ protected:
bool EvaluateJitBufMes ( const CVector<uint8_t>& vecData );
bool EvaluateReqJitBufMes();
bool EvaluateChanGainMes ( const CVector<uint8_t>& vecData );
bool EvaluateConClientListNameMes ( const CVector<uint8_t>& vecData );
bool EvaluateConClientListMes ( const CVector<uint8_t>& vecData );
bool EvaluateReqConnClientsList();
bool EvaluateChanNameMes ( const CVector<uint8_t>& vecData );
bool EvaluateChanInfoMes ( const CVector<uint8_t>& vecData );
bool EvaluateReqChanInfoMes();
bool EvaluateChatTextMes ( const CVector<uint8_t>& vecData );
@ -266,11 +262,9 @@ signals:
void ReqJittBufSize();
void ChangeNetwBlSiFact ( int iNewNetwBlSiFact );
void ChangeChanGain ( int iChanID, double dNewGain );
void ConClientListNameMesReceived ( CVector<CChannelInfo> vecChanInfo );
void ConClientListMesReceived ( CVector<CChannelInfo> vecChanInfo );
void ServerFullMesReceived();
void ReqConnClientsList();
void ChangeChanName ( QString strName );
void ChangeChanInfo ( CChannelCoreInfo ChanInfo );
void ReqChanInfo();
void ChatTextReceived ( QString strChatText );

View file

@ -1088,8 +1088,6 @@ void CServer::CreateAndSendChanListForAllConChannels()
if ( vecChannels[i].IsConnected() )
{
// send message
// #### COMPATIBILITY OLD VERSION, TO BE REMOVED ####
vecChannels[i].CreateConClientListNameMes ( vecChanInfo );
vecChannels[i].CreateConClientListMes ( vecChanInfo );
}
}
@ -1107,8 +1105,6 @@ void CServer::CreateAndSendChanListForThisChan ( const int iCurChanID )
CVector<CChannelInfo> vecChanInfo ( CreateChannelList() );
// now send connected channels list to the channel with the ID "iCurChanID"
// #### COMPATIBILITY OLD VERSION, TO BE REMOVED ####
vecChannels[iCurChanID].CreateConClientListNameMes ( vecChanInfo );
vecChannels[iCurChanID].CreateConClientListMes ( vecChanInfo );
}

View file

@ -122,14 +122,6 @@ public slots:
GenRandomIntInRange ( -100, 100 ) );
break;
case 3: // PROTMESSID_CONN_CLIENTS_LIST_NAME
vecChanInfo[0].iChanID = GenRandomIntInRange ( -2, 20 );
vecChanInfo[0].iIpAddr = GenRandomIntInRange ( 0, 100000 );
vecChanInfo[0].strName = GenRandomString();
Protocol.CreateConClientListNameMes ( vecChanInfo );
break;
case 4: // PROTMESSID_CONN_CLIENTS_LIST
vecChanInfo[0].iChanID = GenRandomIntInRange ( -2, 20 );
vecChanInfo[0].iIpAddr = GenRandomIntInRange ( 0, 100000 );
@ -142,10 +134,6 @@ public slots:
Protocol.CreateReqConnClientsList();
break;
case 6: // PROTMESSID_CHANNEL_NAME
Protocol.CreateChanNameMes ( GenRandomString() );
break;
case 7: // PROTMESSID_CHANNEL_INFOS
ChannelCoreInfo.eCountry =
static_cast<QLocale::Country> ( GenRandomIntInRange ( 0, 100 ) );

View file

@ -796,7 +796,6 @@ class CChannelInfo : public CChannelCoreInfo
{
public:
CChannelInfo() :
bOnlyNameIsUsed ( false ),
iChanID ( 0 ),
iIpAddr ( 0 ) {}
@ -804,7 +803,6 @@ public:
const quint32 NiIP,
const CChannelCoreInfo& NCorInf ) :
CChannelCoreInfo ( NCorInf ),
bOnlyNameIsUsed ( false ),
iChanID ( NiID ),
iIpAddr ( NiIP ) {}
@ -820,7 +818,6 @@ public:
NsCity,
NiInstrument,
NeSkillLevel ),
bOnlyNameIsUsed ( false ),
iChanID ( NiID ),
iIpAddr ( NiIP ) {}
@ -843,25 +840,6 @@ public:
}
}
// #### COMPATIBILITY OLD VERSION, TO BE REMOVED ####
CChannelInfo ( const int NiID,
const quint32 NiIP,
const QString NsName ) :
CChannelCoreInfo ( NsName,
QLocale::AnyCountry,
"",
CInstPictures::GetNotUsedInstrument(),
SL_NOT_SET ),
bOnlyNameIsUsed ( true ),
iChanID ( NiID ),
iIpAddr ( NiIP ) {}
// in old versions, the name was the only client info -> to be removed
// when compatiblility to old versions is removed
bool bOnlyNameIsUsed;
// ID of the channel
int iChanID;