44 lines
798 B
C++
44 lines
798 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_ */
|