wlanutilities/wlanlogin/ictsqtwrapper/src/ictsqtwrapper.cpp
author hgs
Thu, 24 Jun 2010 10:49:51 +0300
changeset 39 7b3e49e4608a
permissions -rw-r--r--
201025
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
39
hgs
parents:
diff changeset
     1
/*
hgs
parents:
diff changeset
     2
* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
hgs
parents:
diff changeset
     3
* All rights reserved.
hgs
parents:
diff changeset
     4
* This component and the accompanying materials are made available
hgs
parents:
diff changeset
     5
* under the terms of "Eclipse Public License v1.0"
hgs
parents:
diff changeset
     6
* which accompanies this distribution, and is available
hgs
parents:
diff changeset
     7
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
hgs
parents:
diff changeset
     8
*
hgs
parents:
diff changeset
     9
* Initial Contributors:
hgs
parents:
diff changeset
    10
* Nokia Corporation - initial contribution.
hgs
parents:
diff changeset
    11
*
hgs
parents:
diff changeset
    12
* Contributors:
hgs
parents:
diff changeset
    13
*
hgs
parents:
diff changeset
    14
* Description:
hgs
parents:
diff changeset
    15
* Implementation of IctsWrapper class
hgs
parents:
diff changeset
    16
*
hgs
parents:
diff changeset
    17
*/
hgs
parents:
diff changeset
    18
hgs
parents:
diff changeset
    19
// System includes
hgs
parents:
diff changeset
    20
hgs
parents:
diff changeset
    21
// User includes
hgs
parents:
diff changeset
    22
hgs
parents:
diff changeset
    23
#include "ictsqtwrapper.h"
hgs
parents:
diff changeset
    24
#include "ictsqtwrapper_symbian.h"
hgs
parents:
diff changeset
    25
hgs
parents:
diff changeset
    26
#include "OstTraceDefinitions.h"
hgs
parents:
diff changeset
    27
#ifdef OST_TRACE_COMPILER_IN_USE
hgs
parents:
diff changeset
    28
#include "ictsqtwrapperTraces.h"
hgs
parents:
diff changeset
    29
#endif
hgs
parents:
diff changeset
    30
hgs
parents:
diff changeset
    31
/*!
hgs
parents:
diff changeset
    32
    \class IctsWrapper
hgs
parents:
diff changeset
    33
    \brief This is a wrapper implementation for symbian side ICTS client interface
hgs
parents:
diff changeset
    34
*/
hgs
parents:
diff changeset
    35
hgs
parents:
diff changeset
    36
// External function prototypes
hgs
parents:
diff changeset
    37
hgs
parents:
diff changeset
    38
// Local constants
hgs
parents:
diff changeset
    39
hgs
parents:
diff changeset
    40
hgs
parents:
diff changeset
    41
// ======== LOCAL FUNCTIONS ========
hgs
parents:
diff changeset
    42
hgs
parents:
diff changeset
    43
hgs
parents:
diff changeset
    44
// ======== MEMBER FUNCTIONS ========
hgs
parents:
diff changeset
    45
hgs
parents:
diff changeset
    46
/*!
hgs
parents:
diff changeset
    47
    Constructor
hgs
parents:
diff changeset
    48
        
hgs
parents:
diff changeset
    49
 */
hgs
parents:
diff changeset
    50
IctsWrapper::IctsWrapper(int iap, int netId, QObject *parent) : 
hgs
parents:
diff changeset
    51
    QObject(parent), 
hgs
parents:
diff changeset
    52
    mIsPolling(false),
hgs
parents:
diff changeset
    53
    d_ptr(new IctsWrapperPrivate(iap, netId, this))
hgs
parents:
diff changeset
    54
{
hgs
parents:
diff changeset
    55
    OstTraceFunctionEntry0( ICTSWRAPPER_ICTSWRAPPER_ENTRY );
hgs
parents:
diff changeset
    56
    
hgs
parents:
diff changeset
    57
    OstTraceFunctionExit0( ICTSWRAPPER_ICTSWRAPPER_EXIT );
hgs
parents:
diff changeset
    58
}
hgs
parents:
diff changeset
    59
hgs
parents:
diff changeset
    60
/*!
hgs
parents:
diff changeset
    61
    Destructor
hgs
parents:
diff changeset
    62
        
hgs
parents:
diff changeset
    63
 */
hgs
parents:
diff changeset
    64
IctsWrapper::~IctsWrapper()
hgs
parents:
diff changeset
    65
{
hgs
parents:
diff changeset
    66
    OstTraceFunctionEntry0( ICTSWRAPPER_DESTRUCTOR_ENTRY );
hgs
parents:
diff changeset
    67
    
hgs
parents:
diff changeset
    68
    OstTraceFunctionExit0( ICTSWRAPPER_DESTRUCTOR_EXIT );
hgs
parents:
diff changeset
    69
}
hgs
parents:
diff changeset
    70
hgs
parents:
diff changeset
    71
/*!
hgs
parents:
diff changeset
    72
    This function emits connectivityTestResult signal
hgs
parents:
diff changeset
    73
    @param [in] result result of internet connectivity test
hgs
parents:
diff changeset
    74
    @param [in] redirectUrl Possible redirection URL that was received
hgs
parents:
diff changeset
    75
 */
hgs
parents:
diff changeset
    76
