UniSet
1.4.0
|
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 SharedMemory* ic=0, const std::string prefix="rs" ); 00018 virtual ~RTUExchange(); 00019 00021 static RTUExchange* init_rtuexchange( int argc, const char* const* argv, 00022 UniSetTypes::ObjectId shmID, SharedMemory* ic=0, 00023 const std::string prefix="rs" ); 00024 00026 static void help_print( int argc, const char* const* argv ); 00027 00028 protected: 00029 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(); 00037 virtual void poll(); 00038 00039 virtual ModbusClient* initMB( bool reopen=false ); 00040 virtual bool initDeviceInfo( RTUDeviceMap& m, ModbusRTU::ModbusAddr a, UniXML_iterator& it ); 00041 00042 private: 00043 RTUExchange(); 00044 00045 UniSetTypes::uniset_mutex pollMutex; 00046 bool rs_pre_clean; 00047 bool allNotRespond; 00048 Trigger trAllNotRespond; 00049 // PassiveTimer ptAllNotRespond; 00050 }; 00051 // ----------------------------------------------------------------------------- 00052 #endif // _RS_EXCHANGE_H_ 00053 // -----------------------------------------------------------------------------