From 7e99bafff91f01f02e4b0e4012831e5632a14957 Mon Sep 17 00:00:00 2001 From: Nicu Hodos Date: Sat, 8 Jul 2023 11:52:43 +0200 Subject: [PATCH] use typedef for function --- include/ha.h | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/include/ha.h b/include/ha.h index 4490d96..c577006 100644 --- a/include/ha.h +++ b/include/ha.h @@ -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; }