libhomegear-base  0.7
Base library for Homegear and Homegear family modules.
DeviceFamily.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 DEVICEFAMILY_H_
32 #define DEVICEFAMILY_H_
33 
34 #include "IDeviceFamily.h"
35 
36 namespace BaseLib {
37 namespace Systems {
38 
39 class DeviceFamily : public IDeviceFamily {
40  public:
41  DeviceFamily(BaseLib::SharedObjects *bl, IFamilyEventSink *eventHandler, int32_t id, std::string name);
42 
43  virtual bool init();
44  virtual void dispose();
45 
46  virtual bool lifetick();
47 
48  virtual std::shared_ptr<DeviceDescription::Devices> getRpcDevices();
49  virtual void load();
50  virtual void save(bool full);
51  virtual std::shared_ptr<ICentral> getCentral();
52  virtual std::string handleCliCommand(std::string &command);
53  virtual bool hasPhysicalInterface();
54  virtual std::shared_ptr<PhysicalInterfaces> physicalInterfaces();
55 
56  /*
57  * Executed when Homegear is fully started.
58  */
59  virtual void homegearStarted();
60 
61  /*
62  * Executed before Homegear starts shutting down.
63  */
64  virtual void homegearShuttingDown();
65 
66  // {{{ RPC
67  virtual std::shared_ptr<Variable> getPairingInfo() = 0;
68  virtual std::shared_ptr<Variable> getParamsetDescription(PRpcClientInfo clientInfo, int32_t deviceId, int32_t firmwareVersion, int32_t channel, ParameterGroup::Type::Enum type);
69  virtual PVariable listKnownDeviceTypes(PRpcClientInfo clientInfo, bool channels, std::set<std::string> &fields);
70  // }}}
71  protected:
72  std::shared_ptr<ICentral> _central;
73  std::shared_ptr<PhysicalInterfaces> _physicalInterfaces;
74 
75  std::shared_ptr<DeviceDescription::Devices> _rpcDevices;
76 
77  virtual std::shared_ptr<ICentral> initializeCentral(uint32_t deviceId, int32_t address, std::string serialNumber) = 0;
78  virtual void createCentral() = 0;
79  private:
80  DeviceFamily(const DeviceFamily &) = delete;
81  DeviceFamily &operator=(const DeviceFamily &) = delete;
82 };
83 
84 }
85 }
86 #endif
Definition: IDeviceFamily.h:58
virtual bool init()
Definition: DeviceFamily.cpp:45
int32_t deviceId
Definition: Licensing.h:381
This is the base library main class.
Definition: BaseLib.h:95
virtual std::string handleCliCommand(std::string &command)
Definition: DeviceFamily.cpp:135
virtual void dispose()
Definition: DeviceFamily.cpp:95
virtual std::shared_ptr< ICentral > initializeCentral(uint32_t deviceId, int32_t address, std::string serialNumber)=0
virtual std::shared_ptr< Variable > getPairingInfo()=0
std::shared_ptr< PhysicalInterfaces > _physicalInterfaces
Definition: DeviceFamily.h:73
Definition: BaseLib.cpp:34
virtual void homegearShuttingDown()
Definition: DeviceFamily.cpp:126
std::shared_ptr< RpcClientInfo > PRpcClientInfo
Definition: ScriptInfo.h:47
FamilyType type()
Definition: IDeviceFamily.cpp:35
std::shared_ptr< ICentral > _central
Definition: DeviceFamily.h:72
Definition: IDeviceFamily.h:79
virtual void save(bool full)
Definition: DeviceFamily.cpp:82
std::shared_ptr< Variable > PVariable
Definition: PhysicalInterfaceSettings.h:41
int32_t channel
Definition: UiElements.h:215
virtual PVariable listKnownDeviceTypes(PRpcClientInfo clientInfo, bool channels, std::set< std::string > &fields)
Definition: DeviceFamily.cpp:158
virtual std::shared_ptr< ICentral > getCentral()
Definition: DeviceFamily.cpp:36
std::shared_ptr< DeviceDescription::Devices > _rpcDevices
Definition: DeviceFamily.h:75
virtual bool lifetick()
Definition: DeviceFamily.cpp:52
virtual void createCentral()=0
virtual void load()
Definition: DeviceFamily.cpp:57
std::string name
Definition: UiElements.h:216
virtual void homegearStarted()
Definition: DeviceFamily.cpp:117
virtual std::shared_ptr< Variable > getParamsetDescription(PRpcClientInfo clientInfo, int32_t deviceId, int32_t firmwareVersion, int32_t channel, ParameterGroup::Type::Enum type)
Definition: DeviceFamily.cpp:148
DeviceFamily(BaseLib::SharedObjects *bl, IFamilyEventSink *eventHandler, int32_t id, std::string name)
Definition: DeviceFamily.cpp:40
Definition: DeviceFamily.h:39
virtual std::shared_ptr< PhysicalInterfaces > physicalInterfaces()
Definition: DeviceFamily.cpp:38
virtual std::shared_ptr< DeviceDescription::Devices > getRpcDevices()
Definition: DeviceFamily.cpp:35
virtual bool hasPhysicalInterface()
Definition: DeviceFamily.cpp:37