convergedconnectionhandler/cchserver/src/cchsubserviceinfo.cpp
branchRCL_3
changeset 21 f742655b05bf
parent 20 65a3ef1d5bd0
child 22 d38647835c2e
equal deleted inserted replaced
20:65a3ef1d5bd0 21:f742655b05bf
     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 	return iType;
       
   154 	}
       
   155     
       
   156 // ---------------------------------------------------------------------------
       
   157 // CCCHSubserviceInfo::SetState
       
   158 // (other items were commented in a header).
       
   159 // ---------------------------------------------------------------------------
       
   160 //
       
   161 void CCCHSubserviceInfo::SetState( const TCCHSubserviceState aState )
       
   162     {
       
   163     CCHLOGSTRING2( "CCCHSubserviceInfo::SetState: iPreviousState = %d", 
       
   164         iState );
       
   165     CCHLOGSTRING2( "CCCHSubserviceInfo::SetState: new state = %d", 
       
   166         aState );
       
   167     CCHLOGSTRING2( "CCCHSubserviceInfo::SetState: new state = %d", 
       
   168         Type() );
       
   169     iPreviousState = iState;
       
   170     iState = aState;
       
   171     }
       
   172 
       
   173 // ---------------------------------------------------------------------------
       
   174 // CCCHSubserviceInfo::SetError
       
   175 // (other items were commented in a header).
       
   176 // ---------------------------------------------------------------------------
       
   177 //
       
   178 void CCCHSubserviceInfo::SetError( const TInt aError )
       
   179     {
       
   180     iError = aError;
       
   181     }
       
   182 
       
   183 // ---------------------------------------------------------------------------
       
   184 // CCCHSubserviceInfo::SetIapId
       
   185 // (other items were commented in a header).
       
   186 // ---------------------------------------------------------------------------
       
   187 //
       
   188 void CCCHSubserviceInfo::SetIapId( const TUint32 aIapId )
       
   189     {
       
   190     iIapId = aIapId;
       
   191     }
       
   192 
       
   193 // ---------------------------------------------------------------------------
       
   194 // CCCHSubserviceInfo::SetSNAPId
       
   195 // (other items were commented in a header).
       
   196 // ---------------------------------------------------------------------------
       
   197 //
       
   198 void CCCHSubserviceInfo::SetSNAPId( const TUint32 aSNAPid )
       
   199     {
       
   200     iSNAPId = aSNAPid;
       
   201     }
       
   202 
       
   203 // ---------------------------------------------------------------------------
       
   204 // CCCHSubserviceInfo::Update
       
   205 // (other items were commented in a header).
       
   206 // ---------------------------------------------------------------------------
       
   207 //
       
   208 void CCCHSubserviceInfo::Update()
       
   209     {
       
   210     CCHLOGSTRING( "CCCHSubserviceInfo::Update: IN" );
       
   211 
       
   212     // Read state from plugin
       
   213     GetServiceNetworkInfo();
       
   214     
       
   215     StatusChanged();
       
   216         
       
   217     CCHLOGSTRING( "CCCHSubserviceInfo::Update: OUT" );
       
   218     }
       
   219 
       
   220 // ---------------------------------------------------------------------------
       
   221 // CCCHSubserviceInfo::IsEnabled
       
   222 // (other items were commented in a header).
       
   223 // ---------------------------------------------------------------------------
       
   224 //
       
   225 TBool CCCHSubserviceInfo::IsEnabled() const
       
   226     {
       
   227     return ( iState != ECCHUninitialized && iState != ECCHDisabled );
       
   228     }
       
   229 
       
   230 // ---------------------------------------------------------------------------
       
   231 // CCCHSubserviceInfo::StatusChangedL
       
   232 // (other items were commented in a header).
       
   233 // ---------------------------------------------------------------------------
       
   234 //    
       
   235 void CCCHSubserviceInfo::StatusChanged()
       
   236     {
       
   237     CCHLOGSTRING( "CCCHSubserviceInfo::StatusChangedL: IN" );
       
   238     CCHLOGSTRING2( "CCCHSubserviceInfo::StatusChangedL: iServiceId %d", 
       
   239         iServiceId );
       
   240     CCHLOGSTRING2( "CCCHSubserviceInfo::StatusChangedL: iType %d", 
       
   241         iType );
       
   242     CCHLOGSTRING2( "CCCHSubserviceInfo::StatusChangedL: iState %d", 
       
   243         iState );
       
   244     CCHLOGSTRING2( "CCCHSubserviceInfo::StatusChangedL: iPreviousState %d", 
       
   245         iPreviousState );
       
   246     CCHLOGSTRING2( "CCCHSubserviceInfo::StatusChangedL: iError %d", 
       
   247         iError );
       
   248     
       
   249     if( iPreviousState == ECCHUninitialized && iState == ECCHDisabled )
       
   250         {
       
   251         CCHLOGSTRING( "CCCHSubserviceInfo::StatusChangedL: Status not notified" );
       
   252         }
       
   253     else 
       
   254         {
       
   255         if ( iPreviousState == ECCHDisconnecting && iState == ECCHDisabled )
       
   256             {
       
   257             iPreviousState = ECCHUninitialized;
       
   258             }
       
   259         CCHLOGSTRING( "CCCHSubserviceInfo::StatusChangedL: Notify new status" );
       
   260         TServiceStatus serviceStatus;
       
   261         serviceStatus.iConnectionInfo.iServiceSelection.iServiceId = iServiceId;
       
   262         serviceStatus.iConnectionInfo.iServiceSelection.iType      = iType;
       
   263         serviceStatus.iConnectionInfo.iIapId                       = iIapId;
       
   264         serviceStatus.iConnectionInfo.iSNAPId                      = iSNAPId; 
       
   265         serviceStatus.iConnectionInfo.iSNAPLocked                  = iSNAPLocked; 
       
   266         serviceStatus.iState                                       = iState;
       
   267         serviceStatus.iError                                       = iError;
       
   268         
       
   269         // Send notify to clients
       
   270         iServer.RequestStorage().NotifyServiceStatesChange( serviceStatus );
       
   271         }
       
   272     CCHLOGSTRING( "CCCHSubserviceInfo::StatusChangedL: OUT" );
       
   273     }
       
   274 
       
   275 
       
   276 // ---------------------------------------------------------------------------
       
   277 // CCCHSubserviceInfo::GetServiceNetworkInfo
       
   278 // ---------------------------------------------------------------------------
       
   279 //   
       
   280 void CCCHSubserviceInfo::GetServiceNetworkInfo( )
       
   281     {
       
   282     iServer.PluginHandler().GetServiceNetworkInfo( iServiceId, iPluginUid,
       
   283             iType, iSNAPId, iIapId, iSNAPLocked, iPasswordSet );
       
   284     }
       
   285 
       
   286 
       
   287 // ---------------------------------------------------------------------------
       
   288 // CCCHSubserviceInfo::FillSubserviceInfo
       
   289 // (other items were commented in a header).
       
   290 // ---------------------------------------------------------------------------
       
   291 //    
       
   292 void CCCHSubserviceInfo::FillSubserviceInfo( TCCHSubservice& aSubservice )
       
   293     {
       
   294     CCHLOGSTRING( "CCCHSubserviceInfo::FillSubserviceInfo: IN" );
       
   295     GetServiceNetworkInfo();
       
   296 
       
   297     aSubservice.iConnectionInfo.iServiceSelection.iServiceId    = iServiceId;
       
   298     aSubservice.iConnectionInfo.iServiceSelection.iType         = iType;
       
   299     aSubservice.iConnectionInfo.iIapId                          = iIapId;
       
   300     aSubservice.iConnectionInfo.iSNAPId                         = iSNAPId;
       
   301     aSubservice.iConnectionInfo.iSNAPLocked                     = iSNAPLocked;
       
   302     aSubservice.iSubserviceId                                   = iSubserviceId;
       
   303     aSubservice.iState                                          = iState;
       
   304     aSubservice.iError                                          = iError;
       
   305     CCHLOGSTRING( "CCCHSubserviceInfo::FillSubserviceInfo: OUT" );
       
   306     }
       
   307 
       
   308 // ---------------------------------------------------------------------------
       
   309 // CCCHSubserviceInfo::GetState
       
   310 // (other items were commented in a header).
       
   311 // ---------------------------------------------------------------------------
       
   312 //    
       
   313 TCCHSubserviceState CCCHSubserviceInfo::GetState()
       
   314     {
       
   315     CCHLOGSTRING( "CCCHSubserviceInfo::GetState: IN" );
       
   316     iServer.PluginHandler().GetServiceState( iServiceId, iPluginUid, 
       
   317             iType, iState, iError );
       
   318     return iState;
       
   319     }
       
   320 
       
   321 // ---------------------------------------------------------------------------
       
   322 // CCCHSubserviceInfo::GetError
       
   323 // (other items were commented in a header).
       
   324 // ---------------------------------------------------------------------------
       
   325 //    
       
   326 TInt CCCHSubserviceInfo::GetError()
       
   327     {
       
   328     CCHLOGSTRING( "CCCHSubserviceInfo::GetError: IN" );
       
   329     iServer.PluginHandler().GetServiceState( iServiceId, iPluginUid, 
       
   330             iType, iState, iError );
       
   331     return iError;
       
   332     }
       
   333     
       
   334 // ---------------------------------------------------------------------------
       
   335 // CCCHSubserviceInfo::SetStartupFlag
       
   336 // (other items were commented in a header).
       
   337 // ---------------------------------------------------------------------------
       
   338 // 
       
   339 void CCCHSubserviceInfo::SetStartupFlag( TBool aLoadAtStartUp )
       
   340     {
       
   341     iEnableAtStartUp = aLoadAtStartUp;
       
   342     }
       
   343     
       
   344 // ---------------------------------------------------------------------------
       
   345 // CCCHSubserviceInfo::GetStartUpFlag
       
   346 // (other items were commented in a header).
       
   347 // ---------------------------------------------------------------------------
       
   348 //     
       
   349 TBool CCCHSubserviceInfo::GetStartUpFlag() const
       
   350     {
       
   351     return iEnableAtStartUp;
       
   352     }
       
   353     
       
   354 // ========================== OTHER EXPORTED FUNCTIONS =======================
       
   355 
       
   356 //  End of File