1 // Copyright (c) 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".
8 // Initial Contributors:
9 // Nokia Corporation - initial contribution.
23 #ifndef LBS_SUPL_PSY_ADAPTATION_H
24 #define LBS_SUPL_PSY_ADAPTATION_H
29 #include "lbsnetinternalapi.h"
30 #include "lbsnetinternalmsgtypes.h"
34 The MLbsSuplPsyAdaptationObserver class is used in partnership with
35 CLbsSuplPsyAdaptation. The observer interface is used by LBS to provide
36 responses to requests made by the SUPL PSY via CLbsSuplPsyAdaptation.
38 Although all the interface methods in the MLbsSuplPsyAdaptationObserver
39 are synchronous they should return quickly. If required, the SUPL PSY should
40 internally queue the responses and process them asynchronously.
42 @see CLbsSuplPsyAdaptation
44 class MLbsSuplPsyAdaptationObserver
47 virtual TVersion Version() = 0;
49 virtual void OnLocationUpdate(TUint aRequestId, TPositionInfoBase& aPosition, TInt aReason) = 0;
52 LBS issues a single call to OnSessionComplete() to close a session and return the final
53 result code to the SUPL PSY.
55 The aReason parameter indicates the overall success or failure for the request.
57 The request ID parameter identifies the session that is being closed. This ID is allocated when
58 a new request is created:
60 In normal situations, OnSessionComplete() will be invoked when the overall request has
61 finished. OnSessionComplete() can also be used by LBS to terminate a request if a protocol
62 conflict has arisen. For example, the local SUPL subsystem or a remote SUPL Server is unable to
63 simultaneously perform two requests (for example a TerminalBased AGPS session is active).
65 @param aRequestId The Id of the request being closed.
67 @param aReason Reason for the completion of the request. KErrNone if the request is successfully
68 completed, or one of a range of error codes otherwise.
70 virtual void OnSessionComplete(TUint aRequestId, TInt aReason) = 0;
75 The SUPL PSY adaptation interface is a point to point interface between the SUPL PSY and
76 the Netowrk Gateway and allows the SUPL PSY to ask a remote SUPL Server for the position of
77 the device. As the interface is point to point, only one instance is allowed and must be shared
78 between one or more SUPL PSYs. It is the responsibility of the SUPL PSY(s) to combine multiple
79 requests coming from multiple users.
81 The CLbsSuplPsyAdaptation class is used in partnership with MLbsSuplPsyAdaptationObserver.
82 LBS responds to requests from the SUPL PSY via that observer class.
84 Although all the interface methods in the class are synchronous they must return immediately.
85 When the SUPL PSY makes a request via CLbsSuplPsyAdaptation the LBS subsystem must
86 queue the request internally and return control to the caller immediately. Afterwards, when
87 the SUPL Server provides a response LBS uses the corresponding notification method in the
88 MLbsSuplPsyAdaptationObserver class.
90 The interface is a temporary solution and should be removed (or incorporated into the SUPL PSY)
91 once a common codeline is established.
93 The interface, even though declared as internalAll, MUST be used by the SUPL PSY EXCLUSIVELY.
94 It MUST NOT be used by the Generic Network PSY, or any other components.
96 @see MLbsSuplPsyAdaptationObserver
98 NONSHARABLE_CLASS(CLbsSuplPsyAdaptation) : public CActive, public MLbsNetChannelObserver
101 static CLbsSuplPsyAdaptation * NewL(MLbsSuplPsyAdaptationObserver& aObserver);
102 ~ CLbsSuplPsyAdaptation ();
105 RequestLocationUpdate() should be used by the SUPL PSY to request a SUPL Server to
106 calculate the current location of the handset and return it to the terminal.
108 When the location information is received from the SUPL Server it is being forwarded to
109 the SUPl PSY via the method MLbsSuplPsyAdaptationObserver::OnLocationUpdate().
111 The position information returned is network calculated and is normally
112 expected to be an approximate location only. For example, related to the position
113 of the current serving cell. It may also be a position calculated by the network with
114 the assistance of the terminal (the terminal sends measurements to the network).
116 This method automatically cancels any active location request and
117 replaces it with the new request. The CancelLocationRequest() method is used when the
118 SYPL PSY wants to a cancel request but does not immediately wish to replace it with
121 The aRequestId parameter is generated by the SUPL PSY and is used to connect all
122 corresponding responses and further requests. The same request ID must be used the
123 SUPL PSY if it wishes to cancel the request. Similarly, the same request ID must also
124 be supplied by LBS when it responds to the SUPL PSY
125 via the MLbsSuplPsyAdaptationObserver::OnLocationUpdate() method.
127 The request ID is also passed by the LBS subsystem when it closes a session via the
128 method MLbsSuplPsyAdaptationObserver::OnSessionComplete().
130 @param aRequestId The Id of the location request. This is generated by the SUPL PSY
131 and must be used by LBS when it returns the obtained position information.
133 @param aProtocolModuleId The Id of the protocol Module to be used.
134 @param aProtocolModuleId The Id of the protocol Module to be used.
135 @param aNewClient Indicates the first request from a new client.
139 @see MLbsSuplPsyAdaptationObserver::OnSessionComplete()
140 @see MLbsSuplPsyAdaptationObserver::OnLocationUpdate()
141 @see CancelLocationRequest
143 void RequestLocationUpdate(TUint aRequestId, TBool aNewClient, TUid aProtocolModule);
146 This method attempts to cancel a request to obtain the location
147 of the terminal. The previous request will have been initiated by calling
148 RequestLocationUpdate()
150 Note: If the SUPL PSY wishes to stop the location request and immediately issue a
151 new location request it should issue a subsequent call to RequestLocationUpdate().
152 Submitting a new location request, automatically cancels any outstanding transfer.
154 In some circumstances, LBS may still return the associated position to the SUPl PSY.
155 This situation can occur when the cancel request is performed after a point where it
156 is no longer possible to stop the request being sent.
158 @param aRequestId The Id of the network location request to be cancelled.
159 @param aReason Indicates why the LBS subsystem wants the terminate the request.
161 @see RequestLocationUpdate()
162 @see MLbsSuplPsyAdaptationObserver::OnLocationUpdate()
164 void CancelLocationRequest(TUint aRequestId, TInt aReason);
166 virtual void ProcessNetChannelMessage(RLbsNetChannel::TLbsNetChannelId aChannelId, const TLbsNetInternalMsgBase& aMessage);
182 TInt RunError( TInt aError );
184 TLbsNetInternalMsgBase* CreateTLbsCellLocationRequestMsgL(TUint aRequestId, TBool aNewClient, TUid aProtocolModule);
187 CLbsSuplPsyAdaptation (MLbsSuplPsyAdaptationObserver& aObserver);
190 * Construct HPositionGenericInfo and set requested fields
192 HPositionGenericInfo* ConstructGenericInfoL(
193 TInt aBufferSize = KPositionGenericInfoDefaultBufferSize ) const;
196 // Callback function for get location request complete event
197 MLbsSuplPsyAdaptationObserver& iObserver;
199 RLbsNetChannel iPsyChannel;
201 TLbsNetInternalMsgBase* iSentMsg;
204 TPositionInfoBase* iPositionInfo;
212 #endif // LBS_SUPL_PSY_ADAPTATION_H