telephonyprotocols/umtsgprsscpr/spudfsm/src/tpdpstateinitialised.cpp
changeset 64 b34bb05ac869
parent 56 ab72d5c1d770
equal deleted inserted replaced
56:ab72d5c1d770 64:b34bb05ac869
     1 // Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies).
       
     2 // All rights reserved.
       
     3 // This component and the accompanying materials are made available
       
     4 // under the terms of "Eclipse Public License v1.0"
       
     5 // which accompanies this distribution, and is available
       
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     7 //
       
     8 // Initial Contributors:
       
     9 // Nokia Corporation - initial contribution.
       
    10 //
       
    11 // Contributors:
       
    12 //
       
    13 // Description:
       
    14 // Initialised state
       
    15 // 
       
    16 //
       
    17 
       
    18 /**
       
    19  @file 
       
    20  @internalComponent
       
    21 */
       
    22  
       
    23 #include <networking/umtsnifcontrolif.h>
       
    24 #include "tpdpstates.h"
       
    25 #include "spudfsmdebuglogger.h"
       
    26 #include "pdpfsmnmspace.h"
       
    27 #include "cpdpfsm.h"
       
    28 #include "cpdpfsmfactory.h"
       
    29 #include "eteldrivernmspace.h"
       
    30 
       
    31 TInt TPdpStateInitialised::Input (CPdpFsm& aFsm, const TInt aOperation, const TInt aErrorCode)
       
    32 {
       
    33 	SPUDFSMVERBOSE_FNLOG("TPdpStateInitialised::Input()");
       
    34 	SPUDFSMVERBOSE_LOG2(_L("aOperation : %S(%d)"), LogOperation(aFsm, aOperation), aOperation);
       
    35 
       
    36 	switch (aOperation)
       
    37 	{
       
    38 	case SpudMan::ECreatePrimaryPDPContext:
       
    39 		aFsm.iContextType = CPdpFsm::EPrimary;
       
    40 
       
    41 		// have to ensure EOpenPhone is called the first time a primary context is created
       
    42 		if (iPdpFsmFactory->iEtelOpened == EFalse)
       
    43 		{
       
    44 			aFsm.ChangeStateToOpeningPhone();
       
    45 			EtelDriverInput(aFsm, EtelDriver::EOpenPhone);
       
    46 		}
       
    47 		else // just create the primary
       
    48 		{
       
    49 			aFsm.ChangeStateToCreatingPrimary();
       
    50 			EtelDriverInput (aFsm, EtelDriver::ECreate1ryPdpContext);
       
    51 		}
       
    52 	
       
    53 		return KErrNone;
       
    54 	case SpudMan::ECreateSecondaryPDPContext:
       
    55 		aFsm.ChangeStateToCreatingSecondary();
       
    56 
       
    57 		aFsm.iContextType = CPdpFsm::ESecondary;
       
    58 
       
    59 		EtelDriverInput (aFsm, EtelDriver::ECreate2ryPdpContext);
       
    60 	
       
    61 		return KErrNone;
       
    62 		
       
    63 	// these stop the default actions which aren't of value in the Initialised state, although we 
       
    64 	// do not expect to see these here.
       
    65 	case PdpFsm::EContextDeleted:
       
    66 		return KErrNone;
       
    67 	case PdpFsm::EContextStatusChangeNetwork:
       
    68 		if (aFsm.iContextStatus == RPacketContext::EStatusDeleted)
       
    69 		{
       
    70 			return KErrNone;
       
    71 		}
       
    72 		break;
       
    73 	}
       
    74 
       
    75 	// default error handling
       
    76 	return TPdpState::Input(aFsm, aOperation, aErrorCode);
       
    77 
       
    78 }
       
    79 
       
    80