2 // Tizen Web Device API
3 // Copyright (c) 2012 Samsung Electronics Co., Ltd.
5 // Licensed under the Apache License, Version 2.0 (the License);
6 // you may not use this file except in compliance with the License.
7 // You may obtain a copy of the License at
9 // http://www.apache.org/licenses/LICENSE-2.0
11 // Unless required by applicable law or agreed to in writing, software
12 // distributed under the License is distributed on an AS IS BASIS,
13 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 // See the License for the specific language governing permissions and
15 // limitations under the License.
18 #include <Commons/plugin_initializer_def.h>
19 #include <Commons/WrtAccess/WrtAccess.h>
20 #include <Commons/Exception.h>
21 #include <TimeTracer.h>
22 #include "JSAlarmManager.h"
23 #include "JSAlarmAbsolute.h"
24 #include "JSAlarmRelative.h"
27 #define WRT_JS_EXTENSION_OBJECT_TIZEN "tizen"
32 using namespace WrtDeviceApis;
33 using namespace WrtDeviceApis::Commons;
34 using namespace WrtDeviceApis::CommonsJavaScript;
36 class_definition_options_t ConstructorClassOptions =
41 USE_OVERLAYED, //ignored
47 void on_widget_start_callback(int widgetId)
49 LoggerD("[Tizen\\AlarmManager ] on_widget_start_callback (" << widgetId << ")");
53 WrtAccessSingleton::Instance().initialize(widgetId);
55 Catch(Commons::Exception)
57 LoggerE("WrtAccess initialization failed");
61 void on_widget_stop_callback(int widgetId)
63 LoggerD("[Tizen\\AlarmManager ] on_widget_stop_callback (" << widgetId << ")");
66 TIME_TRACER_EXPORT_REPORT_TO(TIME_TRACER_EXPORT_FILE,"Alarm");
67 TIME_TRACER_RELEASE();
68 WrtAccessSingleton::Instance().deinitialize(widgetId);
70 Catch(Commons::Exception)
72 LoggerE("WrtAccess deinitialization failed");
76 PLUGIN_ON_WIDGET_START(on_widget_start_callback)
77 PLUGIN_ON_WIDGET_STOP(on_widget_stop_callback)
79 PLUGIN_CLASS_MAP_BEGIN
80 PLUGIN_CLASS_MAP_ADD_CLASS(
81 WRT_JS_EXTENSION_OBJECT_TIZEN,
83 (js_class_template_getter)DeviceAPI::Alarm::JSAlarmManager::getClassRef,
85 PLUGIN_CLASS_MAP_ADD_INTERFACE(
86 WRT_JS_EXTENSION_OBJECT_TIZEN,
87 TIZEN_ALARM_ABSOLUTE_INTERFACE,
88 (js_class_template_getter)DeviceAPI::Alarm::JSAlarmAbsolute::getClassRef,
89 reinterpret_cast<js_class_constructor_cb_t>(DeviceAPI::Alarm::JSAlarmAbsolute::constructor),
90 &ConstructorClassOptions)
91 PLUGIN_CLASS_MAP_ADD_INTERFACE(
92 WRT_JS_EXTENSION_OBJECT_TIZEN,
93 TIZEN_ALARM_RELATIVE_INTERFACE,
94 (js_class_template_getter)DeviceAPI::Alarm::JSAlarmRelative::getClassRef,
95 reinterpret_cast<js_class_constructor_cb_t>(DeviceAPI::Alarm::JSAlarmRelative::constructor),
96 &ConstructorClassOptions)