ref: fdc89f1a20889c0295534f58dc2e82ce8c55a18b
src/components/heartrate/HeartRateController.cpp
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 |
#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; } |