summaryrefslogtreecommitdiff
path: root/saltoqd/versionmanager.cpp
blob: 8c88992eed30371151cac7b371f1d4ec953b097b (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.payload.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);
}