epoc32/include/lbsSuplPsyAdaptation.h
author William Roberts <williamr@symbian.org>
Wed, 31 Mar 2010 12:33:34 +0100
branchSymbian3
changeset 4 837f303aceeb
permissions -rw-r--r--
Current Symbian^3 public API header files (from PDK 3.0.h)
This is the epoc32/include tree with the "platform" subtrees removed, and
all but a selected few mbg and rsg files removed.
williamr@4
     1
// Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
williamr@4
     2
// All rights reserved.
williamr@4
     3
// This component and the accompanying materials are made available
williamr@4
     4
// under the terms of "Eclipse Public License v1.0"
williamr@4
     5
// which accompanies this distribution, and is available
williamr@4
     6
// at the URL "http://www.eclipse.org/legal/epl-v10.html".
williamr@4
     7
//
williamr@4
     8
// Initial Contributors:
williamr@4
     9
// Nokia Corporation - initial contribution.
williamr@4
    10
//
williamr@4
    11
// Contributors:
williamr@4
    12
//
williamr@4
    13
// Description:
williamr@4
    14
//
williamr@4
    15
williamr@4
    16
/**
williamr@4
    17
 @file
williamr@4
    18
 @internalComponent
williamr@4
    19
 @prototype
williamr@4
    20
*/
williamr@4
    21
williamr@4
    22
williamr@4
    23
#ifndef LBS_SUPL_PSY_ADAPTATION_H
williamr@4
    24
#define LBS_SUPL_PSY_ADAPTATION_H
williamr@4
    25
williamr@4
    26
#include <e32std.h>
williamr@4
    27
#include <e32base.h>
williamr@4
    28
#include <lbs.h>
williamr@4
    29
#include "lbsnetinternalapi.h"
williamr@4
    30
#include "lbsnetinternalmsgtypes.h"
williamr@4
    31
williamr@4
    32
williamr@4
    33
/**
williamr@4
    34
The MLbsSuplPsyAdaptationObserver class is used in partnership with
williamr@4
    35
CLbsSuplPsyAdaptation. The observer interface is used by LBS to provide 
williamr@4
    36
responses to requests made by the SUPL PSY via CLbsSuplPsyAdaptation. 
williamr@4
    37
williamr@4
    38
Although all the interface methods in the MLbsSuplPsyAdaptationObserver
williamr@4
    39
are synchronous they should return quickly. If required, the SUPL PSY should 
williamr@4
    40
internally queue the responses and process them asynchronously. 
williamr@4
    41
williamr@4
    42
@see CLbsSuplPsyAdaptation
williamr@4
    43
*/
williamr@4
    44
class MLbsSuplPsyAdaptationObserver
williamr@4
    45
	{
williamr@4
    46
public:
williamr@4
    47
	virtual TVersion Version() = 0;
williamr@4
    48
	
williamr@4
    49
	virtual void OnLocationUpdate(TUint aRequestId, TPositionInfoBase& aPosition, TInt aReason) = 0;
williamr@4
    50
williamr@4
    51
	/**
williamr@4
    52
	LBS issues a single call to OnSessionComplete() to close a session and return the final 
williamr@4
    53
	result code to the SUPL PSY. 
williamr@4
    54
williamr@4
    55
	The aReason parameter indicates the overall success or failure for the request. 
williamr@4
    56
williamr@4
    57
	The request ID parameter identifies the session that is being closed. This ID is allocated when
williamr@4
    58
	a new request is created: 
williamr@4
    59
williamr@4
    60
	In normal situations, OnSessionComplete() will be invoked when the overall request has
williamr@4
    61
	finished. OnSessionComplete() can also be used by LBS to terminate a request if a protocol 
williamr@4
    62
	conflict has arisen. For example, the local SUPL subsystem or a remote SUPL Server is unable to 
williamr@4
    63
	simultaneously perform two requests (for example a TerminalBased AGPS session is active).
williamr@4
    64
williamr@4
    65
	@param aRequestId The Id of the request being closed. 
williamr@4
    66
williamr@4
    67
	@param aReason Reason for the completion of the request. KErrNone if the request is successfully
williamr@4
    68
	       completed, or one of a range of error codes otherwise. 
williamr@4
    69
	*/
williamr@4
    70
	virtual void OnSessionComplete(TUint aRequestId, TInt aReason) = 0;
williamr@4
    71
	};
williamr@4
    72
williamr@4
    73
