Merge "[ACR][20/08/2013][Add]Enhance Double::ToString() andFloat::ToString() to set...
[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          * @privlevel   public
86          * @privilege   %http://tizen.org/privilege/alarm
87          *
88          * @return      An error code
89          * @param[in]   duetime                 The time for the alarm to ring @n Any value with a unit that is less than a second is ignored.
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, existing 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          * @privlevel   public
104          * @privilege   %http://tizen.org/privilege/alarm
105          *
106          * @return      An error code
107          * @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.
108          * @param[in]   period                  The interval in minutes between consecutive alarm rings
109          * @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.
110          * @exception   E_SUCCESS               The method is successful.
111          * @exception   E_PRIVILEGE_DENIED      The application does not have the privilege to call this method.
112          * @exception   E_INVALID_ARG           A specified input parameter is invalid.
113          * @exception   E_SYSTEM                A system error has occurred.
114          * @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.
115          */
116         result Set(const Tizen::Base::DateTime& start, int period, const Tizen::Base::DateTime* pEnd = null);
117
118         /**
119          * Cancels the alarm.
120          *
121          * @since       2.0
122          *
123          * @privlevel   public
124          * @privilege   %http://tizen.org/privilege/alarm
125          *
126          * @return      An error code
127          * @exception   E_SUCCESS               The method is successful.
128          * @exception   E_PRIVILEGE_DENIED      The application does not have the privilege to call this method.
129          * @exception   E_SYSTEM                A system error has occurred.
130          */
131         result Cancel(void);
132
133         /**
134          * Gets the start time for the current instance of %Alarm.
135          *
136          * @since       2.0
137          *
138          * @return      An instance of Tizen::Base::DateTime indicating the start time for the alarm
139          * @remarks     If this %Alarm instance is not registered by the Set() method, return value is default value of the Tizen::Base::DateTime class.
140          */
141         const Tizen::Base::DateTime GetStartTime(void) const;
142
143         /**
144          * Gets the period of the current instance of %Alarm in minutes.
145          *
146          * @since       2.0
147          *
148          * @return      The period of the current instance of %Alarm in minutes
149          * @remarks     If this %Alarm instance is not registered by the Set() method, return value is @c 0.
150          */
151         int GetPeriod(void) const;
152
153         /**
154          * Gets the end time for the current instance of %Alarm.
155          *
156          * @since       2.0
157          *
158          * @return       A pointer to Tizen::Base::DateTime indicating the end time for the alarm, @n
159          *                      else @c null if the end time has not been set
160          */
161         const Tizen::Base::DateTime* GetEndTime(void) const;
162
163 private:
164         /**
165          * 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.
166          */
167         Alarm(const Alarm& alarml);
168
169         /**
170          * 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.
171          */
172         Alarm& operator =(const Alarm& alarml);
173
174 private:
175         friend class _AlarmImpl;
176
177         class _AlarmImpl* __pAlarmImpl;
178
179 }; // Alarm
180
181 } } // Tizen::System
182
183 #endif // _FSYS_ALARM_H_