|
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: A class for TrackLog functionality |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef CTRACKLOG_H_ |
|
20 #define CTRACKLOG_H_ |
|
21 |
|
22 #include <f32file.h> |
|
23 #include <Lbs.h> |
|
24 #include "clocationrecord.h" |
|
25 #include <LbsSatellite.h> |
|
26 |
|
27 class MTrackLogObserver; |
|
28 class CGpxConverterAO; |
|
29 |
|
30 /** |
|
31 * class for recording position min/max values |
|
32 */ |
|
33 class TBoundaries |
|
34 { |
|
35 public: |
|
36 TReal64 minLatitude; |
|
37 TReal64 maxLatitude; |
|
38 TReal64 minLongitude; |
|
39 TReal64 maxLongitude; |
|
40 TReal32 distance; |
|
41 }; |
|
42 |
|
43 /** |
|
44 * Location trail item class. |
|
45 */ |
|
46 class TTrackLogItem |
|
47 { |
|
48 public: |
|
49 TTime iTimeStamp; |
|
50 TReal64 iLatitude; |
|
51 TReal64 iLongitude; |
|
52 TReal32 iAltitude; |
|
53 TReal32 iHdop; |
|
54 TReal32 iVdop; |
|
55 TReal32 iCourse; |
|
56 TReal32 iQuality; |
|
57 TUint32 iNumSatellites; |
|
58 void ExternalizeL( RWriteStream& aStream ) const; |
|
59 void InternalizeL( RReadStream& aStream ); |
|
60 }; |
|
61 |
|
62 class MGpxConversionObserver |
|
63 { |
|
64 public: |
|
65 /** |
|
66 * This method is used to notify about converted GPX files |
|
67 */ |
|
68 virtual void GpxFileCreated( const TDesC& aFileName, TItemId aTagId, TReal32 aLength, |
|
69 TTime aStart, TTime aEnd ) = 0; |
|
70 }; |
|
71 |
|
72 class CTrackLog : public CBase, public MLocationAddObserver |
|
73 { |
|
74 |
|
75 public: |
|
76 /** |
|
77 * 2-phased constructor. |
|
78 */ |
|
79 IMPORT_C static CTrackLog* NewL(); |
|
80 |
|
81 /** |
|
82 * C++ destructor. |
|
83 * @since S60 3.1 |
|
84 */ |
|
85 IMPORT_C virtual ~CTrackLog(); |
|
86 |
|
87 IMPORT_C TInt GetStatus( TBool& aRecording, TPositionSatelliteInfo& aFixQuality ); |
|
88 |
|
89 IMPORT_C TBool IsRecording(); |
|
90 |
|
91 /** |
|
92 * Initialize recording |
|
93 */ |
|
94 IMPORT_C void StartRecordingL(TItemId aId); |
|
95 |
|
96 /** |
|
97 * Stop tracklog recording |
|
98 */ |
|
99 IMPORT_C void StopRecordingL(); |
|
100 |
|
101 /** |
|
102 * stop tracklog recording without saving gpx file |
|
103 */ |
|
104 IMPORT_C void CancelRecording(); |
|
105 |
|
106 /** |
|
107 * get tracklog file name |
|
108 */ |
|
109 IMPORT_C void GetTrackLogName(TFileName& aFileName); |
|
110 |
|
111 /* |
|
112 * from MLocationAddObserver |
|
113 */ |
|
114 void LocationAdded( const TLocationTrailItem& aTrailItem, const TPositionSatelliteInfo& aSatellites ); |
|
115 |
|
116 IMPORT_C void AddGpxObserver( MGpxConversionObserver* aObserver ); |
|
117 |
|
118 IMPORT_C void StartRecoveryL(); |
|
119 IMPORT_C TInt AddObserver( MTrackLogObserver* aObserver ); |
|
120 |
|
121 IMPORT_C TInt RemoveObserver( MTrackLogObserver* aObserver ); |
|
122 |
|
123 private: |
|
124 /** |
|
125 * C++ constructor. |
|
126 */ |
|
127 CTrackLog(); |
|
128 |
|
129 /** |
|
130 * 2nd phase constructor. |
|
131 */ |
|
132 void ConstructL(); |
|
133 |
|
134 /** |
|
135 * Write Tracklog data from buffer to temporary file |
|
136 */ |
|
137 void WriteBufferToFileL(); |
|
138 |
|
139 /** |
|
140 * Read interval value from Central repository |
|
141 * @param aKey, Key to item |
|
142 * @param aValue, Read value |
|
143 */ |
|
144 void ReadCenRepValueL(TInt aKey, TInt& aValue); |
|
145 |
|
146 private: |
|
147 /** |
|
148 * Array for storing tracklog items |
|
149 */ |
|
150 RArray<TTrackLogItem> iTrackLogItemArray; |
|
151 |
|
152 /** |
|
153 * Array of track log observers. |
|
154 */ |
|
155 RPointerArray<MTrackLogObserver> iObservers; |
|
156 |
|
157 TInt iMaxBufferSize; |
|
158 TBool iRecording; |
|
159 |
|
160 TPositionSatelliteInfo iSatelliteInfo; |
|
161 |
|
162 TFileName iGpxFileName; |
|
163 TFileName iTmpFileName; |
|
164 TItemId iTagId; |
|
165 |
|
166 CGpxConverterAO* iGpxConverter; |
|
167 TBoundaries* iBoundaries; |
|
168 TCoordinate* lastCoords; |
|
169 |
|
170 RFs iFs; |
|
171 }; |
|
172 |
|
173 #endif /*CTRACKLOG_H_*/ |