ConOpSys V2970  P004.07
ANVILEX control operating system
MODBUS_Request_FIFO.h
Go to the documentation of this file.
1 //------------------------------------------------------------------------------
2 //! @file MODBUS_Request_FIFO.h
3 //! @brief MODBUS request FIFO 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_FIFO.h $
7 //! $Revision: 2765 $
8 //! $Date: 2021-07-04 04:32:25 +0500 (So, 04 Jul 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 "Defines.h"
47 
48 //------------------------------------------------------------------------------
49 // Class definitions
50 //------------------------------------------------------------------------------
51 
52 //! @brief MODBUS request FIFO 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 
81 
82  //!-------------------------------------------------------------------------
83  //! @brief Returns empty buffer status
84  //! @note None
85  //! @return BOOL - Buffer status
86  //! @retval false - Buffer is not empty
87  //! @retval true - Buffer is empty
88  //! \par Override
89  //! Not allowed
90  //! @attention None
91  //--------------------------------------------------------------------------
92 
93  BOOL Is_Empty();
94 
95  //!-------------------------------------------------------------------------
96  //! @brief Push data into buffer
97  //! @note None
98  //! @param [in] u8_Value - U8 value to push into buffer
99  //! \par Override
100  //! Not allowed
101  //! @attention None
102  //--------------------------------------------------------------------------
103 
104  VOID Push( U8 u8_Value );
105 
106  //!-------------------------------------------------------------------------
107  //! @brief Pop data from buffer
108  //! @note None
109  //! @param [out] *u8_Value - Poped value from the buffer
110  //! @param [out] *f32_Interval - Time interval value
111  //! @return BOOL - Execution status
112  //! @retval false - Buffer is empty, no data poped
113  //! @retval true - Data successfull poped
114  //! \par Override
115  //! Not allowed
116  //! @attention None
117  //--------------------------------------------------------------------------
118 
119  BOOL Pop( U8 *u8_Value, F32 *f32_Interval );
120 
121  //--------------------------------------------------------------------------
122  // Public variables
123  //--------------------------------------------------------------------------
124 
125  //! @brief Data buffer
126  U8 u8_Data[ 16 ] = { (U8)0x00 };
127 
128  //! @brief Timestamp buffer
129  U64 u64_Timestamp[ 16 ] = { (U64)0 };
130 
131  //! @brief Status code buffer
132  BOOL bool_Status[ 16 ] = { (BOOL)false };
133 
134  //! @brief Push end index
136 
137  //! @brief Pop end index
139 
140  //----------------------------------------------------------------------------
141  // Protected defines, methods and variables
142  //----------------------------------------------------------------------------
143 
144  protected:
145 
146  //----------------------------------------------------------------------------
147  // Private defines, methods and variables
148  //----------------------------------------------------------------------------
149 
150  private:
151 
152  //! @brief Last pop operation timestamp
154 
155  //! @brief Overflow flag
157 
158 };
159 
160 //------------------------------------------------------------------------------
161 // End Of File
162 //------------------------------------------------------------------------------
ConOpSys data type definitions header file.
int BOOL
Boolean datatype definition.
Definition: Defines.h:124
unsigned long long U64
Binary 64-Bit unsigned integer datatype defenition.
Definition: Defines.h:213
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
MODBUS request FIFO class.
Definition: MODBUS_Request_FIFO.h:54
BOOL Pop(U8 *u8_Value, F32 *f32_Interval)
Pop data from buffer.
Definition: MODBUS_Request_FIFO.cpp:149
BOOL Is_Empty()
Returns empty buffer status.
Definition: MODBUS_Request_FIFO.cpp:101
BOOL bool_Overflow
Overflow flag.
Definition: MODBUS_Request_FIFO.h:156
TMODBUS_Request_FIFO()
Class constructor method.
Definition: MODBUS_Request_FIFO.cpp:71
U64 u64_Timestamp[16]
Timestamp buffer.
Definition: MODBUS_Request_FIFO.h:129
VOID Push(U8 u8_Value)
Push data into buffer.
Definition: MODBUS_Request_FIFO.cpp:113
U8 u8_Data[16]
Data buffer.
Definition: MODBUS_Request_FIFO.h:126
U32 u32_Pop_Index
Pop end index.
Definition: MODBUS_Request_FIFO.h:138
U64 u64_Last_Pop_Timestamp
Last pop operation timestamp.
Definition: MODBUS_Request_FIFO.h:153
BOOL bool_Status[16]
Status code buffer.
Definition: MODBUS_Request_FIFO.h:132
~TMODBUS_Request_FIFO()
Class destructor method.
Definition: MODBUS_Request_FIFO.cpp:93
U32 u32_Push_Index
Push end index.
Definition: MODBUS_Request_FIFO.h:135