void IctsWrapper::emitConnectivityTestResult(IctsWrapper::ConnectivityTestResult result, QUrl redirectUrl)
hgs
parents:
diff changeset
    77
{
hgs
parents:
diff changeset
    78
    OstTraceFunctionEntry0( ICTSWRAPPER_EMITCONNECTIVITYTESTRESULT_ENTRY );
hgs
parents:
diff changeset
    79
hgs
parents:
diff changeset
    80
    OstTrace1( TRACE_NORMAL, ICTSWRAPPER_EMITCONNECTIVITYTESTRESULT_RESULT_TRACE, "IctsWrapper::emitConnectivityTestResult;result=%d", result );
hgs
parents:
diff changeset
    81
          
hgs
parents:
diff changeset
    82
#ifdef OST_TRACE_COMPILER_IN_USE
hgs
parents:
diff changeset
    83
    QString url = redirectUrl.toString();
hgs
parents:
diff changeset
    84
    TPtrC tmp(url.utf16(),url.length() );
hgs
parents:
diff changeset
    85
    
hgs
parents:
diff changeset
    86
    OstTraceExt1( TRACE_NORMAL, ICTSWRAPPER_EMITCONNECTIVITYTESTRESULT_URL_TRACE, 
hgs
parents:
diff changeset
    87
        "IctsWrapper::emitConnectivityTestResult;redirectUrl=%S", tmp );
hgs
parents:
diff changeset
    88
#endif
hgs
parents:
diff changeset
    89
    
hgs
parents:
diff changeset
    90
    emit connectivityTestResult(result, redirectUrl);
hgs
parents:
diff changeset
    91
    mIsPolling = false;
hgs
parents:
diff changeset
    92
hgs
parents:
diff changeset
    93
    OstTraceFunctionExit0( ICTSWRAPPER_EMITCONNECTIVITYTESTRESULT_EXIT );
hgs
parents:
diff changeset
    94
}
hgs
parents:
diff changeset
    95
hgs
parents:
diff changeset
    96
/*!
hgs
parents:
diff changeset
    97
    This function starts connectivity test
hgs
parents:
diff changeset
    98
 */
hgs
parents:
diff changeset
    99
hgs
parents:
diff changeset
   100
void IctsWrapper::startConnectivityTest()
hgs
parents:
diff changeset
   101
{
hgs
parents:
diff changeset
   102
    OstTraceFunctionEntry0( ICTSWRAPPER_STARTCONNECTIVITYTEST_ENTRY );
hgs
parents:
diff changeset
   103
    
hgs
parents:
diff changeset
   104
    d_ptr->startConnectivityTest();
hgs
parents:
diff changeset
   105
hgs
parents:
diff changeset
   106
    OstTraceFunctionExit0( ICTSWRAPPER_STARTCONNECTIVITYTEST_EXIT );
hgs
parents:
diff changeset
   107
}
hgs
parents:
diff changeset
   108
hgs
parents:
diff changeset
   109
/*!
hgs
parents:
diff changeset
   110
    This function starts connectivity test in polling mode
hgs
parents:
diff changeset
   111
    
hgs
parents:
diff changeset
   112
    @param [in] pollingTime Total polling time
hgs
parents:
diff changeset
   113
    @param [in] pollingInterval Interval between polls
hgs
parents:
diff changeset
   114
 */
hgs
parents:
diff changeset
   115
void IctsWrapper::startPolling(int pollingTime, int pollingInterval)
hgs
parents:
diff changeset
   116
{
hgs
parents:
diff changeset
   117
    OstTraceFunctionEntry0( ICTSWRAPPER_STARTPOLLING_ENTRY );
hgs
parents:
diff changeset
   118
    
hgs
parents:
diff changeset
   119
    d_ptr->startPolling(pollingTime, pollingInterval);
hgs
parents:
diff changeset
   120
    mIsPolling = true;
hgs
parents:
diff changeset
   121
hgs
parents:
diff changeset
   122
    OstTraceFunctionExit0( ICTSWRAPPER_STARTPOLLING_EXIT );
hgs
parents:
diff changeset
   123
}
hgs
parents:
diff changeset
   124
hgs
parents:
diff changeset
   125
/*!
hgs
parents:
diff changeset
   126
    This function stops polling mode
hgs
parents:
diff changeset
   127
 */
hgs
parents:
diff changeset
   128
void IctsWrapper::stopPolling()
hgs
parents:
diff changeset
   129
{
hgs
parents:
diff changeset
   130
    OstTraceFunctionEntry0( ICTSWRAPPER_STOPPOLLING_ENTRY );
hgs
parents:
diff changeset
   131
hgs
parents:
diff changeset
   132
    d_ptr->stopPolling();
hgs
parents:
diff changeset
   133
    
hgs
parents:
diff changeset
   134
    OstTraceFunctionExit0( ICTSWRAPPER_STOPPOLLING_EXIT );
hgs
parents:
diff changeset
   135
}
hgs
parents:
diff changeset
   136
hgs
parents:
diff changeset
   137
/*!
hgs
parents:
diff changeset
   138
    This function returns whether we are polling or not
hgs
parents:
diff changeset
   139
 */
hgs
parents:
diff changeset
   140
bool IctsWrapper::isPolling() const
hgs
parents:
diff changeset
   141
{
hgs
parents:
diff changeset
   142
    OstTraceFunctionEntry0( ICTSWRAPPER_ISPOLLING_ENTRY );
hgs
parents:
diff changeset
   143
    
hgs
parents:
diff changeset
   144
    OstTraceFunctionExit0( ICTSWRAPPER_ISPOLLING_EXIT );
hgs
parents:
diff changeset
   145
    
hgs
parents:
diff changeset
   146
    return mIsPolling;
hgs
parents:
diff changeset
   147
}