From bcb421e175acd71545836724dfc2534fe8e41e98 Mon Sep 17 00:00:00 2001 From: Volker Fischer Date: Sat, 4 Mar 2006 11:12:47 +0000 Subject: [PATCH] improved implementation --- src/channel.cpp | 37 ++++++++++++------------------------- src/channel.h | 15 +-------------- 2 files changed, 13 insertions(+), 39 deletions(-) diff --git a/src/channel.cpp b/src/channel.cpp index fe0b54ea..784dda0c 100755 --- a/src/channel.cpp +++ b/src/channel.cpp @@ -30,33 +30,20 @@ \******************************************************************************/ CChannelSet::CChannelSet() { -// TEST for a test just connect each channel in a separate function -// TODO better solution!!! -QObject::connect ( &vecChannels[0], SIGNAL ( MessReadyForSending ( CVector ) ), - this, SLOT ( OnSendProtMessageCh0 ( CVector ) ) ); -QObject::connect ( &vecChannels[1], SIGNAL ( MessReadyForSending ( CVector ) ), - this, SLOT ( OnSendProtMessageCh0 ( CVector ) ) ); -QObject::connect ( &vecChannels[2], SIGNAL ( MessReadyForSending ( CVector ) ), - this, SLOT ( OnSendProtMessageCh0 ( CVector ) ) ); -QObject::connect ( &vecChannels[3], SIGNAL ( MessReadyForSending ( CVector ) ), - this, SLOT ( OnSendProtMessageCh0 ( CVector ) ) ); -QObject::connect ( &vecChannels[4], SIGNAL ( MessReadyForSending ( CVector ) ), - this, SLOT ( OnSendProtMessageCh0 ( CVector ) ) ); -QObject::connect ( &vecChannels[5], SIGNAL ( MessReadyForSending ( CVector ) ), - this, SLOT ( OnSendProtMessageCh0 ( CVector ) ) ); -QObject::connect ( &vecChannels[6], SIGNAL ( MessReadyForSending ( CVector ) ), - this, SLOT ( OnSendProtMessageCh0 ( CVector ) ) ); -QObject::connect ( &vecChannels[7], SIGNAL ( MessReadyForSending ( CVector ) ), - this, SLOT ( OnSendProtMessageCh0 ( CVector ) ) ); -QObject::connect ( &vecChannels[8], SIGNAL ( MessReadyForSending ( CVector ) ), - this, SLOT ( OnSendProtMessageCh0 ( CVector ) ) ); -QObject::connect ( &vecChannels[9], SIGNAL ( MessReadyForSending ( CVector ) ), - this, SLOT ( OnSendProtMessageCh0 ( CVector ) ) ); - - + // connect "message send"-message for each channel + for ( int i = 0; i < MAX_NUM_CHANNELS; i++ ) + { + QObject::connect ( &vecChannels[i], + SIGNAL ( MessReadyForSending ( CVector ) ), + this, SLOT ( OnSendProtMessage ( i, CVector ) ) ); + } } - +void CChannelSet::OnSendProtMessage ( int iChID, CVector vecMessage ) +{ + // just pass message through and add channel ID + emit MessReadyForSending ( iChID,vecMessage ); +} int CChannelSet::GetFreeChan() { diff --git a/src/channel.h b/src/channel.h index 51bc4248..437f55de 100755 --- a/src/channel.h +++ b/src/channel.h @@ -180,21 +180,8 @@ protected: CChannel vecChannels[MAX_NUM_CHANNELS]; QMutex Mutex; - - public slots: -// TODO better solution!!! - void OnSendProtMessageCh0(CVector mess) { emit MessReadyForSending(0,mess); } - void OnSendProtMessageCh1(CVector mess) { emit MessReadyForSending(1,mess); } - void OnSendProtMessageCh2(CVector mess) { emit MessReadyForSending(2,mess); } - void OnSendProtMessageCh3(CVector mess) { emit MessReadyForSending(3,mess); } - void OnSendProtMessageCh4(CVector mess) { emit MessReadyForSending(4,mess); } - void OnSendProtMessageCh5(CVector mess) { emit MessReadyForSending(5,mess); } - void OnSendProtMessageCh6(CVector mess) { emit MessReadyForSending(6,mess); } - void OnSendProtMessageCh7(CVector mess) { emit MessReadyForSending(7,mess); } - void OnSendProtMessageCh8(CVector mess) { emit MessReadyForSending(8,mess); } - void OnSendProtMessageCh9(CVector mess) { emit MessReadyForSending(9,mess); } - + void OnSendProtMessage ( int iChID, CVector vecMessage ); signals: void MessReadyForSending ( int iChID, CVector vecMessage );