use of org.apache.plc4x.java.canopen.protocol.CANOpenProtocolLogic in project plc4x by apache.
the class CANOpenPlcDriver method getStackConfigurer.
@Override
protected ProtocolStackConfigurer<Message> getStackConfigurer(Transport transport) {
if (!(transport instanceof CANTransport)) {
throw new PlcRuntimeException("CANopen driver requires a CAN transport instance");
}
final CANTransport<Message> canTransport = (CANTransport<Message>) transport;
return CustomProtocolStackConfigurer.builder(canTransport.getMessageType(), canTransport::getMessageInput).withProtocol(cfg -> {
CANOpenProtocolLogic protocolLogic = new CANOpenProtocolLogic();
ConfigurationFactory.configure(cfg, protocolLogic);
return new CANDriverAdapter<>(protocolLogic, canTransport.getMessageType(), canTransport.adapter(), new CANOpenFrameDataHandler(canTransport::getTransportFrameBuilder));
}).withDriverContext(cfg -> new CANOpenDriverContext()).withPacketSizeEstimator(configuration1 -> canTransport.getEstimator()).littleEndian().build();
}
Aggregations