some more work for ping message

This commit is contained in:
Volker Fischer 2008-08-02 07:28:21 +00:00
parent 1b2e1dcb6e
commit 788908b0d2
6 changed files with 71 additions and 34 deletions

View file

@ -1,5 +1,5 @@
/******************************************************************************\
* Copyright (c) 2004-2006
* Copyright (c) 2004-2008
*
* Author(s):
* Volker Fischer
@ -70,13 +70,21 @@ CChannelSet::CChannelSet()
QObject::connect ( &vecChannels[4], SIGNAL ( NameHasChanged() ), this, SLOT ( OnNameHasChangedCh4() ) );
QObject::connect ( &vecChannels[5], SIGNAL ( NameHasChanged() ), this, SLOT ( OnNameHasChangedCh5() ) );
// chate text received
// chat text received
QObject::connect ( &vecChannels[0], SIGNAL ( ChatTextReceived ( QString ) ), this, SLOT ( OnChatTextReceivedCh0 ( QString ) ) );
QObject::connect ( &vecChannels[1], SIGNAL ( ChatTextReceived ( QString ) ), this, SLOT ( OnChatTextReceivedCh1 ( QString ) ) );
QObject::connect ( &vecChannels[2], SIGNAL ( ChatTextReceived ( QString ) ), this, SLOT ( OnChatTextReceivedCh2 ( QString ) ) );
QObject::connect ( &vecChannels[3], SIGNAL ( ChatTextReceived ( QString ) ), this, SLOT ( OnChatTextReceivedCh3 ( QString ) ) );
QObject::connect ( &vecChannels[4], SIGNAL ( ChatTextReceived ( QString ) ), this, SLOT ( OnChatTextReceivedCh4 ( QString ) ) );
QObject::connect ( &vecChannels[5], SIGNAL ( ChatTextReceived ( QString ) ), this, SLOT ( OnChatTextReceivedCh5 ( QString ) ) );
// ping message received
QObject::connect ( &vecChannels[0], SIGNAL ( PingReceived ( QTime ) ), this, SLOT ( OnPingReceivedCh0 ( QTime ) ) );
QObject::connect ( &vecChannels[1], SIGNAL ( PingReceived ( QTime ) ), this, SLOT ( OnPingReceivedCh1 ( QTime ) ) );
QObject::connect ( &vecChannels[2], SIGNAL ( PingReceived ( QTime ) ), this, SLOT ( OnPingReceivedCh2 ( QTime ) ) );
QObject::connect ( &vecChannels[3], SIGNAL ( PingReceived ( QTime ) ), this, SLOT ( OnPingReceivedCh3 ( QTime ) ) );
QObject::connect ( &vecChannels[4], SIGNAL ( PingReceived ( QTime ) ), this, SLOT ( OnPingReceivedCh4 ( QTime ) ) );
QObject::connect ( &vecChannels[5], SIGNAL ( PingReceived ( QTime ) ), this, SLOT ( OnPingReceivedCh5 ( QTime ) ) );
}
CVector<CChannelShortInfo> CChannelSet::CreateChannelList()
@ -475,6 +483,9 @@ CChannel::CChannel() : sName ( "" ),
QObject::connect( &Protocol, SIGNAL ( ChatTextReceived ( QString ) ),
this, SIGNAL ( ChatTextReceived ( QString ) ) );
QObject::connect( &Protocol, SIGNAL ( PingReceived ( QTime ) ),
this, SIGNAL ( PingReceived ( QTime ) ) );
}
void CChannel::SetEnable ( const bool bNEnStat )

View file

@ -1,5 +1,5 @@
/******************************************************************************\
* Copyright (c) 2004-2006
* Copyright (c) 2004-2008
*
* Author(s):
* Volker Fischer
@ -118,6 +118,7 @@ public:
void CreateReqJitBufMes() { Protocol.CreateReqJitBufMes(); }
void CreateReqConnClientsList() { Protocol.CreateReqConnClientsList(); }
void CreateChatTextMes ( const QString& strChatText ) { Protocol.CreateChatTextMes ( strChatText ); }
void CreatePingMes ( const QTime time ) { Protocol.CreatePingMes ( time ); }
void CreateNetwBlSiFactMes ( const int iNetwBlSiFact )
{
@ -194,6 +195,7 @@ signals:
void ProtocolStatus ( bool bOk );
void NameHasChanged();
void ChatTextReceived ( QString strChatText );
void PingReceived ( QTime time );
};
@ -285,6 +287,13 @@ public slots:
void OnChatTextReceivedCh4 ( QString strChatText ) { CreateAndSendChatTextForAllConChannels ( 4, strChatText ); }
void OnChatTextReceivedCh5 ( QString strChatText ) { CreateAndSendChatTextForAllConChannels ( 5, strChatText ); }
void OnPingReceivedCh0 ( QTime time ) { vecChannels[0].CreatePingMes ( time ); }
void OnPingReceivedCh1 ( QTime time ) { vecChannels[1].CreatePingMes ( time ); }
void OnPingReceivedCh2 ( QTime time ) { vecChannels[2].CreatePingMes ( time ); }
void OnPingReceivedCh3 ( QTime time ) { vecChannels[3].CreatePingMes ( time ); }
void OnPingReceivedCh4 ( QTime time ) { vecChannels[4].CreatePingMes ( time ); }
void OnPingReceivedCh5 ( QTime time ) { vecChannels[5].CreatePingMes ( time ); }
signals:
void MessReadyForSending ( int iChID, CVector<uint8_t> vecMessage );
};

View file

@ -88,6 +88,12 @@ void CClient::OnNewConnection()
Channel.CreateReqConnClientsList();
}
void CClient::OnReceivePingMessage ( QTime time )
{
// calculate difference between received time and current time
emit PingTimeReceived ( time.msecsTo ( QTime().currentTime() ) );
}
bool CClient::SetServerAddr ( QString strNAddr )
{
QHostAddress InetAddr;

View file

@ -124,6 +124,9 @@ public:
void SendTextMess ( const QString& strChatText )
{ Channel.CreateChatTextMes ( strChatText ); }
void SendPingMess()
{ Channel.CreatePingMes ( QTime().currentTime() ); }
CSound* GetSndInterface() { return &Sound; }
CChannel* GetChannel() { return &Channel; }
@ -182,10 +185,12 @@ public slots:
void OnReqJittBufSize();
void OnProtocolStatus ( bool bOk );
void OnNewConnection();
void OnReceivePingMessage ( QTime time );
signals:
void ConClientListMesReceived ( CVector<CChannelShortInfo> vecChanInfo );
void ChatTextReceived ( QString strChatText );
void PingTimeReceived ( int iPingTime );
};

View file

@ -164,6 +164,12 @@ void CClientSettingsDlg::OnOpenChatOnNewMessageStateChanged ( int value )
void CClientSettingsDlg::UpdateDisplay()
{
// TEST
//pClient->SendPingMess();
// response time
TextLabelStdDevTimer->setText ( QString().
setNum ( pClient->GetTimingStdDev(), 'f', 2 ) + " ms" );

View file

@ -1,5 +1,5 @@
/******************************************************************************\
* Copyright (c) 2004-2006
* Copyright (c) 2004-2008
*
* Author(s):
* Volker Fischer