natplugins/natpnatfwsdpprovider/src/nspstateinitializing.cpp
changeset 0 1bce908db942
equal deleted inserted replaced
-1:000000000000 0:1bce908db942
       
     1 /*
       
     2 * Copyright (c) 2008 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:  Initializing state implementation
       
    15 *
       
    16 */
       
    17 
       
    18 #include "nspstateinitializing.h"
       
    19 #include "nspevents.h"
       
    20 #include "nspactionset.h"
       
    21 
       
    22 
       
    23 // ======== MEMBER FUNCTIONS ========
       
    24 // ---------------------------------------------------------------------------
       
    25 // CNSPStateInitializing::CNSPStateInitializing
       
    26 // ---------------------------------------------------------------------------
       
    27 //
       
    28 CNSPStateInitializing::CNSPStateInitializing()
       
    29     {
       
    30     }
       
    31 
       
    32 
       
    33 // ---------------------------------------------------------------------------
       
    34 // CNSPStateInitializing::NewL
       
    35 // ---------------------------------------------------------------------------
       
    36 //
       
    37 CNSPStateInitializing* CNSPStateInitializing::NewL()
       
    38     {
       
    39     CNSPStateInitializing* self = CNSPStateInitializing::NewLC();
       
    40     CleanupStack::Pop( self );
       
    41     return self;
       
    42     }
       
    43 
       
    44 
       
    45 // ---------------------------------------------------------------------------
       
    46 // CNSPStateInitializing::NewLC
       
    47 // ---------------------------------------------------------------------------
       
    48 //
       
    49 CNSPStateInitializing* CNSPStateInitializing::NewLC()
       
    50     {
       
    51     CNSPStateInitializing* self = new ( ELeave ) CNSPStateInitializing;
       
    52     CleanupStack::PushL( self );
       
    53     return self;
       
    54     }
       
    55 
       
    56 
       
    57 // ---------------------------------------------------------------------------
       
    58 // CNSPStateInitializing::~CNSPStateInitializing
       
    59 // ---------------------------------------------------------------------------
       
    60 //
       
    61 CNSPStateInitializing::~CNSPStateInitializing()
       
    62     {
       
    63     }
       
    64 
       
    65 
       
    66 // ---------------------------------------------------------------------------
       
    67 // CNSPStateInitializing::DoAcceptL
       
    68 // ---------------------------------------------------------------------------
       
    69 //
       
    70 TBool CNSPStateInitializing::DoAcceptL( TNSPStateMachineEvent& aEvent )
       
    71     {
       
    72     User::LeaveIfError( TNSPStateMachineEvent::ENat == aEvent.Request() ?
       
    73                     KErrNone : KErrArgument );
       
    74     
       
    75     return ETrue;
       
    76     }
       
    77 
       
    78 
       
    79 // ---------------------------------------------------------------------------
       
    80 // CNSPStateInitializing::DoStateEntryL
       
    81 // ---------------------------------------------------------------------------
       
    82 //
       
    83 void CNSPStateInitializing::DoStateEntryL( TNSPStateMachineEvent& /*aEvent*/ )
       
    84     {
       
    85     }
       
    86 
       
    87 
       
    88 // ---------------------------------------------------------------------------
       
    89 // CNSPStateInitializing::DoReverse
       
    90 // ---------------------------------------------------------------------------
       
    91 //
       
    92 void CNSPStateInitializing::DoReverse( TNSPStateMachineEvent& /*aEvent*/ )
       
    93     {
       
    94     }
       
    95 
       
    96 
       
    97 // ---------------------------------------------------------------------------
       
    98 // CNSPStateInitializing::DoApplyL
       
    99 // ---------------------------------------------------------------------------
       
   100 //
       
   101 void CNSPStateInitializing::DoApplyL( TNSPStateMachineEvent& aEvent )
       
   102     {
       
   103     switch( aEvent.Request() )
       
   104         {
       
   105         case TNSPStateMachineEvent::ENat:
       
   106             {
       
   107             ControlMediaL( aEvent );
       
   108             break;
       
   109             }
       
   110         
       
   111         default:
       
   112             {
       
   113             User::Leave( KErrArgument );
       
   114             }
       
   115         }
       
   116     }
       
   117 
       
   118 
       
   119 // ---------------------------------------------------------------------------
       
   120 // CNSPStateInitializing::DoExitL
       
   121 // ---------------------------------------------------------------------------
       
   122 //
       
   123 void CNSPStateInitializing::DoExitL( TNSPStateMachineEvent& aEvent )
       
   124     {
       
   125     switch( aEvent.Request() )
       
   126         {
       
   127         case TNSPStateMachineEvent::ENat:
       
   128             {
       
   129             break;
       
   130             }
       
   131         
       
   132         default:
       
   133             {
       
   134             User::Leave( KErrArgument );
       
   135             }
       
   136         }
       
   137     }
       
   138 
       
   139 
       
   140 // ---------------------------------------------------------------------------
       
   141 // CNSPStateInitializing::ControlMediaL
       
   142 // ---------------------------------------------------------------------------
       
   143 //
       
   144 void CNSPStateInitializing::ControlMediaL( TNSPStateMachineEvent& aEvent ) const
       
   145 	{
       
   146 	TNSPStateMachineMediaEvent& event = MEDIAEVENT( aEvent );
       
   147 	User::LeaveIfError( event.Status() );
       
   148 	
       
   149 	if ( MNATFWConnectivityObserver::ESessionCreated == event.Event() )
       
   150 		{
       
   151 		event.NextState() = KStateIndexIdle;
       
   152 		}
       
   153 	else
       
   154 		{
       
   155 		User::Leave( KErrArgument );
       
   156 		}
       
   157 	}
       
   158 
       
   159 
       
   160 // end of file