1 lbs.h |
1 // Copyright (c) 2003-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 the License "Symbian Foundation License v1.0" to Symbian Foundation members and "Symbian Foundation End User License Agreement v1.0" to non-members |
|
5 // which accompanies this distribution, and is available |
|
6 // at the URL "http://www.symbianfoundation.org/legal/licencesv10.html". |
|
7 // |
|
8 // Initial Contributors: |
|
9 // Nokia Corporation - initial contribution. |
|
10 // |
|
11 // Contributors: |
|
12 // |
|
13 // Description: |
|
14 // |
|
15 |
|
16 #ifndef __LBS_H__ |
|
17 #define __LBS_H__ |
|
18 |
|
19 #include <lbspositioninfo.h> |
|
20 #include <lbsipc.h> |
|
21 #include <lbscommon.h> |
|
22 #include <lbsrequestor.h> |
|
23 #include <lbscriteria.h> |
|
24 |
|
25 // Forward declarations |
|
26 class CPositioningPtrHolder; |
|
27 class CServerPositioningPtrHolder; |
|
28 class RPositionServer : public RSessionBase |
|
29 |
|
30 /** |
|
31 This is generally the first interface class used by all client applications. |
|
32 It is used to make the primary connection to the location server. After the |
|
33 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 |
|
36 The RPositionServer class can also be used to discover what position |
|
37 technology "modules" are available. However, this is only required if a |
|
38 client application actually needs to use a particular module. |
|
39 |
|
40 @publishedAll |
|
41 @released |
|
42 */ |
|
43 { |
|
44 public: |
|
45 IMPORT_C RPositionServer(); |
|
46 |
|
47 IMPORT_C TInt Connect(); |
|
48 IMPORT_C void Close(); |
|
49 |
|
50 IMPORT_C TInt CancelRequest(TInt aRequestId); |
|
51 IMPORT_C TVersion Version() const; |
|
52 |
|
53 IMPORT_C TInt GetDefaultModuleId(TPositionModuleId& aModuleId) const; |
|
54 IMPORT_C TInt GetNumModules(TUint& aNumModules) const; |
|
55 IMPORT_C TInt GetModuleInfoByIndex(TInt aModuleIndex, |
|
56 TPositionModuleInfoBase& aModuleInfo) const; |
|
57 IMPORT_C TInt GetModuleInfoById(TPositionModuleId aModuleId, |
|
58 TPositionModuleInfoBase& aModuleInfo) const; |
|
59 |
|
60 IMPORT_C TInt GetModuleStatus(TPositionModuleStatusBase& aPosModuleStatus, |
|
61 TPositionModuleId aModuleId) const; |
|
62 |
|
63 IMPORT_C void NotifyModuleStatusEvent(TPositionModuleStatusEventBase& aStatusEvent, |
|
64 TRequestStatus& aStatus, |
|
65 const TPositionModuleId aModuleId = KPositionNullModuleId) const; |
|
66 |
|
67 private: |
|
68 void ConstructL(); |
|
69 void Destruct(); |
|
70 static TInt StartServer(); |
|
71 |
|
72 private: |
|
73 /** A pointer to a container that holds pointer descriptors, needed to point |
|
74 to the clients request data during asynchronous requests */ |
|
75 CServerPositioningPtrHolder* iPtrHolder; |
|
76 |
|
77 /** Variable for future expansion. */ |
|
78 TAny* iReserved; |
|
79 }; |
|
80 |
|
81 |
|
82 class RPositionerSubSessionBase : public RSubSessionBase |
|
83 /** |
|
84 Abstract base class for all positioning sub-sessions, including RPositioner. |
|
85 |
|
86 @see RPositioner |
|
87 @publishedAll |
|
88 @released |
|
89 */ |
|
90 { |
|
91 public: |
|
92 IMPORT_C TInt CancelRequest(TInt aRequestId); |
|
93 |
|
94 IMPORT_C TInt CompleteRequest(TInt aRequestId); |
|
95 |
|
96 protected: |
|
97 IMPORT_C RPositionerSubSessionBase(); |
|
98 |
|
99 IMPORT_C virtual TAny* ExtendedInterface(TInt aFunctionNumber, TAny* aPtr1, TAny* aPtr2); |
|
100 |
|
101 private: |
|
102 /** Unused variable for future expansion. */ |
|
103 TAny* iReserved; |
|
104 }; |
|
105 |
|
106 |
|
107 class RPositioner : public RPositionerSubSessionBase |
|
108 /** |
|
109 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 |
|
111 obtaining position information, this class also provides mechanisms |
|
112 for obtaining the last known position, the general status of the |
|
113 positioning module, changing how often it wishes to receive position |
|
114 updates, as well as identifying itself to the location framework. |
|
115 |
|
116 Before using the class, a primary connection must have already been |
|
117 established with the server. |
|
118 |
|
119 @see RPositionServer |
|
120 @publishedAll |
|
121 @released |
|
122 */ |
|
123 { |
|
124 public: |
|
125 IMPORT_C RPositioner(); |
|
126 |
|
127 IMPORT_C TInt Open(RPositionServer& aPosServer); |
|
128 IMPORT_C TInt Open(RPositionServer& aPosServer, |
|
129 TPositionModuleId aModuleId); |
|
130 IMPORT_C TInt Open(RPositionServer& aPosServer, |
|
131 const TPositionCriteriaBase& aCriteria); |
|
132 IMPORT_C void Close(); |
|
133 |
|
134 IMPORT_C TInt SetRequestor(CRequestor::TRequestorType aType, |
|
135 CRequestor::TRequestorFormat aFormat, |
|
136 const TDesC& aData); |
|
137 IMPORT_C TInt SetRequestor(const RRequestorStack& aRequestorStack); |
|
138 |
|
139 IMPORT_C TInt SetUpdateOptions(const TPositionUpdateOptionsBase& aPosOption); |
|
140 IMPORT_C TInt GetUpdateOptions(TPositionUpdateOptionsBase& aPosOption) const; |
|
141 |
|
142 IMPORT_C void GetLastKnownPosition(TPositionInfoBase& aPosInfo, |
|
143 TRequestStatus& aStatus) const; |
|
144 IMPORT_C void NotifyPositionUpdate(TPositionInfoBase& aPosInfo, |
|
145 TRequestStatus& aStatus) const; |
|
146 |
|
147 protected: |
|
148 IMPORT_C virtual void ConstructL(); |
|
149 IMPORT_C virtual void Destruct(); |
|
150 IMPORT_C virtual TAny* ExtendedInterface(TInt aFunctionNumber, TAny* aPtr1, TAny* aPtr2); |
|
151 |
|
152 private: |
|
153 void SetRequestorImplL(const RRequestorStack& aRequestorStack) const; |
|
154 |
|
155 public: |
|
156 TInt OpenImpl(RPositionServer& aPosServer, TPositionModuleId aModuleId, const TPositionCriteriaBase& aCriteria, TBool aOpenedUsingModuleId); |
|
157 private: |
|
158 /** A pointer to a container that holds pointer descriptors, needed to point |
|
159 to the clients request data during asynchronous requests */ |
|
160 CPositioningPtrHolder* iPtrHolder; |
|
161 /** Unused variable for future expansion. */ |
|
162 TAny* iReserved; |
|
163 }; |
|
164 |
|
165 |
|
166 #include <lbs.inl> |
|
167 |
|
168 #endif // __LBS_H__ |