/****************************************************************************** Function Name : vRetrieveDataFromBuffer Input(s) : Output : Functionality : Read data from DIL buffer Member of : CMsgContainerJ1939 Friend of : - Author(s) : Arun kumar K Date Created : 20.01.2011 ******************************************************************************/ void CMsgContainerJ1939::vRetrieveDataFromBuffer() { EnterCriticalSection(&m_sCritSecDataSync); static INT nType = 0; static HRESULT Result = 0; while (m_ouVSEBufJ1939.GetMsgCount() > 0) { STJ1939_MSG sJ1939Msg; INT nSize = MAX_MSG_LEN_J1939; // First read the J1939 message Result = m_ouVSEBufJ1939.ReadFromBuffer(nType, m_pbyJ1939Data, nSize); if (Result == ERR_READ_MEMORY_SHORT) { CString omBuf; omBuf.Format(_("J1939 PSDI - ERR_READ_MEMORY_SHORT nSize: %d"), nSize); ASSERT(!AfxMessageBox(omBuf)); } else if (Result == EMPTY_APP_BUFFER) { CString omBuf; omBuf.Format(_("J1939 PSDI - EMPTY_APP_BUFFER")); ASSERT(!AfxMessageBox(omBuf)); } if (Result == CALL_SUCCESS) { // Save it into the J1939 message structure m_sJ1939Data.vSetDataStream(m_pbyJ1939Data); vProcessNewData(m_sJ1939Data); } } LeaveCriticalSection(&m_sCritSecDataSync); }
/****************************************************************************** Function Name : vRetrieveDataFromBuffer Input(s) : Output : Functionality : Read data from DIL buffer Member of : CMsgContainerCAN Friend of : - Author(s) : Anish kumar Date Created : 01.04.2010 ******************************************************************************/ void CMsgContainerCAN::vRetrieveDataFromBuffer() { EnterCriticalSection(&m_sCritSecDataSync); while (m_ouMCCanBufFSE.GetMsgCount() > 0) { STCANDATA sCanData; if (m_ouMCCanBufFSE.ReadFromBuffer(&sCanData) == CALL_SUCCESS) { vProcessNewData(sCanData); } } LeaveCriticalSection(&m_sCritSecDataSync); }