Add DRAFT stubs for Vehicle plugin
[profile/ivi/wrt-plugins-tizen.git] / src / standards / Tizen / Vehicle / PluginInitializer.cpp
1 #include <Commons/plugin_initializer_def.h>
2 #include <Commons/WrtAccess/WrtAccess.h>
3 #include <Commons/Exception.h>
4 #include <dpl/log/log.h>
5 #include "VehicleAsyncCallbackManager.h" 
6 #include "VehicleListenerManager.h" 
7 #include "JSVehicle.h" 
8
9 using namespace WrtDeviceApis;
10 using namespace WrtDeviceApis::Commons;
11
12 namespace TizenApis {
13 namespace Vehicle {
14
15 void on_widget_start_callback(int widgetId)
16 {
17     LogDebug("[Tizen/Vehicle] on_widget_start_callback (" << widgetId << ")");
18     Try {
19         WrtAccessSingleton::Instance().initialize(widgetId);
20     } Catch (Exception) {
21         LogError("WrtAccess initialization failed");
22     }
23 }
24
25 void on_widget_stop_callback(int widgetId)
26 {
27     LogDebug("[Tizen/Vehicle] on_widget_stop_callback (" << widgetId << ")");
28     Try {
29         WrtAccessSingleton::Instance().deinitialize(widgetId);
30     } Catch (Exception) {
31         LogError("WrtAccess deinitialization failed");
32     }
33 }
34
35 void on_frame_load_callback(const void * context)
36 {
37 }
38
39 void on_frame_unload_callback(const void * context)
40 {
41     VehicleAsyncCallbackManagerSingleton::Instance().unregisterContext(static_cast<JSContextRef>(context));
42     VehicleListenerManagerSingleton::Instance().unregisterContext(static_cast<JSContextRef>(context));
43 }
44
45 PLUGIN_ON_WIDGET_START(on_widget_start_callback)
46 PLUGIN_ON_WIDGET_STOP(on_widget_stop_callback)
47
48 PLUGIN_ON_FRAME_LOAD(on_frame_load_callback)
49 PLUGIN_ON_FRAME_UNLOAD(on_frame_unload_callback)
50
51 PLUGIN_CLASS_MAP_BEGIN
52
53     PLUGIN_CLASS_MAP_ADD_CLASS(
54         WRT_JS_EXTENSION_OBJECT_TIZEN,
55         "vehicle",
56         (js_class_template_getter)JSVehicle::getClassRef,
57         NULL)
58
59 PLUGIN_CLASS_MAP_END
60
61 } //namespace Vehicle
62 } //namespace TizenApis
63