18#include <unordered_map>
20#include "UniSetObject.h"
23#include "DebugStream.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 )
127 std::string help() const noexcept;
130#ifndef DISABLE_REST_API
132 virtual Poco::JSON::Object::Ptr httpGet(
const Poco::URI::QueryParameters& p )
override;
133 virtual Poco::JSON::Object::Ptr httpRequest(
const std::string& req,
const Poco::URI::QueryParameters& p )
override;
134 virtual Poco::JSON::Object::Ptr httpHelp(
const Poco::URI::QueryParameters& p )
override;
186 const long& in_d1_check_s;
187 const long& in_d2_check_s;
188 long out_set_d1_check_s;
189 long out_set_d2_check_s;
191 const long& in_check_undef_s;
193 const long& in_t_check_s;
195 const long& in_log_s;
219 virtual
void sysCommand( const
uniset::SystemMessage* sm )
override {}
220 virtual void askSensors( UniversalIO::UIOCommand cmd ) {}
226 virtual std::string
getTypeOfMessage(
int t )
const {
return uniset::strTypeOfMessage(t); }
228#ifndef DISABLE_REST_API
230 virtual Poco::JSON::Object::Ptr httpDumpIO();
231 virtual Poco::JSON::Object::Ptr httpRequestLog(
const Poco::URI::QueryParameters& p );
232 virtual Poco::JSON::Object::Ptr request_params_set(
const std::string& req,
const Poco::URI::QueryParameters& p )
override;
233 virtual Poco::JSON::Object::Ptr request_params_get(
const std::string& req,
const Poco::URI::QueryParameters& p )
override;
236 void preAskSensors( UniversalIO::UIOCommand cmd );
244 virtual void step(){}
246 void updateOutputs(
bool force );
258 const std::string argprefix;
273 std::atomic_bool activated = {
false };
274 std::atomic_bool canceled = {
false };
281 std::shared_ptr<uniset::LogAgregator> loga;
282 std::shared_ptr<DebugStream> mylog;
283 std::shared_ptr<uniset::LogServer> logserv;
284 std::string logserv_host = {
""};
285 int logserv_port = {0};
298 long prev_out_lamp_c;
299 long prev_out_depend_c;
300 long prev_in_d1_check_s;
301 long prev_in_d2_check_s;
302 long prev_out_set_d1_check_s;
303 long prev_out_set_d2_check_s;
304 long prev_out_undef_c;
305 long prev_in_check_undef_s;
306 long prev_out_t_set_c;
307 long prev_in_t_check_s;
314 long priv_in_d1_check_s;
315 long priv_in_d2_check_s;
316 long priv_in_check_undef_s;
317 long priv_in_t_check_s;
325 void updatePreviousValues() noexcept;
329 void preSensorInfo( const
uniset::SensorMessage* sm );
330 void preTimerInfo( const
uniset::TimerMessage* tm );
338 return std::hash<long>()(
key);
342 std::unordered_map<const uniset::ObjectId,size_t, StatHashFn> smStat;
343 size_t processingMessageCatchCount = { 0 };
345 std::unordered_map<long,size_t> msgTypeStat;
347 std::string ostate = {
"" };
Definition MBSlaveTest/TestProc_SK.h:30
long maxHeartBeat
Definition MBSlaveTest/TestProc_SK.h:264
const uniset::ObjectId undef_c
Definition MBSlaveTest/TestProc_SK.h:160
virtual bool activateObject() override
Активизация объекта (переопределяется для необходимых действий после активизации)
const int checkLogTime
Definition MBSlaveTest/TestProc_SK.h:203
const uniset::ObjectId log_s
Definition MBSlaveTest/TestProc_SK.h:175
uniset::PassiveTimer ptStartUpTimeout
Definition MBSlaveTest/TestProc_SK.h:276
const uniset::ObjectId set_d1_check_s
Definition MBSlaveTest/TestProc_SK.h:154
virtual void callback() noexcept override
virtual void processingMessage(const uniset::VoidMessage *msg) override
const uniset::ObjectId d1_check_s
Definition MBSlaveTest/TestProc_SK.h:148
int sleep_msec
Definition MBSlaveTest/TestProc_SK.h:252
virtual void httpGetUserData(Poco::JSON::Object::Ptr &jdata)
Definition MBSlaveTest/TestProc_SK.h:229
std::string msgstr(uniset::ObjectId id, bool showLinkName=true) const
int mbPort
Definition MBSlaveTest/TestProc_SK.h:206
uniset::timeout_t smReadyTimeout
Definition MBSlaveTest/TestProc_SK.h:272
const uniset::ObjectId t_set_c
Definition MBSlaveTest/TestProc_SK.h:166
const uniset::ObjectId log_c
Definition MBSlaveTest/TestProc_SK.h:172
virtual std::string getTypeOfMessage(int t) const
Definition MBSlaveTest/TestProc_SK.h:226
int getIntProp(const std::string &name)
Definition MBSlaveTest/TestProc_SK.h:268
virtual bool deactivateObject() override
Деактивация объекта (переопределяется для необходимых действий при завершении работы)
const int checkWorkingTime
Definition MBSlaveTest/TestProc_SK.h:201
const int mbADDR
Definition MBSlaveTest/TestProc_SK.h:205
const uniset::ObjectId check_undef_s
Definition MBSlaveTest/TestProc_SK.h:163
const uniset::ObjectId lamp_c
Definition MBSlaveTest/TestProc_SK.h:142
std::string strval(uniset::ObjectId id, bool showLinkName=true) const
const std::string mbIP
Definition MBSlaveTest/TestProc_SK.h:204
const uniset::ObjectId on_s
Definition MBSlaveTest/TestProc_SK.h:139
const int checkTime
Definition MBSlaveTest/TestProc_SK.h:202
const uniset::ObjectId depend_c
Definition MBSlaveTest/TestProc_SK.h:145
uniset::timeout_t activateTimeout
Definition MBSlaveTest/TestProc_SK.h:275
const uniset::ObjectId d2_check_s
Definition MBSlaveTest/TestProc_SK.h:151
const std::string getProp(const std::string &name)
Definition MBSlaveTest/TestProc_SK.h:270
bool forceOut
Definition MBSlaveTest/TestProc_SK.h:253
const int changeTime
Definition MBSlaveTest/TestProc_SK.h:200
uniset::ObjectId idHeartBeat
Definition MBSlaveTest/TestProc_SK.h:263
uniset::ObjectId smTestID
Definition MBSlaveTest/TestProc_SK.h:259
const uniset::ObjectId t_check_s
Definition MBSlaveTest/TestProc_SK.h:169
int askPause
Definition MBSlaveTest/TestProc_SK.h:277
std::string str(uniset::ObjectId id, bool showLinkName=true) const
const uniset::ObjectId set_d2_check_s
Definition MBSlaveTest/TestProc_SK.h:157
virtual std::string getMonitInfo() const
Definition MBSlaveTest/TestProc_SK.h:225
xmlNode * confnode
Definition MBSlaveTest/TestProc_SK.h:266
std::string dumpVars()
Definition MBSlaveTest/TestProc_SK.h:125
Пассивный таймер
Definition PassiveTimer.h:94
Definition MessageType.h:127
Definition MessageType.h:171
Definition MessageType.h:214
Definition UniSetObject.h:80
Definition VMonitor.h:117
std::string pretty_str(int namewidth=NameWidth, int colnum=ColCount) const
Definition VMonitor.cc:186
Definition Calibration.h:27
KeyType key(const uniset::ObjectId id, const uniset::ObjectId node)
Definition UniSetTypes.cc:980
const ObjectId DefaultObjectId
Definition UniSetTypes.h:71
std::shared_ptr< Configuration > uniset_conf() noexcept
Definition Configuration.cc:90
long ObjectId
Definition UniSetTypes_i.idl:30
Definition IOController_i.idl:58
Definition UniSetTypes_i.idl:65