summaryrefslogtreecommitdiff
path: root/musicconn.cc
blob: 45a00fb7622bd0ef815a495a023fb8100c9b793c (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
33
34
35
36
37
38
39
40
#include <QtCore/QDebug>
#include <QtCore/QJsonDocument>

#include "sappeer.h"
#include "musicconn.h"

#if SAILFISH
#include "libwatchfish/musiccontroller.h"

static watchfish::MusicController *controller = 0;
#endif

MusicConn::MusicConn(SAPConnection *conn, QObject *parent)
	: QObject(parent), _conn(conn), _socket(conn->getSocket(100))
{
	connect(_conn, SIGNAL(disconnected()), SLOT(deleteLater()));
	connect(_conn, SIGNAL(destroyed()), SLOT(deleteLater()));
	Q_ASSERT(_socket);
	connect(_socket, SIGNAL(connected()), SLOT(handleConnected()));
	connect(_socket, SIGNAL(messageReceived()), SLOT(handleMessageReceived()));
}

MusicConn::~MusicConn()
{
	qDebug() << "Music terminated";
}

void MusicConn::handleConnected()
{
	qDebug() << "Music connected";
}

void MusicConn::handleMessageReceived()
{
	qDebug() << "Music msg received";
	QByteArray data = _socket->receive();
	qDebug() << data.toHex();
	qDebug() << QString::fromLatin1(data);
	qDebug() << "Fini";
}