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.
85 * @privilege %http://tizen.org/privilege/alarm
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.
95 result Set(const Tizen::Base::DateTime& duetime);
98 * Sets a repeating alarm.
102 * @privilege %http://tizen.org/privilege/alarm
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.
114 result Set(const Tizen::Base::DateTime& start, int period, const Tizen::Base::DateTime* pEnd = null);
121 * @privilege %http://tizen.org/privilege/alarm
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.
131 * Gets the start time for the current instance of %Alarm.
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.
138 const Tizen::Base::DateTime GetStartTime(void) const;
141 * Gets the period of the current instance of %Alarm in minutes.
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.
148 int GetPeriod(void) const;
151 * Gets the end time for the current instance of %Alarm.
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
158 const Tizen::Base::DateTime* GetEndTime(void) const;
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.
164 Alarm(const Alarm& alarml);
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.
169 Alarm& operator =(const Alarm& alarml);
172 friend class _AlarmImpl;
174 class _AlarmImpl* __pAlarmImpl;
180 #endif // _FSYS_ALARM_H_