networkprotocolmodules/privacyprotocolmodule/PrivacyProtocolModule/src/privacyrequestinfo.cpp
changeset 36 b47902b73a93
parent 0 9cfd9a3ee49c
equal deleted inserted replaced
35:a2efdd544abf 36:b47902b73a93
       
     1 // Copyright (c) 2007-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 //
       
    15 
       
    16 #include "lbsdevloggermacros.h"
       
    17 #include "privacyrequestinfo.h"
       
    18 
       
    19 
       
    20 //---------------------------------------------------------------------------
       
    21 // CRequestInfoBase:
       
    22 //---------------------------------------------------------------------------
       
    23 
       
    24 
       
    25 /** 
       
    26 Get the request ID.
       
    27 
       
    28 @return The request ID associated with this request.
       
    29 */  
       
    30 TInt CRequestInfoBase::GetRequestId() const
       
    31 	{
       
    32 	LBSLOG(ELogP1, "CRequestInfoBase::GetRequestId()\n");
       
    33 	return iRequestId;
       
    34 	}
       
    35 
       
    36 
       
    37 /** 
       
    38 Set the request ID.
       
    39 
       
    40 @param aRequestId The request ID to be associated with this request.
       
    41 */  
       
    42 void CRequestInfoBase::SetRequestId(TInt aRequestId)
       
    43 	{
       
    44 	LBSLOG(ELogP1, "CRequestInfoBase::SetRequestId()\n");
       
    45 	iRequestId = aRequestId;
       
    46 	}
       
    47 
       
    48 
       
    49 /** 
       
    50 Get the request type.
       
    51 
       
    52 @return The type of request.
       
    53 */  
       
    54 CRequestInfoBase::TPrivacyRequestType CRequestInfoBase::Type() const
       
    55 	{
       
    56 	LBSLOG(ELogP1, "CRequestInfoBase::Type()\n");
       
    57 	return iRequestType;
       
    58 	}
       
    59 
       
    60 
       
    61 /** 
       
    62 Constructor.
       
    63 
       
    64 @param aRequestType The type of request.
       
    65 */  
       
    66 CRequestInfoBase::CRequestInfoBase(CRequestInfoBase::TPrivacyRequestType aRequestType) :
       
    67 	iRequestType(aRequestType)
       
    68 	{
       
    69 	LBSLOG(ELogP1, "CRequestInfoBase::CRequestInfoBase()\n");
       
    70 	}
       
    71 
       
    72 
       
    73 //---------------------------------------------------------------------------
       
    74 // CPrivacyRequestInfo:
       
    75 //---------------------------------------------------------------------------
       
    76 
       
    77 
       
    78 /** 
       
    79 Static public constructor.
       
    80 
       
    81 @return A new instance of this class.
       
    82 */  
       
    83 CPrivacyRequestInfo* CPrivacyRequestInfo::NewL(const RMessage2& aMessage)
       
    84 	{
       
    85 	LBSLOG(ELogP1, "CPrivacyRequestInfo::NewL() Begin\n");
       
    86 	CPrivacyRequestInfo* self = new (ELeave) CPrivacyRequestInfo(aMessage);
       
    87 	LBSLOG(ELogP1, "CPrivacyRequestInfo::NewL() End\n");
       
    88 	return self;
       
    89 	}
       
    90 
       
    91 
       
    92 /** 
       
    93 Destructor.
       
    94 */  
       
    95 CPrivacyRequestInfo::~CPrivacyRequestInfo()
       
    96 	{
       
    97 	LBSLOG(ELogP1, "CPrivacyRequestInfo::~CPrivacyRequestInfo()\n");
       
    98 	}
       
    99 		
       
   100 
       
   101 /** 
       
   102 Complete this request.
       
   103 
       
   104 @param aStatus Status to complete with.
       
   105 */  
       
   106 void CPrivacyRequestInfo::CompleteRequest(TInt aStatus)
       
   107 	{
       
   108     LBSLOG(ELogP7, "->A CPrivacyRequestInfo::CompleteRequest(aStatus)\n");
       
   109     LBSLOG2(ELogP7, "\t > TInt aStatus = %d\n", aStatus);
       
   110 	iResponseMessage.Complete(aStatus);
       
   111 	}
       
   112 		
       
   113 
       
   114 /** 
       
   115 Get the TLbsExternalRequestInfo2 associated with this request.
       
   116 
       
   117 @param aRequestInfo Reference to the TLbsExternalRequestInfo2 to populate.
       
   118 */  
       
   119 void CPrivacyRequestInfo::GetRequestInfo(TLbsExternalRequestInfo2& aRequestInfo) const
       
   120 	{
       
   121 	LBSLOG(ELogP1, "CPrivacyRequestInfo::GetRequestInfo() Begin\n");
       
   122 	aRequestInfo = iRequestInfo;
       
   123 	LBSLOG(ELogP1, "CPrivacyRequestInfo::GetRequestInfo() End\n");
       
   124 	}
       
   125 
       
   126 
       
   127 /** 
       
   128 Set the TLbsExternalRequestInfo2 associated with this request.
       
   129 
       
   130 @param aRequestInfo Reference to the TLbsExternalRequestInfo2 to set.
       
   131 */  
       
   132 void CPrivacyRequestInfo::SetRequestInfo(const TLbsExternalRequestInfo2& aRequestInfo)
       
   133 	{
       
   134 	LBSLOG(ELogP1, "CPrivacyRequestInfo::SetRequestInfo() Begin\n");
       
   135 	iRequestInfo = aRequestInfo;
       
   136 	LBSLOG(ELogP1, "CPrivacyRequestInfo::SetRequestInfo() End\n");
       
   137 	}
       
   138 
       
   139 
       
   140 /** 
       
   141 Set the TLbsNetPosRequestPrivacy associated with this request.
       
   142 
       
   143 @param aRequestPrivacy Reference to the TLbsNetPosRequestPrivacy to populate.
       
   144 */  
       
   145 void CPrivacyRequestInfo::GetRequestPrivacy(TLbsNetPosRequestPrivacy& aRequestPrivacy) const
       
   146 	{
       
   147 	LBSLOG(ELogP1, "CPrivacyRequestInfo::GetRequestPrivacy() Begin\n");
       
   148 	aRequestPrivacy = iRequestPrivacy;
       
   149 	LBSLOG(ELogP1, "CPrivacyRequestInfo::GetRequestPrivacy() End\n");
       
   150 	}
       
   151 
       
   152 
       
   153 /** 
       
   154 Set the TLbsNetPosRequestPrivacy associated with this request.
       
   155 
       
   156 @param aRequestPrivacy Reference to the TLbsNetPosRequestPrivacy to set.
       
   157 */  
       
   158 void CPrivacyRequestInfo::SetRequestPrivacy(const TLbsNetPosRequestPrivacy& aRequestPrivacy)
       
   159 	{
       
   160 	LBSLOG(ELogP1, "CPrivacyRequestInfo::SetRequestPrivacy() Begin\n");
       
   161 	iRequestPrivacy = aRequestPrivacy;
       
   162 	LBSLOG(ELogP1, "CPrivacyRequestInfo::SetRequestPrivacy() End\n");
       
   163 	}
       
   164 
       
   165 
       
   166 /** 
       
   167 Determine if this request requires a response.
       
   168 
       
   169 @return ETrue if a response if required, EFalse otherwise.
       
   170 */  
       
   171 TBool CPrivacyRequestInfo::IsResponseRequired() const
       
   172 	{
       
   173 	LBSLOG(ELogP1, "CPrivacyRequestInfo::IsResponseRequired()\n");
       
   174 	return iResponseRequired;
       
   175 	}
       
   176 
       
   177 
       
   178 /** 
       
   179 Set if this request requires a response.
       
   180 
       
   181 @param aResponseRequired ETrue if a response is required, EFalse otherwise.
       
   182 */  
       
   183 void CPrivacyRequestInfo::SetIsResponseRequired(TBool aResponseRequired)
       
   184 	{
       
   185 	LBSLOG(ELogP1, "CPrivacyRequestInfo::SetIsResponseRequired()\n");
       
   186 	iResponseRequired = aResponseRequired;
       
   187 	}
       
   188 
       
   189 /** 
       
   190 Determine if the session should be completed by the Privacy Protocol Module, or by the client
       
   191 
       
   192 @return ETrue If the Privacy Protocol Module should complete the session, EFalse otherwise
       
   193 */
       
   194 TBool CPrivacyRequestInfo::IsSessionCompleteAutomatic() const
       
   195 	{
       
   196 	LBSLOG(ELogP1, "CPrivacyRequestInfo::IsSessionCompleteAutomatic()\n");
       
   197 	return iSessionCompleteAutomatic;	
       
   198 	}
       
   199 
       
   200 /** 
       
   201 Set if the session should be completed by the Privacy Protocol Module, or by the client
       
   202 
       
   203 @param aAutomatic If it's set to ETrue then the  Privacy Protocol Module should complete 
       
   204 					the session, otherwise the client will
       
   205 */
       
   206 void CPrivacyRequestInfo::SetIsSessionCompleteAutomatic(TBool aAutomatic)
       
   207 	{
       
   208 	LBSLOG(ELogP1, "CPrivacyRequestInfo::SetIsSessionCompleteAutomatic()\n");
       
   209 	iSessionCompleteAutomatic = aAutomatic;	
       
   210 	}
       
   211 
       
   212 /** 
       
   213 Determine if the response from LBS should be converted to an error code 
       
   214 before sending to client or not.
       
   215 
       
   216 @return ETrue If the Privacy Protocol Module should convert the response, EFalse otherwise
       
   217 */
       
   218 TBool CPrivacyRequestInfo::ConvertResponseCode() const
       
   219 	{
       
   220 	LBSLOG(ELogP1, "CPrivacyRequestInfo::ConvertResponseCode()\n");
       
   221 	return iConvertResponseCode;	
       
   222 	}
       
   223 
       
   224 /** 
       
   225 Set if the response from LBS should be converted to an error code by the 
       
   226 Privacy Protocol Module, or not.
       
   227 
       
   228 @param aConvert If it's set to ETrue then the Privacy Protocol Module will convert 
       
   229 					the return code, otherwise it won't
       
   230 */
       
   231 void CPrivacyRequestInfo::SetConvertResponseCode(TBool aConvert)
       
   232 	{
       
   233 	LBSLOG(ELogP1, "CPrivacyRequestInfo::SetConvertResponseCode()\n");
       
   234 	iConvertResponseCode = aConvert;	
       
   235 	}
       
   236 
       
   237 /**
       
   238 Get the session associated with this request.
       
   239 
       
   240 @return A pointer to the session.
       
   241 */
       
   242 const CSession2* CPrivacyRequestInfo::Session() const
       
   243 	{
       
   244 	LBSLOG(ELogP1, "CPrivacyRequestInfo::Session()\n");
       
   245 	if (iResponseMessage.IsNull())
       
   246 		{
       
   247 		return NULL;
       
   248 		}
       
   249 	else
       
   250 		{
       
   251 		return iResponseMessage.Session();
       
   252 		}
       
   253 	}
       
   254 
       
   255 /** 
       
   256 Constructor
       
   257 
       
   258 @param aMessage The message associated with this response. This may be completed later if a response is required.
       
   259 */  
       
   260 CPrivacyRequestInfo::CPrivacyRequestInfo(const RMessage2& aMessage) :
       
   261 	CRequestInfoBase(CRequestInfoBase::EPrivacyRequestTypeRequest),
       
   262 	iResponseMessage(aMessage), iSessionCompleteAutomatic(ETrue), 
       
   263 	iConvertResponseCode(ETrue)
       
   264 	{
       
   265 	LBSLOG(ELogP1, "CPrivacyRequestInfo::CPrivacyRequestInfo()\n");
       
   266 	}
       
   267 
       
   268 
       
   269 //---------------------------------------------------------------------------
       
   270 // CCancelPrivacyRequestInfo:
       
   271 //---------------------------------------------------------------------------
       
   272 
       
   273 
       
   274 /** 
       
   275 Static public constructor.
       
   276 
       
   277 @return A new instance of this class.
       
   278 */  
       
   279 CCancelPrivacyRequestInfo* CCancelPrivacyRequestInfo::NewL()
       
   280 	{
       
   281 	LBSLOG(ELogP1, "CCancelPrivacyRequestInfo::NewL() Begin\n");
       
   282 	CCancelPrivacyRequestInfo* self = new (ELeave) CCancelPrivacyRequestInfo();
       
   283 	LBSLOG(ELogP1, "CCancelPrivacyRequestInfo::NewL() End\n");
       
   284 	return self;
       
   285 	}
       
   286 
       
   287 
       
   288 /** 
       
   289 Destructor.
       
   290 */  
       
   291 CCancelPrivacyRequestInfo::~CCancelPrivacyRequestInfo()
       
   292 	{
       
   293 	LBSLOG(ELogP1, "CCancelPrivacyRequestInfo::~CCancelPrivacyRequestInfo()\n");
       
   294 	}
       
   295 
       
   296 
       
   297 /** 
       
   298 Get the reason why the request was cancelled.
       
   299 
       
   300 @return A TInt indicating why the request was cancelled.
       
   301 */  
       
   302 TInt CCancelPrivacyRequestInfo::CancelReason() const
       
   303 	{
       
   304 	LBSLOG(ELogP1, "CCancelPrivacyRequestInfo::CancelReason()\n");
       
   305 	return iCancelReason;
       
   306 	}
       
   307 
       
   308 
       
   309 /** 
       
   310 Sets the reason why the request was cancelled.
       
   311 
       
   312 @param aCancelReason A TInt indicating why the request was cancelled.
       
   313 */  
       
   314 void CCancelPrivacyRequestInfo::SetCancelReason(TInt aCancelReason)
       
   315 	{
       
   316 	LBSLOG(ELogP1, "CCancelPrivacyRequestInfo::SetCancelReason()\n");
       
   317 	iCancelReason = aCancelReason;
       
   318 	}
       
   319 
       
   320 
       
   321 /** 
       
   322 Constructor.
       
   323 */  
       
   324 CCancelPrivacyRequestInfo::CCancelPrivacyRequestInfo() :
       
   325 	CRequestInfoBase(CRequestInfoBase::EPrivacyRequestTypeCancel)
       
   326 	{
       
   327 	LBSLOG(ELogP1, "CCancelPrivacyRequestInfo::CCancelPrivacyRequestInfo()\n");
       
   328 	}
       
   329 
       
   330 
       
   331 //---------------------------------------------------------------------------
       
   332 // CPrivacyRequestBuffer:
       
   333 //---------------------------------------------------------------------------
       
   334 
       
   335 
       
   336 /** 
       
   337 Static public constructor.
       
   338 */  
       
   339 CPrivacyRequestBuffer* CPrivacyRequestBuffer::NewL()
       
   340 	{
       
   341 	LBSLOG(ELogP1, "CPrivacyRequestBuffer::NewL() Begin\n");
       
   342 	CPrivacyRequestBuffer* self = new (ELeave) CPrivacyRequestBuffer();
       
   343 	LBSLOG(ELogP1, "CPrivacyRequestBuffer::NewL() End\n");
       
   344 	return self;
       
   345 	}
       
   346 
       
   347 
       
   348 /** 
       
   349 Destructor.
       
   350 */  
       
   351 
       
   352 CPrivacyRequestBuffer::~CPrivacyRequestBuffer()
       
   353 	{
       
   354 	LBSLOG(ELogP1, "CPrivacyRequestBuffer::~CPrivacyRequestBuffer() Begin\n");
       
   355 	iBuffer.ResetAndDestroy();
       
   356 	iBuffer.Close();
       
   357 	LBSLOG(ELogP1, "CPrivacyRequestBuffer::~CPrivacyRequestBuffer() End\n");
       
   358 	}
       
   359 
       
   360 
       
   361 /** 
       
   362 Adds a request to the buffer.
       
   363 
       
   364 This class takes ownership of the request, and adds it to the end of its queue.
       
   365 
       
   366 @param aRequestInfo The request to be added.
       
   367 */  
       
   368 void CPrivacyRequestBuffer::AddRequestL(CPrivacyRequestInfo* aRequestInfo)
       
   369 	{
       
   370 	LBSLOG(ELogP1, "CPrivacyRequestBuffer::AddRequestL() Begin\n");
       
   371 	iBuffer.AppendL(aRequestInfo);
       
   372 	LBSLOG(ELogP1, "CPrivacyRequestBuffer::AddRequestL() End\n");
       
   373 	}
       
   374 
       
   375 /** 
       
   376 Callback function for use with RPointerArray<CPrivacyRequestInfo> to find a request by ID.
       
   377 
       
   378 @param aRequestId Pointer to the request ID to find.
       
   379 @param requestInfo Reference to a CPrivacyRequestInfo to check against.
       
   380 
       
   381 @return ETrue if requestInfo has the required ID specified by aRequestId.
       
   382 */  
       
   383 TBool FindRequestById(const TInt* aRequestId, const CPrivacyRequestInfo& requestInfo)
       
   384 	{
       
   385 	return (requestInfo.GetRequestId() == *aRequestId);
       
   386 	}
       
   387 
       
   388 /** 
       
   389 Find a request matching the specified ID in the buffer.
       
   390 
       
   391 @return The found request, or NULL if no suitable request can be found.
       
   392 */  
       
   393 CPrivacyRequestInfo* CPrivacyRequestBuffer::FindRequest(TInt aRequestId)
       
   394 	{
       
   395 	LBSLOG(ELogP1, "CPrivacyRequestBuffer::FindRequest() Begin\n");
       
   396 	TInt pos = iBuffer.Find(aRequestId,FindRequestById);
       
   397 	
       
   398 	if (pos >= 0)
       
   399 		{
       
   400 		CPrivacyRequestInfo* requestInfo = iBuffer[pos];
       
   401 		LBSLOG(ELogP1, "CPrivacyRequestBuffer::FindRequest() End (FOUND REQUEST)\n");
       
   402 		return requestInfo;
       
   403 		}
       
   404 	
       
   405 	LBSLOG(ELogP1, "CPrivacyRequestBuffer::FindRequest() End (NOT FOUND)\n");
       
   406 	return NULL;
       
   407 	}
       
   408 
       
   409 /** 
       
   410 Callback function for use with RPointerArray<CPrivacyRequestInfo> to find a request by Session.
       
   411 
       
   412 @param aSession Pointer to the session to find.
       
   413 @param requestInfo Reference to a CPrivacyRequestInfo to check against.
       
   414 
       
   415 @return ETrue if requestInfo has the required session specified by aSession.
       
   416 */  
       
   417 TBool FindRequestBySession(const CSession2* aSession, const CPrivacyRequestInfo& requestInfo)
       
   418 	{
       
   419 	return (requestInfo.Session() == aSession);
       
   420 	}
       
   421 
       
   422 /** 
       
   423 Find a request matching the specified ID in the buffer.
       
   424 
       
   425 @return The found request, or NULL if no suitable request can be found.
       
   426 */  
       
   427 CPrivacyRequestInfo* CPrivacyRequestBuffer::FindRequest(const CSession2* aSession)
       
   428 	{
       
   429 	LBSLOG(ELogP1, "CPrivacyRequestBuffer::FindRequest() Begin\n");
       
   430 	TInt pos = iBuffer.Find(*aSession,FindRequestBySession);
       
   431 	
       
   432 	if (pos >= 0)
       
   433 		{
       
   434 		CPrivacyRequestInfo* requestInfo = iBuffer[pos];
       
   435 		LBSLOG(ELogP1, "CPrivacyRequestBuffer::FindRequest() End (FOUND REQUEST)\n");
       
   436 		return requestInfo;
       
   437 		}
       
   438 	
       
   439 	LBSLOG(ELogP1, "CPrivacyRequestBuffer::FindRequest() End (NOT FOUND)\n");
       
   440 	return NULL;
       
   441 	}
       
   442 
       
   443 /** 
       
   444 Remove a request from the buffer.
       
   445 
       
   446 This class relinquishes ownership of the request.
       
   447 
       
   448 @param aRequestInfo Pointer to the request to remove.
       
   449 
       
   450 @return The request from the buffer, if found, otherwise NULL.
       
   451 */  
       
   452 CPrivacyRequestInfo* CPrivacyRequestBuffer::RemoveRequest(CPrivacyRequestInfo* aRequestInfo)
       
   453 	{
       
   454 	LBSLOG(ELogP1, "CPrivacyRequestBuffer::RemoveRequest() Begin\n");
       
   455 	
       
   456 	TInt pos = iBuffer.Find(aRequestInfo);
       
   457 	if (pos >= 0)
       
   458 		{
       
   459 		CPrivacyRequestInfo* requestInfo = iBuffer[pos];
       
   460 		iBuffer.Remove(pos);
       
   461 		LBSLOG(ELogP1, "CPrivacyRequestBuffer::RemoveRequest() End (RETURNING REQUEST)\n");
       
   462 		return requestInfo;
       
   463 		}
       
   464 	
       
   465 	LBSLOG(ELogP1, "CPrivacyRequestBuffer::RemoveRequest() End (NOT FOUND)\n");
       
   466 	return NULL;
       
   467 	}
       
   468 
       
   469 /** 
       
   470 Gets the number of requests present in the buffer.
       
   471 
       
   472 @return The number of requests.
       
   473 */  
       
   474 TInt CPrivacyRequestBuffer::NumRequests() const
       
   475 	{
       
   476 	return iBuffer.Count();
       
   477 	}
       
   478 
       
   479 /**
       
   480 Search through the buffer for requests with a matching Id and cancel them.
       
   481 
       
   482 The cancel action depends on what type of request it is:
       
   483 Verify: Convert it into a notify request but leave it in the buffer. Complete
       
   484         the client request with the given cancel reason.
       
   485 Notify: Remove it from the buffer.
       
   486 
       
   487 The cancel request should not be added to the buffer.
       
   488 
       
   489 @param aRequestId ID of the cancel request to match.
       
   490 @param aReason Reason code for the cancel.
       
   491 */
       
   492 void CPrivacyRequestBuffer::CancelAnyOutstandingRequestById(TInt aRequestId, TInt aReason)
       
   493 	{
       
   494 	LBSLOG(ELogP1, "CPrivacyRequestBuffer::CancelAnyOutstandingRequestById() Begin\n");
       
   495 
       
   496 	for (TInt pos = 0; pos < iBuffer.Count(); pos++)
       
   497 		{
       
   498 		CPrivacyRequestInfo* requestInfo = iBuffer[pos]; 
       
   499 		if (requestInfo->GetRequestId() == aRequestId)
       
   500 			{
       
   501 			TLbsNetPosRequestPrivacy privacy;
       
   502 			requestInfo->GetRequestPrivacy(privacy);
       
   503 			
       
   504 			switch (privacy.RequestAdvice())
       
   505 				{
       
   506 				case TLbsNetPosRequestPrivacy::ERequestAdviceVerify:
       
   507 					{
       
   508 					// Change the privacy advice to 'Notify'
       
   509 					privacy.SetRequestAdvice(TLbsNetPosRequestPrivacy::ERequestAdviceNotify);
       
   510 					privacy.SetRequestAction(TLbsNetPosRequestPrivacy::ERequestActionAllow); 
       
   511 					requestInfo->SetRequestPrivacy(privacy);
       
   512 				                         
       
   513 					// Complete the outstanding client request
       
   514 					__ASSERT_DEBUG(requestInfo->IsResponseRequired(), User::Invariant());
       
   515 					requestInfo->CompleteRequest(aReason);
       
   516 					requestInfo->SetIsResponseRequired(EFalse);
       
   517 					break;
       
   518 					}
       
   519 				case TLbsNetPosRequestPrivacy::ERequestAdviceNotify:
       
   520 					{
       
   521 					// Remove this request from the buffer
       
   522 					iBuffer.Remove(pos);
       
   523 					delete requestInfo;
       
   524 					
       
   525 					// Need to decrement pos because we've just removed an entry from the buffer
       
   526 					pos--;
       
   527 					break;
       
   528 					}
       
   529 				default:
       
   530 					{
       
   531 					break;
       
   532 					}
       
   533 				}
       
   534 			}
       
   535 		}
       
   536 	
       
   537 	LBSLOG(ELogP1, "CPrivacyRequestBuffer::CancelAnyOutstandingRequestById() End\n");
       
   538 	}
       
   539 
       
   540 /**
       
   541 Cancels any outstanding asynchronous requests from a client session.
       
   542 
       
   543 This function should only be used when a client session has disconnected,
       
   544 in order to clean up any outstanding asynchronous requests.
       
   545 
       
   546 @param aSession Session to clean up requests for.
       
   547 */
       
   548 void CPrivacyRequestBuffer::CancelAnyOutstandingRequestBySession(const CSession2* aSession)
       
   549 	{
       
   550 	LBSLOG(ELogP1, "CPrivacyRequestBuffer::CancelAnyOutstandingRequestBySession() Begin\n");
       
   551 
       
   552 	for (TInt pos = 0; pos < iBuffer.Count(); pos++)
       
   553 		{
       
   554 		CPrivacyRequestInfo* requestInfo = iBuffer[pos];
       
   555 		if (requestInfo->IsResponseRequired()
       
   556 			&& requestInfo->Session() == aSession)
       
   557 			{
       
   558 			// Outstanding asynchronous request for this client.
       
   559 			// It should always be a privacy verify request.
       
   560 			
       
   561 			// Change the verify into a notify.
       
   562 			TLbsNetPosRequestPrivacy privacy;
       
   563 			requestInfo->GetRequestPrivacy(privacy);
       
   564 			privacy.SetRequestAdvice(TLbsNetPosRequestPrivacy::ERequestAdviceNotify);
       
   565 			privacy.SetRequestAction(TLbsNetPosRequestPrivacy::ERequestActionAllow); 
       
   566 			requestInfo->SetRequestPrivacy(privacy);
       
   567 			
       
   568 			// Clean up the outstanding client request
       
   569 			requestInfo->CompleteRequest(KErrCancel);
       
   570 			requestInfo->SetIsResponseRequired(EFalse);
       
   571 			}
       
   572 		}
       
   573 	
       
   574 	LBSLOG(ELogP1, "CPrivacyRequestBuffer::CancelAnyOutstandingRequestBySession() End\n");
       
   575 	}
       
   576 
       
   577 /** 
       
   578 Constructor.
       
   579 */  
       
   580 CPrivacyRequestBuffer::CPrivacyRequestBuffer()
       
   581 	{
       
   582 	LBSLOG(ELogP1, "CPrivacyRequestBuffer::CPrivacyRequestBuffer()\n");
       
   583 	}
       
   584 
       
   585