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@2
|
4 |
// under the terms of the License "Symbian Foundation License v1.0" to Symbian Foundation members and "Symbian Foundation End User License Agreement v1.0" to non-members
|
williamr@2
|
5 |
// which accompanies this distribution, and is available
|
williamr@2
|
6 |
// at the URL "http://www.symbianfoundation.org/legal/licencesv10.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@2
|
20 |
#include <lbsipc.h>
|
williamr@2
|
21 |
#include <lbscommon.h>
|
williamr@2
|
22 |
#include <lbsrequestor.h>
|
williamr@2
|
23 |
#include <lbscriteria.h>
|
williamr@2
|
24 |
|
williamr@2
|
25 |
// Forward declarations
|
williamr@2
|
26 |
class CPositioningPtrHolder;
|
williamr@2
|
27 |
class CServerPositioningPtrHolder;
|
williamr@2
|
28 |
class RPositionServer : public RSessionBase
|
williamr@2
|
29 |
|
williamr@2
|
30 |
/**
|
williamr@2
|
31 |
This is generally the first interface class used by all client applications.
|
williamr@2
|
32 |
It is used to make the primary connection to the location server. After the
|
williamr@2
|
33 |
primary connection has been established, its handle is passed as a parameter
|
williamr@2
|
34 |
of the Open methods of RPositioner to create a "sub-session".
|
williamr@2
|
35 |
|
williamr@2
|
36 |
The RPositionServer class can also be used to discover what position
|
williamr@2
|
37 |
technology "modules" are available. However, this is only required if a
|
williamr@2
|
38 |
client application actually needs to use a particular module.
|
williamr@2
|
39 |
|
williamr@2
|
40 |
@publishedAll
|
williamr@2
|
41 |
@released
|
williamr@2
|
42 |
*/
|
williamr@2
|
43 |
{
|
williamr@2
|
44 |
public:
|
williamr@2
|
45 |
IMPORT_C RPositionServer();
|
williamr@2
|
46 |
|
williamr@2
|
47 |
IMPORT_C TInt Connect();
|
williamr@2
|
48 |
IMPORT_C void Close();
|
williamr@2
|
49 |
|
williamr@2
|
50 |
IMPORT_C TInt CancelRequest(TInt aRequestId);
|
williamr@2
|
51 |
IMPORT_C TVersion Version() const;
|
williamr@2
|
52 |
|
williamr@2
|
53 |
IMPORT_C TInt GetDefaultModuleId(TPositionModuleId& aModuleId) const;
|
williamr@2
|
54 |
IMPORT_C TInt GetNumModules(TUint& aNumModules) const;
|
williamr@2
|
55 |
IMPORT_C TInt GetModuleInfoByIndex(TInt aModuleIndex,
|
williamr@2
|
56 |
TPositionModuleInfoBase& aModuleInfo) const;
|
williamr@2
|
57 |
IMPORT_C TInt GetModuleInfoById(TPositionModuleId aModuleId,
|
williamr@2
|
58 |
TPositionModuleInfoBase& aModuleInfo) const;
|
williamr@2
|
59 |
|
williamr@2
|
60 |
IMPORT_C TInt GetModuleStatus(TPositionModuleStatusBase& aPosModuleStatus,
|
williamr@2
|
61 |
TPositionModuleId aModuleId) const;
|
williamr@2
|
62 |
|
williamr@2
|
63 |
IMPORT_C void NotifyModuleStatusEvent(TPositionModuleStatusEventBase& aStatusEvent,
|
williamr@2
|
64 |
TRequestStatus& aStatus,
|
williamr@2
|
65 |
const TPositionModuleId aModuleId = KPositionNullModuleId) const;
|
williamr@2
|
66 |
|
williamr@2
|
67 |
private:
|
williamr@2
|
68 |
void ConstructL();
|
williamr@2
|
69 |
void Destruct();
|
williamr@2
|
70 |
static TInt StartServer();
|
williamr@2
|
71 |
|
williamr@2
|
72 |
private:
|
williamr@2
|
73 |
/** A pointer to a container that holds pointer descriptors, needed to point
|
williamr@2
|
74 |
to the clients request data during asynchronous requests */
|
williamr@2
|
75 |
CServerPositioningPtrHolder* iPtrHolder;
|
williamr@2
|
76 |
|
williamr@2
|
77 |
/** Variable for future expansion. */
|
williamr@2
|
78 |
TAny* iReserved;
|
williamr@2
|
79 |
};
|
williamr@2
|
80 |
|
williamr@2
|
81 |
|
williamr@2
|
82 |
class RPositionerSubSessionBase : public RSubSessionBase
|
williamr@2
|
83 |
/**
|
williamr@2
|
84 |
Abstract base class for all positioning sub-sessions, including RPositioner.
|
williamr@2
|
85 |
|
williamr@2
|
86 |
@see RPositioner
|
williamr@2
|
87 |
@publishedAll
|
williamr@2
|
88 |
@released
|
williamr@2
|
89 |
*/
|
williamr@2
|
90 |
{
|
williamr@2
|
91 |
public:
|
williamr@2
|
92 |
IMPORT_C TInt CancelRequest(TInt aRequestId);
|
williamr@2
|
93 |
|
williamr@2
|
94 |
IMPORT_C TInt CompleteRequest(TInt aRequestId);
|
williamr@2
|
95 |
|
williamr@2
|
96 |
protected:
|
williamr@2
|
97 |
IMPORT_C RPositionerSubSessionBase();
|
williamr@2
|
98 |
|
williamr@2
|
99 |
IMPORT_C virtual TAny* ExtendedInterface(TInt aFunctionNumber, TAny* aPtr1, TAny* aPtr2);
|
williamr@2
|
100 |
|
williamr@2
|
101 |
private:
|
williamr@2
|
102 |
/** Unused variable for future expansion. */
|
williamr@2
|
103 |
TAny* iReserved;
|
williamr@2
|
104 |
};
|
williamr@2
|
105 |
|
williamr@2
|
106 |
|
williamr@2
|
107 |
class RPositioner : public RPositionerSubSessionBase
|
williamr@2
|
108 |
/**
|
williamr@2
|
109 |
This class is used to create a sub-session with the server for the
|
williamr@2
|
110 |
purpose of obtaining the current position. In addition to actually
|
williamr@2
|
111 |
obtaining position information, this class also provides mechanisms
|
williamr@2
|
112 |
for obtaining the last known position, the general status of the
|
williamr@2
|
113 |
positioning module, changing how often it wishes to receive position
|
williamr@2
|
114 |
updates, as well as identifying itself to the location framework.
|
williamr@2
|
115 |
|
williamr@2
|
116 |
Before using the class, a primary connection must have already been
|
williamr@2
|
117 |
established with the server.
|
williamr@2
|
118 |
|
williamr@2
|
119 |
@see RPositionServer
|
williamr@2
|
120 |
@publishedAll
|
williamr@2
|
121 |
@released
|
williamr@2
|
122 |
*/
|
williamr@2
|
123 |
{
|
williamr@2
|
124 |
public:
|
williamr@2
|
125 |
IMPORT_C RPositioner();
|
williamr@2
|
126 |
|
williamr@2
|
127 |
IMPORT_C TInt Open(RPositionServer& aPosServer);
|
williamr@2
|
128 |
IMPORT_C TInt Open(RPositionServer& aPosServer,
|
williamr@2
|
129 |
TPositionModuleId aModuleId);
|
williamr@2
|
130 |
IMPORT_C TInt Open(RPositionServer& aPosServer,
|
williamr@2
|
131 |
const TPositionCriteriaBase& aCriteria);
|
williamr@2
|
132 |
IMPORT_C void Close();
|
williamr@2
|
133 |
|
williamr@2
|
134 |
IMPORT_C TInt SetRequestor(CRequestor::TRequestorType aType,
|
williamr@2
|
135 |
CRequestor::TRequestorFormat aFormat,
|
williamr@2
|
136 |
const TDesC& aData);
|
williamr@2
|
137 |
IMPORT_C TInt SetRequestor(const RRequestorStack& aRequestorStack);
|
williamr@2
|
138 |
|
williamr@2
|
139 |
IMPORT_C TInt SetUpdateOptions(const TPositionUpdateOptionsBase& aPosOption);
|
williamr@2
|
140 |
IMPORT_C TInt GetUpdateOptions(TPositionUpdateOptionsBase& aPosOption) const;
|
williamr@2
|
141 |
|
williamr@2
|
142 |
IMPORT_C void GetLastKnownPosition(TPositionInfoBase& aPosInfo,
|
williamr@2
|
143 |
TRequestStatus& aStatus) const;
|
williamr@2
|
144 |
IMPORT_C void NotifyPositionUpdate(TPositionInfoBase& aPosInfo,
|
williamr@2
|
145 |
TRequestStatus& aStatus) const;
|
williamr@2
|
146 |
|
williamr@2
|
147 |
protected:
|
williamr@2
|
148 |
IMPORT_C virtual void ConstructL();
|
williamr@2
|
149 |
IMPORT_C virtual void Destruct();
|
williamr@2
|
150 |
IMPORT_C virtual TAny* ExtendedInterface(TInt aFunctionNumber, TAny* aPtr1, TAny* aPtr2);
|
williamr@2
|
151 |
|
williamr@2
|
152 |
private:
|
williamr@2
|
153 |
void SetRequestorImplL(const RRequestorStack& aRequestorStack) const;
|
williamr@2
|
154 |
|
williamr@2
|
155 |
public:
|
williamr@2
|
156 |
TInt OpenImpl(RPositionServer& aPosServer, TPositionModuleId aModuleId, const TPositionCriteriaBase& aCriteria, TBool aOpenedUsingModuleId);
|
williamr@2
|
157 |
private:
|
williamr@2
|
158 |
/** A pointer to a container that holds pointer descriptors, needed to point
|
williamr@2
|
159 |
to the clients request data during asynchronous requests */
|
williamr@2
|
160 |
CPositioningPtrHolder* iPtrHolder;
|
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 |
#include <lbs.inl>
|
williamr@2
|
167 |
|
williamr@2
|
168 |
#endif // __LBS_H__
|