2 // Copyright (c) 2012 Samsung Electronics Co., Ltd.
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
8 // http://www.apache.org/licenses/LICENSE-2.0
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.
19 * @brief This is the header file for the %Alarm class.
21 * This header file contains the declarations of the %Alarm class.
24 #ifndef _FSYS_ALARM_H_
25 #define _FSYS_ALARM_H_
27 #include <FBaseDateTime.h>
28 #include <FSysIAlarmEventListener.h>
30 namespace Tizen { namespace System
35 * @brief This class provides methods for creating, deleting, and updating an alarm.
39 * @final This class is not intended for extension.
41 * The %Alarm class provides methods to create a one-time or repeating alarm.
43 * For more information on the class features, see <a href="../org.tizen.native.appprogramming/html/guide/system/system_namespace.htm">System Guide</a>.
46 class _OSP_EXPORT_ Alarm
47 : public Tizen::Base::Object
51 * This is the default constructor for this class.
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.
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().
69 * Initializes an instance of %Alarm with the specified @c listener.
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.
78 result Construct(IAlarmEventListener& listener);
81 * Sets a one-time alarm.
86 * @privilege %http://tizen.org/privilege/alarm
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.
96 result Set(const Tizen::Base::DateTime& duetime);
99 * Sets a repeating alarm.
104 * @privilege %http://tizen.org/privilege/alarm
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.
116 result Set(const Tizen::Base::DateTime& start, int period, const Tizen::Base::DateTime* pEnd = null);
124 * @privilege %http://tizen.org/privilege/alarm
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.
134 * Gets the start time for the current instance of %Alarm.
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.
141 const Tizen::Base::DateTime GetStartTime(void) const;
144 * Gets the period of the current instance of %Alarm in minutes.
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.
151 int GetPeriod(void) const;
154 * Gets the end time for the current instance of %Alarm.
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
161 const Tizen::Base::DateTime* GetEndTime(void) const;
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.
167 Alarm(const Alarm& alarml);
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.
172 Alarm& operator =(const Alarm& alarml);
175 friend class _AlarmImpl;
177 class _AlarmImpl* __pAlarmImpl;
183 #endif // _FSYS_ALARM_H_