use of org.openlcb.can.AliasMap in project JMRI by JMRI.
the class MonitorPane method initComponents.
@Override
public void initComponents(CanSystemConnectionMemo memo) {
this.memo = memo;
memo.getTrafficController().addCanListener(this);
aliasMap = memo.get(org.openlcb.can.AliasMap.class);
messageBuilder = new MessageBuilder(aliasMap);
setFixedWidthFont();
}
use of org.openlcb.can.AliasMap in project JMRI by JMRI.
the class OlcbConfigurationManager method configureManagers.
@Override
public void configureManagers() {
// create our NodeID
getOurNodeID();
// do the connections
tc = adapterMemo.getTrafficController();
olcbCanInterface = createOlcbCanInterface(nodeID, tc);
// create JMRI objects
InstanceManager.setSensorManager(getSensorManager());
InstanceManager.setTurnoutManager(getTurnoutManager());
InstanceManager.setThrottleManager(getThrottleManager());
InstanceManager.setProgrammerManager(getProgrammerManager());
// start alias acquisition
new StartUpHandler().start();
OlcbInterface iface = getInterface();
loaderClient = new LoaderClient(iface.getOutputConnection(), iface.getMemoryConfigurationService(), iface.getDatagramService());
iface.registerMessageListener(loaderClient);
iface.registerMessageListener(new SimpleNodeIdentInfoHandler());
aliasMap = new AliasMap();
tc.addCanListener(new CanListener() {
@Override
public void message(CanMessage m) {
if (!m.isExtended() || m.isRtr()) {
return;
}
aliasMap.processFrame(convertFromCan(m));
}
@Override
public void reply(CanReply m) {
if (!m.isExtended() || m.isRtr()) {
return;
}
aliasMap.processFrame(convertFromCan(m));
}
});
messageBuilder = new MessageBuilder(aliasMap);
}
use of org.openlcb.can.AliasMap in project JMRI by JMRI.
the class OpenLcbCanSendPane method initComponents.
@Override
public void initComponents(CanSystemConnectionMemo memo) {
super.initComponents(memo);
iface = memo.get(OlcbInterface.class);
actions = new ClientActions(iface);
tc = memo.getTrafficController();
tc.addCanListener(this);
connection = memo.get(org.openlcb.Connection.class);
srcNodeID = memo.get(org.openlcb.NodeID.class);
aliasMap = memo.get(org.openlcb.can.AliasMap.class);
// register request for notification
Connection.ConnectionListener cl = new Connection.ConnectionListener() {
@Override
public void connectionActive(Connection c) {
log.debug("connection active");
// load the alias field
srcAliasField.setText(Integer.toHexString(aliasMap.getAlias(srcNodeID)));
}
};
connection.registerStartNotification(cl);
mcs = memo.get(MemoryConfigurationService.class);
store = memo.get(MimicNodeStore.class);
nodeSelector = new NodeSelector(store);
setLayout(new BoxLayout(this, BoxLayout.Y_AXIS));
// handle single-packet part
{
JPanel pane1 = new JPanel();
pane1.setLayout(new BoxLayout(pane1, BoxLayout.Y_AXIS));
jLabel1.setText("Single Frame: (Raw input format is [123] 12 34 56) ");
jLabel1.setVisible(true);
sendButton.setText("Send");
sendButton.setVisible(true);
sendButton.setToolTipText("Send frame");
packetTextField.setToolTipText("Frame as hex pairs, e.g. 82 7D; standard header in (), extended in []");
pane1.add(jLabel1);
pane1.add(packetTextField);
pane1.add(sendButton);
pane1.add(Box.createVerticalGlue());
sendButton.addActionListener(new java.awt.event.ActionListener() {
@Override
public void actionPerformed(java.awt.event.ActionEvent e) {
sendButtonActionPerformed(e);
}
});
add(pane1);
}
add(new JSeparator());
// Configure the sequence
add(new JLabel("Send sequence of frames:"));
JPanel pane2 = new JPanel();
pane2.setLayout(new GridLayout2(MAXSEQUENCE + 2, 4));
pane2.add(new JLabel(""));
pane2.add(new JLabel("Send"));
pane2.add(new JLabel("packet"));
pane2.add(new JLabel("wait (msec)"));
for (int i = 0; i < MAXSEQUENCE; i++) {
pane2.add(new JLabel(Integer.toString(i + 1)));
mUseField[i] = new JCheckBox();
mPacketField[i] = new JTextField(10);
mDelayField[i] = new JTextField(10);
pane2.add(mUseField[i]);
pane2.add(mPacketField[i]);
pane2.add(mDelayField[i]);
}
// starts a new row in layout
pane2.add(mRunButton);
add(pane2);
mRunButton.addActionListener(new java.awt.event.ActionListener() {
@Override
public void actionPerformed(java.awt.event.ActionEvent e) {
runButtonActionPerformed(e);
}
});
// special packet forms
add(new JSeparator());
add(new JLabel("Send special frame:"));
pane2 = new JPanel();
pane2.setLayout(new FlowLayout());
pane2.add(new JLabel("Src Node alias:"));
pane2.add(srcAliasField);
add(pane2);
pane2 = new JPanel();
pane2.setLayout(new FlowLayout());
add(pane2);
JButton b;
b = new JButton("Send CIM");
b.addActionListener(new java.awt.event.ActionListener() {
@Override
public void actionPerformed(java.awt.event.ActionEvent e) {
sendCimPerformed(e);
}
});
pane2.add(b);
// send OpenLCB messages
add(new JSeparator());
add(addLineLabel("Send OpenLCB global message:"));
pane2 = new JPanel();
pane2.setLayout(new FlowLayout());
add(pane2);
b = new JButton("Send Verify Nodes Global");
b.addActionListener(new java.awt.event.ActionListener() {
@Override
public void actionPerformed(java.awt.event.ActionEvent e) {
sendVerifyNodeGlobal(e);
}
});
pane2.add(b);
b = new JButton("Send Verify Node Global with NodeID");
b.addActionListener(new java.awt.event.ActionListener() {
@Override
public void actionPerformed(java.awt.event.ActionEvent e) {
sendVerifyNodeGlobalID(e);
}
});
pane2.add(b);
add(new JSeparator());
add(addLineLabel("Send OpenLCB event message:"));
pane2 = new JPanel();
pane2.setLayout(new FlowLayout());
add(pane2);
b = new JButton("Send Request Consumers");
b.addActionListener(new java.awt.event.ActionListener() {
@Override
public void actionPerformed(java.awt.event.ActionEvent e) {
sendReqConsumers(e);
}
});
pane2.add(b);
b = new JButton("Send Request Producers");
b.addActionListener(new java.awt.event.ActionListener() {
@Override
public void actionPerformed(java.awt.event.ActionEvent e) {
sendReqProducers(e);
}
});
pane2.add(b);
b = new JButton("Send Event Produced");
b.addActionListener(new java.awt.event.ActionListener() {
@Override
public void actionPerformed(java.awt.event.ActionEvent e) {
sendEventPerformed(e);
}
});
pane2.add(b);
pane2.add(new JLabel("Event ID (8 bytes):"));
pane2.add(sendEventField);
add(new JSeparator());
add(addLineLabel("Send OpenLCB addressed message to:", nodeSelector));
pane2 = new JPanel();
pane2.setLayout(new FlowLayout());
add(pane2);
b = new JButton("Send Request Events");
b.addActionListener(new java.awt.event.ActionListener() {
@Override
public void actionPerformed(java.awt.event.ActionEvent e) {
sendRequestEvents(e);
}
});
pane2.add(b);
pane2 = new JPanel();
pane2.setLayout(new FlowLayout());
add(pane2);
b = new JButton("Send Datagram");
b.addActionListener(new java.awt.event.ActionListener() {
@Override
public void actionPerformed(java.awt.event.ActionEvent e) {
sendDatagramPerformed(e);
}
});
pane2.add(b);
pane2.add(new JLabel("Contents: "));
pane2.add(datagramContentsField);
b = new JButton("Send Datagram Reply");
b.addActionListener(new java.awt.event.ActionListener() {
@Override
public void actionPerformed(java.awt.event.ActionEvent e) {
sendDatagramReply(e);
}
});
pane2.add(b);
// send OpenLCB Configuration message
add(new JSeparator());
add(addLineLabel("Send OpenLCB Configuration Command:"));
pane2 = new JPanel();
pane2.setLayout(new FlowLayout());
add(pane2);
pane2.add(new JLabel("Memory Address: "));
pane2.add(configAddressField);
pane2.add(new JLabel("Address Space: "));
pane2.add(addrSpace);
pane2 = new JPanel();
pane2.setLayout(new FlowLayout());
add(pane2);
pane2.add(new JLabel("Byte Count: "));
pane2.add(configNumberField);
b = new JButton("Read");
b.addActionListener(new java.awt.event.ActionListener() {
@Override
public void actionPerformed(java.awt.event.ActionEvent e) {
readPerformed(e);
}
});
pane2.add(b);
pane2.add(new JLabel("Data: "));
pane2.add(readDataField);
pane2 = new JPanel();
pane2.setLayout(new FlowLayout());
add(pane2);
b = new JButton("Write");
b.addActionListener(new java.awt.event.ActionListener() {
@Override
public void actionPerformed(java.awt.event.ActionEvent e) {
writePerformed(e);
}
});
pane2.add(b);
pane2.add(new JLabel("Data: "));
// NOI18N
writeDataField.setText("00 00");
pane2.add(writeDataField);
b = new JButton("Open CDI Config Tool");
add(b);
b.addActionListener(new java.awt.event.ActionListener() {
@Override
public void actionPerformed(java.awt.event.ActionEvent e) {
openCdiPane();
}
});
}
Aggregations