libhomegear-base  0.7
Base library for Homegear and Homegear family modules.
ICentral.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 ICENTRAL_H_
32 #define ICENTRAL_H_
33 
34 #include "../Variable.h"
35 #include "../IEvents.h"
36 #include "../DeviceDescription/HomegearDevice.h"
37 #include "../Sockets/RpcClientInfo.h"
38 #include "IPhysicalInterface.h"
39 #include "Peer.h"
40 
41 #include <set>
42 
43 using namespace BaseLib::DeviceDescription;
44 
45 namespace BaseLib {
46 
47 namespace Systems {
48 
50  public:
51  struct PairingState {
52  uint64_t peerId = 0;
53  std::string state;
54  std::string messageId;
55  std::list<std::string> variables;
56  };
57  typedef std::shared_ptr<PairingState> PPairingState;
58 
59  struct PairingMessage {
60  std::string messageId;
61  std::list<std::string> variables;
62 
63  PairingMessage(std::string messageId) {
64  this->messageId = messageId;
65  }
66 
67  PairingMessage(std::string messageId, std::list<std::string> variables) {
68  this->messageId = messageId;
69  this->variables = variables;
70  }
71  };
72  typedef std::shared_ptr<PairingMessage> PPairingMessage;
73 
74  //Event handling
76  public:
77  //Hooks
78  virtual void onAddWebserverEventHandler(BaseLib::Rpc::IWebserverEventSink *eventHandler, std::map<int32_t, PEventHandler> &eventHandlers) = 0;
79  virtual void onRemoveWebserverEventHandler(std::map<int32_t, PEventHandler> &eventHandlers) = 0;
80 
81  virtual void onRPCEvent(std::string &source, uint64_t id, int32_t channel, std::string &deviceAddress, std::shared_ptr<std::vector<std::string>> &valueKeys, std::shared_ptr<std::vector<PVariable>> &values) = 0;
82  virtual void onRPCUpdateDevice(uint64_t id, int32_t channel, std::string address, int32_t hint) = 0;
83  virtual void onRPCNewDevices(std::vector<uint64_t> &ids, PVariable deviceDescriptions) = 0;
84  virtual void onRPCDeleteDevices(std::vector<uint64_t> &ids, PVariable deviceAddresses, PVariable deviceInfo) = 0;
85  virtual void onEvent(std::string &source, uint64_t peerId, int32_t channel, std::shared_ptr<std::vector<std::string>> &variables, std::shared_ptr<std::vector<std::shared_ptr<BaseLib::Variable>>> &values) = 0;
86  virtual void onServiceMessageEvent(const PServiceMessage &serviceMessage) = 0;
87  virtual void onRunScript(ScriptEngine::PScriptInfo &scriptInfo, bool wait) = 0;
88  virtual BaseLib::PVariable onInvokeRpc(std::string &methodName, BaseLib::PArray &parameters) = 0;
89  virtual uint64_t onGetRoomIdByName(std::string &name) = 0;
90  };
91  //End event handling
92 
93  ICentral(int32_t deviceFamily, BaseLib::SharedObjects *baseLib, ICentralEventSink *eventHandler);
94  ICentral(int32_t deviceFamily, BaseLib::SharedObjects *baseLib, uint32_t deviceId, std::string serialNumber, int32_t address, ICentralEventSink *eventHandler);
95  virtual ~ICentral();
96  virtual void dispose(bool wait = true);
97 
98  virtual void load();
99  virtual void save(bool full);
100 
101  /*
102  * Executed when Homegear is fully started.
103  */
104  virtual void homegearStarted();
105 
106  /*
107  * Executed before Homegear starts shutting down.
108  */
109  virtual void homegearShuttingDown();
110 
111  virtual int32_t deviceFamily();
112 
113  std::shared_ptr<DeviceTranslations> getTranslations() { return _translations; }
114  virtual int32_t getAddress() { return _address; }
115  virtual uint64_t getId() { return _deviceId; }
116  virtual std::string getSerialNumber() { return _serialNumber; }
117  virtual std::string handleCliCommand(std::string command) { return ""; }
118  std::vector<std::shared_ptr<Peer>> getPeers();
119  std::shared_ptr<Peer> getPeer(int32_t address);
120  std::shared_ptr<Peer> getPeer(uint64_t id);
121  std::shared_ptr<Peer> getPeer(std::string serialNumber);
122 
123  virtual bool peerExists(int32_t address);
124  virtual bool peerExists(std::string serialNumber);
125  virtual bool peerExists(uint64_t id);
126  virtual uint64_t getPeerIdFromSerial(std::string &serialNumber);
127 
128  virtual PVariable activateLinkParamset(PRpcClientInfo clientInfo, std::string serialNumber, int32_t channel, std::string remoteSerialNumber, int32_t remoteChannel, bool longPress) {
129  return Variable::createError(-32601,
130  "Method not implemented for this central.");
131  }
132  virtual PVariable activateLinkParamset(PRpcClientInfo clientInfo, uint64_t peerId, int32_t channel, uint64_t remoteId, int32_t remoteChannel, bool longPress) { return Variable::createError(-32601, "Method not implemented for this central."); }
133  virtual PVariable addCategoryToChannel(PRpcClientInfo clientInfo, uint64_t peerId, int32_t channel, uint64_t categoryId);
134  virtual PVariable addDevice(PRpcClientInfo clientInfo, std::string serialNumber) { return Variable::createError(-32601, "Method not implemented for this central."); }
135  virtual PVariable addChannelToBuildingPart(PRpcClientInfo clientInfo, uint64_t peerId, int32_t channel, uint64_t buildingPartId);
136  virtual PVariable addChannelToRoom(PRpcClientInfo clientInfo, uint64_t peerId, int32_t channel, uint64_t roomId);
137  virtual PVariable addLink(PRpcClientInfo clientInfo, std::string senderSerialNumber, int32_t senderChannel, std::string receiverSerialNumber, int32_t receiverChannel, std::string name, std::string description) {
138  return Variable::createError(-32601,
139  "Method not implemented for this central.");
140  }
141  virtual PVariable addLink(PRpcClientInfo clientInfo, uint64_t senderId, int32_t senderChannel, uint64_t receiverId, int32_t receiverChannel, std::string name, std::string description) {
142  return Variable::createError(-32601,
143  "Method not implemented for this central.");
144  }
145  virtual PVariable createDevice(PRpcClientInfo clientInfo, int32_t deviceType, std::string serialNumber, int32_t address, int32_t firmwareVersion, std::string interfaceId) {
146  return Variable::createError(-32601,
147  "Method not implemented for this central.");
148  }
149  virtual PVariable createDevice(PRpcClientInfo clientInfo, const std::string &code) { return Variable::createError(-32601, "Method not implemented for this central."); }
150  virtual PVariable deleteDevice(PRpcClientInfo clientInfo, std::string serialNumber, int32_t flags) { return Variable::createError(-32601, "Method not implemented for this central."); }
151  virtual PVariable deleteDevice(PRpcClientInfo clientInfo, uint64_t peerId, int32_t flags) { return Variable::createError(-32601, "Method not implemented for this central."); }
152  virtual PVariable getAllConfig(PRpcClientInfo clientInfo, uint64_t peerId, bool checkAcls);
153  virtual PVariable getAllValues(PRpcClientInfo clientInfo, BaseLib::PArray peerIds, bool returnWriteOnly, bool checkAcls);
154  virtual PVariable getChannelsInBuildingPart(PRpcClientInfo clientInfo, uint64_t buildingPartId, bool checkAcls);
155  virtual PVariable getChannelsInCategory(PRpcClientInfo clientInfo, uint64_t categoryId, bool checkAcls);
156  virtual PVariable getChannelsInRoom(PRpcClientInfo clientInfo, uint64_t roomId, bool checkAcls);
157  virtual PVariable getConfigParameter(PRpcClientInfo clientInfo, std::string serialNumber, uint32_t channel, std::string name);
158  virtual PVariable getConfigParameter(PRpcClientInfo clientInfo, uint64_t peerId, uint32_t channel, std::string name);
159  virtual PVariable getDeviceDescription(PRpcClientInfo clientInfo, std::string serialNumber, int32_t channel, std::map<std::string, bool> fields);
160  virtual PVariable getDeviceDescription(PRpcClientInfo clientInfo, uint64_t id, int32_t channel, std::map<std::string, bool> fields);
161  virtual PVariable getDeviceInfo(PRpcClientInfo clientInfo, uint64_t id, std::map<std::string, bool> fields, bool checkAcls);
162  virtual PVariable getDevicesInBuildingPart(PRpcClientInfo clientInfo, uint64_t buildingPartId, bool checkAcls);
163  virtual PVariable getDevicesInCategory(PRpcClientInfo clientInfo, uint64_t categoryId, bool checkAcls);
164  virtual PVariable getDevicesInRoom(PRpcClientInfo clientInfo, uint64_t roomId, bool checkAcls);
165  virtual PVariable getPeerId(PRpcClientInfo clientInfo, int32_t filterType, std::string filterValue, bool checkAcls);
166  virtual PVariable getPeerId(PRpcClientInfo clientInfo, int32_t address);
167  virtual PVariable getPeerId(PRpcClientInfo clientInfo, std::string serialNumber);
168  virtual PVariable getInstallMode(PRpcClientInfo clientInfo);
169  virtual PVariable getLinkInfo(PRpcClientInfo clientInfo, std::string senderSerialNumber, int32_t senderChannel, std::string receiverSerialNumber, int32_t receiverChannel);
170  virtual PVariable getLinkInfo(PRpcClientInfo clientInfo, uint64_t senderId, int32_t senderChannel, uint64_t receiverId, int32_t receiverChannel);
171  virtual PVariable getLinkPeers(PRpcClientInfo clientInfo, std::string serialNumber, int32_t channel);
172  virtual PVariable getLinkPeers(PRpcClientInfo clientInfo, uint64_t peerId, int32_t channel);
173  virtual PVariable getLinks(PRpcClientInfo clientInfo, std::string serialNumber, int32_t channel, int32_t flags);
174  virtual PVariable getLinks(PRpcClientInfo clientInfo, uint64_t peerId, int32_t channel, int32_t flags, bool checkAcls);
175  virtual PVariable getName(PRpcClientInfo clientInfo, uint64_t id, int32_t channel);
176  virtual PVariable getPairingState(PRpcClientInfo clientInfo);
177  virtual PVariable getParamsetDescription(PRpcClientInfo clientInfo, std::string serialNumber, int32_t channel, ParameterGroup::Type::Enum type, std::string remoteSerialNumber, int32_t remoteChannel);
178  virtual PVariable getParamsetDescription(PRpcClientInfo clientInfo, uint64_t peerId, int32_t channel, ParameterGroup::Type::Enum type, uint64_t remoteId, int32_t remoteChannel, bool checkAcls);
179  virtual PVariable getParamsetId(PRpcClientInfo clientInfo, std::string serialNumber, uint32_t channel, ParameterGroup::Type::Enum type, std::string remoteSerialNumber, int32_t remoteChannel);
180  virtual PVariable getParamsetId(PRpcClientInfo clientInfo, uint64_t peerId, uint32_t channel, ParameterGroup::Type::Enum type, uint64_t remoteId, int32_t remoteChannel);
181  virtual PVariable getParamset(PRpcClientInfo clientInfo, std::string serialNumber, int32_t channel, ParameterGroup::Type::Enum type, std::string remoteSerialNumber, int32_t remoteChannel);
182  virtual PVariable getParamset(PRpcClientInfo clientInfo, uint64_t peerId, int32_t channel, ParameterGroup::Type::Enum type, uint64_t remoteId, int32_t remoteChannel, bool checkAcls);
183  virtual PVariable getRolesInRoom(PRpcClientInfo clientInfo, uint64_t roomId, bool checkDeviceAcls, bool checkVariableAcls);
184  virtual PVariable getServiceMessages(PRpcClientInfo clientInfo, bool returnId, const std::string &language, bool checkAcls);
185  virtual PVariable getSniffedDevices(PRpcClientInfo clientInfo) { return Variable::createError(-32601, "Method not implemented for this central."); }
186  virtual PVariable getValue(PRpcClientInfo clientInfo, std::string serialNumber, uint32_t channel, std::string valueKey, bool requestFromDevice, bool asynchronous);
187  virtual PVariable getValue(PRpcClientInfo clientInfo, uint64_t id, uint32_t channel, std::string valueKey, bool requestFromDevice, bool asynchronous);
188  virtual PVariable getVariableDescription(PRpcClientInfo clientInfo, uint64_t id, uint32_t channel, std::string valueKey, const std::unordered_set<std::string> &fields);
189  virtual PVariable getVariablesInBuildingPart(PRpcClientInfo clientInfo, uint64_t buildingPartId, bool returnDeviceAssigned, bool checkDeviceAcls, bool checkVariableAcls);
190  virtual PVariable getVariablesInCategory(PRpcClientInfo clientInfo, uint64_t categoryId, bool checkDeviceAcls, bool checkVariableAcls);
191  virtual PVariable getVariablesInRole(PRpcClientInfo clientInfo, uint64_t roleId, bool checkDeviceAcls, bool checkVariableAcls);
192  virtual PVariable getVariablesInRoom(PRpcClientInfo clientInfo, uint64_t roomId, bool returnDeviceAssigned, bool checkDeviceAcls, bool checkVariableAcls);
193  virtual PVariable invokeFamilyMethod(PRpcClientInfo clientInfo, std::string &methodName, PArray parameters) { return Variable::createError(-32601, "Method not implemented for this central."); }
194  virtual PVariable listDevices(PRpcClientInfo clientInfo, bool channels, std::map<std::string, bool> fields, bool checkAcls);
195  virtual PVariable listDevices(PRpcClientInfo clientInfo, bool channels, std::map<std::string, bool> fields, std::shared_ptr<std::set<uint64_t>> knownDevices, bool checkAcls);
196  virtual PVariable listTeams(BaseLib::PRpcClientInfo clientInfo, bool checkAcls);
197  virtual PVariable putParamset(PRpcClientInfo clientInfo, std::string serialNumber, int32_t channel, ParameterGroup::Type::Enum type, std::string remoteSerialNumber, int32_t remoteChannel, PVariable paramset);
198  virtual PVariable putParamset(PRpcClientInfo clientInfo, uint64_t peerId, int32_t channel, ParameterGroup::Type::Enum type, uint64_t remoteId, int32_t remoteChannel, PVariable paramset, bool checkAcls);
199  virtual PVariable reportValueUsage(PRpcClientInfo clientInfo, std::string serialNumber);
200  virtual PVariable removeCategoryFromChannel(PRpcClientInfo clientInfo, uint64_t peerId, int32_t channel, uint64_t categoryId);
201  virtual PVariable removeChannelFromBuildingPart(PRpcClientInfo clientInfo, uint64_t peerId, int32_t channel, uint64_t buildingPartId);
202  virtual PVariable removeChannelFromRoom(PRpcClientInfo clientInfo, uint64_t peerId, int32_t channel, uint64_t roomId);
203  virtual PVariable removeLink(PRpcClientInfo clientInfo, std::string senderSerialNumber, int32_t senderChannel, std::string receiverSerialNumber, int32_t receiverChannel) {
204  return Variable::createError(-32601,
205  "Method not implemented for this central.");
206  }
207  virtual PVariable removeLink(PRpcClientInfo clientInfo, uint64_t senderId, int32_t senderChannel, uint64_t receiverId, int32_t receiverChannel) { return Variable::createError(-32601, "Method not implemented for this central."); }
208  virtual PVariable rssiInfo(PRpcClientInfo clientInfo, bool checkAcls);
209  virtual PVariable searchDevices(PRpcClientInfo clientInfo, const std::string &interfaceId) { return Variable::createError(-32601, "Method not implemented for this central."); }
210  virtual PVariable searchInterfaces(PRpcClientInfo clientInfo, PVariable metadata) { return Variable::createError(-32601, "Method not implemented for this central."); }
211 
220  virtual std::shared_ptr<BaseLib::Variable> setId(PRpcClientInfo clientInfo, uint64_t oldPeerId, uint64_t newPeerId);
221  virtual std::shared_ptr<BaseLib::Variable> setSerialNumber(PRpcClientInfo clientInfo, uint64_t peer_id, const std::string &new_serial_number);
222  virtual PVariable setInstallMode(PRpcClientInfo clientInfo, bool on, uint32_t duration, BaseLib::PVariable metadata, bool debugOutput = true) { return Variable::createError(-32601, "Method not implemented for this central."); }
223  virtual PVariable setInterface(PRpcClientInfo clientInfo, uint64_t peerId, std::string interfaceId) { return Variable::createError(-32601, "Method not implemented for this central."); }
224  virtual PVariable setLinkInfo(PRpcClientInfo clientInfo, std::string senderSerialNumber, int32_t senderChannel, std::string receiverSerialNumber, int32_t receiverChannel, std::string name, std::string description);
225  virtual PVariable setLinkInfo(PRpcClientInfo clientInfo, uint64_t senderId, int32_t senderChannel, uint64_t receiverId, int32_t receiverChannel, std::string name, std::string description);
226  virtual PVariable setName(PRpcClientInfo clientInfo, uint64_t id, int32_t channel, std::string name);
227  virtual PVariable setTeam(PRpcClientInfo clientInfo, std::string serialNumber, int32_t channel, std::string teamSerialNumber, int32_t teamChannel, bool force = false, bool burst = true) {
228  return Variable::createError(-32601,
229  "Method not implemented for this central.");
230  }
231  virtual PVariable setTeam(PRpcClientInfo clientInfo, uint64_t peerId, int32_t channel, uint64_t teamId, int32_t teamChannel, bool force = false, bool burst = true) {
232  return Variable::createError(-32601,
233  "Method not implemented for this central.");
234  }
235  virtual PVariable setValue(PRpcClientInfo clientInfo, std::string serialNumber, uint32_t channel, std::string valueKey, PVariable value, bool wait);
236  virtual PVariable setValue(PRpcClientInfo clientInfo, uint64_t id, uint32_t channel, std::string valueKey, PVariable value, bool wait);
237  virtual PVariable startSniffing(PRpcClientInfo clientInfo) { return Variable::createError(-32601, "Method not implemented for this central."); }
238  virtual PVariable stopSniffing(PRpcClientInfo clientInfo) { return Variable::createError(-32601, "Method not implemented for this central."); }
239  virtual PVariable updateFirmware(PRpcClientInfo clientInfo, std::vector<uint64_t> ids, bool manual) { return Variable::createError(-32601, "Method not implemented for this central."); }
240  protected:
241  BaseLib::SharedObjects *_bl = nullptr;
242  int32_t _deviceFamily = -1;
243  uint64_t _deviceId = 0;
244  int32_t _address = 0;
245  std::string _serialNumber;
246  std::map<uint32_t, uint32_t> _variableDatabaseIds;
247  std::atomic_bool _initialized;
248  std::atomic_bool _disposing;
249 
250  std::shared_ptr<DeviceDescription::DeviceTranslations> _translations;
251  std::unordered_map<int32_t, std::shared_ptr<Peer>> _peers;
252  std::unordered_map<std::string, std::shared_ptr<Peer>> _peersBySerial;
253  std::map<uint64_t, std::shared_ptr<Peer>> _peersById;
254  std::mutex _peersMutex;
255 
256  std::atomic_bool _pairing;
257  std::atomic_int _timeLeftInPairingMode;
258  std::mutex _newPeersMutex;
259  std::map<int64_t, std::list<PPairingState>> _newPeers;
260  std::list<PPairingMessage> _pairingMessages;
261 
262  //Event handling
263  std::map<std::string, PEventHandler> _physicalInterfaceEventhandlers;
264 
265  ICentral(const ICentral &);
266  ICentral &operator=(const ICentral &);
267 
268  //Hooks
269  virtual void raiseAddWebserverEventHandler(BaseLib::Rpc::IWebserverEventSink *eventHandler, std::map<int32_t, PEventHandler> &eventHandlers);
270  virtual void raiseRemoveWebserverEventHandler(std::map<int32_t, PEventHandler> &eventHandlers);
271 
272  virtual void raiseRPCEvent(std::string &source, uint64_t id, int32_t channel, std::string &deviceAddress, std::shared_ptr<std::vector<std::string>> &valueKeys, std::shared_ptr<std::vector<PVariable>> &values);
273  virtual void raiseRPCUpdateDevice(uint64_t id, int32_t channel, std::string address, int32_t hint);
274  virtual void raiseRPCNewDevices(std::vector<uint64_t> &ids, PVariable deviceDescriptions);
275  virtual void raiseRPCDeleteDevices(std::vector<uint64_t> &ids, PVariable deviceAddresses, PVariable deviceInfo);
276  virtual void raiseEvent(std::string &source, uint64_t peerID, int32_t channel, std::shared_ptr<std::vector<std::string>> &variables, std::shared_ptr<std::vector<std::shared_ptr<BaseLib::Variable>>> &values);
277  virtual void raiseServiceMessageEvent(const PServiceMessage &serviceMessage);
278  virtual void raiseRunScript(ScriptEngine::PScriptInfo &scriptInfo, bool wait);
279  virtual BaseLib::PVariable raiseInvokeRpc(std::string &methodName, BaseLib::PArray &parameters);
280  virtual uint64_t raiseGetRoomIdByName(std::string &name);
281  //End event handling
282 
283  //Physical device event handling
284  bool onPacketReceived(std::string &senderID, std::shared_ptr<Packet> packet) override = 0;
285  //End physical device event handling
286 
287  // {{{ Peer event handling
288  //Hooks
289  void onAddWebserverEventHandler(BaseLib::Rpc::IWebserverEventSink *eventHandler, std::map<int32_t, PEventHandler> &eventHandlers) override;
290  void onRemoveWebserverEventHandler(std::map<int32_t, PEventHandler> &eventHandlers) override;
291 
292  void onRPCEvent(std::string &source, uint64_t id, int32_t channel, std::string &deviceAddress, std::shared_ptr<std::vector<std::string>> &valueKeys, std::shared_ptr<std::vector<PVariable>> &values) override;
293  void onRPCUpdateDevice(uint64_t id, int32_t channel, std::string address, int32_t hint) override;
294  void onEvent(std::string &source, uint64_t peerID, int32_t channel, std::shared_ptr<std::vector<std::string>> &variables, std::shared_ptr<std::vector<std::shared_ptr<BaseLib::Variable>>> &values) override;
295  void onServiceMessageEvent(const PServiceMessage &serviceMessage) override;
296  void onRunScript(ScriptEngine::PScriptInfo &scriptInfo, bool wait) override;
297  BaseLib::PVariable onInvokeRpc(std::string &methodName, BaseLib::PArray &parameters) override;
298  // }}}
299 
300  virtual void setPeerId(uint64_t oldPeerId, uint64_t newPeerId);
301  virtual void setPeerSerialNumber(const std::string &old_serial_number, const std::string &new_serial_number);
302  virtual void deletePeersFromDatabase();
303  virtual void loadVariables() = 0;
304  virtual void loadPeers() {}
305  virtual void savePeers(bool full) {}
306  virtual void saveVariables() = 0;
307  virtual void saveVariable(uint32_t index, int64_t intValue);
308  virtual void saveVariable(uint32_t index, std::string &stringValue);
309  virtual void saveVariable(uint32_t index, std::vector<uint8_t> &binaryValue);
310  private:
311  /*
312  * Used for default implementation of getPairingState.
313  */
314  std::map<int64_t, std::list<PPairingState>> _newPeersDefault;
315 };
316 
317 }
318 }
319 #endif /* CENTRAL_H_ */
std::string messageId
Definition: ICentral.h:54
std::list< std::string > variables
Definition: ICentral.h:55
virtual PVariable removeLink(PRpcClientInfo clientInfo, std::string senderSerialNumber, int32_t senderChannel, std::string receiverSerialNumber, int32_t receiverChannel)
Definition: ICentral.h:203
Definition: BinaryPayload.cpp:36
virtual PVariable setTeam(PRpcClientInfo clientInfo, uint64_t peerId, int32_t channel, uint64_t teamId, int32_t teamChannel, bool force=false, bool burst=true)
Definition: ICentral.h:231
std::unordered_map< std::string, std::shared_ptr< Peer > > _peersBySerial
Definition: ICentral.h:252
int32_t deviceId
Definition: Licensing.h:381
virtual PVariable deleteDevice(PRpcClientInfo clientInfo, std::string serialNumber, int32_t flags)
Definition: ICentral.h:150
std::mutex _peersMutex
Definition: ICentral.h:254
std::shared_ptr< PairingState > PPairingState
Definition: ICentral.h:57
Definition: IEvents.h:72
This is the base library main class.
Definition: BaseLib.h:95
virtual PVariable searchInterfaces(PRpcClientInfo clientInfo, PVariable metadata)
Definition: ICentral.h:210
std::list< PPairingMessage > _pairingMessages
Definition: ICentral.h:260
std::map< int64_t, std::list< PPairingState > > _newPeers
Definition: ICentral.h:259
Definition: BaseLib.cpp:34
virtual PVariable activateLinkParamset(PRpcClientInfo clientInfo, std::string serialNumber, int32_t channel, std::string remoteSerialNumber, int32_t remoteChannel, bool longPress)
Definition: ICentral.h:128
virtual std::string handleCliCommand(std::string command)
Definition: ICentral.h:117
virtual std::string getSerialNumber()
Definition: ICentral.h:116
std::shared_ptr< Array > PArray
Definition: Variable.h:72
std::shared_ptr< RpcClientInfo > PRpcClientInfo
Definition: ScriptInfo.h:47
std::map< uint64_t, std::shared_ptr< Peer > > _peersById
Definition: ICentral.h:253
std::mutex _newPeersMutex
Definition: ICentral.h:258
std::shared_ptr< DeviceDescription::DeviceTranslations > _translations
Definition: ICentral.h:250
virtual PVariable updateFirmware(PRpcClientInfo clientInfo, std::vector< uint64_t > ids, bool manual)
Definition: ICentral.h:239
std::shared_ptr< ScriptInfo > PScriptInfo
Definition: ScriptInfo.h:56
std::list< std::string > variables
Definition: ICentral.h:61
PVariable value
Definition: UiElements.h:217
std::string _serialNumber
Definition: ICentral.h:245
virtual PVariable startSniffing(PRpcClientInfo clientInfo)
Definition: ICentral.h:237
virtual PVariable setInterface(PRpcClientInfo clientInfo, uint64_t peerId, std::string interfaceId)
Definition: ICentral.h:223
virtual PVariable addLink(PRpcClientInfo clientInfo, std::string senderSerialNumber, int32_t senderChannel, std::string receiverSerialNumber, int32_t receiverChannel, std::string name, std::string description)
Definition: ICentral.h:137
std::shared_ptr< Variable > PVariable
Definition: PhysicalInterfaceSettings.h:41
int32_t channel
Definition: UiElements.h:215
virtual PVariable setTeam(PRpcClientInfo clientInfo, std::string serialNumber, int32_t channel, std::string teamSerialNumber, int32_t teamChannel, bool force=false, bool burst=true)
Definition: ICentral.h:227
std::atomic_bool _initialized
Definition: ICentral.h:247
virtual PVariable getSniffedDevices(PRpcClientInfo clientInfo)
Definition: ICentral.h:185
std::atomic_bool _pairing
Definition: ICentral.h:256
Definition: ICentral.h:49
uint64_t peerId
Definition: UiElements.h:214
virtual PVariable stopSniffing(PRpcClientInfo clientInfo)
Definition: ICentral.h:238
virtual PVariable removeLink(PRpcClientInfo clientInfo, uint64_t senderId, int32_t senderChannel, uint64_t receiverId, int32_t receiverChannel)
Definition: ICentral.h:207
virtual uint64_t getId()
Definition: ICentral.h:115
virtual PVariable setInstallMode(PRpcClientInfo clientInfo, bool on, uint32_t duration, BaseLib::PVariable metadata, bool debugOutput=true)
Definition: ICentral.h:222
static PVariable createError(int32_t faultCode, const std::string &faultString, bool retry=false)
Definition: Variable.cpp:224
std::atomic_bool _disposing
Definition: ICentral.h:248
std::map< uint32_t, uint32_t > _variableDatabaseIds
Definition: ICentral.h:246
std::atomic_int _timeLeftInPairingMode
Definition: ICentral.h:257
PairingMessage(std::string messageId)
Definition: ICentral.h:63
std::unordered_map< int32_t, std::shared_ptr< Peer > > _peers
Definition: ICentral.h:251
std::shared_ptr< PairingMessage > PPairingMessage
Definition: ICentral.h:72
std::string state
Definition: ICentral.h:53
virtual PVariable deleteDevice(PRpcClientInfo clientInfo, uint64_t peerId, int32_t flags)
Definition: ICentral.h:151
virtual PVariable createDevice(PRpcClientInfo clientInfo, int32_t deviceType, std::string serialNumber, int32_t address, int32_t firmwareVersion, std::string interfaceId)
Definition: ICentral.h:145
virtual PVariable createDevice(PRpcClientInfo clientInfo, const std::string &code)
Definition: ICentral.h:149
virtual PVariable searchDevices(PRpcClientInfo clientInfo, const std::string &interfaceId)
Definition: ICentral.h:209
virtual int32_t getAddress()
Definition: ICentral.h:114
This class provides hooks into the web server so get and post requests can be passed into family modu...
Definition: IWebserverEventSink.h:43
std::string name
Definition: UiElements.h:216
virtual void loadPeers()
Definition: ICentral.h:304
std::string messageId
Definition: ICentral.h:60
virtual PVariable invokeFamilyMethod(PRpcClientInfo clientInfo, std::string &methodName, PArray parameters)
Definition: ICentral.h:193
virtual PVariable addLink(PRpcClientInfo clientInfo, uint64_t senderId, int32_t senderChannel, uint64_t receiverId, int32_t receiverChannel, std::string name, std::string description)
Definition: ICentral.h:141
Definition: IEvents.h:66
virtual PVariable activateLinkParamset(PRpcClientInfo clientInfo, uint64_t peerId, int32_t channel, uint64_t remoteId, int32_t remoteChannel, bool longPress)
Definition: ICentral.h:132
virtual void savePeers(bool full)
Definition: ICentral.h:305
std::shared_ptr< DeviceTranslations > getTranslations()
Definition: ICentral.h:113
std::shared_ptr< ServiceMessage > PServiceMessage
Definition: ServiceMessage.h:74
virtual PVariable addDevice(PRpcClientInfo clientInfo, std::string serialNumber)
Definition: ICentral.h:134
PairingMessage(std::string messageId, std::list< std::string > variables)
Definition: ICentral.h:67
std::map< std::string, PEventHandler > _physicalInterfaceEventhandlers
Definition: ICentral.h:263