Package gnu.io

Examples of gnu.io.CommPortIdentifier.open()


    SerialPort com;
    private boolean isOutputOpen = false;

    public MoppyCOMBridge(String portName) throws NoSuchPortException, PortInUseException, UnsupportedCommOperationException, IOException {
        CommPortIdentifier cpi = CommPortIdentifier.getPortIdentifier(portName);
        com = (SerialPort) cpi.open("MoppyDesk", 2000);
        com.setSerialPortParams(SERIAL_RATE, SerialPort.DATABITS_8, SerialPort.STOPBITS_1, SerialPort.PARITY_NONE);
        os = com.getOutputStream();
        isOutputOpen = true;
    }
View Full Code Here


            final CommPort commPort;
            try {

                final CommPortIdentifier cpi =
                        CommPortIdentifier.getPortIdentifier(channelSink.remoteAddress.getDeviceAddress());
                commPort = cpi.open(this.getClass().getName(), 1000);

            } catch (NoSuchPortException e) {
                throw e;
            } catch (PortInUseException e) {
                throw e;
View Full Code Here

      portId = (CommPortIdentifier) portList.nextElement();
      if (portId.getPortType() == CommPortIdentifier.PORT_SERIAL) {
        // initalize serial port
        try {
          // name,timeout
          serialPort = (SerialPort) portId.open("lee", 2000); //$NON-NLS-1$
          System.out
              .println(Messages
                  .getString("io.SerialCommunication.1") + portId.getName()); //$NON-NLS-1$
          puertos.add(serialPort);
          // Cadena de entrada por el puerto serie
View Full Code Here

  static RobotCamColorTrack prueba;
  static OutputStream out;
  public static void main(String[] args) throws Exception {

    CommPortIdentifier portId = CommPortIdentifier.getPortIdentifier( "COM3d" );
    SerialPort sp = (SerialPort)portId.open("SerialCommunicationChannel", 2000);

    sp.setSerialPortParams(38400, SerialPort.DATABITS_8, SerialPort.STOPBITS_1, SerialPort.PARITY_NONE);
    out  = sp.getOutputStream();
   
    DataInputStream i=new DataInputStream(System.in);
View Full Code Here

//    sc.open("banana, COM5");

//    sc.send("advance");

    CommPortIdentifier portId = CommPortIdentifier.getPortIdentifier( "COM6" );
    SerialPort sp = (SerialPort)portId.open("SerialCommunicationChannel", 2000);

    sp.setSerialPortParams(38400, SerialPort.DATABITS_8, SerialPort.STOPBITS_1, SerialPort.PARITY_NONE);
    out  = sp.getOutputStream();
//    sc = new SerialComm("6",3);*/

 
View Full Code Here

      System.out.println("Es necesario especificar por par�metro el puerto COM a utilizar - Ej: 'java -jar SimpleBot.jar COM4'");
      return;
    }
   
    CommPortIdentifier portId = CommPortIdentifier.getPortIdentifier( args[0] );
    SerialPort sp = (SerialPort)portId.open("SerialCommunicationChannel", 2000);

    sp.setSerialPortParams(38400, SerialPort.DATABITS_8, SerialPort.STOPBITS_1, SerialPort.PARITY_NONE);
    out  = sp.getOutputStream();

    prueba = new RobotCamColorTrack("3");
View Full Code Here

          Main.log.addLine("Error: Port is currently in use");
        }
        else
        {
           
            commPort = portIdentifier.open("jStation",2000);
           
            if ( commPort instanceof SerialPort )
            {
                SerialPort serialPort = (SerialPort) commPort;
               
View Full Code Here

        while (thePorts.hasMoreElements()) {
            CommPortIdentifier com = (CommPortIdentifier) thePorts.nextElement();
            switch (com.getPortType()) {
            case CommPortIdentifier.PORT_SERIAL:
                try {
                    CommPort thePort = com.open("CommUtil", 50);
                    thePort.close();
                    h.add(com);
                 Main.log.addLine("Port, "  + com.getName() + ", is available.");
                   
                    jComPortBox.addItem(com.getName());
View Full Code Here

    @Override
    protected void doConnect(SocketAddress remoteAddress, SocketAddress localAddress) throws Exception {
        RxtxDeviceAddress remote = (RxtxDeviceAddress) remoteAddress;
        final CommPortIdentifier cpi = CommPortIdentifier.getPortIdentifier(remote.value());
        final CommPort commPort = cpi.open(getClass().getName(), 1000);

        deviceAddress = remote;

        serialPort = (SerialPort) commPort;
    }
View Full Code Here

    CommPortIdentifier portIdentifier = CommPortIdentifier
        .getPortIdentifier(portName);
    if (portIdentifier.isCurrentlyOwned()) {
      throw new IOException("Port is currently in use");
    } else {
      CommPort commPort = portIdentifier.open(this.getClass().getName(),
          TIME_OUT);

      if (commPort instanceof SerialPort) {
        SerialPort serialPort = (SerialPort) commPort;
        serialPort.setSerialPortParams(9600, SerialPort.DATABITS_8,
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.