Search in sources :

Example 1 with CMRISystemConnectionMemo

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()));
}
Also used : JPanel(javax.swing.JPanel) CMRISystemConnectionMemo(jmri.jmrix.cmri.CMRISystemConnectionMemo) BoxLayout(javax.swing.BoxLayout) JButton(javax.swing.JButton) NodeConfigAction(jmri.jmrix.cmri.serial.nodeconfig.NodeConfigAction)

Example 2 with CMRISystemConnectionMemo

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();
}
Also used : SerialTrafficController(jmri.jmrix.cmri.serial.SerialTrafficController) CMRISystemConnectionMemo(jmri.jmrix.cmri.CMRISystemConnectionMemo) SuppressFBWarnings(edu.umd.cs.findbugs.annotations.SuppressFBWarnings)

Example 3 with CMRISystemConnectionMemo

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++;
    }
}
Also used : SerialTrafficController(jmri.jmrix.cmri.serial.SerialTrafficController) CMRISystemConnectionMemo(jmri.jmrix.cmri.CMRISystemConnectionMemo) SerialNode(jmri.jmrix.cmri.serial.SerialNode) Element(org.jdom2.Element) SuppressFBWarnings(edu.umd.cs.findbugs.annotations.SuppressFBWarnings)

Example 4 with CMRISystemConnectionMemo

use of jmri.jmrix.cmri.CMRISystemConnectionMemo in project JMRI by JMRI.

the class SerialMonFrameTest method testMemoCtor.

@Test
public void testMemoCtor() {
    Assume.assumeFalse(GraphicsEnvironment.isHeadless());
    SerialMonFrame action = new SerialMonFrame(new CMRISystemConnectionMemo());
    Assert.assertNotNull("exists", action);
}
Also used : CMRISystemConnectionMemo(jmri.jmrix.cmri.CMRISystemConnectionMemo) Test(org.junit.Test)

Example 5 with CMRISystemConnectionMemo

use of jmri.jmrix.cmri.CMRISystemConnectionMemo in project JMRI by JMRI.

the class DiagnosticActionTest method testCtor.

@Test
public void testCtor() {
    Assume.assumeFalse(GraphicsEnvironment.isHeadless());
    DiagnosticAction action = new DiagnosticAction(new CMRISystemConnectionMemo());
    Assert.assertNotNull("exists", action);
}
Also used : CMRISystemConnectionMemo(jmri.jmrix.cmri.CMRISystemConnectionMemo) Test(org.junit.Test)

Aggregations

CMRISystemConnectionMemo (jmri.jmrix.cmri.CMRISystemConnectionMemo)23 Test (org.junit.Test)16 SerialTrafficController (jmri.jmrix.cmri.serial.SerialTrafficController)5 SuppressFBWarnings (edu.umd.cs.findbugs.annotations.SuppressFBWarnings)3 NodeConfigAction (jmri.jmrix.cmri.serial.nodeconfig.NodeConfigAction)3 JButton (javax.swing.JButton)2 SerialNode (jmri.jmrix.cmri.serial.SerialNode)2 Element (org.jdom2.Element)2 BoxLayout (javax.swing.BoxLayout)1 JPanel (javax.swing.JPanel)1 SerialTrafficControlScaffold (jmri.jmrix.cmri.serial.SerialTrafficControlScaffold)1 ConnectionConfig (jmri.jmrix.cmri.serial.serialdriver.ConnectionConfig)1 SerialDriverAdapter (jmri.jmrix.cmri.serial.serialdriver.SerialDriverAdapter)1 Ignore (org.junit.Ignore)1