package Ġcom . jo h ng ach i hi . park ing . mod b ust cp Ċ Ċ import Ġcom . digital pe tri . mod bus . Mod bus P du Ċ import Ġcom . digital pe tri . mod bus . codec . Mod bus Request Encoder Ċ import Ġcom . digital pe tri . mod bus . codec . Mod bus Response Decoder Ċ import Ġcom . digital pe tri . mod bus . codec . Mod bus Tcp Codec Ċ import Ġcom . digital pe tri . mod bus . codec . Mod bus Tcp Payload Ċ import Ġcom . digital pe tri . mod bus . requests . Read Co ils Request Ċ import Ġcom . digital pe tri . mod bus . requests . Write Multiple Registers Request Ċ import Ġcom . digital pe tri . mod bus . responses . Write Multiple Registers Response Ċ import Ġio . netty . buffer . Byte Buf Ċ import Ġio . netty . buffer . Un p ooled Ċ import Ġio . netty . channel . Channel Handler Ċ import Ġorg . apache . camel . component . netty . Default Channel Handler Factory Ċ import Ġorg . springframework . stereotype . Component Ċ import Ġorg . springframework . stereotype . Service Ċ Ċ @ Component Ċ class ĠMod bus Tcp Client Codec Factory Ġ: ĠDefault Channel Handler Factory () Ġ{ ĊĠĠĠ Ġoverride Ġfun Ġnew Channel Handler (): ĠChannel Handler Ġ{ ĊĠĠĠĠĠĠĠ Ġreturn ĠMod bus Tcp Codec ( Mod bus Request Encoder (), ĠMod bus Response Decoder ()) ĊĠĠĠ Ġ} Ċ } ĊĊ Ċ fun Ġmake Mod bus Message ( ĊĠĠĠ Ġtransaction Id : ĠShort Ġ= Ġ 1 , ĊĠĠĠ Ġunit Id : ĠShort Ġ= Ġ 1 , ĊĠĠĠ Ġp du : ĠMod bus P du Ċ ): ĠMod bus Tcp Payload Ġ{ ĊĠĠĠ Ġreturn ĠMod bus Tcp Payload ( transaction Id , Ġunit Id , Ġp du ) Ċ } Ċ Ċ fun Ġmake Write Multiple Register Request P du ( ĊĠĠĠ Ġaddress : ĠInt , ĊĠĠĠ Ġquantity : ĠInt , ĊĠĠĠ Ġwrite Data : ĠByte Buf Ġ= ĠUn p ooled . buffer (). writeInt ( 1 2 ) Ċ ) Ġ= ĠWrite Multiple Registers Request ( address , Ġquantity , Ġwrite Data ) Ċ Ċ fun Ġmake Write Multiple Register Mod bus Request Message ( ĊĠĠĠ Ġtransaction Id : ĠShort Ġ= Ġ 1 , ĊĠĠĠ Ġunit Id : ĠShort Ġ= Ġ 1 , ĊĠĠĠ Ġaddress : ĠInt Ġ= Ġ 1 , ĊĠĠĠ Ġquantity : ĠInt Ġ= Ġ 1 , ĊĠĠĠ Ġwrite Data : ĠByte Buf Ġ= ĠUn p ooled . buffer (). writeInt ( 1 2 ) Ċ ): ĠMod bus Tcp Payload Ġ= ĊĠĠĠ Ġmake Mod bus Message ( ĊĠĠĠĠĠĠĠ Ġtransaction Id Ġ= Ġtransaction Id , ĊĠĠĠĠĠĠĠ Ġunit Id Ġ= Ġunit Id , ĊĠĠĠĠĠĠĠ Ġp du Ġ= ĠWrite Multiple Registers Request ( address , Ġquantity , Ġwrite Data ) ĊĠĠĠ Ġ) Ċ Ċ fun Ġmake Read Co il Mod bus Request Message () Ġ= ĊĠĠĠ Ġmake Mod bus Message ( pdu Ġ= ĠRead Co ils Request ( 1 , Ġ 1 )) Ċ Ċ fun Ġmake Write Multiple Register Mod bus Response Message () Ġ= ĊĠĠĠ Ġmake Mod bus Message ( pdu Ġ= ĠWrite Multiple Registers Response ( 1 , Ġ 1 ))