1 /* |
|
2 * Copyright (c) 2006-2009 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 "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: An interface to Track Log. |
|
15 * |
|
16 */ |
|
17 |
|
18 #ifndef RTRACKLOG_H_ |
|
19 #define RTRACKLOG_H_ |
|
20 |
|
21 #include <lbssatellite.h> |
|
22 #include <rlocationmanager.h> |
|
23 #include <locationeventdef.h> |
|
24 |
|
25 // forward declaration |
|
26 class MTrackLogObserver; |
|
27 class CTrackLogObserverAO; |
|
28 |
|
29 /* |
|
30 * TrackLog API is used to start, stop and delete track-logs, |
|
31 * to get track-log status and to get track-log in GPX format. |
|
32 * |
|
33 * @lib LocationManager.lib |
|
34 * @since S60 3.2 |
|
35 */ |
|
36 NONSHARABLE_CLASS( RTrackLog ) : public RLocationManager |
|
37 { |
|
38 |
|
39 public: |
|
40 IMPORT_C RTrackLog(); |
|
41 |
|
42 /** |
|
43 * Starts track-log recording. Also starts location trail recording |
|
44 * if it is not already running. |
|
45 * @since S60 3.2 |
|
46 * @param None. |
|
47 * @return KErrNone if successful, otherwise one of the other |
|
48 * system-wide error codes. |
|
49 */ |
|
50 IMPORT_C TInt StartTrackLog(); |
|
51 |
|
52 /** |
|
53 * Stops track-log recording. |
|
54 * @since S60 3.2 |
|
55 * @param None. |
|
56 * @return None. |
|
57 */ |
|
58 IMPORT_C void StopTrackLog(); |
|
59 |
|
60 /** |
|
61 * Gets the status of track-log recording and GPS signal quality. |
|
62 * @since S60 3.2 |
|
63 * @param aRecording, indicating track log recording status |
|
64 * @param aFixQuality, GPS signal quality |
|
65 * @return KErrNone if successful, otherwise one of the other |
|
66 * system-wide error codes. |
|
67 */ |
|
68 IMPORT_C TInt GetStatus(TBool& aRecording, TPositionSatelliteInfo& aFixQuality); |
|
69 |
|
70 /** |
|
71 * Deletes a track-log file |
|
72 * @since S60 3.2 |
|
73 * @param aUri, Track log URI |
|
74 * @return KErrNone if successful, otherwise one of the other |
|
75 * system-wide error codes. |
|
76 */ |
|
77 IMPORT_C TInt DeleteTrackLog(TDesC& aUri); |
|
78 |
|
79 /** |
|
80 * Returns a boolean indicating track-log recording status. |
|
81 * @since S60 3.2 |
|
82 * @param None. |
|
83 * @return KErrNone if successful, otherwise one of the other |
|
84 * system-wide error codes. |
|
85 */ |
|
86 IMPORT_C TBool IsRecording(); |
|
87 |
|
88 /** |
|
89 * Registers a new track-log observer. |
|
90 * @since S60 3.2 |
|
91 * @param aObserver, observer which is added. |
|
92 * @return KErrNone if successful, otherwise one of the other |
|
93 * system-wide error codes. |
|
94 */ |
|
95 IMPORT_C TInt AddObserver(MTrackLogObserver* aObserver ); |
|
96 |
|
97 /** |
|
98 * Removes a registered track-log observer. |
|
99 * @since S60 3.2 |
|
100 * @param aObserver, observer which is removed. |
|
101 * @return KErrNone if successful, otherwise one of the other |
|
102 * system-wide error codes. |
|
103 */ |
|
104 IMPORT_C TInt RemoveObserver(MTrackLogObserver* aObserver); |
|
105 |
|
106 /** |
|
107 * Returns the name of the current track-log file. |
|
108 * @since S60 3.2 |
|
109 * @param aTrackLogName, track log file name |
|
110 * @return KErrNone if successful, otherwise one of the other |
|
111 * system-wide error codes. |
|
112 */ |
|
113 IMPORT_C TInt TrackLogName(TDes& aTrackLogName); |
|
114 |
|
115 /** |
|
116 * Overrides inherited class close. |
|
117 * Close observers array and calls main class close. |
|
118 * @since S60 3.2 |
|
119 * @param None. |
|
120 * @return None. |
|
121 */ |
|
122 IMPORT_C void Close(); |
|
123 |
|
124 public: |
|
125 |
|
126 /** |
|
127 * @param aStatus, the request status of the active object |
|
128 * @return None. |
|
129 */ |
|
130 void SendNotifyRequest( TRequestStatus& aStatus ); |
|
131 |
|
132 /** |
|
133 * Notifies of an event in tracklog. The event can be of type EStarted/EStopped/ESignalChanged. |
|
134 * @param aError error code |
|
135 * @return None. |
|
136 */ |
|
137 void TrackLogEvent( TInt aError ); |
|
138 |
|
139 |
|
140 private: |
|
141 /** |
|
142 * Array of observers |
|
143 */ |
|
144 RPointerArray<MTrackLogObserver> iObservers; |
|
145 |
|
146 TBool iSubscribed; |
|
147 /** |
|
148 * An active object that observes tracklog events (starting/stopping/GPS fix quality changes). |
|
149 */ |
|
150 CTrackLogObserverAO* iTrackLogObserverAO; |
|
151 |
|
152 TPositionSatelliteInfo iFixQuality; |
|
153 TBool iRecording; |
|
154 TEventTypes iEventType; |
|
155 TPckg<TPositionSatelliteInfo> iWrapQuality; |
|
156 TPckg<TBool> iWrapRec; |
|
157 TPckg<TEventTypes> iWrapEventType; |
|
158 }; |
|
159 |
|
160 /** |
|
161 * Track log Observer interface class for receiving track-log events. |
|
162 */ |
|
163 class MTrackLogObserver |
|
164 { |
|
165 |
|
166 public: |
|
167 /** |
|
168 * Called to notify the observer that the |
|
169 * Track-log recording has started. |
|
170 * |
|
171 * @param aError, KErrNone if successful, otherwise one of the other |
|
172 * system-wide error codes. |
|
173 * @return None. |
|
174 */ |
|
175 virtual void TrackLogStarted(TInt aError) = 0; |
|
176 |
|
177 /** |
|
178 * Called to notify the observer that the |
|
179 * Track-log recording was stopped. |
|
180 * |
|
181 * @param aError, KErrNone if successful, otherwise one of the other |
|
182 * system-wide error codes. |
|
183 * @return None. |
|
184 */ |
|
185 virtual void TrackLogStopped(TInt aError) = 0; |
|
186 |
|
187 /** |
|
188 * Called to notify the observer that the |
|
189 * GPS fix quality has changed. |
|
190 * |
|
191 * @param aFixQuality, GPS signal quality |
|
192 * @param aTrackingActive, Is Tracking active |
|
193 * @return None. |
|
194 */ |
|
195 virtual void GPSFixQualityChanged(TPositionSatelliteInfo& aFixQuality, TBool& aTrackingActive) = 0; |
|
196 |
|
197 private: |
|
198 }; |
|
199 #endif /*RTRACKLOG_H_*/ |
|