|
1 /* |
|
2 * Copyright (c) 2005 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: SUPL PSY singleton class. |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 #ifndef SUPLPSYREQUESTMANAGER_H |
|
21 #define SUPLPSYREQUESTMANAGER_H |
|
22 |
|
23 // INCLUDES |
|
24 #include "suplpsycellidhandler.h" |
|
25 // FORWARD DECLARATIONS |
|
26 |
|
27 // CLASS DECLARATION |
|
28 class MSuplPsyRequestCompleteListener; |
|
29 class CSuplPsyRequestor; |
|
30 class CEnvironmentChangeNotifier; |
|
31 class CSuplPsyInfoStoreManager; |
|
32 |
|
33 /** |
|
34 * This class implements singleton class of SUPL PSY |
|
35 * |
|
36 * This class provides function to instance a singleton object of SUPL PSY. |
|
37 * All client connections and location requests are managed by this class. |
|
38 * |
|
39 * @lib nlaSsuplpsy.dll |
|
40 * @since S60 3.1 |
|
41 */ |
|
42 class CSuplPsyRequestManager : public CBase, public MBasicCellIDListener |
|
43 { |
|
44 public: // Constructors and destructor |
|
45 |
|
46 /** |
|
47 * Register the positioner and get singleton instance of the object. |
|
48 * @param aPositioner The reference to the positioner object that |
|
49 * will register to request manager. |
|
50 */ |
|
51 static CSuplPsyRequestManager* RegisterL( |
|
52 MSuplPsyRequestCompleteListener& aPositioner ); |
|
53 |
|
54 /** |
|
55 * Unregister the positioner. The singleton object will be self - destructed |
|
56 * if not positioner is registered |
|
57 * @param aPositioner reference to the positioner that unregister to |
|
58 * request manager. |
|
59 */ |
|
60 void Unregister( |
|
61 MSuplPsyRequestCompleteListener& aPositioner ); |
|
62 /** |
|
63 * Recieves max age set by client |
|
64 * @param aMaxAge Max age value |
|
65 * |
|
66 */ |
|
67 void RecieveMaxAge( TTime aMaxAge ); |
|
68 |
|
69 |
|
70 public: // Functions from base classes |
|
71 |
|
72 /** |
|
73 * Make location request to request manager |
|
74 * @param aPositioner The requestor that makes location request |
|
75 * @since S60 3.1 |
|
76 */ |
|
77 void NotifyPositionUpdate( |
|
78 MSuplPsyRequestCompleteListener& aPositioner ); |
|
79 |
|
80 |
|
81 /** |
|
82 * Cancel location request from request manager |
|
83 * @param aPositioner Reference to the requestor that will cancel the on - going |
|
84 * location request. |
|
85 * @since S60 3.1 |
|
86 */ |
|
87 void CancelNotifyPositionUpdate( |
|
88 MSuplPsyRequestCompleteListener& aPositioner ); |
|
89 |
|
90 /** |
|
91 * Check if the last position is still valid |
|
92 * @param aMaxAge The max age |
|
93 * @return ETrue if last position valid. Otherwise, return EFalse |
|
94 */ |
|
95 TBool IsLastPostionValid( TTime aMaxAge ) const; |
|
96 |
|
97 /** |
|
98 * Get position info |
|
99 * @return Position info. The value is valid only if there has been location |
|
100 * received |
|
101 */ |
|
102 const HPositionGenericInfo& GetPosition(); |
|
103 /** Callback for completion of cell id request |
|
104 * |
|
105 * @return Position info. The value is valid only if there has been location |
|
106 * received |
|
107 */ |
|
108 void BasicCellIDRequestCompletedL(TInt aErrorCode); |
|
109 |
|
110 |
|
111 private: |
|
112 |
|
113 /** |
|
114 * C++default constructor. |
|
115 */ |
|
116 CSuplPsyRequestManager(); |
|
117 |
|
118 /** |
|
119 * Destructor. |
|
120 */ |
|
121 ~CSuplPsyRequestManager(); |
|
122 |
|
123 /** |
|
124 * By default Symbian 2nd phase constructor is private. |
|
125 */ |
|
126 void ConstructL(); |
|
127 |
|
128 /** |
|
129 * Register a positioner |
|
130 */ |
|
131 void RegisterPositionerL( |
|
132 MSuplPsyRequestCompleteListener& aPositioner ); |
|
133 |
|
134 /** |
|
135 * Find the index of positioner |
|
136 */ |
|
137 TInt FindPositioner( |
|
138 MSuplPsyRequestCompleteListener& aPositioner ) const; |
|
139 |
|
140 /** |
|
141 * Check if there is location request on going |
|
142 */ |
|
143 TBool IsActiveLocationRequest() const; |
|
144 |
|
145 /** |
|
146 * Location request complete call back function |
|
147 */ |
|
148 void LocationRequestComplete(); |
|
149 |
|
150 /** |
|
151 * Location request complete static call back |
|
152 */ |
|
153 static TInt LocationRequestCompleteStatic( TAny* aAny ); |
|
154 |
|
155 /** |
|
156 * Callback function for environment change notifier. |
|
157 */ |
|
158 static TInt NotifierCallBack( TAny* aPtr ); |
|
159 |
|
160 /** |
|
161 * This function is called whenever environment change notifier |
|
162 * reports that something has changed. The only change we are |
|
163 * interested of is the system time change. |
|
164 */ |
|
165 void HandleEnvironmentChange(); |
|
166 |
|
167 private: |
|
168 //TPositioner connection |
|
169 struct TPositionerStatus |
|
170 { |
|
171 //Reference to connected positioner |
|
172 MSuplPsyRequestCompleteListener* iPositioner; |
|
173 |
|
174 //Positioner has active location request |
|
175 TBool iRequested; |
|
176 }; |
|
177 |
|
178 private: |
|
179 //Positioner array |
|
180 RArray < TPositionerStatus > iPositionerArray; |
|
181 |
|
182 //Position requestor |
|
183 CSuplPsyRequestor* iRequestor; |
|
184 |
|
185 //Environment change notifier |
|
186 CEnvironmentChangeNotifier* iEnvChangeNotifier; |
|
187 |
|
188 // Returns Cell info |
|
189 CSuplPsyCellIdHandler* iSuplPsyCellIdHandler; |
|
190 |
|
191 CSuplPsyInfoStoreManager* iSuplPsyInfoStoreManager; |
|
192 //Cell Id info |
|
193 TCellIdInfo iCellIdInfo; |
|
194 |
|
195 TTime iMaxAge; |
|
196 }; |
|
197 |
|
198 #endif // SUPLPSYREQUESTMANAGER_H |
|
199 |
|
200 // End of File |