@@ -37,43 +37,71 @@ public class SerialNativeInterface {
3737 private static final String libVersion = "2.9" ;
3838 private static final String libMinorSuffix = "1" ; //since 0.9.0
3939
40+ /** Linux **/
4041 public static final int OS_LINUX = 0 ;
42+ /** Windows **/
4143 public static final int OS_WINDOWS = 1 ;
44+ /** Solaris **/
4245 public static final int OS_SOLARIS = 2 ;//since 0.9.0
46+ /** MacOS **/
4347 public static final int OS_MAC_OS_X = 3 ;//since 0.9.0
44-
45- private static int osType = -1 ;
48+ /** Unknown **/
49+ public static final int OS_UNKNOWN = -1 ;//since 0.9.0
4650
4751 /**
52+ * Port is busy
53+ *
4854 * @since 2.3.0
4955 */
5056 public static final long ERR_PORT_BUSY = -1 ;
5157 /**
58+ * Port is not found
59+ *
5260 * @since 2.3.0
5361 */
5462 public static final long ERR_PORT_NOT_FOUND = -2 ;
5563 /**
64+ * Insufficient permissions to access port
65+ *
5666 * @since 2.3.0
5767 */
5868 public static final long ERR_PERMISSION_DENIED = -3 ;
5969 /**
70+ * Serial port handle is incorrect
71+ *
6072 * @since 2.3.0
6173 */
6274 public static final long ERR_INCORRECT_SERIAL_PORT = -4 ;
6375
6476 /**
77+ * Disable exclusive lock for serial port
78+ *
79+ * Usage:
80+ * <code>System.setProperty("jssc_no_tiocexcl", "true");</code>
81+ *
6582 * @since 2.6.0
6683 */
6784 public static final String PROPERTY_JSSC_NO_TIOCEXCL = "JSSC_NO_TIOCEXCL" ;
6885 /**
86+ * Ignore bytes with framing error or parity error
87+ *
88+ * Usage:
89+ * <code>System.setProperty("jssc_ignpar", "true");</code>
90+ *
6991 * @since 2.6.0
7092 */
7193 public static final String PROPERTY_JSSC_IGNPAR = "JSSC_IGNPAR" ;
7294 /**
95+ * Mark bytes with parity error or framing error
96+ *
97+ * Usage:
98+ * <code>System.setProperty("jssc_iparmrk", "true");</code>
99+ *
73100 * @since 2.6.0
74101 */
75102 public static final String PROPERTY_JSSC_PARMRK = "JSSC_PARMRK" ;
76103
104+ private static int osType ;
77105 static {
78106 String osName = System .getProperty ("os.name" );
79107 if (osName .equals ("Linux" ))
@@ -84,6 +112,8 @@ else if(osName.equals("SunOS"))
84112 osType = OS_SOLARIS ;
85113 else if (osName .equals ("Mac OS X" ) || osName .equals ("Darwin" ))
86114 osType = OS_MAC_OS_X ;
115+ else
116+ osType = OS_UNKNOWN ;
87117 try {
88118 /**
89119 * JSSC includes a small, platform-specific shared library and uses native-lib-loader for extraction.
@@ -105,7 +135,10 @@ else if(osName.equals("Mac OS X") || osName.equals("Darwin"))
105135 public SerialNativeInterface () {}
106136
107137 /**
108- * Get OS type (OS_LINUX || OS_WINDOWS || OS_SOLARIS)
138+ * Get OS type
139+ *
140+ * @return <code>OS_LINUX</code>, <code>OS_WINDOWS</code>, <code>OS_SOLARIS</code>,<code>OS_MACOS</code>
141+ * or <code>OS_UNKNOWN</code> if unknown.
109142 *
110143 * @since 0.8
111144 */
@@ -114,7 +147,9 @@ public static int getOsType() {
114147 }
115148
116149 /**
117- * Get jSSC version. The version of library is <b>Base Version</b> + <b>Minor Suffix</b>
150+ * Get library version
151+ *
152+ * @return Full library version in "major.minor.patch" format.
118153 *
119154 * @since 0.8
120155 */
@@ -123,27 +158,35 @@ public static String getLibraryVersion() {
123158 }
124159
125160 /**
126- * Get jSSC Base Version
161+ * Get library base Version
162+ *
163+ * @return Library base version in "major.minor" format. Was previously used for library versioning caching
164+ * but is no longer used by the project.
127165 *
128166 * @since 0.9.0
129167 */
168+ @ Deprecated
130169 public static String getLibraryBaseVersion () {
131170 return libVersion ;
132171 }
133172
134173 /**
135- * Get jSSC minor suffix. For example in version 0.8.1 - <b>1</b> is a minor suffix
174+ * Get library patch version
175+ *
176+ * @return Library patch version only (e.g. only "patch" from "major.minor.patch"). Was previously used for
177+ * library versioning caching but is no longer used by the project.
136178 *
137179 * @since 0.9.0
138180 */
181+ @ Deprecated
139182 public static String getLibraryMinorSuffix () {
140183 return libMinorSuffix ;
141184 }
142185
143186 /**
144- * Get jSSC native library version
187+ * Get native library version
145188 *
146- * @return native lib version (for jSSC-2.8.0 should be 2.8 for example)
189+ * @return Full native library version in "major.minor.patch" format.
147190 *
148191 * @since 2.8.0
149192 */
@@ -293,7 +336,7 @@ public static String getLibraryMinorSuffix() {
293336 *
294337 * @param handle handle of opened port
295338 *
296- * @return Mask of setted flow control mode
339+ * @return Mask of set flow control mode
297340 *
298341 * @since 0.8
299342 */
@@ -320,7 +363,7 @@ public static String getLibraryMinorSuffix() {
320363 public native int [] getLinesStatus (long handle );
321364
322365 /**
323- * Send Break singnal for setted duration
366+ * Send Break signal for set duration
324367 *
325368 * @param handle handle of opened port
326369 * @param duration duration of Break signal
0 commit comments