epoc32/include/lbs.h
author William Roberts <williamr@symbian.org>
Wed, 31 Mar 2010 12:33:34 +0100
branchSymbian3
changeset 4 837f303aceeb
parent 2 2fe1408b6811
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@2
     1
// Copyright (c) 2003-2009 Nokia Corporation and/or its subsidiary(-ies).
williamr@2
     2
// All rights reserved.
williamr@2
     3
// This component and the accompanying materials are made available
williamr@4
     4
// under the terms of "Eclipse Public License v1.0"
williamr@2
     5
// which accompanies this distribution, and is available
williamr@4
     6
// at the URL "http://www.eclipse.org/legal/epl-v10.html".
williamr@2
     7
//
williamr@2
     8
// Initial Contributors:
williamr@2
     9
// Nokia Corporation - initial contribution.
williamr@2
    10
//
williamr@2
    11
// Contributors:
williamr@2
    12
//
williamr@2
    13
// Description:
williamr@2
    14
//
williamr@2
    15
williamr@2
    16
#ifndef __LBS_H__
williamr@2
    17
#define __LBS_H__
williamr@2
    18
williamr@2
    19
#include <lbspositioninfo.h>
williamr@4
    20
#include <lbsareainfo.h>
williamr@2
    21
#include <lbsipc.h>
williamr@2
    22
#include <lbscommon.h>
williamr@2
    23
#include <lbsrequestor.h>
williamr@2
    24
#include <lbscriteria.h>
williamr@2
    25
williamr@2
    26
// Forward declarations
williamr@2
    27
class CPositioningPtrHolder;
williamr@2
    28
class CServerPositioningPtrHolder;
williamr@2
    29
class RPositionServer : public RSessionBase
williamr@2
    30
williamr@2
    31
/**
williamr@2
    32
This is generally the first interface class used by all client applications.
williamr@2
    33
It is used to make the primary connection to the location server. After the
williamr@2
    34
primary connection has been established, its handle is passed as a parameter
williamr@2
    35
of the Open methods of RPositioner to create a "sub-session".
williamr@2
    36
williamr@2
    37
The RPositionServer class can also be used to discover what position
williamr@2
    38
technology "modules" are available. However, this is only required if a
williamr@4
    39
client application actually needs to use a particular module. It is also
williamr@4
    40
used for requests to clear(empty) the last known position store.
williamr@4
    41
williamr@4
    42
Asynchronous requests can be cancelled using the method CancelRequest() with
williamr@4
    43
a value from the enumeration _TReqestId corresponding to the particular
williamr@4
    44
operation being cancelled.
williamr@2
    45
williamr@2
    46
@publishedAll
williamr@2
    47
@released
williamr@2
    48
 */
