summaryrefslogtreecommitdiff
path: root/enhanced-position-service/test/ConfigurationClient.cpp
blob: 704d79c8a8d6b14c47f96d16f84d89900a94f939 (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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
/**************************************************************************
* @licence app begin@
*
* SPDX-License-Identifier: MPL-2.0
*
* \ingroup EnhancedPositionService
*
* \copyright Copyright (C) BMW Car IT GmbH 2011, 2012
* 
* \license
* This Source Code Form is subject to the terms of the
* Mozilla Public License, v. 2.0. If a copy of the MPL was not distributed with
* this file, You can obtain one at http://mozilla.org/MPL/2.0/.
*
* @licence end@
**************************************************************************/

#include "ConfigurationClient.h"

ConfigurationClient::ConfigurationClient(QObject *parent)
  : m_connection(QDBusConnection::sessionBus()),
    m_client(NULL)
{
    qDebug("ConfigurationClient started\n");

    if (!connectToProxy()) {
        qWarning() << "failed to connect to server";
    }
}

ConfigurationClient::~ConfigurationClient()
{
    qDebug("ConfigurationClient: d-tor\n");
}

void ConfigurationClient::PropertyChanged(const QString &name, const QDBusVariant &value)
{
    qDebug("PropertyChanged: %s", name.toUtf8().constData());
}

bool ConfigurationClient::connectToProxy()
{
    if (m_client != NULL) {
        qWarning("m_client already created. do not continue here.");
        return false;
    }

    m_client = new ConfigurationIf(getServiceName(), "/config", getConnection(), 0);

    if (!m_client->isValid()) {
        qWarning("failed to connect to service '%s'.",
                getServiceName().toUtf8().constData());
        delete(m_client);
        m_client = NULL;
        return false;
    }

#if 0
    QObject::connect(m_client, SIGNAL(StatusUpdate(QList<int>)),
                     this, SLOT(StatusUpdate(QList<int>)));
    QObject::connect(m_client, SIGNAL(PositionUpdate(QList<int>)),
                     this, SLOT(PositionUpdate(QList<int>)));
    QObject::connect(m_client, SIGNAL(SatelliteInfoUpdate(QList<int>)),
                         this, SLOT(SatelliteInfoUpdate(QList<int>)));
    QObject::connect(m_client, SIGNAL(AccuracyUpdate(QList<int>)),
                         this, SLOT(AccuracyUpdate(QList<int>)));
#endif

    return true;
}