|
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: Declaration of Service Interface Object |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef _KJS_LIWIINTERFACE_H_ |
|
20 #define _KJS_LIWIINTERFACE_H_ |
|
21 |
|
22 #include <object.h> |
|
23 |
|
24 namespace KJS |
|
25 { |
|
26 class MDeviceBinding; |
|
27 class MDevicePeer; |
|
28 class ServiceEventHandler; |
|
29 class DeviceLiwInterfacePrivate; |
|
30 class DeviceLiwResult; |
|
31 |
|
32 class DeviceLiwInterface : public JSObject |
|
33 { |
|
34 friend class DeviceLiwInterfaceFunc; |
|
35 public: // constructor and destructor |
|
36 |
|
37 /** |
|
38 * Constructor |
|
39 * @return none |
|
40 * @since 5.0 |
|
41 **/ |
|
42 DeviceLiwInterface( ExecState* exec, MDeviceBinding* deviceBinding, |
|
43 MDevicePeer* devicePeer ); |
|
44 |
|
45 /** |
|
46 * Destructor |
|
47 * @return none |
|
48 * @since 5.0 |
|
49 **/ |
|
50 virtual ~DeviceLiwInterface(); |
|
51 |
|
52 public: |
|
53 |
|
54 /** |
|
55 * getValueProperty |
|
56 * @return JSValue* |
|
57 * @since 5.0 |
|
58 **/ |
|
59 virtual JSValue* getValueProperty(KJS::ExecState*, int token) const { return jsUndefined(); }; |
|
60 /** |
|
61 * getOwnPropertySlot |
|
62 * @return bool |
|
63 * @since 5.0 |
|
64 **/ |
|
65 bool getOwnPropertySlot(ExecState* exec, const Identifier& propertyName, PropertySlot& slot); |
|
66 |
|
67 /** |
|
68 * Set callback |
|
69 * @return none |
|
70 * @since 5.0 |
|
71 **/ |
|
72 void SetObserver( ServiceEventHandler* aObserver ); |
|
73 |
|
74 /** |
|
75 * Invoke SAPI function |
|
76 * @return Value |
|
77 * @since 5.0 |
|
78 **/ |
|
79 JSValue* InvokeOp( ExecState* exec, |
|
80 const Identifier& propertyName, const List& aArgs ); |
|
81 |
|
82 /** |
|
83 * Close |
|
84 **/ |
|
85 void Close(ExecState* exec); |
|
86 |
|
87 /** |
|
88 * isValid |
|
89 */ |
|
90 bool isValid() const { return m_valid; } |
|
91 |
|
92 |
|
93 /** |
|
94 * IsRunningCallBack |
|
95 */ |
|
96 TBool IsRunningCallBack() const; |
|
97 |
|
98 /** |
|
99 * Get class info |
|
100 * @return const ClassInfo* |
|
101 * @since 5.0 |
|
102 **/ |
|
103 virtual const ClassInfo* classInfo() const { return &info; } |
|
104 |
|
105 static const ClassInfo info; |
|
106 |
|
107 private: |
|
108 DeviceLiwInterfacePrivate* m_privateData; // private object to hold data |
|
109 bool m_valid; // object is valid or not |
|
110 |
|
111 }; |
|
112 |
|
113 class DeviceLiwInterfacePrivate |
|
114 { |
|
115 friend class DeviceLiwInterface; |
|
116 friend class DeviceLiwInterfaceFunc; |
|
117 public: |
|
118 DeviceLiwInterfacePrivate(MDeviceBinding* deviceBinding, MDevicePeer* devicePeer); |
|
119 ~DeviceLiwInterfacePrivate() { Close(); } |
|
120 void Close(); |
|
121 MDeviceBinding* m_deviceBinding; // not owned |
|
122 MDevicePeer* m_devicePeer; // owned |
|
123 Identifier m_interfaceName; |
|
124 RPointerArray<DeviceLiwResult>* m_resultObjArray;// owned |
|
125 ExecState* m_exec; // not owned |
|
126 }; |
|
127 |
|
128 |
|
129 class DeviceLiwInterfaceFunc : public JSObject |
|
130 { |
|
131 public: // constructor and destructor |
|
132 |
|
133 /** |
|
134 * Constructor |
|
135 * @return none |
|
136 * @since 5.0 |
|
137 **/ |
|
138 DeviceLiwInterfaceFunc( ExecState* exec, |
|
139 const Identifier &propertyName ); |
|
140 |
|
141 /** |
|
142 * Destructor |
|
143 * @return none |
|
144 * @since 5.0 |
|
145 **/ |
|
146 virtual ~DeviceLiwInterfaceFunc(); |
|
147 |
|
148 public: // From JSObject |
|
149 |
|
150 /** |
|
151 * Whether implements the call |
|
152 * @return bool |
|
153 * @since 5.0 |
|
154 **/ |
|
155 bool implementsCall() const; |
|
156 |
|
157 /** |
|
158 * Call the function |
|
159 * @return Value |
|
160 * @since 5.0 |
|
161 **/ |
|
162 JSValue* callAsFunction(ExecState *exec, JSObject *aThisObj, const List &aArgs); |
|
163 |
|
164 private: |
|
165 Identifier m_funcName; |
|
166 }; |
|
167 |
|
168 } // namespace |
|
169 |
|
170 #endif //_KJS_DEVICELIWIINTERFACE_H_ |
|
171 |