use of jmri.jmrix.cmri.CMRISystemConnectionMemo in project JMRI by JMRI.
the class SerialPacketGenActionTest method testStringCtor.
@Test
public void testStringCtor() {
Assume.assumeFalse(GraphicsEnvironment.isHeadless());
SerialPacketGenAction action = new SerialPacketGenAction("CMRI test Action", new CMRISystemConnectionMemo());
Assert.assertNotNull("exists", action);
}
use of jmri.jmrix.cmri.CMRISystemConnectionMemo 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.CMRISystemConnectionMemo in project JMRI by JMRI.
the class ConnectionConfig method loadDetails.
@Override
public void loadDetails(JPanel details) {
setInstance();
// have to embed the usual one in a new JPanel
JPanel p = new JPanel();
super.loadDetails(p);
details.setLayout(new BoxLayout(details, BoxLayout.Y_AXIS));
details.add(p);
// add another button
JButton b = new JButton("Configure C/MRI nodes");
details.add(b);
b.addActionListener(new NodeConfigAction((CMRISystemConnectionMemo) adapter.getSystemConnectionMemo()));
}
use of jmri.jmrix.cmri.CMRISystemConnectionMemo 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.CMRISystemConnectionMemo in project JMRI by JMRI.
the class SerialPacketGenFrameTest method testMemoCtor.
@Test
public void testMemoCtor() {
Assume.assumeFalse(GraphicsEnvironment.isHeadless());
SerialPacketGenFrame action = new SerialPacketGenFrame(new CMRISystemConnectionMemo());
Assert.assertNotNull("exists", action);
}
Aggregations