cmmanager/cppacketdataapplugin/src/cppacketdataapplugin.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 packet data 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 "cppacketdataapplugin.h"
       
    26 #include "cppacketdataapview.h"
       
    27 #include "OstTraceDefinitions.h"
       
    28 #ifdef OST_TRACE_COMPILER_IN_USE
       
    29 #include "cppacketdataappluginTraces.h"
       
    30 #endif
       
    31 
       
    32 /*!
       
    33     \class CpPacketDataApPlugin
       
    34     \brief Implements the packet data bearer AP (access point) Control Panel
       
    35            plugin.
       
    36 */
       
    37 
       
    38 // External function prototypes
       
    39 
       
    40 // Local constants
       
    41 
       
    42 // ======== LOCAL FUNCTIONS ========
       
    43 
       
    44 // ======== MEMBER FUNCTIONS ========
       
    45 
       
    46 /*!
       
    47     Constructor.
       
    48 */
       
    49 CpPacketDataApPlugin::CpPacketDataApPlugin() :
       
    50     mTranslator(new HbTranslator("cpapplugin")),
       
    51     mCmManager(0),
       
    52     mCmConnectionMethod(0)
       
    53 {
       
    54     OstTraceFunctionEntry0(CPPACKETDATAAPPLUGIN_CPPACKETDATAAPPLUGIN_ENTRY);
       
    55  
       
    56     OstTraceFunctionExit0(CPPACKETDATAAPPLUGIN_CPPACKETDATAAPPLUGIN_EXIT);
       
    57 }
       
    58 
       
    59 /*!
       
    60     Destructor.
       
    61 */
       
    62 CpPacketDataApPlugin::~CpPacketDataApPlugin()
       
    63 {
       
    64     OstTraceFunctionEntry0(DUP1_CPPACKETDATAAPPLUGIN_CPPACKETDATAAPPLUGIN_ENTRY);
       
    65     
       
    66     delete mCmConnectionMethod;
       
    67     delete mCmManager;
       
    68     
       
    69     OstTraceFunctionExit0(DUP1_CPPACKETDATAAPPLUGIN_CPPACKETDATAAPPLUGIN_EXIT);
       
    70 }
       
    71 
       
    72 /*!
       
    73     Returns the bearer type handled by the plugin.
       
    74 */
       
    75 uint CpPacketDataApPlugin::bearerType() const
       
    76 {
       
    77     OstTraceFunctionEntry0(CPPACKETDATAAPPLUGIN_BEARERTYPE_ENTRY);
       
    78     
       
    79     OstTraceFunctionExit0(CPPACKETDATAAPPLUGIN_BEARERTYPE_EXIT);
       
    80     return CMManagerShim::BearerTypePacketData;
       
    81 }
       
    82 
       
    83 /*!
       
    84     Creates the packet data AP settings view.
       
    85 */
       
    86 CpBaseSettingView *CpPacketDataApPlugin::createSettingView(
       
    87     uint connectionMethod)
       
    88 {
       
    89     OstTraceFunctionEntry0(CPPACKETDATAAPPLUGIN_CREATESETTINGVIEW_ENTRY);
       
    90     
       
    91     // Find the connection method
       
    92     try {
       
    93         mCmManager = new CmManagerShim();
       
    94         mCmConnectionMethod = mCmManager->connectionMethod(connectionMethod);
       
    95     }
       
    96     catch (const std::exception&) {
       
    97         // Error, don't create settings view, just return
       
    98         OstTrace1(
       
    99             TRACE_ERROR,
       
   100             CPPACKETDATAAPPLUGIN_CREATESETTINGVIEW,
       
   101             "Connection method loading failed;connectionMethod=%u",
       
   102             connectionMethod);
       
   103 
       
   104         OstTraceFunctionExit0(DUP1_CPPACKETDATAAPPLUGIN_CREATESETTINGVIEW_EXIT);
       
   105         return NULL;
       
   106     }
       
   107 
       
   108     // Connection method found, create settings view
       
   109     OstTraceFunctionExit0(CPPACKETDATAAPPLUGIN_CREATESETTINGVIEW_EXIT);
       
   110     return new CpPacketDataApView(mCmConnectionMethod);
       
   111 }
       
   112 
       
   113 Q_EXPORT_PLUGIN2(cppacketdataapplugin, CpPacketDataApPlugin);