ConOpSys V2970  P004.07
ANVILEX control operating system
MODBUS_Request_PDU.h
Go to the documentation of this file.
1 //------------------------------------------------------------------------------
2 //! @file MODBUS_Request_PDU.h
3 //! @brief MODBUS request 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_Request_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 request 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_Request_PDU();
81 
82  //!-------------------------------------------------------------------------
83  //! @brief Finalise request
84  //! @note This method finalised request by checking CRC of the PDU buffer.
85  //! @return BOOL - Status of operation
86  //! @retval false - Operation failed
87  //! @retval true - Operation successed
88  //! \par Override
89  //! Not allowed
90  //! @attention None
91  //--------------------------------------------------------------------------
92 
93  virtual BOOL Done();
94 
95  //!-------------------------------------------------------------------------
96  //! @brief Test for PDU has a valid slave address
97  //! @note None
98  //! @param [in] u8_Slave_Address - Expected slave address
99  //! @return TRIL - Address validation result
100  //! @retval unset - Bad PDU format
101  //! @retval false - Specified and PDU slave adresses are not equal
102  //! @retval true - Specified and PDU slave adresses are equal
103  //! \par Override
104  //! Not allowed
105  //! @attention None
106  //--------------------------------------------------------------------------
107 
108  TRIL Is_Slave_Address_Valid( U8 u8_Slave_Address );
109 
110  //!-------------------------------------------------------------------------
111  //! @brief Test for broadcast PDU
112  //! @note None
113  //! @return TRIL - Broadcast PDU flag status
114  //! @retval unset - Bad PDU format
115  //! @retval false - Non broadcast PDU
116  //! @retval true - Broadcast PDU
117  //! \par Override
118  //! Not allowed
119  //! @attention None
120  //--------------------------------------------------------------------------
121 
122  TRIL Is_Broadcast();
123 
124  //!-------------------------------------------------------------------------
125  //! @brief Test for PDU has a valid CRC
126  //! @note None
127  //! @return TRIL - PDU CRC status
128  //! @retval unset - Bad PDU format
129  //! @retval false - CRC of PDU invalid
130  //! @retval true - CRC of PDU valid
131  //! \par Override
132  //! Not allowed
133  //! @attention None
134  //--------------------------------------------------------------------------
135 
136  TRIL Is_CRC_Valid();
137 
138  //!-------------------------------------------------------------------------
139  //! @brief Fills buffer with test data
140  //! @note None
141  //! \par Override
142  //! Not allowed
143  //! @attention Don't call this method directly.
144  //--------------------------------------------------------------------------
145 
146  VOID Test_Data();
147 
148  //----------------------------------------------------------------------------
149  // Protected defines, methods and variables
150  //----------------------------------------------------------------------------
151 
152  protected:
153 
154  //----------------------------------------------------------------------------
155  // Private defines, methods and variables
156  //----------------------------------------------------------------------------
157 
158  private:
159 
160 };
161 
162 //------------------------------------------------------------------------------
163 // End Of File
164 //------------------------------------------------------------------------------
int BOOL
Boolean datatype definition.
Definition: Defines.h:124
int TRIL
Thrilean datatype defenition.
Definition: Defines.h:143
unsigned char U8
Binary 8-Bit unsigned integer datatype defenition.
Definition: Defines.h:183
void VOID
Datatypesess datatype definition.
Definition: Defines.h:105
Communication protocol MODBUS over UART class header file.
MODBUS generic PDU base class.
Definition: MODBUS_PDU.h:100
MODBUS request PDU class.
Definition: MODBUS_Request_PDU.h:54
TRIL Is_CRC_Valid()
Test for PDU has a valid CRC.
Definition: MODBUS_Request_PDU.cpp:217
VOID Test_Data()
Fills buffer with test data.
Definition: MODBUS_Request_PDU.cpp:289
TMODBUS_Request_PDU()
Class constructor method.
Definition: MODBUS_Request_PDU.cpp:65
virtual BOOL Done()
Finalise request.
Definition: MODBUS_Request_PDU.cpp:81
TRIL Is_Slave_Address_Valid(U8 u8_Slave_Address)
Test for PDU has a valid slave address.
Definition: MODBUS_Request_PDU.cpp:96
virtual ~TMODBUS_Request_PDU()
Class destructor method.
Definition: MODBUS_Request_PDU.cpp:73
TRIL Is_Broadcast()
Test for broadcast PDU.
Definition: MODBUS_Request_PDU.cpp:157