mirror of
https://github.com/mudita/MuditaOS.git
synced 2025-12-31 09:58:00 -05:00
Improve structure of the module sys. Problems within this module prevents from linking others. Signed-off-by: Marcin Smoczyński <smoczynski.marcin@gmail.com>
30 lines
1.2 KiB
C++
30 lines
1.2 KiB
C++
// Copyright (c) 2017-2021, Mudita Sp. z.o.o. All rights reserved.
|
|
// For licensing, see https://github.com/mudita/MuditaOS/LICENSE.md
|
|
|
|
#include <Timers/TimerFactory.hpp>
|
|
|
|
#include <Timers/SystemTimer.hpp>
|
|
|
|
namespace sys
|
|
{
|
|
TimerHandle TimerFactory::createSingleShotTimer(Service *parent,
|
|
const std::string &name,
|
|
std::chrono::milliseconds interval,
|
|
timer::TimerCallback &&callback)
|
|
{
|
|
auto timer = new timer::SystemTimer(parent, name, interval, timer::Type::SingleShot);
|
|
timer->connect(std::move(callback));
|
|
return TimerHandle{timer};
|
|
}
|
|
|
|
TimerHandle TimerFactory::createPeriodicTimer(Service *parent,
|
|
const std::string &name,
|
|
std::chrono::milliseconds interval,
|
|
timer::TimerCallback &&callback)
|
|
{
|
|
auto timer = new timer::SystemTimer(parent, name, interval, timer::Type::Periodic);
|
|
timer->connect(std::move(callback));
|
|
return TimerHandle{timer};
|
|
}
|
|
} // namespace sys
|