make the "ParseMessageBody" signal/slot mechanism the default since in the future we will need to use different threads at some point

This commit is contained in:
Volker Fischer 2014-01-06 12:52:53 +00:00
parent 7c81775232
commit 27f0e540b6
2 changed files with 5 additions and 16 deletions

View file

@ -105,13 +105,11 @@ QObject::connect ( &Protocol,
SIGNAL ( ReqNetTranspProps() ), SIGNAL ( ReqNetTranspProps() ),
this, SLOT ( OnReqNetTranspProps() ) ); this, SLOT ( OnReqNetTranspProps() ) );
#ifdef ENABLE_RECEIVE_SOCKET_IN_SEPARATE_THREAD
// this connection is intended for a thread transition if we have a // this connection is intended for a thread transition if we have a
// separate socket thread running // separate socket thread running
QObject::connect ( this, QObject::connect ( this,
SIGNAL ( ParseMessageBody ( CVector<uint8_t>, int, int ) ), SIGNAL ( ParseMessageBody ( CVector<uint8_t>, int, int ) ),
this, SLOT ( OnParseMessageBody ( CVector<uint8_t>, int, int ) ) ); this, SLOT ( OnParseMessageBody ( CVector<uint8_t>, int, int ) ) );
#endif
} }
bool CChannel::ProtocolIsEnabled() bool CChannel::ProtocolIsEnabled()
@ -483,7 +481,6 @@ EPutDataStat CChannel::PutData ( const CVector<uint8_t>& vecbyData,
} }
else else
{ {
#ifdef ENABLE_RECEIVE_SOCKET_IN_SEPARATE_THREAD
// parse the message assuming this is a regular protocol message // parse the message assuming this is a regular protocol message
emit ParseMessageBody ( vecbyMesBodyData, iRecCounter, iRecID ); emit ParseMessageBody ( vecbyMesBodyData, iRecCounter, iRecID );
@ -491,14 +488,6 @@ EPutDataStat CChannel::PutData ( const CVector<uint8_t>& vecbyData,
// check if the protocol was ok since we emit just a signal // check if the protocol was ok since we emit just a signal
// and do not get any feedback on the protocol decoding state // and do not get any feedback on the protocol decoding state
eRet = PS_PROT_OK; eRet = PS_PROT_OK;
#else
// parse the message assuming this is a protocol message
if ( !Protocol.ParseMessageBody ( vecbyMesBodyData, iRecCounter, iRecID ) )
{
// set status flag
eRet = PS_PROT_OK;
}
#endif
} }
} }
else else

View file

@ -208,11 +208,13 @@ public slots:
void OnNetTranspPropsReceived ( CNetworkTransportProps NetworkTransportProps ); void OnNetTranspPropsReceived ( CNetworkTransportProps NetworkTransportProps );
void OnReqNetTranspProps(); void OnReqNetTranspProps();
#ifdef ENABLE_RECEIVE_SOCKET_IN_SEPARATE_THREAD
void OnParseMessageBody ( CVector<uint8_t> vecbyMesBodyData, void OnParseMessageBody ( CVector<uint8_t> vecbyMesBodyData,
int iRecCounter, int iRecCounter,
int iRecID ) { Protocol.ParseMessageBody ( vecbyMesBodyData, iRecCounter, iRecID ); } int iRecID )
#endif {
// note that the return value is ignored here
Protocol.ParseMessageBody ( vecbyMesBodyData, iRecCounter, iRecID );
}
signals: signals:
void MessReadyForSending ( CVector<uint8_t> vecMessage ); void MessReadyForSending ( CVector<uint8_t> vecMessage );
@ -233,11 +235,9 @@ signals:
void DetectedCLMessage ( CVector<uint8_t> vecbyMesBodyData, void DetectedCLMessage ( CVector<uint8_t> vecbyMesBodyData,
int iRecID ); int iRecID );
#ifdef ENABLE_RECEIVE_SOCKET_IN_SEPARATE_THREAD
void ParseMessageBody ( CVector<uint8_t> vecbyMesBodyData, void ParseMessageBody ( CVector<uint8_t> vecbyMesBodyData,
int iRecCounter, int iRecCounter,
int iRecID ); int iRecID );
#endif
}; };
#endif /* !defined ( CHANNEL_HOIH9345KJH98_3_4344_BB23945IUHF1912__INCLUDED_ ) */ #endif /* !defined ( CHANNEL_HOIH9345KJH98_3_4344_BB23945IUHF1912__INCLUDED_ ) */