|
1 // Copyright (c) 2008-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 "Eclipse Public License v1.0" |
|
5 // which accompanies this distribution, and is available |
|
6 // at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
7 // |
|
8 // Initial Contributors: |
|
9 // Nokia Corporation - initial contribution. |
|
10 // |
|
11 // Contributors: |
|
12 // |
|
13 // Description: |
|
14 // This file defines the base class for SUPL protocol state machines. |
|
15 // |
|
16 // |
|
17 |
|
18 /** |
|
19 @file |
|
20 @internalTechnology |
|
21 @deprecated |
|
22 */ |
|
23 |
|
24 #ifndef __SUPLFSMSESSIONBASE_H__ |
|
25 #define __SUPLFSMSESSIONBASE_H__ |
|
26 |
|
27 #include <e32base.h> |
|
28 #include <lbspositioninfo.h> |
|
29 #include <lbs/lbsnetprotocolbase.h> |
|
30 #include <lbs/lbsnetcommon.h> |
|
31 #include <lbs/lbsloccommon.h> |
|
32 #include "lbstimer.h" |
|
33 #include <etelmm.h> |
|
34 #include "suplmessagebase.h" |
|
35 #include "suplpospayload.h" |
|
36 #include "suplconnectionmanager.h" |
|
37 #include "suplpositioningprotocolfsm.h" |
|
38 |
|
39 |
|
40 //----------------------------------------------------------------------------- |
|
41 // State Machine Base Class |
|
42 //----------------------------------------------------------------------------- |
|
43 |
|
44 class CSuplFsmEventStore; |
|
45 class CSuplStateHandlerBase; |
|
46 class MSuplProtocolManagerObserver; |
|
47 |
|
48 /** KSuplPosTimerEvent |
|
49 Identity of timer for when SUPL POS is expected from the network |
|
50 */ |
|
51 const TInt KSuplPosTimerEvent = 0x200; |
|
52 |
|
53 /** KSuplPosTimerDurationInSecTimerDurationInSec |
|
54 Timer duration for when SUPL POS is expected from the network |
|
55 after having sent out a SUPL POS INIT. |
|
56 */ |
|
57 const TInt KSuplPosTimerDurationInSecTimerDurationInSec = 10; |
|
58 |
|
59 /** KSuplEndTimerEvent |
|
60 Identity of timer for when SUPL END is expected from the network |
|
61 */ |
|
62 const TInt KSuplEndTimerEvent = 0x400; |
|
63 |
|
64 /** KSuplEndTimerDurationInSecTimerDurationInSec |
|
65 Timer duration for when SUPL END is expected from the network |
|
66 after having sent out the last SUPL POS. |
|
67 */ |
|
68 const TInt KSuplEndTimerDurationInSecTimerDurationInSec = 10; |
|
69 |
|
70 /** KSessionConnectedTimerEvent |
|
71 Identity of timer for when connection confirmation expected from Connection Manager |
|
72 */ |
|
73 const TInt KSessionConnectedTimerEvent = 0x300; |
|
74 |
|
75 /** KSessionConnectedTimerDurationInSec |
|
76 Timer duration for when connection confirmation expected from Connection Manager |
|
77 */ |
|
78 const TInt KSessionConnectedTimerDurationInSec = 15; |
|
79 |
|
80 |
|
81 /** SUPL State Machine observer mixin definition. |
|
82 This class used by the SUPL state machines to communicate with |
|
83 their observer, the Protocol Manager. |
|
84 */ |
|
85 class MSuplFsmSessionObserver |
|
86 { |
|
87 |
|
88 public: |
|
89 |
|
90 virtual MSuplProtocolManagerObserver& Gateway() = 0; |
|
91 virtual CSuplConnectionManager& ConnectionManager() = 0; |
|
92 virtual const TLbsNetSessionId& NewSessionId() = 0; |
|
93 virtual void ProcedureCompleteInd(const MLbsNetworkProtocolObserver::TLbsNetProtocolService& aService) = 0; |
|
94 virtual void LocationReq(const TLbsNetSessionId& aSessionId, |
|
95 const MLbsNetworkProtocolObserver::TLbsNetProtocolService& aType, |
|
96 const TLbsNetPosRequestQuality& aQuality, const TLbsNetPosRequestMethod& aPosMethod) = 0; |
|
97 virtual void ProcessAssistanceData(const TLbsAsistanceDataGroup& aGroupMask, |
|
98 const RLbsAssistanceDataBuilderSet& aData,const TInt& aReason, |
|
99 const MLbsNetworkProtocolObserver::TLbsNetProtocolService& aService) = 0; |
|
100 virtual void PrivacyReq(const TLbsNetSessionId& aSessionId, |
|
101 const TLbsNetPosRequestPrivacy& aPrivacy, |
|
102 const TLbsExternalRequestInfo& aRequestInfo) = 0; |
|
103 }; |
|
104 |
|
105 |
|
106 /** Base class definition for SUPL protocol state machines. |
|
107 This class provides support for common features of all state machines. |
|
108 |
|
109 A significant aspect incorporated in this base class is the active object |
|
110 mechanism for performing state transitions. This feature is used to allow |
|
111 event-handling methods to return inmediately after storing the event, relying |
|
112 on later execution of RunL for the real handling of the events. |
|
113 This approach keeps the Network Gateway responsive to new events. |
|
114 Another benefit of the Active Object paradigm is that it provides state |
|
115 machines with the ability to perform autonomous and asynchronous actions. |
|
116 |
|
117 In RunL, state transitions are followed by the execution of the entry actions of the |
|
118 next state. Each state's entry actions are designed to be completed in a short time. |
|
119 This staged approach ensures that lengthy protocol module |
|
120 activity is broken down into shorter steps, thereby releasing the active |
|
121 scheduler to process other active objects in the NG thread. A self-completion |
|
122 approach is employed to achieve this. @see CSuplFsmSessionBase::DoTransitionStage() |
|
123 |
|
124 The base class includes various attributes that describe protocol activity, |
|
125 together with access methods used to retrieve the value of these attributes. |
|
126 |
|
127 External events and their associated parameters are kept in the Event Store |
|
128 to be used for the length of the sessio as required. @see CSuplFsmEventStore |
|
129 */ |
|
130 NONSHARABLE_CLASS(CSuplFsmSessionBase) : public CActive, public MSuplConnectionManagerObserver, |
|
131 public MSuplPositioningProtocolFsmObserver, |
|
132 public MLbsCallbackTimerObserver |
|
133 { |
|
134 public: |
|
135 |
|
136 /** State machine protocol state. |
|
137 This defines the general protocol state for state machines. |
|
138 */ |
|
139 enum TMachineState |
|
140 { |
|
141 /** Not valid */ |
|
142 EStateNull, |
|
143 /** Ready to use, but not currently active. */ |
|
144 EStateReady, |
|
145 /** Actively performing a protocol procedure. */ |
|
146 EStateActive, |
|
147 /** In the process of cancelling. */ |
|
148 EStateCancelling |
|
149 }; |
|
150 |
|
151 /** SUPL specific states |
|
152 These identify the current state within the |
|
153 MO-LR or MT-LR protocol procedure. |
|
154 */ |
|
155 enum TSuplProcedureState |
|
156 { |
|
157 /** Idle */ |
|
158 EStateProcedureNull, |
|
159 |
|
160 // ----------------- MOLR-ONLY STATES ---------------------------------------- |
|
161 /** Trigger: Connected to SLP. Action: SUPL START sent*/ |
|
162 EStateStartSent, |
|
163 /** Trigger: SUPL RESPONSE received. Action: Request sent to LBS.*/ |
|
164 EStateResponseReceived, |
|
165 |
|
166 // ----------------- MTLR-ONLY STATES --------------------------------------- |
|
167 /** Trigger: SUPL INIT message received. Action: Send privacy request to LBS*/ |
|
168 EStateSuplInitReceived, |
|
169 |
|
170 //------------------ STATES COMMON TO MOLR AND MTLR -------------------------- |
|
171 /** Trigger: Privacy Response received from LBS allowing MTLR or self location requested. |
|
172 Action: Initiate a network session */ |
|
173 EStateNetConnectionStarted, |
|
174 /** Trigger: LBS requested Assistance data or provided a result. Action: SUPL POS INIT sent */ |
|
175 EStatePosInitSent, |
|
176 /** Trigger: SUPL END with position received. Action: forward received position to LBS */ |
|
177 EStatePositionReceived, |
|
178 /** Trigger: SUPL POS received. Actions: relay messages between Positioning FSM, LBS and network */ |
|
179 EStatePositioningInProgress, |
|
180 /** Trigger: errors or client cancel while connected. Actions: send SUPL END*/ |
|
181 EStateSuplSessionEnded, |
|
182 /** Trigger: session has terminated. Actions: instruct positioning FSM to halt*/ |
|
183 EStatePosSessionEnded, |
|
184 /** Trigger: session has terminated. Actions: termination of LBS session */ |
|
185 EStateLbsSessionEnded, |
|
186 /** Trigger: session has terminated. Action: termination of network session */ |
|
187 EStateNetConnectionClosed |
|
188 }; |
|
189 |
|
190 /** State machine cancel source. |
|
191 This defines the source of a cancellation. |
|
192 */ |
|
193 enum TCancelSource |
|
194 { |
|
195 /** Not cancelling */ |
|
196 ECancelNone, |
|
197 /** The LBS client cancelled the procedure */ |
|
198 ECancelClient, |
|
199 /** A network error occurred */ |
|
200 ECancelNetwork, |
|
201 /** A positioning protocol error occurred*/ |
|
202 ECancelPosProt, |
|
203 /** An SUPL protocol state machine encountered an error*/ |
|
204 ECancelSuplProt, |
|
205 /** State machine is closing down (destruction)*/ |
|
206 ECancelClosing |
|
207 }; |
|
208 |
|
209 enum TCancelReason |
|
210 { |
|
211 /** Reason not specified */ |
|
212 EReasonNone, |
|
213 /** A protocol has received an unexpected message */ |
|
214 EReasonUnexpectedMessage, |
|
215 /** A timer has expired */ |
|
216 EReasonTimerExpiry, |
|
217 /** The connection is down */ |
|
218 EReasonDisconnected, |
|
219 /** The connection manager can't connect to remote server |
|
220 with LBS's minimun security requirements*/ |
|
221 EReasonInsuficcientSecurity, |
|
222 /** A SUPL server could not be found in the host settings DB*/ |
|
223 EReasonSlpSettingsMissing, |
|
224 /** Parsing error decoding a received SUPL message */ |
|
225 EReasonParsingError, |
|
226 /** Mandatory data missing in received SUPL message*/ |
|
227 EReasonDataMissing, |
|
228 /** A value in a received message is out of range or corrupted*/ |
|
229 EReasonUnexpectedDataValue, |
|
230 /** No supported positioning methods in received SUPL message*/ |
|
231 EReasonMethodMismatch, |
|
232 /** Received SUPL message contains invalid sessionID*/ |
|
233 EReasonInvalidSessId, |
|
234 /** Mandatory info for outgoing message is not available */ |
|
235 EReasonDataUnavailable, |
|
236 /** LBS rejected a privacy request*/ |
|
237 EReasonPrivacyRejected, |
|
238 /** LBS wants a privacy request to be ignored*/ |
|
239 EReasonPrivacyIgnored, |
|
240 /** LBS declares itself unable to calculate the position **/ |
|
241 EReasonFutilePosCalc |
|
242 }; |
|
243 |
|
244 protected: |
|
245 |
|
246 /** State transition stage. |
|
247 This defines the individual stages used when a state machine makes a |
|
248 transition from one state to another. This approach allows the state |
|
249 machine to perform a number of asynchronous actions without making |
|
250 any call to RunL too lengthy. |
|
251 */ |
|
252 enum TTransitionStage |
|
253 { |
|
254 /** Not in a transition */ |
|
255 ETransitionNull, |
|
256 /** Enter new state */ |
|
257 ETransitionEnter |
|
258 }; |
|
259 |
|
260 |
|
261 public: |
|
262 |
|
263 virtual ~CSuplFsmSessionBase(); |
|
264 |
|
265 |
|
266 // Methods that can be overriden in derived classes |
|
267 // |
|
268 /** Complete state transition. |
|
269 Derived classes implement a method to perform actions after a state transition. |
|
270 */ |
|
271 virtual void PostTransition() = 0; |
|
272 |
|
273 /** Change state. |
|
274 Derived classes implement a method to select the next state following an event. |
|
275 The next state selected may (rarely) be the same as the current state, in which case |
|
276 parameter aForceRedo indicates that the entry actions for the state must be |
|
277 performed again. |
|
278 */ |
|
279 virtual TBool SelectNextState(TBool& aForceRedo) = 0; |
|
280 |
|
281 /** Cancel the active procedure. |
|
282 Derived classes implement a method to cancel the active procedure. |
|
283 */ |
|
284 virtual void CancelProcedure() = 0; |
|
285 |
|
286 /** A location response from LBS has been received. |
|
287 Derived classes implement a method to handle this response, with due |
|
288 consideration of the prevailing state machine activity. |
|
289 */ |
|
290 virtual void LocationResp(TInt aReason, const TPositionInfoBase& aPosInfo) = 0; |
|
291 virtual void AssistanceDataReq(const TLbsAssistanceDataGroup& aFilter) = 0; |
|
292 |
|
293 // Derived from MSuplConnectionManagerObserver. Implemented by concrete state machines |
|
294 // with due consideration of the prevailing state machine activity. |
|
295 void Connected(const TInetAddr& aIpAddress); |
|
296 void ConnectionError(const TSuplConnectionError& aError); |
|
297 void MessageReceived(CSuplMessageBase* aSuplMessage); |
|
298 |
|
299 // Derived from MSuplPositioningProtocolFsmObserver. |
|
300 virtual void ProcessAssistanceData(const TLbsAsistanceDataGroup& aGroupMask, TInt aReason) = 0; |
|
301 virtual void ProcessPositioningRequest(const TLbsNetPosRequestQuality& aQuality, |
|
302 const TLbsNetPosRequestMethod& aPosMethod) = 0; |
|
303 virtual void PositioningPayloadToNetwork(const CSuplPosPayload* aPositioningPayload) = 0; |
|
304 virtual void PositioningProtocolError(const TInt& aError) = 0; |
|
305 void PositioningSessionEnded(); |
|
306 |
|
307 // Methods called by State Handlers and Protocol Manager |
|
308 virtual void CompleteProcedure() = 0; |
|
309 virtual const TLbsNetSessionId& LbsSessionId() const; |
|
310 void StartConnectionTimer(); |
|
311 void StartSuplPosTimer(); |
|
312 void StartSuplEndTimer(); |
|
313 void SetSessionInProgress(TBool aSessionInProgress); |
|
314 CSuplFsmSessionBase::TSuplProcedureState CurrentState(); |
|
315 CSuplSessionId* MessageSessionId(); |
|
316 void SetMessageSessionId(CSuplSessionId* aMessageSessionId); |
|
317 virtual TInt GetHostId(TLbsHostSettingsId& aHostId) = 0; |
|
318 void SetSessionId(const TLbsNetSessionId& aSessionId); |
|
319 CSuplPositioningProtocolFsm* PositioningFsm(); |
|
320 const TLbsNetSessionId& SessionId() const; |
|
321 TBool IsSessionConnected(); |
|
322 virtual void CancelMachine(const TCancelSource& aCancelSource,const TCancelReason& aReason); |
|
323 MSuplFsmSessionObserver& Observer(); |
|
324 TMachineState State() const; |
|
325 MLbsNetworkProtocolObserver::TLbsNetProtocolService LocReqType() const; |
|
326 TBool PosMethodSupported(const TLbsNetPosRequestMethod& aPosMethods, TLbsNetPosMethod& aSelectedMethod, const TLbsNetPosCapabilities& aLbsCapabilities); |
|
327 |
|
328 public: |
|
329 |
|
330 // Methods for storing and retrieving event-related data from the store |
|
331 // |
|
332 TInt StoreLocationRequest(const TLbsNetPosRequestOptionsBase& aOptions); |
|
333 void StoreAssistanceDataRequest(const TLbsAssistanceDataGroup& aFilter); |
|
334 void StoreSuplMessage(const CSuplMessageBase* aMessage); |
|
335 void StorePosPayload(const CSuplPosPayload* aPayload); |
|
336 void StoreCancelInfo(const CSuplFsmSessionBase::TCancelSource& aSource, |
|
337 const CSuplFsmSessionBase::TCancelReason& aReason); |
|
338 void StoreNetInfo(const RMobilePhone::TMobilePhoneNetworkInfoV1& aNetworkInfo, |
|
339 const RMobilePhone::TMobilePhoneLocationAreaV1& aLocationArea); |
|
340 void StoreMccMnc(TUint aMcc, TUint aMnc); |
|
341 void StoreMsisdn(const TDesC& aTelNumber); |
|
342 void StoreCellInfo(const RMobilePhone::TMobilePhoneCellInfoV9& aCellInfo); |
|
343 void StorePositioningEnded(TBool aPosEnded); |
|
344 |
|
345 TBool RetrieveLocationRequestOptions(TLbsNetPosRequestOptions& aOptions); |
|
346 TBool RetrieveAssistanceDataRequest(TLbsAssistanceDataGroup& aAssitDataMask); |
|
347 void RetrieveStoredNetworkInfo(RMobilePhone::TMobilePhoneNetworkInfoV1& aNetworkInfo, |
|
348 RMobilePhone::TMobilePhoneLocationAreaV1& aLocationArea); |
|
349 TBool RetrieveStoredCellInfo(RMobilePhone::TMobilePhoneCellInfoV9& aCellInfo); |
|
350 const CSuplMessageBase* RetrieveSuplMessage(); |
|
351 const CSuplPosPayload* RetrievePosPayload(); |
|
352 const TInetAddr& RetrieveLocalIpAddress(); |
|
353 void RetrieveCancelInfo(CSuplFsmSessionBase::TCancelSource& aSource, |
|
354 CSuplFsmSessionBase::TCancelReason& aReason); |
|
355 void RetrievePrivacyAdvice(TLbsNetPosRequestPrivacy& aPrivacy); |
|
356 void RetrieveRequestorInfo(TLbsExternalRequestInfo& aRequestor); |
|
357 void RetrieveInitPosMethod(TLbsNetPosRequestMethod& aPosMethod); |
|
358 void RetrieveInitQuality(TLbsNetPosRequestQuality& aQuality); |
|
359 void RetrieveVer(TDes8& aVer); |
|
360 TPositionInfoBase* RetrievePositionL(); |
|
361 TBool RetrievePositioningSessionEnded(); |
|
362 |
|
363 TBool IsUnexpectedSuplEndStored(); |
|
364 TBool IsAssistanceDataRequestStored(); |
|
365 TBool IsNetworkInfoAvailable(); |
|
366 TBool IsPositionStored(); |
|
367 TBool PosSessionConducted(); |
|
368 inline const TDesC* Msisdn() const; |
|
369 |
|
370 protected: |
|
371 |
|
372 CSuplFsmSessionBase(MSuplFsmSessionObserver& aObserver); |
|
373 void InitialiseMachineBase(); |
|
374 void CompleteMachineBase(); |
|
375 void SetSessionConnected(TBool aSessionConnected); |
|
376 |
|
377 TBool IsCancelPending() const; |
|
378 void SetMachineAsCancelling(); |
|
379 void SetMachineAsNotCancellable(); |
|
380 TInt GenerateHostId(TLbsHostSettingsId& aHostId); |
|
381 |
|
382 TInt OnTimerError(TInt aTimerId, TInt aError); |
|
383 |
|
384 TBool DetermineStateFromPosInitSent(); |
|
385 TBool DetermineStateFromPositioningInProgress(TBool& aForceRedo); |
|
386 |
|
387 void PerformTransition(); |
|
388 |
|
389 private: |
|
390 |
|
391 void ResetSessionId(); |
|
392 |
|
393 void DoTransitionStage(); |
|
394 void CheckForStoredEvents(); |
|
395 TBool NextStateEntryActionsL(); |
|
396 void GenerateHostIdL(TLbsHostSettingsId& aHostId); |
|
397 |
|
398 // CActive derived methods |
|
399 void RunL(); |
|
400 void RunError(); |
|
401 void DoCancel(); |
|
402 |
|
403 protected: |
|
404 |
|
405 /** Reference to State machine observer |
|
406 */ |
|
407 MSuplFsmSessionObserver& iObserver; |
|
408 |
|
409 /** Local store for buffering external events |
|
410 that are likely to trigger state transitions. |
|
411 */ |
|
412 CSuplFsmEventStore* iEventStore; |
|
413 |
|
414 /** Pointer to state handler. |
|
415 This is owned by the derived classes that create state handlers. |
|
416 */ |
|
417 CSuplStateHandlerBase* iStateHandler; |
|
418 |
|
419 /** Current machine state. |
|
420 */ |
|
421 TMachineState iProtocolState; |
|
422 |
|
423 /** Current state of the SUPL procedure (MO-LR or MT-LR) |
|
424 */ |
|
425 TSuplProcedureState iCurrentState; |
|
426 |
|
427 /** Session ID. |
|
428 Session Id at the beginning of the session. This number is always used |
|
429 in messages sent to the network. |
|
430 */ |
|
431 TLbsNetSessionId iSessionId; |
|
432 |
|
433 /** State transition stage enumeration. |
|
434 */ |
|
435 TTransitionStage iTransitionState; |
|
436 |
|
437 /** Flag to indicate if state machine is to be cancelled. |
|
438 */ |
|
439 TBool iIsCancelPending; |
|
440 |
|
441 /** Flag to indicate that the machine cannot be cancelled. Derived |
|
442 state machines set this variable to true when they have reached |
|
443 late stages of the procedure and no longer makes sense to cancel. |
|
444 */ |
|
445 TBool iCancelNoLongerAllowed; |
|
446 |
|
447 /** Location request type. |
|
448 */ |
|
449 MLbsNetworkProtocolObserver::TLbsNetProtocolService iLocReqType; |
|
450 |
|
451 /** Flag to show that this session has an active |
|
452 connection with a server |
|
453 */ |
|
454 TBool iSessionConnected; |
|
455 |
|
456 /** Positioning Protocol State Machine (RRLP) |
|
457 */ |
|
458 CSuplPositioningProtocolFsm* iPositioningProtocol; |
|
459 |
|
460 /** Assistance Data Builder |
|
461 Passed to the positioning FSM for it to set assistance data in. |
|
462 */ |
|
463 RLbsAssistanceDataBuilderSet iAssistanceDataBuilderSet; |
|
464 |
|
465 /** The id of default settings generated using MCC and MNC*/ |
|
466 TLbsHostSettingsId iDefSettingsId; |
|
467 |
|
468 /** Store of settings for available SLPs to contact */ |
|
469 CLbsHostSettingsStore* iSlpSettingsStore; |
|
470 |
|
471 /** When this flag is true, all the messages sent to LBS must contain |
|
472 the session ID in iReplacementSessionId, otherwise iSessionId. |
|
473 */ |
|
474 TBool iSessionIdReplaced; |
|
475 |
|
476 /** LBS replacement session ID. |
|
477 Session Id to be used in all communications with LBS when iSessionIdReplaced |
|
478 is true. Changing the session Id halfway through an MOLR session may |
|
479 be required due to conflicting self-locate requests. |
|
480 */ |
|
481 TLbsNetSessionId iReplacementSessionId; |
|
482 |
|
483 /** Timer used for monitoring arrival of |
|
484 SUPL messages. |
|
485 */ |
|
486 CLbsCallbackTimer* iSuplProtTimer; |
|
487 |
|
488 /** Flag that is set to true from the moment a SUPL START |
|
489 is sent or a SUPL INIT is received until the moment a |
|
490 SUPL END is received or sent. |
|
491 */ |
|
492 TBool iSessionInProgress; |
|
493 |
|
494 /** Used to keep the SLP session Id */ |
|
495 CSuplSessionId* iMessageSessionId; |
|
496 |
|
497 /** The MCC of the home network */ |
|
498 TUint iMcc; |
|
499 |
|
500 /** The MNC of the home network */ |
|
501 TUint iMnc; |
|
502 |
|
503 /** The telephone number */ |
|
504 HBufC* iTelNumber; |
|
505 }; |
|
506 |
|
507 |
|
508 //----------------------------------------------------------------------------- |
|
509 // State Machine Event Store Class |
|
510 //----------------------------------------------------------------------------- |
|
511 |
|
512 /** State machine event store. |
|
513 |
|
514 This is used to hold external events that require asynchronous actions until the |
|
515 state machine is next in a position to be able to service each event, at which |
|
516 point the event is removed from the store. |
|
517 |
|
518 All the memory required is allocated on creation. Dynamic arrays are used for |
|
519 convenience as they provide a useful inteface but they are prevented from allocating |
|
520 memory at runtime. |
|
521 */ |
|
522 NONSHARABLE_CLASS(CSuplFsmEventStore) : public CBase |
|
523 { |
|
524 |
|
525 public: |
|
526 static CSuplFsmEventStore* NewL(TInt aMaxEntries); |
|
527 ~CSuplFsmEventStore(); |
|
528 |
|
529 void ClearStore(); |
|
530 TBool IsStoreEmpty(); |
|
531 TBool IsAssistanceDataReqStored(); |
|
532 TBool UnexpectedSuplEndStored(); |
|
533 TBool IsSuplMessageStored(const CSuplMessageBase*& aSuplMessage); |
|
534 TBool IsNetworkInfoAvailable(); |
|
535 TBool IsPositionStored(); |
|
536 TBool PositioningEnded(); |
|
537 TBool PosSessionConducted(); |
|
538 |
|
539 TInt StoreEvent(const CSuplMessageBase* aSuplMessage); |
|
540 TInt StoreEvent(const CSuplPosPayload* aPosPayload); |
|
541 void StoreEvent(const TLbsAssistanceDataGroup& aAssistDataMask); |
|
542 TInt StoreEvent(const TLbsNetPosRequestOptionsBase& aOptions); |
|
543 void StoreEvent(const CSuplFsmSessionBase::TCancelSource& aSource, |
|
544 const CSuplFsmSessionBase::TCancelReason& aReason); |
|
545 void StoreEvent(const TInetAddr& aAddress); |
|
546 void StoreEvent(const RMobilePhone::TMobilePhoneNetworkInfoV1& aNetworkInfo, |
|
547 const RMobilePhone::TMobilePhoneLocationAreaV1& aLocationArea); |
|
548 void StoreEvent(const RMobilePhone::TMobilePhoneSubscriberId& aImsi); |
|
549 void StoreEvent(const RMobilePhone::TMobilePhoneCellInfoV9& aCellInfo); |
|
550 void StoreEvent(const CLbsNetworkProtocolBase::TLbsPrivacyResponse& aResponse); |
|
551 void StoreEventL(const TPositionInfoBase& aPosInfo); |
|
552 void StoreExternalLocationRequest(const TLbsNetPosRequestPrivacy& aPrivacy, |
|
553 const TLbsExternalRequestInfo& aRequestor, |
|
554 const TLbsNetPosRequestQuality& quality, |
|
555 const TLbsNetPosRequestMethod& aPosMethod, |
|
556 const TDesC8& ver); |
|
557 void SetUnexpectedSuplEnd(); |
|
558 void SetPosSessionConducted(); |
|
559 void SetProxyModeRequested(const TBool& aIsProxyMode); |
|
560 void SetPositioningEnded(const TBool& aPositioningEnded); |
|
561 |
|
562 TBool GetAssistanceDataRequest(TLbsAssistanceDataGroup& aAssistDataMask); |
|
563 TBool GetLocationRequestOptions(TLbsNetPosRequestOptionsBase& aOptions); |
|
564 void GetCancelInfo(CSuplFsmSessionBase::TCancelSource& aSource, |
|
565 CSuplFsmSessionBase::TCancelReason& aReason); |
|
566 void GetNetworkInfo(RMobilePhone::TMobilePhoneNetworkInfoV1& aNetworkInfo, |
|
567 RMobilePhone::TMobilePhoneLocationAreaV1& aLocationArea); |
|
568 TBool GetCellInfo(RMobilePhone::TMobilePhoneCellInfoV9& aCellInfo); |
|
569 void GetPrivacyAdvice(TLbsNetPosRequestPrivacy& aPrivacy); |
|
570 void GetRequestorInfo(TLbsExternalRequestInfo& aRequestor); |
|
571 void GetInitPosMethod(TLbsNetPosRequestMethod& aPosMethod); |
|
572 void GetInitQuality(TLbsNetPosRequestQuality& aQuality); |
|
573 void GetVer(TDes8& aVer); |
|
574 TPositionInfoBase* PositionL(); |
|
575 TBool GetPrivacyResp(CLbsNetworkProtocolBase::TLbsPrivacyResponse& aResponse); |
|
576 const CSuplMessageBase* SuplMessage(); |
|
577 const CSuplPosPayload* PosPayload(); |
|
578 const TInetAddr& Address(); |
|
579 |
|
580 |
|
581 private: |
|
582 |
|
583 CSuplFsmEventStore(TInt aMaxEntries); |
|
584 |
|
585 private: |
|
586 |
|
587 // Request assistance data event |
|
588 TBool iAssistanceDataStored; |
|
589 TLbsAssistanceDataGroup iAssistanceDataMask; |
|
590 |
|
591 // Location request event |
|
592 TBool iLocationRequestStored; |
|
593 TLbsNetPosRequestOptionsBase* iLocRequestOptions; |
|
594 |
|
595 // Unexpected SUPL END received |
|
596 TBool iUnexpectedSuplEndReceived; |
|
597 |
|
598 // Reason the procedure was cancelled (if it was) |
|
599 CSuplFsmSessionBase::TCancelSource iCancelSource; |
|
600 CSuplFsmSessionBase::TCancelReason iCancelReason; |
|
601 |
|
602 /** The internal queue of SUPL messages, represented by an array of pointers to messages. |
|
603 */ |
|
604 RPointerArray<const CSuplMessageBase> iMessageQueue; |
|
605 |
|
606 /** The internal queue of positioning payloads, represented by an array of pointers to payloads. |
|
607 */ |
|
608 RPointerArray<const CSuplPosPayload> iPayloadQueue; |
|
609 |
|
610 /** The maximum number of entries permitted in the queues (fixed at construction). |
|
611 */ |
|
612 TInt iMaxEntries; |
|
613 |
|
614 /** Local IP adddress provided by the Connection Manager |
|
615 */ |
|
616 TInetAddr iAddress; |
|
617 |
|
618 /* Network data required for Location ID in SUPL messages |
|
619 */ |
|
620 TBool iNetworkDataStored; |
|
621 RMobilePhone::TMobilePhoneNetworkInfoV1 iNetworkInfo; |
|
622 RMobilePhone::TMobilePhoneLocationAreaV1 iLocationArea; |
|
623 |
|
624 /* IMSI needed by SUPL state machine for |
|
625 autoconfiguration of SLP |
|
626 */ |
|
627 TBool iImsiStored; |
|
628 RMobilePhone::TMobilePhoneSubscriberId iImsi; |
|
629 |
|
630 /* Cell info with Timing Advance required for |
|
631 enhanced cell-id |
|
632 */ |
|
633 TBool iCellInfoStored; |
|
634 RMobilePhone::TMobilePhoneCellInfoV9 iCellInfo; |
|
635 |
|
636 /** LBS's response to a privacy request |
|
637 */ |
|
638 TBool iPrivacyRespStored; |
|
639 CLbsNetworkProtocolBase::TLbsPrivacyResponse iPrivacyResp; |
|
640 |
|
641 /* Parameters received from a SUPL INIT |
|
642 */ |
|
643 TLbsNetPosRequestPrivacy iPrivacyInfo; |
|
644 TLbsExternalRequestInfo iRequestorInfo; |
|
645 TLbsNetPosRequestQuality iInitQuality; |
|
646 TLbsNetPosRequestMethod iInitPosMethod; |
|
647 // HMAC of the received SUPL INIT message |
|
648 TBuf8<8> iVer; |
|
649 |
|
650 // Position received from LBS during an MTLR |
|
651 // before a positioning session (SUPL POS/RRLP) |
|
652 // has started (a position cached by LBS that |
|
653 // satisfies SUPL INIT QoP) |
|
654 TBool iPositionStored; |
|
655 TPositionInfoBase* iPosition; |
|
656 |
|
657 TBool iPositioningEnded; |
|
658 TBool iPosSessionConducted; |
|
659 }; |
|
660 |
|
661 |
|
662 inline const TDesC* CSuplFsmSessionBase::Msisdn() const |
|
663 { |
|
664 return iTelNumber; |
|
665 } |
|
666 |
|
667 #endif // __SUPLFSMSESSIONBASE_H__ |