Files
MuditaOS/module-sys/Service/TimerFactory.cpp
Lefucjusz 773f2c7eb1 [BH-2069] Update license URL in headers
Update outdated license file URL in
license headers across all project.
2024-09-18 11:53:01 +02:00

30 lines
1.2 KiB
C++

// Copyright (c) 2017-2024, Mudita Sp. z.o.o. All rights reserved.
// For licensing, see https://github.com/mudita/MuditaOS/blob/master/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