supla-device
Loading...
Searching...
No Matches
channel_map.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_CHANNEL_MAP_H_
5#define SRC_SUPLA_SUPLET_CHANNEL_MAP_H_
6
7#include <stdint.h>
8#include <supla-common/proto.h>
9
10#ifndef SUPLA_SUPLET_MAX_CHANNELS_PER_INSTANCE
11#define SUPLA_SUPLET_MAX_CHANNELS_PER_INSTANCE 32
12#endif
13
14namespace Supla {
15namespace Suplet {
16
17constexpr int kInvalidChannelNumber = -1;
18constexpr uint8_t kInvalidChannelId = 0;
19
21 uint8_t channelId = kInvalidChannelId;
22 int16_t channelNumber = kInvalidChannelNumber;
23};
24
26 public:
27 uint8_t getCount() const;
28 void clear();
29
30 bool add(uint8_t channelId, int channelNumber);
31 bool containsId(uint8_t channelId) const;
32 int getChannelNumber(uint8_t channelId) const;
33 const ChannelMapping *getMapping(uint8_t index) const;
34
35 private:
36 ChannelMapping mappings[SUPLA_SUPLET_MAX_CHANNELS_PER_INSTANCE] = {};
37 uint8_t count = 0;
38};
39
40} // namespace Suplet
41} // namespace Supla
42
43#endif // SRC_SUPLA_SUPLET_CHANNEL_MAP_H_
Definition channel_map.h:25
Definition channel_map.h:20