Class S7HMuxImpl
- java.lang.Object
-
- io.netty.channel.ChannelHandlerAdapter
-
- io.netty.channel.ChannelInboundHandlerAdapter
-
- io.netty.channel.ChannelDuplexHandler
-
- io.netty.handler.codec.MessageToMessageCodec<io.netty.buffer.ByteBuf,io.netty.buffer.ByteBuf>
-
- org.apache.plc4x.java.s7.readwrite.connection.S7HMuxImpl
-
- All Implemented Interfaces:
io.netty.channel.ChannelHandler,io.netty.channel.ChannelInboundHandler,io.netty.channel.ChannelOutboundHandler,S7HMux
@Sharable public class S7HMuxImpl extends io.netty.handler.codec.MessageToMessageCodec<io.netty.buffer.ByteBuf,io.netty.buffer.ByteBuf> implements S7HMux
Implementation of a multiplexing channel, from an embedded channel to two possible TCP connections, primary and secondary. The objective is to allow connections to individual systems with a two CP (PN CPUs, CP343-1, CP443-1 or similar), or H-type systems (S7-400H or S7-1500H).The user App must be in charge of restoring the requests or subscriptions that it is requesting.
-
-
Field Summary
Fields Modifier and Type Field Description protected io.netty.channel.Channelembeded_channelstatic io.netty.util.AttributeKey<Boolean>IS_CONNECTEDstatic io.netty.util.AttributeKey<Boolean>IS_PING_ACTIVEstatic io.netty.util.AttributeKey<Boolean>IS_PRIMARYstatic io.netty.util.AttributeKey<Integer>PING_TIMEprotected io.netty.channel.Channelprimary_channelstatic io.netty.util.AttributeKey<Integer>READ_TIME_OUTstatic io.netty.util.AttributeKey<Integer>RETRY_TIMEprotected io.netty.channel.Channelsecondary_channelprotected io.netty.channel.Channeltcp_channel
-
Constructor Summary
Constructors Constructor Description S7HMuxImpl()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidchannelActive(io.netty.channel.ChannelHandlerContext ctx)voidchannelInactive(io.netty.channel.ChannelHandlerContext ctx)voidchannelReadComplete(io.netty.channel.ChannelHandlerContext ctx)voidchannelRegistered(io.netty.channel.ChannelHandlerContext ctx)voidchannelUnregistered(io.netty.channel.ChannelHandlerContext ctx)voidchannelWritabilityChanged(io.netty.channel.ChannelHandlerContext ctx)protected voiddecode(io.netty.channel.ChannelHandlerContext ctx, io.netty.buffer.ByteBuf inbb, List<Object> list)protected voidencode(io.netty.channel.ChannelHandlerContext ctx, io.netty.buffer.ByteBuf outbb, List<Object> list)voidexceptionCaught(io.netty.channel.ChannelHandlerContext ctx, Throwable cause)voidsetEmbeddedChannel(io.netty.channel.Channel embeded_channel)voidsetPrimaryChannel(io.netty.channel.Channel primary_channel)voidsetSecondaryChannel(io.netty.channel.Channel secondary_channel)voiduserEventTriggered(io.netty.channel.ChannelHandlerContext ctx, Object evt)-
Methods inherited from class io.netty.handler.codec.MessageToMessageCodec
acceptInboundMessage, acceptOutboundMessage, channelRead, write
-
Methods inherited from class io.netty.channel.ChannelDuplexHandler
bind, close, connect, deregister, disconnect, flush, read
-
Methods inherited from class io.netty.channel.ChannelHandlerAdapter
ensureNotSharable, handlerAdded, handlerRemoved, isSharable
-
-
-
-
Field Detail
-
IS_CONNECTED
public static final io.netty.util.AttributeKey<Boolean> IS_CONNECTED
-
IS_PRIMARY
public static final io.netty.util.AttributeKey<Boolean> IS_PRIMARY
-
READ_TIME_OUT
public static final io.netty.util.AttributeKey<Integer> READ_TIME_OUT
-
IS_PING_ACTIVE
public static final io.netty.util.AttributeKey<Boolean> IS_PING_ACTIVE
-
PING_TIME
public static final io.netty.util.AttributeKey<Integer> PING_TIME
-
RETRY_TIME
public static final io.netty.util.AttributeKey<Integer> RETRY_TIME
-
embeded_channel
protected io.netty.channel.Channel embeded_channel
-
tcp_channel
protected io.netty.channel.Channel tcp_channel
-
primary_channel
protected io.netty.channel.Channel primary_channel
-
secondary_channel
protected io.netty.channel.Channel secondary_channel
-
-
Method Detail
-
encode
protected void encode(io.netty.channel.ChannelHandlerContext ctx, io.netty.buffer.ByteBuf outbb, List<Object> list) throws Exception- Specified by:
encodein classio.netty.handler.codec.MessageToMessageCodec<io.netty.buffer.ByteBuf,io.netty.buffer.ByteBuf>- Throws:
Exception
-
decode
protected void decode(io.netty.channel.ChannelHandlerContext ctx, io.netty.buffer.ByteBuf inbb, List<Object> list) throws Exception- Specified by:
decodein classio.netty.handler.codec.MessageToMessageCodec<io.netty.buffer.ByteBuf,io.netty.buffer.ByteBuf>- Throws:
Exception
-
channelRegistered
public void channelRegistered(io.netty.channel.ChannelHandlerContext ctx) throws Exception- Specified by:
channelRegisteredin interfaceio.netty.channel.ChannelInboundHandler- Overrides:
channelRegisteredin classio.netty.channel.ChannelInboundHandlerAdapter- Throws:
Exception
-
exceptionCaught
public void exceptionCaught(io.netty.channel.ChannelHandlerContext ctx, Throwable cause) throws Exception- Specified by:
exceptionCaughtin interfaceio.netty.channel.ChannelHandler- Specified by:
exceptionCaughtin interfaceio.netty.channel.ChannelInboundHandler- Overrides:
exceptionCaughtin classio.netty.channel.ChannelInboundHandlerAdapter- Throws:
Exception
-
channelWritabilityChanged
public void channelWritabilityChanged(io.netty.channel.ChannelHandlerContext ctx) throws Exception- Specified by:
channelWritabilityChangedin interfaceio.netty.channel.ChannelInboundHandler- Overrides:
channelWritabilityChangedin classio.netty.channel.ChannelInboundHandlerAdapter- Throws:
Exception
-
userEventTriggered
public void userEventTriggered(io.netty.channel.ChannelHandlerContext ctx, Object evt) throws Exception- Specified by:
userEventTriggeredin interfaceio.netty.channel.ChannelInboundHandler- Overrides:
userEventTriggeredin classio.netty.channel.ChannelInboundHandlerAdapter- Throws:
Exception
-
channelReadComplete
public void channelReadComplete(io.netty.channel.ChannelHandlerContext ctx) throws Exception- Specified by:
channelReadCompletein interfaceio.netty.channel.ChannelInboundHandler- Overrides:
channelReadCompletein classio.netty.channel.ChannelInboundHandlerAdapter- Throws:
Exception
-
channelInactive
public void channelInactive(io.netty.channel.ChannelHandlerContext ctx) throws Exception- Specified by:
channelInactivein interfaceio.netty.channel.ChannelInboundHandler- Overrides:
channelInactivein classio.netty.channel.ChannelInboundHandlerAdapter- Throws:
Exception
-
channelActive
public void channelActive(io.netty.channel.ChannelHandlerContext ctx) throws Exception- Specified by:
channelActivein interfaceio.netty.channel.ChannelInboundHandler- Overrides:
channelActivein classio.netty.channel.ChannelInboundHandlerAdapter- Throws:
Exception
-
channelUnregistered
public void channelUnregistered(io.netty.channel.ChannelHandlerContext ctx) throws Exception- Specified by:
channelUnregisteredin interfaceio.netty.channel.ChannelInboundHandler- Overrides:
channelUnregisteredin classio.netty.channel.ChannelInboundHandlerAdapter- Throws:
Exception
-
setEmbeddedChannel
public void setEmbeddedChannel(io.netty.channel.Channel embeded_channel)
- Specified by:
setEmbeddedChannelin interfaceS7HMux
-
setPrimaryChannel
public void setPrimaryChannel(io.netty.channel.Channel primary_channel)
- Specified by:
setPrimaryChannelin interfaceS7HMux
-
setSecondaryChannel
public void setSecondaryChannel(io.netty.channel.Channel secondary_channel)
- Specified by:
setSecondaryChannelin interfaceS7HMux
-
-