use of jmri.jmrix.loconet.LnPacketizer in project JMRI by JMRI.
the class PR3Adapter method configure.
/**
* Set up all of the other objects to operate with a PR3 connected to this
* port. This overrides the version in loconet.locobuffer, but it has to
* duplicate much of the functionality there, so the code is basically
* copied.
*/
@Override
public void configure() {
setCommandStationType(getOptionState(option2Name));
setTurnoutHandling(getOptionState(option3Name));
if (commandStationType == LnCommandStationType.COMMAND_STATION_PR3_ALONE) {
// PR3 standalone case
// connect to a packetizing traffic controller
// that does echoing
jmri.jmrix.loconet.pr2.LnPr2Packetizer packets = new jmri.jmrix.loconet.pr2.LnPr2Packetizer();
packets.connectPort(this);
// create memo
/*PR3SystemConnectionMemo memo
= new PR3SystemConnectionMemo(packets, new SlotManager(packets));*/
this.getSystemConnectionMemo().setLnTrafficController(packets);
// do the common manager config
this.getSystemConnectionMemo().configureCommandStation(commandStationType, mTurnoutNoRetry, mTurnoutExtraSpace);
this.getSystemConnectionMemo().configureManagersPR2();
// start operation
packets.startThreads();
// set mode
LocoNetMessage msg = new LocoNetMessage(6);
msg.setOpCode(0xD3);
msg.setElement(1, 0x10);
// set PR2
msg.setElement(2, 1);
msg.setElement(3, 0);
msg.setElement(4, 0);
packets.sendLocoNetMessage(msg);
} else {
// MS100 modes - connecting to a separate command station
// connect to a packetizing traffic controller
LnPacketizer packets = new LnPacketizer();
packets.connectPort(this);
// create memo
/*PR3SystemConnectionMemo memo
= new PR3SystemConnectionMemo(packets, new SlotManager(packets));*/
this.getSystemConnectionMemo().setLnTrafficController(packets);
// do the common manager config
this.getSystemConnectionMemo().configureCommandStation(commandStationType, mTurnoutNoRetry, mTurnoutExtraSpace);
this.getSystemConnectionMemo().configureManagersMS100();
// start operation
packets.startThreads();
// set mode
LocoNetMessage msg = new LocoNetMessage(6);
msg.setOpCode(0xD3);
msg.setElement(1, 0x10);
// set MS100, no power
msg.setElement(2, 0);
if (commandStationType == LnCommandStationType.COMMAND_STATION_STANDALONE) {
// set MS100, with power
msg.setElement(2, 3);
}
msg.setElement(3, 0);
msg.setElement(4, 0);
packets.sendLocoNetMessage(msg);
}
}
use of jmri.jmrix.loconet.LnPacketizer in project JMRI by JMRI.
the class MS100Adapter method configure.
/**
* set up all of the other objects to operate with a MS100 connected to this
* port
*/
@Override
public void configure() {
setCommandStationType(getOptionState(option2Name));
setTurnoutHandling(getOptionState(option3Name));
// connect to a packetizing traffic controller
LnPacketizer packets = new LnPacketizer();
packets.connectPort(this);
// create memo
this.getSystemConnectionMemo().setLnTrafficController(packets);
// do the common manager config
this.getSystemConnectionMemo().configureCommandStation(commandStationType, mTurnoutNoRetry, mTurnoutExtraSpace);
this.getSystemConnectionMemo().configureManagers();
// start operation
packets.startThreads();
}
use of jmri.jmrix.loconet.LnPacketizer in project JMRI by JMRI.
the class LocoNetBluetoothAdapter method configure.
/**
* Set up all of the other objects to operate.
*/
@Override
public void configure() {
setCommandStationType(getOptionState(option1Name));
setTurnoutHandling(getOptionState(option2Name));
// connect to a packetizing traffic controller
LnPacketizer packets = new LnPacketizer();
packets.connectPort(this);
// create memo
this.getSystemConnectionMemo().setLnTrafficController(packets);
// do the common manager config
this.getSystemConnectionMemo().configureCommandStation(commandStationType, mTurnoutNoRetry, mTurnoutExtraSpace);
this.getSystemConnectionMemo().configureManagers();
// start operation
packets.startThreads();
}
use of jmri.jmrix.loconet.LnPacketizer in project JMRI by JMRI.
the class HexFileFrame method configure.
public void configure() {
if (port == null) {
log.error("initComponents called before adapter has been set");
return;
}
// connect to a packetizing LnTrafficController
packets = new LnPacketizer();
packets.connectPort(port);
connected = true;
// create memo
port.getSystemConnectionMemo().setLnTrafficController(packets);
// do the common manager config
// full featured by default
port.getSystemConnectionMemo().configureCommandStation(// full featured by default
LnCommandStationType.COMMAND_STATION_DCS100, false, false);
port.getSystemConnectionMemo().configureManagers();
LnSensorManager LnSensorManager = (LnSensorManager) port.getSystemConnectionMemo().getSensorManager();
// NOI18N
LnSensorManager.setDefaultSensorState(port.getOptionState("SensorDefaultState"));
// Install a debug programmer, replacing the existing LocoNet one
jmri.ProgrammerManager ep = port.getSystemConnectionMemo().getProgrammerManager();
port.getSystemConnectionMemo().setProgrammerManager(new jmri.progdebugger.DebugProgrammerManager(port.getSystemConnectionMemo()));
jmri.InstanceManager.setProgrammerManager(port.getSystemConnectionMemo().getProgrammerManager());
jmri.InstanceManager.deregister(ep, jmri.ProgrammerManager.class);
jmri.InstanceManager.deregister(ep, jmri.AddressedProgrammerManager.class);
jmri.InstanceManager.deregister(ep, jmri.GlobalProgrammerManager.class);
// Install a debug throttle manager, replacing the existing LocoNet one
port.getSystemConnectionMemo().setThrottleManager(new jmri.jmrix.debugthrottle.DebugThrottleManager(port.getSystemConnectionMemo()));
jmri.InstanceManager.setThrottleManager(port.getSystemConnectionMemo().getThrottleManager());
// start operation of packetizer
packets.startThreads();
sourceThread = new Thread(port);
sourceThread.start();
}
use of jmri.jmrix.loconet.LnPacketizer in project JMRI by JMRI.
the class HexFileServer method configure.
public void configure() {
if (port == null) {
log.error("initComponents called before adapter has been set");
return;
}
// connect to a packetizing LnTrafficController
packets = new LnPacketizer();
packets.connectPort(port);
connected = true;
// create memo
port.getSystemConnectionMemo().setLnTrafficController(packets);
// do the common manager config
// full featured by default
port.getSystemConnectionMemo().configureCommandStation(// full featured by default
LnCommandStationType.COMMAND_STATION_DCS100, false, false);
port.getSystemConnectionMemo().configureManagers();
// Install a debug programmer, replacing the existing LocoNet one
port.getSystemConnectionMemo().setProgrammerManager(new jmri.progdebugger.DebugProgrammerManager(port.getSystemConnectionMemo()));
jmri.InstanceManager.setProgrammerManager(port.getSystemConnectionMemo().getProgrammerManager());
// Install a debug throttle manager, replacing the existing LocoNet one
port.getSystemConnectionMemo().setThrottleManager(new jmri.jmrix.debugthrottle.DebugThrottleManager(port.getSystemConnectionMemo()));
jmri.InstanceManager.setThrottleManager(port.getSystemConnectionMemo().getThrottleManager());
// start operation of packetizer
packets.startThreads();
sourceThread = new Thread(port);
sourceThread.start();
}
Aggregations