summaryrefslogtreecommitdiff
path: root/saltoqd/versionmanager.cpp
blob: 2b7d69251b15a91682104544ec762c242c6ac882 (plain)
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
#include "versionmanager.h"

VersionManager::VersionManager(ToqManager *toq) :
	QObject(toq), _toq(toq)
{
	_toq->setEndpointListener(ToqConnection::VersionEndpoint, this);
}

void VersionManager::handleMessage(const ToqConnection::Message &msg)
{
	Q_ASSERT(msg.destination == ToqConnection::VersionEndpoint);
	switch (msg.type) {
	case 0:
		handleVersionMessage(msg);
		break;
	default:
		qWarning() << "Unknown version message" << msg.type;
		break;
	}
}

void VersionManager::handleVersionMessage(const ToqConnection::Message &msg)
{
	QJsonObject root = msg.toJson().object();
	qDebug() << "Remote AlohaVersion: " << root["AlohaVersion"].toString();

	QJsonObject reply;
	reply.insert("PhoneType", QJsonValue(QLatin1String("Android")));
	reply.insert("SoftwareRelease", QJsonValue(QLatin1String("4.4.2")));

	_toq->sendReply(msg, 1, reply);
}