some cleanup for the server

This commit is contained in:
Volker Fischer 2011-04-14 19:40:12 +00:00
parent a238cd9569
commit 043a7f28e1
3 changed files with 49 additions and 117 deletions

View file

@ -38,8 +38,7 @@ CLlconServerDlg::CLlconServerDlg ( CServer* pNServP, QWidget* parent )
// set up list view for connected clients // set up list view for connected clients
ListViewClients->setColumnWidth ( 0, 170 ); ListViewClients->setColumnWidth ( 0, 170 );
ListViewClients->setColumnWidth ( 1, 130 ); ListViewClients->setColumnWidth ( 1, 130 );
ListViewClients->setColumnWidth ( 2, 40 ); ListViewClients->setColumnWidth ( 2, 60 );
ListViewClients->setColumnWidth ( 3, 40 );
ListViewClients->clear(); ListViewClients->clear();
// insert items in reverse order because in Windows all of them are // insert items in reverse order because in Windows all of them are
@ -51,9 +50,6 @@ CLlconServerDlg::CLlconServerDlg ( CServer* pNServP, QWidget* parent )
vecpListViewItems[i]->setHidden ( true ); vecpListViewItems[i]->setHidden ( true );
} }
// Init timing jitter text label
TextLabelResponseTime->setText ( "" );
// Main menu bar ----------------------------------------------------------- // Main menu bar -----------------------------------------------------------
pMenu = new QMenuBar ( this ); pMenu = new QMenuBar ( this );
@ -79,56 +75,46 @@ void CLlconServerDlg::OnTimer()
CVector<QString> vecsName; CVector<QString> vecsName;
CVector<int> veciJitBufNumFrames; CVector<int> veciJitBufNumFrames;
CVector<int> veciNetwFrameSizeFact; CVector<int> veciNetwFrameSizeFact;
double dCurTiStdDev;
ListViewMutex.lock(); ListViewMutex.lock();
pServer->GetConCliParam ( vecHostAddresses, vecsName, veciJitBufNumFrames,
veciNetwFrameSizeFact );
// fill list with connected clients
for ( int i = 0; i < USED_NUM_CHANNELS; i++ )
{ {
if ( !( vecHostAddresses[i].InetAddr == QHostAddress ( (quint32) 0 ) ) ) pServer->GetConCliParam ( vecHostAddresses,
vecsName,
veciJitBufNumFrames,
veciNetwFrameSizeFact );
// fill list with connected clients
for ( int i = 0; i < USED_NUM_CHANNELS; i++ )
{ {
// IP, port number if ( !( vecHostAddresses[i].InetAddr == QHostAddress ( (quint32) 0 ) ) )
vecpListViewItems[i]->setText ( 0, QString("%1 : %2" ). {
arg ( vecHostAddresses[i].InetAddr.toString() ). // IP, port number
arg ( vecHostAddresses[i].iPort ) ); vecpListViewItems[i]->setText ( 0, QString("%1 : %2" ).
arg ( vecHostAddresses[i].InetAddr.toString() ).
arg ( vecHostAddresses[i].iPort ) );
// name // name
vecpListViewItems[i]->setText ( 1, vecsName[i] ); vecpListViewItems[i]->setText ( 1, vecsName[i] );
// jitter buffer size (polling for updates) // jitter buffer size (polling for updates)
vecpListViewItems[i]->setText ( 4, vecpListViewItems[i]->setText ( 3,
QString().setNum ( veciJitBufNumFrames[i] ) ); QString().setNum ( veciJitBufNumFrames[i] ) );
// out network block size // out network block size
vecpListViewItems[i]->setText ( 5, vecpListViewItems[i]->setText ( 4,
QString().setNum ( static_cast<double> ( QString().setNum ( static_cast<double> (
veciNetwFrameSizeFact[i] * SYSTEM_BLOCK_DURATION_MS_FLOAT veciNetwFrameSizeFact[i] * SYSTEM_BLOCK_DURATION_MS_FLOAT
), 'f', 2 ) ); ), 'f', 2 ) );
vecpListViewItems[i]->setHidden ( false ); vecpListViewItems[i]->setHidden ( false );
} }
else else
{ {
vecpListViewItems[i]->setHidden ( true ); vecpListViewItems[i]->setHidden ( true );
}
} }
} }
ListViewMutex.unlock(); ListViewMutex.unlock();
// response time (if available)
if ( pServer->GetTimingStdDev ( dCurTiStdDev ) )
{
TextLabelResponseTime->setText ( QString().
setNum ( dCurTiStdDev, 'f', 2 ) + " ms" );
}
else
{
TextLabelResponseTime->setText ( "---" );
}
} }
void CLlconServerDlg::customEvent ( QEvent* Event ) void CLlconServerDlg::customEvent ( QEvent* Event )
@ -136,22 +122,19 @@ void CLlconServerDlg::customEvent ( QEvent* Event )
if ( Event->type() == QEvent::User + 11 ) if ( Event->type() == QEvent::User + 11 )
{ {
ListViewMutex.lock(); ListViewMutex.lock();
const int iMessType = ( (CLlconEvent*) Event )->iMessType;
const int iStatus = ( (CLlconEvent*) Event )->iStatus;
const int iChanNum = ( (CLlconEvent*) Event )->iChanNum;
switch(iMessType)
{ {
case MS_JIT_BUF_PUT: const int iMessType = ( (CLlconEvent*) Event )->iMessType;
vecpListViewItems[iChanNum]->SetLight ( 0, iStatus ); const int iStatus = ( (CLlconEvent*) Event )->iStatus;
break; const int iChanNum = ( (CLlconEvent*) Event )->iChanNum;
case MS_JIT_BUF_GET: switch(iMessType)
vecpListViewItems[iChanNum]->SetLight ( 1, iStatus ); {
break; case MS_JIT_BUF_PUT:
case MS_JIT_BUF_GET:
vecpListViewItems[iChanNum]->SetLight ( iStatus );
break;
}
} }
ListViewMutex.unlock(); ListViewMutex.unlock();
} }
} }

