wlanutilities/wlanqtutilities/wrapper/src/wlanqtutilsconmonwrapper.cpp
author hgs
Thu, 27 May 2010 10:28:52 +0300
changeset 32 5bbf13e885a0
parent 31 e8f4211554fb
child 39 7b3e49e4608a
permissions -rw-r--r--
201021_1
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
/*
31
hgs
parents: 19
diff changeset
     2
* Copyright (c) 2009-2010 Nokia Corporation and/or its subsidiary(-ies).
19
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:
31
hgs
parents: 19
diff changeset
    15
* Wrapper for Symbian Connection Monitor library.
hgs
parents: 19
diff changeset
    16
*/
hgs
parents: 19
diff changeset
    17
hgs
parents: 19
diff changeset
    18
// System includes
hgs
parents: 19
diff changeset
    19
hgs
parents: 19
diff changeset
    20
#include <QSharedPointer>
hgs
parents: 19
diff changeset
    21
#include <QScopedPointer>
hgs
parents: 19
diff changeset
    22
hgs
parents: 19
diff changeset
    23
// User includes
hgs
parents: 19
diff changeset
    24
hgs
parents: 19
diff changeset
    25
#include "wlanqtutilsconmonwrapperdisconnect_s60_p.h"
hgs
parents: 19
diff changeset
    26
#include "wlanqtutilsconmonwrapperinfo_s60_p.h"
hgs
parents: 19
diff changeset
    27
#include "wlanqtutilsconmonwrapperscan_s60_p.h"
hgs
parents: 19
diff changeset
    28
#include "wlanqtutilsconmonwrapper.h"
hgs
parents: 19
diff changeset
    29
hgs
parents: 19
diff changeset
    30
/*!
hgs
parents: 19
diff changeset
    31
    \class WlanQtUtilsConMonWrapper
hgs
parents: 19
diff changeset
    32
    \brief Wrapper for Symbian Connection Monitor library.
hgs
parents: 19
diff changeset
    33
hgs
parents: 19
diff changeset
    34
    Provides functionality to scan WLAN networks, to retrieve connection 
hgs
parents: 19
diff changeset
    35
    information, and to disconnect connections.
19
10810c91db26 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    36
*/
10810c91db26 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    37
31
hgs
parents: 19
diff changeset
    38
// External function prototypes
hgs
parents: 19
diff changeset
    39
hgs
parents: 19
diff changeset
    40
// Local constants
hgs
parents: 19
diff changeset
    41
hgs
parents: 19
diff changeset
    42
// ======== LOCAL FUNCTIONS ========
hgs
parents: 19
diff changeset
    43
hgs
parents: 19
diff changeset
    44
// ======== MEMBER FUNCTIONS ========
19
10810c91db26 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    45
31
hgs
parents: 19
diff changeset
    46
/*!
hgs
parents: 19
diff changeset
    47
    Constructor.
hgs
parents: 19
diff changeset
    48
    
hgs
parents: 19
diff changeset
    49
    @param [in] parent Parent object.
hgs
parents: 19
diff changeset
    50
*/
19
10810c91db26 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    51
31
hgs
parents: 19
diff changeset
    52
WlanQtUtilsConMonWrapper::WlanQtUtilsConMonWrapper(QObject *parent) :
hgs
parents: 19
diff changeset
    53
    QObject(parent),
hgs
parents: 19
diff changeset
    54
    d_ptrScan(new WlanQtUtilsConMonWrapperScan(this)),
hgs
parents: 19
diff changeset
    55
    d_ptrInfo(new WlanQtUtilsConMonWrapperInfo(this)),
hgs
parents: 19
diff changeset
    56
    d_ptrDisconnect(new WlanQtUtilsConMonWrapperDisconnect(this))
19
10810c91db26 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    57
{
10810c91db26 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    58
}
10810c91db26 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    59
31
hgs
parents: 19
diff changeset
    60
