2 * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
17 * @author Karol Majewski (k.majewski@samsung.com)
19 * @brief This is a file that you provides interface for wrt-engine while loading and using plugin
20 * If you are a plugin developer you need to plugin_initializer.cpp in your module and provide implementation for macros below
23 #ifndef WRTDEVICEAPIS_COMMONS_PLUGIN_INITIALIZER_DEF_H_
24 #define WRTDEVICEAPIS_COMMONS_PLUGIN_INITIALIZER_DEF_H_
26 #include <wrt_plugin_export.h>
28 typedef java_script_context_t JavaScriptContext;
30 #define EXPORT_SYMBOL __attribute__((__visibility__("default")))
32 //DEFINES FOR GLOBAL OBJECTS AVAILABLE IN JAVASCRIPT
34 * each object which declare this object as parent
35 * will ba available as global object in javascript
37 #define WRT_JS_EXTENSION_OBJECT_GLOBAL "GLOBAL_OBJECT"
42 #define WRT_JS_EXTENSION_OBJECT_BONDI "bondi"
45 * global object Widget
47 #define WRT_JS_EXTENSION_OBJECT_WIDGET "Widget"
50 * global object deviceapis
52 #define WRT_JS_EXTENSION_OBJECT_DEVICEAPIS "deviceapis"
57 #define WRT_JS_EXTENSION_OBJECT_TIZEN "tizen"
62 //HAVE TO BE IMPLEMENTED IN EVERY PLUGIN
64 * You have to(!) call this macro in your plugin_initializer.cpp(!) file providing callback that will be called while loading each widget (for every loaded widget this function will be called)
66 * plugin_initializer.cpp
67 * void on_widget_start_callback(int widgetId, JSContextRef context, const engine_interface_t *interface)
71 * PLUGIN_ON_WIDGET_START(on_widget_start_callback)
73 #define PLUGIN_ON_WIDGET_START(CALLBACK_NAME) extern "C" const on_widget_start_proc PLUGIN_WIDGET_START_PROC EXPORT_SYMBOL = CALLBACK_NAME;
76 * You have to(!) call this macro in your plugin_initializer.cpp(!) file providing callback that will be called while unloading each widget (for every unloaded widget this function will be called)
78 * void on_widget_stop_callback(int widgetId)
82 * PLUGIN_ON_WIDGET_STOP(on_widget_stop_callback)
84 #define PLUGIN_ON_WIDGET_STOP(CALLBACK_NAME) extern "C" const on_widget_stop_proc PLUGIN_WIDGET_STOP_PROC EXPORT_SYMBOL = CALLBACK_NAME;
87 * You have to(!) define an array of structures in your plugin_initializer.cpp(!) file describing a JS class (class_definition) and it's parent class name (parent_name).
88 * JS class will be bind to a parent class name (parent_name.jsclass_name).
90 * plugin_initializer.cpp
91 * PLUGIN_CLASS_MAP_BEGIN
92 * PLUGIN_CLASS_MAP_ADD_CLASS("bondi",WrtPluginBondi::JSICameraManager::getClassInfo())
93 * PLUGIN_CLASS_MAP_ADD_CLASS("bondi",WrtPluginBondi::JSICameraAnotherClass::getClassInfo())
94 * PLUGIN_CLASS_MAP_END
97 #define PLUGIN_CLASS_MAP_BEGIN extern "C" const class_definition_t PLUGIN_CLASS_MAP[] EXPORT_SYMBOL = {
98 #define PLUGIN_CLASS_MAP_ADD_CLASS(PARENTNAME,CLASSNAME,JSCLASSTEMPLATE,PRIVDATA) {PARENTNAME,CLASSNAME,JSCLASSTEMPLATE,PRIVDATA},
99 #define PLUGIN_CLASS_MAP_END {NULL,NULL,NULL,NULL} };
101 #define PLUGIN_CLASS_MAP_BEGIN_STATIC static const class_definition_t PLUGIN_CLASS_MAP[] = {
102 #define PLUGIN_GET_CLASS_MAP(CALLBACK_NAME) extern "C" const get_widget_class_map_proc PLUGIN_GET_CLASS_PROC_MAP EXPORT_SYMBOL = CALLBACK_NAME;
104 #endif // WRTDEVICEAPIS_COMMONS_PLUGIN_INITIALIZER_DEF_H_