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