Search in sources :

Example 31 with Reporter

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;
}
Also used : Reporter(jmri.Reporter)

Example 32 with Reporter

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;
}
Also used : Reporter(jmri.Reporter)

Example 33 with Reporter

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;
}
Also used : Reporter(jmri.Reporter)

Example 34 with Reporter

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())));
}
Also used : Reporter(jmri.Reporter) Test(org.junit.Test)

Example 35 with Reporter

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);
}
Also used : Reporter(jmri.Reporter) Test(org.junit.Test)

Aggregations

Reporter (jmri.Reporter)55 Test (org.junit.Test)18 ReporterManager (jmri.ReporterManager)10 Block (jmri.Block)6 Element (org.jdom2.Element)5 JsonNode (com.fasterxml.jackson.databind.JsonNode)4 IOException (java.io.IOException)4 BlockManager (jmri.BlockManager)4 JsonException (jmri.server.json.JsonException)4 Date (java.util.Date)3 JmriException (jmri.JmriException)3 Sensor (jmri.Sensor)3 OBlock (jmri.jmrit.logix.OBlock)3 ObjectMapper (com.fasterxml.jackson.databind.ObjectMapper)2 ObjectNode (com.fasterxml.jackson.databind.node.ObjectNode)2 ParseException (java.text.ParseException)2 PhysicalLocationReporter (jmri.PhysicalLocationReporter)2 Location (jmri.jmrit.operations.locations.Location)2 JsonMockConnection (jmri.server.json.JsonMockConnection)2 GuiLafPreferencesManager (apps.gui.GuiLafPreferencesManager)1