brltty/brltty-3.9-java-svn.patch

1301 lines
46 KiB
Diff
Raw Normal View History

diff -Naur brltty-3.9.orig/Bindings/Java/apitest brltty-3.9/Bindings/Java/apitest
--- brltty-3.9.orig/Bindings/Java/apitest 2007-10-17 17:19:30.000000000 +0200
+++ brltty-3.9/Bindings/Java/apitest 2008-02-28 14:05:14.000000000 +0100
@@ -24,5 +24,5 @@
export LD_LIBRARY_PATH="${currentDirectory}"
export LD_PRELOAD="${currentDirectory}/../../Programs/libbrlapi.so"
-exec java -classpath "${currentDirectory}" ApiTest "${@}"
+exec java -classpath "${currentDirectory}/classes" org.a11y.BrlAPI.Test "${@}"
exit "${?}"
diff -Naur brltty-3.9.orig/Bindings/Java/ApiTest.java brltty-3.9/Bindings/Java/ApiTest.java
--- brltty-3.9.orig/Bindings/Java/ApiTest.java 2007-10-17 17:19:30.000000000 +0200
+++ brltty-3.9/Bindings/Java/ApiTest.java 1970-01-01 01:00:00.000000000 +0100
@@ -1,102 +0,0 @@
-/*
- * libbrlapi - A library providing access to braille terminals for applications.
- *
- * Copyright (C) 2006-2007 by
- * Samuel Thibault <Samuel.Thibault@ens-lyon.org>
- * Sébastien Hinderer <Sebastien.Hinderer@ens-lyon.org>
- *
- * libbrlapi comes with ABSOLUTELY NO WARRANTY.
- *
- * This is free software, placed under the terms of the
- * GNU Lesser General Public License, as published by the Free Software
- * Foundation; either version 2.1 of the License,
- * or (at your option) any later version.
- * Please see the file COPYING-API for details.
- *
- * Web Page: http://mielke.cc/brltty/
- *
- * This software is maintained by Dave Mielke <dave@mielke.cc>.
- */
-
-public class ApiTest {
- public static void main(String argv[]) {
- BrlapiSettings settings = new BrlapiSettings();
-
- {
- int argi = 0;
- while (argi < argv.length) {
- String arg = argv[argi++];
-
- if (arg.equals("-host")) {
- if (argi == argv.length) {
- System.err.println("Missing host specification.");
- System.exit(2);
- }
-
- settings.host = argv[argi++];
- continue;
- }
-
- System.err.println("Invalid option: " + arg);
- System.exit(2);
- }
- }
-
- try {
- System.loadLibrary("brlapi_java");
-
- System.out.print("Connecting to BrlAPI... ");
- Brlapi brlapi = new Brlapi(settings);
- System.out.println("done (fd=" + brlapi.getFileDescriptor() + ")");
-
- System.out.print("Connected to " + brlapi.getHost());
- System.out.print(" using key file " + brlapi.getAuth());
- System.out.println();
-
- System.out.print("Driver is " + brlapi.getDriverName());
- System.out.println();
-
- BrlapiSize size = brlapi.getDisplaySize();
- System.out.println("Display size is " + size.getWidth() + "x" + size.getHeight());
-
- int tty = brlapi.enterTtyMode();
- System.out.println("TTY is " + tty);
-
- brlapi.writeText("ok !! €", Brlapi.CURSOR_OFF);
- brlapi.writeText(null, 1);
-
- long key[] = {0};
- brlapi.ignoreKeys(Brlapi.rangeType_all, key);
- key[0] = BrlapiConstants.KEY_TYPE_CMD;
- brlapi.acceptKeys(Brlapi.rangeType_type, key);
- long keys[][] = {{0,2},{5,7}};
- brlapi.ignoreKeyRanges(keys);
-
- printKey(new BrlapiKey(brlapi.readKey(true)));
-
- BrlapiWriteArguments ws = new BrlapiWriteArguments();
- ws.regionBegin = 10;
- ws.regionSize = 20;
- ws.text = "Key Pressed € ";
- ws.andMask = "????????????????????".getBytes();
- ws.cursor = 3;
- brlapi.write(ws);
-
- printKey(new BrlapiKey(brlapi.readKey(true)));
-
- brlapi.leaveTtyMode();
- brlapi.closeConnection();
- } catch (BrlapiError exception) {
- System.out.println("got error: " + exception);
- System.exit(3);
- }
- }
-
- private static void printKey (BrlapiKey key) {
- System.out.println("got key " + Long.toHexString(key.getCode()) + " (" +
- Integer.toHexString(key.getType()) + "," +
- Integer.toHexString(key.getCommand()) + "," +
- Integer.toHexString(key.getArgument()) + "," +
- Integer.toHexString(key.getFlags()) + ")");
- }
-}
diff -Naur brltty-3.9.orig/Bindings/Java/bindings.c brltty-3.9/Bindings/Java/bindings.c
--- brltty-3.9.orig/Bindings/Java/bindings.c 2007-10-17 17:19:30.000000000 +0200
+++ brltty-3.9/Bindings/Java/bindings.c 2008-02-28 14:05:14.000000000 +0100
@@ -67,7 +67,7 @@
char message[lenmsg + 2 + lenerr + 1];
snprintf(message, sizeof(message), "%s: %s", msg, error);
- if (!(jcexcep = (*jenv)->FindClass(jenv, "BrlapiError"))) {
+ if (!(jcexcep = (*jenv)->FindClass(jenv, "org.a11y.BrlAPI.Error"))) {
ThrowException(jenv, ERR_NULLPTR, "ThrowBrlapiErrorFindClass");
return;
}
@@ -98,7 +98,7 @@
}
(*env)->SetByteArrayRegion(env, jbuf, 0, size, (jbyte *) buf);
- if (!(jcexcep = (*env)->FindClass(env, "BrlapiException"))) {
+ if (!(jcexcep = (*env)->FindClass(env, "org.a11y.BrlAPI.Exception"))) {
ThrowException(env, ERR_NULLPTR, "exceptionHandlerFindClass");
return;
}
@@ -137,7 +137,7 @@
return ret; \
}
-JNIEXPORT jint JNICALL Java_BrlapiNative_openConnection(JNIEnv *jenv, jobject jobj, jobject JclientSettings , jobject JusedSettings) {
+JNIEXPORT jint JNICALL Java_org_a11y_BrlAPI_Native_openConnection(JNIEnv *jenv, jobject jobj, jobject JclientSettings , jobject JusedSettings) {
jclass jcclientSettings, jcusedSettings;
jfieldID clientAuthID = NULL, clientHostID = NULL, usedAuthID, usedHostID;
brlapi_connectionSettings_t clientSettings, usedSettings,
@@ -226,7 +226,7 @@
return (jint) result;
}
-JNIEXPORT void JNICALL Java_BrlapiNative_closeConnection(JNIEnv *jenv, jobject jobj) {
+JNIEXPORT void JNICALL Java_org_a11y_BrlAPI_Native_closeConnection(JNIEnv *jenv, jobject jobj) {
env = jenv;
GET_HANDLE(jenv, jobj, );
@@ -235,7 +235,7 @@
(*jenv)->SetLongField(jenv, jcls, handleID, (jlong) (intptr_t) NULL);
}
-JNIEXPORT jstring JNICALL Java_BrlapiNative_getDriverName(JNIEnv *jenv, jobject jobj) {
+JNIEXPORT jstring JNICALL Java_org_a11y_BrlAPI_Native_getDriverName(JNIEnv *jenv, jobject jobj) {
char name[32];
GET_HANDLE(jenv, jobj, NULL);
@@ -250,7 +250,7 @@
return (*jenv)->NewStringUTF(jenv, name);
}
-JNIEXPORT jobject JNICALL Java_BrlapiNative_getDisplaySize(JNIEnv *jenv, jobject jobj) {
+JNIEXPORT jobject JNICALL Java_org_a11y_BrlAPI_Native_getDisplaySize(JNIEnv *jenv, jobject jobj) {
unsigned int x, y;
jclass jcsize;
jmethodID jinit;
@@ -264,7 +264,7 @@
return NULL;
}
- if (!(jcsize = (*jenv)->FindClass(jenv, "BrlapiSize"))) {
+ if (!(jcsize = (*jenv)->FindClass(jenv, "org.a11y.BrlAPI.DisplaySize"))) {
ThrowException(jenv, ERR_NULLPTR, __func__);
return NULL;
}
@@ -280,7 +280,7 @@
return jsize;
}
-JNIEXPORT jint JNICALL Java_BrlapiNative_enterTtyMode(JNIEnv *jenv, jobject jobj, jint jtty, jstring jdriver) {
+JNIEXPORT jint JNICALL Java_org_a11y_BrlAPI_Native_enterTtyMode(JNIEnv *jenv, jobject jobj, jint jtty, jstring jdriver) {
int tty ;
char *driver;
int result;
@@ -306,7 +306,7 @@
return (jint) result;
}
-JNIEXPORT void JNICALL Java_BrlapiNative_enterTtyModeWithPath(JNIEnv *jenv, jobject jobj, jintArray jttys, jstring jdriver) {
+JNIEXPORT void JNICALL Java_org_a11y_BrlAPI_Native_enterTtyModeWithPath(JNIEnv *jenv, jobject jobj, jintArray jttys, jstring jdriver) {
jint *ttys ;
char *driver;
int result;
@@ -338,7 +338,7 @@
}
}
-JNIEXPORT void JNICALL Java_BrlapiNative_leaveTtyMode(JNIEnv *jenv, jobject jobj) {
+JNIEXPORT void JNICALL Java_org_a11y_BrlAPI_Native_leaveTtyMode(JNIEnv *jenv, jobject jobj) {
env = jenv;
GET_HANDLE(jenv, jobj, );
@@ -348,7 +348,7 @@
}
}
-JNIEXPORT void JNICALL Java_BrlapiNative_setFocus(JNIEnv *jenv, jobject jobj, jint jarg1) {
+JNIEXPORT void JNICALL Java_org_a11y_BrlAPI_Native_setFocus(JNIEnv *jenv, jobject jobj, jint jarg1) {
int arg1 ;
GET_HANDLE(jenv, jobj, );
@@ -361,7 +361,7 @@
}
}
-JNIEXPORT void JNICALL Java_BrlapiNative_writeTextNative(JNIEnv *jenv, jobject jobj, jint jarg1, jstring jarg2) {
+JNIEXPORT void JNICALL Java_org_a11y_BrlAPI_Native_writeTextNative(JNIEnv *jenv, jobject jobj, jint jarg1, jstring jarg2) {
brlapi_writeArguments_t s = BRLAPI_WRITEARGUMENTS_INITIALIZER;
int result;
GET_HANDLE(jenv, jobj, );
@@ -391,7 +391,7 @@
}
}
-JNIEXPORT void JNICALL Java_BrlapiNative_writeDots(JNIEnv *jenv, jobject jobj, jbyteArray jarg1) {
+JNIEXPORT void JNICALL Java_org_a11y_BrlAPI_Native_writeDots(JNIEnv *jenv, jobject jobj, jbyteArray jarg1) {
jbyte *arg1;
int result;
GET_HANDLE(jenv, jobj, );
@@ -417,7 +417,7 @@
}
}
-JNIEXPORT void JNICALL Java_BrlapiNative_write(JNIEnv *jenv, jobject jobj, jobject jarguments) {
+JNIEXPORT void JNICALL Java_org_a11y_BrlAPI_Native_write(JNIEnv *jenv, jobject jobj, jobject jarguments) {
brlapi_writeArguments_t arguments = BRLAPI_WRITEARGUMENTS_INITIALIZER;
int result;
jstring text, andMask, orMask;
@@ -476,7 +476,7 @@
}
}
-JNIEXPORT jlong JNICALL Java_BrlapiNative_readKey(JNIEnv *jenv, jobject jobj, jboolean jblock) {
+JNIEXPORT jlong JNICALL Java_org_a11y_BrlAPI_Native_readKey(JNIEnv *jenv, jobject jobj, jboolean jblock) {
brlapi_keyCode_t code;
int result;
GET_HANDLE(jenv, jobj, -1);
@@ -494,7 +494,7 @@
return (jlong)code;
}
-JNIEXPORT void JNICALL Java_BrlapiNative_ignoreKeys(JNIEnv *jenv, jobject jobj, jlong jrange, jlongArray js) {
+JNIEXPORT void JNICALL Java_org_a11y_BrlAPI_Native_ignoreKeys(JNIEnv *jenv, jobject jobj, jlong jrange, jlongArray js) {
jlong *s;
unsigned int n;
int result;
@@ -520,7 +520,7 @@
}
}
-JNIEXPORT void JNICALL Java_BrlapiNative_acceptKeys(JNIEnv *jenv, jobject jobj, jlong jrange, jlongArray js) {
+JNIEXPORT void JNICALL Java_org_a11y_BrlAPI_Native_acceptKeys(JNIEnv *jenv, jobject jobj, jlong jrange, jlongArray js) {
jlong *s;
unsigned int n;
int result;
@@ -546,21 +546,21 @@
}
}
-JNIEXPORT void JNICALL Java_BrlapiNative_ignoreAllKeys(JNIEnv *jenv, jobject jobj) {
+JNIEXPORT void JNICALL Java_org_a11y_BrlAPI_Native_ignoreAllKeys(JNIEnv *jenv, jobject jobj) {
GET_HANDLE(jenv, jobj, );
if (brlapi__ignoreAllKeys(handle) < 0)
ThrowError(jenv, __func__);
}
-JNIEXPORT void JNICALL Java_BrlapiNative_acceptAllKeys(JNIEnv *jenv, jobject jobj) {
+JNIEXPORT void JNICALL Java_org_a11y_BrlAPI_Native_acceptAllKeys(JNIEnv *jenv, jobject jobj) {
GET_HANDLE(jenv, jobj, );
if (brlapi__acceptAllKeys(handle) < 0)
ThrowError(jenv, __func__);
}
-JNIEXPORT void JNICALL Java_BrlapiNative_ignoreKeyRanges(JNIEnv *jenv, jobject jobj, jobjectArray js) {
+JNIEXPORT void JNICALL Java_org_a11y_BrlAPI_Native_ignoreKeyRanges(JNIEnv *jenv, jobject jobj, jobjectArray js) {
unsigned int n;
GET_HANDLE(jenv, jobj, );
@@ -591,7 +591,7 @@
}
}
-JNIEXPORT void JNICALL Java_BrlapiNative_acceptKeyRanges(JNIEnv *jenv, jobject jobj, jobjectArray js) {
+JNIEXPORT void JNICALL Java_org_a11y_BrlAPI_Native_acceptKeyRanges(JNIEnv *jenv, jobject jobj, jobjectArray js) {
unsigned int n;
GET_HANDLE(jenv, jobj, );
@@ -622,7 +622,7 @@
}
}
-JNIEXPORT void JNICALL Java_BrlapiNative_enterRawMode(JNIEnv *jenv, jobject jobj, jstring jdriver) {
+JNIEXPORT void JNICALL Java_org_a11y_BrlAPI_Native_enterRawMode(JNIEnv *jenv, jobject jobj, jstring jdriver) {
env = jenv;
char *driver;
int res;
@@ -642,7 +642,7 @@
}
}
-JNIEXPORT void JNICALL Java_BrlapiNative_leaveRawMode(JNIEnv *jenv, jobject jobj) {
+JNIEXPORT void JNICALL Java_org_a11y_BrlAPI_Native_leaveRawMode(JNIEnv *jenv, jobject jobj) {
env = jenv;
GET_HANDLE(jenv, jobj, );
@@ -652,7 +652,7 @@
}
}
-JNIEXPORT jint JNICALL Java_BrlapiNative_sendRaw(JNIEnv *jenv, jobject jobj, jbyteArray jbuf) {
+JNIEXPORT jint JNICALL Java_org_a11y_BrlAPI_Native_sendRaw(JNIEnv *jenv, jobject jobj, jbyteArray jbuf) {
jbyte *buf;
unsigned int n;
int result;
@@ -679,7 +679,7 @@
return (jint) result;
}
-JNIEXPORT jint JNICALL Java_BrlapiNative_recvRaw(JNIEnv *jenv, jobject jobj, jbyteArray jbuf) {
+JNIEXPORT jint JNICALL Java_org_a11y_BrlAPI_Native_recvRaw(JNIEnv *jenv, jobject jobj, jbyteArray jbuf) {
jbyte *buf;
unsigned int n;
int result;
@@ -707,7 +707,7 @@
return (jint) result;
}
-JNIEXPORT jstring JNICALL Java_BrlapiNative_getPacketTypeName(JNIEnv *jenv, jclass jcls, jlong jtype) {
+JNIEXPORT jstring JNICALL Java_org_a11y_BrlAPI_Native_getPacketTypeName(JNIEnv *jenv, jclass jcls, jlong jtype) {
const char *type;
env = jenv;
@@ -720,7 +720,7 @@
return (*jenv)->NewStringUTF(jenv, type);
}
-JNIEXPORT jstring JNICALL Java_BrlapiError_toString (JNIEnv *jenv, jobject jerr) {
+JNIEXPORT jstring JNICALL Java_org_a11y_BrlAPI_Error_toString (JNIEnv *jenv, jobject jerr) {
jclass jcerr;
jfieldID brlerrnoID, libcerrnoID, gaierrnoID, errfunID;
jstring jerrfun;
@@ -750,7 +750,7 @@
return (*jenv)->NewStringUTF(jenv, res);
}
-JNIEXPORT jstring JNICALL Java_BrlapiException_toString (JNIEnv *jenv, jobject jerr) {
+JNIEXPORT jstring JNICALL Java_org_a11y_BrlAPI_Exception_toString (JNIEnv *jenv, jobject jerr) {
jclass jcerr;
jfieldID handleID, errnoID, typeID, bufID;
jarray jbuf;
@@ -789,7 +789,7 @@
return (*jenv)->NewStringUTF(jenv, errmsg);
}
-JNIEXPORT void JNICALL Java_BrlapiKey_expandKeyCode (JNIEnv *jenv, jobject obj, jlong jkey) {
+JNIEXPORT void JNICALL Java_org_a11y_BrlAPI_Key_expandKeyCode (JNIEnv *jenv, jobject obj, jlong jkey) {
jclass jckey;
jfieldID typeID, commandID, argumentID, flagsID;
brlapi_keyCode_t key = jkey;
diff -Naur brltty-3.9.orig/Bindings/Java/BrlapiError.java brltty-3.9/Bindings/Java/BrlapiError.java
--- brltty-3.9.orig/Bindings/Java/BrlapiError.java 2007-10-17 17:19:30.000000000 +0200
+++ brltty-3.9/Bindings/Java/BrlapiError.java 1970-01-01 01:00:00.000000000 +0100
@@ -1,52 +0,0 @@
-/*
- * libbrlapi - A library providing access to braille terminals for applications.
- *
- * Copyright (C) 2006-2007 by
- * Samuel Thibault <Samuel.Thibault@ens-lyon.org>
- * Sébastien Hinderer <Sebastien.Hinderer@ens-lyon.org>
- *
- * libbrlapi comes with ABSOLUTELY NO WARRANTY.
- *
- * This is free software, placed under the terms of the
- * GNU Lesser General Public License, as published by the Free Software
- * Foundation; either version 2.1 of the License,
- * or (at your option) any later version.
- * Please see the file COPYING-API for details.
- *
- * Web Page: http://mielke.cc/brltty/
- *
- * This software is maintained by Dave Mielke <dave@mielke.cc>.
- */
-
-public class BrlapiError extends Exception {
- static final long serialVersionUID = 0;
- int brlerrno;
- int libcerrno;
- int gaierrno;
- String errfun;
- public final native String toString();
- public BrlapiError(int brlerrno, int libcerrno, int gaierrno, String errfun) {
- this.brlerrno = brlerrno;
- this.libcerrno = libcerrno;
- this.gaierrno = gaierrno;
- this.errfun = errfun;
- }
-
- public final static int SUCCESS = 0; /* Success */
- public final static int NOMEM = 1; /* Not enough memory */
- public final static int TTYBUSY = 2; /* Already a connection running in this tty */
- public final static int DEVICEBUSY = 3; /* Already a connection using RAW mode */
- public final static int UNKNOWN_INSTRUCTION = 4; /* Not implemented in protocol */
- public final static int ILLEGAL_INSTRUCTION = 5; /* Forbiden in current mode */
- public final static int INVALID_PARAMETER = 6; /* Out of range or have no sense */
- public final static int INVALID_PACKET = 7; /* Invalid size */
- public final static int CONNREFUSED = 8; /* Connection refused */
- public final static int OPNOTSUPP = 9; /* Operation not supported */
- public final static int GAIERR = 10; /* Getaddrinfo error */
- public final static int LIBCERR = 11; /* Libc error */
- public final static int UNKNOWNTTY = 12; /* Couldn't find out the tty number */
- public final static int PROTOCOL_VERSION = 13; /* Bad protocol version */
- public final static int EOF = 14; /* Unexpected end of file */
- public final static int EMPTYKEY = 15; /* Too many levels of recursion */
- public final static int DRIVERERROR = 16; /* Packet returned by driver too large */
-}
diff -Naur brltty-3.9.orig/Bindings/Java/BrlapiException.java brltty-3.9/Bindings/Java/BrlapiException.java
--- brltty-3.9.orig/Bindings/Java/BrlapiException.java 2007-10-17 17:19:30.000000000 +0200
+++ brltty-3.9/Bindings/Java/BrlapiException.java 1970-01-01 01:00:00.000000000 +0100
@@ -1,34 +0,0 @@
-/*
- * libbrlapi - A library providing access to braille terminals for applications.
- *
- * Copyright (C) 2006-2007 by
- * Samuel Thibault <Samuel.Thibault@ens-lyon.org>
- * Sébastien Hinderer <Sebastien.Hinderer@ens-lyon.org>
- *
- * libbrlapi comes with ABSOLUTELY NO WARRANTY.
- *
- * This is free software, placed under the terms of the
- * GNU Lesser General Public License, as published by the Free Software
- * Foundation; either version 2.1 of the License,
- * or (at your option) any later version.
- * Please see the file COPYING-API for details.
- *
- * Web Page: http://mielke.cc/brltty/
- *
- * This software is maintained by Dave Mielke <dave@mielke.cc>.
- */
-
-public class BrlapiException extends Exception {
- static final long serialVersionUID = 0;
- long handle;
- int errno;
- long packettype;
- byte buf[];
- public final native String toString();
- public BrlapiException(long handle, int errno, int packettype, byte buf[]) {
- this.handle = handle;
- this.errno = errno;
- this.packettype = packettype;
- this.buf = buf;
- }
-}
diff -Naur brltty-3.9.orig/Bindings/Java/Brlapi.java brltty-3.9/Bindings/Java/Brlapi.java
--- brltty-3.9.orig/Bindings/Java/Brlapi.java 2007-10-17 17:19:30.000000000 +0200
+++ brltty-3.9/Bindings/Java/Brlapi.java 2008-02-28 14:05:14.000000000 +0100
@@ -18,12 +18,14 @@
* This software is maintained by Dave Mielke <dave@mielke.cc>.
*/
-public class Brlapi extends BrlapiNative implements BrlapiConstants {
- protected final BrlapiSettings settings;
+package org.a11y.BrlAPI;
+
+public class Brlapi extends Native implements Constants {
+ protected final ConnectionSettings settings;
protected final int fileDescriptor;
- public Brlapi (BrlapiSettings settings) throws BrlapiError {
- this.settings = new BrlapiSettings();
+ public Brlapi (ConnectionSettings settings) throws Error {
+ this.settings = new ConnectionSettings();
fileDescriptor = openConnection(settings, this.settings);
}
@@ -43,37 +45,37 @@
return fileDescriptor;
}
- public int enterTtyMode (int tty) throws BrlapiError {
+ public int enterTtyMode (int tty) throws Error {
return enterTtyMode(tty, null);
}
- public int enterTtyMode (String driver) throws BrlapiError {
+ public int enterTtyMode (String driver) throws Error {
return enterTtyMode(TTY_DEFAULT, driver);
}
- public int enterTtyMode () throws BrlapiError {
+ public int enterTtyMode () throws Error {
return enterTtyMode(null);
}
- public void enterTtyModeWithPath (int ttys[]) throws BrlapiError {
+ public void enterTtyModeWithPath (int ttys[]) throws Error {
enterTtyModeWithPath(ttys, null);
}
- public void writeText (int cursor) throws BrlapiError {
+ public void writeText (int cursor) throws Error {
writeText(cursor, null);
}
- public void writeText (String text) throws BrlapiError {
+ public void writeText (String text) throws Error {
writeText(CURSOR_OFF, text);
}
- public void writeText (String text, int cursor) throws BrlapiError {
+ public void writeText (String text, int cursor) throws Error {
writeText(cursor, text);
}
- public void writeText (int cursor, String text) throws BrlapiError {
+ public void writeText (int cursor, String text) throws Error {
if (text != null) {
- BrlapiSize size = getDisplaySize();
+ DisplaySize size = getDisplaySize();
int count = size.getWidth() * size.getHeight();
{
diff -Naur brltty-3.9.orig/Bindings/Java/BrlapiKey.java brltty-3.9/Bindings/Java/BrlapiKey.java
--- brltty-3.9.orig/Bindings/Java/BrlapiKey.java 2007-10-17 17:19:30.000000000 +0200
+++ brltty-3.9/Bindings/Java/BrlapiKey.java 1970-01-01 01:00:00.000000000 +0100
@@ -1,54 +0,0 @@
-/*
- * libbrlapi - A library providing access to braille terminals for applications.
- *
- * Copyright (C) 2006-2007 by
- * Samuel Thibault <Samuel.Thibault@ens-lyon.org>
- * Sébastien Hinderer <Sebastien.Hinderer@ens-lyon.org>
- *
- * libbrlapi comes with ABSOLUTELY NO WARRANTY.
- *
- * This is free software, placed under the terms of the
- * GNU Lesser General Public License, as published by the Free Software
- * Foundation; either version 2.1 of the License,
- * or (at your option) any later version.
- * Please see the file COPYING-API for details.
- *
- * Web Page: http://mielke.cc/brltty/
- *
- * This software is maintained by Dave Mielke <dave@mielke.cc>.
- */
-
-public class BrlapiKey {
- protected final long code;
- protected int type;
- protected int command;
- protected int argument;
- protected int flags;
-
- public final native void expandKeyCode (long code);
-
- public BrlapiKey (long code) {
- this.code = code;
- expandKeyCode(code);
- }
-
- public long getCode () {
- return code;
- }
-
- public int getType () {
- return type;
- }
-
- public int getCommand () {
- return command;
- }
-
- public int getArgument () {
- return argument;
- }
-
- public int getFlags () {
- return flags;
- }
-}
diff -Naur brltty-3.9.orig/Bindings/Java/BrlapiNative.java brltty-3.9/Bindings/Java/BrlapiNative.java
--- brltty-3.9.orig/Bindings/Java/BrlapiNative.java 2007-10-17 17:19:30.000000000 +0200
+++ brltty-3.9/Bindings/Java/BrlapiNative.java 1970-01-01 01:00:00.000000000 +0100
@@ -1,58 +0,0 @@
-/*
- * libbrlapi - A library providing access to braille terminals for applications.
- *
- * Copyright (C) 2006-2007 by
- * Samuel Thibault <Samuel.Thibault@ens-lyon.org>
- * Sébastien Hinderer <Sebastien.Hinderer@ens-lyon.org>
- *
- * libbrlapi comes with ABSOLUTELY NO WARRANTY.
- *
- * This is free software, placed under the terms of the
- * GNU Lesser General Public License, as published by the Free Software
- * Foundation; either version 2.1 of the License,
- * or (at your option) any later version.
- * Please see the file COPYING-API for details.
- *
- * Web Page: http://mielke.cc/brltty/
- *
- * This software is maintained by Dave Mielke <dave@mielke.cc>.
- */
-
-public class BrlapiNative {
- protected long handle;
-
- protected native int openConnection (
- BrlapiSettings desiredSettings,
- BrlapiSettings actualSettings)
- throws BrlapiError;
- public native void closeConnection ();
-
- public native String getDriverName () throws BrlapiError;
- public native BrlapiSize getDisplaySize () throws BrlapiError;
-
- public native int enterTtyMode (int tty, String driver) throws BrlapiError;
- public native void enterTtyModeWithPath (int ttys[], String driver) throws BrlapiError;
- public native void leaveTtyMode () throws BrlapiError;
- public native void setFocus (int tty) throws BrlapiError;
-
- protected native void writeTextNative (int cursor, String text) throws BrlapiError;
- public native void writeDots (byte dots[]) throws BrlapiError;
- public native void write (BrlapiWriteArguments arguments) throws BrlapiError;
-
- public native long readKey (boolean wait) throws BrlapiError;
- public native void ignoreKeys (long type, long keys[]) throws BrlapiError;
- public native void acceptKeys (long type, long keys[]) throws BrlapiError;
-
- public native void ignoreAllKeys () throws BrlapiError;
- public native void acceptAllKeys () throws BrlapiError;
-
- public native void ignoreKeyRanges (long ranges[][]) throws BrlapiError;
- public native void acceptKeyRanges (long ranges[][]) throws BrlapiError;
-
- public native void enterRawMode (String driver) throws BrlapiError;
- public native void leaveRawMode () throws BrlapiError;
- public native int sendRaw (byte buffer[]) throws BrlapiError;
- public native int recvRaw (byte buffer[]) throws BrlapiError;
-
- public static native String getPacketTypeName (long type);
-}
diff -Naur brltty-3.9.orig/Bindings/Java/BrlapiSettings.java brltty-3.9/Bindings/Java/BrlapiSettings.java
--- brltty-3.9.orig/Bindings/Java/BrlapiSettings.java 2007-10-17 17:19:30.000000000 +0200
+++ brltty-3.9/Bindings/Java/BrlapiSettings.java 1970-01-01 01:00:00.000000000 +0100
@@ -1,37 +0,0 @@
-/*
- * libbrlapi - A library providing access to braille terminals for applications.
- *
- * Copyright (C) 2006-2007 by
- * Samuel Thibault <Samuel.Thibault@ens-lyon.org>
- * Sébastien Hinderer <Sebastien.Hinderer@ens-lyon.org>
- *
- * libbrlapi comes with ABSOLUTELY NO WARRANTY.
- *
- * This is free software, placed under the terms of the
- * GNU Lesser General Public License, as published by the Free Software
- * Foundation; either version 2.1 of the License,
- * or (at your option) any later version.
- * Please see the file COPYING-API for details.
- *
- * Web Page: http://mielke.cc/brltty/
- *
- * This software is maintained by Dave Mielke <dave@mielke.cc>.
- */
-
-public class BrlapiSettings {
- public String host;
- public String auth;
-
- public BrlapiSettings (String host, String auth) {
- this.host = host;
- this.auth = auth;
- }
-
- public BrlapiSettings (String host) {
- this(host, null);
- }
-
- public BrlapiSettings () {
- this(null);
- }
-}
diff -Naur brltty-3.9.orig/Bindings/Java/BrlapiSize.java brltty-3.9/Bindings/Java/BrlapiSize.java
--- brltty-3.9.orig/Bindings/Java/BrlapiSize.java 2007-10-17 17:19:30.000000000 +0200
+++ brltty-3.9/Bindings/Java/BrlapiSize.java 1970-01-01 01:00:00.000000000 +0100
@@ -1,37 +0,0 @@
-/*
- * libbrlapi - A library providing access to braille terminals for applications.
- *
- * Copyright (C) 2006-2007 by
- * Samuel Thibault <Samuel.Thibault@ens-lyon.org>
- * Sébastien Hinderer <Sebastien.Hinderer@ens-lyon.org>
- *
- * libbrlapi comes with ABSOLUTELY NO WARRANTY.
- *
- * This is free software, placed under the terms of the
- * GNU Lesser General Public License, as published by the Free Software
- * Foundation; either version 2.1 of the License,
- * or (at your option) any later version.
- * Please see the file COPYING-API for details.
- *
- * Web Page: http://mielke.cc/brltty/
- *
- * This software is maintained by Dave Mielke <dave@mielke.cc>.
- */
-
-public class BrlapiSize {
- protected final int width;
- protected final int height;
-
- public BrlapiSize (int width, int height) {
- this.width = width;
- this.height = height;
- }
-
- public int getWidth () {
- return width;
- }
-
- public int getHeight () {
- return height;
- }
-}
diff -Naur brltty-3.9.orig/Bindings/Java/BrlapiWriteArguments.java brltty-3.9/Bindings/Java/BrlapiWriteArguments.java
--- brltty-3.9.orig/Bindings/Java/BrlapiWriteArguments.java 2007-10-17 17:19:30.000000000 +0200
+++ brltty-3.9/Bindings/Java/BrlapiWriteArguments.java 1970-01-01 01:00:00.000000000 +0100
@@ -1,32 +0,0 @@
-/*
- * libbrlapi - A library providing access to braille terminals for applications.
- *
- * Copyright (C) 2006-2007 by
- * Samuel Thibault <Samuel.Thibault@ens-lyon.org>
- * Sébastien Hinderer <Sebastien.Hinderer@ens-lyon.org>
- *
- * libbrlapi comes with ABSOLUTELY NO WARRANTY.
- *
- * This is free software, placed under the terms of the
- * GNU Lesser General Public License, as published by the Free Software
- * Foundation; either version 2.1 of the License,
- * or (at your option) any later version.
- * Please see the file COPYING-API for details.
- *
- * Web Page: http://mielke.cc/brltty/
- *
- * This software is maintained by Dave Mielke <dave@mielke.cc>.
- */
-
-public class BrlapiWriteArguments {
- public int displayNumber = Brlapi.DISPLAY_DEFAULT;
- public int regionBegin = 0;
- public int regionSize = 0;
- public String text = null;
- public byte andMask[] = null;
- public byte orMask[] = null;
- public int cursor = Brlapi.CURSOR_LEAVE;
-
- public BrlapiWriteArguments () {
- }
-}
diff -Naur brltty-3.9.orig/Bindings/Java/ConnectionSettings.java brltty-3.9/Bindings/Java/ConnectionSettings.java
--- brltty-3.9.orig/Bindings/Java/ConnectionSettings.java 1970-01-01 01:00:00.000000000 +0100
+++ brltty-3.9/Bindings/Java/ConnectionSettings.java 2008-02-28 14:05:14.000000000 +0100
@@ -0,0 +1,39 @@
+/*
+ * libbrlapi - A library providing access to braille terminals for applications.
+ *
+ * Copyright (C) 2006-2007 by
+ * Samuel Thibault <Samuel.Thibault@ens-lyon.org>
+ * Sébastien Hinderer <Sebastien.Hinderer@ens-lyon.org>
+ *
+ * libbrlapi comes with ABSOLUTELY NO WARRANTY.
+ *
+ * This is free software, placed under the terms of the
+ * GNU Lesser General Public License, as published by the Free Software
+ * Foundation; either version 2.1 of the License,
+ * or (at your option) any later version.
+ * Please see the file COPYING-API for details.
+ *
+ * Web Page: http://mielke.cc/brltty/
+ *
+ * This software is maintained by Dave Mielke <dave@mielke.cc>.
+ */
+
+package org.a11y.BrlAPI;
+
+public class ConnectionSettings {
+ public String host;
+ public String auth;
+
+ public ConnectionSettings (String host, String auth) {
+ this.host = host;
+ this.auth = auth;
+ }
+
+ public ConnectionSettings (String host) {
+ this(host, null);
+ }
+
+ public ConnectionSettings () {
+ this(null);
+ }
+}
diff -Naur brltty-3.9.orig/Bindings/Java/constants.awk brltty-3.9/Bindings/Java/constants.awk
--- brltty-3.9.orig/Bindings/Java/constants.awk 2007-10-17 17:19:30.000000000 +0200
+++ brltty-3.9/Bindings/Java/constants.awk 2008-02-28 14:05:14.000000000 +0100
@@ -19,7 +19,9 @@
###############################################################################
BEGIN {
- print "public interface BrlapiConstants {"
+ print "package org.a11y.BrlAPI;"
+ print ""
+ print "public interface Constants {"
}
END {
diff -Naur brltty-3.9.orig/Bindings/Java/DisplaySize.java brltty-3.9/Bindings/Java/DisplaySize.java
--- brltty-3.9.orig/Bindings/Java/DisplaySize.java 1970-01-01 01:00:00.000000000 +0100
+++ brltty-3.9/Bindings/Java/DisplaySize.java 2008-02-28 14:05:14.000000000 +0100
@@ -0,0 +1,39 @@
+/*
+ * libbrlapi - A library providing access to braille terminals for applications.
+ *
+ * Copyright (C) 2006-2007 by
+ * Samuel Thibault <Samuel.Thibault@ens-lyon.org>
+ * Sébastien Hinderer <Sebastien.Hinderer@ens-lyon.org>
+ *
+ * libbrlapi comes with ABSOLUTELY NO WARRANTY.
+ *
+ * This is free software, placed under the terms of the
+ * GNU Lesser General Public License, as published by the Free Software
+ * Foundation; either version 2.1 of the License,
+ * or (at your option) any later version.
+ * Please see the file COPYING-API for details.
+ *
+ * Web Page: http://mielke.cc/brltty/
+ *
+ * This software is maintained by Dave Mielke <dave@mielke.cc>.
+ */
+
+package org.a11y.BrlAPI;
+
+public class DisplaySize {
+ protected final int width;
+ protected final int height;
+
+ public DisplaySize (int width, int height) {
+ this.width = width;
+ this.height = height;
+ }
+
+ public int getWidth () {
+ return width;
+ }
+
+ public int getHeight () {
+ return height;
+ }
+}
diff -Naur brltty-3.9.orig/Bindings/Java/Error.java brltty-3.9/Bindings/Java/Error.java
--- brltty-3.9.orig/Bindings/Java/Error.java 1970-01-01 01:00:00.000000000 +0100
+++ brltty-3.9/Bindings/Java/Error.java 2008-02-28 14:05:14.000000000 +0100
@@ -0,0 +1,54 @@
+/*
+ * libbrlapi - A library providing access to braille terminals for applications.
+ *
+ * Copyright (C) 2006-2007 by
+ * Samuel Thibault <Samuel.Thibault@ens-lyon.org>
+ * Sébastien Hinderer <Sebastien.Hinderer@ens-lyon.org>
+ *
+ * libbrlapi comes with ABSOLUTELY NO WARRANTY.
+ *
+ * This is free software, placed under the terms of the
+ * GNU Lesser General Public License, as published by the Free Software
+ * Foundation; either version 2.1 of the License,
+ * or (at your option) any later version.
+ * Please see the file COPYING-API for details.
+ *
+ * Web Page: http://mielke.cc/brltty/
+ *
+ * This software is maintained by Dave Mielke <dave@mielke.cc>.
+ */
+
+package org.a11y.BrlAPI;
+
+public class Error extends java.lang.Error {
+ static final long serialVersionUID = 0;
+ int brlerrno;
+ int libcerrno;
+ int gaierrno;
+ String errfun;
+ public final native String toString ();
+ public Error (int brlerrno, int libcerrno, int gaierrno, String errfun) {
+ this.brlerrno = brlerrno;
+ this.libcerrno = libcerrno;
+ this.gaierrno = gaierrno;
+ this.errfun = errfun;
+ }
+
+ public final static int SUCCESS = 0; /* Success */
+ public final static int NOMEM = 1; /* Not enough memory */
+ public final static int TTYBUSY = 2; /* Already a connection running in this tty */
+ public final static int DEVICEBUSY = 3; /* Already a connection using RAW mode */
+ public final static int UNKNOWN_INSTRUCTION = 4; /* Not implemented in protocol */
+ public final static int ILLEGAL_INSTRUCTION = 5; /* Forbiden in current mode */
+ public final static int INVALID_PARAMETER = 6; /* Out of range or have no sense */
+ public final static int INVALID_PACKET = 7; /* Invalid size */
+ public final static int CONNREFUSED = 8; /* Connection refused */
+ public final static int OPNOTSUPP = 9; /* Operation not supported */
+ public final static int GAIERR = 10; /* Getaddrinfo error */
+ public final static int LIBCERR = 11; /* Libc error */
+ public final static int UNKNOWNTTY = 12; /* Couldn't find out the tty number */
+ public final static int PROTOCOL_VERSION = 13; /* Bad protocol version */
+ public final static int EOF = 14; /* Unexpected end of file */
+ public final static int EMPTYKEY = 15; /* Too many levels of recursion */
+ public final static int DRIVERERROR = 16; /* Packet returned by driver too large */
+}
diff -Naur brltty-3.9.orig/Bindings/Java/Exception.java brltty-3.9/Bindings/Java/Exception.java
--- brltty-3.9.orig/Bindings/Java/Exception.java 1970-01-01 01:00:00.000000000 +0100
+++ brltty-3.9/Bindings/Java/Exception.java 2008-02-28 14:05:14.000000000 +0100
@@ -0,0 +1,36 @@
+/*
+ * libbrlapi - A library providing access to braille terminals for applications.
+ *
+ * Copyright (C) 2006-2007 by
+ * Samuel Thibault <Samuel.Thibault@ens-lyon.org>
+ * Sébastien Hinderer <Sebastien.Hinderer@ens-lyon.org>
+ *
+ * libbrlapi comes with ABSOLUTELY NO WARRANTY.
+ *
+ * This is free software, placed under the terms of the
+ * GNU Lesser General Public License, as published by the Free Software
+ * Foundation; either version 2.1 of the License,
+ * or (at your option) any later version.
+ * Please see the file COPYING-API for details.
+ *
+ * Web Page: http://mielke.cc/brltty/
+ *
+ * This software is maintained by Dave Mielke <dave@mielke.cc>.
+ */
+
+package org.a11y.BrlAPI;
+
+public class Exception extends java.lang.Exception {
+ static final long serialVersionUID = 0;
+ long handle;
+ int errno;
+ long packettype;
+ byte buf[];
+ public final native String toString ();
+ public Exception (long handle, int errno, int packettype, byte buf[]) {
+ this.handle = handle;
+ this.errno = errno;
+ this.packettype = packettype;
+ this.buf = buf;
+ }
+}
diff -Naur brltty-3.9.orig/Bindings/Java/Key.java brltty-3.9/Bindings/Java/Key.java
--- brltty-3.9.orig/Bindings/Java/Key.java 1970-01-01 01:00:00.000000000 +0100
+++ brltty-3.9/Bindings/Java/Key.java 2008-02-28 14:05:14.000000000 +0100
@@ -0,0 +1,56 @@
+/*
+ * libbrlapi - A library providing access to braille terminals for applications.
+ *
+ * Copyright (C) 2006-2007 by
+ * Samuel Thibault <Samuel.Thibault@ens-lyon.org>
+ * Sébastien Hinderer <Sebastien.Hinderer@ens-lyon.org>
+ *
+ * libbrlapi comes with ABSOLUTELY NO WARRANTY.
+ *
+ * This is free software, placed under the terms of the
+ * GNU Lesser General Public License, as published by the Free Software
+ * Foundation; either version 2.1 of the License,
+ * or (at your option) any later version.
+ * Please see the file COPYING-API for details.
+ *
+ * Web Page: http://mielke.cc/brltty/
+ *
+ * This software is maintained by Dave Mielke <dave@mielke.cc>.
+ */
+
+package org.a11y.BrlAPI;
+
+public class Key {
+ protected final long code;
+ protected int type;
+ protected int command;
+ protected int argument;
+ protected int flags;
+
+ public final native void expandKeyCode (long code);
+
+ public Key (long code) {
+ this.code = code;
+ expandKeyCode(code);
+ }
+
+ public long getCode () {
+ return code;
+ }
+
+ public int getType () {
+ return type;
+ }
+
+ public int getCommand () {
+ return command;
+ }
+
+ public int getArgument () {
+ return argument;
+ }
+
+ public int getFlags () {
+ return flags;
+ }
+}
diff -Naur brltty-3.9.orig/Bindings/Java/Makefile.in brltty-3.9/Bindings/Java/Makefile.in
--- brltty-3.9.orig/Bindings/Java/Makefile.in 2007-10-17 17:19:30.000000000 +0200
+++ brltty-3.9/Bindings/Java/Makefile.in 2008-02-28 14:06:35.000000000 +0100
@@ -48,32 +48,29 @@
JAVA_JAR_FILE = $(API_NAME).jar
jar: $(JAVA_JAR_FILE)
-API_CLASSES = Brlapi.class BrlapiNative.class BrlapiError.class BrlapiException.class BrlapiSettings.class BrlapiWriteArguments.class BrlapiSize.class BrlapiKey.class
-ALL_CLASSES = $(API_CLASSES) ApiTest.class
+$(JAVA_JAR_FILE): classes.made
+ $(JAR) cf $@ -C classes .
-$(JAVA_JAR_FILE): $(API_CLASSES)
- $(JAR) cf $@ Brlapi*.class
-
-$(ALL_CLASSES): $(SRC_DIR)/*.java BrlapiConstants.class
- $(JAVAC) -d . -classpath . $(SRC_DIR)/*.java
-
-BrlapiConstants.class: BrlapiConstants.java
- $(JAVAC) BrlapiConstants.java
+classes.made: $(SRC_DIR)/*.java Constants.java
+ $(INSTALL_DIRECTORY) classes
+ $(JAVAC) -d classes -classpath . $(SRC_DIR)/*.java
+ touch $@
-BrlapiConstants.java: $(CONSTANTS_SCRIPTS) $(CONSTANTS_SOURCES)
+Constants.java: $(CONSTANTS_SCRIPTS) $(CONSTANTS_SOURCES)
$(AWK) $(CONSTANTS_OPTIONS) $(CONSTANTS_SOURCES) >$@
-doc: javadoc.made
+doc: doc.made
-javadoc.made: $(SRC_DIR)/*.java BrlapiConstants.java
- $(JAVADOC) -quiet -d . -author -version -use $(SRC_DIR)/*.java BrlapiConstants.java
+doc.made: $(SRC_DIR)/*.java Constants.java
+ $(INSTALL_DIRECTORY) doc
+ $(JAVADOC) -quiet -d doc -author -version -use $(SRC_DIR)/*.java Constants.java
touch $@
clean::
- -rm -f BrlapiConstants.java *.class $(JAVA_JAR_FILE) $(JAVA_JNI_FILE)
- -rm -f javadoc.made package-list *.css *.html
- -rm -f -r resources
- -rm -f gjdoc.properties JAVADOC.PLACEHOLDER
+ -rm -f Constants.java classes.made $(JAVA_JAR_FILE) $(JAVA_JNI_FILE)
+ -rm -f -r classes
+ -rm -f doc.made
+ -rm -f -r doc
install: install-jar install-jni
diff -Naur brltty-3.9.orig/Bindings/Java/Native.java brltty-3.9/Bindings/Java/Native.java
--- brltty-3.9.orig/Bindings/Java/Native.java 1970-01-01 01:00:00.000000000 +0100
+++ brltty-3.9/Bindings/Java/Native.java 2008-02-28 14:05:14.000000000 +0100
@@ -0,0 +1,60 @@
+/*
+ * libbrlapi - A library providing access to braille terminals for applications.
+ *
+ * Copyright (C) 2006-2007 by
+ * Samuel Thibault <Samuel.Thibault@ens-lyon.org>
+ * Sébastien Hinderer <Sebastien.Hinderer@ens-lyon.org>
+ *
+ * libbrlapi comes with ABSOLUTELY NO WARRANTY.
+ *
+ * This is free software, placed under the terms of the
+ * GNU Lesser General Public License, as published by the Free Software
+ * Foundation; either version 2.1 of the License,
+ * or (at your option) any later version.
+ * Please see the file COPYING-API for details.
+ *
+ * Web Page: http://mielke.cc/brltty/
+ *
+ * This software is maintained by Dave Mielke <dave@mielke.cc>.
+ */
+
+package org.a11y.BrlAPI;
+
+public class Native {
+ protected long handle;
+
+ protected native int openConnection (
+ ConnectionSettings desiredSettings,
+ ConnectionSettings actualSettings)
+ throws Error;
+ public native void closeConnection ();
+
+ public native String getDriverName () throws Error;
+ public native DisplaySize getDisplaySize () throws Error;
+
+ public native int enterTtyMode (int tty, String driver) throws Error;
+ public native void enterTtyModeWithPath (int ttys[], String driver) throws Error;
+ public native void leaveTtyMode () throws Error;
+ public native void setFocus (int tty) throws Error;
+
+ protected native void writeTextNative (int cursor, String text) throws Error;
+ public native void writeDots (byte dots[]) throws Error;
+ public native void write (WriteArguments arguments) throws Error;
+
+ public native long readKey (boolean wait) throws Error;
+ public native void ignoreKeys (long type, long keys[]) throws Error;
+ public native void acceptKeys (long type, long keys[]) throws Error;
+
+ public native void ignoreAllKeys () throws Error;
+ public native void acceptAllKeys () throws Error;
+
+ public native void ignoreKeyRanges (long ranges[][]) throws Error;
+ public native void acceptKeyRanges (long ranges[][]) throws Error;
+
+ public native void enterRawMode (String driver) throws Error;
+ public native void leaveRawMode () throws Error;
+ public native int sendRaw (byte buffer[]) throws Error;
+ public native int recvRaw (byte buffer[]) throws Error;
+
+ public static native String getPacketTypeName (long type);
+}
diff -Naur brltty-3.9.orig/Bindings/Java/Test.java brltty-3.9/Bindings/Java/Test.java
--- brltty-3.9.orig/Bindings/Java/Test.java 1970-01-01 01:00:00.000000000 +0100
+++ brltty-3.9/Bindings/Java/Test.java 2008-02-28 14:05:14.000000000 +0100
@@ -0,0 +1,106 @@
+/*
+ * libbrlapi - A library providing access to braille terminals for applications.
+ *
+ * Copyright (C) 2006-2007 by
+ * Samuel Thibault <Samuel.Thibault@ens-lyon.org>
+ * Sébastien Hinderer <Sebastien.Hinderer@ens-lyon.org>
+ *
+ * libbrlapi comes with ABSOLUTELY NO WARRANTY.
+ *
+ * This is free software, placed under the terms of the
+ * GNU Lesser General Public License, as published by the Free Software
+ * Foundation; either version 2.1 of the License,
+ * or (at your option) any later version.
+ * Please see the file COPYING-API for details.
+ *
+ * Web Page: http://mielke.cc/brltty/
+ *
+ * This software is maintained by Dave Mielke <dave@mielke.cc>.
+ */
+
+package org.a11y.BrlAPI;
+
+public class Test {
+ public static void main(String argv[]) {
+ ConnectionSettings settings = new ConnectionSettings();
+
+ {
+ int argi = 0;
+ while (argi < argv.length) {
+ String arg = argv[argi++];
+
+ if (arg.equals("-host")) {
+ if (argi == argv.length) {
+ System.err.println("Missing host specification.");
+ System.exit(2);
+ }
+
+ settings.host = argv[argi++];
+ continue;
+ }
+
+ System.err.println("Invalid option: " + arg);
+ System.exit(2);
+ }
+ }
+
+ try {
+ System.loadLibrary("brlapi_java");
+
+ System.out.print("Connecting to BrlAPI... ");
+ Brlapi brlapi = new Brlapi(settings);
+ System.out.println("done (fd=" + brlapi.getFileDescriptor() + ")");
+
+ System.out.print("Connected to " + brlapi.getHost());
+ System.out.print(" using key file " + brlapi.getAuth());
+ System.out.println();
+
+ System.out.print("Driver is " + brlapi.getDriverName());
+ System.out.println();
+
+ DisplaySize size = brlapi.getDisplaySize();
+ System.out.println("Display size is " + size.getWidth() + "x" + size.getHeight());
+
+ int tty = brlapi.enterTtyMode();
+ System.out.println("TTY is " + tty);
+
+ brlapi.writeText("ok !! €", Brlapi.CURSOR_OFF);
+ brlapi.writeText(null, 1);
+
+ long key[] = {0};
+ brlapi.ignoreKeys(Brlapi.rangeType_all, key);
+ key[0] = Constants.KEY_TYPE_CMD;
+ brlapi.acceptKeys(Brlapi.rangeType_type, key);
+ long keys[][] = {{0,2},{5,7}};
+ brlapi.ignoreKeyRanges(keys);
+
+ printKey(new Key(brlapi.readKey(true)));
+
+ {
+ WriteArguments args = new WriteArguments();
+ args.regionBegin = 10;
+ args.regionSize = 20;
+ args.text = "Key Pressed € ";
+ args.andMask = "????????????????????".getBytes();
+ args.cursor = 3;
+ brlapi.write(args);
+ }
+
+ printKey(new Key(brlapi.readKey(true)));
+
+ brlapi.leaveTtyMode();
+ brlapi.closeConnection();
+ } catch (Error error) {
+ System.out.println("got error: " + error);
+ System.exit(3);
+ }
+ }
+
+ private static void printKey (Key key) {
+ System.out.println("got key " + Long.toHexString(key.getCode()) + " (" +
+ Integer.toHexString(key.getType()) + "," +
+ Integer.toHexString(key.getCommand()) + "," +
+ Integer.toHexString(key.getArgument()) + "," +
+ Integer.toHexString(key.getFlags()) + ")");
+ }
+}
diff -Naur brltty-3.9.orig/Bindings/Java/WriteArguments.java brltty-3.9/Bindings/Java/WriteArguments.java
--- brltty-3.9.orig/Bindings/Java/WriteArguments.java 1970-01-01 01:00:00.000000000 +0100
+++ brltty-3.9/Bindings/Java/WriteArguments.java 2008-02-28 14:05:14.000000000 +0100
@@ -0,0 +1,34 @@
+/*
+ * libbrlapi - A library providing access to braille terminals for applications.
+ *
+ * Copyright (C) 2006-2007 by
+ * Samuel Thibault <Samuel.Thibault@ens-lyon.org>
+ * Sébastien Hinderer <Sebastien.Hinderer@ens-lyon.org>
+ *
+ * libbrlapi comes with ABSOLUTELY NO WARRANTY.
+ *
+ * This is free software, placed under the terms of the
+ * GNU Lesser General Public License, as published by the Free Software
+ * Foundation; either version 2.1 of the License,
+ * or (at your option) any later version.
+ * Please see the file COPYING-API for details.
+ *
+ * Web Page: http://mielke.cc/brltty/
+ *
+ * This software is maintained by Dave Mielke <dave@mielke.cc>.
+ */
+
+package org.a11y.BrlAPI;
+
+public class WriteArguments {
+ public int displayNumber = Brlapi.DISPLAY_DEFAULT;
+ public int regionBegin = 0;
+ public int regionSize = 0;
+ public String text = null;
+ public byte andMask[] = null;
+ public byte orMask[] = null;
+ public int cursor = Brlapi.CURSOR_LEAVE;
+
+ public WriteArguments () {
+ }
+}