Examples of SerialParameters


Examples of br.org.scadabr.dnp34j.master.session.config.SerialParameters

  public static void main(String[] args) throws Exception {
    // DNPConfig config = new DNPConfig(new EthernetParameters(
    // "150.162.165.190", 20000), 3, 4);

    DNPConfig config = new DNPConfig(new SerialParameters("COM2", 9600), 3,
        4);
    user = new DNPUser(config);

    user.init();
    // 69775326259457
View Full Code Here

Examples of br.org.scadabr.dnp34j.master.session.config.SerialParameters

        setPhyETHERNET(new PhyETHERNET(this));

        setInputStream(phyETHERNET.getInputStream());
        setOutputStream(phyETHERNET.getOutputStream());
      } else if (config.getCommType() == COMM.SERIAL) {
        SerialParameters parameters = (SerialParameters) config
            .getCommConfig();
        setCommAddress(parameters.getCommAddress());
        setBaudrate(parameters.getBaudrate());
        setDataBits(parameters.getDatabits());
        setStopBits(parameters.getStopbits());
        setParity(parameters.getParity());
        setPhySERIAL(new PhySERIAL(this));

        setInputStream(phySERIAL.getInputStream());
        setOutputStream(phySERIAL.getOutputStream());
      }
View Full Code Here

Examples of com.serotonin.io.serial.SerialParameters

   * @throws Exception
   */
  public boolean connect () throws Exception{
    SerialDataSourceVO vo = (SerialDataSourceVO) this.getVo();
   
    SerialParameters params = new SerialParameters();
    params.setCommPortId(vo.getCommPortId());
        params.setPortOwnerName("Mango Serial Data Source");
        params.setBaudRate(vo.getBaudRate());
        params.setFlowControlIn(vo.getFlowControlIn());
        params.setFlowControlOut(vo.getFlowControlOut());
        params.setDataBits(vo.getDataBits());
        params.setStopBits(vo.getStopBits());
        params.setParity(vo.getParity());
        params.setRecieveTimeout(vo.getReadTimeout());
   
        if ( SerialUtils.portOwned(vo.getCommPortId()) ){
      raiseEvent(DATA_SOURCE_EXCEPTION_EVENT, System.currentTimeMillis(), true, new TranslatableMessage("event.serial.portInUse",vo.getCommPortId()));
      return false;
        }else{
View Full Code Here

Examples of com.serotonin.io.serial.SerialParameters

    } catch (Exception e) {
      // TODO: handle exception
    }

    SerialParameters serialParams = new SerialParameters();

    serialParams.setCommPortId(commPortId);
    serialParams.setBaudRate(baudrate);
    serialParams.setDataBits(dataBits);
    serialParams.setStopBits(stopBits);
    serialParams.setParity(parity);

    // System.out.println("serialParams [commPortId]:: " + commPortId);
    // System.out.println("serialParams [baudrate]:: " + baudrate);
    // System.out.println("serialParams [dataBits]:: " + dataBits);
    // System.out.println("serialParams [stopBits]:: " + stopBits);
View Full Code Here

Examples of com.serotonin.io.serial.SerialParameters

    }

    private static void configureSerial(Config configuration) {
        ModbusFactory factory = new ModbusFactory();
        SerialParameters params = new SerialParameters();
        String port = configuration.getStringProperty("port", "/dev/ttyUSB10");
        int baudrate = configuration.getIntProperty("baudrate", 19200);
        System.out.println("baudrate: " + baudrate);
        int databits = configuration.getIntProperty("data-bits", SerialPort.DATABITS_8);
        System.out.println("databits: " + databits);
        int parity = configuration.getIntProperty("parity", SerialPort.PARITY_EVEN);
        System.out.println("parity: " + parity);
        int stopbits = configuration.getIntProperty("stop-bits", SerialPort.STOPBITS_1);
        System.out.println("stopbits: " + stopbits);
        params.setCommPortId(port);
        params.setBaudRate(baudrate);
        params.setDataBits(databits);
        params.setParity(parity);
        params.setStopBits(stopbits);
        master = factory.createRtuMaster(params, SerialMaster.SYNC_FUNCTION);
        connectionInfo = "Serial Connection to: " + port;
    }
View Full Code Here

Examples of net.wimpi.modbus.util.SerialParameters

        System.out.println("Exiting");
        System.exit(0);
      }

      //2. Setup serial parameters
      SerialParameters params = new SerialParameters();
      params.setPortName(portname);
      params.setBaudRate(38400);
      params.setDatabits(8);
      params.setParity("None");
      params.setStopbits(1);
      params.setEncoding("rtu");
      params.setEcho(true);
      if (Modbus.debug) System.out.println("Encoding [" + params.getEncoding() + "]");

      //3. Create the master facade
      msm = new ModbusSerialMaster(params);
      msm.connect();
View Full Code Here

Examples of net.wimpi.modbus.util.SerialParameters

      System.out.println("net.wimpi.modbus.debug set to: " +
                         System.getProperty("net.wimpi.modbus.debug"));

      //3. Setup serial parameters
      SerialParameters params = new SerialParameters();
      params.setPortName(portname);
      params.setBaudRate(115200);
      params.setDatabits(7);
      params.setParity("None");
      params.setStopbits(2);
//       params.setEncoding("rtu");
//       params.setEcho(true);
      if (Modbus.debug) System.out.println("Encoding [" + params.getEncoding() + "]");

      //4. Open the connection
      con = new SerialConnection(params);
      con.open();
View Full Code Here

Examples of net.wimpi.modbus.util.SerialParameters

      System.out.println("net.wimpi.modbus.debug set to: " +
                         System.getProperty("net.wimpi.modbus.debug"));

      //3. Setup serial parameters
      SerialParameters params = new SerialParameters();
      params.setPortName(portname);
      params.setBaudRate(9600);
      params.setDatabits(8);
      params.setParity("None");
      params.setStopbits(1);
      params.setEncoding("ascii");
      params.setEcho(false);
      if (Modbus.debug) System.out.println("Encoding [" + params.getEncoding() + "]");

      //4. Open the connection
      con = new SerialConnection(params);
      con.open();
View Full Code Here

Examples of net.wimpi.modbus.util.SerialParameters

      ModbusCoupler.getReference().setProcessImage(spi);
      ModbusCoupler.getReference().setMaster(false);
      ModbusCoupler.getReference().setUnitID(2);

      //3. Set up serial parameters
      SerialParameters params = new SerialParameters();
      params.setPortName(portname);
      params.setBaudRate(9600);
      params.setDatabits(8);
      params.setParity("None");
      params.setStopbits(1);
      params.setEncoding("ascii");
      params.setEcho(false);
      if (Modbus.debug) System.out.println("Encoding [" + params.getEncoding() + "]");

      //4. Set up serial listener
      listener = new ModbusSerialListener(params);
      listener.setListening(true);
View Full Code Here

Examples of net.wimpi.modbus.util.SerialParameters

      //      while (portlist.hasMoreElements()) {
      //        logger.debug(portlist.nextElement().toString());
      //      }

      if (connection == null) {
        SerialParameters params = new SerialParameters();
        params.setPortName(port);
        params.setBaudRate(baud);
        params.setDatabits(dataBits);
        params.setParity(parity);
        params.setStopbits(stopBits);
        params.setEncoding(Modbus.SERIAL_ENCODING_RTU);
        params.setEcho(false);
        connection = new SerialConnection(params);
        connection.open();
      }
      if (!connection.isOpen()) {
        connection.open();
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.