homescreenapp/hsutils/tsrc/t_hsutils/src/mocksysteminfo.cpp
changeset 90 3ac3aaebaee5
child 97 66b5fe3c07fd
equal deleted inserted replaced
86:e4f038c420f7 90:3ac3aaebaee5
       
     1 /*
       
     2 * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description:  Mock implementation for system info for testing
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #include <QVariant>
       
    20 
       
    21 #include "mocksysteminfo.h"
       
    22 
       
    23 
       
    24 QSystemNetworkInfo::QSystemNetworkInfo(QObject *parent) : QObject(parent)
       
    25 {
       
    26 }
       
    27 QSystemNetworkInfo::~QSystemNetworkInfo()
       
    28 {
       
    29 }
       
    30 
       
    31 QSystemNetworkInfo::NetworkStatus QSystemNetworkInfo::networkStatus(QSystemNetworkInfo::NetworkMode mode)
       
    32 {
       
    33 // property 'testNetworkMode' -> GsmMode / WcdmaMode, others return NoNetworkAvailable
       
    34 // property 'testNetworkStatus' -> NoNetworkAvailable / Connected / HomeNetwork, others return NoNetworkAvailable
       
    35     QSystemNetworkInfo::NetworkStatus networkStatus = NoNetworkAvailable;
       
    36     int modeProperty = property("testNetworkMode").toInt();
       
    37     int statusProperty = property("testNetworkStatus").toInt();
       
    38     if ( modeProperty == mode ) {
       
    39         networkStatus = (QSystemNetworkInfo::NetworkStatus) statusProperty;
       
    40     }
       
    41     return networkStatus;
       
    42 }
       
    43 
       
    44 int QSystemNetworkInfo::networkSignalStrength(QSystemNetworkInfo::NetworkMode mode)
       
    45 {
       
    46     Q_UNUSED(mode);
       
    47     return -1;
       
    48 }
       
    49 
       
    50 QString QSystemNetworkInfo::networkName(QSystemNetworkInfo::NetworkMode mode)
       
    51 {
       
    52     Q_UNUSED(mode);
       
    53     return QString("Testing");
       
    54 }
       
    55 
       
    56 
       
    57 QSystemDeviceInfo::QSystemDeviceInfo(QObject *parent) : QObject(parent)
       
    58 {
       
    59 }
       
    60 QSystemDeviceInfo::~QSystemDeviceInfo()
       
    61 {
       
    62 }
       
    63 
       
    64 QSystemDeviceInfo::SimStatus QSystemDeviceInfo::simStatus()
       
    65 {
       
    66     if (property("simAvailable").toBool()) {
       
    67         return SingleSimAvailable;
       
    68     }
       
    69     return SimNotAvailable;
       
    70 }
       
    71 
       
    72 QSystemDeviceInfo::Profile QSystemDeviceInfo::currentProfile()
       
    73 {
       
    74     if (property("offlineMode").toBool()) {
       
    75         return OfflineProfile;
       
    76     }
       
    77     return NormalProfile;
       
    78 }
       
    79 
       
    80 // End of file
       
    81