|
1 /* |
|
2 * Copyright (c) 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: Device Liw Binding |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef __DEVICELIWBINDING_H |
|
20 #define __DEVICELIWBINDING_H |
|
21 |
|
22 #include <e32std.h> |
|
23 #include <LiwCommon.h> |
|
24 #include "DeviceLiwMap.h" |
|
25 #include "DeviceBinding.h" |
|
26 #include "DeviceLiwIterable.h" |
|
27 |
|
28 class CLiwServiceHandler; |
|
29 class CRTSecMgrScriptSession; |
|
30 class CRTSecManager; |
|
31 namespace KJS |
|
32 { |
|
33 class List; |
|
34 class UString; |
|
35 |
|
36 class CDeviceLiwBinding : public CBase, public MDeviceBinding |
|
37 { |
|
38 friend class DeviceLiwMap; |
|
39 friend class DeviceLiwIterableFunc; |
|
40 friend class DeviceLiwIterable; |
|
41 |
|
42 public: // constructor and destructor |
|
43 |
|
44 static CDeviceLiwBinding* NewL(); |
|
45 |
|
46 /** |
|
47 * Destructor |
|
48 * @return none |
|
49 * @since 5.0 |
|
50 **/ |
|
51 virtual ~CDeviceLiwBinding(); |
|
52 |
|
53 public: // from MDeviceBinding |
|
54 |
|
55 /** |
|
56 * Load the service provider |
|
57 * @return TInt error code |
|
58 * @since 5.0 |
|
59 **/ |
|
60 TInt LoadServiceProvider( ExecState* exec, const List& args ); |
|
61 |
|
62 /** |
|
63 * Factory method to create the device peer object |
|
64 * @return MDevicePeer* |
|
65 * @since 5.0 |
|
66 **/ |
|
67 MDevicePeer* ServiceObjectPeer( ExecState* exec, |
|
68 const List& args ); |
|
69 |
|
70 /** |
|
71 * Invoke SAPI call |
|
72 * @return JSValue - output params of the SAPI call |
|
73 * @since 5.0 |
|
74 **/ |
|
75 JSValue* InvokeOp( ExecState* exec, const Identifier& propertyName, |
|
76 const List& args, MDevicePeer* peer ); |
|
77 |
|
78 /** |
|
79 * Query and List providers |
|
80 * @return JSValue* - output params of the LIW call to list providers |
|
81 * @since 5.0 |
|
82 **/ |
|
83 JSValue* ListProviders( ExecState* exec, const List& args ); |
|
84 |
|
85 public: |
|
86 |
|
87 /** |
|
88 * Create SAPI interface |
|
89 * @return JSValue - DeviceLiwInterface object |
|
90 * @since 5.0 |
|
91 **/ |
|
92 JSValue* CreateInterface( ExecState* exec, |
|
93 HBufC8 * serviceName, |
|
94 const Identifier& interfaceName ); |
|
95 |
|
96 /** |
|
97 * Convert LiwGenericParamList to javascript list |
|
98 * @return JSValue - javascript list |
|
99 * @since 5.0 |
|
100 **/ |
|
101 JSValue* LiwGenericParamList2JsArray( ExecState* exec, |
|
102 CLiwGenericParamList* liwList ); |
|
103 |
|
104 /** |
|
105 * Convert Unload service provider |
|
106 * @return JSValue - javascript list |
|
107 * @since 5.0 |
|
108 **/ |
|
109 void UnloadServiceProvider(const TDesC8& aServiceName,const TDesC8& aInterfaceName); |
|
110 |
|
111 /** |
|
112 * SetUid |
|
113 * @return none |
|
114 * @since 5.0 |
|
115 **/ |
|
116 void SetUid( const TUint& aValue); |
|
117 |
|
118 private: |
|
119 |
|
120 void ConstructL(); |
|
121 |
|
122 private: |
|
123 |
|
124 /** |
|
125 * Invoke SAPI call |
|
126 * @return JSValue* - output params of the SAPI call |
|
127 * @since 5.0 |
|
128 **/ |
|
129 JSValue* InvokeOpInternal( ExecState* exec, const Identifier& prop, |
|
130 const List& args, MDevicePeer* peer ); |
|
131 |
|
132 /** |
|
133 * Convert LiwVariant to javascript JSValue |
|
134 * @return JSValue - javascript JSValue |
|
135 * @since 5.0 |
|
136 **/ |
|
137 JSValue* LiwVariant2JsVal( ExecState* exec, |
|
138 const TLiwVariant& variant ); |
|
139 |
|
140 /** |
|
141 * Check if the input is a javascript list |
|
142 * @return TBool |
|
143 * @since 5.0 |
|
144 **/ |
|
145 TBool IsAList( ExecState* exec, JSValue* value ); |
|
146 |
|
147 /** |
|
148 * Convert javascript list to LiwGenericParamList |
|
149 * @return none |
|
150 * @since 5.0 |
|
151 **/ |
|
152 void JsList2LiwGenericParamListL( ExecState* exec, |
|
153 JSValue* value, |
|
154 CLiwGenericParamList& liwList ); |
|
155 |
|
156 /** |
|
157 * Convert javscript JSValue to LiwVariant |
|
158 * @return TBool |
|
159 * @since 5.0 |
|
160 **/ |
|
161 TBool JsVal2LiwVariant( ExecState* exec, JSValue* value, |
|
162 TLiwVariant& variant ); |
|
163 |
|
164 private: |
|
165 |
|
166 CLiwServiceHandler* m_serviceHandler; // Owned |
|
167 RCriteriaArray* m_critArr; // Owned |
|
168 /// Main session to secManager |
|
169 CRTSecManager* m_secMgr; // Owned |
|
170 CRTSecMgrScriptSession* m_scriptSession; // Owned |
|
171 TUid m_Uid; |
|
172 }; |
|
173 |
|
174 /** |
|
175 * Convert 16 bit to 8 bit |
|
176 * @return HBufC8* |
|
177 * @since 5.0 |
|
178 **/ |
|
179 HBufC8* GetAsciiBufferL( const UString& buf ); |
|
180 |
|
181 } |
|
182 |
|
183 #endif //__DEVICELIWBINDING_H |
|
184 |
|
185 |
|
186 |
|
187 |
|
188 |
|
189 |
|
190 |
|
191 |
|
192 |
|
193 |
|
194 |
|
195 |
|
196 |
|
197 |