use of jmri.jmrix.cmri.serial.SerialTrafficController in project JMRI by JMRI.
the class SimDriverAdapter method configure.
/**
* set up all of the other objects to operate connected to this port
*/
@SuppressFBWarnings(value = "ST_WRITE_TO_STATIC_FROM_INSTANCE_METHOD", justification = "Access to 'self' OK until multiple instance pattern installed")
@Override
public void configure() {
// install a traffic controller that doesn't time out
SerialTrafficController tc = new SerialTrafficController() {
// timeout doesn't do anything
@SuppressFBWarnings(value = "ST_WRITE_TO_STATIC_FROM_INSTANCE_METHOD", justification = "only until multi-connect update done")
@Override
protected void handleTimeout(jmri.jmrix.AbstractMRMessage m, jmri.jmrix.AbstractMRListener l) {
}
};
// connect to the traffic controller
tc.connectPort(this);
((CMRISystemConnectionMemo) getSystemConnectionMemo()).setTrafficController(tc);
((CMRISystemConnectionMemo) getSystemConnectionMemo()).configureManagers();
}
use of jmri.jmrix.cmri.serial.SerialTrafficController in project JMRI by JMRI.
the class CMRISystemConnectionMemo method getTrafficController.
/*
* Get the traffic controller instance associated with this connection memo.
*/
public SerialTrafficController getTrafficController() {
if (tc == null) {
setTrafficController(new SerialTrafficController());
log.debug("Auto create of SerialTrafficController for initial configuration");
}
return tc;
}
use of jmri.jmrix.cmri.serial.SerialTrafficController in project JMRI by JMRI.
the class NetworkDriverAdapter method configure.
/**
* set up all of the other objects to operate connected to this port
*/
@Override
public void configure() {
// connect to the traffic controller
SerialTrafficController tc = new SerialTrafficController();
tc.connectPort(this);
getSystemConnectionMemo().setTrafficController(tc);
getSystemConnectionMemo().configureManagers();
}
use of jmri.jmrix.cmri.serial.SerialTrafficController in project JMRI by JMRI.
the class ConnectionConfigXml method extendElement.
/**
* Write out the SerialNode objects too
*
* @param e Element being extended
*/
@SuppressFBWarnings(value = "SBSC_USE_STRINGBUFFER_CONCATENATION")
// though it would be good to fix it if you're working in this area
@Override
protected void extendElement(Element e) {
SerialTrafficController tc = ((CMRISystemConnectionMemo) adapter.getSystemConnectionMemo()).getTrafficController();
SerialNode node = (SerialNode) tc.getNode(0);
int index = 1;
while (node != null) {
// add node as an element
Element n = new Element("node");
n.setAttribute("name", "" + node.getNodeAddress());
e.addContent(n);
// add parameters to the node as needed
n.addContent(makeParameter("nodetype", "" + node.getNodeType()));
n.addContent(makeParameter("bitspercard", "" + node.getNumBitsPerCard()));
n.addContent(makeParameter("transmissiondelay", "" + node.getTransmissionDelay()));
n.addContent(makeParameter("num2lsearchlights", "" + node.getNum2LSearchLights()));
n.addContent(makeParameter("pulsewidth", "" + node.getPulseWidth()));
String value = "";
for (int i = 0; i < node.getLocSearchLightBits().length; i++) {
value = value + Integer.toHexString(node.getLocSearchLightBits()[i] & 0xF);
}
n.addContent(makeParameter("locsearchlightbits", "" + value));
value = "";
for (int i = 0; i < node.getCardTypeLocation().length; i++) {
value = value + Integer.toHexString(node.getCardTypeLocation()[i] & 0xF);
}
n.addContent(makeParameter("cardtypelocation", "" + value));
// look for the next node
node = (SerialNode) tc.getNode(index);
index++;
}
}
use of jmri.jmrix.cmri.serial.SerialTrafficController in project JMRI by JMRI.
the class ConnectionConfigXml method extendElement.
/**
* Write out the SerialNode objects too
*
* @param e Element being extended
*/
@SuppressFBWarnings(value = "SBSC_USE_STRINGBUFFER_CONCATENATION")
// though it would be good to fix it if you're working in this area
@Override
protected void extendElement(Element e) {
SerialTrafficController tc = ((CMRISystemConnectionMemo) adapter.getSystemConnectionMemo()).getTrafficController();
SerialNode node = (SerialNode) tc.getNode(0);
int index = 1;
while (node != null) {
// add node as an element
Element n = new Element("node");
n.setAttribute("name", "" + node.getNodeAddress());
e.addContent(n);
// add parameters to the node as needed
n.addContent(makeParameter("nodetype", "" + node.getNodeType()));
n.addContent(makeParameter("bitspercard", "" + node.getNumBitsPerCard()));
n.addContent(makeParameter("transmissiondelay", "" + node.getTransmissionDelay()));
n.addContent(makeParameter("num2lsearchlights", "" + node.getNum2LSearchLights()));
n.addContent(makeParameter("pulsewidth", "" + node.getPulseWidth()));
String value = "";
for (int i = 0; i < node.getLocSearchLightBits().length; i++) {
value = value + Integer.toHexString(node.getLocSearchLightBits()[i] & 0xF);
}
n.addContent(makeParameter("locsearchlightbits", "" + value));
value = "";
for (int i = 0; i < node.getCardTypeLocation().length; i++) {
value = value + Integer.toHexString(node.getCardTypeLocation()[i] & 0xF);
}
n.addContent(makeParameter("cardtypelocation", "" + value));
// look for the next node
node = (SerialNode) tc.getNode(index);
index++;
}
}
Aggregations