| | |
| | | |
| | | } |
| | | |
| | | short CProcessData::getCassetteSequenceNo() |
| | | { |
| | | return m_nCassetteSequenceNo; |
| | | } |
| | | |
| | | short CProcessData::getJobSequenceNo() |
| | | { |
| | | return m_nJobSequenceNo; |
| | | } |
| | | |
| | | std::string& CProcessData::getGlassId() |
| | | { |
| | | return m_strGlassId; |
| | |
| | | return m_nTotalParameter; |
| | | } |
| | | |
| | | const std::list<std::string>& CProcessData::getParameters() |
| | | std::vector<uint8_t>& CProcessData::getParamsRawData() |
| | | { |
| | | return m_params; |
| | | } |
| | | |
| | | void CProcessData::getParameters(std::list<std::string>& list) |
| | | { |
| | | std::copy(m_params.begin(), m_params.end(), std::back_inserter(list)); |
| | | return m_paramsRawData; |
| | | } |
| | | |
| | | int CProcessData::serialize(char* pszBuffer, int nBufferSize) |
| | |
| | | // 解释数据 |
| | | // Glass ID |
| | | int index = 0; |
| | | memcpy(&pszBuffer[index], &m_nCassetteSequenceNo, sizeof(short)); |
| | | index += sizeof(short); |
| | | |
| | | memcpy(&pszBuffer[index], &m_nJobSequenceNo, sizeof(short)); |
| | | index += sizeof(short); |
| | | |
| | | CToolUnits::convertString(&pszBuffer[index], 10 * 2, m_strGlassId); |
| | | index += 10 * 2; |
| | | |
| | |
| | | m_nCurrentGroup = (unsigned int)CToolUnits::toInt16(&pszBuffer[index]); |
| | | index += 2; |
| | | |
| | | // param list(0x1881~0x1a74), 共1000 bytes, 20个字符为一个参数, 50组 |
| | | // 最后一group可能不满足50, 以m_nTotalParameter为依据 |
| | | int size = (m_nCurrentGroup == m_nTotalGroup) ? m_nTotalParameter % 50 : 50; |
| | | for (int i = 0; i < size; i++) { |
| | | std::string strParam; |
| | | CToolUnits::convertString(&pszBuffer[index], 20, strParam); |
| | | if (!strParam.empty()) { |
| | | m_params.push_back(strParam); |
| | | } |
| | | index += 20; |
| | | } |
| | | // 解释数据 |
| | | |
| | | |
| | | |
| | | return 538 * 2; |
| | | } |
| | |
| | | if (nBufferSize < 538 * 2) return -1; |
| | | |
| | | int index = 0; |
| | | memcpy(&m_nCassetteSequenceNo, &pszBuffer[index], sizeof(short)); |
| | | index += sizeof(short); |
| | | |
| | | memcpy(&m_nJobSequenceNo, &pszBuffer[index], sizeof(short)); |
| | | index += sizeof(short); |
| | | |
| | | CToolUnits::convertString(&pszBuffer[index], 10 * 2, m_strGlassId); |
| | | index += 10 * 2; |
| | | |
| | |
| | | memcpy(&m_nCurrentGroup, &pszBuffer[index], sizeof(short)); |
| | | index += sizeof(short); |
| | | |
| | | // 多分组如何处理?待考虑 |
| | | // 参数原始数据 |
| | | m_paramsRawData.clear(); |
| | | m_paramsRawData.insert( |
| | | m_paramsRawData.end(), |
| | | reinterpret_cast<const uint8_t*>(&pszBuffer[index]), |
| | | reinterpret_cast<const uint8_t*>(&pszBuffer[index]) + 500); |
| | | |
| | | |
| | | return 538 * 2; |
| | |
| | | std::to_string(m_nTotalGroup).c_str(), "", weight++)); |
| | | attrubutes.addAttribute(new CAttribute("Current Group", |
| | | std::to_string(m_nCurrentGroup).c_str(), "", weight++)); |
| | | |
| | | char szName[256]; |
| | | int index = 0; |
| | | for (auto item : m_params) { |
| | | sprintf_s(szName, 256, "Parameter %d", ++index); |
| | | attrubutes.addAttribute(new CAttribute(szName, |
| | | item.c_str(), "", weight++)); |
| | | } |
| | | } |
| | | } |