wlanutilities/cpwlansettingsplugin/src/wlansettings.cpp
author Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
Thu, 02 Sep 2010 21:36:44 +0300
changeset 56 de27cc8389dd
parent 19 10810c91db26
permissions -rw-r--r--
Revision: 201033 Kit: 201035
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
19
10810c91db26 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
     1
/*
10810c91db26 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
     2
* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
10810c91db26 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
     3
* All rights reserved.
10810c91db26 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
     4
* This component and the accompanying materials are made available
10810c91db26 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
     5
* under the terms of "Eclipse Public License v1.0""
10810c91db26 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
     6
* which accompanies this distribution, and is available
10810c91db26 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
     7
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
10810c91db26 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
     8
*
10810c91db26 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
     9
* Initial Contributors:
10810c91db26 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    10
* Nokia Corporation - initial contribution.
10810c91db26 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    11
*
10810c91db26 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    12
* Contributors:
10810c91db26 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    13
*
10810c91db26 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    14
* Description:  
10810c91db26 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    15
*
10810c91db26 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    16
*/
10810c91db26 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    17
10810c91db26 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    18
// System includes
10810c91db26 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    19
10810c91db26 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    20
#include <xqsettingsmanager.h>
10810c91db26 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    21
#include <xqsettingskey.h>
10810c91db26 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    22
#include <psmsrvdomaincrkeys.h>
56
de27cc8389dd Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 19
diff changeset
    23
#include <psmtypes.h>
19
10810c91db26 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    24
10810c91db26 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    25
// User includes
10810c91db26 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    26
56
de27cc8389dd Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 19
diff changeset
    27
#include "wlansettings_s60_p.h"
19
10810c91db26 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    28
#include "wlansettings.h"
10810c91db26 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    29
10810c91db26 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    30
#include "OstTraceDefinitions.h"
10810c91db26 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    31
#ifdef OST_TRACE_COMPILER_IN_USE
10810c91db26 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    32
#include "wlansettingsTraces.h"
10810c91db26 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    33
#endif
10810c91db26 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    34
10810c91db26 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    35
/*!
10810c91db26 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    36
   \class WlanSettings
10810c91db26 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    37
   \brief WlanSettings is a wrapper class for CWlanSettingsImpl.
10810c91db26 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    38
*/
10810c91db26 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    39
10810c91db26 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    40
// External function prototypes
10810c91db26 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    41
10810c91db26 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    42
// Local constants
10810c91db26 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    43
56
de27cc8389dd Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 19
diff changeset
    44
//! Device Power Saving Mode setting key
de27cc8389dd Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 19
diff changeset
    45
static const XQSettingsKey devicePowerSavingKey(
de27cc8389dd Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 19
diff changeset
    46
    XQSettingsKey::TargetCentralRepository,
de27cc8389dd Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 19
diff changeset
    47
    KCRUidPowerSaveMode.iUid, 
de27cc8389dd Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 19
diff changeset
    48
    KPsmCurrentMode);
de27cc8389dd Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 19
diff changeset
    49
    
19
10810c91db26 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    50
// ======== MEMBER FUNCTIONS ========
10810c91db26 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    51
10810c91db26 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    52
/*!
10810c91db26 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    53
    Constructor.
10810c91db26 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    54
*/
10810c91db26 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    55
10810c91db26 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    56
WlanSettings::WlanSettings() :
56
de27cc8389dd Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 19
diff changeset
    57
    QObject(),
de27cc8389dd Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 19
diff changeset
    58
    mSettingsManager(new XQSettingsManager(this)),
de27cc8389dd Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 19
diff changeset
    59
    mDevicePowerSavingMode(0),
de27cc8389dd Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 19
diff changeset
    60
    mDevicePowerSavingModeUpToDate(false)
