CDC Badge OS
Firmware for the CDC Badge v1.0 hardware security key
Loading...
Searching...
No Matches
ModuleBase.h
Go to the documentation of this file.
1#pragma once
2
3#include "cdc_core/IModule.h"
4
5namespace cdc::core {
6
20class ModuleBase : public IModule {
21public:
26 explicit ModuleBase(const char* name) : name_(name) {}
27
32 const char* getName() const override { return name_; }
33
38 ServiceState getState() const override { return state_; }
39
49 bool start() override {
52 return false;
53 }
55 return true;
56 }
57
61 void stop() override {
63 }
64
65protected:
66 const char* name_ = nullptr;
68};
69
70} // namespace cdc::core
char name[cdc::hal::ISecureElement::RMEM_NAME_LEN]
Module interface that extends IService with module-specific features.
Definition IModule.h:55
const char * getName() const override
Returns the module name supplied to the constructor.
Definition ModuleBase.h:32
bool start() override
Default start() implementation performing the standard transition.
Definition ModuleBase.h:49
ServiceState state_
Definition ModuleBase.h:67
const char * name_
Definition ModuleBase.h:66
ModuleBase(const char *name)
Constructs a module base with the given module name.
Definition ModuleBase.h:26
ServiceState getState() const override
Returns the current service state.
Definition ModuleBase.h:38
void stop() override
Default stop() implementation that transitions to STOPPED.
Definition ModuleBase.h:61