| 1 | // Copyright (C) 2016 The Qt Company Ltd. |
|---|---|
| 2 | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only |
| 3 | |
| 4 | #include "qlowenergyserviceprivate_p.h" |
| 5 | |
| 6 | #include "qlowenergycontrollerbase_p.h" |
| 7 | |
| 8 | QT_BEGIN_NAMESPACE |
| 9 | |
| 10 | QT_IMPL_METATYPE_EXTERN_TAGGED(QSharedPointer<QLowEnergyServicePrivate>, |
| 11 | QSharedPointer_QLowEnergyServicePrivate) |
| 12 | |
| 13 | QLowEnergyServicePrivate::QLowEnergyServicePrivate(QObject *parent) : QObject(parent) { } |
| 14 | |
| 15 | QLowEnergyServicePrivate::~QLowEnergyServicePrivate() |
| 16 | { |
| 17 | } |
| 18 | |
| 19 | void QLowEnergyServicePrivate::setController(QLowEnergyControllerPrivate *control) |
| 20 | { |
| 21 | controller = control; |
| 22 | |
| 23 | if (control) |
| 24 | setState(QLowEnergyService::RemoteService); |
| 25 | else |
| 26 | setState(QLowEnergyService::InvalidService); |
| 27 | } |
| 28 | |
| 29 | void QLowEnergyServicePrivate::setError(QLowEnergyService::ServiceError newError) |
| 30 | { |
| 31 | lastError = newError; |
| 32 | emit errorOccurred(error: newError); |
| 33 | } |
| 34 | |
| 35 | void QLowEnergyServicePrivate::setState(QLowEnergyService::ServiceState newState) |
| 36 | { |
| 37 | if (state == newState) |
| 38 | return; |
| 39 | |
| 40 | state = newState; |
| 41 | emit stateChanged(newState); |
| 42 | } |
| 43 | |
| 44 | QT_END_NAMESPACE |
| 45 | |
| 46 | #include "moc_qlowenergyserviceprivate_p.cpp" |
| 47 |
