improved implementation

This commit is contained in:
Volker Fischer 2006-03-04 11:12:47 +00:00
parent 83d61351bb
commit bcb421e175
2 changed files with 13 additions and 39 deletions

View file

@ -30,33 +30,20 @@
\******************************************************************************/ \******************************************************************************/
CChannelSet::CChannelSet() CChannelSet::CChannelSet()
{ {
// TEST for a test just connect each channel in a separate function // connect "message send"-message for each channel
// TODO better solution!!! for ( int i = 0; i < MAX_NUM_CHANNELS; i++ )
QObject::connect ( &vecChannels[0], SIGNAL ( MessReadyForSending ( CVector<uint8_t> ) ), {
this, SLOT ( OnSendProtMessageCh0 ( CVector<uint8_t> ) ) ); QObject::connect ( &vecChannels[i],
QObject::connect ( &vecChannels[1], SIGNAL ( MessReadyForSending ( CVector<uint8_t> ) ), SIGNAL ( MessReadyForSending ( CVector<uint8_t> ) ),
this, SLOT ( OnSendProtMessageCh0 ( CVector<uint8_t> ) ) ); this, SLOT ( OnSendProtMessage ( i, CVector<uint8_t> ) ) );
QObject::connect ( &vecChannels[2], SIGNAL ( MessReadyForSending ( CVector<uint8_t> ) ), }
this, SLOT ( OnSendProtMessageCh0 ( CVector<uint8_t> ) ) );
QObject::connect ( &vecChannels[3], SIGNAL ( MessReadyForSending ( CVector<uint8_t> ) ),
this, SLOT ( OnSendProtMessageCh0 ( CVector<uint8_t> ) ) );
QObject::connect ( &vecChannels[4], SIGNAL ( MessReadyForSending ( CVector<uint8_t> ) ),
this, SLOT ( OnSendProtMessageCh0 ( CVector<uint8_t> ) ) );
QObject::connect ( &vecChannels[5], SIGNAL ( MessReadyForSending ( CVector<uint8_t> ) ),
this, SLOT ( OnSendProtMessageCh0 ( CVector<uint8_t> ) ) );
QObject::connect ( &vecChannels[6], SIGNAL ( MessReadyForSending ( CVector<uint8_t> ) ),
this, SLOT ( OnSendProtMessageCh0 ( CVector<uint8_t> ) ) );
QObject::connect ( &vecChannels[7], SIGNAL ( MessReadyForSending ( CVector<uint8_t> ) ),
this, SLOT ( OnSendProtMessageCh0 ( CVector<uint8_t> ) ) );
QObject::connect ( &vecChannels[8], SIGNAL ( MessReadyForSending ( CVector<uint8_t> ) ),
this, SLOT ( OnSendProtMessageCh0 ( CVector<uint8_t> ) ) );
QObject::connect ( &vecChannels[9], SIGNAL ( MessReadyForSending ( CVector<uint8_t> ) ),
this, SLOT ( OnSendProtMessageCh0 ( CVector<uint8_t> ) ) );
} }
void CChannelSet::OnSendProtMessage ( int iChID, CVector<uint8_t> vecMessage )
{
// just pass message through and add channel ID
emit MessReadyForSending ( iChID,vecMessage );
}
int CChannelSet::GetFreeChan() int CChannelSet::GetFreeChan()
{ {

View file

@ -180,21 +180,8 @@ protected:
CChannel vecChannels[MAX_NUM_CHANNELS]; CChannel vecChannels[MAX_NUM_CHANNELS];
QMutex Mutex; QMutex Mutex;
public slots: public slots:
// TODO better solution!!! void OnSendProtMessage ( int iChID, CVector<uint8_t> vecMessage );
void OnSendProtMessageCh0(CVector<uint8_t> mess) { emit MessReadyForSending(0,mess); }
void OnSendProtMessageCh1(CVector<uint8_t> mess) { emit MessReadyForSending(1,mess); }
void OnSendProtMessageCh2(CVector<uint8_t> mess) { emit MessReadyForSending(2,mess); }
void OnSendProtMessageCh3(CVector<uint8_t> mess) { emit MessReadyForSending(3,mess); }
void OnSendProtMessageCh4(CVector<uint8_t> mess) { emit MessReadyForSending(4,mess); }
void OnSendProtMessageCh5(CVector<uint8_t> mess) { emit MessReadyForSending(5,mess); }
void OnSendProtMessageCh6(CVector<uint8_t> mess) { emit MessReadyForSending(6,mess); }
void OnSendProtMessageCh7(CVector<uint8_t> mess) { emit MessReadyForSending(7,mess); }
void OnSendProtMessageCh8(CVector<uint8_t> mess) { emit MessReadyForSending(8,mess); }
void OnSendProtMessageCh9(CVector<uint8_t> mess) { emit MessReadyForSending(9,mess); }
signals: signals:
void MessReadyForSending ( int iChID, CVector<uint8_t> vecMessage ); void MessReadyForSending ( int iChID, CVector<uint8_t> vecMessage );