Package gnu.io

Examples of gnu.io.CommPortIdentifier.open()


        Enumeration ports = CommPortIdentifier.getPortIdentifiers();
        while (ports.hasMoreElements()) {
            CommPortIdentifier com = (CommPortIdentifier) ports.nextElement();
            if (com.getPortType() == CommPortIdentifier.PORT_SERIAL) {
                try {
                    CommPort port = com.open("CommUtil", 50);
                    port.close();
                    p.add(com.getName());
                } catch (PortInUseException e) {
                    Log.info("Port " + com.getName() + " busy.");
                } catch (Exception e) {
View Full Code Here


    if ( ! isCommonPortname ) {
            System.setProperty("gnu.io.rxtx.SerialPorts", portname);
        }
    System.setProperty("gnu.io.rxtx.NoVersionOutput", "true");
    CommPortIdentifier commPortIdentifier = CommPortIdentifier.getPortIdentifier(portname);
    CommPort commPort = commPortIdentifier.open("tc65sh", 2000);
    serialPort = (SerialPort) commPort;
    serialPort.setSerialPortParams(baudrate, SerialPort.DATABITS_8, SerialPort.STOPBITS_1, SerialPort.PARITY_NONE);
    serialPort.enableReceiveTimeout(2000);
    if ( flowControl == FLOWCONTROL_NONE ) {
      serialPort.setFlowControlMode(SerialPort.FLOWCONTROL_NONE);
View Full Code Here

        {
            System.out.println("Error: Port is currently in use");
        }
        else
        {
            CommPort commPort = portIdentifier.open(this.getClass().getName(),2000);
           
            if ( commPort instanceof SerialPort )
            {
                serialPort = (SerialPort) commPort;
                serialPort.setSerialPortParams(115200,SerialPort.DATABITS_8,SerialPort.STOPBITS_1,SerialPort.PARITY_NONE);
View Full Code Here

        if (port != null) {
            return;
        }
        try {
            CommPortIdentifier portId = CommPortIdentifier.getPortIdentifier(portName);
            port = (SerialPort) portId.open("SMSEngine", OPEN_PORT_TIMEOUT);
            out = new OutputStreamWriter(port.getOutputStream(), "ISO-8859-1");
            in = new InputStreamReader(port.getInputStream(), "UTF-8");
        } catch (NoSuchPortException e) {
            log.error("Port opening error (RXTX init). Port not found [" + portName + "]. Under Linux check lock file in /var/lock/");
            throw new RuntimeException(e);
View Full Code Here

            {
              success=0;
              break;
            }
          CommPortIdentifier portId = CommPortIdentifier.getPortIdentifier(porta);
            SerialPort sp = (SerialPort)portId.open("Sms_GSM", 0);
            sp.setSerialPortParams(9600, SerialPort.DATABITS_8, SerialPort.STOPBITS_1, SerialPort.PARITY_NONE);
            sp.setFlowControlMode(sp.FLOWCONTROL_NONE);

            in = sp.getInputStream();
            out = sp.getOutputStream();
View Full Code Here

  SerialToGsm(String porta) {
        try {
//            CommPortIdentifier portId = CommPortIdentifier.getPortIdentifier("serial0");
            portnum=porta;
          CommPortIdentifier portId = CommPortIdentifier.getPortIdentifier(porta);
            SerialPort sp = (SerialPort)portId.open("Sms_GSM", 0);
            sp.setSerialPortParams(9600, SerialPort.DATABITS_8, SerialPort.STOPBITS_1, SerialPort.PARITY_NONE);
            sp.setFlowControlMode(sp.FLOWCONTROL_NONE);

            in = sp.getInputStream();
            out = sp.getOutputStream();
View Full Code Here

        CommPortIdentifier identifier = findCommPortIdentifier(comPort);
        if (identifier == null) {
          throw new RuntimeException("ComPort not found: " + comPort);
        }

        port = (SerialPort)identifier.open(SerialPortNfcDevice.class.getName() + "." + comPort,
            TIMEOUT_FOR_OPEN);

        port.setInputBufferSize(SERIAL_PORT_BUFFER_SIZE);
        //        initSerialPortEventListener();
View Full Code Here

    CommPortIdentifier portIdentifier = CommPortIdentifier
        .getPortIdentifier(com);
    // if (portIdentifier.isCurrentlyOwned()) {
    // System.out.println("Error: Port is currently in use");
    // } else {
    CommPort commPort = portIdentifier
        .open(this.getClass().getName(), 2000);
    if (commPort instanceof SerialPort) {
      s = (SerialPort) commPort;
      s.setSerialPortParams(115200, SerialPort.DATABITS_8,
          SerialPort.STOPBITS_1, SerialPort.PARITY_NONE);
View Full Code Here

      CommPortIdentifier portIdentifier = CommPortIdentifier.getPortIdentifier(deviceName);
      if (portIdentifier.isCurrentlyOwned()) {
        throw new CULDeviceException("The port " + deviceName + " is currenty used by "
            + portIdentifier.getCurrentOwner());
      }
      CommPort port = portIdentifier.open(this.getClass().getName(), 2000);
      if (!(port instanceof SerialPort)) {
        throw new CULDeviceException("The device " + deviceName + " is not a serial port");
      }
      serialPort = (SerialPort) port;
      serialPort.setSerialPortParams(baudRate, SerialPort.DATABITS_8, SerialPort.STOPBITS_1, parityMode);
View Full Code Here

        CommPortIdentifier portIdentifier = CommPortIdentifier.getPortIdentifier(name);
          
        if (portIdentifier.isCurrentlyOwned()) {
            throw new Exception(Localization.getString("connection.exception.inuse"));
        } else {
            this.commPort = portIdentifier.open(this.getClass().getName(), 2000);

            SerialPort serialPort = (SerialPort) this.commPort;
            serialPort.setSerialPortParams(baud,SerialPort.DATABITS_8,SerialPort.STOPBITS_1,SerialPort.PARITY_NONE);

            this.in = serialPort.getInputStream();
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.