use of org.openlcb.can.CanInterface in project JMRI by JMRI.
the class OlcbConfigurationManager method createOlcbCanInterface.
public static CanInterface createOlcbCanInterface(NodeID nodeID, TrafficController tc) {
final CanInterface olcbIf = new CanInterface(nodeID, frame -> tc.sendCanMessage(convertToCan(frame), null));
tc.addCanListener(new CanListener() {
@Override
public void message(CanMessage m) {
// ignored -- loopback is handled by the olcbInterface.
}
@Override
public void reply(CanReply m) {
if (!m.isExtended() || m.isRtr()) {
return;
}
olcbIf.frameInput().send(convertFromCan(m));
}
});
return olcbIf;
}
Aggregations