use of org.traccar.handler.NetworkMessageHandler in project traccar by tananaev.
the class BasePipelineFactory method initChannel.
@Override
protected void initChannel(Channel channel) {
final ChannelPipeline pipeline = channel.pipeline();
addTransportHandlers(pipeline::addLast);
if (timeout > 0 && !connector.isDatagram()) {
pipeline.addLast(new IdleStateHandler(timeout, 0, 0));
}
pipeline.addLast(new OpenChannelHandler(connector));
pipeline.addLast(new NetworkMessageHandler());
pipeline.addLast(new StandardLoggingHandler(protocol));
addProtocolHandlers(handler -> {
if (!(handler instanceof BaseProtocolDecoder || handler instanceof BaseProtocolEncoder)) {
if (handler instanceof ChannelInboundHandler) {
handler = new WrapperInboundHandler((ChannelInboundHandler) handler);
} else {
handler = new WrapperOutboundHandler((ChannelOutboundHandler) handler);
}
}
pipeline.addLast(handler);
});
addHandlers(pipeline, TimeHandler.class, GeolocationHandler.class, HemisphereHandler.class, DistanceHandler.class, RemoteAddressHandler.class, FilterHandler.class, GeocoderHandler.class, SpeedLimitHandler.class, MotionHandler.class, CopyAttributesHandler.class, EngineHoursHandler.class, ComputedAttributesHandler.class, WebDataHandler.class, DefaultDataHandler.class, CommandResultEventHandler.class, OverspeedEventHandler.class, BehaviorEventHandler.class, FuelDropEventHandler.class, MotionEventHandler.class, GeofenceEventHandler.class, AlertEventHandler.class, IgnitionEventHandler.class, MaintenanceEventHandler.class, DriverEventHandler.class);
pipeline.addLast(new MainEventHandler());
}
Aggregations