telephonyserverplugins/simtsy/src/CSimPacketService.cpp
changeset 44 8b72faa1200f
parent 0 3553901f7fa8
child 64 b34bb05ac869
equal deleted inserted replaced
39:2473f5e227f9 44:8b72faa1200f
     1 // Copyright (c) 2001-2009 Nokia Corporation and/or its subsidiary(-ies).
     1 // Copyright (c) 2001-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".
    20 
    20 
    21 /**
    21 /**
    22  @file
    22  @file
    23 */
    23 */
    24 
    24 
       
    25 
       
    26 
       
    27 #include "OstTraceDefinitions.h"
       
    28 #ifdef OST_TRACE_COMPILER_IN_USE
       
    29 #include "CSimPacketServiceTraces.h"
       
    30 #endif
       
    31 
    25 #include "CSimPacketService.h"
    32 #include "CSimPacketService.h"
    26 #include "Simlog.h"
       
    27 #include <pcktcs.h>
    33 #include <pcktcs.h>
    28 #include "CSimPhone.h"
    34 #include "CSimPhone.h"
    29 #include "utils.h"
    35 #include "utils.h"
    30 #include "CSimPacketContext.h"
    36 #include "CSimPacketContext.h"
    31 #include "CSimPubSubChange.h"
    37 #include "CSimPubSubChange.h"
   106 *
   112 *
   107 * @leave Leaves no memory or any data member does not construct for any reason.
   113 * @leave Leaves no memory or any data member does not construct for any reason.
   108 * @panic Panics with SIMTSY EInvalidParameterFormatInConfigFile if an additional param data item is in an invalid format
   114 * @panic Panics with SIMTSY EInvalidParameterFormatInConfigFile if an additional param data item is in an invalid format
   109 */
   115 */
   110 	{
   116 	{
   111 	LOGPACKET1("CSimPacketService: Entered ConstructL()");
   117 	OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSIMPACKETSERVICE_CONSTRUCTL_1, "CSimPacketService: Entered ConstructL()");
   112 	
   118 	
   113 	iTimer = CSimTimer::NewL(iPhone);
   119 	iTimer = CSimTimer::NewL(iPhone);
   114 	iPcktRegTimer = CSimTimer::NewL(iPhone);
   120 	iPcktRegTimer = CSimTimer::NewL(iPhone);
   115 	iNtwkRegTimer = CSimTimer::NewL(iPhone);
   121 	iNtwkRegTimer = CSimTimer::NewL(iPhone);
   116 	iReleaseModeTimer = CSimTimer::NewL(iPhone);
   122 	iReleaseModeTimer = CSimTimer::NewL(iPhone);
   378 					ret=CTestConfig::GetElement(item2->Value(),KStdDelimiter,2,additionalParamDataFormat);
   384 					ret=CTestConfig::GetElement(item2->Value(),KStdDelimiter,2,additionalParamDataFormat);
   379 					if (ret != KErrNone)
   385 					if (ret != KErrNone)
   380 						{
   386 						{
   381 						// AdditionalParamDataFormat not been specified,
   387 						// AdditionalParamDataFormat not been specified,
   382 						// default to plain ASCII
   388 						// default to plain ASCII
   383 						LOGPARSERR("AdditionalParamItem::additionalParamDataFormat",ret,2,&KDefaultGPRSAdditionalParamItem);
   389 						OstTraceDefExt3(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSIMPACKETSERVICE_CONSTRUCTL_2, "WARNING - CONFIGURATION FILE PARSING - Reading element ADDITIONALPARAMITEM::ADDITIONALPARAMDATAFORMAT returned %d (element no. %d) from tag %s.",ret,2,KDefaultGPRSAdditionalParamItem);
   384 						format = EConfigDataFormatAscii;
   390 						format = EConfigDataFormatAscii;
   385 						}
   391 						}
   386 					else
   392 					else
   387 						{
   393 						{
   388 						if (AsciiToNum(additionalParamDataFormat, format) != KErrNone)
   394 						if (AsciiToNum(additionalParamDataFormat, format) != KErrNone)
   389 							{
   395 							{
   390 							LOGPARSERR("AdditionalParamItem::additionalParamDataFormat",KErrArgument,2,&KDefaultGPRSAdditionalParamItem);
   396 							OstTraceDefExt3(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSIMPACKETSERVICE_CONSTRUCTL_3, "WARNING - CONFIGURATION FILE PARSING - Reading element ADDITIONALPARAMITEM::ADDITIONALPARAMDATAFORMAT returned %d (element no. %d) from tag %s.",KErrArgument,2,KDefaultGPRSAdditionalParamItem);
   391 							format = EConfigDataFormatAscii;
   397 							format = EConfigDataFormatAscii;
   392 							}
   398 							}
   393 
   399 
   394 						// Check that the AdditionalParamDataFormat value
   400 						// Check that the AdditionalParamDataFormat value
   395 						// specified in the config file is a valid one,
   401 						// specified in the config file is a valid one,
   396 						// default to ASCII if not.
   402 						// default to ASCII if not.
   397 						if (format >= EMaxConfigDataFormat)
   403 						if (format >= EMaxConfigDataFormat)
   398 							{
   404 							{
   399 							LOGPARSERR("AdditionalParamItem::additionalParamDataFormat",KErrArgument,2,&KDefaultGPRSAdditionalParamItem);
   405 							OstTraceDefExt3(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSIMPACKETSERVICE_CONSTRUCTL_4, "WARNING - CONFIGURATION FILE PARSING - Reading element ADDITIONALPARAMITEM::ADDITIONALPARAMDATAFORMAT returned %d (element no. %d) from tag %s.",KErrArgument,2,KDefaultGPRSAdditionalParamItem);
   400 							format = EConfigDataFormatAscii;
   406 							format = EConfigDataFormatAscii;
   401 							}
   407 							}
   402 						}
   408 						}
   403 										
   409 										
   404 					// Get AdditionalParamData
   410 					// Get AdditionalParamData
   415 							TBuf8<RPacketContext::KMiscProtocolBufferLength> additionalParamDataBuffer;
   421 							TBuf8<RPacketContext::KMiscProtocolBufferLength> additionalParamDataBuffer;
   416 							additionalParamDataBuffer.Copy (additionalParamContent);
   422 							additionalParamDataBuffer.Copy (additionalParamContent);
   417 
   423 
   418 							if (ParseMixedBinaryAsciiDataL(additionalParamDataBuffer) != KErrNone)
   424 							if (ParseMixedBinaryAsciiDataL(additionalParamDataBuffer) != KErrNone)
   419 								{
   425 								{
   420 								LOGPARSERR("AdditionalParamItem::additionalParamContent",KErrArgument,1,&KDefaultGPRSAdditionalParamItem);
   426 								OstTraceDefExt3(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSIMPACKETSERVICE_CONSTRUCTL_5, "WARNING - CONFIGURATION FILE PARSING - Reading element ADDITIONALPARAMITEM::ADDITIONALPARAMCONTENT returned %d (element no. %d) from tag %s.",KErrArgument,1,KDefaultGPRSAdditionalParamItem);
   421 								SimPanic(EInvalidParameterFormatInConfigFile);
   427 								SimPanic(EInvalidParameterFormatInConfigFile);
   422 								}
   428 								}
   423 
   429 
   424 							TPtr8 paramPtr(const_cast<TUint8*>(additionalParamDataBuffer.Ptr()), 
   430 							TPtr8 paramPtr(const_cast<TUint8*>(additionalParamDataBuffer.Ptr()), 
   425 								additionalParamDataBuffer.Length(), additionalParamDataBuffer.Length());
   431 								additionalParamDataBuffer.Length(), additionalParamDataBuffer.Length());
   443 
   449 
   444 				itemOffSet= itemOffSet + numAdditionalParams;;
   450 				itemOffSet= itemOffSet + numAdditionalParams;;
   445 			}
   451 			}
   446 		else
   452 		else
   447 			{
   453 			{
   448 			LOGPARSERR("ProtocolConfigOption::numAdditionalParams",ret,14,&KDefaultContextparamGPRS);	
   454 			OstTraceDefExt3(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSIMPACKETSERVICE_CONSTRUCTL_6, "WARNING - CONFIGURATION FILE PARSING - Reading element PROTOCOLCONFIGOPTION::NUMADDITIONALPARAMS returned %d (element no. %d) from tag %s.",ret,14,KDefaultContextparamGPRS);
   449 			} 
   455 			} 
   450 		} 
   456 		} 
   451 
   457 
   452 	//< Read in all the data for getting the default UMTS configuration parameters
   458 	//< Read in all the data for getting the default UMTS configuration parameters
   453 	item = CfgFile()->Item(KDefaultContextparamRel99);
   459 	item = CfgFile()->Item(KDefaultContextparamRel99);
   550 					ret=CTestConfig::GetElement(item2->Value(),KStdDelimiter,2,additionalParamDataFormat);
   556 					ret=CTestConfig::GetElement(item2->Value(),KStdDelimiter,2,additionalParamDataFormat);
   551 					if (ret != KErrNone)
   557 					if (ret != KErrNone)
   552 						{
   558 						{
   553 						// AdditionalParamDataFormat not been specified,
   559 						// AdditionalParamDataFormat not been specified,
   554 						// default to plain ASCII
   560 						// default to plain ASCII
   555 						LOGPARSERR("No AdditionalParamItem::additionalParamDataFormat",ret,2,&KDefaultAdditionalParamItemRel99);
   561 						OstTraceDefExt3(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSIMPACKETSERVICE_CONSTRUCTL_7, "WARNING - CONFIGURATION FILE PARSING - Reading element NO ADDITIONALPARAMITEM::ADDITIONALPARAMDATAFORMAT returned %d (element no. %d) from tag %s.",ret,2,KDefaultAdditionalParamItemRel99);
   556 						format = EConfigDataFormatAscii;
   562 						format = EConfigDataFormatAscii;
   557 						}
   563 						}
   558 					else
   564 					else
   559 						{
   565 						{
   560 						if (AsciiToNum(additionalParamDataFormat, format) != KErrNone)
   566 						if (AsciiToNum(additionalParamDataFormat, format) != KErrNone)
   561 							{
   567 							{
   562 							LOGPARSERR("AdditionalParamItem::additionalParamDataFormat",KErrArgument,2,&KDefaultAdditionalParamItemRel99);
   568 							OstTraceDefExt3(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSIMPACKETSERVICE_CONSTRUCTL_8, "WARNING - CONFIGURATION FILE PARSING - Reading element ADDITIONALPARAMITEM::ADDITIONALPARAMDATAFORMAT returned %d (element no. %d) from tag %s.",KErrArgument,2,KDefaultAdditionalParamItemRel99);
   563 							format = EConfigDataFormatAscii;
   569 							format = EConfigDataFormatAscii;
   564 							}
   570 							}
   565 
   571 
   566 						// Check that the AdditionalParamDataFormat value
   572 						// Check that the AdditionalParamDataFormat value
   567 						// specified in the config file is a valid one,
   573 						// specified in the config file is a valid one,
   568 						// default to ASCII if not.
   574 						// default to ASCII if not.
   569 						if (format >= EMaxConfigDataFormat)
   575 						if (format >= EMaxConfigDataFormat)
   570 							{
   576 							{
   571 							LOGPARSERR("AdditionalParamItem::additionalParamDataFormat",KErrArgument,2,&KDefaultAdditionalParamItemRel99);
   577 							OstTraceDefExt3(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSIMPACKETSERVICE_CONSTRUCTL_9, "WARNING - CONFIGURATION FILE PARSING - Reading element ADDITIONALPARAMITEM::ADDITIONALPARAMDATAFORMAT returned %d (element no. %d) from tag %s.",KErrArgument,2,KDefaultAdditionalParamItemRel99);
   572 							format = EConfigDataFormatAscii;
   578 							format = EConfigDataFormatAscii;
   573 							}
   579 							}
   574 						}
   580 						}
   575 						
   581 						
   576 					ret=CTestConfig::GetElement(item2->Value(),KStdDelimiter,1,additionalParamContent);
   582 					ret=CTestConfig::GetElement(item2->Value(),KStdDelimiter,1,additionalParamContent);
   586 							TBuf8<RPacketContext::KMiscProtocolBufferLength> additionalParamDataBuffer;
   592 							TBuf8<RPacketContext::KMiscProtocolBufferLength> additionalParamDataBuffer;
   587 							additionalParamDataBuffer.Copy (additionalParamContent);
   593 							additionalParamDataBuffer.Copy (additionalParamContent);
   588 
   594 
   589 							if (ParseMixedBinaryAsciiDataL(additionalParamDataBuffer) != KErrNone)
   595 							if (ParseMixedBinaryAsciiDataL(additionalParamDataBuffer) != KErrNone)
   590 								{
   596 								{
   591 								LOGPARSERR("AdditionalParamItem::additionalParamContent",KErrArgument,1,&KDefaultAdditionalParamItemRel99);
   597 								OstTraceDefExt3(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSIMPACKETSERVICE_CONSTRUCTL_10, "WARNING - CONFIGURATION FILE PARSING - Reading element ADDITIONALPARAMITEM::ADDITIONALPARAMCONTENT returned %d (element no. %d) from tag %s.",KErrArgument,1,KDefaultAdditionalParamItemRel99);
   592 								SimPanic(EInvalidParameterFormatInConfigFile);
   598 								SimPanic(EInvalidParameterFormatInConfigFile);
   593 								}
   599 								}
   594 
   600 
   595 							TPtr8 paramPtr(const_cast<TUint8*>(additionalParamDataBuffer.Ptr()), 
   601 							TPtr8 paramPtr(const_cast<TUint8*>(additionalParamDataBuffer.Ptr()), 
   596 								additionalParamDataBuffer.Length(), additionalParamDataBuffer.Length());
   602 								additionalParamDataBuffer.Length(), additionalParamDataBuffer.Length());
   613 
   619 
   614 				itemOffSet= itemOffSet + numAdditionalParams;;
   620 				itemOffSet= itemOffSet + numAdditionalParams;;
   615 			}
   621 			}
   616 		else
   622 		else
   617 			{
   623 			{
   618 			LOGPARSERR("ProtocolConfigOption::numAdditionalParams",ret,12,&KDefaultContextparamRel99);	
   624 			OstTraceDefExt3(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSIMPACKETSERVICE_CONSTRUCTL_11, "WARNING - CONFIGURATION FILE PARSING - Reading element PROTOCOLCONFIGOPTION::NUMADDITIONALPARAMS returned %d (element no. %d) from tag %s.",ret,12,KDefaultContextparamRel99);
   619 			} 		
   625 			} 		
   620 
   626 
   621 		}
   627 		}
   622 
   628 
   623 		//< Read in all the data for getting the default R5 configuration parameters
   629 		//< Read in all the data for getting the default R5 configuration parameters
   773 					ret=CTestConfig::GetElement(item2->Value(),KStdDelimiter,2,additionalParamDataFormat);
   779 					ret=CTestConfig::GetElement(item2->Value(),KStdDelimiter,2,additionalParamDataFormat);
   774 					if (ret != KErrNone)
   780 					if (ret != KErrNone)
   775 						{
   781 						{
   776 						// AdditionalParamDataFormat not been specified,
   782 						// AdditionalParamDataFormat not been specified,
   777 						// default to plain ASCII
   783 						// default to plain ASCII
   778 						LOGPARSERR("No AdditionalParamItem::additionalParamDataFormat",ret,2,&KDefaultAdditionalParamItem);
   784 						OstTraceDefExt3(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSIMPACKETSERVICE_CONSTRUCTL_12, "WARNING - CONFIGURATION FILE PARSING - Reading element NO ADDITIONALPARAMITEM::ADDITIONALPARAMDATAFORMAT returned %d (element no. %d) from tag %s.",ret,2,KDefaultAdditionalParamItem);
   779 						format = EConfigDataFormatAscii;
   785 						format = EConfigDataFormatAscii;
   780 						}
   786 						}
   781 					else
   787 					else
   782 						{
   788 						{
   783 						if (AsciiToNum(additionalParamDataFormat, format) != KErrNone)
   789 						if (AsciiToNum(additionalParamDataFormat, format) != KErrNone)
   784 							{
   790 							{
   785 							LOGPARSERR("AdditionalParamItem::additionalParamDataFormat",KErrArgument,2,&KDefaultAdditionalParamItem);
   791 							OstTraceDefExt3(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSIMPACKETSERVICE_CONSTRUCTL_13, "WARNING - CONFIGURATION FILE PARSING - Reading element ADDITIONALPARAMITEM::ADDITIONALPARAMDATAFORMAT returned %d (element no. %d) from tag %s.",KErrArgument,2,KDefaultAdditionalParamItem);
   786 							format = EConfigDataFormatAscii;
   792 							format = EConfigDataFormatAscii;
   787 							}
   793 							}
   788 
   794 
   789 						// Check that the AdditionalParamDataFormat value
   795 						// Check that the AdditionalParamDataFormat value
   790 						// specified in the config file is a valid one,
   796 						// specified in the config file is a valid one,
   791 						// default to ASCII if not.
   797 						// default to ASCII if not.
   792 						if (format >= EMaxConfigDataFormat)
   798 						if (format >= EMaxConfigDataFormat)
   793 							{
   799 							{
   794 							LOGPARSERR("AdditionalParamItem::additionalParamDataFormat",KErrArgument,2,&KDefaultAdditionalParamItem);
   800 							OstTraceDefExt3(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSIMPACKETSERVICE_CONSTRUCTL_14, "WARNING - CONFIGURATION FILE PARSING - Reading element ADDITIONALPARAMITEM::ADDITIONALPARAMDATAFORMAT returned %d (element no. %d) from tag %s.",KErrArgument,2,KDefaultAdditionalParamItem);
   795 							format = EConfigDataFormatAscii;
   801 							format = EConfigDataFormatAscii;
   796 							}
   802 							}
   797 						}
   803 						}
   798 
   804 
   799 						ret=CTestConfig::GetElement(item2->Value(),KStdDelimiter,1,additionalParamContent);
   805 						ret=CTestConfig::GetElement(item2->Value(),KStdDelimiter,1,additionalParamContent);
   809 								TBuf8<RPacketContext::KMiscProtocolBufferLength> additionalParamDataBuffer;
   815 								TBuf8<RPacketContext::KMiscProtocolBufferLength> additionalParamDataBuffer;
   810 								additionalParamDataBuffer.Copy (additionalParamContent);
   816 								additionalParamDataBuffer.Copy (additionalParamContent);
   811 
   817 
   812 								if (ParseMixedBinaryAsciiDataL(additionalParamDataBuffer) != KErrNone)
   818 								if (ParseMixedBinaryAsciiDataL(additionalParamDataBuffer) != KErrNone)
   813 									{
   819 									{
   814 									LOGPARSERR("AdditionalParamItem::additionalParamContent",KErrArgument,1,&KDefaultAdditionalParamItem);
   820 									OstTraceDefExt3(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSIMPACKETSERVICE_CONSTRUCTL_15, "WARNING - CONFIGURATION FILE PARSING - Reading element ADDITIONALPARAMITEM::ADDITIONALPARAMCONTENT returned %d (element no. %d) from tag %s.",KErrArgument,1,KDefaultAdditionalParamItem);
   815 									SimPanic(EInvalidParameterFormatInConfigFile);
   821 									SimPanic(EInvalidParameterFormatInConfigFile);
   816 									}
   822 									}
   817 
   823 
   818 								TPtr8 paramPtr(const_cast<TUint8*>(additionalParamDataBuffer.Ptr()), 
   824 								TPtr8 paramPtr(const_cast<TUint8*>(additionalParamDataBuffer.Ptr()), 
   819 									additionalParamDataBuffer.Length(), additionalParamDataBuffer.Length());
   825 									additionalParamDataBuffer.Length(), additionalParamDataBuffer.Length());
  1000 * Trivial Destructor
  1006 * Trivial Destructor
  1001 * Closes all CObject type objects and destroys all other objects created in the ConstructL()
  1007 * Closes all CObject type objects and destroys all other objects created in the ConstructL()
  1002 *
  1008 *
  1003 */
  1009 */
  1004 	{
  1010 	{
  1005 	LOGPACKET1("CSimPacketService: Entered destructor");
  1011 	OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSIMPACKETSERVICE_DTOR_1, "CSimPacketService: Entered destructor");
  1006 		
  1012 		
  1007 	delete iIncomingContextManager;
  1013 	delete iIncomingContextManager;
  1008 	
  1014 	
  1009 	iMutex.Close();
  1015 	iMutex.Close();
  1010 	// delete nifs' contexts
  1016 	// delete nifs' contexts
  1436 		case EPacketNotifyDynamicCapsChange:
  1442 		case EPacketNotifyDynamicCapsChange:
  1437 		case EPacketNotifyReleaseModeChange:
  1443 		case EPacketNotifyReleaseModeChange:
  1438 		case EPacketNotifyAttachModeChange:
  1444 		case EPacketNotifyAttachModeChange:
  1439 		case EPacketNotifyMbmsNetworkServiceStatusChange:
  1445 		case EPacketNotifyMbmsNetworkServiceStatusChange:
  1440 		case EPacketNotifyMbmsServiceAvailabilityChange:
  1446 		case EPacketNotifyMbmsServiceAvailabilityChange:
  1441 			LOGPACKET1("CSimPacketService: RegisterNotification");
  1447 			OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSIMPACKETSERVICE_REGISTERNOTIFICATION_1, "CSimPacketService: RegisterNotification");
  1442 			return KErrNone;
  1448 			return KErrNone;
  1443 		default:
  1449 		default:
  1444 			// Unknown or invalid IPC
  1450 			// Unknown or invalid IPC
  1445 			LOGPACKET1("CSimPacketService: Register error, unknown IPC");
  1451 			OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSIMPACKETSERVICE_REGISTERNOTIFICATION_2, "CSimPacketService: Register error, unknown IPC");
  1446 			return KErrNotSupported;
  1452 			return KErrNotSupported;
  1447 		}
  1453 		}
  1448 	}
  1454 	}
  1449 
  1455 
  1450 TInt CSimPacketService::DeregisterNotification(const TInt aIpc)
  1456 TInt CSimPacketService::DeregisterNotification(const TInt aIpc)
  1470 		case EPacketNotifyDynamicCapsChange:
  1476 		case EPacketNotifyDynamicCapsChange:
  1471 		case EPacketNotifyReleaseModeChange:
  1477 		case EPacketNotifyReleaseModeChange:
  1472 		case EPacketNotifyAttachModeChange:
  1478 		case EPacketNotifyAttachModeChange:
  1473 		case EPacketNotifyMbmsNetworkServiceStatusChange:
  1479 		case EPacketNotifyMbmsNetworkServiceStatusChange:
  1474 		case EPacketNotifyMbmsServiceAvailabilityChange:
  1480 		case EPacketNotifyMbmsServiceAvailabilityChange:
  1475 			LOGPACKET1("CSimPacketService: DeregisterNotification");
  1481 			OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSIMPACKETSERVICE_DEREGISTERNOTIFICATION_1, "CSimPacketService: DeregisterNotification");
  1476 			return KErrNone;
  1482 			return KErrNone;
  1477 		default:
  1483 		default:
  1478 			// Unknown or invalid IPC
  1484 			// Unknown or invalid IPC
  1479 			LOGPACKET1("CSimPacketService: Deregister error, unknown IPC");
  1485 			OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSIMPACKETSERVICE_DEREGISTERNOTIFICATION_2, "CSimPacketService: Deregister error, unknown IPC");
  1480 			return KErrNotSupported;
  1486 			return KErrNotSupported;
  1481 		}
  1487 		}
  1482 	}
  1488 	}
  1483 
  1489 
  1484 TInt CSimPacketService::NumberOfSlotsL(const TInt aIpc)
  1490 TInt CSimPacketService::NumberOfSlotsL(const TInt aIpc)
  1495 	switch (aIpc)
  1501 	switch (aIpc)
  1496 		{
  1502 		{
  1497 		case EPacketNotifyStatusChange:
  1503 		case EPacketNotifyStatusChange:
  1498 		case EPacketNotifyDynamicCapsChange:
  1504 		case EPacketNotifyDynamicCapsChange:
  1499 		case EPacketNotifyMbmsNetworkServiceStatusChange:
  1505 		case EPacketNotifyMbmsNetworkServiceStatusChange:
  1500 			LOGPACKET1("CSimPacketService: Registered with 10 slots");
  1506 			OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSIMPACKETSERVICE_NUMBEROFSLOTSL_1, "CSimPacketService: Registered with 10 slots");
  1501 			numberOfSlots=10;
  1507 			numberOfSlots=10;
  1502 			break;
  1508 			break;
  1503 		case EPacketNotifyContextAdded:
  1509 		case EPacketNotifyContextAdded:
  1504 		case EPacketNotifyContextActivationRequested:
  1510 		case EPacketNotifyContextActivationRequested:
  1505 		case EPacketNotifyChangeOfNtwkRegStatus:
  1511 		case EPacketNotifyChangeOfNtwkRegStatus:
  1506 		case EPacketNotifyMSClassChange:
  1512 		case EPacketNotifyMSClassChange:
  1507 		case EPacketNotifyReleaseModeChange:
  1513 		case EPacketNotifyReleaseModeChange:
  1508 		case EPacketNotifyAttachModeChange:
  1514 		case EPacketNotifyAttachModeChange:
  1509 		case EPacketNotifyMbmsServiceAvailabilityChange:
  1515 		case EPacketNotifyMbmsServiceAvailabilityChange:
  1510 			LOGPACKET1("CSimPacketService: Registered with 2 slots");
  1516 			OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSIMPACKETSERVICE_NUMBEROFSLOTSL_2, "CSimPacketService: Registered with 2 slots");
  1511 			numberOfSlots=2;
  1517 			numberOfSlots=2;
  1512 			break;
  1518 			break;
  1513 		default:
  1519 		default:
  1514 			// Unknown or invalid IPC
  1520 			// Unknown or invalid IPC
  1515 			LOGPACKET1("CSimPacketService: Number of Slots error, unknown IPC");
  1521 			OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSIMPACKETSERVICE_NUMBEROFSLOTSL_3, "CSimPacketService: Number of Slots error, unknown IPC");
  1516 			User::Leave(KErrNotSupported);
  1522 			User::Leave(KErrNotSupported);
  1517 			break;
  1523 			break;
  1518 		}  
  1524 		}  
  1519 	return numberOfSlots;
  1525 	return numberOfSlots;
  1520 	}
  1526 	}
  1677 * @param aTsyReqHandle  The request handle for completing the request 
  1683 * @param aTsyReqHandle  The request handle for completing the request 
  1678 * @param aIpc Ipc representing the request
  1684 * @param aIpc Ipc representing the request
  1679 * @return err KErrNone if request completes ok
  1685 * @return err KErrNone if request completes ok
  1680 */
  1686 */
  1681 	{
  1687 	{
  1682 	LOGPACKET1("CSimPacketService: - CancelService called");
  1688 	OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSIMPACKETSERVICE_CANCELSERVICE_1, "CSimPacketService: - CancelService called");
  1683 	switch (aIpc)
  1689 	switch (aIpc)
  1684 		{
  1690 		{
  1685 		case EPacketNotifyContextAdded:
  1691 		case EPacketNotifyContextAdded:
  1686 			return NotifyContextAddedCancel(aTsyReqHandle);
  1692 			return NotifyContextAddedCancel(aTsyReqHandle);
  1687 		case EPacketAttach:
  1693 		case EPacketAttach:
  1770 * 
  1776 * 
  1771 * @param aTsyReqHandle Tsy Request handle for the client cancel request
  1777 * @param aTsyReqHandle Tsy Request handle for the client cancel request
  1772 * @return KErrNone
  1778 * @return KErrNone
  1773 */
  1779 */
  1774 	{
  1780 	{
  1775 	LOGPACKET1("CSimPacketService::NotifyContextAddedCancel called");
  1781 	OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSIMPACKETSERVICE_NOTIFYCONTEXTADDEDCANCEL_1, "CSimPacketService::NotifyContextAddedCancel called");
  1776 	if(iNotifyContextAdded.iNotifyPending)
  1782 	if(iNotifyContextAdded.iNotifyPending)
  1777 		{
  1783 		{
  1778 		iNotifyContextAdded.iNotifyPending=EFalse;
  1784 		iNotifyContextAdded.iNotifyPending=EFalse;
  1779 		ReqCompleted(aTsyReqHandle,KErrCancel);
  1785 		ReqCompleted(aTsyReqHandle,KErrCancel);
  1780 		}
  1786 		}
  1789 *
  1795 *
  1790 * @param aTsyReqHandle Tsy Request handle for the client request
  1796 * @param aTsyReqHandle Tsy Request handle for the client request
  1791 * @return TInt KErrnone if request completes ok
  1797 * @return TInt KErrnone if request completes ok
  1792 */
  1798 */
  1793 	{
  1799 	{
  1794 	LOGPACKET1("CSimPacketService::Attach called");
  1800 	OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSIMPACKETSERVICE_ATTACH_1, "CSimPacketService::Attach called");
  1795 	iAttachRequestHandle=aTsyReqHandle;
  1801 	iAttachRequestHandle=aTsyReqHandle;
  1796 	return ActionEvent(EPacketEventAttach);
  1802 	return ActionEvent(EPacketEventAttach);
  1797 	}
  1803 	}
  1798 
  1804 
  1799 TInt CSimPacketService::AttachCancel(const TTsyReqHandle aTsyReqHandle)
  1805 TInt CSimPacketService::AttachCancel(const TTsyReqHandle aTsyReqHandle)
  1803 *
  1809 *
  1804 * @param aTsyReqHandle Tsy Request handle for the client request
  1810 * @param aTsyReqHandle Tsy Request handle for the client request
  1805 * @return TInt KErrnone if request completes ok
  1811 * @return TInt KErrnone if request completes ok
  1806 */
  1812 */
  1807 	{
  1813 	{
  1808 	LOGPACKET1("CSimPacketService::AttachCancel called");
  1814 	OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSIMPACKETSERVICE_ATTACHCANCEL_1, "CSimPacketService::AttachCancel called");
  1809 	if((iState == RPacketService::EStatusUnattached) && (iCurrentEvent==EPacketEventAttach))
  1815 	if((iState == RPacketService::EStatusUnattached) && (iCurrentEvent==EPacketEventAttach))
  1810 		{
  1816 		{
  1811 		iTimer->Cancel();
  1817 		iTimer->Cancel();
  1812 		iCurrentEvent= EPacketEventNone;
  1818 		iCurrentEvent= EPacketEventNone;
  1813 		ReqCompleted(aTsyReqHandle,KErrCancel);
  1819 		ReqCompleted(aTsyReqHandle,KErrCancel);
  1871 *
  1877 *
  1872 * @param aTsyReqHandle Tsy Request handle for the client request
  1878 * @param aTsyReqHandle Tsy Request handle for the client request
  1873 * @return TInt KErrnone if request completes ok
  1879 * @return TInt KErrnone if request completes ok
  1874 */
  1880 */
  1875 	{
  1881 	{
  1876 	LOGPACKET1("CSimPacketService::Detach called");
  1882 	OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSIMPACKETSERVICE_DETACH_1, "CSimPacketService::Detach called");
  1877 	iDetachRequestHandle=aTsyReqHandle;
  1883 	iDetachRequestHandle=aTsyReqHandle;
  1878 	return ActionEvent(EPacketEventDetach);
  1884 	return ActionEvent(EPacketEventDetach);
  1879 	}
  1885 	}
  1880 
  1886 
  1881 TInt CSimPacketService::DetachCancel(const TTsyReqHandle aTsyReqHandle)
  1887 TInt CSimPacketService::DetachCancel(const TTsyReqHandle aTsyReqHandle)
  1886 *
  1892 *
  1887 * @param aTsyReqHandle Tsy Request handle for the client request
  1893 * @param aTsyReqHandle Tsy Request handle for the client request
  1888 * @return TInt KErrnone if request completes ok
  1894 * @return TInt KErrnone if request completes ok
  1889 */
  1895 */
  1890 	{
  1896 	{
  1891 	LOGPACKET1("CSimPacketService::DetachCancel called");
  1897 	OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSIMPACKETSERVICE_DETACHCANCEL_1, "CSimPacketService::DetachCancel called");
  1892 	if((iState == RPacketService::EStatusAttached) && (iCurrentEvent==EPacketEventDetach))
  1898 	if((iState == RPacketService::EStatusAttached) && (iCurrentEvent==EPacketEventDetach))
  1893 			{
  1899 			{
  1894 			iTimer->Cancel();
  1900 			iTimer->Cancel();
  1895 			iCurrentEvent= EPacketEventNone;
  1901 			iCurrentEvent= EPacketEventNone;
  1896 			ReqCompleted(aTsyReqHandle,KErrCancel);
  1902 			ReqCompleted(aTsyReqHandle,KErrCancel);
  1905 * @param aTsyReqHandle Tsy Request handle for the client request
  1911 * @param aTsyReqHandle Tsy Request handle for the client request
  1906 * @param aStatus pointer to the status
  1912 * @param aStatus pointer to the status
  1907 * @return TInt err KErrNone if ok
  1913 * @return TInt err KErrNone if ok
  1908 */
  1914 */
  1909 	{
  1915 	{
  1910 	LOGPACKET1("CSimPacketService::GetStatus called");
  1916 	OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSIMPACKETSERVICE_GETSTATUS_1, "CSimPacketService::GetStatus called");
  1911 	*aStatus = iState;
  1917 	*aStatus = iState;
  1912 	ReqCompleted(aTsyReqHandle,KErrNone);
  1918 	ReqCompleted(aTsyReqHandle,KErrNone);
  1913 	return KErrNone;
  1919 	return KErrNone;
  1914 	}
  1920 	}
  1915 
  1921 
  1940 * 
  1946 * 
  1941 * @param aTsyReqHandle Tsy Request handle for the client cancel request
  1947 * @param aTsyReqHandle Tsy Request handle for the client cancel request
  1942 * @return KErrNone
  1948 * @return KErrNone
  1943 */
  1949 */
  1944 	{
  1950 	{
  1945 	LOGPACKET1("CSimPacketService::NotifyStatusChangeCancel called");
  1951 	OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSIMPACKETSERVICE_NOTIFYSTATUSCHANGECANCEL_1, "CSimPacketService::NotifyStatusChangeCancel called");
  1946 	if(iNotifyStatusChange.iNotifyPending)
  1952 	if(iNotifyStatusChange.iNotifyPending)
  1947 		{
  1953 		{
  1948 		iNotifyStatusChange.iNotifyPending=EFalse;
  1954 		iNotifyStatusChange.iNotifyPending=EFalse;
  1949 		ReqCompleted(aTsyReqHandle,KErrCancel);
  1955 		ReqCompleted(aTsyReqHandle,KErrCancel);
  1950 		}
  1956 		}
  1965 * @param aTsyReqHandle Tsy Request handle for the client request
  1971 * @param aTsyReqHandle Tsy Request handle for the client request
  1966 * @param aStatus pointer to the packet service status
  1972 * @param aStatus pointer to the packet service status
  1967 * @return KErrNone
  1973 * @return KErrNone
  1968 */
  1974 */
  1969 	{
  1975 	{
  1970 	LOGPACKET1("CSimPacketService::NotifyContextActivationRequested called");
  1976 	OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSIMPACKETSERVICE_NOTIFYCONTEXTACTIVATIONREQUESTED_1, "CSimPacketService::NotifyContextActivationRequested called");
  1971 	
  1977 	
  1972 	iConfigData.iTsyReqHandle = aTsyReqHandle;
  1978 	iConfigData.iTsyReqHandle = aTsyReqHandle;
  1973 	iConfigData.iData = aContextParameters;
  1979 	iConfigData.iData = aContextParameters;
  1974 
  1980 
  1975 	if ( iIncomingContextManager->IsUseTimerOn() )
  1981 	if ( iIncomingContextManager->IsUseTimerOn() )
  1992 * 
  1998 * 
  1993 * @param aTsyReqHandle Tsy Request handle for the client cancel request
  1999 * @param aTsyReqHandle Tsy Request handle for the client cancel request
  1994 * @return KErrNone
  2000 * @return KErrNone
  1995 */
  2001 */
  1996 	{
  2002 	{
  1997 	LOGPACKET1("CSimPacketService::NotifyContextActivationRequestedCancel called");
  2003 	OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSIMPACKETSERVICE_NOTIFYCONTEXTACTIVATIONREQUESTEDCANCEL_1, "CSimPacketService::NotifyContextActivationRequestedCancel called");
  1998 
  2004 
  1999 	iIncomingContextManager->Cancel();	
  2005 	iIncomingContextManager->Cancel();	
  2000 	iIncomingContextManager->SetUseTimerOff();	
  2006 	iIncomingContextManager->SetUseTimerOff();	
  2001 	
  2007 	
  2002 	ReqCompleted(aTsyReqHandle, KErrNone);
  2008 	ReqCompleted(aTsyReqHandle, KErrNone);
  2039 * @param aCount pointer to the number of contexts opened.
  2045 * @param aCount pointer to the number of contexts opened.
  2040 * @param aMaxAllowed pointer to the maximum number of contexts that can be opened on the packet service
  2046 * @param aMaxAllowed pointer to the maximum number of contexts that can be opened on the packet service
  2041 * @return KErrNone
  2047 * @return KErrNone
  2042 */
  2048 */
  2043 	{
  2049 	{
  2044 	LOGPACKET1("CSimPacketService::EnumerateContexts called");
  2050 	OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSIMPACKETSERVICE_ENUMERATECONTEXTS_1, "CSimPacketService::EnumerateContexts called");
  2045 	// this should enumerate all primary and secondary contexts
  2051 	// this should enumerate all primary and secondary contexts
  2046 	*aCount = iPrimaryContextNameInc + iSecondaryContextNameInc;
  2052 	*aCount = iPrimaryContextNameInc + iSecondaryContextNameInc;
  2047 	*aMaxAllowed = KMaxContextPoolSize;
  2053 	*aMaxAllowed = KMaxContextPoolSize;
  2048 	ReqCompleted(aTsyReqHandle,KErrNone);
  2054 	ReqCompleted(aTsyReqHandle,KErrNone);
  2049 	return KErrNone;
  2055 	return KErrNone;
  2056 * 
  2062 * 
  2057 * @param aTsyReqHandle Tsy Request handle for the client cancel request
  2063 * @param aTsyReqHandle Tsy Request handle for the client cancel request
  2058 * @return KErrNone
  2064 * @return KErrNone
  2059 */
  2065 */
  2060 	{
  2066 	{
  2061 	LOGPACKET1("CSimPacketService::Enumerate Context Cancel called");
  2067 	OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSIMPACKETSERVICE_ENUMERATECONTEXTSCANCEL_1, "CSimPacketService::Enumerate Context Cancel called");
  2062 	return KErrNone;
  2068 	return KErrNone;
  2063 	}
  2069 	}
  2064 
  2070 
  2065 TInt CSimPacketService::GetContextInfo(const TTsyReqHandle aTsyReqHandle, TInt* aIndex,RPacketService::TContextInfo* aInfo)
  2071 TInt CSimPacketService::GetContextInfo(const TTsyReqHandle aTsyReqHandle, TInt* aIndex,RPacketService::TContextInfo* aInfo)
  2066 /**
  2072 /**
  2070 * @param aIndex pointer to the index of the context the info is requested from
  2076 * @param aIndex pointer to the index of the context the info is requested from
  2071 * @param aInfo pointer to the context info. 
  2077 * @param aInfo pointer to the context info. 
  2072 * @return KErrNone if context is found in the list of contexts 
  2078 * @return KErrNone if context is found in the list of contexts 
  2073 */
  2079 */
  2074 	{
  2080 	{
  2075 	LOGPACKET1("CSimPacketService::GetContextInfo called");
  2081 	OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSIMPACKETSERVICE_GETCONTEXTINFO_1, "CSimPacketService::GetContextInfo called");
  2076 	CSimPacketContext*  packetContext;
  2082 	CSimPacketContext*  packetContext;
  2077 
  2083 
  2078 	if((*aIndex >= iContextCount) || (*aIndex < 0))
  2084 	if((*aIndex >= iContextCount) || (*aIndex < 0))
  2079 		ReqCompleted(aTsyReqHandle,KErrArgument);
  2085 		ReqCompleted(aTsyReqHandle,KErrArgument);
  2080 	else {
  2086 	else {
  2123 * @param aTsyReqHandle Tsy Request handle for the client request
  2129 * @param aTsyReqHandle Tsy Request handle for the client request
  2124 * @param aRegistrationStatus pointer to the registration status info requested
  2130 * @param aRegistrationStatus pointer to the registration status info requested
  2125 * @return KErrNone 
  2131 * @return KErrNone 
  2126 */
  2132 */
  2127 	{
  2133 	{
  2128 	LOGPACKET1("CSimPacketService::GetNtwkRegStatus called");
  2134 	OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSIMPACKETSERVICE_GETNTWKREGSTATUS_1, "CSimPacketService::GetNtwkRegStatus called");
  2129 	*aRegistrationStatus = (RPacketService::TRegistrationStatus)iCurrentRegStatus;
  2135 	*aRegistrationStatus = (RPacketService::TRegistrationStatus)iCurrentRegStatus;
  2130 	ReqCompleted(aTsyReqHandle,KErrNone);
  2136 	ReqCompleted(aTsyReqHandle,KErrNone);
  2131 	return KErrNone;
  2137 	return KErrNone;
  2132 	}
  2138 	}
  2133 
  2139 
  2163 * 
  2169 * 
  2164 * @param aTsyReqHandle Tsy Request handle for the client cancel request
  2170 * @param aTsyReqHandle Tsy Request handle for the client cancel request
  2165 * @return KErrNone
  2171 * @return KErrNone
  2166 */
  2172 */
  2167 	{
  2173 	{
  2168 	LOGPACKET1("CSimPacketService::NotifyChangeOfNtwkRegStatusCancel called");
  2174 	OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSIMPACKETSERVICE_NOTIFYCHANGEOFNTWKREGSTATUSCANCEL_1, "CSimPacketService::NotifyChangeOfNtwkRegStatusCancel called");
  2169 	if(iNotifyChangeOfNtwk.iNotifyPending)
  2175 	if(iNotifyChangeOfNtwk.iNotifyPending)
  2170 		{
  2176 		{
  2171 		iNotifyChangeOfNtwk.iNotifyPending=EFalse;
  2177 		iNotifyChangeOfNtwk.iNotifyPending=EFalse;
  2172 		ReqCompleted(aTsyReqHandle,KErrCancel);
  2178 		ReqCompleted(aTsyReqHandle,KErrCancel);
  2173 		}
  2179 		}
  2269 * @param aCaps pointer to the TSY's capability
  2275 * @param aCaps pointer to the TSY's capability
  2270 * @param aPdpType protocol type used by the TSY
  2276 * @param aPdpType protocol type used by the TSY
  2271 * @return KErrNone
  2277 * @return KErrNone
  2272 */
  2278 */
  2273 	{
  2279 	{
  2274 	LOGPACKET1("CSimPacketService::GetStaticCaps called");
  2280 	OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSIMPACKETSERVICE_GETSTATICCAPS_1, "CSimPacketService::GetStaticCaps called");
  2275 	*aCaps = KPacketServiceCaps;
  2281 	*aCaps = KPacketServiceCaps;
  2276 	*aPdpType = RPacketContext::EPdpTypePPP;
  2282 	*aPdpType = RPacketContext::EPdpTypePPP;
  2277 	ReqCompleted(aTsyReqHandle,KErrNone);
  2283 	ReqCompleted(aTsyReqHandle,KErrNone);
  2278 	return KErrNone;
  2284 	return KErrNone;
  2279 	}
  2285 	}
  2285 * @param aCaps Pointer to be populated with the dynamic capabilities of the TSY
  2291 * @param aCaps Pointer to be populated with the dynamic capabilities of the TSY
  2286 * @return KErrNone
  2292 * @return KErrNone
  2287 */
  2293 */
  2288 TInt CSimPacketService::GetDynamicCaps(const TTsyReqHandle aTsyReqHandle, RPacketService::TDynamicCapsFlags* aCaps)
  2294 TInt CSimPacketService::GetDynamicCaps(const TTsyReqHandle aTsyReqHandle, RPacketService::TDynamicCapsFlags* aCaps)
  2289 	{
  2295 	{
  2290 	LOGPACKET1("CSimPacketService::GetDynamicCaps called");
  2296 	OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSIMPACKETSERVICE_GETDYNAMICCAPS_1, "CSimPacketService::GetDynamicCaps called");
  2291 	
  2297 	
  2292 	if (iDynamicCapsArray->Count() == 0)
  2298 	if (iDynamicCapsArray->Count() == 0)
  2293 		{
  2299 		{
  2294 		ReqCompleted(aTsyReqHandle, KErrNotSupported);
  2300 		ReqCompleted(aTsyReqHandle, KErrNotSupported);
  2295 		return KErrNone;
  2301 		return KErrNone;
  2306 * @param aCaps Pointer to be populated with the dynamic capabilities of the TSY
  2312 * @param aCaps Pointer to be populated with the dynamic capabilities of the TSY
  2307 * @return KErrNone
  2313 * @return KErrNone
  2308 */
  2314 */
  2309 TInt CSimPacketService::NotifyDynamicCapsChange(const TTsyReqHandle aTsyReqHandle, RPacketService::TDynamicCapsFlags* aCaps)
  2315 TInt CSimPacketService::NotifyDynamicCapsChange(const TTsyReqHandle aTsyReqHandle, RPacketService::TDynamicCapsFlags* aCaps)
  2310 	{
  2316 	{
  2311 	LOGPACKET1("CSimPacketService::NotifyDynamicCapsChange called");
  2317 	OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSIMPACKETSERVICE_NOTIFYDYNAMICCAPSCHANGE_1, "CSimPacketService::NotifyDynamicCapsChange called");
  2312 	__ASSERT_ALWAYS(!iNotifyDynamicCapsChange.iNotifyPending,SimPanic(ENotificationAlreadyPending));
  2318 	__ASSERT_ALWAYS(!iNotifyDynamicCapsChange.iNotifyPending,SimPanic(ENotificationAlreadyPending));
  2313  
  2319  
  2314 	if (iDynamicCapsArray->Count() == 0)
  2320 	if (iDynamicCapsArray->Count() == 0)
  2315 		{
  2321 		{
  2316 		ReqCompleted(aTsyReqHandle,KErrNotSupported);
  2322 		ReqCompleted(aTsyReqHandle,KErrNotSupported);
  2329 * @param aTsyReqHandle Tsy Request handle for the client cancel request
  2335 * @param aTsyReqHandle Tsy Request handle for the client cancel request
  2330 * @return KErrNone
  2336 * @return KErrNone
  2331 */
  2337 */
  2332 TInt CSimPacketService::NotifyDynamicCapsChangeCancel(const TTsyReqHandle aTsyReqHandle)
  2338 TInt CSimPacketService::NotifyDynamicCapsChangeCancel(const TTsyReqHandle aTsyReqHandle)
  2333 	{
  2339 	{
  2334 	LOGPACKET1("CSimPacketService::NotifyDynamicCapsChangeCancel called");
  2340 	OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSIMPACKETSERVICE_NOTIFYDYNAMICCAPSCHANGECANCEL_1, "CSimPacketService::NotifyDynamicCapsChangeCancel called");
  2335 	if( (iNotifyDynamicCapsChange.iNotifyPending) && (aTsyReqHandle == iNotifyDynamicCapsChange.iNotifyHandle))
  2341 	if( (iNotifyDynamicCapsChange.iNotifyPending) && (aTsyReqHandle == iNotifyDynamicCapsChange.iNotifyHandle))
  2336 		{
  2342 		{
  2337 		iNotifyDynamicCapsChange.iNotifyPending=EFalse;
  2343 		iNotifyDynamicCapsChange.iNotifyPending=EFalse;
  2338 		ReqCompleted(aTsyReqHandle,KErrCancel);
  2344 		ReqCompleted(aTsyReqHandle,KErrCancel);
  2339 		}
  2345 		}
  2368 * @param aTsyReqHandle Tsy Request handle for the client request
  2374 * @param aTsyReqHandle Tsy Request handle for the client request
  2369 * @param aMode pointer to the mode to change to
  2375 * @param aMode pointer to the mode to change to
  2370 * @return KErrNone 
  2376 * @return KErrNone 
  2371 */
  2377 */
  2372 	{
  2378 	{
  2373 	LOGPACKET1("CSimPacketService::SetAttachMode called");
  2379 	OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSIMPACKETSERVICE_SETATTACHMODE_1, "CSimPacketService::SetAttachMode called");
  2374 	if(*aMode != RPacketService::EAttachWhenNeeded)
  2380 	if(*aMode != RPacketService::EAttachWhenNeeded)
  2375 		{
  2381 		{
  2376 		ReqCompleted(aTsyReqHandle, KErrNotSupported);
  2382 		ReqCompleted(aTsyReqHandle, KErrNotSupported);
  2377 		}
  2383 		}
  2378 	else 
  2384 	else 
  2397 * @param aTsyReqHandle Tsy Request handle for the client request
  2403 * @param aTsyReqHandle Tsy Request handle for the client request
  2398 * @param aMode pointer to the mode to change
  2404 * @param aMode pointer to the mode to change
  2399 * @return KErrNone 
  2405 * @return KErrNone 
  2400 */
  2406 */
  2401 	{
  2407 	{
  2402 	LOGPACKET1("CSimPacketService::GetAttachMode called");
  2408 	OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSIMPACKETSERVICE_GETATTACHMODE_1, "CSimPacketService::GetAttachMode called");
  2403 	*aMode = iAttachMode;
  2409 	*aMode = iAttachMode;
  2404 	ReqCompleted(aTsyReqHandle,KErrNone);
  2410 	ReqCompleted(aTsyReqHandle,KErrNone);
  2405 	return KErrNone;
  2411 	return KErrNone;
  2406 	}
  2412 	}
  2407 	
  2413 	
  2412 * @param aTsyReqHandle Tsy Request handle for the client request
  2418 * @param aTsyReqHandle Tsy Request handle for the client request
  2413 * @param aMode pointer to the mode to change
  2419 * @param aMode pointer to the mode to change
  2414 * @return KErrNone 
  2420 * @return KErrNone 
  2415 */
  2421 */
  2416 	{
  2422 	{
  2417 	LOGPACKET1("CSimPacketService::NotifyAttachModeChange called");
  2423 	OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSIMPACKETSERVICE_NOTIFYATTACHMODECHANGE_1, "CSimPacketService::NotifyAttachModeChange called");
  2418 	
  2424 	
  2419 	__ASSERT_ALWAYS(!iNotifyChangeOfAttachMode.iNotifyPending,SimPanic(ENotificationAlreadyPending));
  2425 	__ASSERT_ALWAYS(!iNotifyChangeOfAttachMode.iNotifyPending,SimPanic(ENotificationAlreadyPending));
  2420 	
  2426 	
  2421 	iNotifyChangeOfAttachMode.iNotifyPending=ETrue;
  2427 	iNotifyChangeOfAttachMode.iNotifyPending=ETrue;
  2422 	iNotifyChangeOfAttachMode.iNotifyHandle=aTsyReqHandle;
  2428 	iNotifyChangeOfAttachMode.iNotifyHandle=aTsyReqHandle;
  2432 * @param aTsyReqHandle Tsy Request handle for the client request
  2438 * @param aTsyReqHandle Tsy Request handle for the client request
  2433 * @param aPckg pointer containing the parameters to set to.
  2439 * @param aPckg pointer containing the parameters to set to.
  2434 * @return KErrNone
  2440 * @return KErrNone
  2435 */
  2441 */
  2436 	{
  2442 	{
  2437 	LOGPACKET1("CSimPacketService::SetDefaultContextParams called");
  2443 	OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSIMPACKETSERVICE_SETDEFAULTCONTEXTPARAMS_1, "CSimPacketService::SetDefaultContextParams called");
  2438 	
  2444 	
  2439 	TPckg<TPacketDataConfigBase>* configBase = (TPckg<TPacketDataConfigBase>*)aPckg;
  2445 	TPckg<TPacketDataConfigBase>* configBase = (TPckg<TPacketDataConfigBase>*)aPckg;
  2440 	TPacketDataConfigBase& configBaseV1 = (*configBase)();
  2446 	TPacketDataConfigBase& configBaseV1 = (*configBase)();
  2441 
  2447 
  2442 		
  2448 		
  2614 * @param aTsyReqHandle Tsy Request handle for the client request
  2620 * @param aTsyReqHandle Tsy Request handle for the client request
  2615 * @param aPckg pointer containing the parameters to return to client.
  2621 * @param aPckg pointer containing the parameters to return to client.
  2616 * @return KErrNone
  2622 * @return KErrNone
  2617 */
  2623 */
  2618 	{
  2624 	{
  2619 	LOGPACKET1("CSimPacketService::GetDefaultContextParams called");
  2625 	OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSIMPACKETSERVICE_GETGPRSDEFAULTCONTEXTPARAMS_1, "CSimPacketService::GetDefaultContextParams called");
  2620 
  2626 
  2621 	TPckg<RPacketContext::TContextConfigGPRS>* contextConfigGPRSPckg = (TPckg<RPacketContext::TContextConfigGPRS>*)aPckg;
  2627 	TPckg<RPacketContext::TContextConfigGPRS>* contextConfigGPRSPckg = (TPckg<RPacketContext::TContextConfigGPRS>*)aPckg;
  2622 	RPacketContext::TContextConfigGPRS& contextConfigV1 = (*contextConfigGPRSPckg)();
  2628 	RPacketContext::TContextConfigGPRS& contextConfigV1 = (*contextConfigGPRSPckg)();
  2623 
  2629 
  2624 	contextConfigV1.iAccessPointName.Copy(KApn);
  2630 	contextConfigV1.iAccessPointName.Copy(KApn);
  2647 * @param aTsyReqHandle Tsy Request handle for the client request
  2653 * @param aTsyReqHandle Tsy Request handle for the client request
  2648 * @param aPckg pointer containing the parameters to return to client.
  2654 * @param aPckg pointer containing the parameters to return to client.
  2649 * @return KErrNone
  2655 * @return KErrNone
  2650 */
  2656 */
  2651 	{
  2657 	{
  2652 	LOGPACKET1("CSimPacketService::GetDefaultContextParams called");
  2658 	OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSIMPACKETSERVICE_GETDEFAULTCONTEXTPARAMS_1, "CSimPacketService::GetDefaultContextParams called");
  2653 	TPckg<TPacketDataConfigBase>* configBase = (TPckg<TPacketDataConfigBase>*)aPckg;
  2659 	TPckg<TPacketDataConfigBase>* configBase = (TPckg<TPacketDataConfigBase>*)aPckg;
  2654 	TPacketDataConfigBase& configBaseV1 = (*configBase)();
  2660 	TPacketDataConfigBase& configBaseV1 = (*configBase)();
  2655 
  2661 
  2656 	// GPRS
  2662 	// GPRS
  2657 	if(configBaseV1.ExtensionId()==TPacketDataConfigBase::KConfigGPRS)
  2663 	if(configBaseV1.ExtensionId()==TPacketDataConfigBase::KConfigGPRS)
  2744 * function for further processing.
  2750 * function for further processing.
  2745 *
  2751 *
  2746 * @param aId an id identifying which timer callback is being called
  2752 * @param aId an id identifying which timer callback is being called
  2747 */
  2753 */
  2748 	{
  2754 	{
  2749 	LOGPACKET1(">>CSimPacketService::TimerCallBack");
  2755 	OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSIMPACKETSERVICE_TIMERCALLBACK_1, ">>CSimPacketService::TimerCallBack");
  2750 
  2756 
  2751 	if(aId == ETimerIdPcktServPacket)
  2757 	if(aId == ETimerIdPcktServPacket)
  2752 		{
  2758 		{
  2753 		TimerCallBackPcktRegStatus();
  2759 		TimerCallBackPcktRegStatus();
  2754 		}
  2760 		}
  2817 	else
  2823 	else
  2818 		{
  2824 		{
  2819 		TInt ret = ActionEvent(EPacketEventTimeOut);
  2825 		TInt ret = ActionEvent(EPacketEventTimeOut);
  2820 		__ASSERT_ALWAYS(ret==KErrNone,SimPanic(ETimeOutEventActionFailed));	// Note: this is very crude error handling and should be replaced by something rather more elegant.
  2826 		__ASSERT_ALWAYS(ret==KErrNone,SimPanic(ETimeOutEventActionFailed));	// Note: this is very crude error handling and should be replaced by something rather more elegant.
  2821 		}
  2827 		}
  2822 	LOGPACKET1("<<CSimPacketService::TimerCallBack");
  2828 	OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSIMPACKETSERVICE_TIMERCALLBACK_2, "<<CSimPacketService::TimerCallBack");
  2823 	}
  2829 	}
  2824 
  2830 
  2825 void CSimPacketService::TimerCallBackDeactivate()
  2831 void CSimPacketService::TimerCallBackDeactivate()
  2826 {
  2832 {
  2827 	// deactivate all contexts in every nif
  2833 	// deactivate all contexts in every nif
  2916 		iIncomingContextManager->SetUseTimerOn();								
  2922 		iIncomingContextManager->SetUseTimerOn();								
  2917 			// May get more timeouts for other primary PDP's.
  2923 			// May get more timeouts for other primary PDP's.
  2918 		}
  2924 		}
  2919 	else
  2925 	else
  2920 		{  // Error. Some sort of stange request. Hopefully impossible.
  2926 		{  // Error. Some sort of stange request. Hopefully impossible.
  2921 		LOGPACKET1("CSimPacketService::SimPSEvent property mismatch.");
  2927 		OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSIMPACKETSERVICE_SIMPSEVENT_1, "CSimPacketService::SimPSEvent property mismatch.");
  2922 		SimPanic(EFailedToSetProperty);
  2928 		SimPanic(EFailedToSetProperty);
  2923 		}
  2929 		}
  2924 	
  2930 	
  2925 	}
  2931 	}
  2926 
  2932 
  3012 *
  3018 *
  3013 * @param aState the new state to change to
  3019 * @param aState the new state to change to
  3014 * @return Error indication if change of state is successful or not
  3020 * @return Error indication if change of state is successful or not
  3015 */
  3021 */
  3016 	{
  3022 	{
  3017 	LOGPACKET2(">>CSimPacketService::ChangeState [newState=%d]", aNewState);
  3023 	OstTraceDef1(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSIMPACKETSERVICE_CHANGESTATE_1, ">>CSimPacketService::ChangeState [newState=%d]", aNewState);
  3018 	if(iState == aNewState)
  3024 	if(iState == aNewState)
  3019 		return KErrNone;
  3025 		return KErrNone;
  3020 
  3026 
  3021 	TInt ret=KErrGeneral;
  3027 	TInt ret=KErrGeneral;
  3022 	const TPacketStateChangeValidity* stateChangePnt=KPacketStateChangeValidity;
  3028 	const TPacketStateChangeValidity* stateChangePnt=KPacketStateChangeValidity;
  3066 		iNotifyStatusChange.iNotifyPending=EFalse;
  3072 		iNotifyStatusChange.iNotifyPending=EFalse;
  3067 		*(RPacketService::TStatus*)iNotifyStatusChange.iNotifyData=iState;
  3073 		*(RPacketService::TStatus*)iNotifyStatusChange.iNotifyData=iState;
  3068 		ReqCompleted(iNotifyStatusChange.iNotifyHandle,KErrNone);
  3074 		ReqCompleted(iNotifyStatusChange.iNotifyHandle,KErrNone);
  3069 		}
  3075 		}
  3070 
  3076 
  3071 	LOGPACKET1("<<CSimPacketService::ChangeState");
  3077 	OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSIMPACKETSERVICE_CHANGESTATE_2, "<<CSimPacketService::ChangeState");
  3072 	return KErrNone;
  3078 	return KErrNone;
  3073 	}
  3079 	}
  3074 
  3080 
  3075 TInt CSimPacketService::ActionEvent(TPacketEvent aEvent)
  3081 TInt CSimPacketService::ActionEvent(TPacketEvent aEvent)
  3076 /**
  3082 /**
  3086 	TInt ret=KErrNone;
  3092 	TInt ret=KErrNone;
  3087 
  3093 
  3088 	switch(aEvent)
  3094 	switch(aEvent)
  3089 		{
  3095 		{
  3090 	case EPacketEventAttach:
  3096 	case EPacketEventAttach:
  3091 		LOGPACKET1(">>CSimPacketService::ActionEvent = [EPacketEventAttach]");
  3097 		OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSIMPACKETSERVICE_ACTIONEVENT_1, ">>CSimPacketService::ActionEvent = [EPacketEventAttach]");
  3092 		if(iState==RPacketService::EStatusUnattached)
  3098 		if(iState==RPacketService::EStatusUnattached)
  3093 			{
  3099 			{
  3094 			iCurrentEvent=EPacketEventAttach;
  3100 			iCurrentEvent=EPacketEventAttach;
  3095 			iTimer->Start(iAttachPause,this);
  3101 			iTimer->Start(iAttachPause,this);
  3096 			}
  3102 			}
  3097 		else
  3103 		else
  3098 			ReqCompleted(iAttachRequestHandle, KErrNone);
  3104 			ReqCompleted(iAttachRequestHandle, KErrNone);
  3099 		break;
  3105 		break;
  3100 
  3106 
  3101 	case EPacketEventDetach:
  3107 	case EPacketEventDetach:
  3102 		LOGPACKET1(">>CSimPacketService::ActionEvent = [EPacketEventDetach]");
  3108 		OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSIMPACKETSERVICE_ACTIONEVENT_2, ">>CSimPacketService::ActionEvent = [EPacketEventDetach]");
  3103 		if(iState !=RPacketService::EStatusUnattached)
  3109 		if(iState !=RPacketService::EStatusUnattached)
  3104 			{
  3110 			{
  3105 			iCurrentEvent=EPacketEventDetach;
  3111 			iCurrentEvent=EPacketEventDetach;
  3106 			iTimer->Start(iDetachPause,this);
  3112 			iTimer->Start(iDetachPause,this);
  3107 			}
  3113 			}
  3204 	}
  3210 	}
  3205 
  3211 
  3206 TInt CSimPacketService::GetCurrentReleaseMode(const TTsyReqHandle aTsyReqHandle,RPacketService::TPacketReleaseMode* aReleaseMode)
  3212 TInt CSimPacketService::GetCurrentReleaseMode(const TTsyReqHandle aTsyReqHandle,RPacketService::TPacketReleaseMode* aReleaseMode)
  3207 // return current release mode
  3213 // return current release mode
  3208 	{
  3214 	{
  3209 	LOGPACKET1("CSimPacketService::GetCurrentReleaseMode called");
  3215 	OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSIMPACKETSERVICE_GETCURRENTRELEASEMODE_1, "CSimPacketService::GetCurrentReleaseMode called");
  3210 	*aReleaseMode = (RPacketService::TPacketReleaseMode)iCurrentPacketReleaseMode;
  3216 	*aReleaseMode = (RPacketService::TPacketReleaseMode)iCurrentPacketReleaseMode;
  3211 	ReqCompleted(aTsyReqHandle, KErrNone);
  3217 	ReqCompleted(aTsyReqHandle, KErrNone);
  3212 	return KErrNone;
  3218 	return KErrNone;
  3213 	}
  3219 	}
  3214 	
  3220 	
  3346 /**
  3352 /**
  3347 * Cancel method, returns KErrNone
  3353 * Cancel method, returns KErrNone
  3348 */
  3354 */
  3349 TInt CSimPacketService::NotifyReleaseModeChangeCancel(const TTsyReqHandle aTsyReqHandle)
  3355 TInt CSimPacketService::NotifyReleaseModeChangeCancel(const TTsyReqHandle aTsyReqHandle)
  3350 	{
  3356 	{
  3351 	LOGPACKET1("CSimPacketService::NotifyChangeOfNtwkRegStatusCancel called");
  3357 	OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSIMPACKETSERVICE_NOTIFYRELEASEMODECHANGECANCEL_1, "CSimPacketService::NotifyChangeOfNtwkRegStatusCancel called");
  3352 	if(iNotifyChangeOfReleaseMode.iNotifyPending)
  3358 	if(iNotifyChangeOfReleaseMode.iNotifyPending)
  3353 		{
  3359 		{
  3354 		iNotifyChangeOfReleaseMode.iNotifyPending=EFalse;
  3360 		iNotifyChangeOfReleaseMode.iNotifyPending=EFalse;
  3355 		ReqCompleted(aTsyReqHandle,KErrCancel);
  3361 		ReqCompleted(aTsyReqHandle,KErrCancel);
  3356 		}
  3362 		}
  3392 /**
  3398 /**
  3393 * Cancel method, returns KErrNone
  3399 * Cancel method, returns KErrNone
  3394 */
  3400 */
  3395 TInt CSimPacketService::NotifyAttachModeChangeCancel(const TTsyReqHandle aTsyReqHandle)
  3401 TInt CSimPacketService::NotifyAttachModeChangeCancel(const TTsyReqHandle aTsyReqHandle)
  3396 	{
  3402 	{
  3397 	LOGPACKET1("CSimPacketService::NotifyAttachModeChangeCancel called");
  3403 	OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSIMPACKETSERVICE_NOTIFYATTACHMODECHANGECANCEL_1, "CSimPacketService::NotifyAttachModeChangeCancel called");
  3398 	if(iNotifyChangeOfAttachMode.iNotifyPending)
  3404 	if(iNotifyChangeOfAttachMode.iNotifyPending)
  3399 		{
  3405 		{
  3400 		iNotifyChangeOfAttachMode.iNotifyPending=EFalse;
  3406 		iNotifyChangeOfAttachMode.iNotifyPending=EFalse;
  3401 		ReqCompleted(aTsyReqHandle,KErrCancel);
  3407 		ReqCompleted(aTsyReqHandle,KErrCancel);
  3402 		}
  3408 		}
  3410 * @param aTsyReqHandle Tsy Request handle for the client request
  3416 * @param aTsyReqHandle Tsy Request handle for the client request
  3411 * @param aStatus pointer to the status
  3417 * @param aStatus pointer to the status
  3412 * @return TInt err KErrNone if ok
  3418 * @return TInt err KErrNone if ok
  3413 */
  3419 */
  3414 	{
  3420 	{
  3415 	LOGPACKET1("CSimPacketService::GetMbmsNetworkServiceStatus called");
  3421 	OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSIMPACKETSERVICE_GETMBMSNETWORKSERVICESTATUS_1, "CSimPacketService::GetMbmsNetworkServiceStatus called");
  3416 	*aStatus = (iMbmsBroadcastParamsArray->At(iCurrentMbmsParamsIndex).iMbmsNetworkStatus);
  3422 	*aStatus = (iMbmsBroadcastParamsArray->At(iCurrentMbmsParamsIndex).iMbmsNetworkStatus);
  3417 	if(aAttemptAttach)
  3423 	if(aAttemptAttach)
  3418 		{
  3424 		{
  3419 		if(*aStatus == EMbmsSupportUnknown)
  3425 		if(*aStatus == EMbmsSupportUnknown)
  3420 			{
  3426 			{
  3458 * @param aTsyReqHandle Tsy Request handle for the client request
  3464 * @param aTsyReqHandle Tsy Request handle for the client request
  3459 * @param aStatus pointer to the mbms packet service status
  3465 * @param aStatus pointer to the mbms packet service status
  3460 * @return KErrNone
  3466 * @return KErrNone
  3461 */
  3467 */
  3462 	{
  3468 	{
  3463 	LOGPACKET1("CSimPacketService::NotifyMbmsNetworkServiceStatusChange called");
  3469 	OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSIMPACKETSERVICE_NOTIFYMBMSNETWORKSERVICESTATUSCHANGE_1, "CSimPacketService::NotifyMbmsNetworkServiceStatusChange called");
  3464  	__ASSERT_ALWAYS(!iNotifyMbmsNetworkStatusChange.iNotifyPending,SimPanic(ENotificationAlreadyPending));
  3470  	__ASSERT_ALWAYS(!iNotifyMbmsNetworkStatusChange.iNotifyPending,SimPanic(ENotificationAlreadyPending));
  3465 
  3471 
  3466  	iNotifyMbmsNetworkStatusChange.iNotifyPending = ETrue;
  3472  	iNotifyMbmsNetworkStatusChange.iNotifyPending = ETrue;
  3467 	iNotifyMbmsNetworkStatusChange.iNotifyHandle = aTsyReqHandle;
  3473 	iNotifyMbmsNetworkStatusChange.iNotifyHandle = aTsyReqHandle;
  3468  	iNotifyMbmsNetworkStatusChange.iNotifyData = aStatus;
  3474  	iNotifyMbmsNetworkStatusChange.iNotifyData = aStatus;
  3476 * 
  3482 * 
  3477 * @param aTsyReqHandle Tsy Request handle for the client cancel request
  3483 * @param aTsyReqHandle Tsy Request handle for the client cancel request
  3478 * @return KErrNone
  3484 * @return KErrNone
  3479 */
  3485 */
  3480 	{
  3486 	{
  3481 	LOGPACKET1("CSimPacketService::NotifyMbmsNetworkServiceStatusChangeCancel called");
  3487 	OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSIMPACKETSERVICE_NOTIFYMBMSNETWORKSERVICESTATUSCHANGECANCEL_1, "CSimPacketService::NotifyMbmsNetworkServiceStatusChangeCancel called");
  3482 	if(iNotifyMbmsNetworkStatusChange.iNotifyPending)
  3488 	if(iNotifyMbmsNetworkStatusChange.iNotifyPending)
  3483 		{
  3489 		{
  3484 		iNotifyMbmsNetworkStatusChange.iNotifyPending=EFalse;
  3490 		iNotifyMbmsNetworkStatusChange.iNotifyPending=EFalse;
  3485 		ReqCompleted(aTsyReqHandle,KErrCancel);
  3491 		ReqCompleted(aTsyReqHandle,KErrCancel);
  3486 		}
  3492 		}
  3496 *
  3502 *
  3497 * @param aTsyReqHandle Tsy Request handle for the client request
  3503 * @param aTsyReqHandle Tsy Request handle for the client request
  3498 * @return KErrNone
  3504 * @return KErrNone
  3499 */
  3505 */
  3500 	{
  3506 	{
  3501 	LOGPACKET1("CSimPacketService::NotifyMbmsServiceAvailabilityChange called");
  3507 	OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSIMPACKETSERVICE_NOTIFYMBMSSERVICEAVAILABILITYCHANGE_1, "CSimPacketService::NotifyMbmsServiceAvailabilityChange called");
  3502  	__ASSERT_ALWAYS(!iNotifyMbmsNetworkStatusChange.iNotifyPending,SimPanic(ENotificationAlreadyPending));
  3508  	__ASSERT_ALWAYS(!iNotifyMbmsNetworkStatusChange.iNotifyPending,SimPanic(ENotificationAlreadyPending));
  3503 
  3509 
  3504  	iNotifyMbmsServAvailChange.iNotifyPending = ETrue;
  3510  	iNotifyMbmsServAvailChange.iNotifyPending = ETrue;
  3505  	iNotifyMbmsServAvailChange.iNotifyHandle = aTsyReqHandle;
  3511  	iNotifyMbmsServAvailChange.iNotifyHandle = aTsyReqHandle;
  3506  	(void)iNotifyMbmsServAvailChange.iNotifyData;
  3512  	(void)iNotifyMbmsServAvailChange.iNotifyData;
  3514 * 
  3520 * 
  3515 * @param aTsyReqHandle Tsy Request handle for the client cancel request
  3521 * @param aTsyReqHandle Tsy Request handle for the client cancel request
  3516 * @return KErrNone
  3522 * @return KErrNone
  3517 */
  3523 */
  3518 	{
  3524 	{
  3519 	LOGPACKET1("CSimPacketService::NotifyMbmsServiceAvailabilityChangeCancel called");
  3525 	OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSIMPACKETSERVICE_NOTIFYMBMSSERVICEAVAILABILITYCHANGECANCEL_1, "CSimPacketService::NotifyMbmsServiceAvailabilityChangeCancel called");
  3520 	if(iNotifyMbmsServAvailChange.iNotifyPending)
  3526 	if(iNotifyMbmsServAvailChange.iNotifyPending)
  3521 		{
  3527 		{
  3522 		iNotifyMbmsServAvailChange.iNotifyPending=EFalse;
  3528 		iNotifyMbmsServAvailChange.iNotifyPending=EFalse;
  3523 		ReqCompleted(aTsyReqHandle,KErrCancel);
  3529 		ReqCompleted(aTsyReqHandle,KErrCancel);
  3524 		}
  3530 		}
  3535 * @param aAction TMbmsAction to be performed
  3541 * @param aAction TMbmsAction to be performed
  3536 * @param aBuffer list of TMbmsServiceAvailabilityV1 class passed.
  3542 * @param aBuffer list of TMbmsServiceAvailabilityV1 class passed.
  3537 * @return KErrNone
  3543 * @return KErrNone
  3538 */
  3544 */
  3539 	{
  3545 	{
  3540 	LOGPACKET1("CSimPacketService::UpdateMbmsMonitorServiceListL called");
  3546 	OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSIMPACKETSERVICE_UPDATEMBMSMONITORSERVICELISTL_1, "CSimPacketService::UpdateMbmsMonitorServiceListL called");
  3541 	CPcktMbmsMonitoredServiceList* monServList = CPcktMbmsMonitoredServiceList::NewL();
  3547 	CPcktMbmsMonitoredServiceList* monServList = CPcktMbmsMonitoredServiceList::NewL();
  3542 	CleanupStack::PushL(monServList); 
  3548 	CleanupStack::PushL(monServList); 
  3543 
  3549 
  3544 	TInt error=KErrNone;
  3550 	TInt error=KErrNone;
  3545 	TInt i=0;
  3551 	TInt i=0;
  3550 	RPacketService::TMbmsServiceAvailabilityV1 entry;
  3556 	RPacketService::TMbmsServiceAvailabilityV1 entry;
  3551 	
  3557 	
  3552 	switch(*aAction)
  3558 	switch(*aAction)
  3553 		{
  3559 		{
  3554 		case SIMTSY_PACKET_MBMS_ADD_ENTRIES:
  3560 		case SIMTSY_PACKET_MBMS_ADD_ENTRIES:
  3555 			LOGPACKET1("CSimPacketService::UpdateMbmsMonitorServiceListL Action: ADD ");
  3561 			OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSIMPACKETSERVICE_UPDATEMBMSMONITORSERVICELISTL_2, "CSimPacketService::UpdateMbmsMonitorServiceListL Action: ADD ");
  3556 			monServList->RestoreL(*aBuffer);
  3562 			monServList->RestoreL(*aBuffer);
  3557 			countAdd = monServList->Enumerate();
  3563 			countAdd = monServList->Enumerate();
  3558 			if(countAdd != SIMTSY_PACKET_MBMS_ADD_ENTRIES_COUNT)
  3564 			if(countAdd != SIMTSY_PACKET_MBMS_ADD_ENTRIES_COUNT)
  3559 				{
  3565 				{
  3560 				ReqCompleted(aTsyReqHandle,KErrCorrupt);
  3566 				ReqCompleted(aTsyReqHandle,KErrCorrupt);
  3604 			ReqCompleted(aTsyReqHandle, error);
  3610 			ReqCompleted(aTsyReqHandle, error);
  3605 			CleanupStack::PopAndDestroy(); // monServList
  3611 			CleanupStack::PopAndDestroy(); // monServList
  3606 			break;
  3612 			break;
  3607 
  3613 
  3608 		case SIMTSY_PACKET_MBMS_REM_ENTRIES:
  3614 		case SIMTSY_PACKET_MBMS_REM_ENTRIES:
  3609 			LOGPACKET1("CSimPacketService::UpdateMbmsMonitorServiceListL Action: REMOVE ");
  3615 			OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSIMPACKETSERVICE_UPDATEMBMSMONITORSERVICELISTL_3, "CSimPacketService::UpdateMbmsMonitorServiceListL Action: REMOVE ");
  3610 			monServList->RestoreL(*aBuffer);
  3616 			monServList->RestoreL(*aBuffer);
  3611 			countRem = monServList->Enumerate();
  3617 			countRem = monServList->Enumerate();
  3612 			if(countRem != SIMTSY_PACKET_MBMS_REM_ENTRIES_COUNT)
  3618 			if(countRem != SIMTSY_PACKET_MBMS_REM_ENTRIES_COUNT)
  3613 				{
  3619 				{
  3614 				ReqCompleted(aTsyReqHandle,KErrCorrupt);
  3620 				ReqCompleted(aTsyReqHandle,KErrCorrupt);
  3670 			break;
  3676 			break;
  3671 			
  3677 			
  3672 		case SIMTSY_PACKET_MBMS_REM_ALL_ENTRIES:
  3678 		case SIMTSY_PACKET_MBMS_REM_ALL_ENTRIES:
  3673 			iMbmsMonitorListCount = 0;
  3679 			iMbmsMonitorListCount = 0;
  3674 			iMbmsMonitorListParamsArray->Delete(0,iMbmsMonitorListParamsArray->Count());
  3680 			iMbmsMonitorListParamsArray->Delete(0,iMbmsMonitorListParamsArray->Count());
  3675 			LOGPACKET1("CSimPacketService::UpdateMbmsMonitorServiceListL Action: REMOVE_ALL ");
  3681 			OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSIMPACKETSERVICE_UPDATEMBMSMONITORSERVICELISTL_4, "CSimPacketService::UpdateMbmsMonitorServiceListL Action: REMOVE_ALL ");
  3676 			iUpdateMbmsServiceError = KErrNone;
  3682 			iUpdateMbmsServiceError = KErrNone;
  3677 			iUpdateMbmsServiceReqHandle = aTsyReqHandle;
  3683 			iUpdateMbmsServiceReqHandle = aTsyReqHandle;
  3678 			CleanupStack::PopAndDestroy(); // monServList
  3684 			CleanupStack::PopAndDestroy(); // monServList
  3679 			break;
  3685 			break;
  3680 			
  3686 			
  3681 		default:
  3687 		default:
  3682 			LOGPACKET1("CSimPacketService::UpdateMbmsMonitorServiceListL Action: Default ");
  3688 			OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSIMPACKETSERVICE_UPDATEMBMSMONITORSERVICELISTL_5, "CSimPacketService::UpdateMbmsMonitorServiceListL Action: Default ");
  3683 			ReqCompleted(aTsyReqHandle,KErrNotFound);
  3689 			ReqCompleted(aTsyReqHandle,KErrNotFound);
  3684 			CleanupStack::PopAndDestroy(); // monServList
  3690 			CleanupStack::PopAndDestroy(); // monServList
  3685 			break;
  3691 			break;
  3686 		}
  3692 		}
  3687 	return KErrNone;
  3693 	return KErrNone;
  3693 * 
  3699 * 
  3694 * @param aTsyReqHandle Tsy Request handle for the client cancel request
  3700 * @param aTsyReqHandle Tsy Request handle for the client cancel request
  3695 * @return KErrNone
  3701 * @return KErrNone
  3696 */
  3702 */
  3697 	{
  3703 	{
  3698 	LOGPACKET1("CSimPacketService::UpdateMbmsMonitorServiceListCancel Called ");
  3704 	OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSIMPACKETSERVICE_UPDATEMBMSMONITORSERVICELISTCANCEL_1, "CSimPacketService::UpdateMbmsMonitorServiceListCancel Called ");
  3699 	ReqCompleted(aTsyReqHandle,KErrCancel);
  3705 	ReqCompleted(aTsyReqHandle,KErrCancel);
  3700 	return KErrNone;
  3706 	return KErrNone;
  3701 	}
  3707 	}
  3702 
  3708 
  3703 // CHANGES FOR 2 Phase retrieval of MBMS Monitored Services list starts here.
  3709 // CHANGES FOR 2 Phase retrieval of MBMS Monitored Services list starts here.
  3711 * @param aAction TClientId to be used
  3717 * @param aAction TClientId to be used
  3712 * @param aBufSize Size to be allocated for retrieving the actual list in second phase.
  3718 * @param aBufSize Size to be allocated for retrieving the actual list in second phase.
  3713 * @return KErrNone
  3719 * @return KErrNone
  3714 */
  3720 */
  3715 	{
  3721 	{
  3716 	LOGPACKET1("CSimPacketService::GetMbmsMonitoredServicesListPhase1 called");
  3722 	OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSIMPACKETSERVICE_GETMBMSMONITOREDSERVICESLISTPHASE1_1, "CSimPacketService::GetMbmsMonitoredServicesListPhase1 called");
  3717 	TInt ret=KErrNone;
  3723 	TInt ret=KErrNone;
  3718 	TInt leaveCode=KErrNone;
  3724 	TInt leaveCode=KErrNone;
  3719 	TRAP(leaveCode, ret=ProcessGetMbmsMonitoredServicesListPhase1L(aTsyReqHandle, aClient, aBufSize););
  3725 	TRAP(leaveCode, ret=ProcessGetMbmsMonitoredServicesListPhase1L(aTsyReqHandle, aClient, aBufSize););
  3720 	if (leaveCode != KErrNone)
  3726 	if (leaveCode != KErrNone)
  3721 		{
  3727 		{
  3735 * @param aBufSize Size to be allocated for retrieving the actual list in second phase.
  3741 * @param aBufSize Size to be allocated for retrieving the actual list in second phase.
  3736 * @return KErrNone
  3742 * @return KErrNone
  3737 */
  3743 */
  3738 	{
  3744 	{
  3739 	
  3745 	
  3740 	LOGPACKET1("CSimPacketService::ProcessGetMbmsMonitoredServicesListPhase1L called");
  3746 	OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSIMPACKETSERVICE_PROCESSGETMBMSMONITOREDSERVICESLISTPHASE1L_1, "CSimPacketService::ProcessGetMbmsMonitoredServicesListPhase1L called");
  3741 	CPcktMbmsMonitoredServiceList* list=CPcktMbmsMonitoredServiceList::NewL();
  3747 	CPcktMbmsMonitoredServiceList* list=CPcktMbmsMonitoredServiceList::NewL();
  3742 	CleanupStack::PushL(list);
  3748 	CleanupStack::PushL(list);
  3743 
  3749 
  3744 	RPacketService::TMbmsServiceAvailabilityV1 entry;
  3750 	RPacketService::TMbmsServiceAvailabilityV1 entry;
  3745 	
  3751 	
  3750 			entry.iMbmsAvailabilityStatus = iMbmsMonitorListParamsArray->At(i).iAvailStatus;
  3756 			entry.iMbmsAvailabilityStatus = iMbmsMonitorListParamsArray->At(i).iAvailStatus;
  3751 			entry.iTmgi.SetMCC(iMbmsMonitorListParamsArray->At(i).iMCC);
  3757 			entry.iTmgi.SetMCC(iMbmsMonitorListParamsArray->At(i).iMCC);
  3752 			entry.iTmgi.SetMNC(iMbmsMonitorListParamsArray->At(i).iMNC);
  3758 			entry.iTmgi.SetMNC(iMbmsMonitorListParamsArray->At(i).iMNC);
  3753 			entry.iTmgi.SetServiceId(iMbmsMonitorListParamsArray->At(i).iServiceId);
  3759 			entry.iTmgi.SetServiceId(iMbmsMonitorListParamsArray->At(i).iServiceId);
  3754 			// Add the entry into the list, at the next empty location
  3760 			// Add the entry into the list, at the next empty location
  3755 			LOGPACKET2("Adding the Entry no. %d to the List",i+1);
  3761 			OstTraceDef1(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSIMPACKETSERVICE_PROCESSGETMBMSMONITOREDSERVICESLISTPHASE1L_2, "Adding the Entry no. %d to the List",i+1);
  3756 			list->AddEntryL(entry);
  3762 			list->AddEntryL(entry);
  3757 		}
  3763 		}
  3758 	
  3764 	
  3759 	// Store the  streamed list and the client ID
  3765 	// Store the  streamed list and the client ID
  3760 	CPcktListReadAllAttempt* read=CPcktListReadAllAttempt::NewL(*aClient,aTsyReqHandle);
  3766 	CPcktListReadAllAttempt* read=CPcktListReadAllAttempt::NewL(*aClient,aTsyReqHandle);
  3785 * @param aAction TClientId to be used
  3791 * @param aAction TClientId to be used
  3786 * @param aBuf buffer for the actual list to be populated.
  3792 * @param aBuf buffer for the actual list to be populated.
  3787 * @return KErrNone
  3793 * @return KErrNone
  3788 */
  3794 */
  3789 	{
  3795 	{
  3790 	LOGPACKET1("CSimPacketService::GetMbmsMonitoredServicesListPhase2 called");
  3796 	OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSIMPACKETSERVICE_GETMBMSMONITOREDSERVICESLISTPHASE2_1, "CSimPacketService::GetMbmsMonitoredServicesListPhase2 called");
  3791 	CPcktListReadAllAttempt* read=NULL;
  3797 	CPcktListReadAllAttempt* read=NULL;
  3792 	// Find the get MBMS Monitor Service List from this client
  3798 	// Find the get MBMS Monitor Service List from this client
  3793 	for (TInt i=0; i<iMbmsServicesList->Count(); ++i)
  3799 	for (TInt i=0; i<iMbmsServicesList->Count(); ++i)
  3794 		{
  3800 		{
  3795 		read = iMbmsServicesList->At(i);
  3801 		read = iMbmsServicesList->At(i);
  3816 * 
  3822 * 
  3817 * @param aTsyReqHandle Tsy Request handle for the client cancel request
  3823 * @param aTsyReqHandle Tsy Request handle for the client cancel request
  3818 * @return KErrNone
  3824 * @return KErrNone
  3819 */
  3825 */
  3820 	{
  3826 	{
  3821 	LOGPACKET1("CSimPacketService::GetMbmsMonitoredServicesListCancel called");
  3827 	OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSIMPACKETSERVICE_GETMBMSMONITOREDSERVICESLISTCANCEL_1, "CSimPacketService::GetMbmsMonitoredServicesListCancel called");
  3822 	// Remove the read all attempt from iGetMbmsMonitoredServices
  3828 	// Remove the read all attempt from iGetMbmsMonitoredServices
  3823 
  3829 
  3824 	CPcktListReadAllAttempt* read=NULL;
  3830 	CPcktListReadAllAttempt* read=NULL;
  3825 	for (TInt i=0; i<iMbmsServicesList->Count(); ++i)
  3831 	for (TInt i=0; i<iMbmsServicesList->Count(); ++i)
  3826 		{
  3832 		{
  3844 * @param aCount count of the MBMS monitoring services in the list
  3850 * @param aCount count of the MBMS monitoring services in the list
  3845 * @param aMaxAllowed maximum MBMS monitoring services allowed
  3851 * @param aMaxAllowed maximum MBMS monitoring services allowed
  3846 * @return KErrNone
  3852 * @return KErrNone
  3847 */
  3853 */
  3848 	{
  3854 	{
  3849 	LOGPACKET1("CSimPacketService::EnumerateMbmsMonitorServiceList called");
  3855 	OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSIMPACKETSERVICE_ENUMERATEMBMSMONITORSERVICELIST_1, "CSimPacketService::EnumerateMbmsMonitorServiceList called");
  3850 	*aCount = iMbmsMonitorListCount;
  3856 	*aCount = iMbmsMonitorListCount;
  3851 	*aMaxAllowed = KMaxMbmsMonitorContexts;
  3857 	*aMaxAllowed = KMaxMbmsMonitorContexts;
  3852 	iEnumerateMonitorListReqHandle = aTsyReqHandle;
  3858 	iEnumerateMonitorListReqHandle = aTsyReqHandle;
  3853 	return KErrNone;
  3859 	return KErrNone;
  3854 	}
  3860 	}
  3881 * @param aCount count of the MBMS active services in the list
  3887 * @param aCount count of the MBMS active services in the list
  3882 * @param aMaxAllowed maximum MBMS active services allowed
  3888 * @param aMaxAllowed maximum MBMS active services allowed
  3883 * @return KErrNone
  3889 * @return KErrNone
  3884 */
  3890 */
  3885 	{
  3891 	{
  3886 	LOGPACKET1("CSimPacketService::EnumerateMbmsActiveServiceList called");
  3892 	OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSIMPACKETSERVICE_ENUMERATEMBMSACTIVESERVICELIST_1, "CSimPacketService::EnumerateMbmsActiveServiceList called");
  3887 	*aCount = iMbmsNifWrappers.Count(); // The NifWrapper contains the list of mbmsContexts that are activated.
  3893 	*aCount = iMbmsNifWrappers.Count(); // The NifWrapper contains the list of mbmsContexts that are activated.
  3888 	*aMaxAllowed = KMaxMbmsActiveContexts;
  3894 	*aMaxAllowed = KMaxMbmsActiveContexts;
  3889 	iEnumerateActiveListReqHandle = aTsyReqHandle;
  3895 	iEnumerateActiveListReqHandle = aTsyReqHandle;
  3890 	return KErrNone;
  3896 	return KErrNone;
  3891 	}
  3897 	}