Skip to content

2.4 Concrete Protocol Layer ProtocolLinker

luosheng edited this page Jun 7, 2023 · 1 revision

Concrete Protocol Layer means a protocol with full implemetations, like Modbus Rtu. Modbus Rtu extends CRC16 and byte[] linear combination from Modbus common core, using serial port.

Implementation

After receving SendReceive message from IProtocol, IProtocolLinker will found SpecialProtocolUnitAttribute in ProtocolUnit.

If sure, ProtocolUnit will directory translate the message and send it to IConnector.
Then run CheckRight to check the response message from IConnector, and return it to IProtocol.

If not, ProtocolUnit will translate the message, then reflect and create its ProtocolLinkerBytesExtend, run BytesExtend in this ProtocolLinkerBytesExtend instance to extend message. At the end send message to IConnector.
When receving, it will run CheckRight first to check response, and run BytesDecact in ProtocolLinkerBytesExtend to decact message to protocol core. Finally return it to IProtocol.

You need to name AProtocolLinkerBytesExtend for AProtocolLinker because of the reflection rule.

inner 3

Interface

IProtocol sends SendMessage to IProtocolLinker, IProtocolLinker sends SendMessage to IConnector.
ProtocolLinker controls the sending methods in contruction and overridable inner methods.

IProtocol sends Connect/Disconnect to IProtocolLinker, IProtocolLinker sends Connect/DisConnect to IConnector.

outer 3

Home

Clone this wiki locally