Search in sources :

Example 21 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 22 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();
    b = new JButton("Configure C/MRI nodes");
    b.addActionListener(new NodeConfigAction((CMRISystemConnectionMemo) adapter.getSystemConnectionMemo()));
    if (!additionalItems.contains(b)) {
        additionalItems.add(b);
    }
    super.loadDetails(details);
}
Also used : CMRISystemConnectionMemo(jmri.jmrix.cmri.CMRISystemConnectionMemo) JButton(javax.swing.JButton) NodeConfigAction(jmri.jmrix.cmri.serial.nodeconfig.NodeConfigAction)

Example 23 with CMRISystemConnectionMemo

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

the class SerialDriverAdapter 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);
    ((CMRISystemConnectionMemo) getSystemConnectionMemo()).setTrafficController(tc);
    ((CMRISystemConnectionMemo) getSystemConnectionMemo()).configureManagers();
}
Also used : SerialTrafficController(jmri.jmrix.cmri.serial.SerialTrafficController) CMRISystemConnectionMemo(jmri.jmrix.cmri.CMRISystemConnectionMemo)

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