summaryrefslogtreecommitdiffstats
path: root/src/bluetooth/qlowenergyserviceprivate.cpp
blob: c82897cd4ae771964152bcc6561077a434214ca2 (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
// Copyright (C) 2016 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only

#include "qlowenergyserviceprivate_p.h"

#include "qlowenergycontrollerbase_p.h"

QT_BEGIN_NAMESPACE

QT_IMPL_METATYPE_EXTERN_TAGGED(QSharedPointer<QLowEnergyServicePrivate>,
                               QSharedPointer_QLowEnergyServicePrivate)

QLowEnergyServicePrivate::QLowEnergyServicePrivate(QObject *parent) : QObject(parent) { }

QLowEnergyServicePrivate::~QLowEnergyServicePrivate()
{
}

void QLowEnergyServicePrivate::setController(QLowEnergyControllerPrivate *control)
{
    controller = control;

    if (control)
        setState(QLowEnergyService::RemoteService);
    else
        setState(QLowEnergyService::InvalidService);
}

void QLowEnergyServicePrivate::setError(QLowEnergyService::ServiceError newError)
{
    lastError = newError;
    emit errorOccurred(newError);
}

void QLowEnergyServicePrivate::setState(QLowEnergyService::ServiceState newState)
{
    if (state == newState)
        return;

    state = newState;
    emit stateChanged(newState);
}

QT_END_NAMESPACE

#include "moc_qlowenergyserviceprivate_p.cpp"