MediaServer object properties
[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     static JSObjectRef createJSObject(JSContextRef context);
23 private:
24         /**
25                 * The callback invoked when an object is first created.
26                 */
27         static void initialize(JSContextRef context,
28                                                    JSObjectRef object);
29
30         /**
31                 * The callback invoked when an object is finalized.
32                 */
33         static void finalize(JSObjectRef object);
34
35         /**
36                 * The callback invoked when an object is used as the target of an 'instanceof' expression.
37                 */
38         static bool hasInstance(JSContextRef ctx,
39                                                         JSObjectRef constructor,
40                                                         JSValueRef possibleInstance,
41                                                         JSValueRef* exception);
42
43     /**
44      * Getters  for properties
45      */
46     static JSValueRef getProperty(JSContextRef context,
47                 JSObjectRef object,
48                 JSStringRef propertyName,
49                 JSValueRef* exception);
50
51
52         /**
53                 * Browses for media item under a given MediaContainer.
54                 */
55         static JSValueRef browse(JSContextRef context,
56                                 JSObjectRef object,
57                                 JSObjectRef thisObject,
58                                 size_t argumentCount,
59                                 const JSValueRef arguments[],
60                                 JSValueRef* exception);
61
62
63         /**
64                 * Searches for media item under a given MediaContainer.
65                 */
66         static JSValueRef find(JSContextRef context,
67                                 JSObjectRef object,
68                                 JSObjectRef thisObject,
69                                 size_t argumentCount,
70                                 const JSValueRef arguments[],
71                                 JSValueRef* exception);
72
73
74         /**
75                  * This structure contains properties and callbacks that define a type of object.
76                  */
77         static JSClassDefinition m_classInfo;
78
79         /**
80                  * This structure describes a statically declared function.
81                  */
82         static JSStaticFunction m_function[];
83
84     /**
85      * This member variable contains the initialization values for the
86      * properties of this class. The values are given according to the
87      * data structure JSPropertySpec.
88      */
89     static JSStaticValue m_property[];
90
91         static JSClassRef m_jsClassRef;
92 };
93
94 }
95 }
96
97 #endif // JSMEDIASERVER_H