1 // Copyright (c) 2003-2009 Nokia Corporation and/or its subsidiary(-ies). |
1 // Copyright (c) 2003-2009 Nokia Corporation and/or its subsidiary(-ies). |
2 // All rights reserved. |
2 // All rights reserved. |
3 // This component and the accompanying materials are made available |
3 // This component and the accompanying materials are made available |
4 // under the terms of the License "Symbian Foundation License v1.0" to Symbian Foundation members and "Symbian Foundation End User License Agreement v1.0" to non-members |
4 // under the terms of "Eclipse Public License v1.0" |
5 // which accompanies this distribution, and is available |
5 // which accompanies this distribution, and is available |
6 // at the URL "http://www.symbianfoundation.org/legal/licencesv10.html". |
6 // at the URL "http://www.eclipse.org/legal/epl-v10.html". |
7 // |
7 // |
8 // Initial Contributors: |
8 // Initial Contributors: |
9 // Nokia Corporation - initial contribution. |
9 // Nokia Corporation - initial contribution. |
10 // |
10 // |
11 // Contributors: |
11 // Contributors: |
33 primary connection has been established, its handle is passed as a parameter |
34 primary connection has been established, its handle is passed as a parameter |
34 of the Open methods of RPositioner to create a "sub-session". |
35 of the Open methods of RPositioner to create a "sub-session". |
35 |
36 |
36 The RPositionServer class can also be used to discover what position |
37 The RPositionServer class can also be used to discover what position |
37 technology "modules" are available. However, this is only required if a |
38 technology "modules" are available. However, this is only required if a |
38 client application actually needs to use a particular module. |
39 client application actually needs to use a particular module. It is also |
|
40 used for requests to clear(empty) the last known position store. |
|
41 |
|
42 Asynchronous requests can be cancelled using the method CancelRequest() with |
|
43 a value from the enumeration _TReqestId corresponding to the particular |
|
44 operation being cancelled. |
39 |
45 |
40 @publishedAll |
46 @publishedAll |
41 @released |
47 @released |
42 */ |
48 */ |
43 { |
49 { |
44 public: |
50 public: |
|
51 /** Type for values defined in _TRequestId |
|
52 @publishedPartner |
|
53 @prototype*/ |
|
54 typedef TInt TRequestId; |
|
55 |
|
56 /** Identification numbers used for cancelling requests. |
|
57 Note that the TRequestId enum may be extended in the future by adding |
|
58 more enumerated values. To maintain compatibility any unrecognized values |
|
59 must be handled as EReqUnknown. |
|
60 @publishedPartner |
|
61 @prototype*/ |
|
62 enum _TRequestId |
|
63 { |
|
64 /** Unknown/undefined Id */ |
|
65 EReqUnknown = 0, |
|
66 /** The id of the RPositionServer::NotifyModuleStatusEvent request */ |
|
67 EReqNotifyModuleStatusEvent = 1, |
|
68 /** The id of the RPositionServer::EmptyLastKnownPositionStore request */ |
|
69 EReqEmptyLastKnownPositionStore = 2 |
|
70 }; |
|
71 |
|
72 public: |
45 IMPORT_C RPositionServer(); |
73 IMPORT_C RPositionServer(); |
46 |
74 |
47 IMPORT_C TInt Connect(); |
75 IMPORT_C TInt Connect(); |
48 IMPORT_C void Close(); |
76 IMPORT_C void Close(); |
49 |
77 |
50 IMPORT_C TInt CancelRequest(TInt aRequestId); |
78 IMPORT_C TInt CancelRequest(TRequestId aRequestId); |
51 IMPORT_C TVersion Version() const; |
79 IMPORT_C TVersion Version() const; |
52 |
80 |
53 IMPORT_C TInt GetDefaultModuleId(TPositionModuleId& aModuleId) const; |
81 IMPORT_C TInt GetDefaultModuleId(TPositionModuleId& aModuleId) const; |
54 IMPORT_C TInt GetNumModules(TUint& aNumModules) const; |
82 IMPORT_C TInt GetNumModules(TUint& aNumModules) const; |
55 IMPORT_C TInt GetModuleInfoByIndex(TInt aModuleIndex, |
83 IMPORT_C TInt GetModuleInfoByIndex(TInt aModuleIndex, |
61 TPositionModuleId aModuleId) const; |
89 TPositionModuleId aModuleId) const; |
62 |
90 |
63 IMPORT_C void NotifyModuleStatusEvent(TPositionModuleStatusEventBase& aStatusEvent, |
91 IMPORT_C void NotifyModuleStatusEvent(TPositionModuleStatusEventBase& aStatusEvent, |
64 TRequestStatus& aStatus, |
92 TRequestStatus& aStatus, |
65 const TPositionModuleId aModuleId = KPositionNullModuleId) const; |
93 const TPositionModuleId aModuleId = KPositionNullModuleId) const; |
|
94 |
|
95 IMPORT_C void EmptyLastKnownPositionStore(TRequestStatus& aStatus); |
66 |
96 |
67 private: |
97 private: |
68 void ConstructL(); |
98 void ConstructL(); |
69 void Destruct(); |
99 void Destruct(); |
70 static TInt StartServer(); |
100 static TInt StartServer(); |
81 |
111 |
82 class RPositionerSubSessionBase : public RSubSessionBase |
112 class RPositionerSubSessionBase : public RSubSessionBase |
83 /** |
113 /** |
84 Abstract base class for all positioning sub-sessions, including RPositioner. |
114 Abstract base class for all positioning sub-sessions, including RPositioner. |
85 |
115 |
|
116 Asynchronous requests issued from derived classess are cancelled using the |
|
117 method CancelRequest() with a value from the enumeration _TReqestId corresponding |
|
118 to the particular operation being cancelled. |
|
119 |
86 @see RPositioner |
120 @see RPositioner |
87 @publishedAll |
121 @publishedAll |
88 @released |
122 @released |
89 */ |
123 */ |
90 { |
124 { |
91 public: |
125 |
92 IMPORT_C TInt CancelRequest(TInt aRequestId); |
126 public: |
|
127 |
|
128 /** Type for values defined in _TRequestId |
|
129 @publishedPartner |
|
130 @prototype*/ |
|
131 typedef TInt TRequestId; |
|
132 |
|
133 /** Identification numbers used for cancelling requests. |
|
134 Note that the TRequestId enum may be extended in the future by adding |
|
135 more enumerated values. To maintain compatibility any unrecognized values |
|
136 must be handled as EReqUnknown. |
|
137 @publishedPartner |
|
138 @prototype*/ |
|
139 enum _TRequestId |
|
140 { |
|
141 /** Unknown/undefined Id */ |
|
142 EReqUnknown = 0, |
|
143 /** The id of the GetLastKnownPosition request */ |
|
144 EReqGetLastKnownPosition = 1, |
|
145 /** The id of the GetLastKnownPositionArea request */ |
|
146 EReqGetLastKnownPositionArea = 2, |
|
147 /** The id of the ReqNotifyPositionUpdate request */ |
|
148 EReqNotifyPositionUpdate = 3 |
|
149 }; |
|
150 public: |
|
151 IMPORT_C TInt CancelRequest(TRequestId aRequestId); |
93 |
152 |
94 IMPORT_C TInt CompleteRequest(TInt aRequestId); |
153 IMPORT_C TInt CompleteRequest(TInt aRequestId); |
95 |
154 |
96 protected: |
155 protected: |
97 IMPORT_C RPositionerSubSessionBase(); |
156 IMPORT_C RPositionerSubSessionBase(); |
107 class RPositioner : public RPositionerSubSessionBase |
166 class RPositioner : public RPositionerSubSessionBase |
108 /** |
167 /** |
109 This class is used to create a sub-session with the server for the |
168 This class is used to create a sub-session with the server for the |
110 purpose of obtaining the current position. In addition to actually |
169 purpose of obtaining the current position. In addition to actually |
111 obtaining position information, this class also provides mechanisms |
170 obtaining position information, this class also provides mechanisms |
112 for obtaining the last known position, the general status of the |
171 for obtaining the last known position, the last known position with |
113 positioning module, changing how often it wishes to receive position |
172 area information, the general status of the positioning module, |
114 updates, as well as identifying itself to the location framework. |
173 changing how often it wishes to receive position updates, as well as |
|
174 identifying itself to the location framework. |
115 |
175 |
116 Before using the class, a primary connection must have already been |
176 Before using the class, a primary connection must have already been |
117 established with the server. |
177 established with the server. |
118 |
178 |
119 @see RPositionServer |
179 @see RPositionServer |
120 @publishedAll |
180 @publishedAll |
121 @released |
181 @released |
122 */ |
182 */ |
123 { |
183 { |
|
184 |
124 public: |
185 public: |
125 IMPORT_C RPositioner(); |
186 IMPORT_C RPositioner(); |
126 |
187 |
127 IMPORT_C TInt Open(RPositionServer& aPosServer); |
188 IMPORT_C TInt Open(RPositionServer& aPosServer); |
128 IMPORT_C TInt Open(RPositionServer& aPosServer, |
189 IMPORT_C TInt Open(RPositionServer& aPosServer, |
139 IMPORT_C TInt SetUpdateOptions(const TPositionUpdateOptionsBase& aPosOption); |
200 IMPORT_C TInt SetUpdateOptions(const TPositionUpdateOptionsBase& aPosOption); |
140 IMPORT_C TInt GetUpdateOptions(TPositionUpdateOptionsBase& aPosOption) const; |
201 IMPORT_C TInt GetUpdateOptions(TPositionUpdateOptionsBase& aPosOption) const; |
141 |
202 |
142 IMPORT_C void GetLastKnownPosition(TPositionInfoBase& aPosInfo, |
203 IMPORT_C void GetLastKnownPosition(TPositionInfoBase& aPosInfo, |
143 TRequestStatus& aStatus) const; |
204 TRequestStatus& aStatus) const; |
|
205 |
|
206 IMPORT_C void GetLastKnownPositionArea(TPositionInfoBase& aPosInfo, |
|
207 TPositionAreaInfoBase& aAreaInfo, |
|
208 TRequestStatus& aStatus) const; |
|
209 |
144 IMPORT_C void NotifyPositionUpdate(TPositionInfoBase& aPosInfo, |
210 IMPORT_C void NotifyPositionUpdate(TPositionInfoBase& aPosInfo, |
145 TRequestStatus& aStatus) const; |
211 TRequestStatus& aStatus) const; |
146 |
212 |
147 protected: |
213 protected: |
148 IMPORT_C virtual void ConstructL(); |
214 IMPORT_C virtual void ConstructL(); |
149 IMPORT_C virtual void Destruct(); |
215 IMPORT_C virtual void Destruct(); |
150 IMPORT_C virtual TAny* ExtendedInterface(TInt aFunctionNumber, TAny* aPtr1, TAny* aPtr2); |
216 IMPORT_C virtual TAny* ExtendedInterface(TInt aFunctionNumber, TAny* aPtr1, TAny* aPtr2); |
151 |
217 |
152 private: |
|
153 void SetRequestorImplL(const RRequestorStack& aRequestorStack) const; |
|
154 |
|
155 public: |
218 public: |
156 TInt OpenImpl(RPositionServer& aPosServer, TPositionModuleId aModuleId, const TPositionCriteriaBase& aCriteria, TBool aOpenedUsingModuleId); |
219 TInt OpenImpl(RPositionServer& aPosServer, TPositionModuleId aModuleId, const TPositionCriteriaBase& aCriteria, TBool aOpenedUsingModuleId); |
157 private: |
220 private: |
158 /** A pointer to a container that holds pointer descriptors, needed to point |
221 /** A pointer to a container that holds pointer descriptors, needed to point |
159 to the clients request data during asynchronous requests */ |
222 to the clients request data during asynchronous requests */ |