Merge "Update deprecated libprivilege-control API functions." into tizen
[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. @n
52          * The object is not fully constructed after this constructor is called. @n
53          * For full construction, the Construct() method must be called right after calling this constructor.
54          *
55          * @since 2.0
56          *
57          */
58         Alarm(void);
59
60         /**
61          * This is the destructor for this class. @n
62          * It unregisters the current instance of %Alarm from the system.
63          * This destructor overrides Tizen::Base::Object::~Object().
64          *
65          * @since 2.0
66          */
67         ~Alarm(void);
68
69         /**
70          * Initializes an instance of %Alarm with the specified @c listener.
71          *
72          * @since       2.0
73          *
74          * @return      An error code
75          * @param[in]   listener                A reference to IAlarmEventListener
76          * @exception   E_SUCCESS               The method is successful.
77          * @exception   E_SYSTEM                A system error has occurred.
78          */
79         result Construct(IAlarmEventListener& listener);
80
81         /**
82          * Sets a one-time alarm.
83          *
84          * @since       2.0
85          *
86          * @privlevel   public
87          * @privilege   %http://tizen.org/privilege/alarm
88          *
89          * @return              An error code
90          * @param[in]   duetime                         The time for the alarm to ring @n 
91          *                                                                      Any value with a unit that is less than a second is ignored.
92          * @exception   E_SUCCESS                       The method is successful.
93          * @exception   E_PRIVILEGE_DENIED      The application does not have the privilege to call this method.
94          * @exception   E_INVALID_ARG           The specified @c duetime is invalid.
95          * @exception   E_SYSTEM                        A system error has occurred.
96          * @remarks     If this %Alarm instance is already registered by this method, the existing alarm is cancelled automatically.
97          */
98         result Set(const Tizen::Base::DateTime& duetime);
99
100         /**
101          * Sets a repeating alarm.
102          *
103          * @since               2.0
104          *
105          * @privlevel   public
106          * @privilege   %http://tizen.org/privilege/alarm
107          *
108          * @return              An error code
109          * @param[in]   start                   The time for the alarm to ring first @n 
110          *                                                              Any value with a unit that is less than a second is ignored.
111          * @param[in]   period                          The interval in minutes between consecutive alarm rings
112          * @param[in]   pEnd                                    The time for the alarm ring to end @n 
113          *                                                              Any value with a unit that is less than a second is ignored.
114          * @exception   E_SUCCESS                       The method is successful.
115          * @exception   E_PRIVILEGE_DENIED      The application does not have the privilege to call this method.
116          * @exception   E_INVALID_ARG           A specified input parameter is invalid.
117          * @exception   E_SYSTEM                        A system error has occurred.
118          * @remarks     
119          *                      - If this %Alarm instance is already registered by this method, existing alarm is cancelled automatically.
120          *                      - If @c pEnd is @c null, the alarm repeats forever.
121          */
122         result Set(const Tizen::Base::DateTime& start, int period, const Tizen::Base::DateTime* pEnd = null);
123
124         /**
125          * Cancels the alarm.
126          *
127          * @since               2.0
128          *
129          * @privlevel   public
130          * @privilege   %http://tizen.org/privilege/alarm
131          *
132          * @return              An error code
133          * @exception   E_SUCCESS                       The method is successful.
134          * @exception   E_PRIVILEGE_DENIED      The application does not have the privilege to call this method.
135          * @exception   E_SYSTEM                        A system error has occurred.
136          */
137         result Cancel(void);
138
139         /**
140          * Gets the start time for the current instance of %Alarm.
141          *
142          * @since               2.0
143          *
144          * @return              An instance of Tizen::Base::DateTime indicating the start time for the alarm
145          * @remarks     If this %Alarm instance is not registered by the Set() method, the return value is the default value of 
146          *                              the Tizen::Base::DateTime instance.
147          */
148         const Tizen::Base::DateTime GetStartTime(void) const;
149
150         /**
151          * Gets the period of the current instance of %Alarm in minutes.
152          *
153          * @since               2.0
154          *
155          * @return              The period of the current instance of %Alarm in minutes
156          * @remarks     If this %Alarm instance is not registered by the Set() method, return value is @c 0.
157          */
158         int GetPeriod(void) const;
159
160         /**
161          * Gets the end time for the current instance of %Alarm.
162          *
163          * @since       2.0
164          *
165          * @return      A pointer to Tizen::Base::DateTime indicating the end time for the alarm, @n
166          *                      else @c null if the end time has not been set
167          */
168         const Tizen::Base::DateTime* GetEndTime(void) const;
169
170 private:
171         /**
172          * 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.
173          */
174         Alarm(const Alarm& alarml);
175
176         /**
177          * 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.
178          */
179         Alarm& operator =(const Alarm& alarml);
180
181 private:
182         friend class _AlarmImpl;
183
184         class _AlarmImpl* __pAlarmImpl;
185
186 }; // Alarm
187
188 } } // Tizen::System
189
190 #endif // _FSYS_ALARM_H_