server sends version info on initial connection
This commit is contained in:
parent
8724d1443c
commit
d21acb0a7f
4 changed files with 84 additions and 1 deletions
|
@ -105,6 +105,7 @@ public:
|
||||||
{ Protocol.CreateChanInfoMes ( ChInfo ); }
|
{ Protocol.CreateChanInfoMes ( ChInfo ); }
|
||||||
|
|
||||||
void CreateReqChanInfoMes() { Protocol.CreateReqChanInfoMes(); }
|
void CreateReqChanInfoMes() { Protocol.CreateReqChanInfoMes(); }
|
||||||
|
void CreateVersionAndOSMes() { Protocol.CreateVersionAndOSMes(); }
|
||||||
|
|
||||||
void SetGain ( const int iChanID, const double dNewGain );
|
void SetGain ( const int iChanID, const double dNewGain );
|
||||||
double GetGain ( const int iChanID );
|
double GetGain ( const int iChanID );
|
||||||
|
|
|
@ -154,7 +154,7 @@ MESSAGES (with connection)
|
||||||
| 1 byte licence type |
|
| 1 byte licence type |
|
||||||
+---------------------+
|
+---------------------+
|
||||||
|
|
||||||
- PROTMESSID_CLM_REQ_CHANNEL_LEVEL_LIST: Opt in or out of the channel level list
|
- PROTMESSID_REQ_CHANNEL_LEVEL_LIST: Opt in or out of the channel level list
|
||||||
|
|
||||||
+---------------+
|
+---------------+
|
||||||
| 1 byte option |
|
| 1 byte option |
|
||||||
|
@ -162,6 +162,12 @@ MESSAGES (with connection)
|
||||||
|
|
||||||
option is boolean, true to opt in, false to opt out
|
option is boolean, true to opt in, false to opt out
|
||||||
|
|
||||||
|
- PROTMESSID_VERSION_AND_OS: Version number and operating system
|
||||||
|
|
||||||
|
+-------------------------+------------------+------------------------------+
|
||||||
|
| 1 byte operating system | 2 bytes number n | n bytes UTF-8 string version |
|
||||||
|
+-------------------------+------------------+------------------------------+
|
||||||
|
|
||||||
|
|
||||||
// #### COMPATIBILITY OLD VERSION, TO BE REMOVED ####
|
// #### COMPATIBILITY OLD VERSION, TO BE REMOVED ####
|
||||||
- PROTMESSID_OPUS_SUPPORTED: Informs that OPUS codec is supported
|
- PROTMESSID_OPUS_SUPPORTED: Informs that OPUS codec is supported
|
||||||
|
@ -608,6 +614,10 @@ if ( rand() < ( RAND_MAX / 2 ) ) return false;
|
||||||
case PROTMESSID_REQ_CHANNEL_LEVEL_LIST:
|
case PROTMESSID_REQ_CHANNEL_LEVEL_LIST:
|
||||||
bRet = EvaluateReqChannelLevelListMes ( vecbyMesBodyData );
|
bRet = EvaluateReqChannelLevelListMes ( vecbyMesBodyData );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case PROTMESSID_VERSION_AND_OS:
|
||||||
|
bRet = EvaluateVersionAndOSMes ( vecbyMesBodyData );
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
// immediately send acknowledge message
|
// immediately send acknowledge message
|
||||||
|
@ -1335,6 +1345,71 @@ bool CProtocol::EvaluateReqChannelLevelListMes ( const CVector<uint8_t>& vecData
|
||||||
return false; // no error
|
return false; // no error
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CProtocol::CreateVersionAndOSMes()
|
||||||
|
{
|
||||||
|
int iPos = 0; // init position pointer
|
||||||
|
|
||||||
|
// get the version number string
|
||||||
|
const QString strVerion = VERSION;
|
||||||
|
|
||||||
|
// convert version string to utf-8
|
||||||
|
const QByteArray strUTF8Version = strVerion.toUtf8();
|
||||||
|
|
||||||
|
// size of current message body
|
||||||
|
const int iEntrLen =
|
||||||
|
1 /* operating system */ +
|
||||||
|
2 /* version utf-8 string size */ + strUTF8Version.size();
|
||||||
|
|
||||||
|
// build data vector
|
||||||
|
CVector<uint8_t> vecData ( iEntrLen );
|
||||||
|
|
||||||
|
// operating system (1 byte)
|
||||||
|
PutValOnStream ( vecData, iPos,
|
||||||
|
static_cast<uint32_t> ( COSUtil::GetOperatingSystem() ), 1 );
|
||||||
|
|
||||||
|
// version
|
||||||
|
PutStringUTF8OnStream ( vecData, iPos, strUTF8Version );
|
||||||
|
|
||||||
|
CreateAndSendMessage ( PROTMESSID_VERSION_AND_OS, vecData );
|
||||||
|
}
|
||||||
|
|
||||||
|
bool CProtocol::EvaluateVersionAndOSMes ( const CVector<uint8_t>& vecData )
|
||||||
|
{
|
||||||
|
int iPos = 0; // init position pointer
|
||||||
|
const int iDataLen = vecData.Size();
|
||||||
|
|
||||||
|
// check size (the first 1 byte)
|
||||||
|
if ( iDataLen < 1 )
|
||||||
|
{
|
||||||
|
return true; // return error code
|
||||||
|
}
|
||||||
|
|
||||||
|
// operating system (1 byte)
|
||||||
|
const COSUtil::EOpSystemType eOSType =
|
||||||
|
static_cast<COSUtil::EOpSystemType> ( GetValFromStream ( vecData, iPos, 1 ) );
|
||||||
|
|
||||||
|
// version text
|
||||||
|
QString strVersion;
|
||||||
|
if ( GetStringFromStream ( vecData,
|
||||||
|
iPos,
|
||||||
|
MAX_LEN_VERSION_TEXT,
|
||||||
|
strVersion ) )
|
||||||
|
{
|
||||||
|
return true; // return error code
|
||||||
|
}
|
||||||
|
|
||||||
|
// 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 VersionAndOSReceived ( eOSType, strVersion );
|
||||||
|
|
||||||
|
return false; // no error
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// Connection less messages ----------------------------------------------------
|
// Connection less messages ----------------------------------------------------
|
||||||
void CProtocol::CreateCLPingMes ( const CHostAddress& InetAddr, const int iMs )
|
void CProtocol::CreateCLPingMes ( const CHostAddress& InetAddr, const int iMs )
|
||||||
|
|
|
@ -55,6 +55,7 @@
|
||||||
#define PROTMESSID_OPUS_SUPPORTED 26 // tells that OPUS codec is supported
|
#define PROTMESSID_OPUS_SUPPORTED 26 // tells that OPUS codec is supported
|
||||||
#define PROTMESSID_LICENCE_REQUIRED 27 // licence required
|
#define PROTMESSID_LICENCE_REQUIRED 27 // licence required
|
||||||
#define PROTMESSID_REQ_CHANNEL_LEVEL_LIST 28 // request the channel level list
|
#define PROTMESSID_REQ_CHANNEL_LEVEL_LIST 28 // request the channel level list
|
||||||
|
#define PROTMESSID_VERSION_AND_OS 29 // version number and operating system
|
||||||
|
|
||||||
// message IDs of connection less messages (CLM)
|
// message IDs of connection less messages (CLM)
|
||||||
// DEFINITION -> start at 1000, end at 1999, see IsConnectionLessMessageID
|
// DEFINITION -> start at 1000, end at 1999, see IsConnectionLessMessageID
|
||||||
|
@ -106,6 +107,7 @@ public:
|
||||||
void CreateLicenceRequiredMes ( const ELicenceType eLicenceType );
|
void CreateLicenceRequiredMes ( const ELicenceType eLicenceType );
|
||||||
void CreateOpusSupportedMes();
|
void CreateOpusSupportedMes();
|
||||||
void CreateReqChannelLevelListMes ( const bool bRCL );
|
void CreateReqChannelLevelListMes ( const bool bRCL );
|
||||||
|
void CreateVersionAndOSMes();
|
||||||
|
|
||||||
void CreateCLPingMes ( const CHostAddress& InetAddr, const int iMs );
|
void CreateCLPingMes ( const CHostAddress& InetAddr, const int iMs );
|
||||||
void CreateCLPingWithNumClientsMes ( const CHostAddress& InetAddr,
|
void CreateCLPingWithNumClientsMes ( const CHostAddress& InetAddr,
|
||||||
|
@ -227,6 +229,7 @@ protected:
|
||||||
bool EvaluateReqNetwTranspPropsMes();
|
bool EvaluateReqNetwTranspPropsMes();
|
||||||
bool EvaluateLicenceRequiredMes ( const CVector<uint8_t>& vecData );
|
bool EvaluateLicenceRequiredMes ( const CVector<uint8_t>& vecData );
|
||||||
bool EvaluateReqChannelLevelListMes ( const CVector<uint8_t>& vecData );
|
bool EvaluateReqChannelLevelListMes ( const CVector<uint8_t>& vecData );
|
||||||
|
bool EvaluateVersionAndOSMes ( const CVector<uint8_t>& vecData );
|
||||||
|
|
||||||
bool EvaluateCLPingMes ( const CHostAddress& InetAddr,
|
bool EvaluateCLPingMes ( const CHostAddress& InetAddr,
|
||||||
const CVector<uint8_t>& vecData );
|
const CVector<uint8_t>& vecData );
|
||||||
|
@ -286,6 +289,7 @@ signals:
|
||||||
void ReqNetTranspProps();
|
void ReqNetTranspProps();
|
||||||
void LicenceRequired ( ELicenceType eLicenceType );
|
void LicenceRequired ( ELicenceType eLicenceType );
|
||||||
void ReqChannelLevelList ( bool bOptIn );
|
void ReqChannelLevelList ( bool bOptIn );
|
||||||
|
void VersionAndOSReceived ( COSUtil::EOpSystemType eOSType, QString strVersion );
|
||||||
|
|
||||||
void CLPingReceived ( CHostAddress InetAddr,
|
void CLPingReceived ( CHostAddress InetAddr,
|
||||||
int iMs );
|
int iMs );
|
||||||
|
|
|
@ -597,6 +597,9 @@ CreateAndSendChanListForAllConChannels();
|
||||||
vecChannels[iChID].CreateLicReqMes ( eLicenceType );
|
vecChannels[iChID].CreateLicReqMes ( eLicenceType );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// send version info (for, e.g., feature activation in the client)
|
||||||
|
vecChannels[iChID].CreateVersionAndOSMes();
|
||||||
|
|
||||||
// reset the conversion buffers
|
// reset the conversion buffers
|
||||||
DoubleFrameSizeConvBufIn[iChID].Reset();
|
DoubleFrameSizeConvBufIn[iChID].Reset();
|
||||||
DoubleFrameSizeConvBufOut[iChID].Reset();
|
DoubleFrameSizeConvBufOut[iChID].Reset();
|
||||||
|
|
Loading…
Reference in a new issue