use of jmri.Reporter in project JMRI by JMRI.
the class CbusReporterManager method createNewReporter.
@Override
public Reporter createNewReporter(String systemName, String userName) {
Reporter t;
log.debug("ReporterManager create new CbusReporter: " + systemName);
int addr = Integer.parseInt(systemName.substring(prefix.length() + 1));
t = new CbusReporter(addr, tc, prefix);
t.setUserName(userName);
t.addPropertyChangeListener(this);
return t;
}
use of jmri.Reporter in project JMRI by JMRI.
the class Dcc4PcReporterManager method createNewReporter.
@Override
public Reporter createNewReporter(String systemName, String userName) {
Reporter r = new Dcc4PcReporter(systemName, userName);
register(r);
return r;
}
use of jmri.Reporter in project JMRI by JMRI.
the class Z21ReporterManager method createNewReporter.
@Override
public Reporter createNewReporter(String systemName, String userName) {
if (!systemName.matches(getSystemPrefix() + typeLetter() + "[" + 1 + "]")) {
log.warn("Invalid Reporter name: " + systemName + " - only one reporter supported ");
throw new IllegalArgumentException("Invalid Reporter name: " + systemName + " - only one reporter supported ");
}
// make sure we are going to get railcom data from the command station
// set the broadcast flags so we get messages we may want to hear
_memo.getRocoZ21CommandStation().setRailComMessagesFlag(true);
// and forward the flags to the command station.
_memo.getTrafficController().sendz21Message(Z21Message.getLanSetBroadcastFlagsRequestMessage(_memo.getRocoZ21CommandStation().getZ21BroadcastFlags()), null);
// then create and register the reporter
Reporter r = new Z21Reporter(systemName, userName, _memo);
register(r);
return r;
}
use of jmri.Reporter in project JMRI by JMRI.
the class AbstractReporterMgrTestBase method testDefaultSystemName.
@Test
public void testDefaultSystemName() {
// create
Reporter t = l.provideReporter("" + getNameToTest1());
// check
Assert.assertTrue("real object returned ", t != null);
Assert.assertTrue("system name correct ", t == l.getBySystemName(getSystemName(getNameToTest1())));
}
use of jmri.Reporter in project JMRI by JMRI.
the class AbstractReporterMgrTestBase method testReporterGetByDisplayName.
@Test
public void testReporterGetByDisplayName() {
// Create
Reporter t = l.provideReporter("" + getNameToTest1());
t.setUserName("Fred");
// Try a successful one
t = l.getByDisplayName(getSystemName(getNameToTest1()));
Assert.assertTrue("get retrieved existing object ", t != null);
Reporter t2 = l.getByDisplayName("Fred");
Assert.assertTrue("get retrieved existing object ", t2 == t);
}
Aggregations