cmmanager/cpwlanapplugin/src/cpwlanapplugin.cpp
branchRCL_3
changeset 58 83ca720e2b9a
parent 57 05bc53fe583b
child 62 bb1f80fb7db2
equal deleted inserted replaced
57:05bc53fe583b 58:83ca720e2b9a
     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 * Control Panel WLAN AP plugin implementation.
       
    16 *
       
    17 */
       
    18 
       
    19 // System includes
       
    20 #include <HbTranslator>
       
    21 #include <cmmanager_shim.h>
       
    22 #include <cmconnectionmethod_shim.h>
       
    23 
       
    24 // User includes
       
    25 #include "cpwlanapplugin.h"
       
    26 #include "cpwlanapview.h"
       
    27 #include "OstTraceDefinitions.h"
       
    28 #ifdef OST_TRACE_COMPILER_IN_USE
       
    29 #include "cpwlanappluginTraces.h"
       
    30 #endif
       
    31 
       
    32 /*!
       
    33     \class CpWlanApPlugin
       
    34     \brief Implements the WLAN bearer AP (access point) Control Panel plugin.
       
    35 */
       
    36 
       
    37 // External function prototypes
       
    38 
       
    39 // Local constants
       
    40 
       
    41 // ======== LOCAL FUNCTIONS ========
       
    42 
       
    43 // ======== MEMBER FUNCTIONS ========
       
    44 
       
    45 /*!
       
    46     Constructor.
       
    47 */
       
    48 CpWlanApPlugin::CpWlanApPlugin() :
       
    49     mTranslator(new HbTranslator("cpapplugin")),
       
    50     mCmManager(0),
       
    51     mCmConnectionMethod(0)
       
    52 {
       
    53     OstTraceFunctionEntry0(CPWLANAPPLUGIN_CPWLANAPPLUGIN_ENTRY);
       
    54 
       
    55     OstTraceFunctionExit0(CPWLANAPPLUGIN_CPWLANAPPLUGIN_EXIT);
       
    56 }
       
    57 
       
    58 /*!
       
    59     Destructor.
       
    60 */
       
    61 CpWlanApPlugin::~CpWlanApPlugin()
       
    62 {
       
    63     OstTraceFunctionEntry0(DUP1_CPWLANAPPLUGIN_CPWLANAPPLUGIN_ENTRY);
       
    64     
       
    65     delete mCmConnectionMethod;
       
    66     delete mCmManager;
       
    67 
       
    68     OstTraceFunctionExit0(DUP1_CPWLANAPPLUGIN_CPWLANAPPLUGIN_EXIT);
       
    69 }
       
    70 
       
    71 /*!
       
    72     Returns the bearer type handled by the plugin.
       
    73 */
       
    74 uint CpWlanApPlugin::bearerType() const
       
    75 {
       
    76     OstTraceFunctionEntry0(CPWLANAPPLUGIN_BEARERTYPE_ENTRY);
       
    77     
       
    78     OstTraceFunctionExit0(CPWLANAPPLUGIN_BEARERTYPE_EXIT);
       
    79     return CMManagerShim::BearerTypeWlan;
       
    80 }
       
    81 
       
    82 /*!
       
    83     Creates the WLAN AP settings view.
       
    84 */
       
    85 CpBaseSettingView *CpWlanApPlugin::createSettingView(uint connectionMethod)
       
    86 {
       
    87     OstTraceFunctionEntry0(CPWLANAPPLUGIN_CREATESETTINGVIEW_ENTRY);
       
    88 
       
    89     // Find the connection method
       
    90     try {
       
    91         mCmManager = new CmManagerShim();
       
    92         mCmConnectionMethod = mCmManager->connectionMethod(connectionMethod);
       
    93     }
       
    94     catch (const std::exception&) {
       
    95         // Error, don't create settings view, just return
       
    96         OstTrace1(
       
    97             TRACE_ERROR,
       
    98             CPWLANAPPLUGIN_CREATESETTINGVIEW,
       
    99             "Connection method loading failed;connectionMethod=%u",
       
   100             connectionMethod);
       
   101 
       
   102         OstTraceFunctionExit0(DUP1_CPWLANAPPLUGIN_CREATESETTINGVIEW_EXIT);
       
   103         return NULL;
       
   104     }
       
   105     
       
   106     // Connection method found, create settings view
       
   107     OstTraceFunctionExit0(CPWLANAPPLUGIN_CREATESETTINGVIEW_EXIT);
       
   108     return new CpWlanApView(mCmConnectionMethod);
       
   109 }
       
   110 
       
   111 Q_EXPORT_PLUGIN2(cpwlanapplugin, CpWlanApPlugin);