use typedef for function

This commit is contained in:
Nicu Hodos 2023-07-08 11:52:43 +02:00
parent 294eef45c6
commit 7e99bafff9

View File

@ -32,11 +32,12 @@ namespace Ha {
}
};
typedef void (*onMessage)(const char* msg);
struct Command : Component {
const char* commandTopic;
void (*f)(const char* msg);
onMessage f;
Command(const char* name, const char* uniqueId, const char* configTopic, const char* commandTopic, void (*f)(const char* msg)) : Component(name, uniqueId, configTopic) {
Command(const char* name, const char* uniqueId, const char* configTopic, const char* commandTopic, onMessage f) : Component(name, uniqueId, configTopic) {
this->commandTopic = commandTopic;
this->f = f;
}