Update change log and spec for wrt-plugins-tizen_0.4.51
[framework/web/wrt-plugins-tizen.git] / src / Alarm / JSAlarmRelative.h
1 //
2 // Tizen Web Device API
3 // Copyright (c) 2012 Samsung Electronics Co., Ltd.
4 //
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
8 //
9 // http://www.apache.org/licenses/LICENSE-2.0
10 //
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.
16 //
17
18
19 #ifndef _JS_TIZEN_ALARMRELATIVE
20 #define _JS_TIZEN_ALARMRELATIVE
21
22 #include <JavaScriptCore/JavaScript.h>
23 #include <CommonsJavaScript/PrivateObject.h>
24 #include <IApplicationManager.h>
25 #include "AlarmRelative.h"
26
27 namespace DeviceAPI {
28 namespace Alarm {
29
30 #define TIZEN_ALARM_RELATIVE_INTERFACE "AlarmRelative"
31
32 #define TIZEN_ALARM_RELATIVE_ATTRIBUTE_ID "id"
33 #define TIZEN_ALARM_RELATIVE_ATTRIBUTE_DELAY "delay"
34 #define TIZEN_ALARM_RELATIVE_ATTRIBUTE_PERIOD "period"
35
36 typedef WrtDeviceApis::CommonsJavaScript::PrivateObject<AlarmRelativePtr, WrtDeviceApis::CommonsJavaScript::NoOwnership> JSAlarmRelativePriv;
37
38 class JSAlarmRelative {
39 public:
40     static const JSClassDefinition* getClassInfo();
41     static const JSClassRef getClassRef();
42     static JSValueRef createJSObject(JSContextRef context, AlarmRelativePtr privateData);
43     static JSValueRef createJSObject(JSContextRef context, int delay, int interval);
44     static JSObjectRef constructor(JSContextRef ctx, JSObjectRef constructor, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception);
45
46 protected:
47     static void initialize(JSContextRef context, JSObjectRef object);
48     static void finalize(JSObjectRef object);
49     static JSValueRef getRemainingSeconds(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef * exception);
50
51 private:
52     static AlarmRelativePtr getPrivData(JSObjectRef object);
53    
54     static JSValueRef getId(JSContextRef context,
55                                         JSObjectRef object,
56                                         JSStringRef propertyName,
57                                         JSValueRef* exception);
58
59     static JSValueRef getDelay(JSContextRef context,
60                                                 JSObjectRef object,
61                                                 JSStringRef propertyName,
62                                                 JSValueRef* exception);
63
64     static JSValueRef getPeriod(JSContextRef context,
65                                                 JSObjectRef object,
66                                                 JSStringRef propertyName,
67                                                 JSValueRef* exception);
68
69     static JSClassDefinition m_jsClassInfo;
70     static JSClassRef m_jsClassRef;
71     static JSStaticFunction m_function[];
72     static JSStaticValue m_property[];
73 };
74
75 }// Alarm
76 } // TizenApis
77
78 #endif