telephonyprotocols/umtsgprsscpr/Test/te_spud/src/PdpFsmInterfaceTest.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 // The implementation of the RPdpFsmInterface for SPUD TEL unit tests
       
    15 // 
       
    16 //
       
    17 
       
    18 /**
       
    19  @file
       
    20  @internalComponent
       
    21 */
       
    22 
       
    23 #include "PdpFsmInterfaceTest.h"
       
    24 #include "InputRequestListener.h"
       
    25 #include "DefaultContextParameters.h"
       
    26 #include <etelpckt.h>
       
    27 
       
    28 
       
    29 CPdpFsmInterfaceTest::CPdpFsmInterfaceTest(CInputRequestListener& aListener) : iListener(aListener), iTftOperationCode(KAddFilters)
       
    30 	{
       
    31 	DefaultTftInfo(iTftInfo);
       
    32 	}
       
    33 
       
    34 const TName& CPdpFsmInterfaceTest::TsyName()
       
    35 	{
       
    36 	return SimTsyName();
       
    37 	}
       
    38 
       
    39 /**
       
    40  Signals to the test execute thread that RPdpFsmInterface::Input has been called
       
    41  */
       
    42 TInt CPdpFsmInterfaceTest::Input(TContextId aPdpId, const TInt aOperation, const TInt aParam)
       
    43 	{
       
    44 	// The aOperation parameters are broken up into those that are notifications and those that aren't
       
    45 	// Since notifications can happen anytime, separate request status members need to be kept for each one
       
    46 	// Other input requests happen serially, so only one request can be pending at any time
       
    47 	TRequestStatus *status = NULL;
       
    48 	switch (aOperation)
       
    49 		{
       
    50 	case PdpFsm::EQoSProfileChangeNetwork:		
       
    51 		status = &iListener.iEtelDriverQosNotificationStatus;
       
    52 		break;
       
    53 	case PdpFsm::EConfigGPRSChangeNetwork:
       
    54 		status = &iListener.iEtelDriverConfigGPRSNotificationStatus;
       
    55 		break;
       
    56 	case PdpFsm::EContextStatusChangeNetwork:
       
    57 		status = &iListener.iEtelDriverContextStatusNotificationStatus;
       
    58 		break;
       
    59 	case PdpFsm::EServiceStatusChangeNetwork:
       
    60 		status = &iListener.iEtelDriverServiceNotificationStatus;
       
    61 		break;
       
    62 	default:
       
    63 		iListener.iEtelDriverInputResponseData.iPdpId = aPdpId;
       
    64 		iListener.iEtelDriverInputResponseData.iSignal = aOperation;
       
    65 		status = &iListener.iEtelDriverInputResponseStatus;
       
    66 		break;
       
    67 		}
       
    68 	iListener.iParentThread.RequestComplete(status, aParam);
       
    69 	
       
    70 	return KErrNone;
       
    71 	}
       
    72 
       
    73 
       
    74 
       
    75 #ifdef SYMBIAN_NETWORKING_UMTSR5
       
    76 // Gets just return default values
       
    77 TInt CPdpFsmInterfaceTest::Get(TContextId /*aPdpId*/, RPacketQoS::TQoSR5Negotiated& /*aParam*/) const
       
    78 	{
       
    79 	ASSERT(EFalse);
       
    80 	return KErrNone;
       
    81 	}
       
    82 
       
    83 TInt CPdpFsmInterfaceTest::Get(TContextId /*aPdpId*/, RPacketQoS::TQoSR5Requested& aQoSR5Requested) const
       
    84 	{
       
    85 	DefaultQoSR99_R4Requested(aQoSR5Requested);
       
    86 	aQoSR5Requested.iSignallingIndication = EFalse;
       
    87 	aQoSR5Requested.iSourceStatisticsDescriptor = RPacketQoS::ESourceStatisticsDescriptorUnknown;
       
    88 	return KErrNone;
       
    89 	}
       
    90 	
       
    91 #else
       
    92 // !SYMBIAN_NETWORKING_UMTSR5
       
    93 
       
    94 // Gets just return default values
       
    95 TInt CPdpFsmInterfaceTest::Get(TContextId /*aPdpId*/, RPacketQoS::TQoSR99_R4Negotiated& /*aParam*/) const
       
    96 	{
       
    97 	ASSERT(EFalse);
       
    98 	return KErrNone;
       
    99 	}
       
   100 
       
   101 TInt CPdpFsmInterfaceTest::Get(TContextId /*aPdpId*/, RPacketQoS::TQoSR99_R4Requested& aQoSR99_R4Requested) const
       
   102 	{
       
   103 	DefaultQoSR99_R4Requested(aQoSR99_R4Requested);
       
   104 	return KErrNone;
       
   105 	}
       
   106 
       
   107 
       
   108 #endif 
       
   109 // SYMBIAN_NETWORKING_UMTSR5 
       
   110 
       
   111 
       
   112 
       
   113 TInt CPdpFsmInterfaceTest::Get(TContextId /*aPdpId*/, RPacketContext::TContextConfigGPRS& aParam) const
       
   114 	{
       
   115 	DefaultContextConfigGPRS(aParam);
       
   116 	return KErrNone;
       
   117 	}
       
   118 	
       
   119 TInt CPdpFsmInterfaceTest::Get(TContextId /*aPdpId*/, TTFTOperationCode& aParam) const
       
   120 	{
       
   121 	aParam = iTftOperationCode;
       
   122 	return KErrNone;
       
   123 	}
       
   124 
       
   125 TInt CPdpFsmInterfaceTest::Get(TContextId /*aPdpId*/, TTFTInfo& aTFTInfo) const
       
   126 	{
       
   127 	aTFTInfo = iTftInfo;
       
   128 	return KErrNone;
       
   129 	}
       
   130 
       
   131 TInt CPdpFsmInterfaceTest::Get(TContextId /*aPdpId*/, RPacketContext::TDataChannelV2& aDataChannelV2) const
       
   132 	{
       
   133 	DefaultDataChannel(aDataChannelV2);
       
   134 	return KErrNone;
       
   135 	}
       
   136 	
       
   137 TInt CPdpFsmInterfaceTest::Get(TContextId /*aPdpId*/, RPacketContext::TContextStatus& aParam) const
       
   138 	{
       
   139 	aParam = RPacketContext::EStatusUnknown;
       
   140 	return KErrNone;
       
   141 	}
       
   142 
       
   143 void CPdpFsmInterfaceTest::Get(RPacketService::TStatus& aParam)
       
   144 	{
       
   145 	aParam = RPacketService::EStatusActive;
       
   146 	}
       
   147 
       
   148 TInt CPdpFsmInterfaceTest::GetLastErrorCause(TContextId /*aPdpId*/, TInt& /*aLastErrorCause*/) const
       
   149 	{
       
   150 	/*Placeholder for unused function*/
       
   151 	return KErrNone;
       
   152 	}
       
   153 
       
   154 /**
       
   155  Store the parameters passed to Set to be compared by the test execute thread
       
   156  */
       
   157 TInt CPdpFsmInterfaceTest::Set(TContextId aPdpId, const RPacketContext::TContextConfigGPRS& aContextConfigGPRS)
       
   158 	{
       
   159 	iListener.iNotifyContextConfigData.iPdpId = aPdpId;
       
   160 	iListener.iNotifyContextConfigData.iContextConfigGPRS = aContextConfigGPRS;
       
   161 	return KErrNone;
       
   162 	}
       
   163 
       
   164 /**
       
   165  Store the parameters passed to Set to be compared by the test execute thread
       
   166  */
       
   167 TInt CPdpFsmInterfaceTest::Set(TContextId aPdpId, const RPacketContext::TContextStatus& aParam)
       
   168 	{
       
   169 	iListener.iNotifyContextStatusData.iPdpId = aPdpId;
       
   170 	iListener.iNotifyContextStatusData.iContextStatus = aParam;
       
   171 	return KErrNone;
       
   172 	}
       
   173 
       
   174 /**
       
   175  Store the parameters passed to Set to be compared by the test execute thread
       
   176  */
       
   177 void CPdpFsmInterfaceTest::Set(const RPacketService::TStatus aServiceStatus)
       
   178 	{
       
   179 	iListener.iPacketServiceStatus = aServiceStatus;
       
   180 	}
       
   181 
       
   182 /**
       
   183  Store the parameters passed to Set to be compared by the test execute thread
       
   184  */
       
   185 TInt CPdpFsmInterfaceTest::Set(TContextId aPdpId, const RPacketContext::TDataChannelV2& aDataChannelV2)
       
   186 	{
       
   187 	iListener.iNotifyContextDataChannelData.iPdpId = aPdpId;
       
   188 	iListener.iNotifyContextDataChannelData.iDataChannelV2 = aDataChannelV2;
       
   189 	return KErrNone;
       
   190 	}
       
   191 
       
   192 
       
   193 #ifdef SYMBIAN_NETWORKING_UMTSR5
       
   194 /**
       
   195  Store the parameters passed to Set to be compared by the test execute thread
       
   196  */
       
   197 TInt CPdpFsmInterfaceTest::Set(TContextId /*aPdpId*/, const RPacketQoS::TQoSR5Requested& /*aParam*/)
       
   198 	{
       
   199 	ASSERT(EFalse);
       
   200 	return KErrNone;
       
   201 	}
       
   202 
       
   203 /**
       
   204  Store the parameters passed to Set to be compared by the test execute thread
       
   205  */
       
   206 TInt CPdpFsmInterfaceTest::Set(const TContextId aPdpId, const RPacketQoS::TQoSR5Negotiated& aQoSR5Negotiated)
       
   207 	{
       
   208 	iListener.iNotifyQosNegotiatedData.iPdpId = aPdpId;
       
   209 	iListener.iNotifyQosNegotiatedData.iNegotiated = aQoSR5Negotiated;
       
   210 	return KErrNone;
       
   211 	}
       
   212 
       
   213 #else
       
   214 // !SYMBIAN_NETWORKING_UMTSR5 
       
   215 
       
   216 /**
       
   217  Store the parameters passed to Set to be compared by the test execute thread
       
   218  */
       
   219 TInt CPdpFsmInterfaceTest::Set(TContextId /*aPdpId*/, const RPacketQoS::TQoSR99_R4Requested& /*aParam*/)
       
   220 	{
       
   221 	ASSERT(EFalse);
       
   222 	return KErrNone;
       
   223 	}
       
   224 
       
   225 /**
       
   226  Store the parameters passed to Set to be compared by the test execute thread
       
   227  */
       
   228 TInt CPdpFsmInterfaceTest::Set(TContextId aPdpId, const RPacketQoS::TQoSR99_R4Negotiated& aQoSR99_R4Negotiated)
       
   229 	{
       
   230 	iListener.iNotifyQosNegotiatedData.iPdpId = aPdpId;
       
   231 	iListener.iNotifyQosNegotiatedData.iNegotiated = aQoSR99_R4Negotiated;
       
   232 	return KErrNone;
       
   233 	}
       
   234 
       
   235 #endif 
       
   236 // SYMBIAN_NETWORKING_UMTSR5 
       
   237 
       
   238 
       
   239 
       
   240 
       
   241 /**
       
   242  Store the parameters passed to Set to be compared by the test execute thread
       
   243  */
       
   244 TInt CPdpFsmInterfaceTest::Set(TContextId /*aPdpId*/, const TTFTOperationCode& aParam)
       
   245 	{
       
   246 	iTftOperationCode = aParam;
       
   247 	return KErrNone;
       
   248 	}
       
   249 
       
   250 /**
       
   251  Store the parameters passed to Set to be compared by the test execute thread
       
   252  */
       
   253 TInt CPdpFsmInterfaceTest::Set(TContextId /*aPdpId*/, const TTFTInfo& aParam)
       
   254 	{
       
   255 	iTftInfo = aParam;
       
   256 	return KErrNone;
       
   257 	}
       
   258 	
       
   259 void CPdpFsmInterfaceTest::SetContextTerminationErrorAndStop(TContextId /*aPdpId*/, TInt /*aErrorCode*/)
       
   260 	{/*Placeholder for unused function*/}
       
   261 
       
   262