Files
MuditaOS/module-services/service-cellular/call/api/CallTimer.hpp
Marcin Zieliński 94a825af64 [MOS-810] Fixed call state timer termination
Fixed the problem that the call state polling
timer wasn't terminated in some cases, so the
modem command AT+CLCC had still been issued
until e.g. another call was made. In such cases,
this lead to inability for the modem to go to
a power-down state due to constant activity and
thus lead to battery power waste.

Additionally, fixed a hidden bug that TimerRing
hadn't got a virtual destructor.

Also thrown out some dead code.
2022-12-09 16:56:05 +01:00

46 lines
973 B
C++

// Copyright (c) 2017-2022, Mudita Sp. z.o.o. All rights reserved.
// For licensing, see https://github.com/mudita/MuditaOS/LICENSE.md
#pragma once
#include <Timers/TimerHandle.hpp>
namespace call::api
{
class Timer
{
public:
virtual void start() = 0;
virtual void stop() = 0;
virtual time_t duration() = 0;
virtual ~Timer() = default;
};
struct TimerRing
{
virtual void start() = 0;
virtual ~TimerRing() = default;
};
}; // namespace call::api
class CallTimer : public call::api::Timer
{
sys::TimerHandle handle;
std::time_t startActiveTime{0};
public:
explicit CallTimer(sys::TimerHandle handle);
void start() override;
void stop() override;
time_t duration() override;
};
class TimerRing : public call::api::TimerRing
{
sys::TimerHandle handle;
public:
explicit TimerRing(sys::TimerHandle handle);
void start() override;
};