Add DRAFT stubs for Vehicle plugin
[profile/ivi/wrt-plugins-tizen.git] / src / standards / Tizen / Contact / plugin_initializer.cpp
1 /*
2  * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
3  *
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
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
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.
15  */
16
17 /**
18  * @file        plugin_initializer.cpp
19  * @author      Karol Majewski (k.majewski@samsung.com)
20  * @version     0.1
21  * @brief
22  */
23
24 #include <dpl/log/log.h>
25
26 #include <Commons/plugin_initializer_def.h>
27 #include <Commons/WrtAccess/WrtAccess.h>
28 #include "JSContactManager.h"
29 #include "JSContact.h"
30 #include "JSContactRef.h"
31 #include "JSContactName.h"
32 #include "JSContactOrganization.h"
33 #include "JSContactWebSite.h"
34 #include "JSContactAnniversary.h"
35 #include "JSContactAccount.h"
36 #include "JSContactAddress.h"
37 #include "JSContactPhoneNumber.h"
38 #include "JSContactEmailAddress.h"
39 #include "ContactAsyncCallbackManager.h"
40 #include "ContactListenerManager.h"
41
42 using namespace WrtDeviceApis;
43 using namespace WrtDeviceApis::Commons;
44
45 void on_widget_start_callback(int widgetId)
46 {
47     LogDebug("[Tizen\\contact] on_widget_start_callback (" << widgetId << ")");
48     Try
49     {
50         WrtAccessSingleton::Instance().initialize(widgetId);
51     }
52     Catch(Commons::Exception)
53     {
54         LogError("WrtAccess initialization failed");
55     }
56 }
57
58 void on_widget_stop_callback(int widgetId)
59 {
60     LogDebug("[Tizen\\contact] on_widget_stop_callback (" << widgetId << ")");
61     Try
62     {
63         WrtAccessSingleton::Instance().deinitialize(widgetId);
64     }
65     Catch(Commons::Exception)
66     {
67         LogError("WrtAccess deinitialization failed");
68     }
69 }
70
71 void on_frame_load_callback(const void * context)
72 {
73     LogDebug("[Tizen\\contact] on_frame_load_callback (" << context << ")");
74 }
75
76 void on_frame_unload_callback(const void * context)
77 {
78     LogDebug("[Tizen\\contact] on_frame_unload_callback (" << context << ")");
79
80     TizenApis::Tizen1_0::Contact::ContactAsyncCallbackManagerSingleton::Instance().unregisterContext(static_cast<JSContextRef>(context));
81     TizenApis::Tizen1_0::Contact::ContactListenerManagerSingleton::Instance().unregisterContext(static_cast<JSContextRef>(context));
82 }
83
84 PLUGIN_ON_WIDGET_START(on_widget_start_callback)
85 PLUGIN_ON_WIDGET_STOP(on_widget_stop_callback)
86 PLUGIN_ON_FRAME_LOAD(on_frame_load_callback)
87 PLUGIN_ON_FRAME_UNLOAD(on_frame_unload_callback)
88
89 PLUGIN_CLASS_MAP_BEGIN
90     PLUGIN_CLASS_MAP_ADD_CLASS(WRT_JS_EXTENSION_OBJECT_TIZEN,
91                                "contact",
92                                (js_class_template_getter)TizenApis::Tizen1_0::Contact::JSContactManager::getClassRef,
93                                NULL)
94     PLUGIN_CLASS_MAP_ADD_CLASS(WRT_JS_EXTENSION_OBJECT_TIZEN,
95                                "Contact",
96                                (js_class_template_getter)TizenApis::Tizen1_0::Contact::JSContact::getClassRef,
97                                NULL)
98     PLUGIN_CLASS_MAP_ADD_CLASS(WRT_JS_EXTENSION_OBJECT_TIZEN,
99                                "ContactRef",
100                                (js_class_template_getter)TizenApis::Tizen1_0::Contact::JSContactRef::getClassRef,
101                                NULL)
102     PLUGIN_CLASS_MAP_ADD_CLASS(WRT_JS_EXTENSION_OBJECT_TIZEN,
103                                "ContactName",
104                                (js_class_template_getter)TizenApis::Tizen1_0::Contact::JSContactName::getClassRef,
105                                NULL)
106     PLUGIN_CLASS_MAP_ADD_CLASS(WRT_JS_EXTENSION_OBJECT_TIZEN,
107                                "ContactOrganization",
108                                (js_class_template_getter)TizenApis::Tizen1_0::Contact::JSContactOrganization::getClassRef,
109                                NULL)
110     PLUGIN_CLASS_MAP_ADD_CLASS(WRT_JS_EXTENSION_OBJECT_TIZEN,
111                                "ContactWebSite",
112                                (js_class_template_getter)TizenApis::Tizen1_0::Contact::JSContactWebSite::getClassRef,
113                                NULL)
114     PLUGIN_CLASS_MAP_ADD_CLASS(WRT_JS_EXTENSION_OBJECT_TIZEN,
115                                "ContactAnniversary",
116                                (js_class_template_getter)TizenApis::Tizen1_0::Contact::JSContactAnniversary::getClassRef,
117                                NULL)
118     PLUGIN_CLASS_MAP_ADD_CLASS(WRT_JS_EXTENSION_OBJECT_TIZEN,
119                                "ContactAccount",
120                                (js_class_template_getter)TizenApis::Tizen1_0::Contact::JSContactAccount::getClassRef,
121                                NULL)
122     PLUGIN_CLASS_MAP_ADD_CLASS(WRT_JS_EXTENSION_OBJECT_TIZEN,
123                                "ContactAddress",
124                                (js_class_template_getter)TizenApis::Tizen1_0::Contact::JSContactAddress::getClassRef,
125                                NULL)
126     PLUGIN_CLASS_MAP_ADD_CLASS(WRT_JS_EXTENSION_OBJECT_TIZEN,
127                                "ContactPhoneNumber",
128                                (js_class_template_getter)TizenApis::Tizen1_0::Contact::JSContactPhoneNumber::getClassRef,
129                                NULL)
130     PLUGIN_CLASS_MAP_ADD_CLASS(WRT_JS_EXTENSION_OBJECT_TIZEN,
131                                "ContactEmailAddress",
132                                (js_class_template_getter)TizenApis::Tizen1_0::Contact::JSContactEmailAddress::getClassRef,
133                                NULL)
134 PLUGIN_CLASS_MAP_END