Search in sources :

Example 1 with Plc4xNettyWrapper

use of org.apache.plc4x.java.spi.Plc4xNettyWrapper in project plc4x by apache.

the class CustomProtocolStackConfigurer method configurePipeline.

/**
 * Applies the given Stack to the Pipeline
 */
@Override
public Plc4xProtocolBase<BASE_PACKET_CLASS> configurePipeline(Configuration configuration, ChannelPipeline pipeline, boolean passive, List<EventListener> ignore) {
    if (this.encryptionHandler != null) {
        pipeline.addLast(this.encryptionHandler);
    }
    pipeline.addLast(getMessageCodec(configuration));
    Plc4xProtocolBase<BASE_PACKET_CLASS> protocol = configure(configuration, this.protocol.apply(configuration));
    DriverContext driverContext = this.driverContext.apply(configuration);
    if (driverContext != null) {
        protocol.setDriverContext(driverContext);
    }
    Plc4xNettyWrapper<BASE_PACKET_CLASS> context = new Plc4xNettyWrapper<>(pipeline, passive, protocol, basePacketClass);
    pipeline.addLast(context);
    return protocol;
}
Also used : DriverContext(org.apache.plc4x.java.spi.context.DriverContext) Plc4xNettyWrapper(org.apache.plc4x.java.spi.Plc4xNettyWrapper)

Aggregations

Plc4xNettyWrapper (org.apache.plc4x.java.spi.Plc4xNettyWrapper)1 DriverContext (org.apache.plc4x.java.spi.context.DriverContext)1