35 lines
907 B
C++
35 lines
907 B
C++
#include "HeartRateController.h"
|
|
#include <heartratetask/HeartRateTask.h>
|
|
#include <systemtask/SystemTask.h>
|
|
|
|
using namespace Pinetime::Controllers;
|
|
|
|
HeartRateController::HeartRateController(Pinetime::System::SystemTask &systemTask) : systemTask{systemTask} {
|
|
|
|
}
|
|
|
|
|
|
void HeartRateController::Update(HeartRateController::States newState, uint8_t heartRate) {
|
|
this->state = newState;
|
|
this->heartRate = heartRate;
|
|
}
|
|
|
|
void HeartRateController::Start() {
|
|
if(task != nullptr) {
|
|
state = States::NotEnoughData;
|
|
task->PushMessage(Pinetime::Applications::HeartRateTask::Messages::StartMeasurement);
|
|
}
|
|
}
|
|
|
|
void HeartRateController::Stop() {
|
|
if(task != nullptr) {
|
|
state = States::Stopped;
|
|
task->PushMessage(Pinetime::Applications::HeartRateTask::Messages::StopMeasurement);
|
|
}
|
|
}
|
|
|
|
void HeartRateController::SetHeartRateTask(Pinetime::Applications::HeartRateTask *task) {
|
|
this->task = task;
|
|
}
|
|
|