CFrameProcessor_J1939::CFrameProcessor_J1939() { // Get hold of J1939 DIL interface HRESULT Result = DIL_GetInterface(J1939, (void**) &m_pouDIL_J1939); ASSERT(S_OK == Result); ASSERT(NULL != m_pouDIL_J1939); m_sJ1939ProcParams.m_pILog = NULL; m_sJ1939ProcParams.dwClientID = 0x0; // Allocate necessary amount of memory. m_sJ1939Data.m_unDLC = MAX_DATA_LEN_J1939; m_sJ1939Data.m_pbyData = new BYTE[m_sJ1939Data.m_unDLC];// For basic data object ASSERT(NULL != m_sJ1939Data.m_pbyData); // For raw data bytes. It should be equal to the size of m_sJ1939Data m_pbyJ1939Data = new BYTE[m_sJ1939Data.unGetSize()]; ASSERT(NULL != m_pbyJ1939Data); USHORT Length = ushCalculateStrLen(true, MAX_DATA_LEN_J1939); m_sCurrFormatDat.m_pcDataHex = new char[Length]; ASSERT(NULL != m_sCurrFormatDat.m_pcDataHex); memset(m_sCurrFormatDat.m_pcDataHex, '\0', Length * sizeof(char)); Length = ushCalculateStrLen(false, MAX_DATA_LEN_J1939); m_sCurrFormatDat.m_pcDataDec = new char[Length]; ASSERT(NULL != m_sCurrFormatDat.m_pcDataDec); memset(m_sCurrFormatDat.m_pcDataDec, '\0', Length * sizeof(char)); m_sDataCopyThread.m_hActionEvent = m_ouVSEBufJ1939.getNotifyEvent(); m_bIsJ1939DataLogged = FALSE; }
/****************************************************************************** Function Name : CMsgContainerJ1939 Input(s) : Output : Functionality : Constructor Member of : CMsgContainerJ1939 Friend of : - Author(s) : Arun kumar K Date Created : 20.01.2011 ******************************************************************************/ CMsgContainerJ1939::CMsgContainerJ1939(void) { InitializeCriticalSection(&m_sCritSecDataSync); InitializeCriticalSection(&m_omCritSecFilter); m_pouDIL_J1939 = nullptr; // Allocate necessary amount of memory. m_sJ1939Data.m_unDLC = MAX_DATA_LEN_J1939; m_sJ1939Data.m_pbyData = new BYTE[m_sJ1939Data.m_unDLC];// For basic data object ASSERT(nullptr != m_sJ1939Data.m_pbyData); // For raw data bytes. It should be equal to the size of m_sJ1939Data m_pbyJ1939Data = new BYTE[MAX_MSG_LEN_J1939 + sizeof(__int64)]; ASSERT(nullptr != m_pbyJ1939Data); USHORT Length = ushCalculateStrLen(true, MAX_DATA_LEN_J1939); m_sOutFormattedData.m_pcDataHex = new char[Length]; ASSERT(nullptr != m_sOutFormattedData.m_pcDataHex); memset(m_sOutFormattedData.m_pcDataHex, '\0', Length * sizeof(char)); Length = ushCalculateStrLen(false, MAX_DATA_LEN_J1939); m_sOutFormattedData.m_pcDataDec = new char[Length]; ASSERT(nullptr != m_sOutFormattedData.m_pcDataDec); memset(m_sOutFormattedData.m_pcDataDec, '\0', Length * sizeof(char)); }