libhomegear-base  0.7
Base library for Homegear and Homegear family modules.
Physical.h
Go to the documentation of this file.
1 /* Copyright 2013-2019 Homegear GmbH
2  *
3  * libhomegear-base is free software: you can redistribute it and/or
4  * modify it under the terms of the GNU Lesser General Public License as
5  * published by the Free Software Foundation, either version 3 of the
6  * License, or (at your option) any later version.
7  *
8  * libhomegear-base is distributed in the hope that it will be useful,
9  * but WITHOUT ANY WARRANTY; without even the implied warranty of
10  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11  * GNU Lesser General Public License for more details.
12  *
13  * You should have received a copy of the GNU Lesser General Public
14  * License along with libhomegear-base. If not, see
15  * <http://www.gnu.org/licenses/>.
16  *
17  * In addition, as a special exception, the copyright holders give
18  * permission to link the code of portions of this program with the
19  * OpenSSL library under certain conditions as described in each
20  * individual source file, and distribute linked combinations
21  * including the two.
22  * You must obey the GNU Lesser General Public License in all respects
23  * for all of the code used other than OpenSSL. If you modify
24  * file(s) with this exception, you may extend this exception to your
25  * version of the file(s), but you are not obligated to do so. If you
26  * do not wish to do so, delete this exception statement from your
27  * version. If you delete this exception statement from all source
28  * files in the program, then also delete it here.
29 */
30 
31 #ifndef DEVICEPARAMETERPHYSICAL_H_
32 #define DEVICEPARAMETERPHYSICAL_H_
33 
34 #include <string>
35 #include <memory>
36 
37 namespace rapidxml
38 {
39 class xml_node;
40 }
41 
42 using namespace rapidxml;
43 
44 namespace BaseLib
45 {
46 
47 class SharedObjects;
48 
49 namespace DeviceDescription
50 {
51 
52 class Physical;
53 typedef Physical PhysicalNone;
54 class PhysicalInteger;
55 class PhysicalBoolean;
57 
58 typedef std::shared_ptr<Physical> PPhysical;
59 typedef std::shared_ptr<PhysicalNone> PPhysicalNone;
60 typedef std::shared_ptr<PhysicalInteger> PPhysicalInteger;
61 typedef std::shared_ptr<PhysicalBoolean> PPhysicalBoolean;
62 typedef std::shared_ptr<PhysicalString> PPhysicalString;
63 
64 class IPhysical
65 {
66 public:
67  struct Type
68  {
69  enum Enum { none = 0x00, tInteger = 0x01, tBoolean = 0x02, tString = 0x03 };
70  };
71 
73  {
74  enum Enum { none, addition, subtraction };
75  };
76 
78  {
79  enum Enum { none = 0, command = 1, centralCommand = 2, internal = 3, config = 4, configString = 5, store = 6, memory = 7 };
80  };
81 
82  struct Endianess
83  {
84  enum Enum { unset = 0, big = 1, little = 2 };
85  };
86 
87  std::string groupId;
88  std::string typeString;
89  Type::Enum type = Type::none;
90  OperationType::Enum operationType = OperationType::none;
91  Endianess::Enum endianess = Endianess::big;
92  int32_t address = 0;
93  double index = 0;
94  bool sizeDefined = false;
95  double size = 1.0;
96  int32_t bitSize = -1;
97  int32_t mask = -1;
98  int32_t list = -1;
99  double memoryIndex = 0;
100  MemoryIndexOperation::Enum memoryIndexOperation = MemoryIndexOperation::Enum::none;
101  double memoryChannelStep = 0;
102 
104  IPhysical(BaseLib::SharedObjects* baseLib, Type::Enum type, xml_node* node);
105  virtual ~IPhysical() {}
106 
107  //Helpers
108  uint32_t startIndex = 0;
109  uint32_t endIndex = 0;
110 protected:
111  BaseLib::SharedObjects* _bl = nullptr;
112 };
113 
114 class Physical : public IPhysical
115 {
116 public:
118  Physical(BaseLib::SharedObjects* baseLib, xml_node* node);
119  virtual ~Physical() {}
120 };
121 
123 {
124 public:
127  virtual ~PhysicalInteger() {}
128 };
129 
131 {
132 public:
135  virtual ~PhysicalBoolean() {}
136 };
137 
138 class PhysicalString : public IPhysical
139 {
140 public:
143  virtual ~PhysicalString() {}
144 };
145 
146 }
147 }
148 
149 #endif
std::shared_ptr< PhysicalNone > PPhysicalNone
Definition: Physical.h:59
Definition: Physical.h:114
This is the base library main class.
Definition: BaseLib.h:95
virtual ~Physical()
Definition: Physical.h:119
std::string typeString
Definition: Physical.h:88
virtual ~IPhysical()
Definition: Physical.h:105
std::shared_ptr< PhysicalString > PPhysicalString
Definition: Physical.h:62
Definition: BaseLib.cpp:34
std::shared_ptr< PhysicalInteger > PPhysicalInteger
Definition: Physical.h:60
Physical PhysicalNone
Definition: Physical.h:52
std::shared_ptr< Physical > PPhysical
Definition: Physical.h:56
virtual ~PhysicalInteger()
Definition: Physical.h:127
virtual ~PhysicalString()
Definition: Physical.h:143
virtual ~PhysicalBoolean()
Definition: Physical.h:135
Definition: Physical.h:64
std::string groupId
Definition: Physical.h:87
Class representing a node of XML document.
Definition: rapidxml.h:539
Definition: BinaryPayload.h:38
std::shared_ptr< PhysicalBoolean > PPhysicalBoolean
Definition: Physical.h:61