View file

@ -5,7 +5,7 @@
<rect> <rect>
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>765</width> <width>580</width>
<height>315</height> <height>315</height>
</rect> </rect>
</property> </property>
@ -51,22 +51,17 @@
</column> </column>
<column> <column>
<property name="text" > <property name="text" >
<string>Put</string> <string>Buffers</string>
</property> </property>
</column> </column>
<column> <column>
<property name="text" > <property name="text" >
<string>Get</string> <string>Jitter Buffer Size</string>
</property> </property>
</column> </column>
<column> <column>
<property name="text" > <property name="text" >
<string>Jitter buffer size</string> <string>Block Size Out/ms</string>
</property>
</column>
<column>
<property name="text" >
<string>Block Size Out</string>
</property> </property>
</column> </column>
</widget> </widget>
@ -98,42 +93,6 @@
</property> </property>
</widget> </widget>
</item> </item>
<item>
<spacer>
<property name="orientation" >
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType" >
<enum>QSizePolicy::Fixed</enum>
</property>
<property name="sizeHint" >
<size>
<width>72</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QLabel" name="TextLabel1" >
<property name="text" >
<string>Timing Standard Deviation:</string>
</property>
<property name="wordWrap" >
<bool>false</bool>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="TextLabelResponseTime" >
<property name="text" >
<string>TextLabelResponseTime</string>
</property>
<property name="wordWrap" >
<bool>false</bool>
</property>
</widget>
</item>
<item> <item>
<spacer> <spacer>
<property name="orientation" > <property name="orientation" >

View file

@ -132,28 +132,18 @@ class CServerListViewItem : public QTreeWidgetItem
{ {
public: public:
CServerListViewItem ( QTreeWidget* parent ) CServerListViewItem ( QTreeWidget* parent )
: QTreeWidgetItem ( parent ), LED0 ( 2 ), LED1 ( 3 ) : QTreeWidgetItem ( parent ), LED ( 2 )
{ {
LED0.SetListViewItemPointer ( this ); LED.SetListViewItemPointer ( this );
LED1.SetListViewItemPointer ( this );
} }
void SetLight ( int iWhichLED, int iNewStatus ) void SetLight ( int iNewStatus )
{ {
switch ( iWhichLED ) LED.SetLight ( iNewStatus );
{
case 0:
LED0.SetLight ( iNewStatus );
break;
case 1:
LED1.SetLight ( iNewStatus );
break;
}
} }
protected: protected:
CMultColLEDListViewItem LED0, LED1; CMultColLEDListViewItem LED;
}; };