supla-device
Loading...
Searching...
No Matches
assignment_applier.h
1/*
2 Copyright (C) AC SOFTWARE SP. Z O.O
3
4 This program is free software; you can redistribute it and/or
5 modify it under the terms of the GNU General Public License
6 as published by the Free Software Foundation; either version 2
7 of the License, or (at your option) any later version.
8
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU General Public License for more details.
13
14 You should have received a copy of the GNU General Public License
15 along with this program; if not, write to the Free Software
16 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
17 */
18
19#ifndef SRC_SUPLA_SUPLET_ASSIGNMENT_APPLIER_H_
20#define SRC_SUPLA_SUPLET_ASSIGNMENT_APPLIER_H_
21
22#include <stdint.h>
23#include <supla/suplet/manager.h>
24#include <supla/suplet/registry.h>
25
26namespace Supla {
27namespace Suplet {
28
29enum class AssignmentResult : uint8_t {
30 Applied = 0,
31 Removed = 1,
32 InvalidArgument = 2,
33 DefinitionNotSupported = 3,
34 InvalidConfig = 4,
35 StorageError = 5,
36 ResourceLimitExceeded = 6,
37 InstanceLimitExceeded = 7,
38 ChannelLimitExceeded = 8,
39};
40
41class AssignmentApplier {
42 public:
43 AssignmentApplier(Manager *manager, const Registry *registry);
44
45 AssignmentResult applyJson(const char *json,
46 uint32_t definitionId,
47 uint16_t definitionVersion);
48 AssignmentResult validateJson(const char *json,
49 uint32_t definitionId,
50 uint16_t definitionVersion) const;
51 AssignmentResult remove(uint8_t instanceId);
52
53 private:
54 Manager *manager = nullptr;
55 const Registry *registry = nullptr;
56};
57
58} // namespace Suplet
59} // namespace Supla
60
61#endif // SRC_SUPLA_SUPLET_ASSIGNMENT_APPLIER_H_
Definition manager.h:44
Definition registry.h:28