コード例 #1
0
 public String getCommPort() {
   return parameters.getPortName();
 }
コード例 #2
0
  /** Set the parameters object to the settings in the properties object. */
  private void loadParams() throws SerialConnectionException {

    try {
      PropertyResourceBundle props =
          (PropertyResourceBundle) PropertyResourceBundle.getBundle(CONFIG_BUNDLE_NAME);
      System.out.println("BaudRate=" + props.getString("baudRate"));

      ezlink.info("BaudRate= : " + props.getString("baudRate"));

      parameters.setBaudRate(props.getString("baudRate"));
      parameters.setFlowControlIn(props.getString("flowControlIn"));
      parameters.setFlowControlOut(props.getString("flowControlOut"));
      parameters.setParity(props.getString("parity"));
      parameters.setDatabits(props.getString("databits"));
      parameters.setStopbits(props.getString("stopbits"));
      parameters.setPIN(props.getString("pin"));
      parameters.setSMC(props.getString("smc"));

      parameters.setDriver(props.getString("driver"));
      parameters.setURL(props.getString("url"));
      parameters.setUserName(props.getString("username"));
      parameters.setPassword(props.getString("password"));
      parameters.setPortName(props.getString("portName"));

    } catch (Exception exp) {
      ezlink.info("+++Error While setting parameters : +++");
      ezlink.error(new Object(), exp);
      throw new SerialConnectionException("Error While setting parameters=" + exp.getMessage());
    }
  }
コード例 #3
0
 /**
  * Create new <code>SerialDemo</code> and initilizes it. Parses args to find configuration file.
  * If found, initial state it set to parameters in configuration file.
  *
  * @param args command line arguments used when program was invoked.
  */
 public SerialManager(String commPort) throws SerialConnectionException {
   parameters = new SerialParameters();
   parameters.setPortName(commPort);
   connection = new SerialConnection(this, parameters);
   initConfig();
 }