telephonyprotocols/umtsgprsscpr/spudtel/src/cpdpconfigchangenotifier.cpp
changeset 68 d0d9cc530d21
parent 62 8ef833fbf5aa
child 75 f45cd1ad4667
equal deleted inserted replaced
62:8ef833fbf5aa 68:d0d9cc530d21
     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 // PDP config change notifier
       
    15 // 
       
    16 //
       
    17 
       
    18 /**
       
    19  @file 
       
    20  @internalComponent
       
    21 */
       
    22 
       
    23 #include <e32base.h>
       
    24 #include <pcktcs.h>
       
    25 
       
    26 #include "cpdpconfigchangenotifier.h"
       
    27 #include "PDPFSM.h"
       
    28 #include "spudteldebuglogger.h"
       
    29 #include "pdpfsmnmspace.h"
       
    30 
       
    31 
       
    32 /**
       
    33 @param aId - pdp context id
       
    34 @param aPacketContext - reference to etel packet context
       
    35 @param aPdpFsmInterface - reference to pdp fsm interface
       
    36 */
       
    37 CPdpConfigChangeNotifier::CPdpConfigChangeNotifier(TContextId aId,
       
    38 										RPacketContext& aPacketContext,
       
    39 										CPdpFsmInterface& aPdpFsmInterface)
       
    40 : CEtelDriverNotifier(aPdpFsmInterface),
       
    41   iId(aId),
       
    42   iPacketContext(aPacketContext),
       
    43   iConfigGPRS(),
       
    44   iConfigGPRSPckg(iConfigGPRS)
       
    45 	{
       
    46 	}
       
    47 
       
    48 CPdpConfigChangeNotifier::~CPdpConfigChangeNotifier()
       
    49 	{
       
    50 	Cancel();
       
    51 	}
       
    52 
       
    53 /** initiate notification */
       
    54 void CPdpConfigChangeNotifier::Start()
       
    55 	{
       
    56 	if (!IsActive())
       
    57 		{ 
       
    58 		iPacketContext.NotifyConfigChanged(iStatus, iConfigGPRSPckg); 
       
    59 		SetActive();
       
    60 		}
       
    61 	}
       
    62 
       
    63 /** stops notification */	
       
    64 void CPdpConfigChangeNotifier::DoCancel()
       
    65 	{
       
    66 	if(IsActive())
       
    67 		{ 
       
    68 		SPUDTELVERBOSE_INFO_LOG(
       
    69 			_L("CPdpConfigChangeNotifier::DoCancel EPacketContextNotifyConfigChanged"));
       
    70 		iPacketContext.CancelAsyncRequest(EPacketContextNotifyConfigChanged); 
       
    71 		}
       
    72 	}
       
    73 
       
    74 /** notifies pdp fsm 
       
    75 
       
    76 @param aStatus - request status
       
    77 */
       
    78 void CPdpConfigChangeNotifier::Notify(const TRequestStatus& aStatus)
       
    79 	{
       
    80 	if(aStatus == KErrNone)
       
    81 		{
       
    82 		SPUDTELVERBOSE_INFO_LOG(_L("FSM set ConfigGPRS"));
       
    83 		iPdpFsmInterface.Set(iId, iConfigGPRS);
       
    84 		SPUDTELVERBOSE_INFO_LOG(_L("FSM input EConfigGPRSChangeNetwork"));
       
    85 		iPdpFsmInterface.Input(iId, PdpFsm::EConfigGPRSChangeNetwork);
       
    86 		}
       
    87 	else
       
    88 		{ 
       
    89 		SPUDTEL_ERROR_LOG(_L("CPdpConfigChangeNotifier::Notify(), error: %d"), 
       
    90 						aStatus.Int());
       
    91 		// Not all TSYs support RPacketContext::NotifyConfigChanged so we handle
       
    92 		// KErrNotSupported silently (PDEF118981).
       
    93 		ASSERT((aStatus == KErrCancel) || (aStatus == KErrNotSupported));
       
    94 		}
       
    95 	}