libhomegear-base  0.7
Base library for Homegear and Homegear family modules.
UiElements.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 UIELEMENTS_H_
32 #define UIELEMENTS_H_
33 
34 #include "HomegearUiElements.h"
35 #include "../../Variable.h"
36 
37 #include <vector>
38 #include <memory>
39 #include <mutex>
40 
41 namespace BaseLib {
42 
43 class SharedObjects;
44 
45 namespace DeviceDescription {
46 
50 class UiElements {
51  public:
52  struct UiVariableInfo {
53  uint64_t peerId = 0;
54  int32_t channel = -1;
55  std::string name;
57  std::string unit;
63  } __attribute__((aligned(128)));
64  typedef std::shared_ptr<UiVariableInfo> PUiVariableInfo;
65 
66  struct UiPeerInfo {
67  std::vector<std::vector<PUiVariableInfo>> inputPeers;
68  std::vector<std::vector<PUiVariableInfo>> outputPeers;
69  } __attribute__((aligned(64)));
70  typedef std::shared_ptr<UiPeerInfo> PUiPeerInfo;
71 
72  explicit UiElements(BaseLib::SharedObjects *baseLib);
73  virtual ~UiElements() = default;
74  void clear();
75 
76  PVariable getUiElements(const std::string &language);
77  PHomegearUiElement getUiElement(const std::string &language, const std::string &id);
78 
87  PHomegearUiElement getUiElement(const std::string &language, const std::string &id, PUiPeerInfo peerInfo);
88  protected:
90  std::mutex _uiInfoMutex;
91  std::unordered_map<std::string, std::unordered_map<std::string, PHomegearUiElement>> _uiInfo;
92 
93  void load(const std::string &language);
94 };
95 
96 }
97 }
98 #endif
void clear()
Definition: UiElements.cpp:42
PVariable getUiElements(const std::string &language)
Definition: UiElements.cpp:213
This is the base library main class.
Definition: BaseLib.h:95
Definition: BaseLib.cpp:34
UiElements(BaseLib::SharedObjects *baseLib)
Definition: UiElements.cpp:38
PVariable minimumValueScaled
Definition: UiElements.h:60
std::vector< std::vector< PUiVariableInfo > > outputPeers
Definition: UiElements.h:68
PVariable maximumValue
Definition: UiElements.h:59
std::vector< std::vector< PUiVariableInfo > > inputPeers
Definition: UiElements.h:67
std::shared_ptr< UiVariableInfo > PUiVariableInfo
Definition: UiElements.h:64
PVariable rendering
Definition: UiElements.h:62
std::unordered_map< std::string, std::unordered_map< std::string, PHomegearUiElement > > _uiInfo
Definition: UiElements.h:91
PVariable maximumValueScaled
Definition: UiElements.h:61
std::shared_ptr< Variable > PVariable
Definition: PhysicalInterfaceSettings.h:41
std::shared_ptr< UiPeerInfo > PUiPeerInfo
Definition: UiElements.h:70
std::mutex _uiInfoMutex
Definition: UiElements.h:90
BaseLib::SharedObjects * _bl
Definition: UiElements.h:89
std::string unit
Definition: UiElements.h:57
std::string name
Definition: UiElements.h:55
uint64_t peerId
Definition: UiElements.h:53
Class holding information on how UI elements look like.
Definition: UiElements.h:50
PHomegearUiElement getUiElement(const std::string &language, const std::string &id)
Definition: UiElements.cpp:103
PVariable value
Definition: UiElements.h:56
struct BaseLib::DeviceDescription::UiElements::UiVariableInfo __attribute__((aligned(128)))
void load(const std::string &language)
Definition: UiElements.cpp:47
std::shared_ptr< HomegearUiElement > PHomegearUiElement
Helper type for Packet pointers.
Definition: HomegearUiElement.h:53
PVariable minimumValue
Definition: UiElements.h:58
int32_t channel
Definition: UiElements.h:54