Search in sources :

Example 1 with JmriConfigurationManager

use of jmri.implementation.JmriConfigurationManager in project JMRI by JMRI.

the class SampleMinimalProgram method codeConfig.

protected void codeConfig(String[] args) {
    jmri.jmrix.SerialPortAdapter adapter = jmri.jmrix.lenz.li100.LI100Adapter.instance();
    //jmri.jmrix.SerialPortAdapter adapter =  jmri.jmrix.nce.serialdriver.SerialDriverAdapter.instance();
    String portName = "/dev/cu.Bluetooth-PDA-Sync";
    String baudRate = "9600";
    //String option1Setting = null;
    //String option2Setting = null;
    adapter.setPort(portName);
    adapter.configureBaudRate(baudRate);
    //if (option1Setting !=null) adapter.configureOption1(option1Setting);
    //if (option2Setting !=null) adapter.configureOption2(option2Setting);
    adapter.openPort(portName, "JMRI app");
    adapter.configure();
    ConfigureManager cm = new JmriConfigurationManager();
    // not setting preference file location!
    InstanceManager.setConfigureManager(cm);
    // needs an error handler that doesn't invoke swing; send to log4j?
    // start web server
    final int port = 12080;
    WebServerPreferences.getDefault().setPort(port);
    try {
        WebServer.getDefault().start();
    } catch (Exception ex) {
        log.error("Unable to start web server.", ex);
    }
    log.info("Up!");
}
Also used : ConfigureManager(jmri.ConfigureManager) JmriConfigurationManager(jmri.implementation.JmriConfigurationManager)

Example 2 with JmriConfigurationManager

use of jmri.implementation.JmriConfigurationManager in project JMRI by JMRI.

the class AppsBase method installConfigurationManager.

protected void installConfigurationManager() {
    ConfigureManager cm = new JmriConfigurationManager();
    FileUtil.createDirectory(FileUtil.getUserFilesPath());
    InstanceManager.store(cm, ConfigureManager.class);
    InstanceManager.setDefault(ConfigureManager.class, cm);
    log.debug("config manager installed");
}
Also used : ConfigureManager(jmri.ConfigureManager) JmriConfigurationManager(jmri.implementation.JmriConfigurationManager)

Aggregations

ConfigureManager (jmri.ConfigureManager)2 JmriConfigurationManager (jmri.implementation.JmriConfigurationManager)2