1 /* |
|
2 * Copyright (c) 2006-2007 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of the License "Eclipse Public License v1.0" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: Header file for location SAPI core implementation. |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 #ifndef C_LOCATIONCOREIMP_H |
|
21 #define C_LOCATIONCOREIMP_H |
|
22 |
|
23 #include <lbs.h> |
|
24 #include <LbsSatellite.h> |
|
25 #include "locationservice.h" |
|
26 |
|
27 |
|
28 /** |
|
29 * Consts to identify the type of location request (trace, getlocation |
|
30 */ |
|
31 |
|
32 const TInt KTraceRequest = 1 ; |
|
33 const TInt KGetLocationRequest = 2 ; |
|
34 |
|
35 |
|
36 |
|
37 |
|
38 |
|
39 /** |
|
40 * This class implements Location SAPI core logic.It has methods |
|
41 * for retreving information location asynchronusly . |
|
42 */ |
|
43 |
|
44 class CGetLoc : public CActive |
|
45 { |
|
46 public: |
|
47 |
|
48 |
|
49 |
|
50 /** |
|
51 * Creates a new instance of a @ref CGetLoc |
|
52 * |
|
53 * @param aPositionServer subsession to location server |
|
54 * @param aRequestorInfoStack requestor indenty |
|
55 * @param aList List of position fields that should be retrived |
|
56 * @param aLocationInfoCategory information type required(Basic, Generic) |
|
57 * |
|
58 */ |
|
59 |
|
60 IMPORT_C static CGetLoc* NewL( RPositionServer &aPositionServer , |
|
61 TPositionFieldIdList aList , |
|
62 TInt aRequestType, |
|
63 TInt aLocationInfoCategory ) ; |
|
64 |
|
65 /** |
|
66 * Destructor. |
|
67 */ |
|
68 virtual ~CGetLoc() ; |
|
69 |
|
70 |
|
71 |
|
72 /** |
|
73 * Gets users current location Asynchronously calls the users callback |
|
74 * function when updates are recived from location server |
|
75 * |
|
76 * @param aCallBackObj callback object for updates notification |
|
77 * @param aUpdatesOptions update options for asynchronous calls |
|
78 * |
|
79 */ |
|
80 TInt GetLocation( MLocationCallBack* aCallBackObj , |
|
81 const TPositionUpdateOptions* aUpdateOptions =NULL ); |
|
82 |
|
83 /** |
|
84 * Traces users location change |
|
85 * Any location change is informed to user via callback function |
|
86 * |
|
87 * @param aCallBackObj callback handle for async trace call |
|
88 * @param aUpdateOptions updateoptions for trace call |
|
89 * |
|
90 * @see TPositionUpdateOptions in LbsCommon.h for details |
|
91 */ |
|
92 TInt GetLocationUpdates( MLocationCallBack* aCallBackObj , |
|
93 const TPositionUpdateOptions* aUpdateOptions = NULL ); |
|
94 |
|
95 void SetStatusComplete() |
|
96 { |
|
97 iRequestStatus = 1; |
|
98 } |
|
99 TBool IsStatusComplete() |
|
100 { |
|
101 if(iRequestStatus == 0) |
|
102 return false; |
|
103 else |
|
104 return true; |
|
105 } |
|
106 |
|
107 |
|
108 |
|
109 |
|
110 protected: |
|
111 |
|
112 /** |
|
113 * From CActive |
|
114 */ |
|
115 void DoCancel(); |
|
116 void RunL(); |
|
117 |
|
118 |
|
119 private: |
|
120 |
|
121 /** |
|
122 * By default Symbian 2nd phase constructor is private. |
|
123 */ |
|
124 |
|
125 void ConstructL(); |
|
126 /** |
|
127 * Default constructor |
|
128 */ |
|
129 |
|
130 CGetLoc(); |
|
131 TInt DoInitialiseL(); |
|
132 |
|
133 private: |
|
134 |
|
135 |
|
136 |
|
137 |
|
138 /** |
|
139 * Class Member which holds location server subsession |
|
140 */ |
|
141 RPositioner iPositioner; |
|
142 |
|
143 /** |
|
144 * Basic info |
|
145 */ |
|
146 TPositionInfo iPositionInfo; |
|
147 |
|
148 |
|
149 /** |
|
150 * Basic info base |
|
151 */ |
|
152 TPositionInfoBase* iPosInfoBase; |
|
153 /** |
|
154 * Generic info |
|
155 */ |
|
156 HPositionGenericInfo *iGenericPosInfo ; |
|
157 /** |
|
158 * callback object |
|
159 */ |
|
160 MLocationCallBack *iCallBack ; |
|
161 |
|
162 /** |
|
163 * Request type (Getlocation or Trace) |
|
164 */ |
|
165 TInt iRequestType ; |
|
166 |
|
167 TInt iRequestStatus; |
|
168 |
|
169 |
|
170 }; |
|
171 |
|
172 |
|
173 |
|
174 #endif //C_LOCATIONCOREIMP_H |
|
175 |
|
176 |
|