Package org.commonlib.comunication

Examples of org.commonlib.comunication.BadParameterException


        break;
      case 8:
        databit = SerialPort.DATABITS_8;
        break;
      default:
        throw new BadParameterException("illegal value for databit=" + pdatabit);
    }

    switch(pstopbit)
    {
      case 1:
        stopbit = SerialPort.STOPBITS_1;
        break;
      case 2:
        stopbit = SerialPort.STOPBITS_2;
        break;
      default:
        throw new BadParameterException("illegal value for stopbit=" + pstopbit);
    }

    switch(pparita)
    {
      case 'N':
        parita = SerialPort.PARITY_NONE;
        break;
      case 'P':
      case 'E':
        parita = SerialPort.PARITY_EVEN;
        break;
      case 'D':
      case 'O':
        parita = SerialPort.PARITY_ODD;
        break;
      case 'M':
        parita = SerialPort.PARITY_MARK;
        break;
      case 'S':
        parita = SerialPort.PARITY_SPACE;
        break;
      default:
        throw new BadParameterException("illegal value for parity=" + pparita);
    }

    switch(pflowctl)
    {
      case 'N':
        flowctl = SerialPort.FLOWCONTROL_NONE;
        break;
      case 'X':
        flowctl = SerialPort.FLOWCONTROL_XONXOFF_IN | SerialPort.FLOWCONTROL_XONXOFF_OUT;
        break;
      case 'R':
        flowctl = SerialPort.FLOWCONTROL_RTSCTS_IN | SerialPort.FLOWCONTROL_RTSCTS_OUT;
        break;
      default:
        throw new BadParameterException("illegal value for flow control=" + pflowctl);
    }

    this.bdrate = pbdrate;
  }
View Full Code Here


        break;
      case 8:
        databit = SerialPort.DATABITS_8;
        break;
      default:
        throw new BadParameterException("illegal value for databit=" + pdatabit);
    }

    switch(pstopbit)
    {
      case 1:
        stopbit = SerialPort.STOPBITS_1;
        break;
      case 2:
        stopbit = SerialPort.STOPBITS_2;
        break;
      default:
        throw new BadParameterException("illegal value for stopbit=" + pstopbit);
    }

    switch(pparita)
    {
      case 'N':
        parita = SerialPort.PARITY_NONE;
        break;
      case 'P':
      case 'E':
        parita = SerialPort.PARITY_EVEN;
        break;
      case 'D':
      case 'O':
        parita = SerialPort.PARITY_ODD;
        break;
      case 'M':
        parita = SerialPort.PARITY_MARK;
        break;
      case 'S':
        parita = SerialPort.PARITY_SPACE;
        break;
      default:
        throw new BadParameterException("illegal value for parity=" + pparita);
    }

    switch(pflowctl)
    {
      case 'N':
        flowctl = SerialPort.FLOWCONTROL_NONE;
        break;
      case 'X':
        flowctl = SerialPort.FLOWCONTROL_XONXOFF_IN | SerialPort.FLOWCONTROL_XONXOFF_OUT;
        break;
      case 'R':
        flowctl = SerialPort.FLOWCONTROL_RTSCTS_IN | SerialPort.FLOWCONTROL_RTSCTS_OUT;
        break;
      default:
        throw new BadParameterException("illegal value for flow control=" + pflowctl);
    }

    this.bdrate = pbdrate;
  }
View Full Code Here

        break;
      case SerialPort.DATABITS_8:
        arCmd.add("cs8");
        break;
      default:
        throw new BadParameterException("illegal value for databit=" + databit);
    }

    switch(stopbit)
    {
      case SerialPort.STOPBITS_1:
        arCmd.add("-cstopb");
        break;
      case SerialPort.STOPBITS_2:
        arCmd.add("cstopb");
        break;
      default:
        throw new BadParameterException("illegal value for stopbit=" + stopbit);
    }

    switch(parita)
    {
      case SerialPort.PARITY_NONE:
        arCmd.add("ignpar");
        arCmd.add("-parenb");
        break;
      case SerialPort.PARITY_EVEN:
        arCmd.add("parenb");
        arCmd.add("-parodd");
        break;
      case SerialPort.PARITY_ODD:
        arCmd.add("parenb");
        arCmd.add("parodd");
        break;
      case SerialPort.PARITY_MARK:
        arCmd.add("parmrk");
        break;
      default:
        throw new BadParameterException("illegal value for parity=" + parita);
    }

    if((flowctl & SerialPort.FLOWCONTROL_XONXOFF_IN) != 0
       || (flowctl & SerialPort.FLOWCONTROL_XONXOFF_OUT) != 0)
    {
View Full Code Here

TOP

Related Classes of org.commonlib.comunication.BadParameterException

Copyright © 2018 www.massapicom. 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.