InfiniTime/src/components/heartrate/HeartRateController.cpp
Reinhold Gschweicher ac7b2da611 Update includes to to be relative to src directory
Don't use relative imports like `../foo.h` as those depend on the
relative position of both files. Rather than that use imports relative
to the `src` directory, which explicitly is part of the include
directories.
2021-11-15 22:02:49 +01:00

36 lines
1022 B
C++

#include "components/heartrate/HeartRateController.h"
#include <heartratetask/HeartRateTask.h>
#include <systemtask/SystemTask.h>
using namespace Pinetime::Controllers;
void HeartRateController::Update(HeartRateController::States newState, uint8_t heartRate) {
this->state = newState;
if (this->heartRate != heartRate) {
this->heartRate = heartRate;
service->OnNewHeartRateValue(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;
}
void HeartRateController::SetService(Pinetime::Controllers::HeartRateService* service) {
this->service = service;
}