This commit is contained in:
Volker Fischer 2006-03-06 19:18:25 +00:00
parent 576b87b49e
commit 29457cba80

View file

@ -86,10 +86,6 @@ void CProtocol::EnqueueMessage ( CVector<uint8_t>& vecMessage,
const int iCnt,
const int iID )
{
qDebug("EnqueueMessage start");
// check if list is empty so that we have to initiate a send process
const bool bListWasEmpty = SendMessQueue.empty();
@ -104,18 +100,10 @@ qDebug("EnqueueMessage start");
{
SendMessage();
}
qDebug("EnqueueMessage end");
}
void CProtocol::SendMessage()
{
qDebug("SendMessage start");
// we have to check that list is not empty, since in another thread the
// last element of the list might have been erased
if ( !SendMessQueue.empty() )
@ -134,10 +122,6 @@ qDebug("SendMessage start");
// no message to send, stop timer
TimerSendMess.stop();
}
qDebug("SendMessage stop");
}
void CProtocol::CreateAndSendAcknMess ( const int& iID, const int& iCnt )
@ -146,10 +130,6 @@ void CProtocol::CreateAndSendAcknMess ( const int& iID, const int& iCnt )
CVector<uint8_t> vecData ( 2 ); // 2 bytes of data
unsigned int iPos = 0; // init position pointer
qDebug("CreateAndSendAcknMess start");
// build data vector
PutValOnStream ( vecData, iPos, static_cast<uint32_t> ( iID ), 2 );
@ -158,10 +138,6 @@ qDebug("CreateAndSendAcknMess start");
// immediately send acknowledge message
emit MessReadyForSending ( vecAcknMessage );
qDebug("CreateAndSendAcknMess end");
}
@ -171,21 +147,21 @@ qDebug("CreateAndSendAcknMess end");
*/
void CProtocol::DeleteSendMessQueue()
{
// Mutex.lock();
// {
Mutex.lock();
{
// delete complete "send message queue"
SendMessQueue.clear();
// }
// Mutex.unlock();
}
Mutex.unlock();
}
void CProtocol::OnTimerSendMess()
{
// Mutex.lock();
// {
Mutex.lock();
{
SendMessage();
// }
// Mutex.unlock();
}
Mutex.unlock();
}
bool CProtocol::ParseMessage ( const CVector<unsigned char>& vecbyData,
@ -194,15 +170,10 @@ bool CProtocol::ParseMessage ( const CVector<unsigned char>& vecbyData,
/*
return code: true -> ok; false -> error
*/
qDebug("before lock");
bool bRet;
Mutex.lock();
{
qDebug("after lock");
int iRecCounter, iRecID, iData;
unsigned int iPos;
CVector<uint8_t> vecData;
@ -275,20 +246,22 @@ for ( int i = 0; i < iNumBytes; i++ ) {
iOldRecID = iRecID;
iOldRecCnt = iRecCounter;
return true; // everything was ok
bRet = true; // everything was ok
}
else
{
return false; // return error code
bRet = false; // return error code
}
}
Mutex.unlock();
return bRet;
}
void CProtocol::CreateJitBufMes ( const int iJitBufSize )
{
// Mutex.lock();
// {
Mutex.lock();
{
CVector<uint8_t> vecNewMessage;
CVector<uint8_t> vecData ( 2 ); // 2 bytes of data
unsigned int iPos = 0; // init position pointer
@ -307,8 +280,8 @@ void CProtocol::CreateJitBufMes ( const int iJitBufSize )
// enqueue message
EnqueueMessage ( vecNewMessage, iCurCounter, PROTMESSID_JITT_BUF_SIZE );
// }
// Mutex.unlock();
}
Mutex.unlock();
}