williamr@2
    49
	{
williamr@2
    50
public:
williamr@4
    51
	/** Type for values defined in _TRequestId
williamr@4
    52
	@publishedPartner
williamr@4
    53
	@prototype*/
williamr@4
    54
	typedef TInt TRequestId;
williamr@4
    55
williamr@4
    56
 	/** Identification numbers used for cancelling requests.
williamr@4
    57
 	Note that the TRequestId enum may be extended in the future by adding
williamr@4
    58
 	more enumerated values. To maintain compatibility any unrecognized values 
williamr@4
    59
 	must be handled as EReqUnknown.
williamr@4
    60
 	@publishedPartner
williamr@4
    61
	@prototype*/
williamr@4
    62
	enum _TRequestId
williamr@4
    63
		{
williamr@4
    64
		/** Unknown/undefined Id */
williamr@4
    65
		EReqUnknown						= 0,
williamr@4
    66
		/** The id of the RPositionServer::NotifyModuleStatusEvent request */
williamr@4
    67
		EReqNotifyModuleStatusEvent     = 1,
williamr@4
    68
		/** The id of the RPositionServer::EmptyLastKnownPositionStore request */
williamr@4
    69
		EReqEmptyLastKnownPositionStore = 2
williamr@4
    70
		};
williamr@4
    71
		
williamr@4
    72
public:
williamr@2
    73
	IMPORT_C RPositionServer();
williamr@2
    74
williamr@2
    75
	IMPORT_C TInt Connect();
williamr@2
    76
	IMPORT_C void Close();
williamr@2
    77
williamr@4
    78
	IMPORT_C TInt CancelRequest(TRequestId aRequestId);
williamr@2
    79
	IMPORT_C TVersion Version() const;
williamr@2
    80
williamr@2
    81
	IMPORT_C TInt GetDefaultModuleId(TPositionModuleId& aModuleId) const;
williamr@2
    82
	IMPORT_C TInt GetNumModules(TUint& aNumModules) const;
williamr@2
    83
	IMPORT_C TInt GetModuleInfoByIndex(TInt aModuleIndex,
williamr@2
    84
	                                   TPositionModuleInfoBase& aModuleInfo) const;
williamr@2
    85
	IMPORT_C TInt GetModuleInfoById(TPositionModuleId aModuleId,
williamr@2
    86
	                                TPositionModuleInfoBase& aModuleInfo) const;
williamr@2
    87
williamr@2
    88
	IMPORT_C TInt GetModuleStatus(TPositionModuleStatusBase& aPosModuleStatus,
williamr@2
    89
	                              TPositionModuleId aModuleId) const;
williamr@2
    90
williamr@2
    91
	IMPORT_C void NotifyModuleStatusEvent(TPositionModuleStatusEventBase& aStatusEvent,
williamr@2
    92
	                                      TRequestStatus& aStatus,
williamr@2
    93
	                                      const TPositionModuleId aModuleId = KPositionNullModuleId) const;
williamr@4
    94
	                                      
williamr@4
    95
	IMPORT_C void EmptyLastKnownPositionStore(TRequestStatus& aStatus);
williamr@2
    96
williamr@2
    97
private:
williamr@2
    98
	void ConstructL();
williamr@2
    99
	void Destruct();
williamr@2
   100
	static TInt StartServer();
williamr@2
   101
williamr@2
   102
private:
williamr@2
   103
	/** A pointer to a container that holds pointer descriptors, needed to point
williamr@2
   104
	to the clients request data during asynchronous requests */
williamr@2
   105
	CServerPositioningPtrHolder* iPtrHolder;
williamr@2
   106
	
williamr@2
   107
	/** Variable for future expansion. */
williamr@2
   108
	TAny* iReserved;
williamr@2
   109
	};
williamr@2
   110
williamr@2
   111
williamr@2
   112
class RPositionerSubSessionBase : public RSubSessionBase
williamr@2
   113
/**
williamr@2
   114
Abstract base class for all positioning sub-sessions, including RPositioner.
williamr@2
   115
williamr@4
   116
Asynchronous requests issued from derived classess are cancelled using the
williamr@4
   117
method CancelRequest() with a value from the enumeration _TReqestId corresponding
williamr@4
   118
to the particular operation being cancelled.
williamr@4
   119
williamr@2
   120
@see RPositioner
williamr@2
   121
@publishedAll
williamr@2
   122
@released
williamr@2
   123
 */
williamr@2
   124
	{
williamr@4
   125
	
williamr@2
   126
public:
williamr@4
   127
williamr@4
   128
	/** Type for values defined in _TRequestId
williamr@4
   129
	@publishedPartner
williamr@4
   130
	@prototype*/
williamr@4
   131
	typedef TInt TRequestId;
williamr@4
   132
williamr@4
   133
	/** Identification numbers used for cancelling requests.
williamr@4
   134
 	Note that the TRequestId enum may be extended in the future by adding
williamr@4
   135
 	more enumerated values. To maintain compatibility any unrecognized values 
williamr@4
   136
 	must be handled as EReqUnknown.
williamr@4
   137
 	@publishedPartner
williamr@4
   138
	@prototype*/
williamr@4
   139
	enum _TRequestId
williamr@4
   140
		{
williamr@4
   141
		/** Unknown/undefined Id */
williamr@4
   142
		EReqUnknown					 = 0,
williamr@4
   143
		/** The id of the GetLastKnownPosition request */
williamr@4
   144
		EReqGetLastKnownPosition     = 1,
williamr@4
   145
		/** The id of the GetLastKnownPositionArea request */
williamr@4
   146
		EReqGetLastKnownPositionArea = 2,
williamr@4
   147
		/** The id of the ReqNotifyPositionUpdate request */
williamr@4
   148
		EReqNotifyPositionUpdate     = 3
williamr@4
   149
		};
williamr@4
   150
public:
williamr@4
   151
	IMPORT_C TInt CancelRequest(TRequestId aRequestId);
williamr@2
   152
williamr@2
   153
	IMPORT_C TInt CompleteRequest(TInt aRequestId);
williamr@2
   154
williamr@2
   155
protected:
williamr@2
   156
	IMPORT_C RPositionerSubSessionBase();
williamr@2
   157
	
williamr@2
   158
	IMPORT_C virtual TAny* ExtendedInterface(TInt aFunctionNumber, TAny* aPtr1, TAny* aPtr2);
williamr@2
   159
williamr@2
   160
private:
williamr@2
   161
	/** Unused variable for future expansion. */
williamr@2
   162
	TAny* iReserved;
williamr@2
   163
	};
