use of org.openlcb.can.OpenLcbCanFrame in project JMRI by JMRI.
the class OlcbConfigurationManager method convertFromCan.
static OpenLcbCanFrame convertFromCan(jmri.jmrix.can.CanFrame message) {
OpenLcbCanFrame fin = new OpenLcbCanFrame(0);
fin.setHeader(message.getHeader());
if (message.getNumDataElements() == 0) {
return fin;
}
byte[] data = new byte[message.getNumDataElements()];
for (int i = 0; i < data.length; ++i) {
data[i] = (byte) (message.getElement(i) & 0xff);
}
fin.setData(data);
return fin;
}
use of org.openlcb.can.OpenLcbCanFrame in project JMRI by JMRI.
the class MonitorPane method frameToMessages.
// see jmri.jmrix.openlcb.OlcbConfigurationManager
java.util.List<Message> frameToMessages(int header, int len, int[] content) {
OpenLcbCanFrame frame = new OpenLcbCanFrame(header & 0xFFF);
frame.setHeader(header);
if (len != 0) {
byte[] data = new byte[len];
for (int i = 0; i < data.length; i++) {
data[i] = (byte) content[i];
}
frame.setData(data);
}
aliasMap.processFrame(frame);
java.util.List<Message> list = messageBuilder.processFrame(frame);
return list;
}
Aggregations