44 lines
823 B
C++
44 lines
823 B
C++
/*
|
||
* ModbusDiscreteOutput.hh
|
||
*
|
||
* Created on: 18 мар. 2021 г.
|
||
* Author: titov
|
||
*/
|
||
|
||
#ifndef UMLIBRARY_DRIVER_MODBUSDISCRETEOUTPUT_HH_
|
||
#define UMLIBRARY_DRIVER_MODBUSDISCRETEOUTPUT_HH_
|
||
|
||
#include <stdint.h>
|
||
|
||
#include "IModBus.hh"
|
||
|
||
namespace driver {
|
||
namespace modbus {
|
||
|
||
class ModbusDiscreteOutput : public IModBusDispatch {
|
||
|
||
typedef IModBusDispatch::Status Status;
|
||
|
||
const bool inversion; //!<Признак инверсии выхода.
|
||
bool coil_state;
|
||
|
||
bool on_state() const { return not inversion; }
|
||
bool off_state() const { return inversion; }
|
||
|
||
|
||
public:
|
||
ModbusDiscreteOutput( bool initial_state, bool inversion );
|
||
|
||
const bool & status() const;
|
||
|
||
Status read( uint16_t & reg );
|
||
Status write( uint16_t reg );
|
||
};
|
||
|
||
}
|
||
}
|
||
|
||
|
||
|
||
#endif /* UMLIBRARY_DRIVER_MODBUSDISCRETEOUTPUT_HH_ */
|