19
10810c91db26 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    61
{
56
de27cc8389dd Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 19
diff changeset
    62
    OstTraceFunctionEntry0( WLANSETTINGS_WLANSETTINGS_ENTRY );
de27cc8389dd Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 19
diff changeset
    63
    OstTraceFunctionExit0( WLANSETTINGS_WLANSETTINGS_EXIT );
19
10810c91db26 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    64
}
10810c91db26 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    65
10810c91db26 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    66
/*!
10810c91db26 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    67
    Destructor.
10810c91db26 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    68
*/
10810c91db26 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    69
10810c91db26 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    70
WlanSettings::~WlanSettings()
10810c91db26 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    71
{
56
de27cc8389dd Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 19
diff changeset
    72
    OstTraceFunctionEntry0( DUP1_WLANSETTINGS_WLANSETTINGS_ENTRY );
19
10810c91db26 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    73
56
de27cc8389dd Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 19
diff changeset
    74
    delete d_ptr;
19
10810c91db26 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    75
    
56
de27cc8389dd Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 19
diff changeset
    76
    OstTraceFunctionExit0( DUP1_WLANSETTINGS_WLANSETTINGS_EXIT );
19
10810c91db26 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    77
}
10810c91db26 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    78
10810c91db26 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    79
/*!
10810c91db26 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    80
    Creates the CWlanSettingsImpl object for reading/writing settings.
10810c91db26 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    81
    \return Error code.
10810c91db26 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    82
*/
10810c91db26 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    83
10810c91db26 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    84
int WlanSettings::init()
10810c91db26 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    85
{
56
de27cc8389dd Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 19
diff changeset
    86
    OstTraceFunctionEntry0( WLANSETTINGS_INIT_ENTRY );
19
10810c91db26 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    87
    
56
de27cc8389dd Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 19
diff changeset
    88
    // Listen for changes in the key value
de27cc8389dd Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 19
diff changeset
    89
    bool connectStatus = connect(
de27cc8389dd Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 19
diff changeset
    90
        mSettingsManager,
de27cc8389dd Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 19
diff changeset
    91
        SIGNAL(valueChanged(XQSettingsKey, QVariant)),
de27cc8389dd Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 19
diff changeset
    92
        this,
de27cc8389dd Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 19
diff changeset
    93
        SLOT(devicePowerSavingKeyChanged()));
de27cc8389dd Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 19
diff changeset
    94
    Q_ASSERT(connectStatus);
de27cc8389dd Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 19
diff changeset
    95
    mSettingsManager->startMonitoring(devicePowerSavingKey);
19
10810c91db26 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    96
    
56
de27cc8389dd Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 19
diff changeset
    97
    TRAPD(error,(d_ptr = CWlanSettingsPrivate::NewL(this)));
de27cc8389dd Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 19
diff changeset
    98
    
de27cc8389dd Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 19
diff changeset
    99
    OstTraceFunctionExit0( WLANSETTINGS_INIT_EXIT );
19
10810c91db26 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   100
    return error;
10810c91db26 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   101
}
10810c91db26 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   102
56
de27cc8389dd Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 19
diff changeset
   103
/*!
de27cc8389dd Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 19
diff changeset
   104
    Reads the value of the Device Power Saving Mode setting.
de27cc8389dd Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 19
diff changeset
   105
*/
19
10810c91db26 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   106
56
de27cc8389dd Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 19
diff changeset
   107
void WlanSettings::readDevicePowerSavingKey()
19
10810c91db26 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   108
{
56
de27cc8389dd Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 19
diff changeset
   109
    OstTraceFunctionEntry0( WLANSETTINGS_READDEVICEPOWERSAVINGKEY_ENTRY );
19
10810c91db26 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   110
    
56
de27cc8389dd Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 19
diff changeset
   111
    mDevicePowerSavingMode = 
de27cc8389dd Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 19
diff changeset
   112
        mSettingsManager->readItemValue(devicePowerSavingKey).toInt();
19
10810c91db26 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   113
56
de27cc8389dd Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 19
diff changeset
   114
    mDevicePowerSavingModeUpToDate = true;
de27cc8389dd Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 19
diff changeset
   115
    
de27cc8389dd Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 19
diff changeset
   116
    OstTrace1(
de27cc8389dd Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 19
diff changeset
   117
        TRACE_NORMAL,
de27cc8389dd Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 19
diff changeset
   118
        WLANSETTINGS_READDEVICEPOWERSAVINGKEY,
de27cc8389dd Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 19
diff changeset
   119
        "WlanSettings::readDevicePowerSavingKey;powerSaving=%d",
de27cc8389dd Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 19
diff changeset
   120
        mDevicePowerSavingMode );
de27cc8389dd Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 19
diff changeset
   121
de27cc8389dd Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 19
diff changeset
   122
    OstTraceFunctionExit0( WLANSETTINGS_READDEVICEPOWERSAVINGKEY_EXIT );
de27cc8389dd Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 19
diff changeset
   123
}
19
10810c91db26 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   124
56
de27cc8389dd Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 19
diff changeset
   125
