bool CUSBLProcess::ReplyTransponderState(QByteArray byUSBLData)
{
bool bParseOK = false;
QString strUnpacketData = "";
if(m_DataProtocol.UnpacketData(std::move(byUSBLData), strUnpacketData))
{
QDomDocument doc;
doc.setContent(strUnpacketData);
if(!doc.isNull())
{
QDomElement elementObject = doc.documentElement();
if(!isValidReply(elementObject))
{
return false;
}
QDomNode node;
QDomNamedNodeMap AttributeNodeMap;
QDomNodeList nodeList = elementObject.elementsByTagName("SynchStatus");
if (!nodeList.isEmpty() && !(nodeList = nodeList.at(0).toElement().elementsByTagName("Job")).isEmpty())
{
node = nodeList.at(0);
if(!node.isNull() && !node.attributes().namedItem("RemoteControlEnabled").isNull() && !(nodeList = node.toElement().elementsByTagName("Objects")).isEmpty())
{
if(!(nodeList = nodeList.at(0).toElement().elementsByTagName("Object")).isEmpty())
{
AttributeNodeMap = nodeList.at(0).attributes();
if(!AttributeNodeMap.namedItem("Type").isNull() && !AttributeNodeMap.namedItem("UID").isNull() &&
!(nodeList = nodeList.at(0).toElement().elementsByTagName("Properties")).isEmpty() &&
!(node = nodeList.at(0).attributes().namedItem("State")).isNull())
{
std::string sType = AttributeNodeMap.namedItem("Type").nodeValue().trimmed().toStdString();
std::string sUID = AttributeNodeMap.namedItem("UID").nodeValue().trimmed().toStdString();
if(node.nodeValue().trimmed() == "Tracked")
{
auto itTransponder = m_mTransponder.end();
if((itTransponder = std::find_if(m_mTransponder.begin(), m_mTransponder.end(), [sType, sUID](const std::map<int32_t, std::tuple<std::string, std::string, std::string, int32_t, int32_t, std::string>>::value_type &ItemData){return std::get<0>(ItemData.second) == sType && std::get<1>(ItemData.second) == sUID;})) != m_mTransponder.end())
{
std::get<2>(itTransponder->second) = node.nodeValue().trimmed().toStdString();
}
bParseOK = true;
}
}
}
else
{
bParseOK = true;
}
}
}
}
SendUSBLDataToDisplay(doc);
}
return bParseOK;
}
【 在 pgw 的大作中提到: 】
: 你倒是贴几段赏析一下
--
FROM 221.219.211.*