Responding to Requests and Cancelling Requests

As shown in the previous Privacy Controller API code examples, a Privacy Controller has a pointer to a CLbsPrivacyController class. The Privacy Controller uses this pointer to respond to privacy requests and to cancel them. The simple outline code in this section shows how a Privacy Controller calls these functions.

Responding to a request

The code below shows how the observer class can respond to privacy requests by calling CLbsPrivacyController::RespondNetworkLocationRequest().

// Send a privacy response to the LBS subsystem
void CMyLbsPrivacyControllerObserver::SendResponse(TUint aRequestId,
                                                   CLbsPrivacyController::TRequestVerificationResult aResult)
	{
	// aRequestId is the ID of a privacy request that was previously received
	iController->RespondNetworkLocationRequest(aRequestId, aResult);
	}

Cancelling a privacy verification request

The code below shows how the observer class can cancel privacy verification requests by calling CLbsPrivacyController::CancelNetworkLocationRequest().

There is no guarantee that a privacy request will be cancelled by calling CLbsPrivacyController::CancelNetworkLocationRequest(). If a privacy request was first accepted and then later cancelled by a Privacy Controller, the network may accept the request before the cancel message is processed. The sequence diagrams in LBS Privacy Controllerr describe this situation in more detail.

// Cancel a privacy response
void CMyLbsPrivacyControllerObserver::CancelRequest(TUint aRequestId)
	{
	// aRequestId is the ID of a privacy request that was previously received
	iController->CancelNetworkLocationRequest(aRequestId);
	}