supla-device
Loading...
Searching...
No Matches
capability_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_SUPLET_CAPABILITY_REGISTRY_H_
5#define SRC_SUPLA_SUPLET_CAPABILITY_REGISTRY_H_
6
7#include <stdint.h>
8#include <supla/suplet/definition.h>
9
10namespace Supla {
11namespace Suplet {
12
14 public:
16
17 bool add(const Capability &capability);
18 void clear();
19
20 uint8_t getCount() const;
21 bool getCapability(uint8_t index, Capability *capability) const;
22 bool find(Category category,
23 Kind kind,
24 uint8_t handlerVersion,
25 Capability *capability) const;
26
27 private:
28 struct Entry {
29 Capability capability = {};
30 Entry *next = nullptr;
31 };
32
33 bool contains(Category category, Kind kind, uint8_t handlerVersion) const;
34
35 Entry *first = nullptr;
36};
37
38} // namespace Suplet
39} // namespace Supla
40
41#endif // SRC_SUPLA_SUPLET_CAPABILITY_REGISTRY_H_
Definition capability_registry.h:13
Definition definition.h:77