diff options
Diffstat (limited to 'wearable_src/Alarm/AlarmConverter.h')
-rwxr-xr-x | wearable_src/Alarm/AlarmConverter.h | 65 |
1 files changed, 65 insertions, 0 deletions
diff --git a/wearable_src/Alarm/AlarmConverter.h b/wearable_src/Alarm/AlarmConverter.h new file mode 100755 index 0000000..cf9ada5 --- /dev/null +++ b/wearable_src/Alarm/AlarmConverter.h @@ -0,0 +1,65 @@ +// +// Tizen Web Device API +// Copyright (c) 2012 Samsung Electronics Co., Ltd. +// +// Licensed under the Apache License, Version 2.0 (the License); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an AS IS BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// + + +#ifndef _JS_TIZEN_ALARM_CONVERTER_H_ +#define _JS_TIZEN_ALARM_CONVERTER_H_ + +#include <vector> +#include <string> +#include <app.h> +#include <CommonsJavaScript/Converter.h> +#include <CommonsJavaScript/ScopedJSStringRef.h> +#include <JSApplicationControl.h> +#include <ApplicationControl.h> +#include <ApplicationConverter.h> +#include "JSAlarmAbsolute.h" +#include "AlarmAbsolute.h" +#include "JSAlarmRelative.h" +#include "AlarmRelative.h" + +namespace DeviceAPI { +namespace Alarm { + +using namespace WrtDeviceApis::Commons; +using namespace WrtDeviceApis::CommonsJavaScript; + +class AlarmConverter : public WrtDeviceApis::CommonsJavaScript::Converter +{ +public: + using Converter::toJSValueRef; + explicit AlarmConverter(JSContextRef context); + virtual ~AlarmConverter(); + + int toNativeAlarmValue(std::vector<std::string> daysOfTheWeek); + std::vector<std::string> convertFlagToDaysOfTheWeek(int byDayValue); + int toNativeValue(int interval); + std::vector<std::string> toPrivateValue(int byDayValue); + service_h toService(std::string id); + service_h toService(std::string id, std::string page); + bool toAlarmAbsolutePtr(int id, service_h handle, AlarmAbsolutePtr ptr); + bool toAlarmRelativePtr(int id, service_h handle, AlarmRelativePtr ptr); + int toNativeInterval(std::string freq, std::string interval); + bool toAlarmService(service_h alarm_service, DeviceAPI::Application::ApplicationControlPtr ptr); +}; + +typedef ConverterFactory<AlarmConverter> AlarmConverterFactory; + +} +} + +#endif /* _JS_TIZEN_ALARM_CONVERTER_H_ */ |