31 #ifndef SERVICEMESSAGES_H_ 32 #define SERVICEMESSAGES_H_ 34 #include "../Variable.h" 35 #include "../Encoding/BinaryEncoder.h" 36 #include "../Encoding/BinaryDecoder.h" 37 #include "../IEvents.h" 38 #include "../Database/DatabaseTypes.h" 39 #include "../Sockets/RpcClientInfo.h" 54 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<Variable>>> &values) = 0;
55 virtual void onRPCEvent(std::string &source, uint64_t peerId, int32_t channel, std::string &deviceAddress, std::shared_ptr<std::vector<std::string>> &valueKeys, std::shared_ptr<std::vector<std::shared_ptr<Variable>>> &values) = 0;
57 virtual void onSaveParameter(std::string
name, uint32_t channel, std::vector<uint8_t> &data) = 0;
74 virtual bool set(std::string
id,
bool value);
76 virtual std::shared_ptr<Variable>
get(
const PRpcClientInfo &clientInfo,
bool returnId,
const std::string &language);
83 virtual void setUnreach(
bool value,
bool requeue);
85 virtual void checkUnreach(int32_t cyclicTimeout, int64_t lastPacketReceived);
91 int64_t timestamp = 0;
113 std::map<uint32_t, std::map<std::string, ErrorInfo>>
_errors;
118 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);
119 virtual void raiseRPCEvent(std::string &source, uint64_t peerId, int32_t channel, std::string &deviceAddress, std::shared_ptr<std::vector<std::string>> &valueKeys, std::shared_ptr<std::vector<std::shared_ptr<Variable>>> &values);
virtual void save(ServiceMessagePriority priority, int64_t timestamp, uint32_t index, bool value)
Definition: ServiceMessages.cpp:144
bool _lowbat
Definition: ServiceMessages.h:109
virtual std::shared_ptr< Database::DataTable > onGetServiceMessages()=0
virtual void raiseRPCEvent(std::string &source, uint64_t peerId, int32_t channel, std::string &deviceAddress, std::shared_ptr< std::vector< std::string >> &valueKeys, std::shared_ptr< std::vector< std::shared_ptr< Variable >>> &values)
Definition: ServiceMessages.cpp:57
virtual void load()
Definition: ServiceMessages.cpp:88
std::string _peerSerial
Definition: ServiceMessages.h:98
This is the base library main class.
Definition: BaseLib.h:95
bool _stickyUnreach
Definition: ServiceMessages.h:107
Definition: ServiceMessages.h:50
int32_t id
Definition: FileDescriptorManager.h:53
virtual void onEnqueuePendingQueues()=0
ServiceMessages(BaseLib::SharedObjects *baseLib, uint64_t peerId, std::string peerSerial, IServiceEventSink *eventHandler)
Definition: ServiceMessages.cpp:36
Definition: BaseLib.cpp:34
int64_t _stickyUnreachTime
Definition: ServiceMessages.h:108
virtual void onConfigPending(bool configPending)=0
virtual void onSaveServiceMessage(Database::DataRow &data)=0
virtual void resetConfigPendingSetTime()
Definition: ServiceMessages.cpp:617
std::shared_ptr< RpcClientInfo > PRpcClientInfo
Definition: ScriptInfo.h:47
virtual void setUnreach(bool value, bool requeue)
Definition: ServiceMessages.cpp:652
virtual std::shared_ptr< Database::DataTable > raiseGetServiceMessages()
Definition: ServiceMessages.cpp:69
virtual ~ServiceMessages()
Definition: ServiceMessages.cpp:44
bool _configPending
Definition: ServiceMessages.h:100
int64_t _configPendingTime
Definition: ServiceMessages.h:101
virtual void raiseDeleteServiceMessage(uint64_t databaseID)
Definition: ServiceMessages.cpp:79
int32_t _unreachResendCounter
Definition: ServiceMessages.h:103
Definition: ServiceMessages.h:47
PVariable value
Definition: UiElements.h:217
virtual void raiseSaveServiceMessage(Database::DataRow &data)
Definition: ServiceMessages.cpp:74
virtual int64_t getConfigPendingSetTime()
Definition: ServiceMessages.h:81
int32_t channel
Definition: UiElements.h:215
BaseLib::SharedObjects * _bl
Definition: ServiceMessages.h:95
std::map< uint32_t, std::map< std::string, ErrorInfo > > _errors
Definition: ServiceMessages.h:113
std::map< uint32_t, uint32_t > _variableDatabaseIDs
Definition: ServiceMessages.h:96
virtual void raiseServiceMessageEvent(const PServiceMessage &serviceMessage)
Definition: ServiceMessages.cpp:61
virtual void setConfigPending(bool value)
Definition: ServiceMessages.cpp:626
Definition: ServiceMessages.h:90
uint64_t peerId
Definition: UiElements.h:214
virtual void raiseConfigPending(bool configPending)
Definition: ServiceMessages.cpp:49
int64_t last_unreach_event_
Definition: ServiceMessages.h:106
virtual void setPeerId(uint64_t peerId)
Definition: ServiceMessages.h:68
int64_t _unreachTime
Definition: ServiceMessages.h:105
bool _unreach
Definition: ServiceMessages.h:104
bool _disposing
Definition: ServiceMessages.h:99
virtual void onDeleteServiceMessage(uint64_t databaseID)=0
static int64_t getTime()
Gets the current unix time stamp in milliseconds.
Definition: HelperFunctions.cpp:73
ServiceMessagePriority
Definition: ServiceMessage.h:45
virtual void endUnreach()
Definition: ServiceMessages.cpp:577
virtual bool getLowbat()
Definition: ServiceMessages.h:88
virtual void raiseEnqueuePendingQueues()
Definition: ServiceMessages.cpp:83
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< Variable >>> &values)=0
virtual void raiseSaveParameter(std::string name, uint32_t channel, std::vector< uint8_t > &data)
Definition: ServiceMessages.cpp:65
virtual void onSaveParameter(std::string name, uint32_t channel, std::vector< uint8_t > &data)=0
virtual void checkUnreach(int32_t cyclicTimeout, int64_t lastPacketReceived)
Definition: ServiceMessages.cpp:527
std::string name
Definition: UiElements.h:216
int64_t _lowbatTime
Definition: ServiceMessages.h:110
virtual void onServiceMessageEvent(const PServiceMessage &serviceMessage)=0
virtual void setPeerSerial(std::string peerSerial)
Definition: ServiceMessages.h:69
std::mutex _errorMutex
Definition: ServiceMessages.h:112
int64_t _configPendingSetTime
Definition: ServiceMessages.h:102
virtual void onRPCEvent(std::string &source, uint64_t peerId, int32_t channel, std::string &deviceAddress, std::shared_ptr< std::vector< std::string >> &valueKeys, std::shared_ptr< std::vector< std::shared_ptr< Variable >>> &values)=0
uint64_t _peerId
Definition: ServiceMessages.h:97
virtual bool getUnreach()
Definition: ServiceMessages.h:84
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)
Definition: ServiceMessages.cpp:53
std::shared_ptr< ServiceMessage > PServiceMessage
Definition: ServiceMessage.h:74
std::deque< std::shared_ptr< DataColumn > > DataRow
Type definition to easily create a DataRow.
Definition: DatabaseTypes.h:181
virtual bool getConfigPending()
Definition: ServiceMessages.h:79