telephonyprotocols/pdplayer/umts/spudtel/src/cpdpstatuschangenotifier.cpp
branchRCL_3
changeset 65 630d2f34d719
parent 0 3553901f7fa8
child 66 07a122eea281
child 69 b982c3e940f3
equal deleted inserted replaced
61:17af172ffa5f 65:630d2f34d719
     1 // Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies).
     1 // Copyright (c) 2004-2010 Nokia Corporation and/or its subsidiary(-ies).
     2 // All rights reserved.
     2 // All rights reserved.
     3 // This component and the accompanying materials are made available
     3 // This component and the accompanying materials are made available
     4 // under the terms of "Eclipse Public License v1.0"
     4 // under the terms of "Eclipse Public License v1.0"
     5 // which accompanies this distribution, and is available
     5 // which accompanies this distribution, and is available
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
    18 /**
    18 /**
    19  @file 
    19  @file 
    20  @internalComponent
    20  @internalComponent
    21 */
    21 */
    22 
    22 
       
    23 
       
    24 
       
    25 #include "OstTraceDefinitions.h"
       
    26 #ifdef OST_TRACE_COMPILER_IN_USE
       
    27 #include "cpdpstatuschangenotifierTraces.h"
       
    28 #endif
       
    29 
    23 #include <e32base.h>
    30 #include <e32base.h>
    24 
    31 
    25 #include "cpdpstatuschangenotifier.h"
    32 #include "cpdpstatuschangenotifier.h"
    26 #include "PDPFSM.h"
    33 #include "PDPFSM.h"
    27 #include "spudteldebuglogger.h"
       
    28 #include "pdpfsmnmspace.h"
    34 #include "pdpfsmnmspace.h"
    29 
    35 
    30 #include <pcktcs.h>
    36 #include <pcktcs.h>
    31 
    37 
    32 
    38 
    63 /** stops notification */	
    69 /** stops notification */	
    64 void CPdpStatusChangeNotifier::DoCancel()
    70 void CPdpStatusChangeNotifier::DoCancel()
    65 	{
    71 	{
    66 	if(IsActive())
    72 	if(IsActive())
    67 		{ 
    73 		{ 
    68 		SPUDTELVERBOSE_INFO_LOG(
    74 		OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CPDPSTATUSCHANGENOTIFIER_DOCANCEL_1, "CPdpStatusChangeNotifier::DoCancel EPacketContextNotifyStatusChange");
    69 			_L("CPdpStatusChangeNotifier::DoCancel EPacketContextNotifyStatusChange"));
       
    70 		iPacketContext.CancelAsyncRequest(EPacketContextNotifyStatusChange); 
    75 		iPacketContext.CancelAsyncRequest(EPacketContextNotifyStatusChange); 
    71 		}
    76 		}
    72 	}
    77 	}
    73 
    78 
    74 /** notifies pdp fsm 
    79 /** notifies pdp fsm 
    77 */
    82 */
    78 void CPdpStatusChangeNotifier::Notify(const TRequestStatus& aStatus)
    83 void CPdpStatusChangeNotifier::Notify(const TRequestStatus& aStatus)
    79 	{
    84 	{
    80 	if(aStatus == KErrNone)
    85 	if(aStatus == KErrNone)
    81 		{
    86 		{
    82 		SPUDTELVERBOSE_INFO_LOG(_L("Notified of context status change"));
    87 		OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CPDPSTATUSCHANGENOTIFIER_NOTIFY_1, "Notified of context status change");
    83 		RPacketContext::TContextStatus aOldContextStatus;
    88 		RPacketContext::TContextStatus aOldContextStatus;
    84 		iPdpFsmInterface.Get(iId,aOldContextStatus);
    89 		iPdpFsmInterface.Get(iId,aOldContextStatus);
    85 		// only notify of change if it has actually changed
    90 		// only notify of change if it has actually changed
    86 		if (iContextStatus != aOldContextStatus)
    91 		if (iContextStatus != aOldContextStatus)
    87 			{
    92 			{
    88 			SPUDTELVERBOSE_INFO_LOG(_L("FSM input EContextStatusChangeNetwork"));
    93 			OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CPDPSTATUSCHANGENOTIFIER_NOTIFY_2, "FSM input EContextStatusChangeNetwork");
    89 			iPdpFsmInterface.Set(iId, iContextStatus);
    94 			iPdpFsmInterface.Set(iId, iContextStatus);
    90             TInt err = KErrNone;
    95             TInt err = KErrNone;
    91             iPacketContext.GetLastErrorCause(err); // Ignore error return code.
    96             iPacketContext.GetLastErrorCause(err); // Ignore error return code.
    92 			iPdpFsmInterface.Input(iId,  PdpFsm::EContextStatusChangeNetwork, err);
    97 			iPdpFsmInterface.Input(iId,  PdpFsm::EContextStatusChangeNetwork, err);
    93 			}
    98 			}
    94 		}
    99 		}
    95 	else
   100 	else
    96 		{ 
   101 		{ 
    97 		SPUDTEL_ERROR_LOG(_L("CPdpStatusChangeNotifier::Notify(), error: %d"), 
   102 		OstTraceDef1(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CPDPSTATUSCHANGENOTIFIER_NOTIFY_3, "CPdpStatusChangeNotifier::Notify(), error: %d", aStatus.Int());
    98 						aStatus.Int());
       
    99 		ASSERT(aStatus == KErrCancel); 
   103 		ASSERT(aStatus == KErrCancel); 
   100 		}
   104 		}
   101 	}
   105 	}
   102 	
   106 	
   103 	
   107 	
   137 /** stops notification */	
   141 /** stops notification */	
   138 void CMbmsPdpStatusChangeNotifier::DoCancel()
   142 void CMbmsPdpStatusChangeNotifier::DoCancel()
   139 	{
   143 	{
   140 	if(IsActive())
   144 	if(IsActive())
   141 		{ 
   145 		{ 
   142 		SPUDTELVERBOSE_INFO_LOG(
   146 		OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CMBMSPDPSTATUSCHANGENOTIFIER_DOCANCEL_1, "CMbmsPdpStatusChangeNotifier::DoCancel EPacketContextNotifyStatusChange");
   143 			_L("CMbmsPdpStatusChangeNotifier::DoCancel EPacketContextNotifyStatusChange"));
       
   144 		iMbmsPacketContext.CancelAsyncRequest(EPacketContextNotifyStatusChange); 
   147 		iMbmsPacketContext.CancelAsyncRequest(EPacketContextNotifyStatusChange); 
   145 		}
   148 		}
   146 	}
   149 	}
   147 
   150 
   148 /** notifies pdp fsm 
   151 /** notifies pdp fsm 
   151 */
   154 */
   152 void CMbmsPdpStatusChangeNotifier::Notify(const TRequestStatus& aStatus)
   155 void CMbmsPdpStatusChangeNotifier::Notify(const TRequestStatus& aStatus)
   153 	{
   156 	{
   154 	if(aStatus == KErrNone)
   157 	if(aStatus == KErrNone)
   155 		{
   158 		{
   156 		SPUDTELVERBOSE_INFO_LOG(_L("Notified of context status change"));
   159 		OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CMBMSPDPSTATUSCHANGENOTIFIER_NOTIFY_1, "Notified of context status change");
   157 		RPacketContext::TContextStatus aOldContextStatus;
   160 		RPacketContext::TContextStatus aOldContextStatus;
   158 		iPdpFsmInterface.Get(iId,aOldContextStatus);
   161 		iPdpFsmInterface.Get(iId,aOldContextStatus);
   159 		// only notify of change if it has actually changed
   162 		// only notify of change if it has actually changed
   160 		if (iContextStatus != aOldContextStatus)
   163 		if (iContextStatus != aOldContextStatus)
   161 			{
   164 			{
   162 			SPUDTELVERBOSE_INFO_LOG(_L("FSM input EContextStatusChangeNetwork"));
   165 			OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CMBMSPDPSTATUSCHANGENOTIFIER_NOTIFY_2, "FSM input EContextStatusChangeNetwork");
   163 			iPdpFsmInterface.Set(iId, iContextStatus);
   166 			iPdpFsmInterface.Set(iId, iContextStatus);
   164             TInt err = KErrNone;
   167             TInt err = KErrNone;
   165             iMbmsPacketContext.GetLastErrorCause(err); // Ignore error return code.
   168             iMbmsPacketContext.GetLastErrorCause(err); // Ignore error return code.
   166 			iPdpFsmInterface.Input(iId, PdpFsm::EContextStatusChangeNetwork, err);
   169 			iPdpFsmInterface.Input(iId, PdpFsm::EContextStatusChangeNetwork, err);
   167 			}
   170 			}
   168 		}
   171 		}
   169 	else
   172 	else
   170 		{ 
   173 		{ 
   171 		SPUDTEL_ERROR_LOG(_L("CMbmsPdpStatusChangeNotifier::Notify(), error: %d"), 
   174 		OstTraceDef1(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CMBMSPDPSTATUSCHANGENOTIFIER_NOTIFY_3, "CMbmsPdpStatusChangeNotifier::Notify(), error: %d", aStatus.Int());
   172 						aStatus.Int());
       
   173 		ASSERT(aStatus == KErrCancel); 
   175 		ASSERT(aStatus == KErrCancel); 
   174 		}
   176 		}
   175 	}
   177 	}
   176 	
   178