Merge pull request #303 from atsampson/moretestbench

Update CTestbench for new protocol messages
This commit is contained in:
Volker Fischer 2020-05-28 07:25:35 +02:00 committed by GitHub
commit b509400a80
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -60,9 +60,11 @@ public:
iPortIncrement++; iPortIncrement++;
} }
// connect protocol signal // connect protocol signals
QObject::connect ( &Protocol, SIGNAL ( MessReadyForSending ( CVector<uint8_t> ) ), QObject::connect ( &Protocol, SIGNAL ( MessReadyForSending ( CVector<uint8_t> ) ),
this, SLOT ( OnSendProtMessage ( CVector<uint8_t> ) ) ); this, SLOT ( OnSendProtMessage ( CVector<uint8_t> ) ) );
QObject::connect ( &Protocol, SIGNAL ( CLMessReadyForSending ( CHostAddress, CVector<uint8_t> ) ),
this, SLOT ( OnSendCLMessage ( CHostAddress, CVector<uint8_t> ) ) );
// connect and start the timer (testbench heartbeat) // connect and start the timer (testbench heartbeat)
QObject::connect ( &Timer, SIGNAL ( timeout() ), QObject::connect ( &Timer, SIGNAL ( timeout() ),
@ -115,13 +117,15 @@ public slots:
CNetworkTransportProps NetTrProps; CNetworkTransportProps NetTrProps;
CServerCoreInfo ServerInfo; CServerCoreInfo ServerInfo;
CVector<CServerInfo> vecServerInfo ( 1 ); CVector<CServerInfo> vecServerInfo ( 1 );
CVector<uint16_t> vecLevelList ( 1 );
CHostAddress CurHostAddress ( QHostAddress ( sAddress ), iPort ); CHostAddress CurHostAddress ( QHostAddress ( sAddress ), iPort );
CHostAddress CurLocalAddress ( QHostAddress ( sLAddress ), iLPort ); CHostAddress CurLocalAddress ( QHostAddress ( sLAddress ), iLPort );
CChannelCoreInfo ChannelCoreInfo; CChannelCoreInfo ChannelCoreInfo;
ELicenceType eLicenceType; ELicenceType eLicenceType;
ESvrRegResult eSvrRegResult;
// generate random protocol message // generate random protocol message
switch ( GenRandomIntInRange ( 0, 27 ) ) switch ( GenRandomIntInRange ( 0, 34 ) )
{ {
case 0: // PROTMESSID_JITT_BUF_SIZE case 0: // PROTMESSID_JITT_BUF_SIZE
Protocol.CreateJitBufMes ( GenRandomIntInRange ( 0, 10 ) ); Protocol.CreateJitBufMes ( GenRandomIntInRange ( 0, 10 ) );
@ -278,11 +282,55 @@ public slots:
break; break;
case 27: case 27:
{
// arbitrary "audio" packet (with random sizes) // arbitrary "audio" packet (with random sizes)
CVector<uint8_t> vecMessage ( GenRandomIntInRange ( 1, 1000 ) ); CVector<uint8_t> vecMessage ( GenRandomIntInRange ( 1, 1000 ) );
OnSendProtMessage ( vecMessage ); OnSendProtMessage ( vecMessage );
break; break;
} }
case 28: // PROTMESSID_CLM_CONN_CLIENTS_LIST
vecChanInfo[0].iChanID = GenRandomIntInRange ( -2, 20 );
vecChanInfo[0].iIpAddr = GenRandomIPv4Address().toIPv4Address();
vecChanInfo[0].strName = GenRandomString();
Protocol.CreateCLConnClientsListMes ( CurHostAddress, vecChanInfo );
break;
case 29: // PROTMESSID_CLM_REQ_CONN_CLIENTS_LIST
Protocol.CreateCLReqConnClientsListMes ( CurHostAddress );
break;
case 30: // PROTMESSID_CLM_CHANNEL_LEVEL_LIST
vecLevelList[0] = GenRandomIntInRange ( 0, 0xF );
Protocol.CreateCLChannelLevelListMes ( CurHostAddress,
vecLevelList,
1 );
break;
case 31: // PROTMESSID_CLM_REGISTER_SERVER_RESP
eSvrRegResult =
static_cast<ESvrRegResult> ( GenRandomIntInRange ( 0, 1 ) );
Protocol.CreateCLRegisterServerResp ( CurHostAddress,
eSvrRegResult );
break;
case 32: // PROTMESSID_CHANNEL_PAN
Protocol.CreateChanPanMes ( GenRandomIntInRange ( -2, 20 ),
GenRandomIntInRange ( 0, 32767 ) );
break;
case 33: // PROTMESSID_MUTE_STATE_CHANGED
Protocol.CreateMuteStateHasChangedMes ( GenRandomIntInRange ( -2, 20 ),
GenRandomIntInRange ( 0, 1 ) );
break;
case 34: // PROTMESSID_CLIENT_ID
Protocol.CreateClientIDMes ( GenRandomIntInRange ( -2, 20 ) );
break;
}
} }
void OnSendProtMessage ( CVector<uint8_t> vecMessage ) void OnSendProtMessage ( CVector<uint8_t> vecMessage )
@ -295,4 +343,12 @@ public slots:
// send the next message // send the next message
Protocol.Reset(); Protocol.Reset();
} }
void OnSendCLMessage ( CHostAddress InetAddr, CVector<uint8_t> vecMessage )
{
// silence unused warning
(void) InetAddr;
OnSendProtMessage ( vecMessage );
}
}; };