/*!
de27cc8389dd Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 19
diff changeset
   126
    Slot for handling updates in the Device Power Saving Mode setting.
de27cc8389dd Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 19
diff changeset
   127
*/
19
10810c91db26 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   128
56
de27cc8389dd Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 19
diff changeset
   129
void WlanSettings::devicePowerSavingKeyChanged()
de27cc8389dd Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 19
diff changeset
   130
{
de27cc8389dd Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 19
diff changeset
   131
    OstTraceFunctionEntry0( WLANSETTINGS_DEVICEPOWERSAVINGKEYCHANGED_ENTRY );
19
10810c91db26 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   132
    
56
de27cc8389dd Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 19
diff changeset
   133
    // Remember that we need to read the setting value again before
de27cc8389dd Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 19
diff changeset
   134
    // using it, and notify UI of the change.
de27cc8389dd Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 19
diff changeset
   135
    mDevicePowerSavingModeUpToDate = false;
de27cc8389dd Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 19
diff changeset
   136
    emit devicePowerSavingUpdated();
de27cc8389dd Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 19
diff changeset
   137
    
de27cc8389dd Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 19
diff changeset
   138
    OstTraceFunctionExit0( WLANSETTINGS_DEVICEPOWERSAVINGKEYCHANGED_EXIT );
19
10810c91db26 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   139
}
10810c91db26 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   140
10810c91db26 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   141
/*!
10810c91db26 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   142
    Reads the WLAN setting values.
10810c91db26 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   143
    \return Error code.
10810c91db26 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   144
*/
10810c91db26 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   145
10810c91db26 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   146
int WlanSettings::loadSettings()
10810c91db26 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   147
{
56
de27cc8389dd Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 19
diff changeset
   148
    OstTraceFunctionEntry0( WLANSETTINGS_LOADSETTINGS_ENTRY );
de27cc8389dd Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 19
diff changeset
   149
    
de27cc8389dd Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 19
diff changeset
   150
    TRAPD(error, d_ptr->LoadDBSettingsL());
19
10810c91db26 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   151
    
56
de27cc8389dd Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 19
diff changeset
   152
    OstTrace1(
de27cc8389dd Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 19
diff changeset
   153
        TRACE_NORMAL,
de27cc8389dd Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 19
diff changeset
   154
        WLANSETTINGS_LOADSETTINGS,
de27cc8389dd Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 19
diff changeset
   155
        "WlanSettings::loadSettings;error=%d",
de27cc8389dd Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 19
diff changeset
   156
        error );
19
10810c91db26 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   157
    
56
de27cc8389dd Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 19
diff changeset
   158
    OstTraceFunctionExit0( WLANSETTINGS_LOADSETTINGS_EXIT );
19
10810c91db26 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   159
    return error;
10810c91db26 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   160
}
10810c91db26 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   161
10810c91db26 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   162
/*!
10810c91db26 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   163
    Function to get the scan network type.
10810c91db26 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   164
    \return ScanNetworkType which is automatic or user-defined.
10810c91db26 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   165
*/
10810c91db26 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   166
10810c91db26 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   167
WlanSettings::ScanNetworkType WlanSettings::scanNetworkType()
10810c91db26 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   168
{
56
de27cc8389dd Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 19
diff changeset
   169
    OstTraceFunctionEntry0( WLANSETTINGS_SCANNETWORKTYPE_ENTRY );
19
10810c91db26 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   170
    
10810c91db26 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   171
    ScanNetworkType scanType;
56
de27cc8389dd Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 19
diff changeset
   172
    if (d_ptr->ScanInterval() == ScanNetworkAuto) {
19
10810c91db26 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   173
        scanType = EScanNetworkAuto;
56
de27cc8389dd Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 19
diff changeset
   174
    } else {
19
10810c91db26 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   175
        scanType = EScanNetworkUserDefined;
10810c91db26 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   176
    }
10810c91db26 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   177
    
56
de27cc8389dd Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 19
diff changeset
   178
    OstTrace1(
de27cc8389dd Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 19
diff changeset
   179
        TRACE_NORMAL,
de27cc8389dd Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 19
diff changeset
   180
        WLANSETTINGS_SCANNETWORKTYPE,
de27cc8389dd Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 19
diff changeset
   181
        "WlanSettings::scanNetworkType;scanType=%d",
de27cc8389dd Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 19
diff changeset
   182
        scanType );
de27cc8389dd Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 19
diff changeset
   183
    
de27cc8389dd Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 19
diff changeset
   184
    OstTraceFunctionExit0( WLANSETTINGS_SCANNETWORKTYPE_EXIT );
19
10810c91db26 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   185
    return scanType;
10810c91db26 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   186
}
10810c91db26 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   187
10810c91db26 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   188
/*!
10810c91db26 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   189
    Function to get the scan interval.
10810c91db26 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   190
    \return Scan interval  in minutes.
10810c91db26 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   191
*/
10810c91db26 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   192
10810c91db26 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   193
uint WlanSettings::scanInterval()
10810c91db26 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   194
{
56
de27cc8389dd Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 19
diff changeset
   195
    OstTraceFunctionEntry0( WLANSETTINGS_SCANINTERVAL_ENTRY );
19
10810c91db26 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   196
    
56
de27cc8389dd Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 19
diff changeset
   197
    uint scanInterval = d_ptr->ScanInterval();
19
10810c91db26 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   198
    
56
de27cc8389dd Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 19
diff changeset
   199
    OstTrace1(
de27cc8389dd Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 19
diff changeset
   200
        TRACE_NORMAL,
de27cc8389dd Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 19
diff changeset
   201
        WLANSETTINGS_SCANINTERVAL,
de27cc8389dd Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 19
diff changeset
   202
        "WlanSettings::scanInterval;scanInterval=%u",
de27cc8389dd Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 19
diff changeset
   203
        scanInterval );
19
10810c91db26 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   204
    
56
de27cc8389dd Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 19
diff changeset
   205
    OstTraceFunctionExit0( WLANSETTINGS_SCANINTERVAL_EXIT );
19
10810c91db26 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   206
    return scanInterval;
10810c91db26 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   207
}
10810c91db26 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   208
10810c91db26 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   209
/*!
56
de27cc8389dd Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 19
diff changeset
   210
    Function to get Wlan Power Saving Option.
19
10810c91db26 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   211
    \return True if Power Saving option is enabled, otherwise False.
10810c91db26 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   212
*/
10810c91db26 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   213
56
de27cc8389dd Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 19
diff changeset
   214
