2 * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
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
8 * http://www.apache.org/licenses/LICENSE-2.0
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.
17 #ifndef _JS_TIZEN_ALARMRECURRENCE
18 #define _JS_TIZEN_ALARMRECURRENCE
20 #include <JavaScriptCore/JavaScript.h>
21 #include "AlarmRecurrence.h"
27 using namespace TizenApis::Api::Alarm;
29 typedef WrtDeviceApis::CommonsJavaScript::PrivateObject<AlarmRecurrencePtr, WrtDeviceApis::CommonsJavaScript::NoOwnership> JSAlarmRecurrencePriv;
32 #define TIZEN_ALARM_PROPERTY_MINUTELY_RECURRENCE "MINUTELY"
33 #define TIZEN_ALARM_PROPERTY_HOURLY_RECURRENCE "HOURLY"
34 #define TIZEN_ALARM_PROPERTY_DAILY_RECURRENCE "DAILY"
35 #define TIZEN_ALARM_PROPERTY_WEEKLY_RECURRENCE "WEEKLY"
37 class JSAlarmRecurrence {
39 static const JSClassDefinition* getClassInfo();
40 static const JSClassRef getClassRef();
41 static JSObjectRef createJSObject(JSContextRef context, std::vector<std::string> daysOfTheWeek);
42 static JSObjectRef createJSObject(JSContextRef context, AlarmRecurrence::alarm_frequency_e frequency, int interval);
46 static void initialize(JSContextRef context, JSObjectRef object);
47 static void finalize(JSObjectRef object);
48 static bool hasInstance(JSContextRef context, JSObjectRef constructor, JSValueRef possibleInstance, JSValueRef* exception);
49 static JSObjectRef constructor(JSContextRef ctx, JSObjectRef constructor, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception);
52 static AlarmRecurrencePtr getPrivData(JSObjectRef object);
53 static JSValueRef getFrequency(JSContextRef context,
55 JSStringRef propertyName,
56 JSValueRef* exception);
58 static bool setFrequency(JSContextRef context,
60 JSStringRef propertyName,
62 JSValueRef* exception);
64 static JSValueRef getInterval(JSContextRef context,
66 JSStringRef propertyName,
67 JSValueRef* exception);
69 static bool setInterval(JSContextRef context,
71 JSStringRef propertyName,
73 JSValueRef* exception);
75 static JSValueRef getDaysOfTheWeek(JSContextRef context,
77 JSStringRef propertyName,
78 JSValueRef* exception);
80 static bool setDaysOfTheWeek(JSContextRef context,
82 JSStringRef propertyName,
84 JSValueRef* exception);
86 static JSClassDefinition m_jsClassInfo;
87 static JSClassRef m_jsClassRef;
88 static JSStaticValue m_property[];