1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
#include "stdafx.h"
#include "CJobDataB.h"
 
 
namespace SERVO {
    CJobDataB::CJobDataB()
    {
 
    }
 
    CJobDataB::~CJobDataB()
    {
 
    }
 
    int CJobDataB::serialize(char* pszBuffer, int nBufferSize)
    {
        int index = 0;
        memcpy(&pszBuffer[index], &m_nPortNo, sizeof(short));
        index += sizeof(short);
 
        int strLen = min(20, m_strCarrierId.size());
        memcpy(&pszBuffer[index], m_strCarrierId.c_str(), strLen);
        index += strLen;
 
        strLen = min(20, m_pruductId.size());
        memcpy(&pszBuffer[index], m_pruductId.c_str(), strLen);
        index += strLen;
 
        memcpy(&pszBuffer[index], &m_nCarrierState, sizeof(short));
        index += sizeof(short);
 
        memcpy(&pszBuffer[index], &m_nSlotMapping, sizeof(int));
        index += sizeof(int);
 
        memcpy(&pszBuffer[index], &m_nSlotSelectedFlag, sizeof(int));
        index += sizeof(int);
 
        for (int i = 0; i < min(25, m_glassIds.size()); i++) {
            std::string& strGlassId = m_glassIds.at(i);
            strLen = min(20, strGlassId.size());
            memcpy(&pszBuffer[index], strGlassId.c_str(), strLen);
            index += strLen;
        }
 
        return 320 * 2;
    }
}