bug fix for server
This commit is contained in:
parent
6d8160c518
commit
25161fa55a
5 changed files with 74 additions and 65 deletions
|
@ -114,7 +114,7 @@
|
||||||
<item>
|
<item>
|
||||||
<widget class="QLabel" name="TextLabelCopyright" >
|
<widget class="QLabel" name="TextLabelCopyright" >
|
||||||
<property name="text" >
|
<property name="text" >
|
||||||
<string>Copyright (C) 2005 - 2006</string>
|
<string>Copyright (C) 2005 - 2008</string>
|
||||||
</property>
|
</property>
|
||||||
<property name="wordWrap" >
|
<property name="wordWrap" >
|
||||||
<bool>false</bool>
|
<bool>false</bool>
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/******************************************************************************\
|
/******************************************************************************\
|
||||||
* Copyright (c) 2004-2006
|
* Copyright (c) 2004-2008
|
||||||
*
|
*
|
||||||
* Author(s):
|
* Author(s):
|
||||||
* Volker Fischer
|
* Volker Fischer
|
||||||
|
@ -28,8 +28,8 @@
|
||||||
/* Implementation *************************************************************/
|
/* Implementation *************************************************************/
|
||||||
CLlconServerDlg::CLlconServerDlg ( CServer* pNServP, QWidget* parent )
|
CLlconServerDlg::CLlconServerDlg ( CServer* pNServP, QWidget* parent )
|
||||||
: pServer ( pNServP ), QDialog ( parent ),
|
: pServer ( pNServP ), QDialog ( parent ),
|
||||||
BitmCubeGreen ( LED_WIDTH_HEIGHT_SIZE_PIXEL, LED_WIDTH_HEIGHT_SIZE_PIXEL ),
|
BitmCubeGreen ( LED_WIDTH_HEIGHT_SIZE_PIXEL, LED_WIDTH_HEIGHT_SIZE_PIXEL ),
|
||||||
BitmCubeRed ( LED_WIDTH_HEIGHT_SIZE_PIXEL, LED_WIDTH_HEIGHT_SIZE_PIXEL ),
|
BitmCubeRed ( LED_WIDTH_HEIGHT_SIZE_PIXEL, LED_WIDTH_HEIGHT_SIZE_PIXEL ),
|
||||||
BitmCubeYellow ( LED_WIDTH_HEIGHT_SIZE_PIXEL, LED_WIDTH_HEIGHT_SIZE_PIXEL )
|
BitmCubeYellow ( LED_WIDTH_HEIGHT_SIZE_PIXEL, LED_WIDTH_HEIGHT_SIZE_PIXEL )
|
||||||
{
|
{
|
||||||
setupUi ( this );
|
setupUi ( this );
|
||||||
|
@ -39,8 +39,8 @@ CLlconServerDlg::CLlconServerDlg ( CServer* pNServP, QWidget* parent )
|
||||||
tr ( " server " ) + QString ( VERSION ) );
|
tr ( " server " ) + QString ( VERSION ) );
|
||||||
|
|
||||||
// create bitmaps
|
// create bitmaps
|
||||||
BitmCubeGreen.fill ( QColor ( 0, 255, 0 ) );
|
BitmCubeGreen.fill ( QColor ( 0, 255, 0 ) );
|
||||||
BitmCubeRed.fill ( QColor ( 255, 0, 0 ) );
|
BitmCubeRed.fill ( QColor ( 255, 0, 0 ) );
|
||||||
BitmCubeYellow.fill ( QColor ( 255, 255, 0 ) );
|
BitmCubeYellow.fill ( QColor ( 255, 255, 0 ) );
|
||||||
|
|
||||||
// set up list view for connected clients
|
// set up list view for connected clients
|
||||||
|
@ -63,7 +63,7 @@ CLlconServerDlg::CLlconServerDlg ( CServer* pNServP, QWidget* parent )
|
||||||
for ( int i = MAX_NUM_CHANNELS - 1; i >= 0; i-- )
|
for ( int i = MAX_NUM_CHANNELS - 1; i >= 0; i-- )
|
||||||
{
|
{
|
||||||
vecpListViewItems[i] = new CServerListViewItem ( ListViewClients );
|
vecpListViewItems[i] = new CServerListViewItem ( ListViewClients );
|
||||||
vecpListViewItems[i]->setHidden ( false );
|
vecpListViewItems[i]->setHidden ( true );
|
||||||
}
|
}
|
||||||
|
|
||||||
// Init timing jitter text label
|
// Init timing jitter text label
|
||||||
|
@ -108,9 +108,9 @@ void CLlconServerDlg::OnTimer()
|
||||||
if ( !( vecHostAddresses[i].InetAddr == QHostAddress ( (quint32) 0 ) ) )
|
if ( !( vecHostAddresses[i].InetAddr == QHostAddress ( (quint32) 0 ) ) )
|
||||||
{
|
{
|
||||||
// IP, port number
|
// IP, port number
|
||||||
vecpListViewItems[i]->setText ( 0, QString().sprintf ( "%s : %d",
|
vecpListViewItems[i]->setText ( 0, QString("%1 : %2" ).
|
||||||
vecHostAddresses[i].InetAddr.toString(),
|
arg ( vecHostAddresses[i].InetAddr.toString() ).
|
||||||
vecHostAddresses[i].iPort ) /* IP, port */);
|
arg ( vecHostAddresses[i].iPort ) );
|
||||||
|
|
||||||
// name
|
// name
|
||||||
vecpListViewItems[i]->setText ( 1, vecsName[i] );
|
vecpListViewItems[i]->setText ( 1, vecsName[i] );
|
||||||
|
@ -123,15 +123,15 @@ void CLlconServerDlg::OnTimer()
|
||||||
vecpListViewItems[i]->setText ( 5,
|
vecpListViewItems[i]->setText ( 5,
|
||||||
QString().setNum (
|
QString().setNum (
|
||||||
double ( veciNetwInBlSiFact[i] * MIN_BLOCK_DURATION_MS ), 'f', 2 ) );
|
double ( veciNetwInBlSiFact[i] * MIN_BLOCK_DURATION_MS ), 'f', 2 ) );
|
||||||
vecpListViewItems[i]->setText(6,
|
vecpListViewItems[i]->setText ( 6,
|
||||||
QString().setNum (
|
QString().setNum (
|
||||||
double ( veciNetwOutBlSiFact[i] * MIN_BLOCK_DURATION_MS ), 'f', 2 ) );
|
double ( veciNetwOutBlSiFact[i] * MIN_BLOCK_DURATION_MS ), 'f', 2 ) );
|
||||||
|
|
||||||
vecpListViewItems[i]->setHidden ( true );
|
vecpListViewItems[i]->setHidden ( false );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
vecpListViewItems[i]->setHidden ( false );
|
vecpListViewItems[i]->setHidden ( true );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -156,8 +156,8 @@ void CLlconServerDlg::customEvent ( QEvent* Event )
|
||||||
ListViewMutex.lock();
|
ListViewMutex.lock();
|
||||||
|
|
||||||
const int iMessType = ( (CLlconEvent*) Event )->iMessType;
|
const int iMessType = ( (CLlconEvent*) Event )->iMessType;
|
||||||
const int iStatus = ( (CLlconEvent*) Event )->iStatus;
|
const int iStatus = ( (CLlconEvent*) Event )->iStatus;
|
||||||
const int iChanNum = ( (CLlconEvent*) Event )->iChanNum;
|
const int iChanNum = ( (CLlconEvent*) Event )->iChanNum;
|
||||||
|
|
||||||
switch(iMessType)
|
switch(iMessType)
|
||||||
{
|
{
|
||||||
|
|
|
@ -32,9 +32,9 @@
|
||||||
/* Implementation *************************************************************/
|
/* Implementation *************************************************************/
|
||||||
CMultiColorLED::CMultiColorLED ( QWidget* parent, Qt::WindowFlags f )
|
CMultiColorLED::CMultiColorLED ( QWidget* parent, Qt::WindowFlags f )
|
||||||
: QLabel ( parent, f ),
|
: QLabel ( parent, f ),
|
||||||
BitmCubeGreen ( LED_WIDTH_HEIGHT_SIZE_PIXEL, LED_WIDTH_HEIGHT_SIZE_PIXEL ),
|
BitmCubeGreen ( LED_WIDTH_HEIGHT_SIZE_PIXEL, LED_WIDTH_HEIGHT_SIZE_PIXEL ),
|
||||||
BitmCubeRed ( LED_WIDTH_HEIGHT_SIZE_PIXEL, LED_WIDTH_HEIGHT_SIZE_PIXEL ),
|
BitmCubeRed ( LED_WIDTH_HEIGHT_SIZE_PIXEL, LED_WIDTH_HEIGHT_SIZE_PIXEL ),
|
||||||
BitmCubeGrey ( LED_WIDTH_HEIGHT_SIZE_PIXEL, LED_WIDTH_HEIGHT_SIZE_PIXEL ),
|
BitmCubeGrey ( LED_WIDTH_HEIGHT_SIZE_PIXEL, LED_WIDTH_HEIGHT_SIZE_PIXEL ),
|
||||||
BitmCubeYellow ( LED_WIDTH_HEIGHT_SIZE_PIXEL, LED_WIDTH_HEIGHT_SIZE_PIXEL )
|
BitmCubeYellow ( LED_WIDTH_HEIGHT_SIZE_PIXEL, LED_WIDTH_HEIGHT_SIZE_PIXEL )
|
||||||
{
|
{
|
||||||
// create bitmaps
|
// create bitmaps
|
||||||
|
@ -56,12 +56,12 @@ CMultiColorLED::CMultiColorLED ( QWidget* parent, Qt::WindowFlags f )
|
||||||
eColorFlag = RL_GREY;
|
eColorFlag = RL_GREY;
|
||||||
|
|
||||||
// init update time
|
// init update time
|
||||||
SetUpdateTime ( DEFAULT_UPDATE_TIME );
|
SetUpdateTime ( DEFAULT_UPDATE_TIME );
|
||||||
|
|
||||||
// init timers -> we want to have single shot timers
|
// init timers -> we want to have single shot timers
|
||||||
TimerRedLight.setSingleShot ( true );
|
TimerRedLight.setSingleShot ( true );
|
||||||
TimerGreenLight.setSingleShot ( true );
|
TimerGreenLight.setSingleShot ( true );
|
||||||
TimerYellowLight.setSingleShot ( true );
|
TimerYellowLight.setSingleShot ( true );
|
||||||
|
|
||||||
// connect timer events to the desired slots
|
// connect timer events to the desired slots
|
||||||
connect ( &TimerRedLight, SIGNAL ( timeout() ),
|
connect ( &TimerRedLight, SIGNAL ( timeout() ),
|
||||||
|
@ -70,6 +70,9 @@ CMultiColorLED::CMultiColorLED ( QWidget* parent, Qt::WindowFlags f )
|
||||||
this, SLOT ( OnTimerGreenLight() ) );
|
this, SLOT ( OnTimerGreenLight() ) );
|
||||||
connect ( &TimerYellowLight, SIGNAL ( timeout() ),
|
connect ( &TimerYellowLight, SIGNAL ( timeout() ),
|
||||||
this, SLOT ( OnTimerYellowLight() ) );
|
this, SLOT ( OnTimerYellowLight() ) );
|
||||||
|
|
||||||
|
connect ( this, SIGNAL ( newPixmap ( const QPixmap& ) ),
|
||||||
|
this, SLOT ( OnNewPixmap ( const QPixmap& ) ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
void CMultiColorLED::Reset()
|
void CMultiColorLED::Reset()
|
||||||
|
@ -109,7 +112,8 @@ void CMultiColorLED::UpdateColor()
|
||||||
{
|
{
|
||||||
if ( eColorFlag != RL_RED )
|
if ( eColorFlag != RL_RED )
|
||||||
{
|
{
|
||||||
setPixmap ( BitmCubeRed );
|
//setPixmap ( BitmCubeRed );
|
||||||
|
emit newPixmap ( BitmCubeRed );
|
||||||
eColorFlag = RL_RED;
|
eColorFlag = RL_RED;
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
|
@ -119,7 +123,8 @@ void CMultiColorLED::UpdateColor()
|
||||||
{
|
{
|
||||||
if ( eColorFlag != RL_YELLOW )
|
if ( eColorFlag != RL_YELLOW )
|
||||||
{
|
{
|
||||||
setPixmap ( BitmCubeYellow );
|
//setPixmap ( BitmCubeYellow );
|
||||||
|
emit newPixmap ( BitmCubeYellow );
|
||||||
eColorFlag = RL_YELLOW;
|
eColorFlag = RL_YELLOW;
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
|
@ -129,7 +134,8 @@ void CMultiColorLED::UpdateColor()
|
||||||
{
|
{
|
||||||
if ( eColorFlag != RL_GREEN )
|
if ( eColorFlag != RL_GREEN )
|
||||||
{
|
{
|
||||||
setPixmap ( BitmCubeGreen );
|
//setPixmap ( BitmCubeGreen );
|
||||||
|
emit newPixmap ( BitmCubeGreen );
|
||||||
eColorFlag = RL_GREEN;
|
eColorFlag = RL_GREEN;
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
|
@ -173,15 +179,15 @@ void CMultiColorLED::SetUpdateTime ( const int iNUTi )
|
||||||
{
|
{
|
||||||
// avoid too short intervals
|
// avoid too short intervals
|
||||||
if ( iNUTi < MIN_TIME_FOR_RED_LIGHT )
|
if ( iNUTi < MIN_TIME_FOR_RED_LIGHT )
|
||||||
{
|
{
|
||||||
iUpdateTime = MIN_TIME_FOR_RED_LIGHT;
|
iUpdateTime = MIN_TIME_FOR_RED_LIGHT;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
iUpdateTime = iNUTi;
|
iUpdateTime = iNUTi;
|
||||||
}
|
}
|
||||||
|
|
||||||
TimerGreenLight.setInterval ( iUpdateTime );
|
TimerGreenLight.setInterval ( iUpdateTime );
|
||||||
TimerYellowLight.setInterval ( iUpdateTime );
|
TimerYellowLight.setInterval ( iUpdateTime );
|
||||||
TimerRedLight.setInterval ( iUpdateTime );
|
TimerRedLight.setInterval ( iUpdateTime );
|
||||||
}
|
}
|
||||||
|
|
|
@ -82,18 +82,20 @@ protected:
|
||||||
bool bFlagYellowLi;
|
bool bFlagYellowLi;
|
||||||
|
|
||||||
protected slots:
|
protected slots:
|
||||||
void OnTimerRedLight();
|
void OnTimerRedLight();
|
||||||
void OnTimerGreenLight();
|
void OnTimerGreenLight();
|
||||||
void OnTimerYellowLight();
|
void OnTimerYellowLight();
|
||||||
|
virtual void OnNewPixmap ( const QPixmap& newPixmap ) { setPixmap ( newPixmap ); }
|
||||||
|
|
||||||
|
signals:
|
||||||
|
void newPixmap ( const QPixmap& newPixmap );
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// TODO list view item LED does not work anymore
|
|
||||||
|
|
||||||
class CMultColLEDListViewItem : public CMultiColorLED
|
class CMultColLEDListViewItem : public CMultiColorLED
|
||||||
{
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
CMultColLEDListViewItem ( const int iNewCol ) : iColumn ( iNewCol ),
|
CMultColLEDListViewItem ( const int iNewCol ) : iColumn ( iNewCol ),
|
||||||
pListViewItem ( NULL ) {}
|
pListViewItem ( NULL ) {}
|
||||||
|
@ -103,15 +105,16 @@ public:
|
||||||
pListViewItem = pNewListViewItem;
|
pListViewItem = pNewListViewItem;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected:
|
protected slots:
|
||||||
virtual void SetPixmap ( QPixmap& NewBitmap )
|
virtual void OnNewPixmap ( const QPixmap& newPixmap )
|
||||||
{
|
{
|
||||||
if ( pListViewItem != NULL )
|
if ( pListViewItem != NULL )
|
||||||
{
|
{
|
||||||
pListViewItem->setIcon ( iColumn, QIcon ( NewBitmap ) );
|
pListViewItem->setIcon ( iColumn, QIcon ( newPixmap ) );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected:
|
||||||
QTreeWidgetItem* pListViewItem;
|
QTreeWidgetItem* pListViewItem;
|
||||||
int iColumn;
|
int iColumn;
|
||||||
};
|
};
|
||||||
|
|
20
src/util.h
20
src/util.h
|
@ -256,13 +256,13 @@ public:
|
||||||
inline TData GetAverage()
|
inline TData GetAverage()
|
||||||
{
|
{
|
||||||
if ( this->iNorm == 0 )
|
if ( this->iNorm == 0 )
|
||||||
{
|
{
|
||||||
return TData ( 0 );
|
return TData ( 0 );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
return tCurAvResult / this->iNorm;
|
return tCurAvResult / this->iNorm;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void Init ( const int iNewSize );
|
virtual void Init ( const int iNewSize );
|
||||||
|
@ -299,15 +299,15 @@ template<class TData> void CMovingAv<TData>::Add ( const TData tNewD )
|
||||||
// increase position pointer and test if wrap
|
// increase position pointer and test if wrap
|
||||||
iCurIdx++;
|
iCurIdx++;
|
||||||
if ( iCurIdx >= this->iVectorSize )
|
if ( iCurIdx >= this->iVectorSize )
|
||||||
{
|
{
|
||||||
iCurIdx = 0;
|
iCurIdx = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
// take care of norm
|
// take care of norm
|
||||||
if ( this->iNorm < this->iVectorSize )
|
if ( this->iNorm < this->iVectorSize )
|
||||||
{
|
{
|
||||||
this->iNorm++;
|
this->iNorm++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue