18 #include <unordered_map>
20 #include "UniSetObject.h"
23 #include "DebugStream.h"
24 #include "LogServer.h"
25 #include "LogAgregator.h"
46 inline std::shared_ptr<DebugStream> log() noexcept {
return mylog; }
47 inline std::shared_ptr<uniset::LogAgregator> logAgregator() noexcept {
return loga; }
49 void init_dlog( std::shared_ptr<DebugStream> d ) noexcept;
53 #define myinfo if( log()->debugging(Debug::INFO) ) log()->info()
56 #define mywarn if( log()->debugging(Debug::WARN) ) log()->warn()
59 #define mycrit if( log()->debugging(Debug::CRIT) ) log()->crit()
62 #define mylog1 if( log()->debugging(Debug::LEVEL1) ) log()->level1()
65 #define mylog2 if( log()->debugging(Debug::LEVEL2) ) log()->level2()
68 #define mylog3 if( log()->debugging(Debug::LEVEL3) ) log()->level3()
71 #define mylog4 if( log()->debugging(Debug::LEVEL4) ) log()->level4()
74 #define mylog5 if( log()->debugging(Debug::LEVEL5) ) log()->level5()
77 #define mylog6 if( log()->debugging(Debug::LEVEL6) ) log()->level6()
80 #define mylog7 if( log()->debugging(Debug::LEVEL7) ) log()->level7()
83 #define mylog8 if( log()->debugging(Debug::LEVEL8) ) log()->level8()
86 #define mylog9 if( log()->debugging(Debug::LEVEL9) ) log()->level9()
89 #define mylogany log()->any()
92 #define vmonit( var ) vmon.add( #var, var )
121 std::string help() noexcept;
124 #ifndef DISABLE_REST_API
126 virtual Poco::JSON::Object::Ptr httpGet(
const Poco::URI::QueryParameters& p )
override;
127 virtual Poco::JSON::Object::Ptr httpRequest(
const std::string& req,
const Poco::URI::QueryParameters& p )
override;
128 virtual Poco::JSON::Object::Ptr httpHelp(
const Poco::URI::QueryParameters& p )
override;
153 virtual void callback() noexcept override;
155 virtual
void sysCommand( const uniset::SystemMessage* sm ){};
156 virtual void askSensors( UniversalIO::UIOCommand cmd ){}
159 virtual void sigterm(
int signo )
override;
163 #ifndef DISABLE_REST_API
165 virtual Poco::JSON::Object::Ptr httpDumpIO();
166 virtual Poco::JSON::Object::Ptr httpRequestLog(
const Poco::URI::QueryParameters& p );
170 virtual void step(){}
172 void preAskSensors( UniversalIO::UIOCommand cmd );
175 virtual void testMode(
bool state );
176 void updateOutputs(
bool force );
189 const std::string argprefix;
204 std::atomic_bool activated;
212 std::shared_ptr<uniset::LogAgregator> loga;
213 std::shared_ptr<DebugStream> mylog;
214 std::shared_ptr<uniset::LogServer> logserv;
215 std::string logserv_host = {
""};
216 int logserv_port = {0};
236 void updatePreviousValues() noexcept;
237 void preSensorInfo( const uniset::SensorMessage* sm );
238 void preTimerInfo( const uniset::TimerMessage* tm );
248 return std::hash<long>()(key);
252 std::unordered_map<const uniset::ObjectId,size_t, StatHashFn> smStat;
253 size_t processingMessageCatchCount = { 0 };
255 std::string ostate = {
"" };
262 #endif // UObject_SK_H_