64 const std::string& prefix =
"mb" );
68 static void help_print(
int argc,
const char*
const* argv );
78 inline std::shared_ptr<LogAgregator> getLogAggregator()
82 inline std::shared_ptr<DebugStream> log()
89 bool reload(
const std::string& confile );
91 static uint8_t firstBit( uint16_t mask );
94 static uint16_t getBits( uint16_t value, uint16_t mask, uint8_t offset );
96 static uint16_t setBits( uint16_t value, uint16_t set, uint16_t mask, uint8_t offset );
98 static uint16_t forceSetBits( uint16_t value, uint16_t set, uint16_t mask, uint8_t offset );
105 virtual void askSensors( UniversalIO::UIOCommand cmd );
106 virtual void initOutput();
109 virtual void initIterators();
110 virtual void initValues();
111 virtual bool reconfigure(
const std::shared_ptr<uniset::UniXML>& xml,
const std::shared_ptr<uniset::MBConfig>& mbconf );
112#ifndef DISABLE_REST_API
114 virtual Poco::JSON::Object::Ptr httpHelp(
const Poco::URI::QueryParameters& p )
override;
116 virtual Poco::JSON::Object::Ptr httpGetMyInfo( Poco::JSON::Object::Ptr root )
override;
119 Poco::JSON::Object::Ptr httpModeGet(
const Poco::URI::QueryParameters& p );
120 Poco::JSON::Object::Ptr httpModeSet(
const Poco::URI::QueryParameters& p );
121 Poco::JSON::Object::Ptr httpModeSupported(
const Poco::URI::QueryParameters&);
122 Poco::JSON::Object::Ptr httpMode(
const Poco::URI::QueryParameters& p );
123 Poco::JSON::Object::Ptr httpReload(
const Poco::URI::QueryParameters& p );
124 virtual Poco::JSON::Object::Ptr httpGetParam(
const Poco::URI::QueryParameters& p );
125 virtual Poco::JSON::Object::Ptr httpSetParam(
const Poco::URI::QueryParameters& p );
126 virtual Poco::JSON::Object::Ptr httpStatus();
127 Poco::JSON::Object::Ptr httpGet(
const Poco::URI::QueryParameters& p );
128 Poco::JSON::Object::Ptr httpRegisters(
const Poco::URI::QueryParameters& p );
129 Poco::JSON::Object::Ptr httpDevices(
const Poco::URI::QueryParameters& p );
130 Poco::JSON::Object::Ptr httpTakeControl( Poco::Net::HTTPServerResponse& resp,
const Poco::URI::QueryParameters& p );
131 Poco::JSON::Object::Ptr httpReleaseControl(
const Poco::URI::QueryParameters& p );
137 void firstInitRegisters();
138 bool preInitRead( MBConfig::InitList::iterator& p );
142 virtual std::shared_ptr<ModbusClient> initMB(
bool reopen =
false ) = 0;
145 bool pollRTU( std::shared_ptr<MBConfig::RTUDevice>& dev, MBConfig::RegMap::iterator& it );
151 void updateRTU(MBConfig::RegMap::iterator& it);
152 void updateMTR(MBConfig::RegMap::iterator& it);
153 void updateRTU188(MBConfig::RegMap::iterator& it);
155 virtual void updateRespondSensors();
157 bool isUpdateSM(
bool wrFunc,
long devMode )
const noexcept;
158 bool isPollEnabled(
bool wrFunc )
const noexcept;
159 bool isSafeMode( std::shared_ptr<MBConfig::RTUDevice>& dev )
const noexcept;
161 bool isProcActive()
const;
162 void setProcActive(
bool st );
165 bool readItem(
const std::shared_ptr<UniXML>& xml,
UniXML::iterator& it, xmlNode* sec );
167 void initOffsetList();
168 std::string initPropPrefix(
const std::string& def_prop_prefix );
170 xmlNode* cnode = { 0 };
171 std::shared_ptr<SMInterface> shm;
173 timeout_t initPause = { 3000 };
181 long maxHeartBeat = { 10 };
182 IOController::IOStateList::iterator itHeartBeat;
186 IOController::IOStateList::iterator itExchangeMode;
190 std::atomic_bool activated = {
false };
191 std::atomic_bool canceled = {
false };
192 timeout_t activateTimeout = { 20000 };
193 bool notUseExchangeTimer = {
false };
196 size_t poll_count = { 0 };
198 std::string statInfo = {
"" };
200 std::shared_ptr<ModbusClient> mb;
207 std::shared_ptr<LogAgregator> loga;
208 std::shared_ptr<DebugStream> mblog;
209 std::shared_ptr<LogServer> logserv;
210 std::string logserv_host = {
""};
211 int logserv_port = {0};
212 const std::shared_ptr<SharedMemory> ic;
218 std::shared_ptr<uniset::MBConfig> mbconf;
Definition UHttpRequestHandler.h:87