diff options
| author | The King <27705324+jlukanc1@users.noreply.github.com> | 2021-01-24 16:01:14 -0500 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-01-24 16:01:14 -0500 |
| commit | 8c3df5f0211e0cc31de90039a73fe48b9a9aafe0 (patch) | |
| tree | 88fc0671a629b27793a418df76f543c7913b644a /src/components/heartrate/HeartRateController.h | |
| parent | 51c8cadcb78bdbe9013f5aace629c96ed3dfd06f (diff) | |
| parent | 80838d1e42e83b50188d6237d16c81cfa27781a6 (diff) | |
Merge branch 'develop' into upstream-dev
Diffstat (limited to 'src/components/heartrate/HeartRateController.h')
| -rw-r--r-- | src/components/heartrate/HeartRateController.h | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/src/components/heartrate/HeartRateController.h b/src/components/heartrate/HeartRateController.h new file mode 100644 index 00000000..001111b5 --- /dev/null +++ b/src/components/heartrate/HeartRateController.h @@ -0,0 +1,38 @@ +#pragma once + +#include <cstdint> +#include <components/ble/HeartRateService.h> + +namespace Pinetime { + namespace Applications { + class HeartRateTask; + } + namespace System { + class SystemTask; + } + namespace Controllers { + class HeartRateController { + public: + enum class States { Stopped, NotEnoughData, NoTouch, Running}; + + explicit HeartRateController(System::SystemTask& systemTask); + + 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); + + private: + System::SystemTask& systemTask; + Applications::HeartRateTask* task = nullptr; + States state = States::Stopped; + uint8_t heartRate = 0; + Pinetime::Controllers::HeartRateService* service = nullptr; + }; + } +}
\ No newline at end of file |
