Commit fa3e0145 authored by Albert Vaca Cintora's avatar Albert Vaca Cintora

Package version checks

parent 17d0fd49
......@@ -29,11 +29,13 @@
#include <ctime>
#include <qjson/qobjecthelper.h>
const static int CURRENT_PACKAGE_VERSION = 1;
NetworkPackage::NetworkPackage(QString type)
{
mId = time(NULL);
mType = type;
mVersion = 1;
mVersion = CURRENT_PACKAGE_VERSION;
}
QByteArray NetworkPackage::serialize() const
......@@ -65,6 +67,11 @@ void NetworkPackage::unserialize(QByteArray a, NetworkPackage* np)
np->setVersion(-1);
}
if (np->version() > CURRENT_PACKAGE_VERSION) {
qDebug() << "Warning: package version " << np->version() << " greater than supported version " << CURRENT_PACKAGE_VERSION;
}
//QVariant -> Object
//NetworkPackage np;
//QJSon json(a);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment