/** JMRIClient lights use the light number on the remote host. */ public JMRIClientLight(int number, JMRIClientSystemConnectionMemo memo) { super(memo.getSystemPrefix() + "l" + number); _number = number; transmitName = memo.getTransmitPrefix() + "L" + number; tc = memo.getJMRIClientTrafficController(); // At construction, register for messages tc.addJMRIClientListener(this); // then request status requestUpdateFromLayout(); }
protected void sendMessage(boolean on) { // get the message text String text; if (on) { text = "LIGHT " + transmitName + " ON\n"; } else // thrown { text = "LIGHT " + transmitName + " OFF\n"; } // create and send the message itself tc.sendJMRIClientMessage(new JMRIClientMessage(text), this); }
// request a status update from the layout protected void requestUpdateFromLayout() { // create the message String text = "LIGHT " + transmitName + "\n"; // create and send the message tc.sendJMRIClientMessage(new JMRIClientMessage(text), this); }