Testing out the PPD42 Air Quality Sensor, with an MSP430 Launchpad and graphing the data with GNUplot.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

121 lines
5.3 KiB

5 years ago
  1. /*-------------------------------------------------------------------------
  2. | rxtx is a native interface to serial ports in java.
  3. | Copyright 1997-2004 by Trent Jarvi taj@www.linux.org.uk.
  4. |
  5. | This library is free software; you can redistribute it and/or
  6. | modify it under the terms of the GNU Library General Public
  7. | License as published by the Free Software Foundation; either
  8. | version 2 of the License, or (at your option) any later version.
  9. |
  10. | This library is distributed in the hope that it will be useful,
  11. | but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  13. | Library General Public License for more details.
  14. |
  15. | You should have received a copy of the GNU Library General Public
  16. | License along with this library; if not, write to the Free
  17. | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
  18. --------------------------------------------------------------------------*/
  19. package gnu.io;
  20. import java.io.*;
  21. import java.util.*;
  22. /**
  23. * @author Trent Jarvi
  24. * @version %I%, %G%
  25. * @since JDK1.0
  26. */
  27. public abstract class SerialPort extends CommPort {
  28. public static final int DATABITS_5 =5;
  29. public static final int DATABITS_6 =6;
  30. public static final int DATABITS_7 =7;
  31. public static final int DATABITS_8 =8;
  32. public static final int PARITY_NONE =0;
  33. public static final int PARITY_ODD =1;
  34. public static final int PARITY_EVEN =2;
  35. public static final int PARITY_MARK =3;
  36. public static final int PARITY_SPACE =4;
  37. public static final int STOPBITS_1 =1;
  38. public static final int STOPBITS_2 =2;
  39. public static final int STOPBITS_1_5 =3;
  40. public static final int FLOWCONTROL_NONE =0;
  41. public static final int FLOWCONTROL_RTSCTS_IN =1;
  42. public static final int FLOWCONTROL_RTSCTS_OUT =2;
  43. public static final int FLOWCONTROL_XONXOFF_IN =4;
  44. public static final int FLOWCONTROL_XONXOFF_OUT=8;
  45. public abstract void setSerialPortParams( int b, int d, int s, int p )
  46. throws UnsupportedCommOperationException;
  47. public abstract int getBaudRate();
  48. public abstract int getDataBits();
  49. public abstract int getStopBits();
  50. public abstract int getParity();
  51. public abstract void setFlowControlMode( int flowcontrol )
  52. throws UnsupportedCommOperationException;
  53. public abstract int getFlowControlMode();
  54. public abstract boolean isDTR();
  55. public abstract void setDTR( boolean state );
  56. public abstract void setRTS( boolean state );
  57. public abstract boolean isCTS();
  58. public abstract boolean isDSR();
  59. public abstract boolean isCD();
  60. public abstract boolean isRI();
  61. public abstract boolean isRTS();
  62. public abstract void sendBreak( int duration );
  63. public abstract void addEventListener( SerialPortEventListener lsnr )
  64. throws TooManyListenersException;
  65. public abstract void removeEventListener();
  66. public abstract void notifyOnDataAvailable( boolean enable );
  67. public abstract void notifyOnOutputEmpty( boolean enable );
  68. public abstract void notifyOnCTS( boolean enable );
  69. public abstract void notifyOnDSR( boolean enable );
  70. public abstract void notifyOnRingIndicator( boolean enable );
  71. public abstract void notifyOnCarrierDetect( boolean enable );
  72. public abstract void notifyOnOverrunError( boolean enable );
  73. public abstract void notifyOnParityError( boolean enable );
  74. public abstract void notifyOnFramingError( boolean enable );
  75. public abstract void notifyOnBreakInterrupt( boolean enable );
  76. /*
  77. public abstract void setRcvFifoTrigger(int trigger);
  78. deprecated
  79. */
  80. /* ---------------------- end of commapi ------------------------ */
  81. /*
  82. can't have static abstract?
  83. public abstract static boolean staticSetDTR( String port, boolean flag )
  84. throws UnsupportedCommOperationException;
  85. public abstract static boolean staticSetRTS( String port, boolean flag )
  86. throws UnsupportedCommOperationException;
  87. */
  88. public abstract byte getParityErrorChar( )
  89. throws UnsupportedCommOperationException;
  90. public abstract boolean setParityErrorChar( byte b )
  91. throws UnsupportedCommOperationException;
  92. public abstract byte getEndOfInputChar( )
  93. throws UnsupportedCommOperationException;
  94. public abstract boolean setEndOfInputChar( byte b )
  95. throws UnsupportedCommOperationException;
  96. public abstract boolean setUARTType(String type, boolean test)
  97. throws UnsupportedCommOperationException;
  98. public abstract String getUARTType()
  99. throws UnsupportedCommOperationException;
  100. public abstract boolean setBaudBase(int BaudBase)
  101. throws UnsupportedCommOperationException;
  102. public abstract int getBaudBase()
  103. throws UnsupportedCommOperationException;
  104. public abstract boolean setDivisor(int Divisor)
  105. throws UnsupportedCommOperationException;
  106. public abstract int getDivisor()
  107. throws UnsupportedCommOperationException;
  108. public abstract boolean setLowLatency()
  109. throws UnsupportedCommOperationException;
  110. public abstract boolean getLowLatency()
  111. throws UnsupportedCommOperationException;
  112. public abstract boolean setCallOutHangup(boolean NoHup)
  113. throws UnsupportedCommOperationException;
  114. public abstract boolean getCallOutHangup()
  115. throws UnsupportedCommOperationException;
  116. }