modbus_msg_sto_wrapper.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2018 Pilz GmbH & Co. KG
3  *
4  * This program is free software: you can redistribute it and/or modify
5  * it under the terms of the GNU Lesser General Public License as published by
6  * the Free Software Foundation, either version 3 of the License, or
7  * (at your option) any later version.
8 
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  * GNU Lesser General Public License for more details.
13 
14  * You should have received a copy of the GNU Lesser General Public License
15  * along with this program. If not, see <http://www.gnu.org/licenses/>.
16  */
17 
18 #ifndef MODBUS_MSG_STO_WRAPPER_H
19 #define MODBUS_MSG_STO_WRAPPER_H
20 
22 #include <prbt_hardware_support/ModbusMsgInStamped.h>
25 
26 namespace prbt_hardware_support
27 {
28 
36 {
37 public:
38  ModbusMsgStoWrapper(const ModbusMsgInStampedConstPtr& modbus_msg_raw, const ModbusApiSpec& api_spec);
39 
45  virtual void checkStructuralIntegrity() const override;
46 
53  bool getSTO() const;
54 
55 private:
62  bool hasSTO() const;
63 
64 };
65 
66 inline bool ModbusMsgStoWrapper::hasSTO() const
67 {
68  return hasRegister(getApiSpec().getRegisterDefinition(modbus_api_spec::STO));
69 }
70 
71 inline bool ModbusMsgStoWrapper::getSTO() const
72 {
73  return getRegister(getApiSpec().getRegisterDefinition(modbus_api_spec::STO));
74 }
75 
76 }
77 
78 #endif // MODBUS_MSG_STO_WRAPPER_H
bool hasRegister(uint32_t reg) const
Check if a certain holding register is define in the Modbus message.
ModbusMsgStoWrapper(const ModbusMsgInStampedConstPtr &modbus_msg_raw, const ModbusApiSpec &api_spec)
bool getSTO() const
Get the STO from the Modbus message.
uint16_t getRegister(uint32_t reg) const
const ModbusApiSpec & getApiSpec() const
virtual void checkStructuralIntegrity() const override
Calls ModbusMsgWrapper::checkStructuralIntegrity().
Wrapper class to add semantic to a raw ModbusMsgInStamped.
Wrapper class to add semantic to a raw ModbusMsgInStamped.
bool hasSTO() const
Check if the message contains a STO definition.
Specifies the meaning of the holding registers.


prbt_hardware_support
Author(s):
autogenerated on Thu Mar 19 2020 03:13:27