WIP160411

thobaben_serialize
Harald Wolff 2016-11-04 14:11:10 +01:00
parent f91581c7b0
commit a133b70953
3 changed files with 7 additions and 8 deletions

View File

@ -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'))
{

View File

@ -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];

View File

@ -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));
}
}