williamr@4
    74
/**
williamr@4
    75
The SUPL PSY adaptation interface is a point to point interface between the SUPL PSY and 
williamr@4
    76
the Netowrk Gateway and allows the SUPL PSY to ask a remote SUPL Server for the position of 
williamr@4
    77
the device. As the interface is point to point, only one instance is allowed and must be shared 
williamr@4
    78
between one or more SUPL PSYs. It is the responsibility of the SUPL PSY(s) to combine multiple 
williamr@4
    79
requests coming from multiple users.
williamr@4
    80
williamr@4
    81
The CLbsSuplPsyAdaptation class is used in partnership with MLbsSuplPsyAdaptationObserver. 
williamr@4
    82
LBS responds to requests from the SUPL PSY via that observer class. 
williamr@4
    83
williamr@4
    84
Although all the interface methods in the class are synchronous they must return immediately.
williamr@4
    85
When the SUPL PSY makes a request via CLbsSuplPsyAdaptation the LBS subsystem must
williamr@4
    86
queue the request internally and return control to the caller immediately. Afterwards, when
williamr@4
    87
the SUPL Server provides a response LBS uses the corresponding notification method in the
williamr@4
    88
MLbsSuplPsyAdaptationObserver class. 
williamr@4
    89
williamr@4
    90
The interface is a temporary solution and should be removed (or incorporated into the SUPL PSY) 
williamr@4
    91
once a common codeline is established.
williamr@4
    92
williamr@4
    93
The interface, even though declared as internalAll, MUST be used by the SUPL PSY EXCLUSIVELY.
williamr@4
    94
It MUST NOT be used by the Generic Network PSY, or any other components.
williamr@4
    95
williamr@4
    96
@see MLbsSuplPsyAdaptationObserver 
williamr@4
    97
*/
williamr@4
    98
