This document describes how to use the Network Privacy API.
The reader must be familiar with the Privacy Protocol Module and the Network Privacy API.
When LBS is configured to load the Privacy Protocol Module, it handles only privacy requests and does not calculate position fixes. It is the responsibility of licensee domestic OS components to obtain the device's position. The Network Privacy API provides the means to send privacy requests into the LBS subsystem.
To use the Network Privacy API a licensee must create a client component that runs in the licensee domestic OS. This component receives privacy and location requests from the network and forwards them to the LBS subsystem via the Network Privacy API.
The Network Privacy API is only available with the Privacy Protocol Module. The first privacy request sent via the Network Privacy API causes the LBS subsystem components to be started.
Many of the implementation details of creating a Network Privacy API client are device creator specific (such as how to connect to a network).
#ifndef CMYNETWORKLISTENER_H_ #define CMYNETWORKLISTENER_H_ #include <EPos_MPosVerificationObserver.h> #include <EPos_CPosNetworkPrivacy.h> #include <EPos_CPosGSMPrivacyRequestInfo.h> class CMyNetworkObserver : public MPosVerificationObserver { public: static CMyNetworkObserver* NewL(); public: CMyNetworkObserver(); virtual ~CMyNetworkObserver(); public: void GSMVerifyPrivacyRequestL(const TDesC* aLCSClient, const TDesC* aRequestor, CPosNetworkPrivacy::TRequestDecision aTimeoutAction); void CancelPrivacyRequestL(TInt aRequestId, CPosNetworkPrivacy::TCancelReason aCancelReason); void GSMNotifyLocationRequestL(TDesC* aLCSClient, TDesC* aRequestor); void GSMTimeoutPrivacyRequestL(const TDesC* aLCSClient, const TDesC* aRequestor, TInt aRequestId, CPosNetworkPrivacy::TRequestDecision aTimeoutAction); public: // Method from MPosVerificationObserver void HandleVerifyComplete(TInt aRequestId, TInt aCompletionCode); private: CPosNetworkPrivacy* iPrivacy; TInt iRequestId; // This demo client just stores a single request ID void ConstructL(); }; #endif /*CMYNETWORKLISTENER_H_*/
CMyNetworkObserver* CMyNetworkObserver::NewL() { CMyNetworkObserver* listener = new (ELeave) CMyNetworkObserver(); CleanupStack::PushL(listener); listener->ConstructL(); CleanupStack::Pop(listener); return listener; } void CMyNetworkObserver::ConstructL() { iPrivacy = CPosNetworkPrivacy::NewL(); }
// Send a privacy request to LBS void CMyNetworkObserver::GSMVerifyPrivacyRequestL(const TDesC* aLCSClient, const TDesC* aRequestor, CPosNetworkPrivacy::TRequestDecision aTimeoutAction) { // Create a new CPosGSMPrivacyRequestInfo object CPosGSMPrivacyRequestInfo* info = CPosGSMPrivacyRequestInfo::NewLC(); // In this example, aLCSClientName is a proper name and aRequestor is a phone number info->SetLCSClientL(*aLCSClient, CPosGSMPrivacyRequestInfo::EIdTypeLogicalName); info->SetRequestorL(*aRequestor, CPosGSMPrivacyRequestInfo::EIdTypeMSISDN); // In this example set the request type to single shot info->SetRequestType(CPosNetworkPrivacyRequestInfo::ERequestSingleShot); // Client has an iRequestId member variable (a production client may need an array to track multiple requests) //iRequestId is set when VerifyLocationRequestL is called iPrivacy->VerifyLocationRequestL(*info, iRequestId, *this, aTimeoutAction); CleanupStack::PopAndDestroy(info); }
// Notify LBS of a location request void CMyNetworkObserver::GSMNotifyLocationRequestL(TDesC* aLCSClient, TDesC* aRequestor) { // Create a new CPosGSMPrivacyRequestInfo object CPosGSMPrivacyRequestInfo* info = CPosGSMPrivacyRequestInfo::NewLC(); // In this example, aLCSClientName is a proper name and aRequestor is a phone number info->SetLCSClientL(*aLCSClient, CPosGSMPrivacyRequestInfo::EIdTypeLogicalName); info->SetRequestorL(*aRequestor, CPosGSMPrivacyRequestInfo::EIdTypeMSISDN); // In this example set the request type to single shot info->SetRequestType(CPosNetworkPrivacyRequestInfo::ERequestSingleShot); // Client has an iRequestId member variable (a production client may need an array to track multiple requests) //iRequestId is set when NotifyLocationRequestL is called iPrivacy->NotifyLocationRequestL(*info, iRequestId); CleanupStack::PopAndDestroy(info); }
// Cancel an outstanding request void CMyNetworkObserver::CancelPrivacyRequestL(TInt aRequestId, CPosNetworkPrivacy::TCancelReason aCancelReason) { // TCancelReason may be e.g. CPosNetworkPrivacy::ECancelReasonTimeout iPrivacy->CancelVerifyLocationRequest(aRequestId, aCancelReason); }
// Notify LBS that a completed privacy request has timed out void CMyNetworkObserver::GSMTimeoutPrivacyRequestL(const TDesC* aLCSClient, const TDesC* aRequestor, TInt aRequestId, CPosNetworkPrivacy::TRequestDecision aTimeoutAction) { // Create a new CPosGSMPrivacyRequestInfo object CPosGSMPrivacyRequestInfo* info = CPosGSMPrivacyRequestInfo::NewLC(); // In this example, aLCSClientName is a proper name and aRequestor is a phone number info->SetLCSClientL(*aLCSClient, CPosGSMPrivacyRequestInfo::EIdTypeLogicalName); info->SetRequestorL(*aRequestor, CPosGSMPrivacyRequestInfo::EIdTypeMSISDN); iPrivacy->NotifyVerificationTimeoutL(*info, aRequestId, aTimeoutAction); CleanupStack::PopAndDestroy(info); }
// Handle verify complete messages from LBS void CMyNetworkObserver::HandleVerifyComplete(TInt aRequestId, TInt aCompleteCode) { // The privacy request identified by aRequestId is complete // Inform the network... }
/* ============================================================================ Name : NetworkPrivacyAPI_Example.mmp Author : Copyright : Description : ============================================================================ */ TARGET NetworkPrivacyAPI_Example.exe TARGETTYPE exe UID 0 0xE3DC328A USERINCLUDE ..\inc SYSTEMINCLUDE \epoc32\include \epoc32\include\lbs SOURCEPATH ..\src SOURCE NetworkPrivacyAPI_Example.cpp CMyNetworkListener.cpp LIBRARY euser.lib eposnwprv.lib CAPABILITY Location NetworkServices ReadDeviceData
Copyright ©2010 Nokia Corporation and/or its subsidiary(-ies).
All rights
reserved. Unless otherwise stated, these materials are provided under the terms of the Eclipse Public License
v1.0.