use JSONBreakableMarshal in AC monitor to get QJsonObject

This commit is contained in:
Stephen Birarda 2015-05-01 15:18:49 -07:00
parent 4b777f09e6
commit a7bff474e3

View file

@ -11,8 +11,9 @@
#include <signal.h> #include <signal.h>
#include <LogHandler.h>
#include <AddressManager.h> #include <AddressManager.h>
#include <JSONBreakableMarshal.h>
#include <LogHandler.h>
#include "AssignmentClientMonitor.h" #include "AssignmentClientMonitor.h"
#include "AssignmentClientApp.h" #include "AssignmentClientApp.h"
@ -196,13 +197,9 @@ void AssignmentClientMonitor::readPendingDatagrams() {
// update our records about how to reach this child // update our records about how to reach this child
matchingNode->setLocalSocket(senderSockAddr); matchingNode->setLocalSocket(senderSockAddr);
// push past the packet header QVariantMap packetVariantMap =
QDataStream packetStream(receivedPacket); JSONBreakableMarshal::fromStringBuffer(receivedPacket.mid(numBytesForPacketHeader(receivedPacket)));
packetStream.skipRawData(numBytesForPacketHeader(receivedPacket)); QJsonObject unpackedStatsJSON = QJsonObject::fromVariantMap(packetVariantMap);
// decode json
QVariantMap unpackedVariantMap;
packetStream >> unpackedVariantMap;
QJsonObject unpackedStatsJSON = QJsonObject::fromVariantMap(unpackedVariantMap);
// get child's assignment type out of the decoded json // get child's assignment type out of the decoded json
QString childType = unpackedStatsJSON["assignment_type"].toString(); QString childType = unpackedStatsJSON["assignment_type"].toString();