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.
18 * @file FBaseRt_TimerImpl.h
19 * @brief This is the header file for the _TimerImpl class.
21 * This file contains the declarations of _TimerImpl.
25 #ifndef _FBASE_RT_INTERNAL_TIMER_IMPL_H_
26 #define _FBASE_RT_INTERNAL_TIMER_IMPL_H_
30 #include <FBaseResult.h>
31 #include <FBaseObject.h>
32 #include <FBaseRtTypes.h>
34 namespace Tizen { namespace Base { namespace Runtime
38 class ITimerEventListener;
41 : public Tizen::Base::Object
45 * This is the default constructor for this class.
53 * This is the destructor for this class.
57 virtual ~_TimerImpl(void);
60 * Initializes the time instance.
63 * @return An error code
64 * @param[in] listener The event listener
65 * @exception E_SUCCESS The method was successful.
66 * @exception E_OUT_OF_MEMORY Insufficient memory.
68 result Construct(const Timer& timer, ITimerEventListener& listener);
71 * Initializes the time instance.
75 * @return An error code
76 * @param[in] listener The event listener
77 * @param[in] awake Set to @c true, if the timer continues to run even if the system enters sleep mode
78 * @c false, if the timer stops running when the system enters sleep mode.
80 * @exception E_SUCCESS The method was successful.
81 * @exception E_OUT_OF_MEMORY Insufficient memory.
83 * @exception E_PRIVILEGE_DENIED The application does not have the privilege to call this method.
87 result Construct(const Timer& timer, ITimerEventListener& listener, bool awake);
93 * @return An error code
94 * @param[in] timeout A timeout interval in milliseconds
95 * @exception E_SUCCESS The method was successful.
96 * @exception E_INVALID_ARG A specified input parameter is invalid.
97 * @exception E_INVALID_STATE The state of the timer is not a valid state. @n
98 The timer might be in the TIMER_STATUS_ACTIVATED state.
99 * @remark Once it has been started, it cannot be started again until it expires. @n
100 * You must cancel it if you want to re-start the timer.
103 result Start(int timeout);
110 * @return An error code
111 * @exception E_SUCCESS The method was successful.
112 * @exception E_INVALID_STATE The state of the timer is not a valid state. @n
113 The timer might be in the TIMER_STATUS_NOT_ACTIVATED state.
114 * @remark The timer cannot be canceled if it is not started.
119 * Starts the timer. The timer is expired repeatedly until it is canceled.
122 * @return An error code
123 * @param[in] interval A interval in milliseconds
124 * @exception E_SUCCESS The method was successful.
125 * @exception E_SYSTEM A system error has occurred.
126 * @exception E_INVALID_ARG A specified input parameter is invalid.
127 * @exception E_INVALID_STATE The state of the timer is not a valid state. @n
128 * The timer might be in the TIMER_STATUS_ACTIVATED state.
131 result StartAsRepeatable(int interval);
134 static gboolean OnTimerExpired(GIOChannel* pGIOChannel, GIOCondition condition, gpointer data);
139 GIOChannel* __pTimerIo;
140 GSource* __pTimerSource;
141 ITimerEventListener* __pTimerEventListener;
142 TimerStatus __status;
146 } } } // Tizen::Base::Runtime
149 #endif // _FBASE_RT_INTERNAL_TIMER_IMPL_H_