|
1 // Copyright (c) 2005-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 <e32std.h> |
|
17 #include <lbscommon.h> |
|
18 #include <lbs/lbsloccommon.h> |
|
19 #include <lbs/lbsprivacycontroller.h> |
|
20 #include "lbsprivacycontrollerimpl.h" |
|
21 #include "lbsdevloggermacros.h" |
|
22 #include "lbsnrhserverdata.h" |
|
23 |
|
24 |
|
25 //----------------------------------------------------------------------------- |
|
26 // MLbsPrivacyObserver |
|
27 //----------------------------------------------------------------------------- |
|
28 |
|
29 /** |
|
30 Returns the current version of the interface. |
|
31 |
|
32 @return The current version of the interface. |
|
33 */ |
|
34 EXPORT_C TVersion MLbsPrivacyObserver::Version() |
|
35 { |
|
36 LBSLOG(ELogP9, "<-S MLbsPrivacyObserver::Version() lbsnetworkrequesthandler.exe\n"); |
|
37 LBSLOG4(ELogP9, " Return TVersion = (%d, %d, %d)\n", |
|
38 KLbsPrivacyObserverVersionMajor, |
|
39 KLbsPrivacyObserverVersionMinor, |
|
40 KLbsPrivacyObserverVersionBuild); |
|
41 return TVersion(KLbsPrivacyObserverVersionMajor, |
|
42 KLbsPrivacyObserverVersionMinor, |
|
43 KLbsPrivacyObserverVersionBuild); |
|
44 |
|
45 } |
|
46 |
|
47 //----------------------------------------------------------------------------- |
|
48 // MLbsPrivacyObserver2 |
|
49 //----------------------------------------------------------------------------- |
|
50 |
|
51 /** |
|
52 Returns the current version of the interface. |
|
53 |
|
54 @return The current version of the interface. |
|
55 */ |
|
56 EXPORT_C TVersion MLbsPrivacyObserver2::Version() |
|
57 { |
|
58 LBSLOG(ELogP9, "<-S MLbsPrivacyObserver2::Version() lbsnetworkrequesthandler.exe\n"); |
|
59 LBSLOG4(ELogP9, " Return TVersion = (%d, %d, %d)\n", |
|
60 KLbsPrivacyObserverVersion2Major, |
|
61 KLbsPrivacyObserverVersion2Minor, |
|
62 KLbsPrivacyObserverVersion2Build); |
|
63 return TVersion(KLbsPrivacyObserverVersion2Major, |
|
64 KLbsPrivacyObserverVersion2Minor, |
|
65 KLbsPrivacyObserverVersion2Build); |
|
66 } |
|
67 |
|
68 //----------------------------------------------------------------------------- |
|
69 // CLbsPrivacyController |
|
70 //----------------------------------------------------------------------------- |
|
71 |
|
72 /** |
|
73 Standard Symbian OS two-phase constructor. |
|
74 |
|
75 @param aObserver Reference to an observer that will be notified when a network |
|
76 location request is recieved by the LBS system. |
|
77 @return A new CLbsPrivacyController object. |
|
78 |
|
79 @capability ECapabilityLocation, ECapabilityReadDeviceData |
|
80 */ |
|
81 EXPORT_C CLbsPrivacyController* CLbsPrivacyController::NewL(MLbsPrivacyObserver& aObserver) |
|
82 { |
|
83 LBSLOG(ELogP9, "->S CLbsPrivacyController::NewL() lbsnetworkrequesthandler.exe\n"); |
|
84 LBSLOG2(ELogP9, " > MLbsPrivacyObserver aObserver = 0x%08X\n", &aObserver); |
|
85 CLbsPrivacyController* self = new (ELeave) CLbsPrivacyController; |
|
86 CleanupStack::PushL(self); |
|
87 self->ConstructL(aObserver); |
|
88 CleanupStack::Pop(); |
|
89 return self; |
|
90 } |
|
91 |
|
92 /** |
|
93 Standard ConstructL for CPrivacyController. It creates the object that |
|
94 implements the functionality for CLbsPrivacyObserver. |
|
95 @internalComponent |
|
96 @param aObserver Reference to an observer that will be notified when a network |
|
97 location request is recieved by the LBS system. |
|
98 */ |
|
99 void CLbsPrivacyController::ConstructL(MLbsPrivacyObserver& aObserver) |
|
100 { |
|
101 iImpl = CLbsPrivacyControllerImpl::NewL(&aObserver); |
|
102 } |
|
103 |
|
104 /** |
|
105 Standard C++ constructor. |
|
106 */ |
|
107 EXPORT_C CLbsPrivacyController::CLbsPrivacyController() |
|
108 { |
|
109 } |
|
110 |
|
111 /** |
|
112 Standard C++ destructor |
|
113 @internalComponent |
|
114 */ |
|
115 CLbsPrivacyController::~CLbsPrivacyController() |
|
116 { |
|
117 LBSLOG(ELogP9, "->S CLbsPrivacyController::~CLbsPrivacyController() lbsnetworkrequesthandler.exe\n"); |
|
118 delete iImpl; |
|
119 } |
|
120 |
|
121 /** |
|
122 The application that is listening to network location requests must use this |
|
123 function to give the LBS system the response to the location request. |
|
124 |
|
125 The application is first notified of a network location request when |
|
126 MLbsObserver::ProcessNetworkLocationRequest is called. Then it can ask the |
|
127 user for verification if needed, or decide on its own. It must then use |
|
128 this function to tell the LBS system whether to accept or reject the network |
|
129 location request. |
|
130 |
|
131 The response can be one of the values of TRequestVerificationResult, usually |
|
132 it will either be ERequestAccepted or ERequestRejected. |
|
133 |
|
134 @see CLbsPrivacyController::TRequestVerificationResult |
|
135 @see MLbsPrivacyObserver::ProcessNetworkLocationRequest |
|
136 |
|
137 @param aRequestId Identifies the request within the LBS system. |
|
138 @param aResult The response to the network location request. |
|
139 |
|
140 @capability ECapabilityLocation, ECapabilityWriteDeviceData |
|
141 */ |
|
142 EXPORT_C void CLbsPrivacyController::RespondNetworkLocationRequest(TUint aRequestId, |
|
143 TRequestVerificationResult aResult) |
|
144 { |
|
145 LBSLOG(ELogP9, "->A CLbsPrivacyController::RespondNetworkLocationRequest() lbsnetworkrequesthandler.exe\n"); |
|
146 LBSLOG2(ELogP9, " > TUint aRequestId = %u\n", aRequestId); |
|
147 LBSLOG2(ELogP9, " > TRequestVerificationResult aResult = %d\n", aResult); |
|
148 |
|
149 iImpl->RespondNetworkLocationRequest(aRequestId, aResult); |
|
150 } |
|
151 |
|
152 /** |
|
153 Force the LBS system to cancel a currently running network location request, or |
|
154 to reject a request which has not yet been answered. |
|
155 |
|
156 If this function is called after CLbsPrivacyController::RespondNetworkLocationRequest() |
|
157 then the LBS system will send a KErrCancel error in the next network |
|
158 Measurement Control message. |
|
159 |
|
160 If this function is called before the request has been accepted |
|
161 (by a call to CLbsPrivacyController::RespondNetworkLocationRequest()) the |
|
162 effect is the same as a call to |
|
163 CLbsPrivacyController::RespondNetworkLocationRequest() with the value |
|
164 ERequestRejected. |
|
165 |
|
166 If aRequestId is not a currently active external location request then the |
|
167 call is ignored. |
|
168 |
|
169 @param aRequestId The Id of the network location request (MT-LR) to cancel. |
|
170 |
|
171 @capability ECapabilityLocation, ECapabilityWriteDeviceData |
|
172 */ |
|
173 EXPORT_C void CLbsPrivacyController::CancelNetworkLocationRequest(TUint aRequestId) |
|
174 { |
|
175 LBSLOG(ELogP9, "->A CLbsPrivacyController::CancelNetworkLocationRequest() lbsnetworkrequesthandler.exe\n"); |
|
176 LBSLOG2(ELogP9, " > TUint aRequestId = %u\n", aRequestId); |
|
177 |
|
178 iImpl->CancelNetworkLocationRequest(aRequestId); |
|
179 } |
|
180 |