williamr@2
   164
williamr@2
   165
williamr@2
   166
class RPositioner : public RPositionerSubSessionBase
williamr@2
   167
/**
williamr@2
   168
This class is used to create a sub-session with the server for the
williamr@2
   169
purpose of obtaining the current position. In addition to actually
williamr@2
   170
obtaining position information, this class also provides mechanisms
williamr@4
   171
for obtaining the last known position, the last known position with 
williamr@4
   172
area information, the general status of the positioning module,
williamr@4
   173
changing how often it wishes to receive position updates, as well as 
williamr@4
   174
identifying itself to the location framework. 
williamr@2
   175
williamr@2
   176
Before using the class, a primary connection must have already been
williamr@2
   177
established with the server.
williamr@2
   178
williamr@2
   179
@see RPositionServer
williamr@2
   180
@publishedAll
williamr@2
   181
@released
williamr@2
   182
 */
williamr@2
   183
	{
williamr@4
   184
williamr@2
   185
public:
williamr@2
   186
	IMPORT_C RPositioner();
williamr@2
   187
williamr@2
   188
	IMPORT_C TInt Open(RPositionServer& aPosServer);
williamr@2
   189
	IMPORT_C TInt Open(RPositionServer& aPosServer,
williamr@2
   190
	                   TPositionModuleId aModuleId);
williamr@2
   191
	IMPORT_C TInt Open(RPositionServer& aPosServer,
williamr@2
   192
	                   const TPositionCriteriaBase& aCriteria);
williamr@2
   193
	IMPORT_C void Close();
williamr@2
   194
williamr@2
   195
	IMPORT_C TInt SetRequestor(CRequestor::TRequestorType aType,
williamr@2
   196
	                           CRequestor::TRequestorFormat aFormat,
williamr@2
   197
	                           const TDesC& aData);
williamr@2
   198
	IMPORT_C TInt SetRequestor(const RRequestorStack& aRequestorStack);
williamr@2
   199
williamr@2
   200
	IMPORT_C TInt SetUpdateOptions(const TPositionUpdateOptionsBase& aPosOption);
williamr@2
   201
	IMPORT_C TInt GetUpdateOptions(TPositionUpdateOptionsBase& aPosOption) const;
williamr@2
   202
williamr@2
   203
	IMPORT_C void GetLastKnownPosition(TPositionInfoBase& aPosInfo,
williamr@2
   204
	                                   TRequestStatus& aStatus) const;
williamr@4
   205
	                                   
williamr@4
   206
	IMPORT_C void GetLastKnownPositionArea(TPositionInfoBase& aPosInfo,
williamr@4
   207
					      				 TPositionAreaInfoBase& aAreaInfo,
williamr@4
   208
	                                   	 TRequestStatus& aStatus) const;
williamr@4
   209
williamr@2
   210
	IMPORT_C void NotifyPositionUpdate(TPositionInfoBase& aPosInfo,
williamr@2
   211
	                                   TRequestStatus& aStatus) const;
williamr@2
   212
williamr@2
   213
protected:
williamr@2
   214
	IMPORT_C virtual void ConstructL();
williamr@2
   215
	IMPORT_C virtual void Destruct();
williamr@2
   216
    IMPORT_C virtual TAny* ExtendedInterface(TInt aFunctionNumber, TAny* aPtr1, TAny* aPtr2);
williamr@2
   217
williamr@2
   218
public:
williamr@2
   219
	TInt OpenImpl(RPositionServer& aPosServer, TPositionModuleId aModuleId, const TPositionCriteriaBase& aCriteria, TBool aOpenedUsingModuleId);
williamr@2
   220
private:
williamr@2
   221
	/** A pointer to a container that holds pointer descriptors, needed to point
williamr@2
   222
	to the clients request data during asynchronous requests */
williamr@2
   223
	CPositioningPtrHolder* iPtrHolder;
williamr@2
   224
	/** Unused variable for future expansion. */
williamr@2
   225
	TAny* iReserved;
williamr@2
   226
	};
williamr@2
   227
williamr@2
   228
williamr@2
   229
#include <lbs.inl>
williamr@2
   230
williamr@2
   231
#endif // __LBS_H__