sync with tizen_2.0
[platform/framework/native/appfw.git] / inc / FSysAlarm.h
1 //
2 // Open Service Platform
3 // Copyright (c) 2012 Samsung Electronics Co., Ltd.
4 //
5 // Licensed under the Apache License, Version 2.0 (the License);
6 // you may not use this file except in compliance with the License.
7 // You may obtain a copy of the License at
8 //
9 //     http://www.apache.org/licenses/LICENSE-2.0
10 //
11 // Unless required by applicable law or agreed to in writing, software
12 // distributed under the License is distributed on an "AS IS" BASIS,
13 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 // See the License for the specific language governing permissions and
15 // limitations under the License.
16 //
17
18 /**
19  * @file        FSysAlarm.h
20  * @brief       This is the header file for the %Alarm class.
21  *
22  * This header file contains the declarations of the %Alarm class.
23  */
24
25 #ifndef _FSYS_ALARM_H_
26 #define _FSYS_ALARM_H_
27
28 #include <FBaseDateTime.h>
29 #include <FSysIAlarmEventListener.h>
30
31 namespace Tizen { namespace System
32 {
33
34 /**
35  * @class       Alarm
36  * @brief       This class provides methods for creating, deleting, and updating an alarm.
37  *
38  * @since 2.0
39  *
40  * @final       This class is not intended for extension.
41  *
42  * The %Alarm class provides methods to create a one-time or repeating alarm.
43  *
44  * For more information on the class features, see <a href="../org.tizen.native.appprogramming/html/guide/system/system_namespace.htm">System Guide</a>.
45  */
46
47 class _OSP_EXPORT_ Alarm
48         : public Tizen::Base::Object
49 {
50 public:
51         /**
52          * This is the default constructor for this class.
53          *
54          * @since 2.0
55          *
56          * @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. 
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          * @privilege   %http://tizen.org/privilege/alarm
87          *
88          * @return      An error code
89          * @param[in]   duetime                 The time for the alarm to ring
90          * @exception   E_SUCCESS               The method is successful.
91          * @exception   E_PRIVILEGE_DENIED      The application does not have the privilege to call this method.
92          * @exception   E_INVALID_ARG           The specified @c duetime is invalid.
93          * @exception   E_SYSTEM                A system error has occurred.
94          * @remarks     If this Alarm instance is already registered by this method, exist alarm is cancelled automatically.
95          */
96         result Set(const Tizen::Base::DateTime& duetime);
97
98         /**
99          * Sets a repeating alarm.
100          *
101          * @since       2.0
102          *
103          * @privilege   %http://tizen.org/privilege/alarm
104          *
105          * @return      An error code
106          * @param[in]   start                   The time for the alarm to ring first
107          * @param[in]   period                  The interval in minutes between consecutive alarm rings
108          * @param[in]   pEnd                    The time for the alarm ring to end
109          * @exception   E_SUCCESS               The method is successful.
110          * @exception   E_PRIVILEGE_DENIED      The application does not have the privilege to call this method.
111          * @exception   E_INVALID_ARG           A specified input parameter is invalid.
112          * @exception   E_SYSTEM                A system error has occurred.
113          * @remarks     If this Alarm instance is already registered by this method, exist alarm is cancelled automatically. @n If @c pEnd is @c null, the alarm repeats forever.
114          */
115         result Set(const Tizen::Base::DateTime& start, int period, const Tizen::Base::DateTime* pEnd = null);
116
117         /**
118          * Cancels the alarm.
119          *
120          * @since       2.0
121          *
122          * @privilege   %http://tizen.org/privilege/alarm
123          *
124          * @return      An error code
125          * @exception   E_SUCCESS               The method is successful.
126          * @exception   E_PRIVILEGE_DENIED      The application does not have the privilege to call this method.
127          * @exception   E_SYSTEM                A system error has occurred.
128          */
129         result Cancel(void);
130
131         /**
132          * Gets the start time for the current instance of %Alarm.
133          *
134          * @since       2.0
135          *
136          * @return      An instance of Tizen::Base::DateTime indicating the start time for the alarm
137          * @remarks     If this Alarm instance is not registered by %Set method, return value is default value of %DateTime class.
138          */
139         const Tizen::Base::DateTime GetStartTime(void) const;
140
141         /**
142          * Gets the period of the current instance of %Alarm in minutes.
143          *
144          * @since       2.0
145          *
146          * @return      The period of the current instance of %Alarm in minutes
147          * @remarks     If this Alarm instance is not registered by %Set method, return value is 0.
148          */
149         int GetPeriod(void) const;
150
151         /**
152          * Gets the end time for the current instance of %Alarm.
153          *
154          * @since       2.0
155          *
156          * @return       A pointer to Tizen::Base::DateTime indicating the end time for the alarm, @n
157          *                      else @c null if the end time has not been set
158          */
159         const Tizen::Base::DateTime* GetEndTime(void) const;
160
161 private:
162         /**
163          * 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.
164          */
165         Alarm(const Alarm& alarml);
166
167         /**
168          * 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.
169          */
170         Alarm& operator =(const Alarm& alarml);
171
172 private:
173         friend class _AlarmImpl;
174
175         class _AlarmImpl* __pAlarmImpl;
176
177 }; // Alarm
178
179 } } // Tizen::System
180
181 #endif // _FSYS_ALARM_H_