/*!
hgs
parents: 19
diff changeset
    61
    Destructor.
hgs
parents: 19
diff changeset
    62
*/
hgs
parents: 19
diff changeset
    63
hgs
parents: 19
diff changeset
    64
WlanQtUtilsConMonWrapper::~WlanQtUtilsConMonWrapper()
19
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
31
hgs
parents: 19
diff changeset
    68
/*!
hgs
parents: 19
diff changeset
    69
   Start a WLAN scan.
hgs
parents: 19
diff changeset
    70
*/
hgs
parents: 19
diff changeset
    71
hgs
parents: 19
diff changeset
    72
void WlanQtUtilsConMonWrapper::scanAvailableWlanAPs()
19
10810c91db26 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    73
{
31
hgs
parents: 19
diff changeset
    74
    d_ptrScan->ScanAvailableWlanAPs();
19
10810c91db26 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    75
}
10810c91db26 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    76
31
hgs
parents: 19
diff changeset
    77
/*!
hgs
parents: 19
diff changeset
    78
   Stop a (possibly) ongoing WLAN scan.
hgs
parents: 19
diff changeset
    79
*/
hgs
parents: 19
diff changeset
    80
hgs
parents: 19
diff changeset
    81
void WlanQtUtilsConMonWrapper::stopScan()
19
10810c91db26 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    82
{
31
hgs
parents: 19
diff changeset
    83
    d_ptrScan->StopScan();
19
10810c91db26 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    84
}
10810c91db26 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    85
31
hgs
parents: 19
diff changeset
    86
/*!
hgs
parents: 19
diff changeset
    87
   Return active connection information.
hgs
parents: 19
diff changeset
    88
hgs
parents: 19
diff changeset
    89
   @return Information of active connection, 0 if not found.
hgs
parents: 19
diff changeset
    90
*/ 
hgs
parents: 19
diff changeset
    91
hgs
parents: 19
diff changeset
    92
WlanQtUtilsConnection *WlanQtUtilsConMonWrapper::activeConnection() const
19
10810c91db26 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    93
{
31
hgs
parents: 19
diff changeset
    94
    return d_ptrInfo->ActiveConnection();
19
10810c91db26 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    95
}
10810c91db26 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    96
31
hgs
parents: 19
diff changeset
    97
/*!
hgs
parents: 19
diff changeset
    98
   Returns information of a connection with the given connection ID.
hgs
parents: 19
diff changeset
    99
hgs
parents: 19
diff changeset
   100
   @param [in] connectionId Connection ID.
hgs
parents: 19
diff changeset
   101
hgs
parents: 19
diff changeset
   102
   @return Information of the given connection, 0 if not found.
hgs
parents: 19
diff changeset
   103
*/ 
hgs
parents: 19
diff changeset
   104
hgs
parents: 19
diff changeset
   105
WlanQtUtilsConnection* WlanQtUtilsConMonWrapper::connectionInfo(
hgs
parents: 19
diff changeset
   106
    uint connectionId) const
19
10810c91db26 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   107
{
31
hgs
parents: 19
diff changeset
   108
    return d_ptrInfo->ConnectionInfo(connectionId);
19
10810c91db26 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   109
}
10810c91db26 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   110
31
hgs
parents: 19
diff changeset
   111
/*!
hgs
parents: 19
diff changeset
   112
   Stops given connection regardless of how many applications are using it.
hgs
parents: 19
diff changeset
   113
hgs
parents: 19
diff changeset
   114
   @param [in] iapId IAP ID to disconnect.
hgs
parents: 19
diff changeset
   115
*/ 
hgs
parents: 19
diff changeset
   116
hgs
parents: 19
diff changeset
   117
void WlanQtUtilsConMonWrapper::disconnectIap(int iapId)
19
10810c91db26 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   118
{
31
hgs
parents: 19
diff changeset
   119
   d_ptrDisconnect->DisconnectConnection(iapId);
19
10810c91db26 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   120
}