diff options
author | Christian Gromm <christian.gromm@microchip.com> | 2016-06-21 14:14:04 +0200 |
---|---|---|
committer | Christian Gromm <christian.gromm@microchip.com> | 2016-06-21 14:14:04 +0200 |
commit | 860b3c0ccfb2756b8ed77523048952011b74a212 (patch) | |
tree | e0672fb5cf923dcf0a4a48a62a69011e1b72976a /K2LABI/ABI/ResultParser.cpp | |
parent | 742bace60b9c0a0f583d8afe1097d029f468fa03 (diff) |
src: can-lin: initial source import
This patch adds the sources needed for the HVAC and iDrive applications.
Change-Id: I53148a5d11c34787dd11295939bbaf8702c64dcb
Signed-off-by: Christian Gromm <christian.gromm@microchip.com>
Diffstat (limited to 'K2LABI/ABI/ResultParser.cpp')
-rw-r--r-- | K2LABI/ABI/ResultParser.cpp | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/K2LABI/ABI/ResultParser.cpp b/K2LABI/ABI/ResultParser.cpp new file mode 100644 index 0000000..b5e39bc --- /dev/null +++ b/K2LABI/ABI/ResultParser.cpp @@ -0,0 +1,29 @@ +#include "k2l-type.h" +#include "ResultParser.h" +#include <string.h> + +BYTE* CResultParser::ToByteArray(ParamDef* pParams, int nParamCount, int& nResultLength) +{ + int nLength = 0; + for (int i = 0; i < nParamCount; i++) + { + nLength += pParams[i].m_nLength; + } + + BYTE* pBuffer = NULL; + if (nLength) + { + nLength = (nLength + 1) & ~1; + pBuffer = new BYTE[nLength]; + memset(pBuffer, 0, nLength); + BYTE* pTemBuf = pBuffer; + for(int i = 0; i < nParamCount; i++) + { + memcpy(pTemBuf, pParams[i].m_pData, pParams[i].m_nLength); + pTemBuf += pParams[i].m_nLength; + } + } + + nResultLength = nLength; + return pBuffer; +} |