use of jmri.jmrix.srcp.parser.ASTinfo in project JMRI by JMRI.
the class SRCPBusConnectionMemo method reply.
@Override
public void reply(jmri.jmrix.srcp.parser.SimpleNode n) {
log.debug("SimpleNode Reply called with " + n.toString());
reply(new SRCPReply(n));
if (n.jjtGetChild(1) instanceof ASTinfo) {
jmri.jmrix.srcp.parser.SimpleNode infonode = (jmri.jmrix.srcp.parser.SimpleNode) n.jjtGetChild(1);
if (!((String) ((SimpleNode) (infonode.jjtGetChild(0))).jjtGetValue()).equals("" + _bus)) {
// not for this bus.
return;
}
// managers for this bus.
if (infonode.jjtGetChild(1) instanceof jmri.jmrix.srcp.parser.ASTdescription) {
SimpleNode descnode = (SimpleNode) infonode.jjtGetChild(1);
for (int i = 0; i < descnode.jjtGetNumChildren(); i++) {
jmri.jmrix.srcp.parser.SimpleNode child = (jmri.jmrix.srcp.parser.SimpleNode) descnode.jjtGetChild(i);
log.debug("child node type " + child.toString() + " value " + (String) child.jjtGetValue());
if (child instanceof jmri.jmrix.srcp.parser.ASTdevicegroup) {
String DeviceType = (String) child.jjtGetValue();
if (DeviceType.equals("FB")) {
setSensorManager(new jmri.jmrix.srcp.SRCPSensorManager(this, _bus));
jmri.InstanceManager.setSensorManager(getSensorManager());
} else if (DeviceType.equals("GA")) {
setTurnoutManager(new jmri.jmrix.srcp.SRCPTurnoutManager(this, _bus));
jmri.InstanceManager.setTurnoutManager(getTurnoutManager());
} else if (DeviceType.equals("SM")) {
setProgrammerManager(new SRCPProgrammerManager(new SRCPProgrammer(this), this));
jmri.InstanceManager.setProgrammerManager(getProgrammerManager());
} else if (DeviceType.equals("POWER")) {
setPowerManager(new jmri.jmrix.srcp.SRCPPowerManager(this, _bus));
jmri.InstanceManager.store(getPowerManager(), jmri.PowerManager.class);
} else if (DeviceType.equals("GL")) {
setThrottleManager(new jmri.jmrix.srcp.SRCPThrottleManager(this));
jmri.InstanceManager.setThrottleManager(getThrottleManager());
} else if (DeviceType.equals("TIME")) {
setClockControl(new jmri.jmrix.srcp.SRCPClockControl(this));
}
}
}
configured = true;
synchronized (this) {
// wake up any thread that called configureManagers().
this.notifyAll();
}
}
}
}
Aggregations