7cba63e4ea8fe7b8ba47d2520743fb17b04d07fe
[profile/ivi/wrt-plugins-ivi.git] / src / MediaServer / JSMediaServer.h
1 #ifndef JSMEDIASERVER_H
2 #define JSMEDIASERVER_H
3
4 #include "MediaServer.h"
5 #include <dpl/shared_ptr.h>
6 #include <JavaScriptCore/JavaScript.h>
7 #include <CommonsJavaScript/JSPendingOperationPrivateObject.h>
8 #include <CommonsJavaScript/PrivateObject.h>
9
10 namespace DeviceAPI {
11 namespace MediaServer {
12
13 typedef WrtDeviceApis::CommonsJavaScript::PrivateObject<MediaServerPtr, WrtDeviceApis::CommonsJavaScript::NoOwnership> MediaServerPrivObject;
14
15 class JSMediaServer
16 {
17 public:
18         static const JSClassDefinition* getClassInfo();
19
20         static const JSClassRef getClassRef();
21
22 private:
23         /**
24                 * The callback invoked when an object is first created.
25                 */
26         static void initialize(JSContextRef context,
27                                                    JSObjectRef object);
28
29         /**
30                 * The callback invoked when an object is finalized.
31                 */
32         static void finalize(JSObjectRef object);
33
34         /**
35                 * The callback invoked when an object is used as the target of an 'instanceof' expression.
36                 */
37         static bool hasInstance(JSContextRef ctx,
38                                                         JSObjectRef constructor,
39                                                         JSValueRef possibleInstance,
40                                                         JSValueRef* exception);
41
42
43         /**
44                 * Browses for media item under a given MediaContainer.
45                 */
46         static JSValueRef browse(JSContextRef context,
47                                 JSObjectRef object,
48                                 JSObjectRef thisObject,
49                                 size_t argumentCount,
50                                 const JSValueRef arguments[],
51                                 JSValueRef* exception);
52
53
54         /**
55                 * Searches for media item under a given MediaContainer.
56                 */
57         static JSValueRef find(JSContextRef context,
58                                 JSObjectRef object,
59                                 JSObjectRef thisObject,
60                                 size_t argumentCount,
61                                 const JSValueRef arguments[],
62                                 JSValueRef* exception);
63
64
65         /**
66                  * This structure contains properties and callbacks that define a type of object.
67                  */
68         static JSClassDefinition m_classInfo;
69
70         /**
71                  * This structure describes a statically declared function.
72                  */
73         static JSStaticFunction m_function[];
74
75         static JSClassRef m_jsClassRef;
76 };
77
78 }
79 }
80
81 #endif // JSMEDIASERVER_H