InfiniTime/src/components/heartrate/HeartRateController.h

40 lines
953 B
C
Raw Normal View History

#pragma once
#include <cstdint>
2021-01-17 15:34:14 +00:00
#include <components/ble/HeartRateService.h>
namespace Pinetime {
namespace Applications {
class HeartRateTask;
}
namespace System {
class SystemTask;
}
namespace Controllers {
class HeartRateController {
2021-04-24 09:00:45 +00:00
public:
enum class States { Stopped, NotEnoughData, NoTouch, Running };
HeartRateController() = default;
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;
}
void SetService(Pinetime::Controllers::HeartRateService* service);
2021-01-17 15:34:14 +00:00
2021-04-24 09:00:45 +00:00
private:
Applications::HeartRateTask* task = nullptr;
States state = States::Stopped;
uint8_t heartRate = 0;
2021-01-17 15:34:14 +00:00
Pinetime::Controllers::HeartRateService* service = nullptr;
};
}
}