40272928d6bbd16c4d0f1783e55371134dd45d30
[platform/framework/native/appfw.git] / inc / FSysAlarm.h
1 //
2 // Copyright (c) 2012 Samsung Electronics Co., Ltd.
3 //
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
7 //
8 //     http://www.apache.org/licenses/LICENSE-2.0
9 //
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.
15 //
16
17 /**
18  * @file        FSysAlarm.h
19  * @brief       This is the header file for the %Alarm class.
20  *
21  * This header file contains the declarations of the %Alarm class.
22  */
23
24 #ifndef _FSYS_ALARM_H_
25 #define _FSYS_ALARM_H_
26
27 #include <FBaseDateTime.h>
28 #include <FSysIAlarmEventListener.h>
29
30 namespace Tizen { namespace System
31 {
32
33 /**
34  * @class       Alarm
35  * @brief       This class provides methods for creating, deleting, and updating an alarm.
36  *
37  * @since 2.0
38  *
39  * @final       This class is not intended for extension.
40  *
41  * The %Alarm class provides methods to create a one-time or repeating alarm.
42  *
43  * For more information on the class features, see <a href="../org.tizen.native.appprogramming/html/guide/system/system_namespace.htm">System Guide</a>.
44  */
45
46 class _OSP_EXPORT_ Alarm
47         : public Tizen::Base::Object
48 {
49 public:
50         /**
51          * This is the default constructor for this class.
52          *
53          * @since 2.0
54          *
55          * @remarks The object is not fully constructed after this constructor is called. For full construction, the Construct() method must be called right after calling this constructor. 
56          */
57         Alarm(void);
58
59         /**
60          * This is the destructor for this class. @n
61          * It unregisters the current instance of %Alarm from the system.
62          * This destructor overrides Tizen::Base::Object::~Object().
63          *
64          * @since 2.0
65          */
66         ~Alarm(void);
67
68         /**
69          * Initializes an instance of %Alarm with the specified @c listener.
70          *
71          * @since       2.0
72          *
73          * @return      An error code
74          * @param[in]   listener                A reference to IAlarmEventListener
75          * @exception   E_SUCCESS               The method is successful.
76          * @exception   E_SYSTEM                A system error has occurred.
77          */
78         result Construct(IAlarmEventListener& listener);
79
80         /**
81          * Sets a one-time alarm.
82          *
83          * @since       2.0
84          *
85          * @privilege   %http://tizen.org/privilege/alarm
86          *
87          * @return      An error code
88          * @param[in]   duetime                 The time for the alarm to ring. @n Any value with a unit that is less than a second is ignored.
89          * @exception   E_SUCCESS               The method is successful.
90          * @exception   E_PRIVILEGE_DENIED      The application does not have the privilege to call this method.
91          * @exception   E_INVALID_ARG           The specified @c duetime is invalid.
92          * @exception   E_SYSTEM                A system error has occurred.
93          * @remarks     If this %Alarm instance is already registered by this method, existing alarm is cancelled automatically.
94          */
95         result Set(const Tizen::Base::DateTime& duetime);
96
97         /**
98          * Sets a repeating alarm.
99          *
100          * @since       2.0
101          *
102          * @privilege   %http://tizen.org/privilege/alarm
103          *
104          * @return      An error code
105          * @param[in]   start                   The time for the alarm to ring first. @n Any value with a unit that is less than a second is ignored.
106          * @param[in]   period                  The interval in minutes between consecutive alarm rings.
107          * @param[in]   pEnd                    The time for the alarm ring to end. @n Any value with a unit that is less than a second is ignored.
108          * @exception   E_SUCCESS               The method is successful.
109          * @exception   E_PRIVILEGE_DENIED      The application does not have the privilege to call this method.
110          * @exception   E_INVALID_ARG           A specified input parameter is invalid.
111          * @exception   E_SYSTEM                A system error has occurred.
112          * @remarks     If this %Alarm instance is already registered by this method, existing alarm is cancelled automatically. @n If @c pEnd is @c null, the alarm repeats forever.
113          */
114         result Set(const Tizen::Base::DateTime& start, int period, const Tizen::Base::DateTime* pEnd = null);
115
116         /**
117          * Cancels the alarm.
118          *
119          * @since       2.0
120          *
121          * @privilege   %http://tizen.org/privilege/alarm
122          *
123          * @return      An error code
124          * @exception   E_SUCCESS               The method is successful.
125          * @exception   E_PRIVILEGE_DENIED      The application does not have the privilege to call this method.
126          * @exception   E_SYSTEM                A system error has occurred.
127          */
128         result Cancel(void);
129
130         /**
131          * Gets the start time for the current instance of %Alarm.
132          *
133          * @since       2.0
134          *
135          * @return      An instance of Tizen::Base::DateTime indicating the start time for the alarm
136          * @remarks     If this %Alarm instance is not registered by the Set() method, return value is default value of the Tizen::Base::DateTime class.
137          */
138         const Tizen::Base::DateTime GetStartTime(void) const;
139
140         /**
141          * Gets the period of the current instance of %Alarm in minutes.
142          *
143          * @since       2.0
144          *
145          * @return      The period of the current instance of %Alarm in minutes
146          * @remarks     If this %Alarm instance is not registered by the Set() method, return value is @c 0.
147          */
148         int GetPeriod(void) const;
149
150         /**
151          * Gets the end time for the current instance of %Alarm.
152          *
153          * @since       2.0
154          *
155          * @return       A pointer to Tizen::Base::DateTime indicating the end time for the alarm, @n
156          *                      else @c null if the end time has not been set
157          */
158         const Tizen::Base::DateTime* GetEndTime(void) const;
159
160 private:
161         /**
162          * This is the default copy constructor for this class. The implementation of this copy constructor is intentionally blank and declared as private to prohibit copying of objects.
163          */
164         Alarm(const Alarm& alarml);
165
166         /**
167          * This is the assignment operator for this class. The implementation of this copy assignment operator is intentionally blank and declared as private to prohibit copying of objects.
168          */
169         Alarm& operator =(const Alarm& alarml);
170
171 private:
172         friend class _AlarmImpl;
173
174         class _AlarmImpl* __pAlarmImpl;
175
176 }; // Alarm
177
178 } } // Tizen::System
179
180 #endif // _FSYS_ALARM_H_