Exemplo n.º 1
0
 public RawTurnoutOperator(AbstractTurnout t, long i, int mt) {
   super(t);
   String sysName = t.getSystemName();
   int startAddress = sysName.lastIndexOf("T");
   address = Integer.parseInt(sysName.substring(startAddress + 1, sysName.length()));
   String prefix = t.getSystemName().substring(0, startAddress);
   java.util.List<jmri.CommandStation> connList =
       jmri.InstanceManager.getList(jmri.CommandStation.class);
   for (int x = 0; x < connList.size(); x++) {
     jmri.CommandStation station = connList.get(x);
     if (station.getSystemPrefix().equals(prefix)) {
       c = station;
       break;
     }
   }
   if (c == null) {
     c = InstanceManager.commandStationInstance();
     log.error(
         "No match against the command station for " + sysName + ", so will use the default");
   }
   interval = i;
   maxTries = mt;
 }
Exemplo n.º 2
0
 private void sendCommand() {
   byte pkt[] =
       jmri.NmraPacket.accDecoderPkt(address, myTurnout.getCommandedState() == Turnout.CLOSED);
   c.sendPacket(pkt, 1);
 }