/****************************************************************************** Function Name : vProcessNewData Input(s) : Output : Functionality : Process a new Rx/Tx msg Member of : CMsgContainerLIN Friend of : - Author(s) : Anish kumar Date Created : 01.04.2010 ******************************************************************************/ void CMsgContainerLIN::vProcessNewData(STLINDATA& sLinData) { // append : 1. Add item, get count, SetItemCount. // OW : 1. Get ID, Create map index, Search if it is present in map // if present change the offset and time stamp // 2. if not present and (get count < max count) save the Buffer index, // ListCtrl index, time stamp, make offest = time stamp in disp entry // and add to the map and array // 3. if not present and (get count = max count), do nothing // 4. SetItemcount if ( IS_A_MESSAGE(sLinData.m_ucDataType) ) { // Add to append buffer // If its the very first entry, the time stamp must if (m_sLINReadDataSpl.m_lTickCount.QuadPart != 0) // be 0 and will { // retain such value. m_sLINReadDataSpl.m_nDeltime = _abs64(sLinData.m_lTickCount.QuadPart - m_sLINReadDataSpl.m_lTickCount.QuadPart); } STLINDATA* pStlin = &m_sLINReadDataSpl; *pStlin = sLinData; if (!bTobeBlocked(sLinData)) { m_ouAppendLinBuf.WriteIntoBuffer(&m_sLINReadDataSpl); if (NULL != m_pRxMsgCallBack) { m_pRxMsgCallBack((void*)&sLinData, LIN); } } } else //Add the error messages { vProcessCurrErrorEntryLin(sLinData.m_uDataInfo.m_sErrInfo); // Add to append buffer // If its the very first entry, the time stamp must if (m_sLINReadDataSpl.m_lTickCount.QuadPart != 0) // be 0 and will { // retain such value. m_sLINReadDataSpl.m_nDeltime = _abs64(sLinData.m_lTickCount.QuadPart - m_sLINReadDataSpl.m_lTickCount.QuadPart); } STLINDATA* pStlin = &m_sLINReadDataSpl; *pStlin = sLinData; m_ouAppendLinBuf.WriteIntoBuffer(&m_sLINReadDataSpl); if (NULL != m_pRxMsgCallBack) { m_pRxMsgCallBack((void*)&sLinData, LIN); } } }
/****************************************************************************** Function Name : vProcessNewData Input(s) : sJ1939Msg Output : Functionality : Process a new Rx/Tx msg Member of : CMsgContainerJ1939 Friend of : - Author(s) : Arun kumar K Date Created : 31.01.2010 ******************************************************************************/ void CMsgContainerJ1939::vProcessNewData(STJ1939_MSG& sJ1939Msg) { // append : 1. Add item, get count, SetItemCount. // OW : 1. Get ID, Create map index, Search if it is present in map // if present change the offset and time stamp // 2. if not present and (get count < max count) save the Buffer index, // ListCtrl index, time stamp, make offest = time stamp in disp entry // and add to the map and array // 3. if not present and (get count = max count), do nothing // 4. SetItemcount if ( !bIsErrorMsg(sJ1939Msg.m_sMsgProperties.m_eType) ) { // Add to append buffer // If its the very first entry, the time stamp must if (m_sJ1939ReadMsgSpl.m_sMsgProperties.m_un64TimeStamp != 0) // be 0 and will { // retain such value. m_sJ1939ReadMsgSpl.m_nDeltime = _abs64( sJ1939Msg.m_sMsgProperties.m_un64TimeStamp - m_sJ1939ReadMsgSpl.m_sMsgProperties.m_un64TimeStamp); } static BYTE arrBuf[MAX_MSG_LEN_J1939 + sizeof(__int64)]; if (!bTobeBlocked(sJ1939Msg)) { sJ1939Msg.vGetDataStream(arrBuf); m_sJ1939ReadMsgSpl.vSetDataStream(arrBuf); m_sJ1939ReadMsgSpl.vGetDataStream(arrBuf); m_ouAppendJ1939Buf.WriteIntoBuffer(J1939, arrBuf/*(BYTE*)&m_sJ1939ReadMsgSpl*/, m_sJ1939ReadMsgSpl.nGetSize()); if (nullptr != m_pRxMsgCallBack) { m_pRxMsgCallBack->onRxMsg((void*)&sJ1939Msg); } } } //else //Add the error messages //{ // vProcessCurrErrorEntry(sCanData.m_uDataInfo.m_sErrInfo); // // Add to append buffer // // If its the very first entry, the time stamp must // if (m_sCANReadDataSpl.m_lTickCount.QuadPart != 0) // be 0 and will // { // retain such value. // m_sCANReadDataSpl.m_nDeltime = sCanData.m_lTickCount.QuadPart - // m_sCANReadDataSpl.m_lTickCount.QuadPart; // } // STCANDATA *pStcan = &m_sCANReadDataSpl; // *pStcan = sCanData; // m_ouAppendCanBuf.WriteIntoBuffer(&m_sCANReadDataSpl); // if (nullptr != m_pRxMsgCallBack) // { // m_pRxMsgCallBack((void*)&sCanData, CAN); // } //} }
/****************************************************************************** Function Name : vProcessNewData Input(s) : Output : Functionality : Process a new Rx/Tx msg Member of : CMsgContainerCAN Friend of : - Author(s) : Anish kumar Date Created : 01.04.2010 ******************************************************************************/ void CMsgContainerCAN::vProcessNewData(STCANDATA& sCanData) { // append : 1. Add item, get count, SetItemCount. // OW : 1. Get ID, Create map index, Search if it is present in map // if present change the offset and time stamp // 2. if not present and (get count < max count) save the Buffer index, // ListCtrl index, time stamp, make offest = time stamp in disp entry // and add to the map and array // 3. if not present and (get count = max count), do nothing // 4. SetItemcount if ( IS_A_MESSAGE(sCanData.m_ucDataType) ) { // Add to append buffer // If its the very first entry, the time stamp must if (m_sCANReadDataSpl.m_lTickCount.QuadPart != 0) // be 0 and will { // retain such value. m_sCANReadDataSpl.m_nDeltime = _abs64(sCanData.m_lTickCount.QuadPart - m_sCANReadDataSpl.m_lTickCount.QuadPart); } STCANDATA* pStcan = &m_sCANReadDataSpl; *pStcan = sCanData; if (!bTobeBlocked(sCanData)) { unsigned char FDataType = m_sCANReadDataSpl.m_ucDataType; if(IS_RX_MESSAGE(FDataType)) { HRESULT h_Evaluate = EvaluateMessage(m_sCANReadDataSpl.m_uDataInfo.m_sCANMsg); } m_ouAppendCanBuf.WriteIntoBuffer(&m_sCANReadDataSpl); if (nullptr != m_pRxMsgCallBack) { m_pRxMsgCallBack->onRxMsg((void*)&sCanData); } } } else //Add the error messages { vProcessCurrErrorEntry(sCanData.m_uDataInfo.m_sErrInfo); // Add to append buffer // If its the very first entry, the time stamp must if (m_sCANReadDataSpl.m_lTickCount.QuadPart != 0) // be 0 and will { // retain such value. m_sCANReadDataSpl.m_nDeltime = _abs64(sCanData.m_lTickCount.QuadPart - m_sCANReadDataSpl.m_lTickCount.QuadPart); } STCANDATA* pStcan = &m_sCANReadDataSpl; *pStcan = sCanData; if (!bTobeBlocked(sCanData)) { m_ouAppendCanBuf.WriteIntoBuffer(&m_sCANReadDataSpl); if (nullptr != m_pRxMsgCallBack) { m_pRxMsgCallBack->onRxMsg((void*)&sCanData); } } } }