2021-01-10 11:57:26 -05:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <cstdint>
|
|
|
|
|
|
|
|
namespace Pinetime {
|
|
|
|
namespace Applications {
|
|
|
|
class HeartRateTask;
|
|
|
|
}
|
2021-01-10 16:02:21 -05:00
|
|
|
namespace System {
|
|
|
|
class SystemTask;
|
|
|
|
}
|
2021-01-10 11:57:26 -05:00
|
|
|
namespace Controllers {
|
|
|
|
class HeartRateController {
|
|
|
|
public:
|
|
|
|
enum class States { NotEnoughData, NoTouch, Running};
|
|
|
|
|
2021-01-10 16:02:21 -05:00
|
|
|
explicit HeartRateController(System::SystemTask& systemTask);
|
|
|
|
|
2021-01-10 11:57:26 -05:00
|
|
|
void Start();
|
|
|
|
void Stop();
|
|
|
|
void Update(States newState, uint8_t heartRate);
|
|
|
|
|
|
|
|
void SetHeartRateTask(Applications::HeartRateTask* task);
|
|
|
|
States State() const { return state; }
|
|
|
|
uint8_t HeartRate() const { return heartRate; }
|
|
|
|
|
|
|
|
private:
|
2021-01-10 16:02:21 -05:00
|
|
|
System::SystemTask& systemTask;
|
2021-01-10 11:57:26 -05:00
|
|
|
Applications::HeartRateTask* task = nullptr;
|
|
|
|
States state = States::NotEnoughData;
|
|
|
|
uint8_t heartRate = 0;
|
|
|
|
};
|
|
|
|
}
|
|
|
|
}
|