libhomegear-base  0.7
Base library for Homegear and Homegear family modules.
Function.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 DEVICEFUNCTION_H_
32 #define DEVICEFUNCTION_H_
33 
34 #include "ParameterGroup.h"
35 #include <string>
36 #include <set>
37 
38 namespace BaseLib
39 {
40 namespace DeviceDescription
41 {
42 
43 class Function;
44 
45 typedef std::set<std::string> LinkFunctionTypes;
46 typedef std::shared_ptr<Function> PFunction;
47 typedef std::map<uint32_t, PFunction> Functions;
48 
52 class Function
53 {
54 public:
55  struct Direction
56  {
57  enum Enum { none = 0, sender = 1, receiver = 2 };
58  };
59 
61  Function(BaseLib::SharedObjects* baseLib, xml_node* node, uint32_t& channel);
62  virtual ~Function() {}
63 
64  //Attributes
65  uint32_t channel = 0;
66  std::string type;
67  uint32_t channelCount = 1;
68 
69  //Properties
71  bool visible = true;
72  bool deletable = false;
73  bool internal = false;
74  std::string countFromVariable;
78  bool grouped = false;
79  Direction::Enum direction = Direction::Enum::none;
80  bool forceEncryption = false;
84  bool hasGroup = false;
85  std::string groupId;
86  std::unordered_map<std::string, BaseLib::PVariable> linkSenderAttributes;
87  std::unordered_map<std::string, BaseLib::PVariable> linkReceiverAttributes;
88  LinkFunctionTypes linkSenderFunctionTypes;
89  LinkFunctionTypes linkReceiverFunctionTypes;
90 
91  //Elements
92  std::string configParametersId;
93  std::string variablesId;
94  std::string linkParametersId;
95  std::vector<PFunction> alternativeFunctions;
96 
97  //Helpers
102 
105 protected:
107 };
108 }
109 }
110 
111 #endif
uint32_t channel
Definition: Function.h:65
This is the base library main class.
Definition: BaseLib.h:95
std::map< uint32_t, PFunction > Functions
Definition: Function.h:47
std::shared_ptr< ConfigParameters > PConfigParameters
Definition: ParameterGroup.h:52
PConfigParameters configParameters
Definition: Function.h:99
bool encryptionEnabledByDefault
Definition: Function.h:70
bool visible
Definition: Function.h:71
std::unordered_map< std::string, BaseLib::PVariable > linkSenderAttributes
Definition: Function.h:86
PLinkParameters linkParameters
Definition: Function.h:101
Class defining a device function or channel.
Definition: Function.h:52
Definition: BaseLib.cpp:34
bool grouped
Definition: Function.h:78
std::string linkParametersId
Definition: Function.h:94
int32_t physicalChannelIndexOffset
Definition: Function.h:77
std::unordered_map< std::string, BaseLib::PVariable > linkReceiverAttributes
Definition: Function.h:87
PVariables variables
Definition: Function.h:100
std::string configParametersId
Definition: Function.h:92
virtual ~Function()
Definition: Function.h:62
std::string defaultLinkScenarioElementId
Definition: Function.h:81
BaseLib::SharedObjects * _bl
Definition: Function.h:106
Direction::Enum direction
Definition: Function.h:79
std::set< std::string > LinkFunctionTypes
Definition: Function.h:43
bool parameterSetDefined(ParameterGroup::Type::Enum type)
Definition: Function.cpp:138
std::string defaultGroupedLinkScenarioElementId1
Definition: Function.h:82
std::shared_ptr< ParameterGroup > PParameterGroup
Definition: Parameter.h:52
int32_t dynamicChannelCountIndex
Definition: Function.h:75
LinkFunctionTypes linkReceiverFunctionTypes
Definition: Function.h:89
std::string defaultGroupedLinkScenarioElementId2
Definition: Function.h:83
std::shared_ptr< Function > PFunction
Definition: Function.h:46
std::string groupId
Definition: Function.h:85
PParameterGroup getParameterGroup(ParameterGroup::Type::Enum type)
Definition: Function.cpp:143
std::vector< PFunction > alternativeFunctions
Definition: Function.h:95
Function(BaseLib::SharedObjects *baseLib)
Definition: Function.cpp:39
bool hasGroup
Definition: Function.h:84
std::string countFromVariable
Definition: Function.h:74
std::string variablesId
Definition: Function.h:93
std::string type
Definition: Function.h:66
std::shared_ptr< LinkParameters > PLinkParameters
Definition: ParameterGroup.h:53
Class representing a node of XML document.
Definition: rapidxml.h:539
LinkFunctionTypes linkSenderFunctionTypes
Definition: Function.h:88
std::shared_ptr< Parameter > PParameter
Definition: Parameter.h:55
std::shared_ptr< Variables > PVariables
Definition: ParameterGroup.h:54
PParameter parameterGroupSelector
Definition: Function.h:98
bool forceEncryption
Definition: Function.h:80
uint32_t channelCount
Definition: Function.h:67
double dynamicChannelCountSize
Definition: Function.h:76
bool deletable
Definition: Function.h:72