|
1 /* |
|
2 * Copyright (c) 2006-2007 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 the License "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: Provides interface between the Liw FrameWork and Service Provider. |
|
15 * |
|
16 */ |
|
17 |
|
18 #ifndef C_CSENSORINTERFACE_H |
|
19 #define C_CSENSORINTERFACE_H |
|
20 |
|
21 #include <LiwVariant.h> |
|
22 #include <utf.h> |
|
23 |
|
24 // User Includes |
|
25 #include "sensorservice.hrh" |
|
26 #include "sensorinterface.hrh" |
|
27 #include "serviceerrno.h" |
|
28 // Forward Declarations |
|
29 class CSensorService; |
|
30 class CStoreAsyncInfo; |
|
31 |
|
32 /** |
|
33 * CSensorInterface - Provides interface between the Liw FrameWork |
|
34 * and Service Provider. |
|
35 */ |
|
36 class CSensorInterface : public CBase, public MLiwInterface |
|
37 { |
|
38 //enumerations for parameter indices. |
|
39 private: |
|
40 enum TParamIndex |
|
41 { |
|
42 EParamIndex0 = 0, |
|
43 EParamIndex1, |
|
44 EParamIndex2, |
|
45 EParamIndex3, |
|
46 EParamIndex4 |
|
47 }; |
|
48 public:// Construction and destruction |
|
49 /** |
|
50 * Two-phased constructor. |
|
51 * @return CSensorInterface* |
|
52 */ |
|
53 static CSensorInterface* NewL(); |
|
54 /** |
|
55 * Destructor |
|
56 */ |
|
57 virtual ~CSensorInterface(); |
|
58 |
|
59 public:// General Methods |
|
60 |
|
61 /** |
|
62 * Returns the Corresponding Sapi Error Code. |
|
63 * @param aError Descriptor specifying format of image |
|
64 * @return SapiErrors. |
|
65 */ |
|
66 static SapiErrors GetSapiErrorCode( TInt aError ); |
|
67 |
|
68 private: |
|
69 /** |
|
70 * Default constructor. |
|
71 */ |
|
72 CSensorInterface(); |
|
73 /** |
|
74 * Symbian OS constructor. |
|
75 * @return void |
|
76 */ |
|
77 void ConstructL(); |
|
78 /** |
|
79 * Executes the Commands passed by the user this method is called by the ExecuteCmdL method. |
|
80 * |
|
81 * @param aCmdName the name of the service command which the consumer wants to invoke |
|
82 * @param aInParamList the input parameter list, can be empty list |
|
83 * @param [in,out] aOutParamList the output parameter list.Return Code is |
|
84 * passed through this list |
|
85 * @param aCmdOptions Options for the command, see TLiwServiceCmdOptions in LiwCommon.hrh. |
|
86 * @param aCallback callback to be registered by consumer application |
|
87 * |
|
88 * |
|
89 * |
|
90 * @see TLiwServiceCmdOptions |
|
91 * @see CLiwGenericParamList |
|
92 * @see MLiwNotifyCallback |
|
93 * |
|
94 */ |
|
95 void ExecuteServiceCommandL( const TDesC8& aCmdName, |
|
96 const CLiwGenericParamList& aInParamList, |
|
97 CLiwGenericParamList& aOutParamList, |
|
98 TUint aCmdOptions = 0, |
|
99 MLiwNotifyCallback* aCallback = 0 ); |
|
100 /** |
|
101 * Extract Channel Information from input map |
|
102 * @param aChannelInfo Refers to channel info where information about the channel |
|
103 * will be extracted to. |
|
104 * @param aChnlInfoMap refers to input map containing channel info |
|
105 */ |
|
106 |
|
107 void GetChannelInfoL( TSensrvChannelInfo& aChannelInfo, |
|
108 const CLiwMap* aChnlInfoMap ); |
|
109 |
|
110 /** |
|
111 * Returns Channel Property string from input property ID |
|
112 * @param aPropertyId Refers to channel property id enum |
|
113 * @return Property Id string |
|
114 */ |
|
115 TPtrC PropertyStrL( TSensrvPropertyId aPropertyId ); |
|
116 |
|
117 /** |
|
118 * Returns Channel Property ID from input property ID string |
|
119 * @param aPropertyIdStr Refers to channel property id string |
|
120 * @return TSensrvPropertyId |
|
121 */ |
|
122 TSensrvPropertyId PropertyIdInfoL( const TDesC& aPropertyIdStr ); |
|
123 |
|
124 /** |
|
125 * Appends list of found channels to the out put parameter List |
|
126 * |
|
127 * @param aChannelInfoList: The List of channels found |
|
128 * @param aList List which will be populated and appended to outputparamList |
|
129 * |
|
130 */ |
|
131 void AppendChannelInfoL( const RSensrvChannelInfoList& aChannelInfoList, |
|
132 CLiwDefaultList* aList ); |
|
133 |
|
134 /** |
|
135 * Appends list of found channel property to the out put parameter List |
|
136 * |
|
137 * @param aPropertyList: The List of channel property |
|
138 * @param aMap Map which will be populated and appended to outputparamList |
|
139 * @param aPropertyId Property id to be searched for |
|
140 */ |
|
141 void AppendPropertyToMapL( const RSensrvPropertyList& aPropertyList, |
|
142 CLiwDefaultMap* aMap, |
|
143 const TUint aPropertyId ); |
|
144 /* |
|
145 * Function for validation of type of Input Containers |
|
146 */ |
|
147 void CheckInputTypeL( const TLiwVariant* aSource, |
|
148 LIW::TVariantTypeId aExpectedtype, |
|
149 const TDesC8* aErrorArgument ); |
|
150 |
|
151 /* |
|
152 * Function for validation of missing params in Input Containers |
|
153 */ |
|
154 void MissingValueL( const TDesC8* aErrorArgument ); |
|
155 |
|
156 public: |
|
157 /** |
|
158 * provides a concrete implementation for the supported service |
|
159 * command aCmdName. |
|
160 * |
|
161 * @param aCmdName the name of the service command which the consumer wants to invoke |
|
162 * @param aInParamList the input parameter list, can be empty list |
|
163 * @param [in,out] aOutParamList the output parameter list.Return Code is |
|
164 * passed through this list |
|
165 * @param aCmdOptions Options for the command, see TLiwServiceCmdOptions in LiwCommon.hrh. |
|
166 * @param aCallback callback to be registered by consumer application |
|
167 * |
|
168 * |
|
169 * |
|
170 * @see TLiwServiceCmdOptions |
|
171 * @see CLiwGenericParamList |
|
172 * @see MLiwNotifyCallback |
|
173 * |
|
174 */ |
|
175 virtual void ExecuteCmdL( const TDesC8& aCmdName, |
|
176 const CLiwGenericParamList& aInParamList, |
|
177 CLiwGenericParamList& aOutParamList, |
|
178 TUint aCmdOptions = 0, |
|
179 MLiwNotifyCallback* aCallback = 0 ); |
|
180 /** |
|
181 * provides a concrete implementation |
|
182 * for this method.Deletes the interface handle. |
|
183 * The consumer application should call this method if there |
|
184 * are no more service commands to be executed on the interface. |
|
185 * |
|
186 */ |
|
187 virtual void Close(); |
|
188 |
|
189 private: |
|
190 |
|
191 /** |
|
192 * Sensor service implementation object. |
|
193 */ |
|
194 CSensorService* iSensorService; |
|
195 |
|
196 /** |
|
197 * Store Information about async calls |
|
198 */ |
|
199 RPointerArray<CStoreAsyncInfo> iAsyncInfo; |
|
200 |
|
201 /** |
|
202 * Holds the error string |
|
203 */ |
|
204 HBufC16* iErrorString; |
|
205 |
|
206 }; |
|
207 |
|
208 #endif // C_CSENSORINTERFACE_H |