-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathModbusUDP.h
More file actions
53 lines (47 loc) · 2.14 KB
/
ModbusUDP.h
File metadata and controls
53 lines (47 loc) · 2.14 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
/**
* @file ModbusUDP.h
* @brief Modbus::Master::UDPProtocol — UDP marker class in the MBAP protocol hierarchy.
*
* @details UDPProtocol is a thin intermediate class that identifies UDP-based transports
* in the class hierarchy without adding behaviour. Concrete implementations (UDPProtocolWinSock,
* UDPProtocolIndy) derive from this class and provide the actual UDP socket I/O.
*/
//---------------------------------------------------------------------------
#ifndef ModbusUDPH
#define ModbusUDPH
#include "ModbusTCP_IP.h"
//---------------------------------------------------------------------------
namespace Modbus {
//---------------------------------------------------------------------------
namespace Master {
//---------------------------------------------------------------------------
/**
* @brief Marker base class for UDP-based Modbus master implementations.
*
* @brief Marker base class for UDP-based Modbus master implementations (NVI pattern).
*
* **Role in NVI Hierarchy:**
* - Inherits all MBAP framing logic and virtual hooks from TCPIPProtocol.
* - Concrete UDP transport classes (UDPProtocolWinSock, UDPProtocolIndy) derive from UDPProtocol
* and implement the Do…() virtual methods using their respective I/O libraries (WinSock2 or Indy).
* - Provides no additional virtual methods; all behavior is inherited from Protocol and TCPIPProtocol.
*
* UDP-Specific Behavior:
* - UDP is connectionless: DoWrite() sends a datagram and DoRead() retrieves bytes from a
* locally cached response datagram.
* - DoInputBufferClear() resets the receive cache between transactions.
*
* Use this class as a base (polymorphic reference) when you need to accept any UDP transport
* polymorphically without caring about the underlying socket library.
*/
class UDPProtocol : public TCPIPProtocol {
public:
protected:
private:
};
//---------------------------------------------------------------------------
}; // End of namespace Master
//---------------------------------------------------------------------------
}; // End of namespace Modbus
//---------------------------------------------------------------------------
#endif