forked from LupusNobilis/java-org.hwo
WIP160411
parent
f91581c7b0
commit
a133b70953
|
@ -51,8 +51,6 @@ public class ByteArrayHexlifier {
|
|||
{
|
||||
buffer[i] = (byte)((source[2*i] - '0')<<4);
|
||||
}
|
||||
|
||||
buffer[i] <<= 4;
|
||||
|
||||
if ((source[(2*i)+1] >= 'A')&&(source[(2*i)+1] <= 'F'))
|
||||
{
|
||||
|
|
|
@ -2,6 +2,8 @@ package org.hwo;
|
|||
|
||||
import java.nio.ByteBuffer;
|
||||
import java.nio.ByteOrder;
|
||||
import static org.hwo.logging.Logging.*;
|
||||
import static org.hwo.logging.LogLevel.*;
|
||||
|
||||
public class ChkSum {
|
||||
|
||||
|
@ -19,6 +21,7 @@ public class ChkSum {
|
|||
{
|
||||
sum += buffer[n];
|
||||
xor ^= buffer[n];
|
||||
//log(DEBUG,"CHKSUM: 0x%02x [ 0x%02x, 0x%02x ]",buffer[n],sum,xor);
|
||||
}
|
||||
|
||||
byte[] t = new byte[12];
|
||||
|
|
|
@ -245,11 +245,11 @@ public class NewSerialPort {
|
|||
private static native synchronized int nsp_setup_handshake(long nsp,int handshake);
|
||||
private static native synchronized int nsp_setup_timeout(long nsp,int timeout);
|
||||
|
||||
private static native synchronized int nsp_open(long nsp);
|
||||
private static native synchronized int nsp_close(long nsp);
|
||||
private static native int nsp_open(long nsp);
|
||||
private static native int nsp_close(long nsp);
|
||||
|
||||
private static native synchronized int nsp_read(long nsp);
|
||||
private static native synchronized int nsp_write(long nsp,int ch);
|
||||
private static native int nsp_read(long nsp);
|
||||
private static native int nsp_write(long nsp,int ch);
|
||||
|
||||
static {
|
||||
NativeLoader.loadLibrary("nsp");
|
||||
|
@ -267,7 +267,6 @@ public class NewSerialPort {
|
|||
if (ch < 0){
|
||||
if (ch == nsp_RET_TIMEOUT)
|
||||
return -1;
|
||||
NewSerialPort.this.close();
|
||||
throw new IOException(String.format("nsp_read()=%d", ch));
|
||||
};
|
||||
return ch;
|
||||
|
@ -285,7 +284,6 @@ public class NewSerialPort {
|
|||
|
||||
r = nsp_write(nsp, arg0);
|
||||
if (r<0){
|
||||
NewSerialPort.this.close();
|
||||
throw new IOException(String.format("nsp_write()=%d", r));
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue