|
UniSet
2.2.1
|
00001 #ifndef _RTUEXCHANGE_H_ 00002 #define _RTUEXCHANGE_H_ 00003 // ----------------------------------------------------------------------------- 00004 #include <ostream> 00005 #include <string> 00006 #include <map> 00007 #include <vector> 00008 #include "MBExchange.h" 00009 #include "modbus/ModbusRTUMaster.h" 00010 #include "RTUStorage.h" 00011 // ----------------------------------------------------------------------------- 00012 class RTUExchange: 00013 public MBExchange 00014 { 00015 public: 00016 RTUExchange( UniSetTypes::ObjectId objId, UniSetTypes::ObjectId shmID, 00017 const std::shared_ptr<SharedMemory>& ic = nullptr, const std::string& prefix = "rs" ); 00018 virtual ~RTUExchange(); 00019 00021 static std::shared_ptr<RTUExchange> init_rtuexchange( int argc, const char* const* argv, 00022 UniSetTypes::ObjectId shmID, const std::shared_ptr<SharedMemory>& ic = nullptr, 00023 const std::string& prefix = "rs" ); 00024 00026 static void help_print( int argc, const char* const* argv ); 00027 00028 protected: 00029 std::shared_ptr<ModbusRTUMaster> mbrtu; 00030 UniSetTypes::uniset_mutex mbMutex; 00031 std::string devname; 00032 ComPort::Speed defSpeed; 00033 bool use485F; 00034 bool transmitCtl; 00035 00036 virtual void step() override; 00037 virtual bool poll() override; 00038 00039 virtual std::shared_ptr<ModbusClient> initMB( bool reopen = false ) override; 00040 virtual bool initDeviceInfo( RTUDeviceMap& m, ModbusRTU::ModbusAddr a, UniXML::iterator& it ) override; 00041 00042 private: 00043 RTUExchange(); 00044 00045 bool rs_pre_clean; 00046 }; 00047 // ----------------------------------------------------------------------------- 00048 #endif // _RS_EXCHANGE_H_ 00049 // -----------------------------------------------------------------------------
1.7.6.1