convergedconnectionhandler/cchserver/src/cchsubserviceinfo.cpp
changeset 0 a4daefaec16c
child 2 7b872347d83b
equal deleted inserted replaced
-1:000000000000 0:a4daefaec16c
       
     1 /*
       
     2 * Copyright (c) 2007 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:  CCCHSubserviceInfo implementation
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 // INCLUDE FILES
       
    20 #include "cchsubserviceinfo.h"
       
    21 #include "cchserverbase.h"
       
    22 #include "cchrequeststorage.h"
       
    23 #include "cchpluginhandler.h"
       
    24 #include "cchlogger.h"
       
    25 
       
    26 // EXTERNAL DATA STRUCTURES
       
    27 // None
       
    28 
       
    29 // EXTERNAL FUNCTION PROTOTYPES
       
    30 // None
       
    31 
       
    32 // CONSTANTS
       
    33 // None
       
    34 
       
    35 // MACROS
       
    36 // None
       
    37 
       
    38 // LOCAL CONSTANTS AND MACROS
       
    39 // None
       
    40 
       
    41 // MODULE DATA STRUCTURES
       
    42 // None
       
    43 
       
    44 // LOCAL FUNCTION PROTOTYPES
       
    45 // None
       
    46 
       
    47 // FORWARD DECLARATIONS
       
    48 // None
       
    49 
       
    50 // ============================= LOCAL FUNCTIONS =============================
       
    51 
       
    52 // ============================ MEMBER FUNCTIONS =============================
       
    53 
       
    54 // ---------------------------------------------------------------------------
       
    55 // CCCHSubserviceInfo::CCCHSubserviceInfo
       
    56 // C++ default constructor can NOT contain any code, that might leave.
       
    57 // ---------------------------------------------------------------------------
       
    58 //
       
    59 CCCHSubserviceInfo::CCCHSubserviceInfo( 
       
    60     TUint aServiceId, 
       
    61     CCCHServerBase& aServer ):
       
    62     iServiceId( aServiceId ),
       
    63     iServer( aServer ),    
       
    64     iEnableAtStartUp( EFalse )
       
    65     {
       
    66     // No implementation required
       
    67     }
       
    68 
       
    69 // ---------------------------------------------------------------------------
       
    70 // CCCHSubserviceInfo::NewL
       
    71 // Two-phased constructor.
       
    72 // ---------------------------------------------------------------------------
       
    73 //
       
    74 CCCHSubserviceInfo* CCCHSubserviceInfo::NewL( 
       
    75     TUint aServiceId, 
       
    76     CCCHServerBase& aServer )
       
    77     {
       
    78     CCCHSubserviceInfo* self = CCCHSubserviceInfo::NewLC( aServiceId, aServer );
       
    79     CleanupStack::Pop( self );
       
    80     return self;
       
    81     }
       
    82 
       
    83 // ---------------------------------------------------------------------------
       
    84 // CCCHSubserviceInfo::NewLC
       
    85 // Two-phased constructor.
       
    86 // ---------------------------------------------------------------------------
       
    87 //
       
    88 CCCHSubserviceInfo* CCCHSubserviceInfo::NewLC( 
       
    89     TUint aServiceId, 
       
    90     CCCHServerBase& aServer )
       
    91     {
       
    92     CCCHSubserviceInfo* self = 
       
    93         new (ELeave) CCCHSubserviceInfo( aServiceId, aServer );
       
    94     CleanupStack::PushL( self );
       
    95     return self;
       
    96     }
       
    97 
       
    98 // Destructor
       
    99 CCCHSubserviceInfo::~CCCHSubserviceInfo()
       
   100     {
       
   101     }
       
   102 
       
   103 
       
   104 // ---------------------------------------------------------------------------
       
   105 // CCCHSubserviceInfo::SetSubserviceId
       
   106 // (other items were commented in a header).
       
   107 // ---------------------------------------------------------------------------
       
   108 //
       
   109 void CCCHSubserviceInfo::SetSubserviceId( const TUint aSubserviceId )
       
   110     {
       
   111     iSubserviceId = aSubserviceId;
       
   112     }
       
   113 
       
   114 // ---------------------------------------------------------------------------
       
   115 // CCCHSubserviceInfo::SetPluginUid
       
   116 // (other items were commented in a header).
       
   117 // ---------------------------------------------------------------------------
       
   118 //
       
   119 void CCCHSubserviceInfo::SetPluginUid( const TUid aPluginUid )
       
   120     {
       
   121     CCHLOGSTRING2( "CCCHSubserviceInfo::SetPluginUid aPluginUid = 0x%X", 
       
   122         aPluginUid );
       
   123     iPluginUid = aPluginUid;    
       
   124     }
       
   125 
       
   126 // ---------------------------------------------------------------------------
       
   127 // CCCHSubserviceInfo::SetPluginUid
       
   128 // (other items were commented in a header).
       
   129 // ---------------------------------------------------------------------------
       
   130 //
       
   131 TUid CCCHSubserviceInfo::GetPluginUid() const
       
   132     {
       
   133     return iPluginUid;
       
   134     }
       
   135 
       
   136 // ---------------------------------------------------------------------------
       
   137 // CCCHSubserviceInfo::SetType
       
   138 // (other items were commented in a header).
       
   139 // ---------------------------------------------------------------------------
       
   140 //
       
   141 void CCCHSubserviceInfo::SetType( const TCCHSubserviceType aType )
       
   142     {
       
   143     iType = aType;
       
   144     }
       
   145 
       
   146 // ---------------------------------------------------------------------------
       
   147 // CCCHSubserviceInfo::GetType
       
   148 // (other items were commented in a header).
       
   149 // ---------------------------------------------------------------------------
       
   150 //
       
   151 TCCHSubserviceType CCCHSubserviceInfo::Type()
       
   152     {
       
   153     GetServiceNetworkInfo();
       
   154     return iType;
       
   155     }
       
   156     
       
   157 // ---------------------------------------------------------------------------
       
   158 // CCCHSubserviceInfo::SetState
       
   159 // (other items were commented in a header).
       
   160 // ---------------------------------------------------------------------------
       
   161 //
       
   162 void CCCHSubserviceInfo::SetState( const TCCHSubserviceState aState )
       
   163     {
       
   164     iState = aState;
       
   165     }
       
   166 
       
   167 // ---------------------------------------------------------------------------
       
   168 // CCCHSubserviceInfo::SetError
       
   169 // (other items were commented in a header).
       
   170 // ---------------------------------------------------------------------------
       
   171 //
       
   172 void CCCHSubserviceInfo::SetError( const TInt aError )
       
   173     {
       
   174     iError = aError;
       
   175     }
       
   176 
       
   177 // ---------------------------------------------------------------------------
       
   178 // CCCHSubserviceInfo::SetIapId
       
   179 // (other items were commented in a header).
       
   180 // ---------------------------------------------------------------------------
       
   181 //
       
   182 void CCCHSubserviceInfo::SetIapId( const TUint32 aIapId )
       
   183     {
       
   184     iIapId = aIapId;
       
   185     }
       
   186 
       
   187 // ---------------------------------------------------------------------------
       
   188 // CCCHSubserviceInfo::SetSNAPId
       
   189 // (other items were commented in a header).
       
   190 // ---------------------------------------------------------------------------
       
   191 //
       
   192 void CCCHSubserviceInfo::SetSNAPId( const TUint32 aSNAPid )
       
   193     {
       
   194     iSNAPId = aSNAPid;
       
   195     }
       
   196 
       
   197 // ---------------------------------------------------------------------------
       
   198 // CCCHSubserviceInfo::Update
       
   199 // (other items were commented in a header).
       
   200 // ---------------------------------------------------------------------------
       
   201 //
       
   202 void CCCHSubserviceInfo::Update()
       
   203     {
       
   204     CCHLOGSTRING( "CCCHSubserviceInfo::Update: IN" );
       
   205 
       
   206     // Read state from plugin
       
   207     GetServiceNetworkInfo();
       
   208     
       
   209     StatusChanged();
       
   210         
       
   211     CCHLOGSTRING( "CCCHSubserviceInfo::Update: OUT" );
       
   212     }
       
   213 
       
   214 // ---------------------------------------------------------------------------
       
   215 // CCCHSubserviceInfo::IsEnabled
       
   216 // (other items were commented in a header).
       
   217 // ---------------------------------------------------------------------------
       
   218 //
       
   219 TBool CCCHSubserviceInfo::IsEnabled() const
       
   220     {
       
   221     return ( iState != ECCHUninitialized && iState != ECCHDisabled );
       
   222     }
       
   223 
       
   224 // ---------------------------------------------------------------------------
       
   225 // CCCHSubserviceInfo::StatusChangedL
       
   226 // (other items were commented in a header).
       
   227 // ---------------------------------------------------------------------------
       
   228 //    
       
   229 void CCCHSubserviceInfo::StatusChanged()
       
   230     {
       
   231     CCHLOGSTRING( "CCCHSubserviceInfo::StatusChangedL: IN" );
       
   232     CCHLOGSTRING2( "CCCHSubserviceInfo::StatusChangedL: iServiceId %d", 
       
   233         iServiceId );
       
   234     CCHLOGSTRING2( "CCCHSubserviceInfo::StatusChangedL: iType %d", 
       
   235         iType );
       
   236     CCHLOGSTRING2( "CCCHSubserviceInfo::StatusChangedL: iState %d", 
       
   237         iState );
       
   238     CCHLOGSTRING2( "CCCHSubserviceInfo::StatusChangedL: iError %d", 
       
   239         iError );
       
   240         
       
   241     TServiceStatus serviceStatus;
       
   242     serviceStatus.iConnectionInfo.iServiceSelection.iServiceId = iServiceId;
       
   243     serviceStatus.iConnectionInfo.iServiceSelection.iType      = iType;
       
   244     serviceStatus.iConnectionInfo.iIapId                       = iIapId;
       
   245     serviceStatus.iConnectionInfo.iSNAPId                      = iSNAPId; 
       
   246     serviceStatus.iConnectionInfo.iSNAPLocked                  = iSNAPLocked; 
       
   247     serviceStatus.iState                                       = iState;
       
   248     serviceStatus.iError                                       = iError;
       
   249     
       
   250     // Send notify to clients
       
   251     iServer.RequestStorage().NotifyServiceStatesChange( serviceStatus );
       
   252     CCHLOGSTRING( "CCCHSubserviceInfo::StatusChangedL: OUT" );
       
   253     }
       
   254 
       
   255 
       
   256 // ---------------------------------------------------------------------------
       
   257 // CCCHSubserviceInfo::GetServiceNetworkInfo
       
   258 // ---------------------------------------------------------------------------
       
   259 //   
       
   260 void CCCHSubserviceInfo::GetServiceNetworkInfo( )
       
   261     {
       
   262     iServer.PluginHandler().GetServiceNetworkInfo( iServiceId, iPluginUid,
       
   263             iType, iSNAPId, iIapId, iSNAPLocked, iPasswordSet );
       
   264     }
       
   265 
       
   266 
       
   267 // ---------------------------------------------------------------------------
       
   268 // CCCHSubserviceInfo::FillSubserviceInfo
       
   269 // (other items were commented in a header).
       
   270 // ---------------------------------------------------------------------------
       
   271 //    
       
   272 void CCCHSubserviceInfo::FillSubserviceInfo( TCCHSubservice& aSubservice )
       
   273     {
       
   274     CCHLOGSTRING( "CCCHSubserviceInfo::FillSubserviceInfo: IN" );
       
   275     GetServiceNetworkInfo();
       
   276 
       
   277     aSubservice.iConnectionInfo.iServiceSelection.iServiceId    = iServiceId;
       
   278     aSubservice.iConnectionInfo.iServiceSelection.iType         = iType;
       
   279     aSubservice.iConnectionInfo.iIapId                          = iIapId;
       
   280     aSubservice.iConnectionInfo.iSNAPId                         = iSNAPId;
       
   281     aSubservice.iConnectionInfo.iSNAPLocked                     = iSNAPLocked;
       
   282     aSubservice.iSubserviceId                                   = iSubserviceId;
       
   283     aSubservice.iState                                          = iState;
       
   284     aSubservice.iError                                          = iError;
       
   285     CCHLOGSTRING( "CCCHSubserviceInfo::FillSubserviceInfo: OUT" );
       
   286     }
       
   287 
       
   288 // ---------------------------------------------------------------------------
       
   289 // CCCHSubserviceInfo::GetState
       
   290 // (other items were commented in a header).
       
   291 // ---------------------------------------------------------------------------
       
   292 //    
       
   293 TCCHSubserviceState CCCHSubserviceInfo::GetState()
       
   294     {
       
   295     CCHLOGSTRING( "CCCHSubserviceInfo::GetState: IN" );
       
   296     iServer.PluginHandler().GetServiceState( iServiceId, iPluginUid, 
       
   297             iType, iState, iError );
       
   298     return iState;
       
   299     }
       
   300 
       
   301 // ---------------------------------------------------------------------------
       
   302 // CCCHSubserviceInfo::GetError
       
   303 // (other items were commented in a header).
       
   304 // ---------------------------------------------------------------------------
       
   305 //    
       
   306 TInt CCCHSubserviceInfo::GetError()
       
   307     {
       
   308     CCHLOGSTRING( "CCCHSubserviceInfo::GetError: IN" );
       
   309     iServer.PluginHandler().GetServiceState( iServiceId, iPluginUid, 
       
   310             iType, iState, iError );
       
   311     return iError;
       
   312     }
       
   313     
       
   314 // ---------------------------------------------------------------------------
       
   315 // CCCHSubserviceInfo::SetStartupFlag
       
   316 // (other items were commented in a header).
       
   317 // ---------------------------------------------------------------------------
       
   318 // 
       
   319 void CCCHSubserviceInfo::SetStartupFlag( TBool aLoadAtStartUp )
       
   320     {
       
   321     iEnableAtStartUp = aLoadAtStartUp;
       
   322     }
       
   323     
       
   324 // ---------------------------------------------------------------------------
       
   325 // CCCHSubserviceInfo::GetStartUpFlag
       
   326 // (other items were commented in a header).
       
   327 // ---------------------------------------------------------------------------
       
   328 //     
       
   329 TBool CCCHSubserviceInfo::GetStartUpFlag() const
       
   330     {
       
   331     return iEnableAtStartUp;
       
   332     }
       
   333     
       
   334 // ========================== OTHER EXPORTED FUNCTIONS =======================
       
   335 
       
   336 //  End of File