modbus_msg_run_permitted_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_RUN_PERMITTED_WRAPPER_H
19 #define MODBUS_MSG_RUN_PERMITTED_WRAPPER_H
20 
22 #include <prbt_hardware_support/ModbusMsgInStamped.h>
25 
26 namespace prbt_hardware_support
27 {
28 
36 {
37 public:
38  ModbusMsgRunPermittedWrapper(const ModbusMsgInStampedConstPtr& modbus_msg_raw, const ModbusApiSpec& api_spec);
39 
45  virtual void checkStructuralIntegrity() const override;
46 
53  bool getRunPermitted() const;
54 
55 private:
62  bool hasRunPermitted() const;
63 
64 };
65 
67 {
68  return hasRegister(getApiSpec().getRegisterDefinition(modbus_api_spec::RUN_PERMITTED));
69 }
70 
72 {
73  return getRegister(getApiSpec().getRegisterDefinition(modbus_api_spec::RUN_PERMITTED));
74 }
75 
76 }
77 
78 #endif // MODBUS_MSG_RUN_PERMITTED_WRAPPER_H
const ModbusApiSpec & getApiSpec() const
uint16_t getRegister(uint32_t reg) const
bool hasRunPermitted() const
Check if the message contains a RUN_PERMITTED definition.
bool hasRegister(uint32_t reg) const
Check if a certain holding register is define in the Modbus message.
Wrapper class to add semantic to a raw ModbusMsgInStamped.
virtual void checkStructuralIntegrity() const override
Calls ModbusMsgWrapper::checkStructuralIntegrity().
static const std::string RUN_PERMITTED
bool getRunPermitted() const
Get the RUN_PERMITTED from the Modbus message.
ModbusMsgRunPermittedWrapper(const ModbusMsgInStampedConstPtr &modbus_msg_raw, const ModbusApiSpec &api_spec)
Wrapper class to add semantic to a raw ModbusMsgInStamped.
Specifies the meaning of the holding registers.


prbt_hardware_support
Author(s):
autogenerated on Tue Feb 2 2021 03:50:17