bool WlanSettings::isWlanPowerSavingEnabled() const
19
10810c91db26 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   215
{
56
de27cc8389dd Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 19
diff changeset
   216
    OstTraceFunctionEntry0( WLANSETTINGS_ISWLANPOWERSAVINGENABLED_ENTRY );
de27cc8389dd Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 19
diff changeset
   217
    OstTraceFunctionExit0( WLANSETTINGS_ISWLANPOWERSAVINGENABLED_EXIT );
de27cc8389dd Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 19
diff changeset
   218
    return d_ptr->PowerSaving();
19
10810c91db26 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   219
}
10810c91db26 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   220
10810c91db26 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   221
/*!
10810c91db26 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   222
    Function to set Power Saving Option.
10810c91db26 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   223
    \param powerSavingOption True to enable or false to disable power saving option. 
10810c91db26 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   224
    \return Error code.
10810c91db26 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   225
*/
10810c91db26 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   226
10810c91db26 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   227
int WlanSettings::setWlanPowerSaving(int powerSavingOption)
10810c91db26 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   228
{
56
de27cc8389dd Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 19
diff changeset
   229
    OstTraceFunctionEntry0( WLANSETTINGS_SETWLANPOWERSAVING_ENTRY );
19
10810c91db26 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   230
    
56
de27cc8389dd Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 19
diff changeset
   231
    d_ptr->SetPowerSaving(powerSavingOption);
de27cc8389dd Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 19
diff changeset
   232
    TRAPD(error, d_ptr->SaveDBSettingsL(CWlanSettingsPrivate::EWlanPowerSaving));
19
10810c91db26 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   233
56
de27cc8389dd Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 19
diff changeset
   234
    OstTraceFunctionExit0( WLANSETTINGS_SETWLANPOWERSAVING_EXIT );
19
10810c91db26 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   235
    return error;
10810c91db26 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   236
}
10810c91db26 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   237
10810c91db26 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   238
/*!
10810c91db26 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   239
    Function to set Scan interval.
10810c91db26 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   240
    \param scanInterval Scan interval in minutes. 
10810c91db26 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   241
    \return Error code.
10810c91db26 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   242
*/
10810c91db26 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   243
10810c91db26 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   244
int WlanSettings::setWlanScanInterval(uint scanInterval)
10810c91db26 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   245
{
56
de27cc8389dd Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 19
diff changeset
   246
    OstTraceFunctionEntry0( WLANSETTINGS_SETWLANSCANINTERVAL_ENTRY );
19
10810c91db26 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   247
    
56
de27cc8389dd Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 19
diff changeset
   248
    d_ptr->SetScanInterval(scanInterval);
de27cc8389dd Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 19
diff changeset
   249
    TRAPD(error, d_ptr->SaveDBSettingsL(CWlanSettingsPrivate::EWlanScanInterval));
19
10810c91db26 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   250
56
de27cc8389dd Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 19
diff changeset
   251
    OstTraceFunctionExit0( WLANSETTINGS_SETWLANSCANINTERVAL_EXIT );
19
10810c91db26 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   252
    return error;
10810c91db26 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   253
}
10810c91db26 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   254
10810c91db26 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   255
/*!
10810c91db26 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   256
    Function to get Join WLAN networks option.
10810c91db26 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   257
    \return 0 for Known, 1 for Manual.
10810c91db26 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   258
*/
10810c91db26 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   259
10810c91db26 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   260
int WlanSettings::joinWlanMode() const
10810c91db26 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   261
{
56
de27cc8389dd Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 19
diff changeset
   262
    OstTraceFunctionEntry0( WLANSETTINGS_JOINWLANMODE_ENTRY );
de27cc8389dd Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 19
diff changeset
   263
    OstTraceFunctionExit0( WLANSETTINGS_JOINWLANMODE_EXIT );
de27cc8389dd Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 19
diff changeset
   264
    return d_ptr->JoinWlanMode();
19
10810c91db26 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   265
}
10810c91db26 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   266
10810c91db26 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   267
/*!
10810c91db26 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   268
    Function to set Join WLAN networks option.
10810c91db26 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   269
    \param mode 0 for Known, 1 for Manual. 
10810c91db26 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   270
    \return Error code.
10810c91db26 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   271
*/
10810c91db26 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   272
10810c91db26 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   273
int WlanSettings::setJoinWlanMode(int mode)
10810c91db26 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   274
{
56
de27cc8389dd Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 19
diff changeset
   275
    OstTraceFunctionEntry0( WLANSETTINGS_SETJOINWLANMODE_ENTRY );
19
10810c91db26 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   276
    
56
de27cc8389dd Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 19
diff changeset
   277
    TRAPD(error, d_ptr->SaveJoinWlanSettingL(mode));
19
10810c91db26 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   278
    
56
de27cc8389dd Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 19
diff changeset
   279
    OstTraceFunctionExit0( WLANSETTINGS_SETJOINWLANMODE_EXIT );
19
10810c91db26 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   280
    return error;
10810c91db26 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   281
}
10810c91db26 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   282
10810c91db26 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   283
/*!
10810c91db26 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   284
    Function to get Power Saving status of the device.
10810c91db26 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   285
    \return True if Power Saving is enabled.
10810c91db26 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   286
*/
10810c91db26 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   287
56
de27cc8389dd Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 19
diff changeset
   288
