13 #ifndef TestProc_SK_H_
14 #define TestProc_SK_H_
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 )
128 std::string help() const noexcept;
131 #ifndef DISABLE_REST_API
133 virtual Poco::JSON::Object::Ptr httpGet(
const Poco::URI::QueryParameters& p )
override;
134 virtual Poco::JSON::Object::Ptr httpRequest(
const std::string& req,
const Poco::URI::QueryParameters& p )
override;
135 virtual Poco::JSON::Object::Ptr httpHelp(
const Poco::URI::QueryParameters& p )
override;
162 virtual
void sysCommand( const
uniset::SystemMessage* sm )
override {}
163 virtual void askSensors( UniversalIO::UIOCommand cmd ) {}
169 virtual std::string
getTypeOfMessage(
int t )
const {
return uniset::strTypeOfMessage(t); }
171 #ifndef DISABLE_REST_API
173 virtual Poco::JSON::Object::Ptr httpDumpIO();
174 virtual Poco::JSON::Object::Ptr httpRequestLog(
const Poco::URI::QueryParameters& p );
175 virtual Poco::JSON::Object::Ptr request_params_set(
const std::string& req,
const Poco::URI::QueryParameters& p )
override;
176 virtual Poco::JSON::Object::Ptr request_params_get(
const std::string& req,
const Poco::URI::QueryParameters& p )
override;
180 virtual void step(){}
182 void preAskSensors( UniversalIO::UIOCommand cmd );
185 virtual void testMode(
bool state );
186 void updateOutputs(
bool force );
199 const std::string argprefix;
214 std::atomic_bool activated = {
false };
215 std::atomic_bool cancelled = {
false };
223 std::shared_ptr<uniset::LogAgregator> loga;
224 std::shared_ptr<DebugStream> mylog;
225 std::shared_ptr<uniset::LogServer> logserv;
226 std::string logserv_host = {
""};
227 int logserv_port = {0};
247 void updatePreviousValues() noexcept;
248 void preSensorInfo( const
uniset::SensorMessage* sm );
249 void preTimerInfo( const
uniset::TimerMessage* tm );
259 return std::hash<long>()(
key);
263 std::unordered_map<const uniset::ObjectId,size_t, StatHashFn> smStat;
264 size_t processingMessageCatchCount = { 0 };
266 std::unordered_map<long,size_t> msgTypeStat;
268 std::string ostate = {
"" };
Definition: DebugStream.h:62
Definition: MBSlaveTest/TestProc_SK.h:30
long maxHeartBeat
Definition: MBSlaveTest/TestProc_SK.h:264
virtual bool activateObject() override
Активизация объекта (переопределяется для необходимых действий после активизации)
uniset::PassiveTimer ptStartUpTimeout
Definition: MBSlaveTest/TestProc_SK.h:276
virtual void callback() noexcept override
virtual void processingMessage(const uniset::VoidMessage *msg) override
int sleep_msec
Definition: MBSlaveTest/TestProc_SK.h:255
virtual void httpGetUserData(Poco::JSON::Object::Ptr &jdata)
Definition: MQPerfTest/TestProc_SK.h:172
std::string msgstr(uniset::ObjectId id, bool showLinkName=true) const
uniset::timeout_t smReadyTimeout
Definition: MBSlaveTest/TestProc_SK.h:272
virtual std::string getTypeOfMessage(int t) const
Definition: MQPerfTest/TestProc_SK.h:169
int getIntProp(const std::string &name)
Definition: MQPerfTest/TestProc_SK.h:209
virtual bool deactivateObject() override
Деактивация объекта (переопределяется для необходимых действий при завершении работы)
std::string strval(uniset::ObjectId id, bool showLinkName=true) const
uniset::timeout_t activateTimeout
Definition: MBSlaveTest/TestProc_SK.h:275
const std::string getProp(const std::string &name)
Definition: MQPerfTest/TestProc_SK.h:211
bool forceOut
Definition: MBSlaveTest/TestProc_SK.h:280
uniset::ObjectId idHeartBeat
Definition: MBSlaveTest/TestProc_SK.h:263
uniset::ObjectId smTestID
Definition: MBSlaveTest/TestProc_SK.h:259
int askPause
Definition: MBSlaveTest/TestProc_SK.h:277
std::string str(uniset::ObjectId id, bool showLinkName=true) const
virtual std::string getMonitInfo() const
Definition: MQPerfTest/TestProc_SK.h:168
xmlNode * confnode
Definition: MBSlaveTest/TestProc_SK.h:266
std::string dumpVars()
Definition: MQPerfTest/TestProc_SK.h:126
Пассивный таймер
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: CommonEventLoop.h:15
KeyType key(const uniset::ObjectId id, const uniset::ObjectId node)
Definition: UniSetTypes.cc:746
const ObjectId DefaultObjectId
Definition: UniSetTypes.h:70
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