- }
-
- public synchronized void scanFPGA(boolean on) throws IOException {
- if (on) {
- out.writeByte(3);
- out.flush();
- } else {
- // FIXME
- }
- }
- // fixme!
- public static int retval = 0;
- public synchronized int readCount() {
- try {
- if (reader != null) {
- reader.start();
- reader = null;
- }
- ByteCallback bc = new ByteCallback() {
- public synchronized void call(byte b) throws Exception {
- retval =
- ((b & 0xff) << 24) |
- ((in.read() & 0xff) << 16) |
- ((in.read() & 0xff) << 8) |
- ((in.read() & 0xff) << 0);
- this.notify();
- }
- };
- synchronized(bc) {
- callbacks.add(bc);
- out.writeByte(6);
- out.flush();
- bc.wait();
- }
- return retval;
- } catch (Exception e) { throw new RuntimeException(e); }
- }
-
- public static interface ByteCallback {
- public void call(byte b) throws Exception;
- }
-
- private Vector callbacks = new Vector();
-
- private Thread reader = new Thread() {