2
* Copyright (C) 2013 Canonical, Ltd.
5
* Gustavo Pichorim Boiko <gustavo.boiko@canonical.com>
7
* This file is part of history-service.
9
* history-service is free software; you can redistribute it and/or modify
10
* it under the terms of the GNU General Public License as published by
11
* the Free Software Foundation; version 3.
13
* history-service is distributed in the hope that it will be useful,
14
* but WITHOUT ANY WARRANTY; without even the implied warranty of
15
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16
* GNU General Public License for more details.
18
* You should have received a copy of the GNU General Public License
19
* along with this program. If not, see <http://www.gnu.org/licenses/>.
22
#include "connection.h"
23
#include "mockconnectiondbus.h"
24
#include "mockconnectionadaptor.h"
26
Q_DECLARE_METATYPE(QList< QVariantMap >)
28
MockConnectionDBus::MockConnectionDBus(MockConnection *parent) :
29
QObject(parent), mAdaptor(0), mConnection(parent)
33
SIGNAL(messageSent(QString,QVariantMap)),
34
SIGNAL(MessageSent(QString,QVariantMap)));
36
SIGNAL(callReceived(QString)),
37
SIGNAL(CallReceived(QString)));
39
SIGNAL(callEnded(QString)),
40
SIGNAL(CallEnded(QString)));
42
SIGNAL(callStateChanged(QString,QString,QString)),
43
SIGNAL(CallStateChanged(QString,QString,QString)));
44
qDBusRegisterMetaType<QList<QVariantMap> >();
48
bool MockConnectionDBus::connectToBus()
50
bool ok = QDBusConnection::sessionBus().registerService("com.canonical.MockConnection");
56
mAdaptor = new MockConnectionAdaptor(this);
59
return QDBusConnection::sessionBus().registerObject("/com/canonical/MockConnection", this);
62
void MockConnectionDBus::PlaceIncomingMessage(const QString &message, const QVariantMap &properties)
64
mConnection->placeIncomingMessage(message, properties);
67
void MockConnectionDBus::PlaceCall(const QVariantMap &properties)
69
mConnection->placeCall(properties);
72
void MockConnectionDBus::HangupCall(const QString &callerId)
74
mConnection->hangupCall(callerId);
77
void MockConnectionDBus::SetCallState(const QString &phoneNumber, const QString &state)
79
mConnection->setCallState(phoneNumber, state);