LAPTOP-SNT8I5JK\Boounion
2025-10-13 047c7cbd047e11fba8d7872e69a11a13e463aec4
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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
#include "stdafx.h"
#include "CJobDataA.h"
#include "ToolUnits.h"
 
 
namespace SERVO {
    CJobDataA::CJobDataA()
    {
        m_pOwner = nullptr;
    }
 
    CJobDataA::~CJobDataA()
    {
 
    }
 
    void* CJobDataA::getOwner()
    {
        return m_pOwner;
    }
 
    void CJobDataA::setOwner(void* pOwner)
    {
        m_pOwner = pOwner;
    }
 
    short CJobDataA::getPortNo()
    {
        return m_nPortNo;
    }
 
    std::string& CJobDataA::getCarrierId()
    {
        return m_strCarrierId;
    }
 
    std::string& CJobDataA::getPruductId()
    {
        return m_pruductId;
    }
 
    int CJobDataA::serialize(char* pszBuffer, int nBufferSize)
    {
        if (nBufferSize < 640) return -1;
 
        int index = 0;
        memcpy(&pszBuffer[index], &m_nPortNo, sizeof(short));
        index += sizeof(short);
 
        int strLen = min(20, (int)m_strCarrierId.size());
        memcpy(&pszBuffer[index], m_strCarrierId.c_str(), strLen);
        index += 20;
 
        strLen = min(20, (int)m_pruductId.size());
        memcpy(&pszBuffer[index], m_pruductId.c_str(), strLen);
        index += 20;
 
        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, (int)strGlassId.size());
            memcpy(&pszBuffer[index], strGlassId.c_str(), strLen);
            index += 20;
        }
 
        return 320 * 2;
    }
 
    int CJobDataA::unserialize(const char* pszBuffer, int nBufferSize)
    {
        if (nBufferSize < 640) return -1;
 
        int index = 0;
        memcpy(&m_nPortNo, &pszBuffer[index], sizeof(short));
        index += sizeof(short);
 
        CToolUnits::convertString(&pszBuffer[index], 20, m_strCarrierId);
        index += 20;
 
        CToolUnits::convertString(&pszBuffer[index], 20, m_pruductId);
        index += 20;
 
        memcpy(&m_nCarrierState, &pszBuffer[index], sizeof(short));
        index += sizeof(short);
 
        memcpy(&m_nSlotMapping, &pszBuffer[index], sizeof(int));
        index += sizeof(int);
 
        memcpy(&m_nSlotSelectedFlag, &pszBuffer[index], sizeof(int));
        index += sizeof(int);
 
        std::string strGlassId;
        m_glassIds.clear();
        for (int i = 0; i < 25; i++) {
            CToolUnits::convertString(&pszBuffer[index], 20, strGlassId);
            index += 20;
            if (!strGlassId.empty()) {
                m_glassIds.push_back(strGlassId);
            }
        }
 
        return 320 * 2;
    }
 
    short CJobDataA::getCarrierState()
    {
        return m_nCarrierState;
    }
 
    std::string& CJobDataA::getCarrierStateDescription(std::string& strDescription)
    {
        static char* pszDescription[20] = {
            "Bind",
            "CancelPod",
            "CancelPodNotification",
            "CancelPodOut",
            "CancelPodAtPort",
            "CancelBind", 
            "Clamp",
            "ClosePod",
            "IndexDown",
            "IndexUp",
            "OpenPod",
            "PodComplete",
            "PodIn",
            "PodNotification",
            "PodOut",
            "PodRelease",
            "PodTagReadData",
            "PodTagWriteData",
            "Proceed WithPod",
            "Unclamp"
        };
 
        if (0 <= m_nCarrierState && m_nCarrierState < 20) {
            strDescription = pszDescription[m_nCarrierState];
        }
        else {
            strDescription = "";
        }
 
        return strDescription;
    }
 
    int CJobDataA::getSlotMapping()
    {
        return m_nSlotMapping;
    }
 
    int CJobDataA::getSlotSelectedFlag()
    {
        return m_nSlotSelectedFlag;
    }
 
    std::vector<std::string>& CJobDataA::getGlassIds()
    {
        return m_glassIds;
    }
}