NONSHARABLE_CLASS(CLbsSuplPsyAdaptation) : public CActive, public MLbsNetChannelObserver
williamr@4
    99
	{
williamr@4
   100
public:
williamr@4
   101
	static CLbsSuplPsyAdaptation * NewL(MLbsSuplPsyAdaptationObserver& aObserver);
williamr@4
   102
	~ CLbsSuplPsyAdaptation ();
williamr@4
   103
	
williamr@4
   104
	/**
williamr@4
   105
	RequestLocationUpdate() should be used by the SUPL PSY to request a SUPL Server to
williamr@4
   106
	calculate the current location of the handset and return it to the terminal. 
williamr@4
   107
williamr@4
   108
	When the location information is received from the SUPL Server it is being forwarded to 
williamr@4
   109
	the SUPl PSY via the method MLbsSuplPsyAdaptationObserver::OnLocationUpdate().
williamr@4
   110
williamr@4
   111
	The position information returned is network calculated and is normally
williamr@4
   112
	expected to be an approximate location only. For example, related to the position
williamr@4
   113
	of the current serving cell. It may also be a position calculated by the network with
williamr@4
   114
	the assistance of the terminal (the terminal sends measurements to the network).
williamr@4
   115
williamr@4
   116
	This method automatically cancels any active location request and
williamr@4
   117
	replaces it with the new request. The CancelLocationRequest() method is used when the
williamr@4
   118
	SYPL PSY wants to a cancel request but does not immediately wish to replace it with
williamr@4
   119
	another.
williamr@4
   120
williamr@4
   121
	The aRequestId parameter is generated by the SUPL PSY and is used to connect all
williamr@4
   122
	corresponding responses and further requests. The same request ID must be used the 
williamr@4
   123
	SUPL PSY if it wishes to cancel the request. Similarly, the same request ID must also
williamr@4
   124
	be supplied by LBS when it responds to the SUPL PSY 
williamr@4
   125
	via the MLbsSuplPsyAdaptationObserver::OnLocationUpdate() method.
williamr@4
   126
williamr@4
   127
	The request ID is also passed by the LBS subsystem when it closes a session via the
williamr@4
   128
	method MLbsSuplPsyAdaptationObserver::OnSessionComplete().
williamr@4
   129
williamr@4
   130
	@param aRequestId The Id of the location request. This is generated by the SUPL PSY
williamr@4
   131
	       and must be used by LBS when it returns the obtained position information. 
williamr@4
   132
williamr@4
   133
	@param aProtocolModuleId The Id of the protocol Module to be used.
williamr@4
   134
	@param aProtocolModuleId The Id of the protocol Module to be used.
williamr@4
   135
	@param aNewClient		 Indicates the first request from a new client.
williamr@4
   136
williamr@4
   137
williamr@4
   138
	@see CLbsAdmin
williamr@4
   139
	@see MLbsSuplPsyAdaptationObserver::OnSessionComplete()
williamr@4
   140
	@see MLbsSuplPsyAdaptationObserver::OnLocationUpdate()
williamr@4
   141
	@see CancelLocationRequest
williamr@4
   142
	*/
williamr@4
   143
	void RequestLocationUpdate(TUint aRequestId, TBool aNewClient, TUid aProtocolModule);
williamr@4
   144
williamr@4
   145
	/**
williamr@4
   146
	This method attempts to cancel a request to obtain the location
williamr@4
   147
	of the terminal. The previous request will have been initiated by calling
williamr@4
   148
	RequestLocationUpdate()
williamr@4
   149
williamr@4
   150
	Note: If the SUPL PSY wishes to stop the location request and immediately issue a 
williamr@4
   151
	new location request it should issue a subsequent call to RequestLocationUpdate().
williamr@4
   152
	Submitting a new location request, automatically cancels any outstanding transfer.
williamr@4
   153
williamr@4
   154
	In some circumstances, LBS may still return the associated position to the SUPl PSY.
williamr@4
   155
	This situation can occur when the cancel request is performed after a point where it 
williamr@4
   156
	is no longer possible to stop the request being sent.
williamr@4
   157
williamr@4
   158
	@param aRequestId The Id of the network location request to be cancelled.
williamr@4
   159
	@param aReason Indicates why the LBS subsystem wants the terminate the request. 
williamr@4
   160
williamr@4
   161
	@see RequestLocationUpdate() 
williamr@4
   162
	@see MLbsSuplPsyAdaptationObserver::OnLocationUpdate()
williamr@4
   163
	*/
williamr@4
   164
	void CancelLocationRequest(TUint aRequestId, TInt aReason);
williamr@4
   165
williamr@4
   166
    virtual void ProcessNetChannelMessage(RLbsNetChannel::TLbsNetChannelId aChannelId, const TLbsNetInternalMsgBase& aMessage);
williamr@4
   167
williamr@4
   168
private:
williamr@4
   169
        /**
williamr@4
   170
        * From CActive
williamr@4
   171
        */
williamr@4
   172
        void RunL();
williamr@4
   173
williamr@4
   174
        /**
williamr@4
   175
        * From CActive
williamr@4
   176
        */
williamr@4
   177
        void DoCancel();
williamr@4
   178
williamr@4
   179
        /**
williamr@4
   180
        * From CActive
williamr@4
   181
        */
williamr@4
   182
        TInt RunError( TInt aError );
williamr@4
   183
williamr@4
   184
        TLbsNetInternalMsgBase* CreateTLbsCellLocationRequestMsgL(TUint aRequestId, TBool aNewClient, TUid aProtocolModule);
williamr@4
   185
williamr@4
   186
private:
williamr@4
   187
	CLbsSuplPsyAdaptation (MLbsSuplPsyAdaptationObserver& aObserver);
williamr@4
   188
	void ConstructL();
williamr@4
   189
            /**
williamr@4
   190
        * Construct HPositionGenericInfo and set requested fields
williamr@4
   191
        */
williamr@4
   192
        HPositionGenericInfo* ConstructGenericInfoL( 
williamr@4
   193
            TInt aBufferSize = KPositionGenericInfoDefaultBufferSize ) const;
williamr@4
   194
williamr@4
   195
private:
williamr@4
   196
            // Callback function for get location request complete event
williamr@4
   197
        MLbsSuplPsyAdaptationObserver& iObserver;
williamr@4
   198
williamr@4
   199
        RLbsNetChannel iPsyChannel;
williamr@4
   200
williamr@4
   201
        TLbsNetInternalMsgBase* iSentMsg;
williamr@4
   202
        
williamr@4
   203
        // position info
williamr@4
   204
        TPositionInfoBase* iPositionInfo;
williamr@4
   205
        
williamr@4
   206
        TUint iRequestid;    
williamr@4
   207
williamr@4
   208
        TBool iLocRequest;
williamr@4
   209
	};
williamr@4
   210
williamr@4
   211
	
williamr@4
   212
#endif // LBS_SUPL_PSY_ADAPTATION_H