Ejemplo n.º 1
0
 /** 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();
 }
Ejemplo n.º 2
0
  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);
  }
Ejemplo n.º 3
0
 // 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);
 }