libhomegear-base  0.7
Base library for Homegear and Homegear family modules.
GlobalServiceMessages.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 GLOBALSERVICEMESSAGES_H_
32 #define GLOBALSERVICEMESSAGES_H_
33 
34 #include "../Variable.h"
35 #include "../Sockets/RpcClientInfo.h"
36 #include "../Encoding/RpcDecoder.h"
37 #include "../Encoding/RpcEncoder.h"
38 #include "ServiceMessage.h"
39 
40 namespace BaseLib {
41 
42 class SharedObjects;
43 
44 namespace Systems {
46  public:
48  virtual ~GlobalServiceMessages();
49 
50  void init(BaseLib::SharedObjects *baseLib);
51  void load();
52 
53  void set(int32_t familyId, const std::string &interface, int32_t messageId, const std::string& messageSubId, ServiceMessagePriority priority, int32_t timestamp, const std::string& message, const std::list<std::string>& variables, const PVariable& data = PVariable(), int64_t value = 0);
54  void unset(int32_t familyId, int32_t messageId, std::string messageSubId, std::string message);
55 
56  std::shared_ptr<Variable> get(PRpcClientInfo clientInfo, const std::string &language);
57  protected:
58  typedef int32_t FamilyId;
59  typedef int32_t MessageId;
60  typedef std::string MessageSubId;
61  typedef std::string MessageType;
62 
64 
65  std::unique_ptr<Rpc::RpcDecoder> _rpcDecoder;
66  std::unique_ptr<Rpc::RpcEncoder> _rpcEncoder;
67 
69  std::unordered_map<FamilyId, std::unordered_map<MessageId, std::unordered_map<MessageSubId, std::unordered_map<MessageType, PServiceMessage>>>> _serviceMessages;
70 };
71 
72 }
73 }
74 #endif
This is the base library main class.
Definition: BaseLib.h:95
void load()
Definition: GlobalServiceMessages.cpp:52
BaseLib::SharedObjects * _bl
Definition: GlobalServiceMessages.h:63
std::unique_ptr< Rpc::RpcDecoder > _rpcDecoder
Definition: GlobalServiceMessages.h:65
Definition: BaseLib.cpp:34
void unset(int32_t familyId, int32_t messageId, std::string messageSubId, std::string message)
Definition: GlobalServiceMessages.cpp:127
std::shared_ptr< RpcClientInfo > PRpcClientInfo
Definition: ScriptInfo.h:47
std::string MessageType
Definition: GlobalServiceMessages.h:61
PVariable value
Definition: UiElements.h:217
virtual ~GlobalServiceMessages()
Definition: GlobalServiceMessages.cpp:42
std::shared_ptr< Variable > PVariable
Definition: PhysicalInterfaceSettings.h:41
int32_t MessageId
Definition: GlobalServiceMessages.h:59
std::string MessageSubId
Definition: GlobalServiceMessages.h:60
std::mutex _serviceMessagesMutex
Definition: GlobalServiceMessages.h:68
int32_t familyId
Definition: Licensing.h:380
ServiceMessagePriority
Definition: ServiceMessage.h:45
void init(BaseLib::SharedObjects *baseLib)
Definition: GlobalServiceMessages.cpp:46
int32_t FamilyId
Definition: GlobalServiceMessages.h:58
std::unordered_map< FamilyId, std::unordered_map< MessageId, std::unordered_map< MessageSubId, std::unordered_map< MessageType, PServiceMessage > > > > _serviceMessages
Definition: GlobalServiceMessages.h:69
std::unique_ptr< Rpc::RpcEncoder > _rpcEncoder
Definition: GlobalServiceMessages.h:66
Definition: GlobalServiceMessages.h:45
GlobalServiceMessages()
Definition: GlobalServiceMessages.cpp:39