Package javax.comm

Examples of javax.comm.CommPortIdentifier.open()


        break;
      }
    }
   
    try {
      serialPort = (SerialPort) portId.open("SerialConnection", 2000);
      outputStream = serialPort.getOutputStream();
      inputStream = serialPort.getInputStream();
      serialPort.setSerialPortParams(9600,
          SerialPort.DATABITS_8,
          SerialPort.STOPBITS_2,
View Full Code Here


    public UARTTransport(String commPortName) throws HCIException {
        try {
            CommPortIdentifier commPort = CommPortIdentifier.getPortIdentifier(commPortName);
            if (commPort.getPortType() != CommPortIdentifier.PORT_SERIAL)
                throw new HCIException(commPortName + " is not a serial port. ");
            SerialPort serial = (SerialPort)commPort.open("Bluetooth", 10000);
            serial.setSerialPortParams(115200, SerialPort.DATABITS_8, SerialPort.STOPBITS_1, SerialPort.PARITY_NONE);
            inStream = serial.getInputStream();
            outStream = serial.getOutputStream();
            readBuffer = new byte[32];
            serial.addEventListener(this);
View Full Code Here

                                portID.getCurrentOwner())) {
                    // NOTE: Do not do this in a static initializer so that
                    // we don't initialize the port if there is no actor using it.
                    // This is synchronized on the SerialComm class to prevent multiple actors
                    // from trying to do this simultaneously.
                    _serialPort = (SerialPort) portID.open(
                            toplevel().getName(), 2000);
                    if (_serialPortListener == null) {
                        // This should only be done once.
                        _serialPortListener = new PortListener();
                    }
View Full Code Here

         portId = CommPortIdentifier.getPortIdentifier(portName);
      } catch (Exception e) {
      }
      if (found == null) {
         try {
            port = (SerialPort) portId.open("SerialPortConnection", 2000);
         } catch (PortInUseException e) {
            return null;
         }
         c_ports.put(portName, port);
      } else {
View Full Code Here

         SerialPort serialPort = null;

         // Open the port
         try {
            serialPort = (SerialPort) portIdentifier.open(
                  "BTGPSSimulator.listenForPort()", 2000);
         } catch (PortInUseException pe) {
            System.out
                  .println("SerialPortConnection.listenForPort() port is already used by another application, excluding it: "
                        + name);
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.