2 // Open Service Platform
3 // Copyright (c) 2012 Samsung Electronics Co., Ltd.
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
9 // http://www.apache.org/licenses/LICENSE-2.0
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.
20 * @brief This is the header file for the %Alarm class.
22 * This header file contains the declarations of the %Alarm class.
25 #ifndef _FSYS_ALARM_H_
26 #define _FSYS_ALARM_H_
28 #include <FBaseDateTime.h>
29 #include <FSysIAlarmEventListener.h>
31 namespace Tizen { namespace System
36 * @brief This class provides methods for creating, deleting, and updating an alarm.
40 * @final This class is not intended for extension.
42 * The %Alarm class provides methods to create a one-time or repeating alarm.
44 * For more information on the class features, see <a href="../org.tizen.native.appprogramming/html/guide/system/system_namespace.htm">System Guide</a>.
47 class _OSP_EXPORT_ Alarm
48 : public Tizen::Base::Object
52 * This is the default constructor for this class.
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.
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().
70 * Initializes an instance of %Alarm with the specified @c listener.
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.
79 result Construct(IAlarmEventListener& listener);
82 * 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.
103 * @privilege %http://tizen.org/privilege/alarm
105 * @return An error code
106 * @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.
107 * @param[in] period The interval in minutes between consecutive alarm rings.
108 * @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.
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, existing alarm is cancelled automatically. @n If @c pEnd is @c null, the alarm repeats forever.
115 result Set(const Tizen::Base::DateTime& start, int period, const Tizen::Base::DateTime* pEnd = null);
122 * @privilege %http://tizen.org/privilege/alarm
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.
132 * Gets the start time for the current instance of %Alarm.
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 the Set() method, return value is default value of the Tizen::Base::DateTime class.
139 const Tizen::Base::DateTime GetStartTime(void) const;
142 * Gets the period of the current instance of %Alarm in minutes.
146 * @return The period of the current instance of %Alarm in minutes
147 * @remarks If this %Alarm instance is not registered by the Set() method, return value is @c 0.
149 int GetPeriod(void) const;
152 * Gets the end time for the current instance of %Alarm.
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
159 const Tizen::Base::DateTime* GetEndTime(void) const;
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.
165 Alarm(const Alarm& alarml);
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.
170 Alarm& operator =(const Alarm& alarml);
173 friend class _AlarmImpl;
175 class _AlarmImpl* __pAlarmImpl;
181 #endif // _FSYS_ALARM_H_