summaryrefslogtreecommitdiff
path: root/wearable_src/Alarm/AlarmRelative.cpp
blob: f58366d647e324233a1c6dba40c0608a2b079d4e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
//
// 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.
//


#include "AlarmRelative.h"
#include "alarm_common.h"
#include <JSTimeDuration.h>
#include <app.h>

namespace DeviceAPI {
namespace Alarm {

AlarmRelative::AlarmRelative()
{
    m_isRecurrence = false;
    service_create(&m_service_handle);
    service_add_extra_data(m_service_handle, ALARM_TYPE_KEY, ALARM_TYPE_RELATIVE_VALUE);
    m_Period = -1;
    m_id = -1;
	is_registered = false;
}

AlarmRelative::AlarmRelative(service_h handle)
{
    service_clone(&m_service_handle, handle);
    m_Period = -1;
    m_id = -1;
	is_registered = false;
}

AlarmRelative::~AlarmRelative()
{
    service_destroy(m_service_handle);
}

int AlarmRelative::getId() const
{
    return m_id;
}

void AlarmRelative::setId(const int id)
{
    m_id = id;
	is_registered = true;
}

bool AlarmRelative::isRecurrence()
{
    return m_isRecurrence;
}

void AlarmRelative::setIsRecurrence(bool value)
{
    m_isRecurrence = value;
}

void AlarmRelative::setDelay(int delay)
{
    char result[12];
    snprintf(result, sizeof(result), "%d", delay);
    service_add_extra_data(m_service_handle, ALARM_RELATIVE_DELAY_KEY, result);
    m_delay = delay;
}

int AlarmRelative::getDelay()
{
    return m_delay;
}

void AlarmRelative::setPeriod(int value)
{
    m_Period = value;
}

int AlarmRelative::getPeriod()
{
    return m_Period;
}

service_h AlarmRelative::getService() 
{
    return m_service_handle;
}

}
}