2 * Copyright (c) 2023 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 #include <dali/public-api/adaptor-framework/timer.h>
22 #include <dali/internal/system/common/system-factory.h>
23 #include <dali/internal/system/common/timer-impl.h>
24 #include <dali/public-api/dali-adaptor-common.h>
32 Timer Timer::New(uint32_t milliSec)
34 Internal::Adaptor::TimerPtr internal = Dali::Internal::Adaptor::GetSystemFactory()->CreateTimer(milliSec);
35 return Timer(internal.Get());
38 Timer::Timer(const Timer& copy) = default;
40 Timer& Timer::operator=(const Timer& rhs) = default;
42 Timer::Timer(Timer&& rhs) noexcept = default;
44 Timer& Timer::operator=(Timer&& rhs) noexcept = default;
50 Timer Timer::DownCast(BaseHandle handle)
52 return Timer(dynamic_cast<Internal::Adaptor::Timer*>(handle.GetObjectPtr()));
57 Internal::Adaptor::GetImplementation(*this).Start();
62 Internal::Adaptor::GetImplementation(*this).Stop();
67 Internal::Adaptor::GetImplementation(*this).Pause();
72 Internal::Adaptor::GetImplementation(*this).Resume();
75 void Timer::SetInterval(unsigned int interval)
77 Internal::Adaptor::GetImplementation(*this).SetInterval(interval, true);
80 void Timer::SetInterval(unsigned int interval, bool restart)
82 Internal::Adaptor::GetImplementation(*this).SetInterval(interval, restart);
85 unsigned int Timer::GetInterval() const
87 return Internal::Adaptor::GetImplementation(*this).GetInterval();
90 bool Timer::IsRunning() const
92 return Internal::Adaptor::GetImplementation(*this).IsRunning();
95 Timer::TimerSignalType& Timer::TickSignal()
97 return Internal::Adaptor::GetImplementation(*this).TickSignal();
100 Timer::Timer(Internal::Adaptor::Timer* timer)