/**************************************************************************** ** ** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). ** Contact: http://www.qt-project.org/legal ** ** This file is part of the Qt Mobility Components. ** ** $QT_BEGIN_LICENSE:LGPL$ ** Commercial License Usage ** Licensees holding valid commercial Qt licenses may use this file in ** accordance with the commercial license agreement provided with the ** Software or, alternatively, in accordance with the terms contained in ** a written agreement between you and Digia. For licensing terms and ** conditions see http://qt.digia.com/licensing. For further information ** use the contact form at http://qt.digia.com/contact-us. ** ** GNU Lesser General Public License Usage ** Alternatively, this file may be used under the terms of the GNU Lesser ** General Public License version 2.1 as published by the Free Software ** Foundation and appearing in the file LICENSE.LGPL included in the ** packaging of this file. Please review the following information to ** ensure the GNU Lesser General Public License version 2.1 requirements ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ** In addition, as a special exception, Digia gives you certain additional ** rights. These rights are described in the Digia Qt LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ** GNU General Public License Usage ** Alternatively, this file may be used under the terms of the GNU ** General Public License version 3.0 as published by the Free Software ** Foundation and appearing in the file LICENSE.GPL included in the ** packaging of this file. Please review the following information to ** ensure the GNU General Public License version 3.0 requirements will be ** met: http://www.gnu.org/copyleft/gpl.html. ** ** ** $QT_END_LICENSE$ ** ****************************************************************************/ #include "qsysteminfodata_simulator_p.h" #include QTM_BEGIN_NAMESPACE void qt_registerSystemInfoTypes() { qRegisterMetaTypeStreamOperators("QtMobility::QSystemInfoData"); qRegisterMetaTypeStreamOperators("QtMobility::QSystemDeviceInfoData"); qRegisterMetaTypeStreamOperators("QtMobility::QSystemStorageInfoData"); qRegisterMetaTypeStreamOperators("QtMobility::QSystemStorageInfoData::DriveInfo"); qRegisterMetaTypeStreamOperators("QtMobility::QSystemNetworkInfoData"); qRegisterMetaTypeStreamOperators("QtMobility::QSystemNetworkInfoData::NetworkInfo"); qRegisterMetaTypeStreamOperators("QtMobility::QSystemDisplayInfoData"); qRegisterMetaTypeStreamOperators("QtMobility::QSystemScreenSaverData"); qRegisterMetaTypeStreamOperators("QtMobility::QSystemBatteryInfoData"); } QDataStream &operator<<(QDataStream &out, const QSystemInfoData &s) { out << s.currentLanguage << s.availableLanguages << s.currentCountryCode; out << s.versions << s.features; return out; } QDataStream &operator>>(QDataStream &in, QSystemInfoData &s) { in >> s.currentLanguage >> s.availableLanguages >> s.currentCountryCode; in >> s.versions >> s.features; return in; } QDataStream &operator<<(QDataStream &out, const QSystemDeviceInfoData &s) { out << s.imei << s.imsi << s.manufacturer << s.model << s.productName; out << static_cast(s.inputMethodType); out << static_cast(s.simStatus); out << static_cast(s.currentProfile); out << static_cast(s.currentPowerState); out << static_cast(s.keyboardTypes); out << static_cast(s.keypadType); out << static_cast(s.lockType); out << static_cast(s.batStatus); out << s.batteryLevel << s.deviceLocked; out << s.wirelessConnected << s.keyboardFlipped << s.backLight << s.keypadLight << s.uniqueDeviceId; out << s.messageRingtoneVolume << s.voiceRingtoneVolume << s.vibrationActive; return out; } QDataStream &operator>>(QDataStream &in, QSystemDeviceInfoData &s) { in >> s.imei >> s.imsi >> s.manufacturer >> s.model >> s.productName; qint32 inputMethod, simStatus, profile, powerState, keyboardTypes, keypadType, lockType, batStatus; in >> inputMethod >> simStatus >> profile >> powerState; in >> keyboardTypes >> keypadType >> lockType >> batStatus; s.inputMethodType = static_cast(inputMethod); s.simStatus = static_cast(simStatus); s.currentProfile = static_cast(profile); s.currentPowerState = static_cast(powerState); in >> s.batteryLevel >> s.deviceLocked; in >> s.wirelessConnected >> s.keyboardFlipped >> s.backLight >> s.keypadLight; s.keyboardTypes = static_cast(keyboardTypes); s.keypadType = static_cast(keypadType); s.lockType = static_cast(lockType); s.batStatus = static_cast(batStatus); in >> s.uniqueDeviceId; in >> s.messageRingtoneVolume >> s.voiceRingtoneVolume >> s.vibrationActive; return in; } QDataStream &operator<<(QDataStream &out, const QSystemStorageInfoData &s) { out << s.drives; return out; } QDataStream &operator>>(QDataStream &in, QSystemStorageInfoData &s) { in >> s.drives; return in; } QDataStream &operator<<(QDataStream &out, const QSystemStorageInfoData::DriveInfo &s) { out << static_cast(s.type) << s.availableSpace << s.totalSpace; out << static_cast(s.state) << s.uri; return out; } QDataStream &operator>>(QDataStream &in, QSystemStorageInfoData::DriveInfo &s) { qint32 type, state; in >> type; s.type = static_cast(type); in >> s.availableSpace >> s.totalSpace; in >> state; s.state = static_cast(state); in >> s.uri; return in; } QDataStream &operator<<(QDataStream &out, const QSystemNetworkInfoData &s) { out << static_cast(s.cellId) << static_cast(s.locationAreaCode); out << s.currentMobileCountryCode << s.currentMobileNetworkCode; out << s.homeMobileCountryCode << s.homeMobileNetworkCode; qint32 currentMode = static_cast(s.currentMode); out << currentMode; out << s.networkInfo; out << s.cellData; return out; } QDataStream &operator>>(QDataStream &in, QSystemNetworkInfoData &s) { qint32 cellid, loc, cellData; in >> cellid >> loc >> cellData; s.cellId = cellid; s.locationAreaCode = loc; in >> s.currentMobileCountryCode >> s.currentMobileNetworkCode; in >> s.homeMobileCountryCode >> s.homeMobileNetworkCode; qint32 currentMode; in >> currentMode; s.currentMode = static_cast(currentMode); in >> s.networkInfo; s.cellData = static_cast(cellData); return in; } QDataStream &operator<<(QDataStream &out, const QSystemNetworkInfoData::NetworkInfo &s) { out << s.name << s.macAddress; out << s.signalStrength << static_cast(s.status); return out; } QDataStream &operator>>(QDataStream &in, QSystemNetworkInfoData::NetworkInfo &s) { in >> s.name >> s.macAddress; in >> s.signalStrength; qint32 status; in >> status; s.status = static_cast(status); return in; } QDataStream &operator<<(QDataStream &out, const QSystemDisplayInfoData &s) { out << static_cast(s.colorDepth) << static_cast(s.displayBrightness); out << static_cast(s.orientation); out << static_cast(s.backlightStatus); return out; } QDataStream &operator>>(QDataStream &in, QSystemDisplayInfoData &s) { qint32 colorDepth, displayBrightness, orientation, backlightStatus; in >> colorDepth >> displayBrightness; in >> orientation >> backlightStatus; s.colorDepth = colorDepth; s.displayBrightness = displayBrightness; s.orientation = static_cast(orientation); s.backlightStatus = static_cast(backlightStatus); return in; } QDataStream &operator<<(QDataStream &out, const QSystemBatteryInfoData &s) { out << static_cast(s.batteryStatus) << static_cast(s.chargingState); out << static_cast(s.chargerType); out << s.nominalCapacity << s.remainingCapacityPercent << s.remainingCapacity << s.voltage; out << s.remainingChargingTime << s.currentFlow << s.cumulativeCurrentFlow << s.remainingCapacityBars; out << s.maxBars; out << s.energyMeasurementUnit; return out; } QDataStream &operator>>(QDataStream &in, QSystemBatteryInfoData &s) { qint32 batteryStatus, chargingState, chargerType, energyMeasurementUnit; in >> batteryStatus >> chargingState >> chargerType; s.batteryStatus = static_cast(batteryStatus); s.chargingState = static_cast(chargingState); s.chargerType = static_cast(chargerType); in >> s.nominalCapacity >> s.remainingCapacityPercent >> s.remainingCapacity; in >> s.voltage >> s.remainingChargingTime >> s.currentFlow; in >> s.cumulativeCurrentFlow >> s.remainingCapacityBars >> s.maxBars; in >> energyMeasurementUnit; s.energyMeasurementUnit = static_cast(energyMeasurementUnit); return in; } QDataStream &operator<<(QDataStream &out, const QSystemScreenSaverData &s) { out << s.inhibitedCount; return out; } QDataStream &operator>>(QDataStream &in, QSystemScreenSaverData &s) { in >> s.inhibitedCount; return in; } QTM_END_NAMESPACE