|
1 /* |
|
2 * Copyright (c) 2002-2005 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of "Eclipse Public License v1.0" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: CActive Derived class for making requests to SUPL terminal |
|
15 * initiation library |
|
16 * |
|
17 */ |
|
18 |
|
19 #ifndef CLBSSUPLTIAPIREQUESTOR_H |
|
20 #define CLBSSUPLTIAPIREQUESTOR_H |
|
21 |
|
22 #include <e32base.h> |
|
23 #include <e32std.h> |
|
24 #include <lbs/lbsnetcommon.h> |
|
25 #include <epos_suplterminal.h> |
|
26 |
|
27 //FORWARD DECLARATIONS |
|
28 class COMASuplTrace; |
|
29 class MLbsSuplTiObserver; |
|
30 |
|
31 /** |
|
32 * Class: CCLbsSuplTiApiRequestor |
|
33 * |
|
34 * Description: This is the CActive derived class that makes the actual |
|
35 * location request to the Terminal Initiation Library. |
|
36 */ |
|
37 class CCLbsSuplTiApiRequestor : public CActive |
|
38 { |
|
39 public: |
|
40 //Destructor for CCLbsSuplTiApiRequestor |
|
41 ~CCLbsSuplTiApiRequestor(); |
|
42 |
|
43 // Two-phased constructor. |
|
44 static CCLbsSuplTiApiRequestor* NewL(MLbsSuplTiObserver& aObserver,RSuplTerminalServer& aServer); |
|
45 |
|
46 // Two-phased constructor. |
|
47 static CCLbsSuplTiApiRequestor* NewLC(MLbsSuplTiObserver& aObserver,RSuplTerminalServer& aServer); |
|
48 |
|
49 public: |
|
50 |
|
51 /** |
|
52 * @Description: Method to make initial location request |
|
53 * Calls TI API's RunSession using the requested paramaters |
|
54 * @param: aSessionId is the Id of the location request.This id is passed |
|
55 * to the TI API's request id as argument |
|
56 * |
|
57 * @param aOptions should be of type TLbsNetPosRequestOptions. |
|
58 * This is used to retrieve the TSuplTerminalQop and |
|
59 * First Req paramaters to be passed to the TI API's |
|
60 * RunSession Method. |
|
61 * |
|
62 * @param aMethod This parameter contains a list of the positioning methods |
|
63 * that should be used to obtain the device's position. |
|
64 * This is used to for setCaps to be sent to the RunSession method. |
|
65 * @return: None |
|
66 * |
|
67 */ |
|
68 void RequestLocation(const TLbsNetSessionId& aSessionId, const TLbsNetPosRequestOptionsBase& aOptions, const TLbsNetPosRequestMethod& aMethod); |
|
69 |
|
70 |
|
71 /** |
|
72 * @Description: Method to retrieve the Position obtained for request made |
|
73 * using the RequestLocation() method |
|
74 * Calls TI API's GetPosition using the requested paramaters |
|
75 * @param: aPositionInfo the position value is returned in this |
|
76 * @return: KErrNone if position retrieved successfully |
|
77 * TODO: Other error codes to be put here |
|
78 * |
|
79 */ |
|
80 TInt GetPosition(TPositionInfoBase& aPositionInfo); |
|
81 |
|
82 /** |
|
83 * @Description: Method to retrieve the session id for which this requestor object |
|
84 * is making requests. The request id is set when client calls |
|
85 * RequestLocation() method. Used to differentiate CCLbsSuplTiApiRequestor |
|
86 * objects based on Session Id. |
|
87 * @return: returns the TLbsNetSessionId object which was passed to this |
|
88 * when making initial request |
|
89 * |
|
90 */ |
|
91 TLbsNetSessionId GetSessionId(); |
|
92 |
|
93 private: |
|
94 // C++ constructor |
|
95 CCLbsSuplTiApiRequestor(MLbsSuplTiObserver& aObserver,RSuplTerminalServer& aServer); |
|
96 |
|
97 // Second-phase constructor |
|
98 void ConstructL(); |
|
99 |
|
100 /** |
|
101 * @Description: Method to convert a TLbsNetPosRequestMethod object to an integer |
|
102 * form to be passed as argument to RunSession for SetCaps. |
|
103 * @param : aMethod The TLbsNetPosRequestMethod object to be converted |
|
104 * @return: returns the setcaps in TInt form |
|
105 * |
|
106 */ |
|
107 TInt ProcessPosMethods( const TLbsNetPosRequestMethod& aMethod); |
|
108 |
|
109 private: |
|
110 // From CActive |
|
111 // Handle completion |
|
112 void RunL(); |
|
113 |
|
114 // For cancelling Ashnchronous requests |
|
115 void DoCancel(); |
|
116 |
|
117 // Override to handle leaves from RunL(). |
|
118 TInt RunError(TInt aError); |
|
119 |
|
120 private: |
|
121 //Enum to indicate state of this requestor |
|
122 enum TCLbsSuplTiApiRequestorState |
|
123 { |
|
124 EUninitialized, // Uninitialized |
|
125 EInitialized, // Initalized |
|
126 }; |
|
127 |
|
128 private: |
|
129 TCLbsSuplTiApiRequestorState iState; // State of the active object |
|
130 |
|
131 RSuplTerminalServer& iServer; |
|
132 RSuplTerminalSubSession iSubSession; |
|
133 |
|
134 //Reference to observer to signal completion |
|
135 MLbsSuplTiObserver& iObserver; |
|
136 |
|
137 //Session id for which this request was made |
|
138 TLbsNetSessionId iNetSessionId; |
|
139 |
|
140 //For Logging |
|
141 COMASuplTrace* iTrace; |
|
142 }; |
|
143 |
|
144 #endif // CLBSSUPLTIAPIREQUESTOR_H |