Changeset View
Changeset View
Standalone View
Standalone View
autotests/fakebluez/deviceinterface.cpp
Show All 14 Lines | |||||
15 | * Lesser General Public License for more details. | 15 | * Lesser General Public License for more details. | ||
16 | * | 16 | * | ||
17 | * You should have received a copy of the GNU Lesser General Public | 17 | * You should have received a copy of the GNU Lesser General Public | ||
18 | * License along with this library. If not, see <http://www.gnu.org/licenses/>. | 18 | * License along with this library. If not, see <http://www.gnu.org/licenses/>. | ||
19 | */ | 19 | */ | ||
20 | 20 | | |||
21 | #include "deviceinterface.h" | 21 | #include "deviceinterface.h" | ||
22 | #include "objectmanager.h" | 22 | #include "objectmanager.h" | ||
23 | #include "batteryinterface.h" | ||||
23 | #include "mediaplayerinterface.h" | 24 | #include "mediaplayerinterface.h" | ||
24 | #include "mediatransportinterface.h" | 25 | #include "mediatransportinterface.h" | ||
25 | #include "inputinterface.h" | 26 | #include "inputinterface.h" | ||
26 | 27 | | |||
27 | #include <QDBusMessage> | 28 | #include <QDBusMessage> | ||
28 | #include <QDBusArgument> | 29 | #include <QDBusArgument> | ||
29 | #include <QDBusConnection> | 30 | #include <QDBusConnection> | ||
30 | 31 | | |||
Show All 14 Lines | 45 | { | |||
45 | setPath(path); | 46 | setPath(path); | ||
46 | setObjectParent(parent); | 47 | setObjectParent(parent); | ||
47 | setProperties(properties); | 48 | setProperties(properties); | ||
48 | setName(QStringLiteral("org.bluez.Device1")); | 49 | setName(QStringLiteral("org.bluez.Device1")); | ||
49 | 50 | | |||
50 | // Alias needs special handling | 51 | // Alias needs special handling | ||
51 | setAlias(properties.value(QStringLiteral("Alias")).toString()); | 52 | setAlias(properties.value(QStringLiteral("Alias")).toString()); | ||
52 | 53 | | |||
54 | // Create Battery1 | ||||
55 | if (properties.contains(QStringLiteral("Battery"))) { | ||||
56 | const QVariantMap &inputProps = qdbus_cast<QVariantMap>(properties.value(QStringLiteral("Battery"))); | ||||
57 | BatteryInterface *input = new BatteryInterface(path, inputProps, parent); | ||||
58 | | ||||
59 | ObjectManager *manager = ObjectManager::self(); | ||||
60 | manager->addObject(input); | ||||
61 | | ||||
62 | QVariantMap props = properties; | ||||
63 | props.remove(QStringLiteral("Battery")); | ||||
64 | setProperties(props); | ||||
65 | } | ||||
66 | | ||||
53 | // Create Input1 | 67 | // Create Input1 | ||
54 | if (properties.contains(QStringLiteral("Input"))) { | 68 | if (properties.contains(QStringLiteral("Input"))) { | ||
55 | const QVariantMap &inputProps = qdbus_cast<QVariantMap>(properties.value(QStringLiteral("Input"))); | 69 | const QVariantMap &inputProps = qdbus_cast<QVariantMap>(properties.value(QStringLiteral("Input"))); | ||
56 | InputInterface *input = new InputInterface(path, inputProps, parent); | 70 | InputInterface *input = new InputInterface(path, inputProps, parent); | ||
57 | 71 | | |||
58 | ObjectManager *manager = ObjectManager::self(); | 72 | ObjectManager *manager = ObjectManager::self(); | ||
59 | manager->addObject(input); | 73 | manager->addObject(input); | ||
60 | 74 | | |||
▲ Show 20 Lines • Show All 238 Lines • Show Last 20 Lines |