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 
21 #include <prbt_hardware_support/ModbusMsgInStamped.h>
25 
26 namespace prbt_hardware_support
27 {
28 using namespace modbus_api::v3;
29 
37 {
38 public:
39  ModbusMsgRunPermittedWrapper(const ModbusMsgInStampedConstPtr& modbus_msg_raw, const ModbusApiSpec& api_spec);
40 
46  virtual void checkStructuralIntegrity() const override;
47 
54  bool getRunPermitted() const;
55 
56 private:
63  bool hasRunPermitted() const;
64 };
65 
67 {
68  return hasRegister(getApiSpec().getRegisterDefinition(modbus_api_spec::RUN_PERMITTED));
69 }
70 
72 {
73  switch (getRegister(getApiSpec().getRegisterDefinition(modbus_api_spec::RUN_PERMITTED)))
74  {
76  return true;
78  return false;
79  default:
80  return false;
81  }
82 }
83 
84 } // namespace prbt_hardware_support
85 
86 #endif // MODBUS_MSG_RUN_PERMITTED_WRAPPER_H
static constexpr uint16_t MODBUS_RUN_PERMITTED_FALSE
Wrapper class to add semantic to a raw ModbusMsgInStamped.
bool hasRunPermitted() const
Check if the message contains a RUN_PERMITTED definition.
static const std::string RUN_PERMITTED
bool getRunPermitted() const
Get the RUN_PERMITTED from the Modbus message.
static constexpr uint16_t MODBUS_RUN_PERMITTED_TRUE
Wrapper class to add semantic to a raw ModbusMsgInStamped.
Specifies the meaning of the holding registers.


prbt_hardware_support
Author(s):
autogenerated on Mon Aug 10 2020 03:10:57