NULL, //ConvertToType
};
+JSStaticValue JSMediaServer::m_property[] =
+{
+ {"id", getProperty, NULL, kJSPropertyAttributeReadOnly},
+ {"friendlyName", getProperty, NULL, kJSPropertyAttributeReadOnly},
+ {"root", getProperty, NULL, kJSPropertyAttributeReadOnly},
+ { 0, 0, 0, 0 }
+};
+
JSStaticFunction JSMediaServer::m_function[] = {
{"browse", JSMediaServer::browse, kJSPropertyAttributeNone},
{"find", JSMediaServer::find, kJSPropertyAttributeNone},
}
+JSValueRef JSMediaServer::getProperty(JSContextRef context,
+ JSObjectRef object,
+ JSStringRef propertyName,
+ JSValueRef* exception)
+{
+ LoggerD("Entered ");
+ // TODO try/catch block
+ MediaServerPrivObject* privateObject = static_cast<MediaServerPrivObject*>(JSObjectGetPrivate(object));
+ if (NULL == privateObject)
+ {
+ LoggerE("private object is null");
+ // TODO post exception
+ }
+
+ if (JSStringIsEqualToUTF8CString(propertyName, "id")) {
+ JSStringRef jsStr = JSStringCreateWithUTF8CString("/com/intel/..."); // FIXME use proxy value
+ return JSValueMakeString(context, jsStr);
+ }
+ if (JSStringIsEqualToUTF8CString(propertyName, "friendlyName")) {
+ JSStringRef jsStr = JSStringCreateWithUTF8CString("FIXME mediaserver"); // FIXME use proxy value
+ return JSValueMakeString(context, jsStr);
+ }
+ if (JSStringIsEqualToUTF8CString(propertyName, "root")) {
+ JSStringRef jsStr = JSStringCreateWithUTF8CString("FIXME mediaserver root "); // FIXME use proxy value
+ return JSValueMakeFromJSONString(context, jsStr);
+ }
+
+ return JSValueMakeUndefined(context);
+}
+
+
+
JSValueRef JSMediaServer::browse(JSContextRef context,
JSObjectRef object,
JSObjectRef thisObject,
static const JSClassRef getClassRef();
+ static JSObjectRef createJSObject(JSContextRef context);
private:
/**
* The callback invoked when an object is first created.
JSValueRef possibleInstance,
JSValueRef* exception);
+ /**
+ * Getters for properties
+ */
+ static JSValueRef getProperty(JSContextRef context,
+ JSObjectRef object,
+ JSStringRef propertyName,
+ JSValueRef* exception);
+
/**
* Browses for media item under a given MediaContainer.
*/
static JSStaticFunction m_function[];
+ /**
+ * This member variable contains the initialization values for the
+ * properties of this class. The values are given according to the
+ * data structure JSPropertySpec.
+ */
+ static JSStaticValue m_property[];
+
static JSClassRef m_jsClassRef;
};