supla-device
Loading...
Searching...
No Matches
mqtt_handler_registry.h
1// SPDX-FileCopyrightText: AC SOFTWARE SP. Z O.O.
2// SPDX-License-Identifier: GPL-2.0-or-later
3
4#ifndef SRC_SUPLA_PROTOCOL_MQTT_HANDLER_REGISTRY_H_
5#define SRC_SUPLA_PROTOCOL_MQTT_HANDLER_REGISTRY_H_
6
7#include <stddef.h>
8
9#include <supla/protocol/mqtt_channel_handler.h>
10
11#ifndef SUPLA_MQTT_HANDLER_REGISTRY_MAX_HANDLERS
12#define SUPLA_MQTT_HANDLER_REGISTRY_MAX_HANDLERS 8
13#endif
14
15namespace Supla {
16namespace Protocol {
17
19 public:
20 static MqttHandlerRegistry &instance();
21
22 bool registerHandler(MqttChannelHandler *handler);
23 MqttChannelHandler *findHandler(int channelType) const;
24
25#if SUPLA_TEST
26 void clearForTests();
27 size_t sizeForTests() const;
28#endif
29
30 private:
31 MqttChannelHandler *handlers[SUPLA_MQTT_HANDLER_REGISTRY_MAX_HANDLERS] = {};
32 size_t handlerCount = 0;
33};
34
35} // namespace Protocol
36} // namespace Supla
37
38#endif // SRC_SUPLA_PROTOCOL_MQTT_HANDLER_REGISTRY_H_
Definition mqtt_channel_handler.h:15
Definition mqtt_handler_registry.h:18