bool WlanSettings::isDevicePowerSavingEnabled()
19
10810c91db26 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   289
{
56
de27cc8389dd Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 19
diff changeset
   290
    OstTraceFunctionEntry0( WLANSETTINGS_ISDEVICEPOWERSAVINGENABLED_ENTRY );
de27cc8389dd Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 19
diff changeset
   291
    
de27cc8389dd Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 19
diff changeset
   292
    if (!mDevicePowerSavingModeUpToDate) {
de27cc8389dd Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 19
diff changeset
   293
        readDevicePowerSavingKey();
de27cc8389dd Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 19
diff changeset
   294
    }
de27cc8389dd Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 19
diff changeset
   295
    if (mDevicePowerSavingMode == EPsmsrvModeNormal) {
de27cc8389dd Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 19
diff changeset
   296
        OstTraceFunctionExit0( WLANSETTINGS_ISDEVICEPOWERSAVINGENABLED_EXIT );
de27cc8389dd Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 19
diff changeset
   297
        return false;
de27cc8389dd Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 19
diff changeset
   298
    } else {
de27cc8389dd Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 19
diff changeset
   299
        OstTraceFunctionExit0( DUP1_WLANSETTINGS_ISDEVICEPOWERSAVINGENABLED_EXIT );
de27cc8389dd Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 19
diff changeset
   300
        return true;
de27cc8389dd Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 19
diff changeset
   301
    }
19
10810c91db26 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   302
}