ConOpSys V2970  P004.07
ANVILEX control operating system
MODBUS_Response_PDU.h
Go to the documentation of this file.
1 //------------------------------------------------------------------------------
2 //! @file MODBUS_Response_PDU.h
3 //! @brief MODBUS response PDU class header file.
4 //! @attention No special attention requered.
5 //! @copyright (C) 2015-2020 ANVILEX LLC
6 //! $HeadURL: https://192.168.3.4:8443/svn/P004_07/ConOpSys/Engine/MODBUS_Response_PDU.h $
7 //! $Revision: 2732 $
8 //! $Date: 2021-06-22 11:38:01 +0500 (Di, 22 Jun 2021) $
9 //! $Author: minch $
10 //------------------------------------------------------------------------------
11 //
12 // Redistribution and use in source and binary forms, with or without
13 // modification, are permitted provided that the following conditions are met:
14 //
15 // 1. Redistributions of source code must retain the above copyright notice,
16 // this list of conditions and the following disclaimer.
17 //
18 // 2. Redistributions in binary form must reproduce the above copyright notice,
19 // this list of conditions and the following disclaimer in the documentation
20 // and/or other materials provided with the distribution.
21 //
22 // 3. Neither the name of ANVILEX nor the names of its contributors may be
23 // used to endorse or promote products derived from this software without
24 // specific prior written permission.
25 //
26 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
27 // AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
28 // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
29 // ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
30 // LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
31 // CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
32 // SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
33 // INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
34 // CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
35 // ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
36 // POSSIBILITY OF SUCH DAMAGE.
37 //
38 //------------------------------------------------------------------------------
39 
40 #pragma once
41 
42 //------------------------------------------------------------------------------
43 // Include system files
44 //------------------------------------------------------------------------------
45 
46 #include "MODBUS_PDU.h"
47 
48 //------------------------------------------------------------------------------
49 // Class definitions
50 //------------------------------------------------------------------------------
51 
52 //! @brief MODBUS responce PDU class
54 {
55 
56  //----------------------------------------------------------------------------
57  // Public defines, methods and variables
58  //----------------------------------------------------------------------------
59 
60  public:
61 
62  //!-------------------------------------------------------------------------
63  //! @brief Class constructor method
64  //! @note None
65  //! \par Override
66  //! Not allowed
67  //! @attention Don't call this method directly.
68  //--------------------------------------------------------------------------
69 
71 
72  //!-------------------------------------------------------------------------
73  //! @brief Class destructor method
74  //! @note None
75  //! \par Override
76  //! Not allowed
77  //! @attention Don't call this method directly.
78  //--------------------------------------------------------------------------
79 
80  virtual ~TMODBUS_Response_PDU();
81 
82  //!-------------------------------------------------------------------------
83  //! @brief Initialisation PDU with specified slave address abd function code
84  //! @note None
85  //! @param [in] u8_Slave_Address - Slave address
86  //! @param [in] u8_Function_Code - Function code
87  //! \par Override
88  //! Not allowed
89  //! @attention None
90  //--------------------------------------------------------------------------
91 
92  VOID Init( U8 u8_Slave_Address, U8 u8_Function_Code );
93 
94  //!-------------------------------------------------------------------------
95  //! @brief Initialisation PDU with specified slave address abd function code
96  //! @note None
97  //! @param [in] u8_Slave_Address - Slave address
98  //! @param [in] u8_Function_Code - Function code
99  //! @param [in] u8_Response_Code - Response code
100  //! \par Override
101  //! Not allowed
102  //! @attention None
103  //--------------------------------------------------------------------------
104 
105  VOID Init( U8 u8_Slave_Address, U8 u8_Function_Code, U8 u8_Response_Code );
106 
107  //!-------------------------------------------------------------------------
108  //! @brief Finalise responce composition
109  //! @note This method finalised responce composition by adding CRC to the PDU buffer.
110  //! \par Override
111  //! Not allowed
112  //! @attention None
113  //--------------------------------------------------------------------------
114 
115  virtual BOOL Done();
116 
117  //!-------------------------------------------------------------------------
118  //! @brief Write U8 value into responce PDU buffer at specified address
119  //! @note None
120  //! @param [in] u32_Address - PDU buffer address
121  //! @param [in] u8_Value - U8 value to write
122  //! \par Override
123  //! Not allowed
124  //! @attention None
125  //--------------------------------------------------------------------------
126 
127  VOID Write_U8_Value( U32 u32_Address, U8 u8_Value );
128 
129  //!-------------------------------------------------------------------------
130  //! @brief Write U16 value into responce PDU buffer at specified address
131  //! @note None
132  //! @param [in] u32_Address - PDU buffer address
133  //! @param [in] u16_Value - U16 value to write
134  //! \par Override
135  //! Not allowed
136  //! @attention None
137  //--------------------------------------------------------------------------
138 
139  VOID Write_U16_Value( U32 u32_Address, U16 u16_Value );
140 
141  //!-------------------------------------------------------------------------
142  //! @brief Write U32 value into responce PDU buffer at specified address
143  //! @note None
144  //! @param [in] u32_Address - PDU buffer address
145  //! @param [in] u32_Value - U32 value to write
146  //! \par Override
147  //! Not allowed
148  //! @attention None
149  //--------------------------------------------------------------------------
150 
151  VOID Write_U32_Value( U32 u32_Address, U32 u32_Value );
152 
153  //!-------------------------------------------------------------------------
154  //! @brief Write F32 value into responce PDU buffer at specified address
155  //! @note None
156  //! @param [in] u32_Address - PDU buffer address
157  //! @param [in] f32_Value - F32 value to write
158  //! \par Override
159  //! Not allowed
160  //! @attention None
161  //--------------------------------------------------------------------------
162 
163  VOID Write_F32_Value( U32 u32_Address, F32 f32_Value );
164 
165  //----------------------------------------------------------------------------
166  // Protected defines, methods and variables
167  //----------------------------------------------------------------------------
168 
169  protected:
170 
171  //----------------------------------------------------------------------------
172  // Private defines, methods and variables
173  //----------------------------------------------------------------------------
174 
175  private:
176 
177 };
178 
179 //------------------------------------------------------------------------------
180 // End of file
181 //------------------------------------------------------------------------------
int BOOL
Boolean datatype definition.
Definition: Defines.h:124
unsigned char U8
Binary 8-Bit unsigned integer datatype defenition.
Definition: Defines.h:183
void VOID
Datatypesess datatype definition.
Definition: Defines.h:105
unsigned long U32
Binary 32-Bit unsigned integer datatype defenition.
Definition: Defines.h:203
float F32
IEEE-754 32-Bit single presession floating point numbers datatype defenition.
Definition: Defines.h:324
unsigned short U16
Binary 16-Bit unsigned integer datatype defenition.
Definition: Defines.h:193
Communication protocol MODBUS over UART class header file.
MODBUS generic PDU base class.
Definition: MODBUS_PDU.h:100
VOID Init()
PDU initialisation method.
Definition: MODBUS_PDU.cpp:134
MODBUS responce PDU class.
Definition: MODBUS_Response_PDU.h:54
VOID Write_F32_Value(U32 u32_Address, F32 f32_Value)
Write F32 value into responce PDU buffer at specified address.
Definition: MODBUS_Response_PDU.cpp:392
virtual BOOL Done()
Finalise responce composition.
Definition: MODBUS_Response_PDU.cpp:134
VOID Write_U16_Value(U32 u32_Address, U16 u16_Value)
Write U16 value into responce PDU buffer at specified address.
Definition: MODBUS_Response_PDU.cpp:248
virtual ~TMODBUS_Response_PDU()
Class destructor method.
Definition: MODBUS_Response_PDU.cpp:73
TMODBUS_Response_PDU()
Class constructor method.
Definition: MODBUS_Response_PDU.cpp:65
VOID Write_U8_Value(U32 u32_Address, U8 u8_Value)
Write U8 value into responce PDU buffer at specified address.
Definition: MODBUS_Response_PDU.cpp:212
VOID Write_U32_Value(U32 u32_Address, U32 u32_Value)
Write U32 value into responce PDU buffer at specified address.
Definition: MODBUS_Response_PDU.cpp:300