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.
19 #ifndef _JS_TIZEN_ALARMRELATIVE
20 #define _JS_TIZEN_ALARMRELATIVE
22 #include <JavaScriptCore/JavaScript.h>
23 #include <CommonsJavaScript/PrivateObject.h>
24 #include <IApplicationManager.h>
25 #include "AlarmRelative.h"
30 #define TIZEN_ALARM_RELATIVE_INTERFACE "AlarmRelative"
32 #define TIZEN_ALARM_RELATIVE_ATTRIBUTE_ID "id"
33 #define TIZEN_ALARM_RELATIVE_ATTRIBUTE_DELAY "delay"
34 #define TIZEN_ALARM_RELATIVE_ATTRIBUTE_PERIOD "period"
36 typedef WrtDeviceApis::CommonsJavaScript::PrivateObject<AlarmRelativePtr, WrtDeviceApis::CommonsJavaScript::NoOwnership> JSAlarmRelativePriv;
38 class JSAlarmRelative {
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);
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);
52 static AlarmRelativePtr getPrivData(JSObjectRef object);
54 static JSValueRef getId(JSContextRef context,
56 JSStringRef propertyName,
57 JSValueRef* exception);
59 static JSValueRef getDelay(JSContextRef context,
61 JSStringRef propertyName,
62 JSValueRef* exception);
64 static JSValueRef getPeriod(JSContextRef context,
66 JSStringRef propertyName,
67 JSValueRef* exception);
69 static JSClassDefinition m_jsClassInfo;
70 static JSClassRef m_jsClassRef;
71 static JSStaticFunction m_function[];
72 static JSStaticValue m_property[];