telephonyserver/etelmultimode/CETEL/mm_retrieve.cpp
changeset 0 3553901f7fa8
equal deleted inserted replaced
-1:000000000000 0:3553901f7fa8
       
     1 // Copyright (c) 2000-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 // This file contains all the code for the retrieval classes defined in the api which
       
    15 // retrieve variable length buffers from the TSY, such as Sms messages or list of detected
       
    16 // networks
       
    17 // 
       
    18 //
       
    19 
       
    20 /**
       
    21  @file
       
    22 */
       
    23 
       
    24 // Multimode header files
       
    25 #include <etelmm.h>
       
    26 #include <mmretrieve.h>
       
    27 #include <etelext.h>
       
    28 #include <e32base.h>
       
    29 #include "mm_hold.h"
       
    30 	
       
    31 
       
    32 EXPORT_C void CAsyncRetrieveVariableLengthBuffer::Start(TRequestStatus& /*aReqStatus*/, TDes8* /*aPhase1Request*/, TDes8* /*aPhase2Request*/)
       
    33 	{
       
    34 	PanicClient(EEtelPanicInvalidRequestType);
       
    35 	}
       
    36 
       
    37 EXPORT_C void CAsyncRetrieveVariableLengthBuffer::DoCancel()
       
    38 /**
       
    39  * This method cancels the active phase of the retrieval
       
    40  * It is called from the CActive::Cancel() method
       
    41  * 
       
    42  * @capability ReadDeviceData
       
    43  * @capability NetworkServices
       
    44 */
       
    45 	{
       
    46 	}
       
    47 
       
    48 EXPORT_C void CAsyncRetrieveVariableLengthBuffer::RunL()
       
    49 /**
       
    50  * This method processes the completion of each asynchronous phase of the retrieval
       
    51  * If phase 1 is now complete, it starts phase 2
       
    52  * If phase 2 is now complete, it complete's the client's request
       
    53  *  
       
    54  * @capability None
       
    55 */
       
    56 	{
       
    57 	}
       
    58 
       
    59 EXPORT_C TBool CAsyncRetrieveVariableLengthBuffer::CompleteIfInUse(TRequestStatus& /*aReqStatus*/)
       
    60 	{
       
    61 	return EFalse;
       
    62 	}
       
    63 
       
    64 
       
    65 EXPORT_C void CAsyncRetrieveVariableLengthBuffer::FreeBuffer()
       
    66 /**
       
    67  * This method deallocates the buffer used to hold the retrieved data
       
    68  *  
       
    69  * @capability None
       
    70 */
       
    71 	{
       
    72 	}
       
    73 
       
    74 /***********************************************************************************/
       
    75 //
       
    76 // base class for buffer retrieval which require client ids to be sent to tsy
       
    77 //
       
    78 /***********************************************************************************/
       
    79 
       
    80 
       
    81 CAsyncRetrieveWithClientIds::CAsyncRetrieveWithClientIds(TInt aSessionHandle, TInt aSubSessionHandle)
       
    82 	{
       
    83 	iId().iSessionHandle = aSessionHandle;
       
    84 	iId().iSubSessionHandle = aSubSessionHandle;
       
    85 	}
       
    86 
       
    87 /***********************************************************************************/
       
    88 //
       
    89 // base class for list retrieval from RMobilePhoneStore
       
    90 //
       
    91 /***********************************************************************************/
       
    92 
       
    93 CAsyncRetrieveStoreList::CAsyncRetrieveStoreList(RMobilePhoneStore& aStore) : 
       
    94 	CAsyncRetrieveWithClientIds(aStore.SessionHandle().Handle(), aStore.SubSessionHandle()), 
       
    95 	iStore(aStore)
       
    96 /** Construction of the list.
       
    97 
       
    98 @param aStore The Mobile phone store class that is associated with this list. */
       
    99 	{
       
   100 	iIpcPhase1=EMobilePhoneStoreReadAllPhase1;
       
   101 	iIpcPhase2=EMobilePhoneStoreReadAllPhase2;
       
   102 	iIpcCancel=EMobilePhoneStoreReadAllCancel;
       
   103 	}
       
   104 	
       
   105 CAsyncRetrieveStoreList::~CAsyncRetrieveStoreList()
       
   106  	{	
       
   107  	Cancel();
       
   108  	}
       
   109 
       
   110 void CAsyncRetrieveStoreList::Get(TInt aIpc, TRequestStatus& aReqStatus, TDes8& aDes1, TDes8& aDes2)
       
   111 /** This function member uses the Get IPC request within RTelSubSessionBase to 
       
   112 send one of the asynchronous phase requests to ETel server.
       
   113 
       
   114 @param aIpc The IPC value of the asynchronous phase request.
       
   115 @param aReqStatus On return, the request status for the asynchronous phase 
       
   116 request.
       
   117 @param aDes1 The first parameter for the asynchronous phase request.
       
   118 @param aDes2 The second parameter for the asynchronous phase request. */
       
   119 	{
       
   120 	iStore.Get(aIpc,aReqStatus,aDes1,aDes2);
       
   121 	}
       
   122 
       
   123 void CAsyncRetrieveStoreList::CancelReq(TInt aIpc1, TInt aIpc2)
       
   124 /** This function member cancels a previously issued Get() requests.
       
   125 
       
   126 @param aIpc1 The IPC value of the cancel request.
       
   127 @param aIpc2 The IPC value of the original asynchronous phase request. */
       
   128 	{
       
   129 	iStore.CancelReq(aIpc1,aIpc2);
       
   130 	}
       
   131 
       
   132 /***********************************************************************************/
       
   133 //
       
   134 // base class for list retrieval from RMobilePhone
       
   135 //
       
   136 /***********************************************************************************/
       
   137 
       
   138 EXPORT_C CAsyncRetrievePhoneList::CAsyncRetrievePhoneList(RMobilePhone& aPhone) : 
       
   139 	CAsyncRetrieveWithClientIds(aPhone.SessionHandle().Handle(), aPhone.SubSessionHandle()),
       
   140 	iPhone(aPhone) 
       
   141 /** Contruct the list for RMobilePhone aPhone.
       
   142 
       
   143 @param aPhone The phone class that will be used to retrieve the lists. */
       
   144 	{
       
   145 	}
       
   146 
       
   147 EXPORT_C CAsyncRetrievePhoneList::~CAsyncRetrievePhoneList()
       
   148  	{
       
   149  	Cancel();
       
   150  	}
       
   151 
       
   152 EXPORT_C void CAsyncRetrievePhoneList::Get(TInt aIpc, TRequestStatus& aReqStatus, TDes8& aDes1, TDes8& aDes2)
       
   153 /** This function member uses the Get IPC request within RTelSubsessionBase to 
       
   154 send one of the asynchronous phase requests to ETel server.
       
   155 
       
   156 @param aIpc The IPC value of the asynchronous phase request.
       
   157 @param aReqStatus On return, the request status for the asynchronous phase 
       
   158 request.
       
   159 @param aDes1 The first parameter for the asynchronous phase request.
       
   160 @param aDes2 The second parameter for the asynchronous phase request. 
       
   161 */
       
   162 	{
       
   163 	iPhone.Get(aIpc,aReqStatus,aDes1,aDes2);
       
   164 	}
       
   165 
       
   166 EXPORT_C void CAsyncRetrievePhoneList::CancelReq(TInt aIpc1, TInt aIpc2)
       
   167 /** This function member uses the Cancel IPC request within RTelSubsessionBase 
       
   168 to send a cancel for one of the asynchronous phases to ETel server.
       
   169 
       
   170 @param aIpc1 The IPC value of the cancel request.
       
   171 @param aIpc2 The IPC value of the original asynchronous phase request. 
       
   172 
       
   173 @capability NetworkServices
       
   174 @capability ReadDeviceData
       
   175 */
       
   176 	{
       
   177 	iPhone.CancelReq(aIpc1,aIpc2);
       
   178 	}
       
   179 
       
   180 
       
   181 /***********************************************************************************/
       
   182 //
       
   183 // Retrieve a list of detected networks
       
   184 //
       
   185 /***********************************************************************************/
       
   186 
       
   187 EXPORT_C CRetrieveMobilePhoneDetectedNetworks* CRetrieveMobilePhoneDetectedNetworks::NewL(RMobilePhone& aPhone)
       
   188 /** This function member creates an instance of the CRetrieveMobilePhoneDetectedNetworks 
       
   189 class. 
       
   190 
       
   191 @param aPhone A reference to their RMobilePhone sub-session as it is this 
       
   192 sub-session that the list retrieval class will operate on.
       
   193 @return The newly created CRetrieveMobilePhoneDetectedNetworks class. 
       
   194 @capability None
       
   195 */
       
   196 	{
       
   197 	CRetrieveMobilePhoneDetectedNetworks* r=new(ELeave) CRetrieveMobilePhoneDetectedNetworks(aPhone);
       
   198 	CleanupStack::PushL(r);
       
   199 	r->ConstructL();
       
   200 	CleanupStack::Pop();
       
   201 	return r;
       
   202 	}	
       
   203 
       
   204 CRetrieveMobilePhoneDetectedNetworks::CRetrieveMobilePhoneDetectedNetworks(RMobilePhone& aPhone) 
       
   205 :	CAsyncRetrievePhoneList(aPhone), iListExtensionId(KETelExtMultimodeV1)
       
   206 	{
       
   207 	}
       
   208 
       
   209 void CRetrieveMobilePhoneDetectedNetworks::ConstructL()
       
   210 	{
       
   211 		iIpcPhase1=EMobilePhoneGetDetectedNetworksPhase1;
       
   212 		iIpcPhase2=EMobilePhoneGetDetectedNetworksPhase2;
       
   213 		iIpcCancel=EMobilePhoneGetDetectedNetworksCancel;
       
   214 	}
       
   215 
       
   216 EXPORT_C CRetrieveMobilePhoneDetectedNetworks::~CRetrieveMobilePhoneDetectedNetworks()
       
   217 /** The destructor frees all resources owned by the object, prior to its destruction. */
       
   218 	{
       
   219 	delete iResults;
       
   220 	delete iResultsV2;
       
   221 	delete iResultsV5;
       
   222 	delete iResultsV8;
       
   223 
       
   224 	}
       
   225 
       
   226 EXPORT_C CMobilePhoneNetworkList* CRetrieveMobilePhoneDetectedNetworks::RetrieveListL()
       
   227 /** This function member provides the client with a handle to the list class retrieved 
       
   228 from the phone. The client will call this function member once Start() has 
       
   229 completed.
       
   230 
       
   231 When the client calls this function member the ownership of the CMobilePhoneNetworkList 
       
   232 object will transfer to the client, so the client is then responsible for 
       
   233 eventual deletion of this object. 
       
   234 
       
   235 @leave KErrNotFound If there is no valid list object to return to the client. 
       
   236 @return A handle to the list class retrieved from the store. If there are no entries in 
       
   237 the list then a handle to an empty list is returned.
       
   238 @capability None
       
   239 */
       
   240 	{
       
   241 	if (iResults)
       
   242 		{
       
   243 		// Give ownership of list to caller of this method
       
   244 		CMobilePhoneNetworkList* ptr=iResults;
       
   245 		iResults=NULL;
       
   246 		return ptr;
       
   247 		}
       
   248 	else
       
   249 		{
       
   250 		User::Leave(KErrNotFound);
       
   251 		return NULL;
       
   252 		}
       
   253 	}
       
   254 
       
   255 EXPORT_C CMobilePhoneNetworkListV2* CRetrieveMobilePhoneDetectedNetworks::RetrieveListV2L()
       
   256 /** This function member provides the client with a handle to the CMobilePhoneNetworkListV2 
       
   257 list class retrieved from the phone. The client will call this function member once 
       
   258 StartV2() has completed.
       
   259 
       
   260 When the client calls this function member the ownership of the CMobilePhoneNetworkListV2 
       
   261 object will transfer to the client, so the client is then responsible for 
       
   262 eventual deletion of this object. 
       
   263 
       
   264 @leave KErrNotFound If there is no valid list object to return to the client. 
       
   265 @return A handle to the list class retrieved from the store. If there are no entries in 
       
   266 the list then a handle to an empty list is returned.
       
   267 @capability None
       
   268 */
       
   269 	{
       
   270 	if (iResultsV2)
       
   271 		{
       
   272 		// Give ownership of list to caller of this method
       
   273 		CMobilePhoneNetworkListV2* ptr=iResultsV2;
       
   274 		iResultsV2=NULL;
       
   275 		return ptr;
       
   276 		}
       
   277 	else
       
   278 		{
       
   279 		User::Leave(KErrNotFound);
       
   280 		return NULL;
       
   281 		}
       
   282 	}
       
   283 
       
   284 EXPORT_C CMobilePhoneNetworkListV5* CRetrieveMobilePhoneDetectedNetworks::RetrieveListV5L()
       
   285 /** This function member provides the client with a handle to the CMobilePhoneNetworkListV5
       
   286 list class retrieved from the phone. The client will call this function member once 
       
   287 StartV5() has completed.
       
   288 
       
   289 When the client calls this function member the ownership of the CMobilePhoneNetworkListV5 
       
   290 object will transfer to the client, so the client is then responsible for 
       
   291 eventual deletion of this object. 
       
   292 
       
   293 @leave KErrNotFound If there is no valid list object to return to the client. 
       
   294 @return A handle to the list class retrieved from the store. If there are no entries in 
       
   295 the list then a handle to an empty list is returned.
       
   296 @capability None
       
   297 */
       
   298 	{
       
   299 	if (iResultsV5)
       
   300 		{
       
   301 		// Give ownership of list to caller of this method
       
   302 		CMobilePhoneNetworkListV5* ptr=iResultsV5;
       
   303 		iResultsV5=NULL;
       
   304 		return ptr;
       
   305 		}
       
   306 	else
       
   307 		{
       
   308 		User::Leave(KErrNotFound);
       
   309 		return NULL;
       
   310 		}
       
   311 	}
       
   312 
       
   313 EXPORT_C CMobilePhoneNetworkListV8* CRetrieveMobilePhoneDetectedNetworks::RetrieveListV8L()
       
   314 /** This function member provides the client with a handle to the CMobilePhoneNetworkListV8
       
   315 list class retrieved from the phone. The client will call this function member once 
       
   316 StartV8() has completed.
       
   317 
       
   318 When the client calls this function member the ownership of the CMobilePhoneNetworkListV8 
       
   319 object will transfer to the client, so the client is then responsible for 
       
   320 eventual deletion of this object. 
       
   321 
       
   322 @leave KErrNotFound If there is no valid list object to return to the client. 
       
   323 @return A handle to the list class retrieved from the store. If there are no entries in 
       
   324 the list then a handle to an empty list is returned.
       
   325 @capability None
       
   326 */
       
   327 	{
       
   328 	if (iResultsV8)
       
   329 		{
       
   330 		// Give ownership of list to caller of this method
       
   331 		CMobilePhoneNetworkListV8* ptr=iResultsV8;
       
   332 		iResultsV8=NULL;
       
   333 		return ptr;
       
   334 		}
       
   335 	else
       
   336 		{
       
   337 		User::Leave(KErrNotFound);
       
   338 		return NULL;
       
   339 		}
       
   340 	}
       
   341 
       
   342 EXPORT_C void CRetrieveMobilePhoneDetectedNetworks::Start(TRequestStatus& aReqStatus)
       
   343 /** This function member starts the two-phase list retrieval of detected networks.
       
   344 
       
   345 @param aReqStatus On completion, the status of the request; KErrNone if successful, 
       
   346 KErrNotSupported if the phone does not support access to a detected network 
       
   347 store and KErrNotFound if the store does not exist. If the list is empty then KErrNone
       
   348 is returned. 
       
   349 @capability NetworkServices
       
   350 @capability ReadDeviceData
       
   351 */
       
   352 	{
       
   353 	if (!CompleteIfInUse(aReqStatus))
       
   354 		{
       
   355 		iIpcPhase1=EMobilePhoneGetDetectedNetworksPhase1;
       
   356 		iIpcPhase2=EMobilePhoneGetDetectedNetworksPhase2;
       
   357 		iIpcCancel=EMobilePhoneGetDetectedNetworksCancel;
       
   358 		iListExtensionId = KETelExtMultimodeV1;
       
   359 
       
   360 		delete iResults;
       
   361 		iResults = NULL;
       
   362 		CAsyncRetrieveVariableLengthBufferV2::Start(aReqStatus,&iId,&iId);
       
   363 		}
       
   364 	}
       
   365 
       
   366 EXPORT_C void CRetrieveMobilePhoneDetectedNetworks::StartV2(TRequestStatus& aReqStatus)
       
   367 /** This function member starts the two-phase list retrieval of detected networks.
       
   368 
       
   369 @param aReqStatus On completion, the status of the request; KErrNone if successful, 
       
   370 KErrNotSupported if the phone does not support access to a detected network 
       
   371 store and KErrNotFound if the store does not exist. If the list is empty then KErrNone
       
   372 is returned. 
       
   373 @capability NetworkServices
       
   374 @capability ReadDeviceData
       
   375 */
       
   376 	{
       
   377 	if (!CompleteIfInUse(aReqStatus))
       
   378 		{
       
   379 		iIpcPhase1=EMobilePhoneGetDetectedNetworksV2Phase1;
       
   380 		iIpcPhase2=EMobilePhoneGetDetectedNetworksV2Phase2;
       
   381 		iIpcCancel=EMobilePhoneGetDetectedNetworksV2Cancel;
       
   382 		iListExtensionId = KETelExtMultimodeV2;
       
   383 		
       
   384 		delete iResultsV2;
       
   385 		iResultsV2 = NULL;
       
   386 		CAsyncRetrieveVariableLengthBufferV2::Start(aReqStatus,&iId,&iId);
       
   387 		}
       
   388 	}
       
   389 
       
   390 EXPORT_C void CRetrieveMobilePhoneDetectedNetworks::StartV5(TRequestStatus& aReqStatus)
       
   391 /** This function member starts the two-phase list retrieval of detected networks.
       
   392 
       
   393 @param aReqStatus On completion, the status of the request; KErrNone if successful, 
       
   394 KErrNotSupported if the phone does not support access to a detected network 
       
   395 store and KErrNotFound if the store does not exist. If the list is empty then KErrNone
       
   396 is returned. 
       
   397 @capability NetworkServices
       
   398 @capability ReadDeviceData
       
   399 */
       
   400 	{
       
   401 	if (!CompleteIfInUse(aReqStatus))
       
   402 		{
       
   403 		iIpcPhase1=EMobilePhoneGetDetectedNetworksV5Phase1;
       
   404 		iIpcPhase2=EMobilePhoneGetDetectedNetworksV5Phase2;
       
   405 		iIpcCancel=EMobilePhoneGetDetectedNetworksV5Cancel;
       
   406 		iListExtensionId = KEtelExtMultimodeV5;
       
   407 		
       
   408 		delete iResultsV5;
       
   409 		iResultsV5 = NULL;
       
   410 		CAsyncRetrieveVariableLengthBufferV2::Start(aReqStatus,&iId,&iId);
       
   411 		}
       
   412 	}
       
   413 
       
   414 EXPORT_C void CRetrieveMobilePhoneDetectedNetworks::StartV8(TRequestStatus& aReqStatus)
       
   415 /** This function member starts the two-phase list retrieval of detected networks.
       
   416 
       
   417 @param aReqStatus On completion, the status of the request; KErrNone if successful, 
       
   418 KErrNotSupported if the phone does not support access to a detected network 
       
   419 store and KErrNotFound if the store does not exist. If the list is empty then KErrNone
       
   420 is returned. 
       
   421 @capability NetworkServices
       
   422 @capability ReadDeviceData
       
   423 */
       
   424 	{
       
   425 	if (!CompleteIfInUse(aReqStatus))
       
   426 		{
       
   427 		iIpcPhase1=EMobilePhoneGetDetectedNetworksV8Phase1;
       
   428 		iIpcPhase2=EMobilePhoneGetDetectedNetworksV8Phase2;
       
   429 		iIpcCancel=EMobilePhoneGetDetectedNetworksV8Cancel;
       
   430 		iListExtensionId = KEtelExtMultimodeV8;
       
   431 		
       
   432 		delete iResultsV8;
       
   433 		iResultsV8 = NULL;
       
   434 		CAsyncRetrieveVariableLengthBufferV2::Start(aReqStatus,&iId,&iId);
       
   435 		}
       
   436 	}
       
   437 
       
   438 void CRetrieveMobilePhoneDetectedNetworks::RestoreListL()
       
   439 /**
       
   440  * This method restores a list from a buffer that contains the streamed version of the list
       
   441  */
       
   442 	{
       
   443 	if(iListExtensionId == KETelExtMultimodeV1)
       
   444 		{	
       
   445 		iResults=CMobilePhoneNetworkList::NewL();
       
   446 		iResults->RestoreL(iResultsPtr);
       
   447 		FreeBuffer();
       
   448 		}
       
   449 	else if(iListExtensionId == KETelExtMultimodeV2)
       
   450 		{
       
   451 		iResultsV2=CMobilePhoneNetworkListV2::NewL();
       
   452 		iResultsV2->RestoreL(iResultsPtr);
       
   453 		FreeBuffer();
       
   454 		}
       
   455 	else if(iListExtensionId == KEtelExtMultimodeV5)
       
   456 		{
       
   457 		iResultsV5=CMobilePhoneNetworkListV5::NewL();
       
   458 		iResultsV5->RestoreL(iResultsPtr);
       
   459 		FreeBuffer();
       
   460 		}
       
   461 	else if(iListExtensionId == KEtelExtMultimodeV8)
       
   462 		{
       
   463 		iResultsV8=CMobilePhoneNetworkListV8::NewL();
       
   464 		iResultsV8->RestoreL(iResultsPtr);
       
   465 		FreeBuffer();
       
   466 		}
       
   467 	else
       
   468 		{
       
   469 		User::Leave(KErrNotFound);
       
   470 		}
       
   471 
       
   472 	}
       
   473 
       
   474 
       
   475 /***********************************************************************************/
       
   476 //
       
   477 // Retrieve a list of call forwarding status/info
       
   478 //
       
   479 /***********************************************************************************/
       
   480 
       
   481 EXPORT_C CRetrieveMobilePhoneCFList* CRetrieveMobilePhoneCFList::NewL(RMobilePhone& aPhone)
       
   482 /** This member function creates an instance of the CRetrieveMobilePhoneCFList 
       
   483 class.
       
   484 
       
   485 @param aPhone A reference to the RMobilePhone sub-session as it is this sub-session 
       
   486 that the list retrieval class will operate on.
       
   487 @return A pointer to the newly created CRetrieveMobilePhoneCFList object. 
       
   488 */
       
   489 	{
       
   490 	CRetrieveMobilePhoneCFList* r=new(ELeave) CRetrieveMobilePhoneCFList(aPhone);
       
   491 	CleanupStack::PushL(r);
       
   492 	r->ConstructL();
       
   493 	CleanupStack::Pop();
       
   494 	return r;
       
   495 	}	
       
   496 
       
   497 CRetrieveMobilePhoneCFList::CRetrieveMobilePhoneCFList(RMobilePhone& aPhone) : 
       
   498 	CAsyncRetrievePhoneList(aPhone)
       
   499 	{
       
   500 	}
       
   501 
       
   502 void CRetrieveMobilePhoneCFList::ConstructL()
       
   503 	{
       
   504 	iIpcPhase1=EMobilePhoneGetCallForwardingStatusPhase1;
       
   505 	iIpcPhase2=EMobilePhoneGetCallForwardingStatusPhase2;
       
   506 	iIpcCancel=EMobilePhoneGetCallForwardingStatusCancel;	
       
   507 	}
       
   508 
       
   509 EXPORT_C CRetrieveMobilePhoneCFList::~CRetrieveMobilePhoneCFList()
       
   510 /** The destructor frees all resources owned by the object, prior to its destruction. */
       
   511 	{
       
   512 	delete iResults;
       
   513 	}
       
   514 
       
   515 EXPORT_C CMobilePhoneCFList* CRetrieveMobilePhoneCFList::RetrieveListL()
       
   516 /** This member function provides the client with a handle to the list class retrieved 
       
   517 from the phone. The client will call this member function once Start() has 
       
   518 completed. The retrieved list will consist of an entry per basic service group 
       
   519 per specified CF condition. When the client calls this member function the 
       
   520 ownership of the CMobilePhoneCFList object will transfer to the client, so 
       
   521 the client is then responsible for eventual deletion of this object.
       
   522 
       
   523 @leave KErrNotFound If there is no valid list object to return to the client. 
       
   524 @return A handle to the list class retrieved from the store. If there are no entries in 
       
   525 the list then a handle to an empty list is returned.
       
   526 */
       
   527 	{
       
   528 	if (iResults)
       
   529 		{
       
   530 		// Give ownership of list to caller of this method
       
   531 		CMobilePhoneCFList* ptr=iResults;
       
   532 		iResults=NULL;
       
   533 		return ptr;
       
   534 		}
       
   535 	else
       
   536 		{
       
   537 		User::Leave(KErrNotFound);
       
   538 		return NULL;
       
   539 		}
       
   540 	}
       
   541 
       
   542 EXPORT_C void CRetrieveMobilePhoneCFList::Start(TRequestStatus& aReqStatus, 
       
   543 												RMobilePhone::TMobilePhoneCFCondition aCondition, 
       
   544 												RMobilePhone::TMobileInfoLocation aLocation)
       
   545 /**
       
   546  * This method starts the retrieval of the call forwarding status list
       
   547  *
       
   548  * @deprecated 7.0s.
       
   549  * Deprecated, other CRetrieveMobilePhoneCFList::Start overload should be used instead
       
   550  * @capability NetworkServices 
       
   551  * @capability ReadDeviceData
       
   552  */
       
   553 	{
       
   554 	if (!CompleteIfInUse(aReqStatus))
       
   555 		{
       
   556 		delete iResults;
       
   557 		iResults = NULL;
       
   558 
       
   559 		iCFRequestData().iCondition=aCondition;
       
   560 		iCFRequestData().iLocation=aLocation;
       
   561 		iCFRequestData().iClient=iId();
       
   562 		iCFRequestData().iServiceGroup=RMobilePhone::EAllServices;
       
   563 
       
   564 		CAsyncRetrievePhoneList::Start(aReqStatus,&iCFRequestData,&iId);
       
   565 		}
       
   566 	}
       
   567 	
       
   568 EXPORT_C void CRetrieveMobilePhoneCFList::Start(TRequestStatus& aReqStatus, 
       
   569 												RMobilePhone::TMobilePhoneCFCondition aCondition, 
       
   570 												RMobilePhone::TMobileService aServiceGroup,
       
   571 												RMobilePhone::TMobileInfoLocation aLocation
       
   572 												)
       
   573 /**
       
   574  * This method starts the retrieval of the call forwarding status list. 
       
   575  * If the list is empty then KErrNone is returned. 
       
   576  * @capability NetworkServices 
       
   577  * @capability ReadDeviceData
       
   578  */
       
   579 	{
       
   580 	if (!CompleteIfInUse(aReqStatus))
       
   581 		{
       
   582 		
       
   583 		delete iResults;
       
   584 		iResults = NULL;
       
   585 
       
   586 		iCFRequestData().iCondition=aCondition;
       
   587 		iCFRequestData().iLocation=aLocation;
       
   588 		iCFRequestData().iClient=iId();
       
   589 		iCFRequestData().iServiceGroup=aServiceGroup;
       
   590 
       
   591 		CAsyncRetrievePhoneList::Start(aReqStatus,&iCFRequestData,&iId);
       
   592 		}
       
   593 	}
       
   594 		
       
   595 void CRetrieveMobilePhoneCFList::RestoreListL()
       
   596 /**
       
   597  * This method restores a list from a buffer that contains the streamed version of the list
       
   598  */
       
   599 	{
       
   600 	iResults=CMobilePhoneCFList::NewL();
       
   601 	iResults->RestoreL(iResultsPtr);
       
   602 	FreeBuffer();
       
   603 	}
       
   604 
       
   605 /***********************************************************************************/
       
   606 //
       
   607 // Retrieve a list of call barring status/info
       
   608 //
       
   609 /***********************************************************************************/
       
   610 
       
   611 EXPORT_C CRetrieveMobilePhoneCBList* CRetrieveMobilePhoneCBList::NewL(RMobilePhone& aPhone)
       
   612 /** This member function creates an instance of the CRetrieveMobilePhoneCBList 
       
   613 class.
       
   614 
       
   615 @param aPhone A reference to the RMobilePhone sub-session, as it is this sub-session 
       
   616 that the list retrieval class will operate on.
       
   617 @return A pointer to the newly created CRetrieveMobilePhoneCBList object. 
       
   618 @capability None
       
   619 */
       
   620 	{
       
   621 	CRetrieveMobilePhoneCBList* r=new(ELeave) CRetrieveMobilePhoneCBList(aPhone);
       
   622 	CleanupStack::PushL(r);
       
   623 	r->ConstructL();
       
   624 	CleanupStack::Pop();
       
   625 	return r;
       
   626 	}	
       
   627 
       
   628 CRetrieveMobilePhoneCBList::CRetrieveMobilePhoneCBList(RMobilePhone& aPhone) : 
       
   629 	CAsyncRetrievePhoneList(aPhone), iListExtensionId(KETelExtMultimodeV1)
       
   630 	{
       
   631 	}
       
   632 
       
   633 void CRetrieveMobilePhoneCBList::ConstructL()
       
   634 	{
       
   635 	}
       
   636 
       
   637 EXPORT_C CRetrieveMobilePhoneCBList::~CRetrieveMobilePhoneCBList()
       
   638 /** The destructor frees all resources owned by the object, prior to its destruction. */
       
   639 	{
       
   640 	delete iResults;
       
   641 	}
       
   642 
       
   643 EXPORT_C CMobilePhoneCBList* CRetrieveMobilePhoneCBList::RetrieveListL()
       
   644 /** This member function provides the client with a handle to the list class retrieved 
       
   645 from the phone.
       
   646 
       
   647 The client will call this member function once Start() has completed. The 
       
   648 retrieved list will consist of an entry per basic service group per specified 
       
   649 CB condition.
       
   650 
       
   651 When the client calls this member function the ownership of the CMobilePhoneCBList 
       
   652 object will transfer to the client, so the client is then responsible for 
       
   653 eventual deletion of this object.
       
   654 
       
   655 @leave KErrNotFound If there is no valid list object to return to the client.
       
   656 @return A handle to the list class retrieved from the store. If there are no entries in 
       
   657 the list then a handle to an empty list is returned.
       
   658 @capability ReadDeviceData
       
   659 */
       
   660 	{
       
   661 	if (iResults)
       
   662 		{
       
   663 		// Give ownership of list to caller of this method
       
   664 		CMobilePhoneCBList* ptr=iResults;
       
   665 		iResults=NULL;
       
   666 		return ptr;
       
   667 		}
       
   668 	else
       
   669 		{
       
   670 		User::Leave(KErrNotFound);
       
   671 		return NULL;
       
   672 		}
       
   673 	}
       
   674 
       
   675 
       
   676 
       
   677 EXPORT_C void CRetrieveMobilePhoneCBList::Start(TRequestStatus& aReqStatus, 
       
   678 												RMobilePhone::TMobilePhoneCBCondition aCondition, 
       
   679 												RMobilePhone::TMobileInfoLocation aLocation)
       
   680 /** This member function starts the two-phase list retrieval. The client also specifies 
       
   681 the call barring condition(s) that it wants to interrogate and from where 
       
   682 this information should be retrieved. The client then waits for its request 
       
   683 to be completed.
       
   684 
       
   685 @param aReqStatus On completion, the status of the request; KErrNone if successful, 
       
   686 KErrNotSupported if the phone does not support access to a CB list store and 
       
   687 KErrNotFound if the store does not exist. If the list is empty then KErrNone
       
   688 is returned.
       
   689 @param aCondition The barring conditions to interrogate.
       
   690 @param aLocation Specifies from where this information should be retrieved. 
       
   691 This parameters defaults to: RMobilePhone::EInfoLocationCachePreferred.
       
   692 @capability NetworkServices
       
   693 @capability ReadDeviceData
       
   694 */
       
   695 	{
       
   696 	if (!CompleteIfInUse(aReqStatus))
       
   697 		{
       
   698 		
       
   699 		iIpcPhase1 = EMobilePhoneGetBarringStatusPhase1;
       
   700 		iIpcPhase2 = EMobilePhoneGetBarringStatusPhase2;
       
   701 		iIpcCancel = EMobilePhoneGetBarringStatusCancel;
       
   702 		iListExtensionId = KETelExtMultimodeV1;
       
   703 		
       
   704 		delete iResults;
       
   705 		iResults = NULL;
       
   706 
       
   707 		iCBRequestData().iCondition=aCondition;
       
   708 		iCBRequestData().iLocation=aLocation;
       
   709 		iCBRequestData().iClient=iId();
       
   710 		
       
   711 		CAsyncRetrievePhoneList::Start(aReqStatus,&iCBRequestData,&iId);
       
   712 		}
       
   713 	}
       
   714 		
       
   715 		
       
   716 void CRetrieveMobilePhoneCBList::RestoreListL()
       
   717 /**
       
   718  * This method restores a list from a buffer that contains the streamed version of the list
       
   719  */
       
   720 	{
       
   721 	if(iListExtensionId == KETelExtMultimodeV1)
       
   722 		{
       
   723 	iResults=CMobilePhoneCBList::NewL();
       
   724 	iResults->RestoreL(iResultsPtr);
       
   725 	FreeBuffer();
       
   726 	}
       
   727 	else
       
   728 		User::Leave(KErrNotFound);
       
   729 	}
       
   730 
       
   731 /***********************************************************************************/
       
   732 //
       
   733 // Retrieve a list of call waiting status/info
       
   734 //
       
   735 /***********************************************************************************/
       
   736 
       
   737 EXPORT_C CRetrieveMobilePhoneCWList* CRetrieveMobilePhoneCWList::NewL(RMobilePhone& aPhone)
       
   738 /** This function member creates an instance of the CRetrieveMobilePhoneCWList 
       
   739 class.
       
   740 
       
   741 @param aPhone A reference to the RMobilePhone sub-session as this is the sub-session 
       
   742 that the list retrieval class will operate on.
       
   743 @return A pointer to the newly created CRetrieveMobilePhoneCWList object. 
       
   744 @capability None
       
   745 */
       
   746 	{
       
   747 	CRetrieveMobilePhoneCWList* r=new(ELeave) CRetrieveMobilePhoneCWList(aPhone);
       
   748 	CleanupStack::PushL(r);
       
   749 	r->ConstructL();
       
   750 	CleanupStack::Pop();
       
   751 	return r;
       
   752 	}	
       
   753 
       
   754 CRetrieveMobilePhoneCWList::CRetrieveMobilePhoneCWList(RMobilePhone& aPhone) : 
       
   755 	CAsyncRetrievePhoneList(aPhone)
       
   756 	{
       
   757 	}
       
   758 
       
   759 void CRetrieveMobilePhoneCWList::ConstructL()
       
   760 	{
       
   761 	iIpcPhase1=EMobilePhoneGetWaitingStatusPhase1;
       
   762 	iIpcPhase2=EMobilePhoneGetWaitingStatusPhase2;
       
   763 	iIpcCancel=EMobilePhoneGetWaitingStatusCancel;
       
   764 	}
       
   765 
       
   766 EXPORT_C CRetrieveMobilePhoneCWList::~CRetrieveMobilePhoneCWList()
       
   767 /** The destructor frees all resources owned by the object, prior to its destruction. */
       
   768 	{
       
   769 	delete iResults;
       
   770 	}
       
   771 
       
   772 EXPORT_C CMobilePhoneCWList* CRetrieveMobilePhoneCWList::RetrieveListL()
       
   773 /** This function member provides the client with a handle to the list class retrieved 
       
   774 from the phone. The client will call this function member once Start() has 
       
   775 completed.
       
   776 
       
   777 When the client calls this function member the ownership of the CMobilePhoneCWList 
       
   778 object will transfer to the client, so the client is then responsible for 
       
   779 eventual deletion of this object.
       
   780 
       
   781 @leave KErrNotFound If there is no valid list object to return to the client
       
   782 @return A handle to the list class retrieved from the store. If there are no entries in 
       
   783 the list then a handle to an empty list is returned.
       
   784 @capability ReadDeviceData
       
   785 */
       
   786 	{
       
   787 	if (iResults)
       
   788 		{
       
   789 		// Give ownership of list to caller of this method
       
   790 		CMobilePhoneCWList* ptr=iResults;
       
   791 		iResults=NULL;
       
   792 		return ptr;
       
   793 		}
       
   794 	else
       
   795 		{
       
   796 		User::Leave(KErrNotFound);
       
   797 		return NULL;
       
   798 		}
       
   799 	}
       
   800 
       
   801 EXPORT_C void CRetrieveMobilePhoneCWList::Start(TRequestStatus& aReqStatus, 
       
   802 												RMobilePhone::TMobileInfoLocation aLocation)
       
   803 /** This function member starts the two-phase list retrieval.
       
   804 
       
   805 @param aReqStatus On completion, the status of the request; KErrNone if successful, 
       
   806 KErrNotSupported if the phone does not support access to a call waiting list 
       
   807 store and KErrNotFound if the store does not exist. If the list is empty then KErrNone
       
   808 is returned.
       
   809 @param aLocation Specifies from where this information should be retrieved. 
       
   810 Defaults to RMobilePhone::EInfoLocationCachePreferred
       
   811 @capability NetworkServices
       
   812 @capability ReadDeviceData
       
   813 */
       
   814 	{
       
   815 	if (!CompleteIfInUse(aReqStatus))
       
   816 		{
       
   817 		delete iResults;
       
   818 		iResults = NULL;
       
   819 
       
   820 		iCWRequestData().iLocation=aLocation;
       
   821 		iCWRequestData().iClient=iId();
       
   822 			
       
   823 		CAsyncRetrievePhoneList::Start(aReqStatus,&iCWRequestData,&iId);
       
   824 		}
       
   825 	}
       
   826 		
       
   827 void CRetrieveMobilePhoneCWList::RestoreListL()
       
   828 /**
       
   829  * This method restores a list from a buffer that contains the streamed version of the list
       
   830  */
       
   831 	{
       
   832 	iResults=CMobilePhoneCWList::NewL();
       
   833 	iResults->RestoreL(iResultsPtr);
       
   834 	FreeBuffer();
       
   835 	}
       
   836 
       
   837 
       
   838 /***********************************************************************************/
       
   839 //
       
   840 // Retrieve a list of call completion Requests
       
   841 //
       
   842 /***********************************************************************************/
       
   843 
       
   844 EXPORT_C CRetrieveMobilePhoneCcbsList* CRetrieveMobilePhoneCcbsList::NewL(RMobilePhone& aPhone)
       
   845 /** This member function creates an instance of the CRetrieveMobilePhoneCcbsList 
       
   846 class.
       
   847 
       
   848 @param aPhone A reference to the RMobilePhone sub-session, as it is this sub-session 
       
   849 that the list retrieval class will operate on.
       
   850 @return A pointer to the newly created CRetrieveMobilePhoneCcbsList object. 
       
   851 @capability None
       
   852 */
       
   853 	{
       
   854 	CRetrieveMobilePhoneCcbsList* r=new(ELeave) CRetrieveMobilePhoneCcbsList(aPhone);
       
   855 	CleanupStack::PushL(r);
       
   856 	r->ConstructL();
       
   857 	CleanupStack::Pop();
       
   858 	return r;
       
   859 	}	
       
   860 
       
   861 CRetrieveMobilePhoneCcbsList::CRetrieveMobilePhoneCcbsList(RMobilePhone& aPhone) : 
       
   862 	CAsyncRetrievePhoneList(aPhone)
       
   863 	{
       
   864 	}
       
   865 
       
   866 void CRetrieveMobilePhoneCcbsList::ConstructL()
       
   867 	{
       
   868 	iIpcPhase1=EMobilePhoneGetCompletionRequestsPhase1;
       
   869 	iIpcPhase2=EMobilePhoneGetCompletionRequestsPhase2;
       
   870 	iIpcCancel=EMobilePhoneGetCompletionRequestsCancel;	
       
   871 	}
       
   872 
       
   873 EXPORT_C CRetrieveMobilePhoneCcbsList::~CRetrieveMobilePhoneCcbsList()
       
   874 /** The destructor frees all resources owned by the object, prior to its destruction. */
       
   875 	{
       
   876 	delete iResults;
       
   877 	}
       
   878 
       
   879 EXPORT_C CMobilePhoneCcbsList* CRetrieveMobilePhoneCcbsList::RetrieveListL()
       
   880 /** This member function provides the client with a handle to the list class retrieved 
       
   881 from the phone. The client will call this member function once Start() has 
       
   882 completed.
       
   883 
       
   884 When the client calls this member function the ownership of the CMobilePhoneCcbsList 
       
   885 object will transfer to the client, so the client is then responsible for 
       
   886 eventual deletion of this object.
       
   887 
       
   888 @leave KErrNotFound If there is no valid list object to return to the client.
       
   889 @return A handle to the list class retrieved from the store. If there are no entries in 
       
   890 the list then a handle to an empty list is returned.
       
   891 @capability ReadDeviceData
       
   892 */
       
   893 	{
       
   894 	if (iResults)
       
   895 		{
       
   896 		// Give ownership of list to caller of this method
       
   897 		CMobilePhoneCcbsList* ptr=iResults;
       
   898 		iResults=NULL;
       
   899 		return ptr;
       
   900 		}
       
   901 	else
       
   902 		{
       
   903 		User::Leave(KErrNotFound);
       
   904 		return NULL;
       
   905 		}
       
   906 	}
       
   907 
       
   908 EXPORT_C void CRetrieveMobilePhoneCcbsList::Start(TRequestStatus& aReqStatus)
       
   909 /** This member function starts the two-phase list retrieval.
       
   910 
       
   911 @param aReqStatus On completion, the status of the request; KErrNone if successful, 
       
   912 KErrNotSupported if the phone does not support access to a CCBS list store 
       
   913 and KErrNotFound if the store does not exist. If the list is empty then KErrNone
       
   914 is returned. 
       
   915 @capability NetworkServices
       
   916 @capability ReadDeviceData
       
   917 */
       
   918 	{
       
   919 	if (!CompleteIfInUse(aReqStatus))
       
   920 		{
       
   921 		delete iResults;
       
   922 		iResults = NULL;
       
   923 
       
   924 		CAsyncRetrievePhoneList::Start(aReqStatus,&iId,&iId);
       
   925 		}
       
   926 	}
       
   927 		
       
   928 void CRetrieveMobilePhoneCcbsList::RestoreListL()
       
   929 /**
       
   930  * This method restores a list from a buffer that contains the streamed version of the list
       
   931  */
       
   932 	{
       
   933 	iResults=CMobilePhoneCcbsList::NewL();
       
   934 	iResults->RestoreL(iResultsPtr);
       
   935 	FreeBuffer();
       
   936 	}
       
   937 
       
   938 /***********************************************************************************/
       
   939 //
       
   940 // Retrieve a list of SMS messages from a phone-side SMS store
       
   941 //
       
   942 /***********************************************************************************/
       
   943 
       
   944 EXPORT_C CRetrieveMobilePhoneSmsList* CRetrieveMobilePhoneSmsList::NewL(RMobilePhoneStore& aStore, RMobileSmsStore::TMobileSmsEntryExtensionId aType)
       
   945 /** This function member creates an instance of the CActive derived CRetrieveMobilePhoneSmsList 
       
   946 class.
       
   947 
       
   948 @param aStore An instance of RMobileSmsStore as this store that the list retrieval 
       
   949 class will operate on.
       
   950 @param aType Specifies whether GSM or CDMA message store entries will be retrieved.
       
   951 @return The newly created CRetrieveMobilePhoneSmsList class. 
       
   952 @capability None
       
   953 */
       
   954 	{
       
   955 	CRetrieveMobilePhoneSmsList* r=new(ELeave) CRetrieveMobilePhoneSmsList(aStore, aType);
       
   956 	CleanupStack::PushL(r);
       
   957 	r->ConstructL();
       
   958 	CleanupStack::Pop();
       
   959 	return r;
       
   960 	}	
       
   961 
       
   962 CRetrieveMobilePhoneSmsList::CRetrieveMobilePhoneSmsList(RMobilePhoneStore& aStore, RMobileSmsStore::TMobileSmsEntryExtensionId aType) 
       
   963 :	CAsyncRetrieveStoreList(aStore), iEntryType(aType)
       
   964 	{
       
   965 	}
       
   966 
       
   967 void CRetrieveMobilePhoneSmsList::ConstructL()
       
   968 	{
       
   969 	}
       
   970 
       
   971 EXPORT_C CRetrieveMobilePhoneSmsList::~CRetrieveMobilePhoneSmsList()
       
   972 /** The destructor frees all resources owned by the object, prior to its destruction. */
       
   973 	{
       
   974 	delete iGsmResults;
       
   975 	delete iCdmaResults;
       
   976 	}
       
   977 
       
   978 EXPORT_C CMobilePhoneGsmSmsList* CRetrieveMobilePhoneSmsList::RetrieveGsmListL()
       
   979 /** These function members will provide the client with a handle to the appropriate 
       
   980 GSM list class retrieved from the store.
       
   981 
       
   982 The client will call this function member once Start() has completed.
       
   983 
       
   984 When the client calls this function member the ownership of the list object 
       
   985 will transfer to the client, so the client is then responsible for eventual 
       
   986 deletion of this object. 
       
   987 
       
   988 @leave KErrNotFound If there is no valid list object to return to the client.
       
   989 @return A handle to the list class retrieved from the store. If there are no entries in 
       
   990 the list then a handle to an empty list is returned.
       
   991 @capability ReadUserData
       
   992 */
       
   993 	{
       
   994 	if ((iEntryType==RMobileSmsStore::KETelMobileGsmSmsEntryV1) && iGsmResults)
       
   995 		{
       
   996 		// Give ownership of GSM SMS list to caller of this method
       
   997 		CMobilePhoneGsmSmsList* ptr=iGsmResults;
       
   998 		iGsmResults=NULL;
       
   999 		return ptr;
       
  1000 		}
       
  1001 	else
       
  1002 		{
       
  1003 		User::Leave(KErrNotFound);
       
  1004 		return NULL;
       
  1005 		}
       
  1006 	}
       
  1007 	
       
  1008 EXPORT_C CMobilePhoneCdmaSmsList* CRetrieveMobilePhoneSmsList::RetrieveCdmaListL()
       
  1009 /** These function members will provide the client with a handle to the appropriate 
       
  1010 CDMA list class retrieved from the store.
       
  1011 
       
  1012 The client will call this function member once Start() has completed.
       
  1013 
       
  1014 When the client calls this function member the ownership of the list object 
       
  1015 will transfer to the client, so the client is then responsible for eventual 
       
  1016 deletion of this object. 
       
  1017 
       
  1018 @leave KErrNotFound If there is no valid list object to return to the client. 
       
  1019 @return A handle to the list class retrieved from the store. If there are no entries in 
       
  1020 the list then a handle to an empty list is returned.
       
  1021 @capability ReadUserData
       
  1022 */
       
  1023 	{
       
  1024 	if ((iEntryType==RMobileSmsStore::KETelMobileCdmaSmsEntryV1) && iCdmaResults)
       
  1025 		{
       
  1026 		// Give ownership of CDMA SMS list to caller of this method
       
  1027 		CMobilePhoneCdmaSmsList* ptr=iCdmaResults;
       
  1028 		iCdmaResults=NULL;
       
  1029 		return ptr;
       
  1030 		}
       
  1031 	else
       
  1032 		{
       
  1033 		User::Leave(KErrNotFound);
       
  1034 		return NULL;
       
  1035 		}
       
  1036 	}
       
  1037 	
       
  1038 EXPORT_C void CRetrieveMobilePhoneSmsList::Start(TRequestStatus& aReqStatus)
       
  1039 /** This function member starts the two-phase list retrieval of all entries within 
       
  1040 the store.
       
  1041 
       
  1042 @param aReqStatus On completion, the status of the request; KErrNone if successful, 
       
  1043 KErrNotSupported if the phone does not support access to an SMS list store 
       
  1044 and KErrNotFound if the store does not exist. If the list is empty then KErrNone
       
  1045 is returned.
       
  1046 @capability ReadUserData
       
  1047 */
       
  1048 	{
       
  1049 	InitiateRequest(aReqStatus,EFalse,KValueNotUsed,KValueNotUsed);
       
  1050 	}
       
  1051 	
       
  1052 EXPORT_C void CRetrieveMobilePhoneSmsList::StartBatch(TRequestStatus& aReqStatus, TInt aStartIndex, TInt aBatchSize)
       
  1053 /** This function member starts the two-phase list retrieval of a batch of entries.
       
  1054 
       
  1055 The client must supply the index (i.e. slot location) from which to start 
       
  1056 the batch retrieval and the number of entries to retrieve in that batch. Please 
       
  1057 note, that if the client specifies aStartIndex=X and aBatchSize=Y, the TSY 
       
  1058 should look in slot X to start with and then continue looking in slots until 
       
  1059 Y used entries are found (or less if the end of the store is reached). When 
       
  1060 the client receives the batch, the slot index attribute of the last entry 
       
  1061 in the list is not necessarily equal to aStartIndex+aBatchSize due to the 
       
  1062 possibility of empty slots. 
       
  1063 
       
  1064 @param aReqStatus On return, the status of the request; KErrNone if successful, 
       
  1065 KErrNotSupported if the phone does not support access to an emergency number 
       
  1066 store and KErrNotFound if the store does not exist. If the list is empty then KErrNone
       
  1067 is returned.
       
  1068 @param aStartIndex The slot where the TSY will start looking.
       
  1069 @param aBatchSize The number of entries the TSY will try to get. 
       
  1070 @capability ReadUserData
       
  1071 */
       
  1072 	{
       
  1073 	InitiateRequest(aReqStatus,ETrue,aStartIndex,aBatchSize);
       
  1074 	}
       
  1075 
       
  1076 void CRetrieveMobilePhoneSmsList::InitiateRequest(TRequestStatus& aReqStatus, TBool aBatch, TInt aStartIndex, TInt aBatchSize)
       
  1077 /**
       
  1078  * This method uses the base class's generic Start() method to start either reading 
       
  1079  * the whole list or just a batch of entries
       
  1080  *
       
  1081  * @param aReqStatus returns the result code after the asynchronous call completes
       
  1082  * @param aBatch Specifies whether a batch or all entries is being read
       
  1083  * @param aStartIndex Specifies the first index of the batch
       
  1084  * @param aBatchSize Specifies how many entries to read after the start
       
  1085  */
       
  1086 	{
       
  1087 	if (!CompleteIfInUse(aReqStatus))
       
  1088 		{
       
  1089 		delete iGsmResults;
       
  1090 		iGsmResults = NULL;
       
  1091 		delete iCdmaResults;
       
  1092 		iCdmaResults = NULL;
       
  1093 
       
  1094 		iRequestData().iClient=iId();
       
  1095 		iRequestData().iEntryType = iEntryType;
       
  1096 		iRequestData().iBatchRequest = aBatch;
       
  1097 		iRequestData().iStartIndex = aStartIndex;
       
  1098 		iRequestData().iBatchSize = aBatchSize;
       
  1099 		CAsyncRetrieveVariableLengthBufferV2::Start(aReqStatus,&iRequestData,&iId);
       
  1100 		}
       
  1101 	}
       
  1102 
       
  1103 void CRetrieveMobilePhoneSmsList::RestoreListL()
       
  1104 /**
       
  1105  * This method restores a list from a buffer that contains the streamed version of the list
       
  1106  */
       
  1107 	{
       
  1108 	if (iEntryType==RMobileSmsStore::KETelMobileGsmSmsEntryV1)
       
  1109 		{
       
  1110 		iGsmResults=CMobilePhoneGsmSmsList::NewL();
       
  1111 		iGsmResults->RestoreL(iResultsPtr);
       
  1112 		}
       
  1113 	else
       
  1114 		{
       
  1115 		iCdmaResults=CMobilePhoneCdmaSmsList::NewL();
       
  1116 		iCdmaResults->RestoreL(iResultsPtr);
       
  1117 		}
       
  1118 	FreeBuffer();
       
  1119 	}
       
  1120 
       
  1121 /***********************************************************************************/
       
  1122 //
       
  1123 // Retrieve a list of SMS parameters from a phone-side SMSP store
       
  1124 //
       
  1125 /***********************************************************************************/
       
  1126 
       
  1127 EXPORT_C CRetrieveMobilePhoneSmspList* CRetrieveMobilePhoneSmspList::NewL(RMobileSmsMessaging& aMessaging)
       
  1128 /** This member function creates an instance of the CActive derived CRetrieveMobilePhoneCbmiList 
       
  1129 class.
       
  1130 
       
  1131 @param aMessaging An instance of RMobileSmsMessaging as it is this messaging 
       
  1132 sub-session that the list retrieval class will operate on.
       
  1133 @return The newly created CRetrieveMobilePhoneSmspList class. 
       
  1134 @capability None
       
  1135 */
       
  1136 	{
       
  1137 	CRetrieveMobilePhoneSmspList* r=new(ELeave) CRetrieveMobilePhoneSmspList(aMessaging);
       
  1138 	CleanupStack::PushL(r);
       
  1139 	r->ConstructL();
       
  1140 	CleanupStack::Pop();
       
  1141 	return r;
       
  1142 	}	
       
  1143 
       
  1144 CRetrieveMobilePhoneSmspList::CRetrieveMobilePhoneSmspList(RMobileSmsMessaging& aMessaging) 
       
  1145 :	CAsyncRetrieveWithClientIds(aMessaging.SessionHandle().Handle(), aMessaging.SubSessionHandle()),
       
  1146 	iMessaging(aMessaging)
       
  1147 	{
       
  1148 	}
       
  1149 
       
  1150 void CRetrieveMobilePhoneSmspList::ConstructL()
       
  1151 	{
       
  1152 	iIpcPhase1=EMobileSmsMessagingGetSmspListPhase1;
       
  1153 	iIpcPhase2=EMobileSmsMessagingGetSmspListPhase2;
       
  1154 	iIpcCancel=EMobileSmsMessagingGetSmspListCancel;
       
  1155 	}
       
  1156 
       
  1157 EXPORT_C CRetrieveMobilePhoneSmspList::~CRetrieveMobilePhoneSmspList()
       
  1158 /** The destructor frees all resources owned by the object, prior to its destruction. */
       
  1159 	{
       
  1160 	Cancel();
       
  1161 	delete iResults;
       
  1162 	}
       
  1163 
       
  1164 EXPORT_C CMobilePhoneSmspList* CRetrieveMobilePhoneSmspList::RetrieveListL()
       
  1165 /** This member function provides the client with a handle to the list class retrieved 
       
  1166 from the store. The client will call this member function once Start() has 
       
  1167 completed.
       
  1168 
       
  1169 When the client calls this member function the ownership of the CMobilePhoneSmspList 
       
  1170 object will transfer to the client, so the client is then responsible for 
       
  1171 eventual deletion of this object.
       
  1172 
       
  1173 @leave KErrNotFound If there is no valid list object to return to the client.
       
  1174 @return A handle to the list class retrieved from the store. If there are no entries in 
       
  1175 the list then a handle to an empty list is returned.
       
  1176 @capability ReadDeviceData
       
  1177 */
       
  1178 	{
       
  1179 	if (iResults)
       
  1180 		{
       
  1181 		// Give ownership of list to caller of this method
       
  1182 		CMobilePhoneSmspList* ptr=iResults;
       
  1183 		iResults=NULL;
       
  1184 		return ptr;
       
  1185 		}
       
  1186 	else
       
  1187 		{
       
  1188 		User::Leave(KErrNotFound);
       
  1189 		return NULL;
       
  1190 		}
       
  1191 	}
       
  1192 		
       
  1193 void CRetrieveMobilePhoneSmspList::RestoreListL()
       
  1194 /**
       
  1195  * This method restores a list from a buffer that contains the streamed version of the list
       
  1196  */
       
  1197 	{
       
  1198 	iResults=CMobilePhoneSmspList::NewL();
       
  1199 	iResults->RestoreL(iResultsPtr);
       
  1200 	FreeBuffer();
       
  1201 	}
       
  1202 
       
  1203 EXPORT_C void CRetrieveMobilePhoneSmspList::Start(TRequestStatus& aReqStatus)
       
  1204 /** This member function starts the two-phase list retrieval. 
       
  1205 
       
  1206 @param aReqStatus On completion, the status of the request; KErrNone if successful, 
       
  1207 KErrNotSupported if the phone does not support access to a SMSP list store 
       
  1208 and KErrNotFound if the store does not exist. If the list is empty then KErrNone
       
  1209 is returned.
       
  1210 @capability ReadDeviceData
       
  1211 */
       
  1212 	{
       
  1213 	if (!CompleteIfInUse(aReqStatus))
       
  1214 		{
       
  1215 		delete iResults;
       
  1216 		iResults = NULL;
       
  1217 		CAsyncRetrieveVariableLengthBufferV2::Start(aReqStatus,&iId,&iId);
       
  1218 		}
       
  1219 	}
       
  1220 
       
  1221 void CRetrieveMobilePhoneSmspList::Get(TInt aIpc, TRequestStatus& aReqStatus, TDes8& aDes1, TDes8& aDes2)
       
  1222 /**
       
  1223  * This method uses the Get IPC request within RTelSubsessionBase
       
  1224  * to send one of the asynchronous phase requests to ETel server
       
  1225  *
       
  1226  * @param aIpc The IPC value of the asynchronous phase request
       
  1227  * @param aReqStatus The request status for the asynchronous phase request
       
  1228  * @param aDes1 The first parameter for the asynchronous phase request
       
  1229  * @param aDes2 The second parameter for the asynchronous phase request
       
  1230  */
       
  1231 	{
       
  1232 	iMessaging.Get(aIpc,aReqStatus,aDes1,aDes2);
       
  1233 	}
       
  1234 
       
  1235 void CRetrieveMobilePhoneSmspList::CancelReq(TInt aIpc1, TInt aIpc2)
       
  1236 /**
       
  1237  * This method uses the Cancel IPC request within RTelSubsessionBase
       
  1238  * to send a cancel for one of the asynchronous phases to ETel server
       
  1239  *
       
  1240  * @param aIpc1 The IPC value of the cancel request
       
  1241  * @param aIpc2 The IPC value of the original asynchronous phase request
       
  1242  */
       
  1243 	{
       
  1244 	iMessaging.CancelReq(aIpc1,aIpc2);
       
  1245 	}
       
  1246 
       
  1247 /***********************************************************************************/
       
  1248 //
       
  1249 // Retrieve a list of Broadcast ID entries from the SIM or phone
       
  1250 //
       
  1251 /***********************************************************************************/
       
  1252 
       
  1253 EXPORT_C CRetrieveMobilePhoneBroadcastIdList* CRetrieveMobilePhoneBroadcastIdList::NewL(RMobileBroadcastMessaging& aMessaging)
       
  1254 /** This member function creates an instance of the CRetrieveMobilePhoneBroadcastIdList 
       
  1255 class.
       
  1256 
       
  1257 @param aMessaging An instance of RMobileBroadcastMessaging as it is this messaging 
       
  1258 sub-session that the list retrieval class will operate on.
       
  1259 @return The newly created CRetrieveMobilePhoneBroadcastIdList. 
       
  1260 @capability None
       
  1261 */
       
  1262 	{
       
  1263 	CRetrieveMobilePhoneBroadcastIdList* r=new(ELeave) CRetrieveMobilePhoneBroadcastIdList(aMessaging);
       
  1264 	CleanupStack::PushL(r);
       
  1265 	r->ConstructL();
       
  1266 	CleanupStack::Pop();
       
  1267 	return r;
       
  1268 	}	
       
  1269 
       
  1270 CRetrieveMobilePhoneBroadcastIdList::CRetrieveMobilePhoneBroadcastIdList(RMobileBroadcastMessaging& aMessaging) : 
       
  1271 	CAsyncRetrieveWithClientIds(aMessaging.SessionHandle().Handle(), aMessaging.SubSessionHandle()),
       
  1272 	iMessaging(aMessaging)
       
  1273 	{
       
  1274 	}
       
  1275 
       
  1276 void CRetrieveMobilePhoneBroadcastIdList::ConstructL()
       
  1277 	{
       
  1278 	iIpcPhase1=EMobileBroadcastMessagingGetIdListPhase1;
       
  1279 	iIpcPhase2=EMobileBroadcastMessagingGetIdListPhase2;
       
  1280 	iIpcCancel=EMobileBroadcastMessagingGetIdListCancel;
       
  1281 	}
       
  1282 
       
  1283 EXPORT_C CRetrieveMobilePhoneBroadcastIdList::~CRetrieveMobilePhoneBroadcastIdList()
       
  1284 /** The destructor frees all resources owned by the object, prior to its destruction. */
       
  1285 	{
       
  1286 	Cancel();
       
  1287 	delete iResults;
       
  1288 	}
       
  1289 
       
  1290 EXPORT_C CMobilePhoneBroadcastIdList* CRetrieveMobilePhoneBroadcastIdList::RetrieveListL()
       
  1291 /** This member function provides the client with a handle to the list class retrieved 
       
  1292 from the store. The client will call this member function once Start() has 
       
  1293 completed with KErrNone.
       
  1294 
       
  1295 When the client calls this member function the ownership of the CMobilePhoneBroadcastIdList 
       
  1296 object will transfer to the client, so the client is then responsible for 
       
  1297 eventual deletion of this object.
       
  1298 
       
  1299 @leave KErrNotFound If there is no valid list object to return to the client.
       
  1300 @return A handle to the list class retrieved from the store. If there are no entries in 
       
  1301 the list then a handle to an empty list is returned.
       
  1302 @capability ReadUserData
       
  1303 */
       
  1304 	{
       
  1305 	if (iResults)
       
  1306 		{
       
  1307 		// Give ownership of list to caller of this method
       
  1308 		CMobilePhoneBroadcastIdList* ptr=iResults;
       
  1309 		iResults=NULL;
       
  1310 		return ptr;
       
  1311 		}
       
  1312 	else
       
  1313 		{
       
  1314 		User::Leave(KErrNotFound);
       
  1315 		return NULL;
       
  1316 		}
       
  1317 	}
       
  1318 
       
  1319 EXPORT_C void CRetrieveMobilePhoneBroadcastIdList::Start(TRequestStatus& aReqStatus, RMobileBroadcastMessaging::TMobileBroadcastIdType aIdType)
       
  1320 /** This member function starts the two-phase list retrieval.
       
  1321 
       
  1322 @param aReqStatus On completion, the status of the request; KErrNone if successful, 
       
  1323 KErrNotSupported if the phone does not support access to a phone book broadcast 
       
  1324 id list store and KErrNotFound if the store does not exist. If the list is empty then KErrNone
       
  1325 is returned.
       
  1326 @param aIdType Specifies whether to retrieve the GSM/WCDMA list of CBMI entries 
       
  1327 or the CDMA list of Service Category entries. 
       
  1328 @capability ReadUserData
       
  1329 */
       
  1330 	{
       
  1331 	if (!CompleteIfInUse(aReqStatus))
       
  1332 		{
       
  1333 		delete iResults;
       
  1334 		iResults = NULL;
       
  1335 
       
  1336 		iBroadcastIdRequestData().iIdType=aIdType;
       
  1337 		iBroadcastIdRequestData().iClient=iId();
       
  1338 		CAsyncRetrieveVariableLengthBufferV2::Start(aReqStatus,&iBroadcastIdRequestData,&iId);
       
  1339 		}
       
  1340 	}
       
  1341 		
       
  1342 void CRetrieveMobilePhoneBroadcastIdList::RestoreListL()
       
  1343 /**
       
  1344  * This method restores a list from a buffer that contains the streamed version of the list
       
  1345  */
       
  1346 	{
       
  1347 	iResults=CMobilePhoneBroadcastIdList::NewL();
       
  1348 	iResults->RestoreL(iResultsPtr);
       
  1349 	FreeBuffer();
       
  1350 	}
       
  1351 
       
  1352 void CRetrieveMobilePhoneBroadcastIdList::Get(TInt aIpc, TRequestStatus& aReqStatus, TDes8& aDes1, TDes8& aDes2)
       
  1353 /**
       
  1354  * This method uses the Get IPC request within RTelSubsessionBase
       
  1355  * to send one of the asynchronous phase requests to ETel server
       
  1356  *
       
  1357  * @param aIpc The IPC value of the asynchronous phase request
       
  1358  * @param aReqStatus The request status for the asynchronous phase request
       
  1359  * @param aDes1 The first parameter for the asynchronous phase request
       
  1360  * @param aDes2 The second parameter for the asynchronous phase request
       
  1361  */
       
  1362 	{
       
  1363 	iMessaging.Get(aIpc,aReqStatus,aDes1,aDes2);
       
  1364 	}
       
  1365 
       
  1366 void CRetrieveMobilePhoneBroadcastIdList::CancelReq(TInt aIpc1, TInt aIpc2)
       
  1367 /**
       
  1368  * This method uses the Cancel IPC request within RTelSubsessionBase
       
  1369  * to send a cancel for one of the asynchronous phases to ETel server
       
  1370  *
       
  1371  * @param aIpc1 The IPC value of the cancel request
       
  1372  * @param aIpc2 The IPC value of the original asynchronous phase request
       
  1373  */
       
  1374 	{
       
  1375 	iMessaging.CancelReq(aIpc1,aIpc2);
       
  1376 	}
       
  1377 
       
  1378 /***********************************************************************************/
       
  1379 //
       
  1380 // Retrieve a list of entries from a phone-side NAM store
       
  1381 // The list contains entries of type RMobileNamStore::TMobileNamEntryV1
       
  1382 //
       
  1383 /***********************************************************************************/
       
  1384 
       
  1385 EXPORT_C CRetrieveMobilePhoneNamList* CRetrieveMobilePhoneNamList::NewL(RMobilePhoneStore& aStore)
       
  1386 /** This member function member creates an instance of the CRetrieveMobilePhoneNamList 
       
  1387 class.
       
  1388 
       
  1389 @param aStore An instance of RMobileNamStore as it is this store that the 
       
  1390 list retrieval class will operate on.
       
  1391 @return The newly created CRetrieveMobilePhoneNamList class. 
       
  1392 @capability None
       
  1393 */
       
  1394 	{
       
  1395 	CRetrieveMobilePhoneNamList* r=new(ELeave) CRetrieveMobilePhoneNamList(aStore);
       
  1396 	CleanupStack::PushL(r);
       
  1397 	r->ConstructL();
       
  1398 	CleanupStack::Pop();
       
  1399 	return r;
       
  1400 	}	
       
  1401 
       
  1402 CRetrieveMobilePhoneNamList::CRetrieveMobilePhoneNamList(RMobilePhoneStore& aStore) : 
       
  1403 	CAsyncRetrieveStoreList(aStore), iListExtensionId(KETelExtMultimodeV1)
       
  1404 	{
       
  1405 	}
       
  1406 
       
  1407 void CRetrieveMobilePhoneNamList::ConstructL()
       
  1408 	{
       
  1409 	iRequestData().iClient=iId();
       
  1410 	}
       
  1411 
       
  1412 EXPORT_C CRetrieveMobilePhoneNamList::~CRetrieveMobilePhoneNamList()
       
  1413 /** The destructor frees all resources owned by the object, prior to its destruction. */
       
  1414 	{
       
  1415 	delete iResults;
       
  1416 	delete iResultsV4;
       
  1417 	}
       
  1418 
       
  1419 EXPORT_C CMobilePhoneNamList* CRetrieveMobilePhoneNamList::RetrieveListL()
       
  1420 /** This function member provides the client with a handle to the list class retrieved 
       
  1421 from the store. The client will call this function member once Start() has 
       
  1422 completed.
       
  1423 
       
  1424 When the client calls this function member the ownership of the CMobilePhoneNamList 
       
  1425 object will transfer to the client, so the client is then responsible for 
       
  1426 eventual deletion of this object. 
       
  1427 
       
  1428 @leave KErrNotFound if there is no valid list object to return to the client. 
       
  1429 @return A handle to the list class retrieved from the store. If there are no entries in 
       
  1430 the list then a handle to an empty list is returned.
       
  1431 @capability ReadDeviceData
       
  1432 */
       
  1433 	{
       
  1434 	if (iResults)
       
  1435 		{
       
  1436 		// Give ownership of list to caller of this method
       
  1437 		CMobilePhoneNamList* ptr=iResults;
       
  1438 		iResults=NULL;
       
  1439 		return ptr;
       
  1440 		}
       
  1441 	else
       
  1442 		{
       
  1443 		User::Leave(KErrNotFound);
       
  1444 		return NULL;
       
  1445 		}
       
  1446 	}
       
  1447 		
       
  1448 EXPORT_C CMobilePhoneNamListV4* CRetrieveMobilePhoneNamList::RetrieveListV4L()
       
  1449 /** This function member provides the client with a handle to the list class retrieved 
       
  1450 from the store. The client will call this function member once Start() has 
       
  1451 completed.
       
  1452 
       
  1453 When the client calls this function member the ownership of the CMobilePhoneNamListV4 
       
  1454 object will transfer to the client, so the client is then responsible for 
       
  1455 eventual deletion of this object. 
       
  1456 
       
  1457 @leave KErrNotFound if there is no valid list object to return to the client. 
       
  1458 @return A handle to the list class retrieved from the store. If there are no entries in 
       
  1459 the list then a handle to an empty list is returned.
       
  1460 @capability ReadDeviceData
       
  1461 */
       
  1462 	{
       
  1463 	if (iResultsV4)
       
  1464 		{
       
  1465 		// Give ownership of list to caller of this method
       
  1466 		CMobilePhoneNamListV4* ptr=iResultsV4;
       
  1467 		iResultsV4=NULL;
       
  1468 		return ptr;
       
  1469 		}
       
  1470 	else
       
  1471 		{
       
  1472 		User::Leave(KErrNotFound);
       
  1473 		return NULL;
       
  1474 		}
       
  1475 	}
       
  1476 		
       
  1477 void CRetrieveMobilePhoneNamList::RestoreListL()
       
  1478 /**
       
  1479  * This method restores a list from a buffer that contains the streamed version of the list
       
  1480  */
       
  1481 	{
       
  1482 	if(iListExtensionId == KETelExtMultimodeV1)
       
  1483 		{	
       
  1484 		iResults=CMobilePhoneNamList::NewL();
       
  1485 		iResults->RestoreL(iResultsPtr);
       
  1486 		FreeBuffer();
       
  1487 		}
       
  1488 	else if(iListExtensionId == KETelExtMultimodeV4)
       
  1489 		{
       
  1490 		iResultsV4=CMobilePhoneNamListV4::NewL();
       
  1491 		iResultsV4->RestoreL(iResultsPtr);
       
  1492 		FreeBuffer();
       
  1493 		}
       
  1494 	else
       
  1495 		{
       
  1496 		User::Leave(KErrNotSupported);
       
  1497 		}
       
  1498 	}
       
  1499 
       
  1500 EXPORT_C void CRetrieveMobilePhoneNamList::Start(TRequestStatus& aReqStatus, TInt aNamId)
       
  1501 /** This function member starts the two-phase list retrieval.
       
  1502 
       
  1503 @param aReqStatus On completion, the status of the request; KErrNone if successful, 
       
  1504 KErrNotSupported if the phone does not support access to an NAM list store 
       
  1505 and KErrNotFound if the store does not exist. If the list is empty then KErrNone
       
  1506 is returned.
       
  1507 @param aNamId The identity of the NAM that the client wishes to read. 
       
  1508 @capability ReadDeviceData
       
  1509 */
       
  1510 	{
       
  1511 	if (!CompleteIfInUse(aReqStatus))
       
  1512 		{
       
  1513 		iIpcPhase1=EMobilePhoneStoreReadAllPhase1;
       
  1514 		iIpcPhase2=EMobilePhoneStoreReadAllPhase2;
       
  1515 		iIpcCancel=EMobilePhoneStoreReadAllCancel;
       
  1516 		iListExtensionId = KETelExtMultimodeV1;
       
  1517 
       
  1518 		delete iResults;
       
  1519 		iResults = NULL;
       
  1520 
       
  1521 		iRequestData().iNamId = aNamId;
       
  1522 		CAsyncRetrieveVariableLengthBufferV2::Start(aReqStatus,&iRequestData,&iId);
       
  1523 		}
       
  1524 	}
       
  1525 
       
  1526 EXPORT_C void CRetrieveMobilePhoneNamList::StartV4(TRequestStatus& aReqStatus, TInt aNamId)
       
  1527 /** This function member starts the two-phase list retrieval.
       
  1528 
       
  1529 @param aReqStatus On completion, the status of the request; KErrNone if successful, 
       
  1530 KErrNotSupported if the phone does not support access to an NAM list store 
       
  1531 and KErrNotFound if the store does not exist. If the list is empty then KErrNone
       
  1532 is returned.
       
  1533 @param aNamId The identity of the NAM that the client wishes to read. 
       
  1534 @capability ReadDeviceData
       
  1535 */
       
  1536 	{
       
  1537 	if (!CompleteIfInUse(aReqStatus))
       
  1538 		{
       
  1539 		iIpcPhase1=EMobilePhoneStoreReadAllV4Phase1;
       
  1540 		iIpcPhase2=EMobilePhoneStoreReadAllV4Phase2;
       
  1541 		iIpcCancel=EMobilePhoneStoreReadAllV4Cancel;
       
  1542 		iListExtensionId = KETelExtMultimodeV4;
       
  1543 
       
  1544 		delete iResultsV4;
       
  1545 		iResultsV4 = NULL;
       
  1546 
       
  1547 		iRequestData().iNamId = aNamId;
       
  1548 		CAsyncRetrieveVariableLengthBufferV2::Start(aReqStatus,&iRequestData,&iId);
       
  1549 		}
       
  1550 	}
       
  1551 
       
  1552 
       
  1553 /***********************************************************************************/
       
  1554 //
       
  1555 // Retrieve a list of entries from a phone-side Own Number store
       
  1556 //
       
  1557 /***********************************************************************************/
       
  1558 
       
  1559 EXPORT_C CRetrieveMobilePhoneONList* CRetrieveMobilePhoneONList::NewL(RMobilePhoneStore& aStore)
       
  1560 /** This function member creates an instance of the CActive derived CRetrieveMobilePhoneONList 
       
  1561 class.
       
  1562 
       
  1563 @param aStore An instance of RMobileONStore as this store that the list retrieval 
       
  1564 class will operate on.
       
  1565 @return The newly created CRetrieveMobilePhoneONList class. 
       
  1566 @capability None
       
  1567 */
       
  1568 	{
       
  1569 	CRetrieveMobilePhoneONList* r=new(ELeave) CRetrieveMobilePhoneONList(aStore);
       
  1570 	CleanupStack::PushL(r);
       
  1571 	r->ConstructL();
       
  1572 	CleanupStack::Pop();
       
  1573 	return r;
       
  1574 	}	
       
  1575 
       
  1576 CRetrieveMobilePhoneONList::CRetrieveMobilePhoneONList(RMobilePhoneStore& aStore) : 
       
  1577 	CAsyncRetrieveStoreList(aStore)
       
  1578 	{
       
  1579 	}
       
  1580 
       
  1581 void CRetrieveMobilePhoneONList::ConstructL()
       
  1582 	{
       
  1583 	}
       
  1584 
       
  1585 EXPORT_C CRetrieveMobilePhoneONList::~CRetrieveMobilePhoneONList()
       
  1586 /** The destructor frees all resources owned by the object, prior to its destruction. */
       
  1587 	{
       
  1588 	delete iResults;
       
  1589 	}
       
  1590 
       
  1591 EXPORT_C CMobilePhoneONList* CRetrieveMobilePhoneONList::RetrieveListL()
       
  1592 /** This function member provides the client with a handle to the list class retrieved 
       
  1593 from the store. The client will call this function member once Start() has 
       
  1594 completed.
       
  1595 
       
  1596 When the client calls this function member the ownership of the CMobilePhoneONList 
       
  1597 object will transfer to the client, so the client is then responsible for 
       
  1598 eventual deletion of this object.
       
  1599 
       
  1600 @leave KErrNotFound if there is no valid list object to return to the client. 
       
  1601 @return A handle to the list class retrieved from the store. If there are no entries in 
       
  1602 the list then a handle to an empty list is returned.
       
  1603 @capability ReadUserData
       
  1604 */
       
  1605 	{
       
  1606 	if (iResults)
       
  1607 		{
       
  1608 		// Give ownership of list to caller of this method
       
  1609 		CMobilePhoneONList* ptr=iResults;
       
  1610 		iResults=NULL;
       
  1611 		return ptr;
       
  1612 		}
       
  1613 	else
       
  1614 		{
       
  1615 		User::Leave(KErrNotFound);
       
  1616 		return NULL;
       
  1617 		}
       
  1618 	}
       
  1619 		
       
  1620 void CRetrieveMobilePhoneONList::RestoreListL()
       
  1621 /**
       
  1622  * This method restores a list from a buffer that contains the streamed version of the list
       
  1623  */
       
  1624 	{
       
  1625 	iResults=CMobilePhoneONList::NewL();
       
  1626 	iResults->RestoreL(iResultsPtr);
       
  1627 	FreeBuffer();
       
  1628 	}
       
  1629 
       
  1630 EXPORT_C void CRetrieveMobilePhoneONList::Start(TRequestStatus& aReqStatus)
       
  1631 /** This function member starts the two-phase retrieval of all own numbers.
       
  1632 
       
  1633 @param aReqStatus On completion, the status of the request; KErrNone if successful, 
       
  1634 KErrNotSupported if the phone does not support a access to an own number store 
       
  1635 and KErrNotFound if the store does not exist. If the list is empty then KErrNone
       
  1636 is returned.
       
  1637 @capability ReadUserData
       
  1638 */
       
  1639 	{
       
  1640 	if (!CompleteIfInUse(aReqStatus))
       
  1641 		{
       
  1642 		delete iResults;
       
  1643 		iResults = NULL;
       
  1644 		CAsyncRetrieveVariableLengthBufferV2::Start(aReqStatus,&iId,&iId);
       
  1645 		}
       
  1646 	}
       
  1647 
       
  1648 /***********************************************************************************/
       
  1649 //
       
  1650 // Retrieve a list of entries from a phone-side Emergency Number store
       
  1651 //
       
  1652 /***********************************************************************************/
       
  1653 
       
  1654 EXPORT_C CRetrieveMobilePhoneENList* CRetrieveMobilePhoneENList::NewL(RMobilePhoneStore& aStore)
       
  1655 /** This function member creates an instance of the CActive derived CRetrieveMobilePhoneENList 
       
  1656 class.
       
  1657 
       
  1658 @param aStore An instance of RMobileENStore as it this store that the list 
       
  1659 retrieval class will operate on.
       
  1660 @return The newly created CRetrieveMobilePhoneENList class. 
       
  1661 @capability None
       
  1662 */
       
  1663 	{
       
  1664 	CRetrieveMobilePhoneENList* r=new(ELeave) CRetrieveMobilePhoneENList(aStore);
       
  1665 	CleanupStack::PushL(r);
       
  1666 	r->ConstructL();
       
  1667 	CleanupStack::Pop();
       
  1668 	return r;
       
  1669 	}	
       
  1670 
       
  1671 CRetrieveMobilePhoneENList::CRetrieveMobilePhoneENList(RMobilePhoneStore& aStore) : 
       
  1672 	CAsyncRetrieveStoreList(aStore)
       
  1673 	{
       
  1674 	}
       
  1675 
       
  1676 void CRetrieveMobilePhoneENList::ConstructL()
       
  1677 	{
       
  1678 	}
       
  1679 
       
  1680 EXPORT_C CRetrieveMobilePhoneENList::~CRetrieveMobilePhoneENList()
       
  1681 /** The destructor frees all resources owned by the object, prior to its destruction. */
       
  1682 	{
       
  1683 	delete iResults;
       
  1684 	}
       
  1685 
       
  1686 EXPORT_C CMobilePhoneENList* CRetrieveMobilePhoneENList::RetrieveListL()
       
  1687 /** This function member provides the client with a handle to the list class retrieved 
       
  1688 from the store. The client will call this function member once Start() has 
       
  1689 completed.
       
  1690 
       
  1691 When the client calls this function member the ownership of the CMobilePhoneENList 
       
  1692 object will transfer to the client, so the client is then responsible for 
       
  1693 eventual deletion of this object.
       
  1694 
       
  1695 @leave KErrNotFound if there is no valid list object to return to the client. 
       
  1696 @return A handle to the list class retrieved from the store. If there are no entries in 
       
  1697 the list then a handle to an empty list is returned.
       
  1698 @capability ReadUserData
       
  1699 */
       
  1700 	{
       
  1701 	if (iResults)
       
  1702 		{
       
  1703 		// Give ownership of list to caller of this method
       
  1704 		CMobilePhoneENList* ptr=iResults;
       
  1705 		iResults=NULL;
       
  1706 		return ptr;
       
  1707 		}
       
  1708 	else
       
  1709 		{
       
  1710 		User::Leave(KErrNotFound);
       
  1711 		return NULL;
       
  1712 		}
       
  1713 	}
       
  1714 		
       
  1715 void CRetrieveMobilePhoneENList::RestoreListL()
       
  1716 /**
       
  1717  * This method restores a list from a buffer that contains the streamed version of the list
       
  1718  */
       
  1719 	{
       
  1720 	iResults=CMobilePhoneENList::NewL();
       
  1721 	iResults->RestoreL(iResultsPtr);
       
  1722 	FreeBuffer();
       
  1723 	}
       
  1724 
       
  1725 EXPORT_C void CRetrieveMobilePhoneENList::Start(TRequestStatus& aReqStatus)
       
  1726 /** This function member starts the two-phase retrieval of all emergency numbers.
       
  1727 
       
  1728 @param aReqStatus On completion, the status of the request; KErrNone if successful, 
       
  1729 KErrNotSupported if the phone does not support access to an emergency number 
       
  1730 store and KErrNotFound if the store does not exist. If the list is empty then KErrNone
       
  1731 is returned.
       
  1732 @capability ReadUserData
       
  1733 */
       
  1734 	{
       
  1735 	if (!CompleteIfInUse(aReqStatus))
       
  1736 		{
       
  1737 		delete iResults;
       
  1738 		iResults = NULL;
       
  1739 		CAsyncRetrieveVariableLengthBufferV2::Start(aReqStatus,&iId,&iId);
       
  1740 		}
       
  1741 	}
       
  1742 
       
  1743 /***********************************************************************************/
       
  1744 //
       
  1745 // Retrieve a list of stored network entries 
       
  1746 //
       
  1747 /***********************************************************************************/
       
  1748 
       
  1749 EXPORT_C CRetrieveMobilePhonePreferredNetworks* CRetrieveMobilePhonePreferredNetworks::NewL(RMobilePhone& aPhone)
       
  1750 /**
       
  1751 Creates an instance of the CActive derived CRetrieveMobilePhonePrefferredNetworks class
       
  1752 
       
  1753 @param aPhone Reference to clients RMobilePhone sub-session. 
       
  1754 @return A pointer to the newly creasted CRetrieveMobilePhonePreferredNetworks object.
       
  1755  
       
  1756 @capability None
       
  1757 */
       
  1758 	{
       
  1759 	CRetrieveMobilePhonePreferredNetworks* r=new(ELeave) CRetrieveMobilePhonePreferredNetworks(aPhone);
       
  1760 	CleanupStack::PushL(r);
       
  1761 	r->ConstructL();
       
  1762 	CleanupStack::Pop();
       
  1763 	return r;
       
  1764 	}	
       
  1765 
       
  1766 CRetrieveMobilePhonePreferredNetworks::CRetrieveMobilePhonePreferredNetworks(RMobilePhone& aPhone) : 
       
  1767 	CAsyncRetrievePhoneList(aPhone)
       
  1768 	{
       
  1769 	}
       
  1770 
       
  1771 void CRetrieveMobilePhonePreferredNetworks::ConstructL()
       
  1772 	{
       
  1773 	iIpcPhase1=EMobilePhoneGetPreferredNetworksPhase1;
       
  1774 	iIpcPhase2=EMobilePhoneGetPreferredNetworksPhase2;
       
  1775 	iIpcCancel=EMobilePhoneGetPreferredNetworksCancel;
       
  1776 	}
       
  1777 	
       
  1778 EXPORT_C CRetrieveMobilePhonePreferredNetworks::~CRetrieveMobilePhonePreferredNetworks()
       
  1779 /**
       
  1780 Destructor
       
  1781 */
       
  1782 		{
       
  1783 		delete iResults;
       
  1784 	}
       
  1785 	
       
  1786 EXPORT_C CMobilePhoneStoredNetworkList* CRetrieveMobilePhonePreferredNetworks::RetrieveListL()
       
  1787 /**
       
  1788 Returns a pointer to the retrieved list.
       
  1789 
       
  1790 @return CMobilePhoneStoredNetworkList* Pointer to the detected networks list.
       
  1791 If there are no entries in the list then a handle to an empty list is returned.
       
  1792 
       
  1793 @capability None
       
  1794 */
       
  1795 	{
       
  1796 	if (iResults)
       
  1797 		{
       
  1798 		// Give ownership of list to caller of this method
       
  1799 		CMobilePhoneStoredNetworkList* ptr=iResults;
       
  1800 		iResults = NULL;
       
  1801 		return ptr;
       
  1802 		}
       
  1803 	else
       
  1804 		{
       
  1805 		User::Leave(KErrNotFound);
       
  1806 		return NULL;
       
  1807 		}
       
  1808 	}
       
  1809 
       
  1810 EXPORT_C void CRetrieveMobilePhonePreferredNetworks::Start(TRequestStatus& aReqStatus)
       
  1811 /**
       
  1812 Starts the retrieval of the stored networks list.
       
  1813 
       
  1814 @param aReqStatus Returns the result code after the asynchronous call completes.
       
  1815 If the list is empty then KErrNone is returned.
       
  1816  
       
  1817 @capability ReadDeviceData
       
  1818 */
       
  1819 	{
       
  1820 	if (!CompleteIfInUse(aReqStatus))
       
  1821 		{
       
  1822 		delete iResults;
       
  1823 		iResults = NULL;
       
  1824 		CAsyncRetrieveVariableLengthBufferV2::Start(aReqStatus,&iId,&iId);
       
  1825 		}
       
  1826 	}
       
  1827 
       
  1828 
       
  1829 void CRetrieveMobilePhonePreferredNetworks::RestoreListL()
       
  1830 /**
       
  1831 Restores a list from a buffer that contains the streamed version of the list
       
  1832  */
       
  1833 	{
       
  1834 	iResults=CMobilePhoneStoredNetworkList::NewL();
       
  1835 	iResults->RestoreL(iResultsPtr);
       
  1836 	FreeBuffer();
       
  1837 	}
       
  1838 
       
  1839 //
       
  1840 //
       
  1841 // class for retrieval of authorization data
       
  1842 //
       
  1843 /***********************************************************************************/
       
  1844 /** standard constructor, initialises data members and the base class*/
       
  1845 CAsyncRetrieveAuthorizationInfo::CAsyncRetrieveAuthorizationInfo(RMobilePhone& aPhone,RMobilePhone::CImsAuthorizationInfoV5& aAuthInfo)
       
  1846 : iPhone(aPhone),iAuthInfo(aAuthInfo)
       
  1847 	{
       
  1848 	iId().iSessionHandle=aPhone.SessionHandle().Handle();
       
  1849 	iId().iSubSessionHandle=aPhone.SubSessionHandle();
       
  1850 	iIpcPhase1=EMobilePhoneAuthorizationInfoPhase1;
       
  1851 	iIpcPhase2=EMobilePhoneAuthorizationInfoPhase2;
       
  1852 	iIpcCancel=EMobilePhoneAuthorizationInfoCancel;
       
  1853 	iAuthInfoValid=FALSE;
       
  1854 	}
       
  1855 /** overload of base class virtual method, deserialize data retrieved from TSY to 
       
  1856 provided data structure*/
       
  1857 void CAsyncRetrieveAuthorizationInfo::RestoreListL()
       
  1858 	{
       
  1859 	iAuthInfo.InternalizeL(iResultsPtr);
       
  1860 	iAuthInfoValid=TRUE;
       
  1861 	FreeBuffer();
       
  1862 	}
       
  1863 /** Issues requested IPC to the ETEL/TSY */	
       
  1864 void CAsyncRetrieveAuthorizationInfo::Get(TInt aIpc, TRequestStatus& aReqStatus, TDes8& aDes1, TDes8& aDes2)
       
  1865 	{
       
  1866 	iPhone.Get(aIpc,aReqStatus,aDes1,aDes2);
       
  1867 	}
       
  1868 /** Cancels previously issued request*/
       
  1869 void CAsyncRetrieveAuthorizationInfo::CancelReq(TInt aIpc1, TInt aIpc2)
       
  1870 	{
       
  1871 	iPhone.CancelReq(aIpc1,aIpc2);
       
  1872 	}
       
  1873 
       
  1874 /** 
       
  1875 Indicates whether iAuthInfo data member is valid - data from ISIM/USIM retrieved 
       
  1876 
       
  1877 @return Whether the authorization information is valid.
       
  1878 */ 
       
  1879 EXPORT_C TBool CAsyncRetrieveAuthorizationInfo::AuthInfoValid() const
       
  1880 	{
       
  1881 	return iAuthInfoValid;
       
  1882 	}
       
  1883 
       
  1884 /** 
       
  1885 Starts the 2 phase retrieval.
       
  1886 
       
  1887 @param aReqStatus On return, KErrNone if successful.
       
  1888 @capability ReadDeviceData
       
  1889 */
       
  1890 EXPORT_C void CAsyncRetrieveAuthorizationInfo::Start(TRequestStatus& aReqStatus)
       
  1891 	{
       
  1892 	if (!CompleteIfInUse(aReqStatus))
       
  1893 		{
       
  1894 		iAuthInfoValid=FALSE;
       
  1895 		iIpcPhase1=EMobilePhoneAuthorizationInfoPhase1;
       
  1896 		iIpcPhase2=EMobilePhoneAuthorizationInfoPhase2;
       
  1897 		iIpcCancel=EMobilePhoneAuthorizationInfoCancel;
       
  1898 		CAsyncRetrieveVariableLengthBufferV2::Start(aReqStatus,&iId,&iId);
       
  1899 		}
       
  1900 	}
       
  1901 
       
  1902 
       
  1903 /** 
       
  1904 Standard 2 phase constructor.
       
  1905 
       
  1906 @param aPhone Reference to an open phone object.
       
  1907 @param anAuthInfo On completion will contains the IMS authorization information.
       
  1908 @return Pointer instance.of class.
       
  1909 */
       
  1910 EXPORT_C CAsyncRetrieveAuthorizationInfo* CAsyncRetrieveAuthorizationInfo::NewL(RMobilePhone& aPhone,RMobilePhone::CImsAuthorizationInfoV5& aAuthInfo)
       
  1911 	{
       
  1912 	return new (ELeave)CAsyncRetrieveAuthorizationInfo(aPhone,aAuthInfo);
       
  1913 	}
       
  1914 
       
  1915 
       
  1916 //
       
  1917 //
       
  1918 // Class for two-phased submission and retrieval of EAP packets
       
  1919 //
       
  1920 //
       
  1921 
       
  1922 /**
       
  1923 Creates a new two-phase retrieval object for sending an EAP packet to
       
  1924 a DF_EAP and receiving its response.
       
  1925 
       
  1926 @param aScEap The sub-session handle that will be used by the returned
       
  1927               object, for submitting requests to the server.
       
  1928 @param aEapRequestPckt The EAP request packet to send to the smart card
       
  1929                        application's (and aScEap's) DF_EAP.
       
  1930 @return Pointer to a new CAsyncSmartCardEapAuthentication object for
       
  1931         use in one EAP request/response.
       
  1932 */
       
  1933 EXPORT_C CAsyncSmartCardEapAuthentication* CAsyncSmartCardEapAuthentication::NewL(RMobileSmartCardEap& aScEap, const TDesC8& aEapRequestPckt)
       
  1934 	{
       
  1935 	CAsyncSmartCardEapAuthentication* self = new(ELeave) CAsyncSmartCardEapAuthentication(aScEap);
       
  1936 	CleanupStack::PushL(self);
       
  1937 	self->ConstructL(aEapRequestPckt);
       
  1938 	CleanupStack::Pop();
       
  1939 	return self;
       
  1940 	}
       
  1941 
       
  1942 /**
       
  1943 Default constructor.  Initialises the IPC values to be used in the two-
       
  1944 phase retrieval process.
       
  1945 
       
  1946 @param aScEap The sub-session handle that will be used by the returned
       
  1947               object, for submitting requests to the server.
       
  1948 */
       
  1949 CAsyncSmartCardEapAuthentication::CAsyncSmartCardEapAuthentication(RMobileSmartCardEap& aScEap)
       
  1950 : iSmartCardEap(aScEap)
       
  1951 	{
       
  1952 	iIpcPhase1 = EMobileSmartCardEapAuthenticationPhase1;
       
  1953 	iIpcPhase2 = EMobileSmartCardEapAuthenticationPhase2;
       
  1954 	iIpcCancel = EMobileSmartCardEapAuthenticationCancel;
       
  1955 	}
       
  1956 
       
  1957 /**
       
  1958 Default destructor.
       
  1959 */
       
  1960 EXPORT_C CAsyncSmartCardEapAuthentication::~CAsyncSmartCardEapAuthentication()
       
  1961 	{
       
  1962 	delete iReqData;
       
  1963 	}
       
  1964 
       
  1965 /**
       
  1966 Second phase constructor.  Ensures memory can be allocated on the
       
  1967 client-side for storing a copy of the EAP request packet.
       
  1968 
       
  1969 @param aEapRequestPckt The EAP request packet to send to the smart card
       
  1970                        application's (and aScEap's) DF_EAP.  This will
       
  1971                        be copied to this object's member data.
       
  1972 */
       
  1973 void CAsyncSmartCardEapAuthentication::ConstructL(const TDesC8& aEapRequestPckt)
       
  1974 	{
       
  1975 	iReqData = RMobileSmartCardEap::CEapAuthenticateRequestDataV6::NewL();
       
  1976 	iReqData->SetEapReqPacketL(aEapRequestPckt);
       
  1977 	}
       
  1978 
       
  1979 /**
       
  1980 Starts the two-phase retrieval process.  The process only completes
       
  1981 when both phases of retrieval complete (or in case of error/failure/
       
  1982 cancellation).
       
  1983 
       
  1984 @param aReqStatus Returns the result code after the asynchronous call
       
  1985                   completes.  Request completion with KErrBadHandle
       
  1986                   means the RMobileSmartCardEap sub-session handle,
       
  1987                   given in the NewL(), has not been initialised
       
  1988                   (RMobileSmartCardEap::InitialiseEapMethod()).
       
  1989                   Completion with KErrInUse means the handle instance
       
  1990                   is not the current owner of the DF_EAP.
       
  1991 
       
  1992 @see RMobileSmartCardEap::InitialiseEapMethod()
       
  1993 */
       
  1994 EXPORT_C void CAsyncSmartCardEapAuthentication::Start(TRequestStatus& aReqStatus)
       
  1995 	{
       
  1996 	if (iSmartCardEap.iSemaphore.Handle() == 0)
       
  1997 		{
       
  1998 		TRequestStatus* status1 = &aReqStatus;
       
  1999 		User::RequestComplete(status1, KErrBadHandle);
       
  2000 		return;
       
  2001 		}
       
  2002 
       
  2003 	if (!iSmartCardEap.iOwnsEapMethodLock)
       
  2004 		{
       
  2005 		TRequestStatus* status2 = &aReqStatus;
       
  2006 		User::RequestComplete(status2, KErrInUse);
       
  2007 		return;
       
  2008 		}
       
  2009 
       
  2010 	TRAPD(err, iReqData->ExternalizeL(iSmartCardEap.iMmPtrHolder->iReqAuthData));
       
  2011 	if (err != KErrNone)
       
  2012 		{
       
  2013 		TRequestStatus* status3 = &aReqStatus;
       
  2014 		User::RequestComplete(status3, err);
       
  2015 		return;
       
  2016 		}
       
  2017 
       
  2018 	TPtr8& ptr1 = iSmartCardEap.iMmPtrHolder->iReqAuthData;
       
  2019 
       
  2020 	CAsyncRetrieveVariableLengthBufferV2::Start(aReqStatus, &ptr1, &ptr1);
       
  2021 	}
       
  2022 
       
  2023 /**
       
  2024 Used to retrieve a descriptor pointing to the response data from the
       
  2025 DF_EAP.
       
  2026 
       
  2027 @return Reference to the descriptor of the retrieved response data.  If
       
  2028         this method is called prior to a successful completion of
       
  2029         CAsyncSmartCardEapAuthentication::Start(), the descriptor will
       
  2030         point to NULL.
       
  2031 */
       
  2032 EXPORT_C TDesC8& CAsyncSmartCardEapAuthentication::RetrieveEapResponse()
       
  2033 	{
       
  2034 	return iResultsPtr;
       
  2035 	}
       
  2036 
       
  2037 /**
       
  2038 Cancels the request specified through the sub-session this object was
       
  2039 created with.
       
  2040 */
       
  2041 void CAsyncSmartCardEapAuthentication::CancelReq(TInt aIpc1, TInt aIpc2)
       
  2042 	{
       
  2043 	iSmartCardEap.CancelReq(aIpc1, aIpc2);
       
  2044 	}
       
  2045 
       
  2046 /**
       
  2047 Sends a request through the sub-session this object was created with.
       
  2048 */
       
  2049 void CAsyncSmartCardEapAuthentication::Get(TInt aIpc, TRequestStatus& aReqStatus, TDes8& aDes1, TDes8& aDes2)
       
  2050 	{
       
  2051 	iSmartCardEap.Get(aIpc, aReqStatus, aDes1, aDes2);
       
  2052 	}
       
  2053 
       
  2054 //
       
  2055 //
       
  2056 // Class for two-phased retrieval of GBA NAF and MBMS MSK Authentication List
       
  2057 //
       
  2058 //
       
  2059 
       
  2060 EXPORT_C CRetrieveMobilePhoneAuthenticationIds* CRetrieveMobilePhoneAuthenticationIds::NewL(RMobilePhone& aPhone)
       
  2061 /** This function member creates an instance of the CActive derived CRetrieveMobilePhoneAuthenticationIds 
       
  2062 class.
       
  2063 
       
  2064 @param aPhone An instance of RMobilePhone as this store that the list retrieval 
       
  2065 class will operate on.
       
  2066 @return The newly created CRetrieveMobilePhoneAuthenticationIds class. 
       
  2067 @capability None
       
  2068 */
       
  2069 	{
       
  2070 	CRetrieveMobilePhoneAuthenticationIds* r=new(ELeave) CRetrieveMobilePhoneAuthenticationIds(aPhone);
       
  2071 	CleanupStack::PushL(r);
       
  2072 	r->ConstructL();
       
  2073 	CleanupStack::Pop();
       
  2074 	return r;
       
  2075 	}	
       
  2076 
       
  2077 CRetrieveMobilePhoneAuthenticationIds::CRetrieveMobilePhoneAuthenticationIds(RMobilePhone& aPhone)
       
  2078 :	CAsyncRetrievePhoneList(aPhone) 
       
  2079 	{
       
  2080 	}
       
  2081 
       
  2082 void CRetrieveMobilePhoneAuthenticationIds::ConstructL()
       
  2083 	{
       
  2084 	iIpcPhase1=EMobilePhoneAuthenticationListPhase1;
       
  2085 	iIpcPhase2=EMobilePhoneAuthenticationListPhase2;
       
  2086 	iIpcCancel=EMobilePhoneAuthenticationListCancel;
       
  2087 	}
       
  2088 
       
  2089 
       
  2090 EXPORT_C CRetrieveMobilePhoneAuthenticationIds::~CRetrieveMobilePhoneAuthenticationIds()
       
  2091 /** The destructor frees all resources owned by the object, prior to its destruction.
       
  2092  */
       
  2093 	{
       
  2094 	delete iGbaNafIdResults;
       
  2095 	delete iMbmsMskIdResults;
       
  2096 	}
       
  2097 
       
  2098 EXPORT_C CMobilePhoneGbaNafIdList* CRetrieveMobilePhoneAuthenticationIds::RetrieveGbaListL()
       
  2099 /** These function members will provide the client with a handle to the appropriate 
       
  2100 GbaNaf list class retrieved from the Authentication.
       
  2101 
       
  2102 The client will call this function member once Start() has completed.
       
  2103 
       
  2104 When the client calls this function member the ownership of the list object 
       
  2105 will transfer to the client, so the client is then responsible for eventual 
       
  2106 deletion of this object. 
       
  2107 
       
  2108 @leave KErrNotFound If there is no valid list object to return to the client.
       
  2109 @return A handle to the list class retrieved from the store. If there are no entries in 
       
  2110 the list then a handle to an empty list is returned.
       
  2111 @capability ReadDeviceData
       
  2112 */
       
  2113 	{
       
  2114 	if ((iListType==RMobilePhone::EGbaNafIdList) && iGbaNafIdResults)
       
  2115 		{
       
  2116 		// Give ownership of GbaNaf list to caller of this method
       
  2117 		CMobilePhoneGbaNafIdList* ptr=iGbaNafIdResults;
       
  2118 		iGbaNafIdResults=NULL;
       
  2119 		return ptr;
       
  2120 		}
       
  2121 	else
       
  2122 		{
       
  2123 		User::Leave(KErrNotFound);
       
  2124 		return NULL;
       
  2125 		}
       
  2126 	}
       
  2127 	
       
  2128 EXPORT_C CMobilePhoneMbmsMskIdList* CRetrieveMobilePhoneAuthenticationIds::RetrieveMbmsListL()
       
  2129 /** These function members will provide the client with a handle to the appropriate 
       
  2130 MBMS MSK ID list class retrieved from the Authentication.
       
  2131 
       
  2132 The client will call this function member once Start() has completed.
       
  2133 
       
  2134 When the client calls this function member the ownership of the list object 
       
  2135 will transfer to the client, so the client is then responsible for eventual 
       
  2136 deletion of this object. 
       
  2137 
       
  2138 @leave KErrNotFound If there is no valid list object to return to the client.
       
  2139 @return A handle to the list class retrieved from the store. If there are no entries in 
       
  2140 the list then a handle to an empty list is returned.
       
  2141 @capability ReadDeviceData
       
  2142 */
       
  2143 	{
       
  2144 	if ((iListType==RMobilePhone::EMbmsMskIdList) && iMbmsMskIdResults)
       
  2145 		{
       
  2146 		// Give ownership of MbmsMsk list to caller of this method
       
  2147 		CMobilePhoneMbmsMskIdList* ptr=iMbmsMskIdResults;
       
  2148 		iMbmsMskIdResults=NULL;
       
  2149 		return ptr;
       
  2150 		}
       
  2151 	else
       
  2152 		{
       
  2153 		User::Leave(KErrNotFound);
       
  2154 		return NULL;
       
  2155 		}
       
  2156 	}	
       
  2157 
       
  2158 EXPORT_C void CRetrieveMobilePhoneAuthenticationIds::Start(TRequestStatus& aReqStatus,const TDesC8& aData)
       
  2159 /** This function member starts the two-phase list retrieval of all entries within 
       
  2160 the store.
       
  2161 
       
  2162 @param aReqStatus On completion, the status of the request; KErrNone if successful, 
       
  2163 KErrNotSupported if the phone does not support access to an Gba/Mbms list  
       
  2164 and KErrNotFound if the list does not exist. If the list is empty then KErrNone
       
  2165 is returned.
       
  2166 @capability ReadDeviceData
       
  2167 */
       
  2168 	{
       
  2169 	if (!CompleteIfInUse(aReqStatus))
       
  2170 		{
       
  2171 		TPckgBuf<RMobilePhone::TAuthInfoV8> commandId;
       
  2172      	commandId.Copy(aData);
       
  2173      	iListType=commandId().iData;
       
  2174      	
       
  2175      	if(iListType == RMobilePhone::EGbaNafIdList || iListType == RMobilePhone::EMbmsMskIdList)
       
  2176      		{
       
  2177      		delete iGbaNafIdResults;
       
  2178 			iGbaNafIdResults = NULL;
       
  2179 			delete iMbmsMskIdResults;
       
  2180 			iMbmsMskIdResults = NULL;
       
  2181 			
       
  2182 			iAuthRequestData().iClient = iId();
       
  2183 			iAuthRequestData().iAuthInfo=commandId();
       
  2184 			CAsyncRetrieveVariableLengthBufferV2::Start(aReqStatus,&iAuthRequestData,&iId);
       
  2185 			}
       
  2186 		else
       
  2187 			{
       
  2188 			TRequestStatus* status = &aReqStatus;
       
  2189 			User::RequestComplete(status, KErrNotSupported);	
       
  2190 			}
       
  2191 	
       
  2192 		}
       
  2193 	}
       
  2194 		
       
  2195 void CRetrieveMobilePhoneAuthenticationIds::RestoreListL()
       
  2196 /**
       
  2197  * This method restores a list from a buffer that contains the streamed version of the list
       
  2198  */
       
  2199 	{
       
  2200 	if (iListType==RMobilePhone::EGbaNafIdList)
       
  2201 		{
       
  2202 		iGbaNafIdResults=CMobilePhoneGbaNafIdList::NewL();
       
  2203 		iGbaNafIdResults->RestoreL(iResultsPtr);
       
  2204 		}
       
  2205 		
       
  2206 	else if(iListType==RMobilePhone::EMbmsMskIdList)
       
  2207 		{
       
  2208 		iMbmsMskIdResults=CMobilePhoneMbmsMskIdList::NewL();
       
  2209 		iMbmsMskIdResults->RestoreL(iResultsPtr);
       
  2210 		}
       
  2211 	else
       
  2212 		{
       
  2213 		User::Leave(KErrNotSupported);
       
  2214 		}	
       
  2215 		
       
  2216 	FreeBuffer();
       
  2217 	}
       
  2218 	
       
  2219 //
       
  2220 //
       
  2221 // Class for two-phased retrieval of Wlan SIDs list
       
  2222 //
       
  2223 //
       
  2224 
       
  2225 EXPORT_C CRetrieveMobilePhonePreferredWlanSIDs* CRetrieveMobilePhonePreferredWlanSIDs::NewL(RMobilePhone& aPhone)
       
  2226 /**
       
  2227 Creates an instance of the CActive derived CRetrieveMobilePhonePreferredWlanSIDs class
       
  2228 
       
  2229 @param aPhone Reference to clients RMobilePhone sub-session. 
       
  2230 @return A pointer to the newly created CRetrieveMobilePhonePreferredWlanSIDs object.
       
  2231  
       
  2232 @capability None
       
  2233 */
       
  2234 	{
       
  2235 	CRetrieveMobilePhonePreferredWlanSIDs* r=new(ELeave) CRetrieveMobilePhonePreferredWlanSIDs(aPhone);
       
  2236 	CleanupStack::PushL(r);
       
  2237 	r->ConstructL();
       
  2238 	CleanupStack::Pop();
       
  2239 	return r;
       
  2240 	}	
       
  2241 
       
  2242 CRetrieveMobilePhonePreferredWlanSIDs::CRetrieveMobilePhonePreferredWlanSIDs(RMobilePhone& aPhone) : 
       
  2243 	CAsyncRetrievePhoneList(aPhone)
       
  2244 	{
       
  2245 	}
       
  2246 
       
  2247 void CRetrieveMobilePhonePreferredWlanSIDs::ConstructL()
       
  2248 	{
       
  2249 	iIpcPhase1=EMobilePhoneGetPreferredWlanSIDsPhase1;
       
  2250 	iIpcPhase2=EMobilePhoneGetPreferredWlanSIDsPhase2;
       
  2251 	iIpcCancel=EMobilePhoneGetPreferredWlanSIDsCancel;
       
  2252 	}
       
  2253 	
       
  2254 EXPORT_C CRetrieveMobilePhonePreferredWlanSIDs::~CRetrieveMobilePhonePreferredWlanSIDs()
       
  2255 /**
       
  2256 Destructor
       
  2257 */
       
  2258 	{
       
  2259 	delete iResults;
       
  2260 	}
       
  2261 	
       
  2262 EXPORT_C CMobilePhoneStoredWlanSIDList* CRetrieveMobilePhonePreferredWlanSIDs::RetrieveListL()
       
  2263 /**
       
  2264 Returns a pointer to the retrieved list.
       
  2265 
       
  2266 @leave KErrNotFound If there is no valid list object to return to the client. 
       
  2267 @return CMobilePhoneStoredWlanSIDList Pointer to the Wlan Specific identifier list(user/Operator controlled).
       
  2268 If there are no entries in the list then a handle to an empty list is returned.
       
  2269 
       
  2270 @capability None
       
  2271 */
       
  2272 	{
       
  2273 	if (iResults)
       
  2274 		{
       
  2275 		// Give ownership of list to caller of this method
       
  2276 		CMobilePhoneStoredWlanSIDList* ptr=iResults;
       
  2277 		iResults = NULL;
       
  2278 		return ptr;
       
  2279 		}
       
  2280 	else
       
  2281 		{
       
  2282 		User::Leave(KErrNotFound);
       
  2283 		return NULL;
       
  2284 		}
       
  2285 	}
       
  2286 
       
  2287 EXPORT_C void CRetrieveMobilePhonePreferredWlanSIDs::Start(TRequestStatus& aReqStatus)
       
  2288 /**
       
  2289 Starts the retrieval of the stored Wlan Specific identifier list.
       
  2290 
       
  2291 @param aReqStatus Returns the result code after the asynchronous call completes.
       
  2292 If the list is empty then KErrNone is returned.
       
  2293  
       
  2294 @capability ReadDeviceData
       
  2295 */
       
  2296 	{
       
  2297 	if (!CompleteIfInUse(aReqStatus))
       
  2298 		{
       
  2299 		delete iResults;
       
  2300 		iResults = NULL;
       
  2301 		CAsyncRetrieveVariableLengthBufferV2::Start(aReqStatus,&iId,&iId);
       
  2302 		}
       
  2303 	}
       
  2304 
       
  2305 void CRetrieveMobilePhonePreferredWlanSIDs::RestoreListL()
       
  2306 /**
       
  2307 Restores a list from a buffer that contains the streamed version of the list
       
  2308  */
       
  2309 	{
       
  2310 	iResults=CMobilePhoneStoredWlanSIDList::NewL();
       
  2311 	iResults->RestoreL(iResultsPtr);
       
  2312 	FreeBuffer();
       
  2313 	}