wlanutilities/wlansniffer/wlansnifferkeepalive/src/wsfkeepalivecmm.cpp
branchRCL_3
changeset 24 63be7eb3fc78
equal deleted inserted replaced
23:b852595f5cbe 24:63be7eb3fc78
       
     1 /*
       
     2  * Copyright (c) 2010 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:
       
    15  * Connection Method Manager interface implementation.
       
    16  */
       
    17 
       
    18 // System include files
       
    19 
       
    20 #include <nifvar.h>
       
    21 #include <cmmanagerdef.h>
       
    22 #include <cmconnectionmethod.h>
       
    23 
       
    24 // User include files
       
    25 
       
    26 #include "wsfkeepalive.h"
       
    27 #include "wsfkeepalivecmm.h"
       
    28 #include "OstTraceDefinitions.h"
       
    29 #ifdef OST_TRACE_COMPILER_IN_USE
       
    30 #include "wsfkeepalivecmmTraces.h"
       
    31 #endif
       
    32 
       
    33 // External function prototypes
       
    34 
       
    35 // Local constants
       
    36 
       
    37 // ======== LOCAL FUNCTIONS ========
       
    38 
       
    39 // ======== MEMBER FUNCTIONS ========
       
    40 
       
    41 CWsfKeepaliveCmm* CWsfKeepaliveCmm::NewL()
       
    42     {
       
    43     OstTraceFunctionEntry0( CWSFKEEPALIVECMM_NEWL_ENTRY );
       
    44     
       
    45     CWsfKeepaliveCmm* me = new ( ELeave ) CWsfKeepaliveCmm();
       
    46     CleanupStack::PushL( me );
       
    47     me->ConstructL();
       
    48     CleanupStack::Pop( me );
       
    49     
       
    50     OstTraceFunctionExit0( CWSFKEEPALIVECMM_NEWL_EXIT );
       
    51     return me;
       
    52     }
       
    53 
       
    54 CWsfKeepaliveCmm::~CWsfKeepaliveCmm()
       
    55     {
       
    56     OstTraceFunctionEntry0(
       
    57         DUP1_CWSFKEEPALIVECMM_CWSFKEEPALIVECMM_ENTRY );
       
    58 
       
    59     iCmManager.Close();
       
    60     
       
    61     OstTraceFunctionExit0(
       
    62         DUP1_CWSFKEEPALIVECMM_CWSFKEEPALIVECMM_EXIT );
       
    63     }
       
    64 
       
    65 // ---------------------------------------------------------------------------
       
    66 // Default constructor
       
    67 // ---------------------------------------------------------------------------
       
    68 //
       
    69 CWsfKeepaliveCmm::CWsfKeepaliveCmm()
       
    70     {
       
    71     OstTraceFunctionEntry0( CWSFKEEPALIVECMM_CWSFKEEPALIVECMM_ENTRY );
       
    72     OstTraceFunctionExit0( CWSFKEEPALIVECMM_CWSFKEEPALIVECMM_EXIT );
       
    73     }
       
    74 
       
    75 // ---------------------------------------------------------------------------
       
    76 // Leaving constructor
       
    77 // ---------------------------------------------------------------------------
       
    78 //
       
    79 void CWsfKeepaliveCmm::ConstructL()
       
    80     {
       
    81     OstTraceFunctionEntry0( CWSFKEEPALIVECMM_CONSTRUCTL_ENTRY );
       
    82     
       
    83     iCmManager.OpenL();
       
    84     
       
    85     OstTraceFunctionExit0( CWSFKEEPALIVECMM_CONSTRUCTL_EXIT );
       
    86     }
       
    87  
       
    88 // ---------------------------------------------------------
       
    89 // Gets Hotspot metadata information
       
    90 // ---------------------------------------------------------
       
    91 //
       
    92 TBool CWsfKeepaliveCmm::GetHotspotInfoL(TInt32 aIapId)
       
    93     {
       
    94     OstTraceFunctionEntry0( CWSFKEEPALIVECMM_GETHOTSPOTINFO_ENTRY );
       
    95     TBool isHotspotIap = EFalse; 
       
    96 
       
    97     RCmConnectionMethod connectionMethod = iCmManager.ConnectionMethodL(aIapId);
       
    98     
       
    99     TRAPD(err, isHotspotIap = connectionMethod.GetBoolAttributeL( CMManager::ECmMetaHotSpot ));
       
   100     
       
   101     if (err != KErrNone)
       
   102         {
       
   103         isHotspotIap = EFalse;
       
   104         }
       
   105     
       
   106     OstTrace1(
       
   107         TRACE_NORMAL,
       
   108         CWSFKEEPALIVECMM_GETHOTSPOTINFO_HOTSPOT,
       
   109         "CWsfKeepaliveCmm::GetHotspotInfoL isHotspotIap=%d",
       
   110         isHotspotIap );
       
   111     
       
   112     OstTraceFunctionExit0( CWSFKEEPALIVECMM_GETHOTSPOTINFO_EXIT );
       
   113     return isHotspotIap;
       
   114     }
       
   115 
       
   116 // ---------------------------------------------------------
       
   117 // Delete Hotspot IAP
       
   118 // ---------------------------------------------------------
       
   119 //
       
   120 TBool CWsfKeepaliveCmm::DeleteHotspotIapL(TInt32 aIapId)
       
   121     {
       
   122     OstTraceFunctionEntry0( CWSFKEEPALIVECMM_DELETEHOTSPOTIAP_ENTRY );
       
   123     TBool ret = EFalse;
       
   124     
       
   125     RCmConnectionMethod connectionMethod = iCmManager.ConnectionMethodL(aIapId);
       
   126     TRAPD(err, ret = connectionMethod.DeleteL());
       
   127     
       
   128     if (err != KErrNone)
       
   129             {
       
   130             ret = EFalse;
       
   131             }
       
   132     
       
   133     OstTraceFunctionExit0( CWSFKEEPALIVECMM_DELETEHOTSPOTIAP_EXIT );
       
   134     return ret;
       
   135     }