From ede97fc7267b8ecfbe65d2da7b7b29261dc8c48c Mon Sep 17 00:00:00 2001 From: Philipp Crocoll Date: Tue, 23 Jun 2015 17:25:27 +0200 Subject: [PATCH] update InputStick Plugin to 1.31 --- .../res/menu/install_utility.xml | 9 + .../res/values-sw600dp/dimens.xml | 8 + .../res/values-sw720dp-land/dimens.xml | 9 + src/java/InputStickAPI/res/values/dimens.xml | 7 + .../inputstick/api/BTConnectionManager.java | 24 +- .../com/inputstick/api/ConnectionManager.java | 25 +- .../src/com/inputstick/api/HIDInfo.java | 2 +- .../inputstick/api/IPCConnectionManager.java | 45 +- .../com/inputstick/api/InputStickError.java | 144 ++++++ .../inputstick/api/OnEmptyBufferListener.java | 8 + .../src/com/inputstick/api/Packet.java | 71 +-- .../src/com/inputstick/api/Util.java | 31 +- .../api/basic/InputStickConsumer.java | 40 +- .../api/basic/InputStickGamepad.java | 29 ++ .../inputstick/api/basic/InputStickHID.java | 225 +++++++-- .../api/basic/InputStickKeyboard.java | 47 +- .../inputstick/api/basic/InputStickMouse.java | 4 + .../api/bluetooth/BT20Connection.java | 204 +++++++++ .../api/bluetooth/BT40Connection.java | 286 ++++++++++++ .../api/bluetooth/BTConnection.java | 26 ++ .../inputstick/api/bluetooth/BTService.java | 428 ++++-------------- .../api/bluetooth/PacketReader.java | 88 ++++ .../inputstick/api/hid/ConsumerReport.java | 15 +- .../com/inputstick/api/hid/GamepadReport.java | 32 ++ .../com/inputstick/api/hid/HIDKeycodes.java | 106 ++--- .../inputstick/api/hid/HIDTransaction.java | 4 + .../api/hid/HIDTransactionQueue.java | 23 +- .../inputstick/api/layout/DanishLayout.java | 218 +++++++++ .../inputstick/api/layout/DvorakLayout.java | 160 +++++++ .../inputstick/api/layout/FinnishLayout.java | 220 +++++++++ .../inputstick/api/layout/FrenchLayout.java | 206 +++++++++ .../inputstick/api/layout/GermanLayout.java | 43 -- .../api/layout/GermanMacLayout.java | 201 ++++++++ .../inputstick/api/layout/HebrewLayout.java | 159 +++++++ .../inputstick/api/layout/ItalianLayout.java | 160 +++++++ .../inputstick/api/layout/KeyboardLayout.java | 16 +- .../api/layout/NorwegianLayout.java | 221 +++++++++ .../api/layout/PortugueseBrazilianLayout.java | 226 +++++++++ .../inputstick/api/layout/SlovakLayout.java | 299 ++++++++++++ .../inputstick/api/layout/SpanishLayout.java | 222 +++++++++ .../inputstick/api/layout/SwedishLayout.java | 218 +++++++++ .../api/layout/SwissFrenchLayout.java | 199 ++++++++ .../api/layout/SwissGermanLayout.java | 220 +++++++++ .../api/layout/UnitedKingdomLayout.java | 160 +++++++ .../src/com/inputstick/init/DeviceInfo.java | 89 ++++ .../src/com/inputstick/init/InitManager.java | 17 +- .../bin/keepass2androidpluginsdk.jar | Bin 20359 -> 20359 bytes src/java/PluginInputStick/AndroidManifest.xml | 4 +- .../res/layout/activity_mac_setup.xml | 42 ++ .../res/layout/activity_masked_password.xml | 177 ++++++++ .../res/layout/activity_quick_settings.xml | 34 ++ .../PluginInputStick/res/raw/changelog.txt | 44 ++ .../res/values-pl/strings.xml | 39 ++ .../values-pl/strings_activity_settings.xml | 105 +++++ .../PluginInputStick/res/values/strings.xml | 32 +- .../res/values/strings_activity_settings.xml | 93 +++- .../PluginInputStick/res/xml/pref_general.xml | 116 ++++- .../plugin/inputstick/ActionReceiver.java | 293 +++++++----- .../plugin/inputstick/Const.java | 13 + .../plugin/inputstick/InputStickService.java | 39 +- .../plugin/inputstick/MacSetupActivity.java | 84 ++++ .../plugin/inputstick/MainActivity.java | 11 +- .../inputstick/MaskedPasswordActivity.java | 255 +++++++++++ .../plugin/inputstick/PluginUtils.java | 28 ++ .../inputstick/QuickSettingsActivity.java | 61 +++ .../plugin/inputstick/SettingsActivity.java | 181 +++++++- .../sheetrock/panda/changelog/ChangeLog.java | 330 ++++++++++++++ 67 files changed, 6391 insertions(+), 784 deletions(-) create mode 100644 src/java/InputStickAPI/res/menu/install_utility.xml create mode 100644 src/java/InputStickAPI/res/values-sw600dp/dimens.xml create mode 100644 src/java/InputStickAPI/res/values-sw720dp-land/dimens.xml create mode 100644 src/java/InputStickAPI/res/values/dimens.xml create mode 100644 src/java/InputStickAPI/src/com/inputstick/api/InputStickError.java create mode 100644 src/java/InputStickAPI/src/com/inputstick/api/OnEmptyBufferListener.java create mode 100644 src/java/InputStickAPI/src/com/inputstick/api/basic/InputStickGamepad.java create mode 100644 src/java/InputStickAPI/src/com/inputstick/api/bluetooth/BT20Connection.java create mode 100644 src/java/InputStickAPI/src/com/inputstick/api/bluetooth/BT40Connection.java create mode 100644 src/java/InputStickAPI/src/com/inputstick/api/bluetooth/BTConnection.java create mode 100644 src/java/InputStickAPI/src/com/inputstick/api/bluetooth/PacketReader.java create mode 100644 src/java/InputStickAPI/src/com/inputstick/api/hid/GamepadReport.java create mode 100644 src/java/InputStickAPI/src/com/inputstick/api/layout/DanishLayout.java create mode 100644 src/java/InputStickAPI/src/com/inputstick/api/layout/DvorakLayout.java create mode 100644 src/java/InputStickAPI/src/com/inputstick/api/layout/FinnishLayout.java create mode 100644 src/java/InputStickAPI/src/com/inputstick/api/layout/FrenchLayout.java create mode 100644 src/java/InputStickAPI/src/com/inputstick/api/layout/GermanMacLayout.java create mode 100644 src/java/InputStickAPI/src/com/inputstick/api/layout/HebrewLayout.java create mode 100644 src/java/InputStickAPI/src/com/inputstick/api/layout/ItalianLayout.java create mode 100644 src/java/InputStickAPI/src/com/inputstick/api/layout/NorwegianLayout.java create mode 100644 src/java/InputStickAPI/src/com/inputstick/api/layout/PortugueseBrazilianLayout.java create mode 100644 src/java/InputStickAPI/src/com/inputstick/api/layout/SlovakLayout.java create mode 100644 src/java/InputStickAPI/src/com/inputstick/api/layout/SpanishLayout.java create mode 100644 src/java/InputStickAPI/src/com/inputstick/api/layout/SwedishLayout.java create mode 100644 src/java/InputStickAPI/src/com/inputstick/api/layout/SwissFrenchLayout.java create mode 100644 src/java/InputStickAPI/src/com/inputstick/api/layout/SwissGermanLayout.java create mode 100644 src/java/InputStickAPI/src/com/inputstick/api/layout/UnitedKingdomLayout.java create mode 100644 src/java/InputStickAPI/src/com/inputstick/init/DeviceInfo.java create mode 100644 src/java/PluginInputStick/res/layout/activity_mac_setup.xml create mode 100644 src/java/PluginInputStick/res/layout/activity_masked_password.xml create mode 100644 src/java/PluginInputStick/res/layout/activity_quick_settings.xml create mode 100644 src/java/PluginInputStick/res/raw/changelog.txt create mode 100644 src/java/PluginInputStick/res/values-pl/strings.xml create mode 100644 src/java/PluginInputStick/res/values-pl/strings_activity_settings.xml create mode 100644 src/java/PluginInputStick/src/keepass2android/plugin/inputstick/Const.java create mode 100644 src/java/PluginInputStick/src/keepass2android/plugin/inputstick/MacSetupActivity.java create mode 100644 src/java/PluginInputStick/src/keepass2android/plugin/inputstick/MaskedPasswordActivity.java create mode 100644 src/java/PluginInputStick/src/keepass2android/plugin/inputstick/PluginUtils.java create mode 100644 src/java/PluginInputStick/src/keepass2android/plugin/inputstick/QuickSettingsActivity.java create mode 100644 src/java/PluginInputStick/src/sheetrock/panda/changelog/ChangeLog.java diff --git a/src/java/InputStickAPI/res/menu/install_utility.xml b/src/java/InputStickAPI/res/menu/install_utility.xml new file mode 100644 index 00000000..c0020282 --- /dev/null +++ b/src/java/InputStickAPI/res/menu/install_utility.xml @@ -0,0 +1,9 @@ + + + + + diff --git a/src/java/InputStickAPI/res/values-sw600dp/dimens.xml b/src/java/InputStickAPI/res/values-sw600dp/dimens.xml new file mode 100644 index 00000000..44f01db7 --- /dev/null +++ b/src/java/InputStickAPI/res/values-sw600dp/dimens.xml @@ -0,0 +1,8 @@ + + + + + diff --git a/src/java/InputStickAPI/res/values-sw720dp-land/dimens.xml b/src/java/InputStickAPI/res/values-sw720dp-land/dimens.xml new file mode 100644 index 00000000..61e3fa8f --- /dev/null +++ b/src/java/InputStickAPI/res/values-sw720dp-land/dimens.xml @@ -0,0 +1,9 @@ + + + + 128dp + + diff --git a/src/java/InputStickAPI/res/values/dimens.xml b/src/java/InputStickAPI/res/values/dimens.xml new file mode 100644 index 00000000..55c1e590 --- /dev/null +++ b/src/java/InputStickAPI/res/values/dimens.xml @@ -0,0 +1,7 @@ + + + + 16dp + 16dp + + diff --git a/src/java/InputStickAPI/src/com/inputstick/api/BTConnectionManager.java b/src/java/InputStickAPI/src/com/inputstick/api/BTConnectionManager.java index f2c55b43..b65bbaa2 100644 --- a/src/java/InputStickAPI/src/com/inputstick/api/BTConnectionManager.java +++ b/src/java/InputStickAPI/src/com/inputstick/api/BTConnectionManager.java @@ -16,6 +16,7 @@ public class BTConnectionManager extends ConnectionManager implements InitManage private String mMac; private byte[] mKey; + private boolean mIsBT40; private InitManager mInitManager; private Application mApp; @@ -74,28 +75,29 @@ public class BTConnectionManager extends ConnectionManager implements InitManage disconnect(); } - private void onData(byte[] rawData) { + @Override + protected void onData(byte[] rawData) { byte[] data; - data = mPacketManager.bytesToPacket(rawData); - + data = mPacketManager.bytesToPacket(rawData); if (data == null) { //TODO failure? return; } - mInitManager.onData(data); - - for (InputStickDataListener listener : mDataListeners) { - listener.onInputStickData(data); - } + mInitManager.onData(data); + super.onData(data); } - - public BTConnectionManager(InitManager initManager, Application app, String mac, byte[] key) { + public BTConnectionManager(InitManager initManager, Application app, String mac, byte[] key, boolean isBT40) { mInitManager = initManager; mMac = mac; mKey = key; mApp = app; + mIsBT40 = isBT40; + } + + public BTConnectionManager(InitManager initManager, Application app, String mac, byte[] key) { + this(initManager, app, mac, key, false); } @Override @@ -112,7 +114,7 @@ public class BTConnectionManager extends ConnectionManager implements InitManage } mBTService.setConnectTimeout(timeout); mBTService.enableReflection(reflection); - mBTService.connect(mMac, doNotAsk); + mBTService.connect(mMac, doNotAsk, mIsBT40); onConnecting(); } diff --git a/src/java/InputStickAPI/src/com/inputstick/api/ConnectionManager.java b/src/java/InputStickAPI/src/com/inputstick/api/ConnectionManager.java index f7bd6df6..82f7cc67 100644 --- a/src/java/InputStickAPI/src/com/inputstick/api/ConnectionManager.java +++ b/src/java/InputStickAPI/src/com/inputstick/api/ConnectionManager.java @@ -15,7 +15,7 @@ public abstract class ConnectionManager { protected Vector mDataListeners = new Vector(); protected int mState; - protected int mErrorCode; + protected int mErrorCode; public abstract void connect(); public abstract void disconnect(); @@ -41,10 +41,33 @@ public abstract class ConnectionManager { return mState; } + public boolean isReady() { + if (mState == STATE_READY) { + return true; + } else { + return false; + } + } + + public boolean isConnected() { + if ((mState == STATE_READY) || (mState == STATE_CONNECTED)) { + return true; + } else { + return false; + } + } + public int getErrorCode() { return mErrorCode; } + + protected void onData(byte[] data) { + for (InputStickDataListener listener : mDataListeners) { + listener.onInputStickData(data); + } + } + public void addStateListener(InputStickStateListener listener) { if (listener != null) { if ( !mStateListeners.contains(listener)) { diff --git a/src/java/InputStickAPI/src/com/inputstick/api/HIDInfo.java b/src/java/InputStickAPI/src/com/inputstick/api/HIDInfo.java index b1c2c1d5..908e4e11 100644 --- a/src/java/InputStickAPI/src/com/inputstick/api/HIDInfo.java +++ b/src/java/InputStickAPI/src/com/inputstick/api/HIDInfo.java @@ -63,7 +63,7 @@ public class HIDInfo { mouseReportProtocol = true; } else { mouseReportProtocol = false; - } + } if (data[6] == 0) { mouseReady = false; diff --git a/src/java/InputStickAPI/src/com/inputstick/api/IPCConnectionManager.java b/src/java/InputStickAPI/src/com/inputstick/api/IPCConnectionManager.java index cac0d4d9..669e8106 100644 --- a/src/java/InputStickAPI/src/com/inputstick/api/IPCConnectionManager.java +++ b/src/java/InputStickAPI/src/com/inputstick/api/IPCConnectionManager.java @@ -14,7 +14,6 @@ import android.os.Handler; import android.os.IBinder; import android.os.Message; import android.os.Messenger; -import android.os.RemoteException; public class IPCConnectionManager extends ConnectionManager { @@ -39,22 +38,24 @@ public class IPCConnectionManager extends ConnectionManager { } @Override - public void handleMessage(Message msg) { + public void handleMessage(Message msg) { + if (ref == null) return; IPCConnectionManager manager = ref.get(); - - switch (msg.what) { - case SERVICE_CMD_DATA: - byte[] data = null; - Bundle b = msg.getData(); - if (b != null) { - data = b.getByteArray("data"); - manager.onData(data); - } - break; - case SERVICE_CMD_STATE: - manager.stateNotify(msg.arg1); - break; - } + if (manager != null) { + switch (msg.what) { + case SERVICE_CMD_DATA: + byte[] data = null; + Bundle b = msg.getData(); + if (b != null) { + data = b.getByteArray("data"); + manager.onData(data); + } + break; + case SERVICE_CMD_STATE: + manager.stateNotify(msg.arg1); + break; + } + } } } @@ -90,7 +91,7 @@ public class IPCConnectionManager extends ConnectionManager { msg.replyTo = mMessenger; msg.setData(b); mService.send(msg); - } catch (RemoteException e) { + } catch (Exception e) { e.printStackTrace(); } } @@ -106,11 +107,9 @@ public class IPCConnectionManager extends ConnectionManager { sendMessage(what, arg1, arg2, (Bundle)null); } - - private void onData(byte[] data) { - for (InputStickDataListener listener : mDataListeners) { - listener.onInputStickData(data); - } + @Override + protected void onData(byte[] data) { + super.onData(data); } @@ -163,7 +162,7 @@ public class IPCConnectionManager extends ConnectionManager { @Override public void sendPacket(Packet p) { - if (mState == ConnectionManager.STATE_READY) { + if ((mState == ConnectionManager.STATE_READY) || (mState == ConnectionManager.STATE_CONNECTED)) { if (p.getRespond()) { sendMessage(IPCConnectionManager.SERVICE_CMD_DATA, 1, 0, p.getBytes()); } else { diff --git a/src/java/InputStickAPI/src/com/inputstick/api/InputStickError.java b/src/java/InputStickAPI/src/com/inputstick/api/InputStickError.java new file mode 100644 index 00000000..d9bbbc6f --- /dev/null +++ b/src/java/InputStickAPI/src/com/inputstick/api/InputStickError.java @@ -0,0 +1,144 @@ +package com.inputstick.api; + +import android.util.SparseArray; + +public class InputStickError { + + public static String ERROR_UNKNOWN_MSG = "Unknown"; + + public static final int ERROR_NONE = 0; + public static final int ERROR_UNKNOWN = 1; + + //Bluetooth comm errors: + public static final int ERROR_BLUETOOTH = 0x0100; + public static final int ERROR_BLUETOOTH_CONNECTION_FAILED = ERROR_BLUETOOTH | 0x01; + public static final int ERROR_BLUETOOTH_CONNECTION_LOST = ERROR_BLUETOOTH | 0x02; + public static final int ERROR_BLUETOOTH_NOT_SUPPORTED = ERROR_BLUETOOTH | 0x03; + public static final int ERROR_BLUETOOTH_INVALID_MAC = ERROR_BLUETOOTH | 0x04; + public static final int ERROR_BLUETOOTH_ECHO_TIMEDOUT = ERROR_BLUETOOTH | 0x05; + public static final int ERROR_BLUETOOTH_NO_REMOTE_DEVICE = ERROR_BLUETOOTH | 0x06; + public static final int ERROR_BLUETOOTH_BT40_NOT_SUPPRTED = ERROR_BLUETOOTH | 0x07; + public static final int ERROR_BLUETOOTH_BT40_NO_SPP_SERVICE = ERROR_BLUETOOTH | 0x08; + + //Hardware-related errors: + public static final int ERROR_HARDWARE = 0x0200; + public static final int ERROR_HARDWARE_WDG_RESET = ERROR_HARDWARE | 0x01; + + //Packet + public static final int ERROR_PACKET = 0x0300; + public static final int ERROR_PACKET_INVALID_CRC = ERROR_PACKET | 0x01; + public static final int ERROR_PACKET_INVALID_LENGTH = ERROR_PACKET | 0x02; + public static final int ERROR_PACKET_INVALID_HEADER = ERROR_PACKET | 0x03; + + //Init + public static final int ERROR_INIT = 0x0400; + public static final int ERROR_INIT_UNSUPPORTED_CMD = ERROR_INIT | 0x01; + public static final int ERROR_INIT_TIMEDOUT = ERROR_INIT | 0x02; + public static final int ERROR_INIT_FW_TYPE_NOT_SUPPORTED = ERROR_INIT | 0x03; + public static final int ERROR_INIT_FW_VERSION_NOT_SUPPORTED = ERROR_INIT | 0x04; + + //Security + public static final int ERROR_SECURITY = 0x0500; + public static final int ERROR_SECURITY_NOT_SUPPORTED = ERROR_SECURITY | 0x01; + public static final int ERROR_SECURITY_NO_KEY = ERROR_SECURITY | 0x02; + public static final int ERROR_SECURITY_INVALID_KEY = ERROR_SECURITY | 0x03; + public static final int ERROR_SECURITY_CHALLENGE = ERROR_SECURITY | 0x04; + public static final int ERROR_SECURITY_NOT_PROTECTED = ERROR_SECURITY | 0x05; + + //Android + public static final int ERROR_ANDROID = 0x1000; + public static final int ERROR_ANDROID_NO_UTILITY_APP = ERROR_ANDROID | 0x01; + public static final int ERROR_ANDROID_SERVICE_DISCONNECTED = ERROR_ANDROID | 0x02; + public static final int ERROR_ANDROID_UTIL_FORCE_DISC = ERROR_ANDROID | 0x03; + public static final int ERROR_ANDROID_UTIL_IDLE_DISC = ERROR_ANDROID | 0x04; + + // 0000 - ERROR_NONE + // xx00 - Category / Unknown + // xxyy - Category / Details + + private static final SparseArray errorCodeMap; + static + { + errorCodeMap = new SparseArray(); + errorCodeMap.put(ERROR_NONE, "None"); + errorCodeMap.put(ERROR_UNKNOWN, "Unknown"); + //Bluetooth + errorCodeMap.put(ERROR_BLUETOOTH, "Bluetooth"); + errorCodeMap.put(ERROR_BLUETOOTH_CONNECTION_FAILED, "Failed to connect"); + errorCodeMap.put(ERROR_BLUETOOTH_CONNECTION_LOST, "Connection lost"); + errorCodeMap.put(ERROR_BLUETOOTH_NOT_SUPPORTED, "Not supported"); + errorCodeMap.put(ERROR_BLUETOOTH_INVALID_MAC, "Invalid MAC"); + errorCodeMap.put(ERROR_BLUETOOTH_ECHO_TIMEDOUT, "Echo timedout"); + errorCodeMap.put(ERROR_BLUETOOTH_NO_REMOTE_DEVICE, "Can't find remote device"); + errorCodeMap.put(ERROR_BLUETOOTH_BT40_NOT_SUPPRTED, "BT 4.0 is not supported"); + errorCodeMap.put(ERROR_BLUETOOTH_BT40_NO_SPP_SERVICE, "BT 4.0 RXTX not found"); + + //Hardware + errorCodeMap.put(ERROR_HARDWARE, "Hardware"); + errorCodeMap.put(ERROR_HARDWARE_WDG_RESET, "WDG reset"); + + //Packet + errorCodeMap.put(ERROR_PACKET, "Invalid packet"); + errorCodeMap.put(ERROR_PACKET_INVALID_CRC, "Invalid CRC"); + errorCodeMap.put(ERROR_PACKET_INVALID_LENGTH, "Invalid length"); + errorCodeMap.put(ERROR_PACKET_INVALID_HEADER, "Invalid header"); + + //Init + errorCodeMap.put(ERROR_INIT, "Init"); + errorCodeMap.put(ERROR_INIT_UNSUPPORTED_CMD, "Command not supported"); + errorCodeMap.put(ERROR_INIT_TIMEDOUT, "Timedout"); + errorCodeMap.put(ERROR_INIT_FW_TYPE_NOT_SUPPORTED, "FW type not supported"); + errorCodeMap.put(ERROR_INIT_FW_VERSION_NOT_SUPPORTED, "FW version not supported"); + + //Security + errorCodeMap.put(ERROR_SECURITY, "Security"); + errorCodeMap.put(ERROR_SECURITY_NOT_SUPPORTED, "Not supported"); + errorCodeMap.put(ERROR_SECURITY_NO_KEY, "No key provided"); + errorCodeMap.put(ERROR_SECURITY_INVALID_KEY, "Invalid key"); + errorCodeMap.put(ERROR_SECURITY_CHALLENGE, "Challenge failed"); + errorCodeMap.put(ERROR_SECURITY_NOT_PROTECTED, "Key was provided, but device is not password protected"); + + //Android + errorCodeMap.put(ERROR_ANDROID, "Android"); + errorCodeMap.put(ERROR_ANDROID_NO_UTILITY_APP, "InputStickUtility app not installed"); + errorCodeMap.put(ERROR_ANDROID_SERVICE_DISCONNECTED, "Service connection lost"); + errorCodeMap.put(ERROR_ANDROID_UTIL_FORCE_DISC, "Connection closed by InputStickUtility"); + errorCodeMap.put(ERROR_ANDROID_UTIL_IDLE_DISC, "Connection closed due to inactivity"); + + } + + public static String getErrorType(int errorCode) { + String result; + errorCode &= 0xFF00; + result = errorCodeMap.get(errorCode); + if (result != null) { + return result; + } else { + return ERROR_UNKNOWN_MSG; + } + } + + public static String getErrorMessage(int errorCode) { + String result; + if (errorCode == ERROR_NONE) { + return errorCodeMap.get(ERROR_NONE); + } + + //handle case: "Bluetooth: Unknown" etc + if ((errorCode & 0x00FF) == 0) { + return ERROR_UNKNOWN_MSG; + } + + result = errorCodeMap.get(errorCode); + if (result != null) { + return result; + } else { + return ERROR_UNKNOWN_MSG; + } + } + + public static String getFullErrorMessage(int errorCode) { + return getErrorType(errorCode) + " - " + getErrorMessage(errorCode); + } + +} diff --git a/src/java/InputStickAPI/src/com/inputstick/api/OnEmptyBufferListener.java b/src/java/InputStickAPI/src/com/inputstick/api/OnEmptyBufferListener.java new file mode 100644 index 00000000..9b84b954 --- /dev/null +++ b/src/java/InputStickAPI/src/com/inputstick/api/OnEmptyBufferListener.java @@ -0,0 +1,8 @@ +package com.inputstick.api; + +public interface OnEmptyBufferListener { + + public void onLocalBufferEmpty(int interfaceId); + public void onRemoteBufferEmpty(int interfaceId); + +} diff --git a/src/java/InputStickAPI/src/com/inputstick/api/Packet.java b/src/java/InputStickAPI/src/com/inputstick/api/Packet.java index ddb24ef5..7b4c2fff 100644 --- a/src/java/InputStickAPI/src/com/inputstick/api/Packet.java +++ b/src/java/InputStickAPI/src/com/inputstick/api/Packet.java @@ -2,48 +2,59 @@ package com.inputstick.api; public class Packet { - public static final byte NONE = 0x00; + public static final byte NONE = 0x00; - public static final byte START_TAG = 0x55; - public static final byte FLAG_RESPOND = (byte)0x80; - public static final byte FLAG_ENCRYPTED = 0x40; + public static final byte START_TAG = 0x55; + public static final byte FLAG_RESPOND = (byte)0x80; + public static final byte FLAG_ENCRYPTED = 0x40; - public static final int MAX_SUBPACKETS = 17; - public static final int MAX_LENGTH = MAX_SUBPACKETS * 16; + public static final int MAX_SUBPACKETS = 17; + public static final int MAX_LENGTH = MAX_SUBPACKETS * 16; - public static final byte CMD_IDENTIFY = 0x01; - public static final byte CMD_LED = 0x02; - public static final byte CMD_RUN_BL = 0x03; - public static final byte CMD_RUN_FW = 0x04; - public static final byte CMD_GET_INFO = 0x05; - public static final byte CMD_BL_ERASE = 0x06; - public static final byte CMD_ADD_DATA = 0x07; - public static final byte CMD_BL_WRITE = 0x08; + public static final byte CMD_IDENTIFY = 0x01; + public static final byte CMD_LED = 0x02; + public static final byte CMD_RUN_BL = 0x03; + public static final byte CMD_RUN_FW = 0x04; + public static final byte CMD_GET_INFO = 0x05; + public static final byte CMD_BL_ERASE = 0x06; + public static final byte CMD_ADD_DATA = 0x07; + public static final byte CMD_BL_WRITE = 0x08; - public static final byte CMD_FW_INFO = 0x10; - public static final byte CMD_INIT = 0x11; - public static final byte CMD_INIT_AUTH = 0x12; - public static final byte CMD_INIT_CON = 0x13; - //public static final byte CMD_SET_KEY = 0x14; - public static final byte CMD_SET_VALUE = 0x14; - public static final byte CMD_RESTORE_DEFAULTS = 0x15; - public static final byte CMD_RESTORE_STATUS = 0x16; + public static final byte CMD_FW_INFO = 0x10; + public static final byte CMD_INIT = 0x11; + public static final byte CMD_INIT_AUTH = 0x12; + public static final byte CMD_INIT_CON = 0x13; + public static final byte CMD_SET_VALUE = 0x14; + public static final byte CMD_RESTORE_DEFAULTS = 0x15; + public static final byte CMD_RESTORE_STATUS = 0x16; + public static final byte CMD_GET_VALUE = 0x17; + public static final byte CMD_SET_PIN = 0x18; + public static final byte CMD_USB_RESUME = 0x19; + public static final byte CMD_USB_POWER = 0x1A; + + public static final byte CMD_SYSTEM_NOTIFICATION = 0x1F; - public static final byte CMD_HID_STATUS_REPORT = 0x20; - public static final byte CMD_HID_DATA_KEYB = 0x21; - public static final byte CMD_HID_DATA_CONSUMER = 0x22; - public static final byte CMD_HID_DATA_MOUSE = 0x23; + + public static final byte CMD_HID_STATUS_REPORT = 0x20; + public static final byte CMD_HID_DATA_KEYB = 0x21; + public static final byte CMD_HID_DATA_CONSUMER = 0x22; + public static final byte CMD_HID_DATA_MOUSE = 0x23; + public static final byte CMD_HID_DATA_GAMEPAD = 0x24; + + public static final byte CMD_HID_DATA_ENDP = 0x2B; + public static final byte CMD_HID_DATA_KEYB_FAST = 0x2C; + public static final byte CMD_HID_DATA_KEYB_FASTEST = 0x2D; //out - public static final byte CMD_HID_STATUS = 0x2F; + public static final byte CMD_HID_STATUS = 0x2F; - public static final byte CMD_DUMMY = (byte)0xFF; + public static final byte CMD_DUMMY = (byte)0xFF; - public static final byte RESP_OK = 0x01; - public static final byte RESP_UNKNOWN_CMD = (byte)0xFF; + public static final byte RESP_OK = 0x01; + public static final byte RESP_UNKNOWN_CMD = (byte)0xFF; public static final byte[] RAW_OLD_BOOTLOADER = new byte[] {START_TAG, (byte)0x00, (byte)0x02, (byte)0x83, (byte)0x00, (byte)0xDA}; diff --git a/src/java/InputStickAPI/src/com/inputstick/api/Util.java b/src/java/InputStickAPI/src/com/inputstick/api/Util.java index 57b187c5..a624514c 100644 --- a/src/java/InputStickAPI/src/com/inputstick/api/Util.java +++ b/src/java/InputStickAPI/src/com/inputstick/api/Util.java @@ -8,6 +8,7 @@ import java.security.NoSuchAlgorithmException; public abstract class Util { public static boolean debug = false; + public static boolean flashingToolMode = false; public static void log(String msg) { log(msg, false); @@ -30,27 +31,31 @@ public abstract class Util { } } + public static String byteToHexString(byte b) { + String s; + //0x0..0xF = 0x00..0x0F + if ((b < 0x10) && (b >= 0)) { + s = Integer.toHexString((int)b); + s = "0" + s; + } else { + s = Integer.toHexString((int)b); + if (s.length() > 2) { + s = s.substring(s.length() - 2); + } + } + s = s.toUpperCase(); + return s; + } public static void printHex(byte[] toPrint) { if (debug) { if (toPrint != null) { int cnt = 0; - String s; byte b; for (int i = 0; i < toPrint.length; i++) { b = toPrint[i]; - //0x0..0xF = 0x00..0x0F - if ((b < 0x10) && (b >= 0)) { - s = Integer.toHexString((int)b); - s = "0" + s; - } else { - s = Integer.toHexString((int)b); - if (s.length() > 2) { - s = s.substring(s.length() - 2); - } - } - s = s.toUpperCase(); - System.out.print("0x" + s + " "); + + System.out.print("0x" + byteToHexString(b) + " "); cnt++; if (cnt == 8) { System.out.println(""); diff --git a/src/java/InputStickAPI/src/com/inputstick/api/basic/InputStickConsumer.java b/src/java/InputStickAPI/src/com/inputstick/api/basic/InputStickConsumer.java index edb3b287..00b6d3cc 100644 --- a/src/java/InputStickAPI/src/com/inputstick/api/basic/InputStickConsumer.java +++ b/src/java/InputStickAPI/src/com/inputstick/api/basic/InputStickConsumer.java @@ -5,7 +5,9 @@ import com.inputstick.api.hid.HIDTransaction; public class InputStickConsumer { - //CONSUMER PAGE + + + //CONSUMER PAGE (consumerAction) public static final int VOL_UP = 0x00E9; public static final int VOL_DOWN = 0x00EA; public static final int VOL_MUTE = 0x00E2; @@ -18,18 +20,42 @@ public class InputStickConsumer { public static final int LAUNCH_EMAIL = 0x018A; public static final int LAUNCH_CALC = 0x0192; - //SYSTEM CONTROL - public static final int POWER_DOWN = 0x81; - public static final int SLEEP = 0x82; - public static final int WAKEUP = 0x83; + //Android OS: + public static final int HOME = 0x0223; + public static final int BACK = 0x0224; + public static final int SEARCH = 0x0221; + + + //SYSTEM PAGE (systemAction) + public static final byte SYSTEM_POWER_DOWN = 0x01; + public static final byte SYSTEM_SLEEP = 0x02; + public static final byte SYSTEM_WAKEUP = 0x03; private InputStickConsumer() { } - /*public static void systemAction(int action) { - }*/ + //use only for SYSTEM_POWER_DOWN, SYSTEM_SLEEP and SYSTEM_WAKEUP + public static void systemAction(byte action) { + HIDTransaction t = new HIDTransaction(); + t.addReport(new ConsumerReport(ConsumerReport.SYSTEM_REPORT_ID, action, (byte)0)); + t.addReport(new ConsumerReport(ConsumerReport.SYSTEM_REPORT_ID, (byte)0, (byte)0)); + InputStickHID.addConsumerTransaction(t); + } + public static void systemPowerDown() { + systemAction(SYSTEM_POWER_DOWN); + } + + public static void systemSleep() { + systemAction(SYSTEM_SLEEP); + } + + public static void systemWakeUp() { + systemAction(SYSTEM_WAKEUP); + } + + //action - see http://www.usb.org/developers/hidpage/Hut1_12v2.pdf (consumer page) public static void consumerAction(int action) { HIDTransaction t = new HIDTransaction(); t.addReport(new ConsumerReport(action)); diff --git a/src/java/InputStickAPI/src/com/inputstick/api/basic/InputStickGamepad.java b/src/java/InputStickAPI/src/com/inputstick/api/basic/InputStickGamepad.java new file mode 100644 index 00000000..f0de3fb1 --- /dev/null +++ b/src/java/InputStickAPI/src/com/inputstick/api/basic/InputStickGamepad.java @@ -0,0 +1,29 @@ +package com.inputstick.api.basic; + +import com.inputstick.api.Packet; + + +public class InputStickGamepad { + + private InputStickGamepad() { + + } + + //buttons1 - button0, button1, ..., button7 + //buttons2 - button8, button1, ..., button15 + public static void customReport(byte buttons1, byte buttons2, byte x, byte y, byte z, byte rX) { + if (InputStickHID.isReady()) { + Packet p = new Packet(false, (byte)0x2B, (byte)0x03); //write directly to endp3in, no buffering + p.addByte((byte)0x07); //report bytes cnt + p.addByte((byte)0x03); //report ID + p.addByte(buttons1); + p.addByte(buttons2); + p.addByte(x); + p.addByte(y); + p.addByte(z); + p.addByte(rX); + InputStickHID.sendPacket(p); + } + } + +} diff --git a/src/java/InputStickAPI/src/com/inputstick/api/basic/InputStickHID.java b/src/java/InputStickAPI/src/com/inputstick/api/basic/InputStickHID.java index 5bc4d5ca..600bbe28 100644 --- a/src/java/InputStickAPI/src/com/inputstick/api/basic/InputStickHID.java +++ b/src/java/InputStickAPI/src/com/inputstick/api/basic/InputStickHID.java @@ -21,8 +21,11 @@ import com.inputstick.api.InputStickStateListener; import com.inputstick.api.OnEmptyBufferListener; import com.inputstick.api.Packet; import com.inputstick.api.Util; +import com.inputstick.api.hid.HIDReport; import com.inputstick.api.hid.HIDTransaction; import com.inputstick.api.hid.HIDTransactionQueue; +import com.inputstick.init.BasicInitManager; +import com.inputstick.init.DeviceInfo; import com.inputstick.init.InitManager; public class InputStickHID implements InputStickStateListener, InputStickDataListener { @@ -36,19 +39,25 @@ public class InputStickHID implements InputStickStateListener, InputStickDataLis private static ConnectionManager mConnectionManager; private static Vector mStateListeners = new Vector(); - + protected static Vector mBufferEmptyListeners = new Vector(); private static InputStickHID instance = new InputStickHID(); private static HIDInfo mHIDInfo; + private static DeviceInfo mDeviceInfo; private static HIDTransactionQueue keyboardQueue; private static HIDTransactionQueue mouseQueue; private static HIDTransactionQueue consumerQueue; + + // >= FW 0.93 private static Timer t1; private static boolean constantUpdateMode; + + private static int mKeyboardReportMultiplier; //enables "slow" typing by multiplying HID reports + private InputStickHID() { } @@ -68,29 +77,73 @@ public class InputStickHID implements InputStickStateListener, InputStickDataLis mConnectionManager.connect(); } - //direct Bluetooth connection, custom InitManager + //direct Bluetooth connection, custom InitManager (use BT2.0) + //mac - Bluetooth MAC address + //key - use null if InputStick is not password protected, otherwise provide 16byte key: MD5(password) public static void connect(Application app, String mac, byte[] key, InitManager initManager) { - mConnectionManager = new BTConnectionManager(initManager, app, mac, key); - init(); + connect(app, mac, key, initManager, false); } - //direct Bluetooth connection - public static void connect(Application app, String mac, byte[] key) { - mConnectionManager = new BTConnectionManager(new InitManager(key), app, mac, key); + //direct Bluetooth connection, custom InitManager + //is40 - use true if target device is BluetoothLowEnergy (4.0) type + //mac - Bluetooth MAC address + //key - use null if InputStick is not password protected, otherwise provide 16byte key: MD5(password) + //is40 - use true if target device is BluetoothLowEnergy (4.0) type + public static void connect(Application app, String mac, byte[] key, InitManager initManager, boolean isBT40) { + mConnectionManager = new BTConnectionManager(initManager, app, mac, key, isBT40); init(); } - //use background service & DeviceManager + //direct Bluetooth connection + //key - use null if InputStick is not password protected, otherwise provide 16byte key: MD5(password) + //is40 - use true if target device is BluetoothLowEnergy (4.0) type + public static void connect(Application app, String mac, byte[] key, boolean isBT40) { + mConnectionManager = new BTConnectionManager(new BasicInitManager(key), app, mac, key, isBT40); + init(); + } + + //direct Bluetooth connection (use BT2.0) + //key - use null if InputStick is not password protected, otherwise provide 16byte key: MD5(password) + public static void connect(Application app, String mac, byte[] key) { + connect(app, mac, key, false); + } + + //use InputStickUtility to connect with InputStick public static void connect(Application app) { mConnectionManager = new IPCConnectionManager(app); init(); } + //closes Bluetooth connection public static void disconnect() { - //TODO check state? - mConnectionManager.disconnect(); + if (mConnectionManager != null) { + mConnectionManager.disconnect(); + } } + //requests USB host to resume from sleep mode (must be supported by USB host) + //note: InputStick will most likely be in STATE_CONNECTED state instead of STATE_READY + public static void wakeUpUSBHost() { + if (isConnected()) { + Packet p = new Packet(false, Packet.CMD_USB_RESUME); + InputStickHID.sendPacket(p); + mConnectionManager.sendPacket(p); + } + } + + public static DeviceInfo getDeviceInfo() { + if ((isReady()) && (mDeviceInfo != null)) { + return mDeviceInfo; + } else { + return null; + } + } + + public static HIDInfo getHIDInfo() { + return mHIDInfo; + } + + //returns current connection state public static int getState() { if (mConnectionManager != null) { return mConnectionManager.getState(); @@ -99,6 +152,7 @@ public class InputStickHID implements InputStickStateListener, InputStickDataLis } } + //returns last error code public static int getErrorCode() { if (mConnectionManager != null) { return mConnectionManager.getErrorCode(); @@ -107,8 +161,17 @@ public class InputStickHID implements InputStickStateListener, InputStickDataLis } } + //returns true if Bluetooth connection is established between the device and InputStick. + //note - InputStick may be not ready yet to accept keyboard/mouse data + public static boolean isConnected() { + if ((getState() == ConnectionManager.STATE_READY) || (getState() == ConnectionManager.STATE_CONNECTED)) { + return true; + } else { + return false; + } + } - + //returns true if InputStick is ready for keyboard/mouse data public static boolean isReady() { if (getState() == ConnectionManager.STATE_READY) { return true; @@ -117,6 +180,7 @@ public class InputStickHID implements InputStickStateListener, InputStickDataLis } } + //adds state listener. Listeners will be notified about change of connection state public static void addStateListener(InputStickStateListener listener) { if (listener != null) { if ( !mStateListeners.contains(listener)) { @@ -125,52 +189,97 @@ public class InputStickHID implements InputStickStateListener, InputStickDataLis } } + public static void removeStateListener(InputStickStateListener listener) { if (listener != null) { mStateListeners.remove(listener); } } + //adds buffer listener. Listeners will be notified when local (application) or remote (InputStick) HID report buffer is empty public static void addBufferEmptyListener(OnEmptyBufferListener listener) { if (listener != null) { - keyboardQueue.addBufferEmptyListener(listener); - mouseQueue.addBufferEmptyListener(listener); - consumerQueue.addBufferEmptyListener(listener); + if ( !mBufferEmptyListeners.contains(listener)) { + mBufferEmptyListeners.add(listener); + } } } public static void removeBufferEmptyListener(OnEmptyBufferListener listener) { if (listener != null) { - keyboardQueue.removeBufferEmptyListener(listener); - mouseQueue.removeBufferEmptyListener(listener); - consumerQueue.removeBufferEmptyListener(listener); - } + mBufferEmptyListeners.remove(listener); + } + } + + public static Vector getBufferEmptyListeners() { + return mBufferEmptyListeners; + } + + //reports added to keyboard queue will be multiplied by reportMultiplier times. This allows to type text slower. + //NOTE: using high multiplier values can make transactions larger than available buffer and as a result they will be splitted! + //this can cause problem if connection is lost (stuck keys) + //TIP: remember to manually set multiplier value back to 1 when slow typing mode is no longer needed!!! + public static void setKeyboardReportMultiplier(int reportMultiplier) { + mKeyboardReportMultiplier = reportMultiplier; } + //adds transaction to keyboard queue. If possible, all reports form a signel transactions will be sent in a single packet public static void addKeyboardTransaction(HIDTransaction transaction) { - keyboardQueue.addTransaction(transaction); + if ((transaction != null) && (keyboardQueue != null)) { + //keyboardQueue.addTransaction(transaction); + + if (mKeyboardReportMultiplier > 1) { + HIDTransaction multipliedTransaction = new HIDTransaction(); + HIDReport r; + for (int i = 0; i < transaction.getReportsCount(); i++) { + r = transaction.getHIDReportAt(i); + for (int j = 0; j < mKeyboardReportMultiplier; j++) { + multipliedTransaction.addReport(r); + } + } + keyboardQueue.addTransaction(multipliedTransaction); + } else { + keyboardQueue.addTransaction(transaction); + } + } } + //adds transaction to mouse queue. If possible, all reports form a signel transactions will be sent in a single packet public static void addMouseTransaction(HIDTransaction transaction) { - mouseQueue.addTransaction(transaction); + if ((transaction != null) && (mouseQueue != null)) { + mouseQueue.addTransaction(transaction); + } } + //adds transaction to consumer queue. If possible, all reports form a signel transactions will be sent in a single packet public static void addConsumerTransaction(HIDTransaction transaction) { - consumerQueue.addTransaction(transaction); + if ((transaction != null) && (consumerQueue != null)) { + consumerQueue.addTransaction(transaction); + } } + //removes all reports from keyboard buffer public static void clearKeyboardBuffer() { - keyboardQueue.clearBuffer(); + if (keyboardQueue != null) { + keyboardQueue.clearBuffer(); + } } + //removes all reports from mouse buffer public static void clearMouseBuffer() { - mouseQueue.clearBuffer(); + if (mouseQueue != null) { + mouseQueue.clearBuffer(); + } } + //removes all reports from consumer buffer public static void clearConsumerBuffer() { - consumerQueue.clearBuffer(); + if (consumerQueue != null) { + consumerQueue.clearBuffer(); + } } + //sends packet to InputStick public static boolean sendPacket(Packet p) { if (mConnectionManager != null) { mConnectionManager.sendPacket(p); @@ -191,29 +300,68 @@ public class InputStickHID implements InputStickStateListener, InputStickDataLis } } + //returns true if local (application) keyboard report buffer is empty. It is still possible that there are reports queued in InputStick's buffer. public static boolean isKeyboardLocalBufferEmpty() { - return keyboardQueue.isLocalBufferEmpty(); - } - public static boolean isMouseLocalBufferEmpty() { - return mouseQueue.isLocalBufferEmpty(); - } - public static boolean isConsumerLocalBufferEmpty() { - return consumerQueue.isLocalBufferEmpty(); + if (keyboardQueue != null) { + return keyboardQueue.isLocalBufferEmpty(); + } else { + return true; + } } + //returns true if local (application) mouse report buffer is empty. It is still possible that there are reports queued in InputStick's buffer. + public static boolean isMouseLocalBufferEmpty() { + if (mouseQueue != null) { + return mouseQueue.isLocalBufferEmpty(); + } else { + return true; + } + } + + //returns true if local (application) consumer report buffer is empty. It is still possible that there are reports queued in InputStick's buffer. + public static boolean isConsumerLocalBufferEmpty() { + if (consumerQueue != null) { + return consumerQueue.isLocalBufferEmpty(); + } else { + return true; + } + } + + //returns true if remote (InputStick) keyboard report buffer is empty. No more keyboard reports will be send to USB host public static boolean isKeyboardRemoteBufferEmpty() { - return keyboardQueue.isRemoteBufferEmpty(); + if (keyboardQueue != null) { + return keyboardQueue.isRemoteBufferEmpty(); + } else { + return true; + } } + + //returns true if remote (InputStick) mouse report buffer is empty. No more mouse reports will be send to USB host public static boolean isMouseRemoteBufferEmpty() { - return mouseQueue.isRemoteBufferEmpty(); + if (mouseQueue != null) { + return mouseQueue.isRemoteBufferEmpty(); + } else { + return true; + } } + + //returns true if remote (InputStick) consumer report buffer is empty. No more consumer reports will be send to USB host public static boolean isConsumerRemoteBufferEmpty() { - return consumerQueue.isRemoteBufferEmpty(); + if (consumerQueue != null) { + return consumerQueue.isRemoteBufferEmpty(); + } else { + return true; + } } @Override public void onInputStickData(byte[] data) { - if (data[0] == Packet.CMD_HID_STATUS) { + byte cmd = data[0]; + if (cmd == Packet.CMD_FW_INFO) { + mDeviceInfo = new DeviceInfo(data); + } + + if (cmd == Packet.CMD_HID_STATUS) { mHIDInfo.update(data); if (mHIDInfo.isSentToHostInfoAvailable()) { @@ -252,12 +400,13 @@ public class InputStickHID implements InputStickStateListener, InputStickDataLis } } - + //returns "Download InputStickUtility" dialog, if connection attepmt resulted in error caused by InputStickUtility not being installed on the device. + //otherwise returns null public static AlertDialog getDownloadDialog(final Context ctx) { if (mConnectionManager.getErrorCode() == InputStickError.ERROR_ANDROID_NO_UTILITY_APP) { AlertDialog.Builder downloadDialog = new AlertDialog.Builder(ctx); downloadDialog.setTitle("No InputStickUtility app installed"); - downloadDialog.setMessage("InputStickUtility is required to run this application. Download now?"); + downloadDialog.setMessage("InputStickUtility is required to run this application. Download now?\nNote: InputStick USB receiver hardware is also required."); downloadDialog.setPositiveButton("Yes", new DialogInterface.OnClickListener() { @Override @@ -286,7 +435,7 @@ public class InputStickHID implements InputStickStateListener, InputStickDataLis } else { return null; } - } + } } diff --git a/src/java/InputStickAPI/src/com/inputstick/api/basic/InputStickKeyboard.java b/src/java/InputStickAPI/src/com/inputstick/api/basic/InputStickKeyboard.java index e95e396e..9bbdad5d 100644 --- a/src/java/InputStickAPI/src/com/inputstick/api/basic/InputStickKeyboard.java +++ b/src/java/InputStickAPI/src/com/inputstick/api/basic/InputStickKeyboard.java @@ -38,6 +38,7 @@ public class InputStickKeyboard { private InputStickKeyboard() { } + //listener will be notified when status of keyboard LEDs changes (NumLock, CapsLock, ScrollLock) public static void addKeyboardListener(InputStickKeyboardListener listener) { if (listener != null) { if ( !mKeyboardListeners.contains(listener)) { @@ -76,30 +77,39 @@ public class InputStickKeyboard { } } + //returns true if NumLock LED is set to ON by USB host, otherwise false is returned. public static boolean isNumLock() { return mNumLock; } + //returns true if CapsLock LED is set to ON by USB host, otherwise false is returned. public static boolean isCapsLock() { return mCapsLock; } + //returns true if ScrollLock LED is set to ON by USB host, otherwise false is returned. public static boolean isScrollLock() { return mScrollLock; } + //same as pressing NumLock key public static void toggleNumLock() { pressAndRelease(NONE, HIDKeycodes.KEY_NUM_LOCK); } + //same as pressing CapsLock key public static void toggleCapsLock() { pressAndRelease(NONE, HIDKeycodes.KEY_CAPS_LOCK); } + //same as pressing ScrollLock key public static void toggleScrollLock() { pressAndRelease(NONE, HIDKeycodes.KEY_SCROLL_LOCK); } + //following key combination will be pressed and immediately released + //modifier - see HIDKeycodes (CTRL_LEFT .. GUI_RIGHT) + //key - see HIDKeycodes public static void pressAndRelease(byte modifier, byte key) { HIDTransaction t = new HIDTransaction(); t.addReport(new KeyboardReport(modifier, NONE)); @@ -108,36 +118,41 @@ public class InputStickKeyboard { InputStickHID.addKeyboardTransaction(t); } + //types text assuming that USB host uses en-US keyboard layout. public static void typeASCII(String toType) { int keyCode; int index; - for (int i = 0; i < toType.length(); i++) { + + for (int i = 0; i < toType.length(); i++) { index = toType.charAt(i); - if (index > 127) { - index = 127; - } - keyCode = HIDKeycodes.getKeyCode(index); - if (keyCode > 128) { - keyCode -= 128; - pressAndRelease(HIDKeycodes.SHIFT_LEFT, (byte)keyCode); - } else { - pressAndRelease(NONE, (byte)keyCode); + if (index == '\n') { + pressAndRelease(NONE, HIDKeycodes.KEY_ENTER); + } else if (index == '\t') { + pressAndRelease(NONE, HIDKeycodes.KEY_TAB); + } else { + if (index > 127) { + index = 127; + } + keyCode = HIDKeycodes.getKeyCode(index); + if (keyCode > 128) { + keyCode -= 128; + pressAndRelease(HIDKeycodes.SHIFT_LEFT, (byte)keyCode); + } else { + pressAndRelease(NONE, (byte)keyCode); + } } } } + //modifier - see HIDKeycodes (CTRL_LEFT .. GUI_RIGHT) + //key0..key5 - see HIDKeycodes + //note: keys will not be released until next report is sent! public static void customReport(byte modifier, byte key0, byte key1, byte key2, byte key3, byte key4, byte key5) { HIDTransaction t = new HIDTransaction(); t.addReport(new KeyboardReport(modifier, key0, key1, key2, key3, key4, key5)); InputStickHID.addKeyboardTransaction(t); } - /*public static void customReport(byte[] report) { - HIDTransaction t = new HIDTransaction(); - t.addReport(report); - InputStickHID.addKeyboardTransaction(t); - }*/ - public static String ledsToString(byte leds) { String result = "None"; boolean first = true; diff --git a/src/java/InputStickAPI/src/com/inputstick/api/basic/InputStickMouse.java b/src/java/InputStickAPI/src/com/inputstick/api/basic/InputStickMouse.java index 19924a8f..3f06b52a 100644 --- a/src/java/InputStickAPI/src/com/inputstick/api/basic/InputStickMouse.java +++ b/src/java/InputStickAPI/src/com/inputstick/api/basic/InputStickMouse.java @@ -37,6 +37,7 @@ public class InputStickMouse { return mReportProtocol; } + //clicks button (BUTTON_LEFT..BUTTON_MIDDLE) n times. public static void click(byte button, int n) { HIDTransaction t = new HIDTransaction(); t.addReport(new MouseReport()); //release @@ -47,18 +48,21 @@ public class InputStickMouse { InputStickHID.addMouseTransaction(t); } + //moves mouse pointer by x,y public static void move(byte x, byte y) { HIDTransaction t = new HIDTransaction(); t.addReport(new MouseReport(NONE, x, y, NONE)); InputStickHID.addMouseTransaction(t); } + //moves scroll wheel by "wheel" public static void scroll(byte wheel) { HIDTransaction t = new HIDTransaction(); t.addReport(new MouseReport(NONE, NONE, NONE, wheel)); InputStickHID.addMouseTransaction(t); } + //sends custom mouse report (buttons will remain in pressed state until released by next report) public static void customReport(byte buttons, byte x, byte y, byte wheel) { HIDTransaction t = new HIDTransaction(); t.addReport(new MouseReport(buttons, x, y, wheel)); diff --git a/src/java/InputStickAPI/src/com/inputstick/api/bluetooth/BT20Connection.java b/src/java/InputStickAPI/src/com/inputstick/api/bluetooth/BT20Connection.java new file mode 100644 index 00000000..2191340c --- /dev/null +++ b/src/java/InputStickAPI/src/com/inputstick/api/bluetooth/BT20Connection.java @@ -0,0 +1,204 @@ +package com.inputstick.api.bluetooth; + +import java.io.IOException; +import java.io.InputStream; +import java.io.OutputStream; +import java.lang.reflect.Method; +import java.util.UUID; + +import android.app.Application; +import android.bluetooth.BluetoothAdapter; +import android.bluetooth.BluetoothDevice; +import android.bluetooth.BluetoothSocket; + +import com.inputstick.api.InputStickError; +import com.inputstick.api.Util; + +public class BT20Connection extends BTConnection { + + private static final UUID MY_UUID = UUID.fromString("00001101-0000-1000-8000-00805F9B34FB"); //SPP + + private final BluetoothAdapter mAdapter; + + private ConnectThread mConnectThread; + private ConnectedThread mConnectedThread; + + + public BT20Connection(Application app, BTService btService, String mac, boolean reflections) { + super(app, btService, mac, reflections); + mAdapter = BluetoothAdapter.getDefaultAdapter(); + } + + @Override + public void connect() { + if (mConnectThread != null) { + mConnectThread.cancel(); + mConnectThread = null; + } + if (mConnectedThread != null) { + mConnectedThread.cancel(); + mConnectedThread = null; + } + final BluetoothDevice device = mAdapter.getRemoteDevice(mMac); + if (device != null) { + mConnectThread = new ConnectThread(device, mReflections); + mConnectThread.start(); + } else { + mBTservice.connectionFailed(false, InputStickError.ERROR_BLUETOOTH_NO_REMOTE_DEVICE); + } + } + + @Override + public void disconnect() { + cancelThreads(); + } + + @Override + public void write(byte[] out) { + mConnectedThread.write(out); + } + + + + + + //################################ + + private synchronized void cancelThreads() { + if (mConnectThread != null) { + mConnectThread.cancel(); + mConnectThread = null; + } + if (mConnectedThread != null) { + mConnectedThread.cancel(); + mConnectedThread = null; + } + } + + + private class ConnectThread extends Thread { + + private final BluetoothSocket mmSocket; + //private final BluetoothDevice mmDevice; + + public ConnectThread(BluetoothDevice device, boolean useReflection) { + //mmDevice = device; + BluetoothSocket tmp = null; + + try { + if (useReflection) { + Method m = device.getClass().getMethod("createRfcommSocket", new Class[] {int.class}); + tmp = (BluetoothSocket) m.invoke(device, 1); + } else { + tmp = device.createRfcommSocketToServiceRecord(MY_UUID); + } + + } catch (IOException e) { + Util.log("Socket create() failed"); + } catch (Exception e) { + Util.log("Socket create() REFLECTION failed"); + e.printStackTrace(); + } + mmSocket = tmp; + } + + public void run() { + Util.log("BEGIN mConnectThread"); + + mAdapter.cancelDiscovery(); //else it will slow down connection + + try { + mmSocket.connect(); + } catch (IOException e) { + try { + mmSocket.close(); + } catch (IOException e2) { + Util.log("unable to close() socket during connection failure"); + } + mBTservice.connectionFailed(true, 0); + return; + } + + //synchronized (BTService.this) { + mConnectThread = null; //TODO + //} + + //connected(mmSocket, mmDevice); : + cancelThreads(); + //receiver + + // Start the thread to manage the connection and perform transmissions + mConnectedThread = new ConnectedThread(mmSocket); + mConnectedThread.start(); + + mBTservice.connectedEstablished(); + } + + public void cancel() { + try { + mmSocket.close(); + } catch (IOException e) { + Util.log("close() of connect socket failed"); + } + } + } + + + + private class ConnectedThread extends Thread { + + private final BluetoothSocket mmSocket; + private final InputStream mmInStream; + private final OutputStream mmOutStream; + + public ConnectedThread(BluetoothSocket socket) { + Util.log("create ConnectedThread"); + mmSocket = socket; + InputStream tmpIn = null; + OutputStream tmpOut = null; + + try { + tmpIn = socket.getInputStream(); + tmpOut = socket.getOutputStream(); + } catch (IOException e) { + Util.log("temp sockets not created"); + } + + mmInStream = tmpIn; + mmOutStream = tmpOut; + } + + + public void run() { + Util.log("BEGIN mConnectedThread"); + int rxTmp; + while (true) { + try { + rxTmp = mmInStream.read(); + mBTservice.onByteRx(rxTmp); + } catch (IOException e) { + mBTservice.connectionFailed(false, InputStickError.ERROR_BLUETOOTH_CONNECTION_LOST); + break; + } + } + } + + public void write(byte[] buffer) { + try { + mmOutStream.write(buffer); + mmOutStream.flush(); + } catch (IOException e) { + Util.log("write() exception"); + } + } + + public void cancel() { + try { + mmSocket.close(); + } catch (IOException e) { + Util.log("socket close() exception"); + } + } + } + +} diff --git a/src/java/InputStickAPI/src/com/inputstick/api/bluetooth/BT40Connection.java b/src/java/InputStickAPI/src/com/inputstick/api/bluetooth/BT40Connection.java new file mode 100644 index 00000000..d15ac9c6 --- /dev/null +++ b/src/java/InputStickAPI/src/com/inputstick/api/bluetooth/BT40Connection.java @@ -0,0 +1,286 @@ +package com.inputstick.api.bluetooth; + +import java.util.List; +import java.util.Timer; +import java.util.TimerTask; +import java.util.UUID; +import java.util.Vector; + +import android.annotation.SuppressLint; +import android.app.Application; +import android.bluetooth.BluetoothAdapter; +import android.bluetooth.BluetoothDevice; +import android.bluetooth.BluetoothGatt; +import android.bluetooth.BluetoothGattCallback; +import android.bluetooth.BluetoothGattCharacteristic; +import android.bluetooth.BluetoothGattDescriptor; +import android.bluetooth.BluetoothGattService; +import android.bluetooth.BluetoothManager; +import android.bluetooth.BluetoothProfile; +import android.content.Context; + +import com.inputstick.api.InputStickError; +import com.inputstick.api.Util; + +@SuppressLint("NewApi") +public class BT40Connection extends BTConnection { + + private static String MOD_CHARACTERISTIC_CONFIG = "00002902-0000-1000-8000-00805f9b34fb"; + private static String MOD_CONF = "0000ffe0-0000-1000-8000-00805f9b34fb"; + private static String MOD_RX_TX = "0000ffe1-0000-1000-8000-00805f9b34fb"; + private final static UUID UUID_HM_RX_TX = UUID.fromString(MOD_RX_TX); + + private BluetoothManager mBluetoothManager; + private BluetoothAdapter mBluetoothAdapter; + private BluetoothGatt mBluetoothGatt; + private BluetoothGattCharacteristic characteristicTX; + private BluetoothGattCharacteristic characteristicRX; + + private static final int REFRESH_INTERVAL = 10; + private Timer t1; + private Vector txBuffer; + private boolean canSend; + + + public BT40Connection(Application app, BTService btService, String mac, boolean reflections) { + super(app, btService, mac, reflections); + mBluetoothManager = (BluetoothManager) (mCtx.getSystemService(Context.BLUETOOTH_SERVICE)); + mBluetoothAdapter = mBluetoothManager.getAdapter(); + + } + + @Override + public void connect() { + final BluetoothDevice device = mBluetoothAdapter.getRemoteDevice(mMac); + if (device != null) { + mBluetoothGatt = device.connectGatt(mCtx, false, mGattCallback); + } else { + mBTservice.connectionFailed(false, InputStickError.ERROR_BLUETOOTH_NO_REMOTE_DEVICE); + } + } + + @Override + public void disconnect() { + txBuffer = null; + try { + if (t1 != null) { + t1.cancel(); + t1 = null; + } + } catch (Exception e) { + + } + try { + if (mBluetoothGatt != null) { + mBluetoothGatt.close(); + mBluetoothGatt.disconnect(); + mBluetoothGatt = null; + } + } catch (Exception e) { + + } + } + + + + @Override + public void write(byte[] out) { + byte[] tmp; + int offset = 0; + + //SPECIAL CASES for flashing utility + if (Util.flashingToolMode) { + if (out.length == 1) { + txBuffer.add(out); + return; + } + if (out.length == 1026) { + tmp = new byte[2]; + tmp[0] = out[0]; + tmp[1] = out[1]; + txBuffer.add(tmp); + offset = 2; + for (int i = 0; i < 64; i++) { + tmp = new byte[16]; + System.arraycopy(out, offset, tmp, 0, 16); + offset += 16; + txBuffer.add(tmp); + } + return; + } + } + + if (out.length == 2) { + addHeader(out); + } else { + Util.log("ADDING: " + out.length); + int loops = out.length / 16; + offset = 0; + for (int i = 0; i < loops; i++) { + tmp = new byte[16]; + System.arraycopy(out, offset, tmp, 0, 16); + offset += 16; + addData16(tmp); + } + + } + } + + + private byte h0; + private byte h1; + private boolean header; + + private synchronized void addHeader(byte[] data) { + h0 = data[0]; + h1 = data[1]; + header = true; + } + + private synchronized void addData16(byte[] data) { + byte[] tmp; + int offset = 0; + if (txBuffer != null) { + if (header) { + header = false; + + tmp = new byte[18]; + offset = 2; + + tmp[0] = h0; + tmp[1] = h1; + } else { + tmp = new byte[16]; + offset = 0; + } + System.arraycopy(data, 0, tmp, offset, 16); + txBuffer.add(tmp); + } + } + + private synchronized byte[] getData() { + if (txBuffer != null) { + if (!txBuffer.isEmpty()) { + byte[] data = txBuffer.firstElement(); + txBuffer.removeElementAt(0); + return data; + } + } + return null; + } + + private synchronized void sendNext() { + if (canSend) { + byte[] data = getData(); + if (data != null) { + canSend = false; + characteristicTX.setValue(data); + mBluetoothGatt.writeCharacteristic(characteristicTX); + } + } + } + + + + private final BluetoothGattCallback mGattCallback = new BluetoothGattCallback() { + + @Override + public void onConnectionStateChange(BluetoothGatt gatt, int status, int newState) { + if (newState == BluetoothProfile.STATE_CONNECTED) { + Util.log("Connected to GATT server."); + Util.log("Attempting to start service discovery:" + mBluetoothGatt.discoverServices()); + } else if (newState == BluetoothProfile.STATE_DISCONNECTED) { + Util.log("Disconnected from GATT server."); + mBTservice.connectionFailed(false, InputStickError.ERROR_BLUETOOTH_CONNECTION_LOST); + } + } + + @Override + public void onServicesDiscovered(BluetoothGatt gatt, int status) { + if (status == BluetoothGatt.GATT_SUCCESS) { + Util.log("GATT onServicesDiscovered"); + List gattServices = null; + boolean serviceDiscovered = false; + if (mBluetoothGatt != null) { + gattServices = mBluetoothGatt.getServices(); + } + if (gattServices != null) { + String uuid = null; + characteristicRX = null; + for (BluetoothGattService gattService : gattServices) { + uuid = gattService.getUuid().toString(); + if (MOD_CONF.equals(uuid)) { + Util.log("BT LE - Serial Service Discovered"); + + characteristicTX = gattService.getCharacteristic(UUID_HM_RX_TX); + characteristicRX = gattService.getCharacteristic(UUID_HM_RX_TX); + if (characteristicRX == null) { + mBTservice.connectionFailed(false, InputStickError.ERROR_BLUETOOTH_BT40_NO_SPP_SERVICE); + } else { + serviceDiscovered = true; + } + } + } + } + if (serviceDiscovered) { + //enable notifications + mBluetoothGatt.setCharacteristicNotification(characteristicRX, true); + if (UUID_HM_RX_TX.equals(characteristicRX.getUuid())) { + Util.log("RXTX SERVICE DISCOVERED!"); + BluetoothGattDescriptor descriptor = characteristicRX.getDescriptor(UUID.fromString(MOD_CHARACTERISTIC_CONFIG)); + descriptor.setValue(BluetoothGattDescriptor.ENABLE_NOTIFICATION_VALUE); + mBluetoothGatt.writeDescriptor(descriptor); + + txBuffer = new Vector(); + t1 = new Timer(); + t1.schedule(new TimerTask() { + @Override + public void run() { + sendNext(); + } + }, REFRESH_INTERVAL, REFRESH_INTERVAL); + + canSend = true; + sendNext(); + + mBTservice.connectedEstablished(); + } else { + mBTservice.connectionFailed(false, InputStickError.ERROR_BLUETOOTH_BT40_NO_SPP_SERVICE); + } + } else { + Util.log("BT LE - Serial Service NOT FOUND"); + mBTservice.connectionFailed(false, InputStickError.ERROR_BLUETOOTH_BT40_NO_SPP_SERVICE); + } + } else { + Util.log("onServicesDiscovered received: " + status); + } + } + + @Override + public void onCharacteristicRead(BluetoothGatt gatt, BluetoothGattCharacteristic characteristic, int status) { + if (status == BluetoothGatt.GATT_SUCCESS) { + } + } + + @Override + public void onCharacteristicChanged(BluetoothGatt gatt, BluetoothGattCharacteristic characteristic) { + byte b[] = characteristic.getValue(); + if (b != null) { + for (int i = 0; i < b.length; i++) { + mBTservice.onByteRx(b[i]); + } + } //TODO error code? + } + + @Override + public void onCharacteristicWrite(BluetoothGatt gatt, BluetoothGattCharacteristic characteristic, int status) { + Util.log("GATT onCharacteristicWrite"); + if (status == BluetoothGatt.GATT_SUCCESS) { + canSend = true; + sendNext(); + } //TODO error code? + } + + }; + +} diff --git a/src/java/InputStickAPI/src/com/inputstick/api/bluetooth/BTConnection.java b/src/java/InputStickAPI/src/com/inputstick/api/bluetooth/BTConnection.java new file mode 100644 index 00000000..a23e1e38 --- /dev/null +++ b/src/java/InputStickAPI/src/com/inputstick/api/bluetooth/BTConnection.java @@ -0,0 +1,26 @@ +package com.inputstick.api.bluetooth; + +import android.app.Application; +import android.content.Context; + + +public abstract class BTConnection { + + protected final Application mApp; + protected final Context mCtx; + protected final String mMac; + protected boolean mReflections; + protected final BTService mBTservice; + + public BTConnection(Application app, BTService btService, String mac, boolean reflections) { + mApp = app; + mCtx = app.getApplicationContext(); + mMac = mac; + mReflections = reflections; + mBTservice = btService; + } + + public abstract void connect(); + public abstract void disconnect(); + public abstract void write(byte[] out); +} diff --git a/src/java/InputStickAPI/src/com/inputstick/api/bluetooth/BTService.java b/src/java/InputStickAPI/src/com/inputstick/api/bluetooth/BTService.java index 4d034625..1d6bbb0f 100644 --- a/src/java/InputStickAPI/src/com/inputstick/api/bluetooth/BTService.java +++ b/src/java/InputStickAPI/src/com/inputstick/api/bluetooth/BTService.java @@ -1,15 +1,7 @@ package com.inputstick.api.bluetooth; -import java.io.IOException; -import java.io.InputStream; -import java.io.OutputStream; -import java.lang.reflect.Method; -import java.util.UUID; - import android.app.Application; import android.bluetooth.BluetoothAdapter; -import android.bluetooth.BluetoothDevice; -import android.bluetooth.BluetoothSocket; import android.content.BroadcastReceiver; import android.content.Context; import android.content.Intent; @@ -17,9 +9,8 @@ import android.content.IntentFilter; import android.os.Handler; import android.os.Message; -import com.inputstick.api.Packet; -import com.inputstick.api.Util; import com.inputstick.api.InputStickError; +import com.inputstick.api.Util; public class BTService { @@ -30,50 +21,29 @@ public class BTService { public static final int EVENT_CONNECTED = 2; public static final int EVENT_CANCELLED = 3; public static final int EVENT_ERROR = 4; - - - private static final UUID MY_UUID = UUID.fromString("00001101-0000-1000-8000-00805F9B34FB"); //SPP - - //private final String dTag = "BTService"; - private final BluetoothAdapter mAdapter; private final Handler mHandler; - private ConnectThread mConnectThread; - private ConnectedThread mConnectedThread; private int mLastEvent; private String mMac; - private boolean mReflection; private final Application mApp; - private final Context mCtx; + private final Context mCtx; private boolean mUseReflection; - private int mConnectTimeout; - - private boolean turnBluetoothOn; - private boolean receiverRegistered; + private int mConnectTimeout; + private long timeout; private int retryCnt; private boolean disconnecting; private boolean connected; - //================================================================ - private static final int RX_TIMEOUT = 3000; - - private long lastRxTime; - private int rxState; - private int rxPos; - private int rxLength; - private byte[] rxData; - private int rxWdgCnt; - - private static final int RX_TAG = 0; - private static final int RX_LENGTH = 1; - private static final int RX_DATA = 2; - + private PacketReader mPacketReader; + private BTConnection mBTConnection; + private boolean turnBluetoothOn; + private boolean receiverRegistered; private final BroadcastReceiver mReceiver = new BroadcastReceiver() { @Override public void onReceive(Context context, Intent intent) { @@ -82,22 +52,20 @@ public class BTService { final int state = intent.getIntExtra(BluetoothAdapter.EXTRA_STATE, BluetoothAdapter.ERROR); if ((state == BluetoothAdapter.STATE_ON) && (turnBluetoothOn)) { turnBluetoothOn = false; - doConnect(false); + connect(false); } } } - }; + }; - - public BTService(Application app, Handler handler) { - mAdapter = BluetoothAdapter.getDefaultAdapter(); + public BTService(Application app, Handler handler) { mLastEvent = EVENT_NONE; mHandler = handler; mApp = app; mCtx = app.getApplicationContext(); - mConnectTimeout = DEFAULT_CONNECT_TIMEOUT; //30s - default value + mConnectTimeout = DEFAULT_CONNECT_TIMEOUT; } public void setConnectTimeout(int timeout) { @@ -109,7 +77,7 @@ public class BTService { } - private synchronized void event(int event, int arg1) { + protected synchronized void event(int event, int arg1) { Util.log("event() " + mLastEvent + " -> " + event); mLastEvent = event; Message msg = Message.obtain(null, mLastEvent, arg1, 0); @@ -120,29 +88,7 @@ public class BTService { return mLastEvent; } - - - private void enableBluetooth(boolean doNotAsk) { - if (mApp != null) { - turnBluetoothOn = true; - - if ( !receiverRegistered) { - IntentFilter filter = new IntentFilter(BluetoothAdapter.ACTION_STATE_CHANGED); - mCtx.registerReceiver(mReceiver, filter); - receiverRegistered = true; - } - - if (doNotAsk) { - BluetoothAdapter.getDefaultAdapter().enable(); - } else { - Intent enableBtIntent = new Intent(BluetoothAdapter.ACTION_REQUEST_ENABLE); - enableBtIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); - mApp.startActivity(enableBtIntent); - } - } - } - - private void doConnect(boolean reconnecting) { + private void connect(boolean reconnecting) { if (reconnecting) { retryCnt++; } else { @@ -150,306 +96,130 @@ public class BTService { timeout = System.currentTimeMillis() + mConnectTimeout; } - if (mConnectThread != null) { - mConnectThread.cancel(); - mConnectThread = null; - } - if (mConnectedThread != null) { - mConnectedThread.cancel(); - mConnectedThread = null; - } - - mConnectThread = new ConnectThread(mAdapter.getRemoteDevice(mMac), mReflection); - mConnectThread.start(); + mBTConnection.connect(); } public synchronized void connect(String mac) { connect(mac, false); - } + } public synchronized void connect(String mac, boolean doNotAsk) { - Util.log("connect to: " + mac + " REFLECTION: " + mUseReflection); - disconnecting = false; - connected = false; - mMac = mac; - - if (BluetoothAdapter.checkBluetoothAddress(mac)) { - BluetoothAdapter mBluetoothAdapter = BluetoothAdapter.getDefaultAdapter(); - if (mBluetoothAdapter == null) { - event(EVENT_ERROR, InputStickError.ERROR_BLUETOOTH_NOT_SUPPORTED); - } else { - if (mBluetoothAdapter.isEnabled()) { - doConnect(false); - } else { - enableBluetooth(doNotAsk); + connect(mac, doNotAsk, false); + } + + public synchronized void connect(String mac, boolean doNotAsk, boolean bt40) { + try { + Util.log("connect to: " + mac + " REFLECTION: " + mUseReflection); + disconnecting = false; + connected = false; + mMac = mac; + if (BluetoothAdapter.checkBluetoothAddress(mac)) { + BluetoothAdapter mBluetoothAdapter = BluetoothAdapter.getDefaultAdapter(); + if (mBluetoothAdapter == null) { + event(BTService.EVENT_ERROR, InputStickError.ERROR_BLUETOOTH_NOT_SUPPORTED); + } else { + if (bt40) { + mBTConnection = new BT40Connection(mApp, this, mMac, mUseReflection); + } else { + mBTConnection = new BT20Connection(mApp, this, mMac, mUseReflection); + } + + if (mBluetoothAdapter.isEnabled()) { + connect(false); + } else { + //enableBluetooth(doNotAsk); : + if (mApp != null) { + turnBluetoothOn = true; + + if ( !receiverRegistered) { + IntentFilter filter = new IntentFilter(BluetoothAdapter.ACTION_STATE_CHANGED); + mCtx.registerReceiver(mReceiver, filter); + receiverRegistered = true; + } + + if (doNotAsk) { + BluetoothAdapter.getDefaultAdapter().enable(); + } else { + Intent enableBtIntent = new Intent(BluetoothAdapter.ACTION_REQUEST_ENABLE); + enableBtIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); + mApp.startActivity(enableBtIntent); + } + } + } } - } - } else { - event(EVENT_ERROR, InputStickError.ERROR_BLUETOOTH_INVALID_MAC); + } else { + event(BTService.EVENT_ERROR, InputStickError.ERROR_BLUETOOTH_INVALID_MAC); + } + } catch (NoClassDefFoundError e) { + event(BTService.EVENT_ERROR, InputStickError.ERROR_BLUETOOTH_BT40_NOT_SUPPRTED); } - } + } public synchronized void disconnect() { Util.log("disconnect"); disconnecting = true; - cancelThreads(); + if (mBTConnection != null) { + mBTConnection.disconnect(); + } event(EVENT_CANCELLED, 0); } public synchronized void write(byte[] out) { - // Create temporary object - /* - ConnectedThread r; - // Synchronize a copy of the ConnectedThread - synchronized (this) { - r = mConnectedThread; - } - // Perform the write unsynchronized if (connected) { - r.write(out); - }*/ - if (connected) { - mConnectedThread.write(out); + mBTConnection.write(out); } } - private synchronized void cancelThreads() { - if (mConnectThread != null) { - mConnectThread.cancel(); - mConnectThread = null; - } - if (mConnectedThread != null) { - mConnectedThread.cancel(); - mConnectedThread = null; - } - } + - private synchronized void connected(BluetoothSocket socket, BluetoothDevice device) { + protected synchronized void connectedEstablished() { + removeReceiver(); //TODO + mPacketReader = new PacketReader(this, mHandler); timeout = 0; - cancelThreads(); - if (receiverRegistered) { - mCtx.unregisterReceiver(mReceiver); - receiverRegistered = false; - } - - // Start the thread to manage the connection and perform transmissions - mConnectedThread = new ConnectedThread(socket); - mConnectedThread.start(); - - connected = true; - event(EVENT_CONNECTED, 0); + connected = true; + event(EVENT_CONNECTED, 0); } - private void connectionFailed() { + protected void connectionFailed(boolean canRetry, int errorCode) { + removeReceiver(); //TODO connected = false; if (disconnecting) { disconnecting = false; } else { - if ((timeout > 0) && (System.currentTimeMillis() < timeout)) { - Util.log("RETRY: "+retryCnt + " time left: " + (timeout - System.currentTimeMillis())); - doConnect(true); - } else { - event(EVENT_ERROR, InputStickError.ERROR_BLUETOOTH_CONNECTION_FAILED); - } + if (canRetry) { + if ((timeout > 0) && (System.currentTimeMillis() < timeout)) { + Util.log("RETRY: "+retryCnt + " time left: " + (timeout - System.currentTimeMillis())); + connect(true); + } else { + event(EVENT_ERROR, InputStickError.ERROR_BLUETOOTH_CONNECTION_FAILED); + } + } else { + event(EVENT_ERROR, errorCode); + } } - } - - private void connectionLost() { - connected = false; - if (disconnecting) { - disconnecting = false; - } else { - event(EVENT_ERROR, InputStickError.ERROR_BLUETOOTH_CONNECTION_LOST); - } - } + } + protected void onByteRx(int rxByte) { + mPacketReader.rxByte(rxByte); + } + private void removeReceiver() { + if (receiverRegistered) { + mCtx.unregisterReceiver(mReceiver); + receiverRegistered = false; + } + } + - - - - - - - - - private class ConnectThread extends Thread { - - private final BluetoothSocket mmSocket; - private final BluetoothDevice mmDevice; - - public ConnectThread(BluetoothDevice device, boolean useReflection) { - mmDevice = device; - BluetoothSocket tmp = null; - - try { - if (useReflection) { - Method m = device.getClass().getMethod("createRfcommSocket", new Class[] {int.class}); - tmp = (BluetoothSocket) m.invoke(device, 1); - } else { - tmp = device.createRfcommSocketToServiceRecord(MY_UUID); - } - - } catch (IOException e) { - Util.log("Socket create() failed"); - } catch (Exception e) { - Util.log("Socket create() REFLECTION failed"); - e.printStackTrace(); - } - mmSocket = tmp; - } - - public void run() { - Util.log("BEGIN mConnectThread"); - - mAdapter.cancelDiscovery(); //else it will slow down connection - - try { - mmSocket.connect(); - } catch (IOException e) { - try { - mmSocket.close(); - } catch (IOException e2) { - Util.log("unable to close() socket during connection failure"); - } - connectionFailed(); - return; - } - - // Reset the ConnectThread - synchronized (BTService.this) { - mConnectThread = null; - } - - connected(mmSocket, mmDevice); - } - - public void cancel() { - try { - mmSocket.close(); - } catch (IOException e) { - Util.log("close() of connect socket failed"); - } - } + public static boolean isBT40Supported() { + return (android.os.Build.VERSION.SDK_INT < android.os.Build.VERSION_CODES.JELLY_BEAN_MR2); } - - - private class ConnectedThread extends Thread { - - private final BluetoothSocket mmSocket; - private final InputStream mmInStream; - private final OutputStream mmOutStream; - - public ConnectedThread(BluetoothSocket socket) { - Util.log("create ConnectedThread"); - mmSocket = socket; - InputStream tmpIn = null; - OutputStream tmpOut = null; - - try { - tmpIn = socket.getInputStream(); - tmpOut = socket.getOutputStream(); - } catch (IOException e) { - Util.log("temp sockets not created"); - } - - mmInStream = tmpIn; - mmOutStream = tmpOut; - } - - - private void rxByte(byte b) { - long time = System.currentTimeMillis(); - if (time > lastRxTime + RX_TIMEOUT) { - rxState = RX_TAG; - } - - - switch (rxState) { - case RX_TAG: - if (b == Packet.START_TAG) { - rxState = RX_LENGTH; - } else { - Util.log("Unexpected RX byte" + b); - if (b == 0xAF) { - rxWdgCnt++; - } - if (rxWdgCnt > 1024) { - rxWdgCnt = 0; - event(EVENT_ERROR, InputStickError.ERROR_HARDWARE_WDG_RESET); - } - } - break; - case RX_LENGTH: - rxLength = b; - rxLength &= 0x3F; - rxLength *= 16; - rxLength += 2; - rxPos = 2; - - rxData = new byte[rxLength]; - rxData[0] = Packet.START_TAG; - rxData[1] = (byte)b; - - rxState = RX_DATA; - break; - case RX_DATA: - if (rxPos < rxLength) { - rxData[rxPos] = b; - rxPos++; - if (rxPos == rxLength) { - //done! - mHandler.obtainMessage(EVENT_DATA, 0, 0, rxData).sendToTarget(); - rxState = RX_TAG; - } - } else { - //buffer overrun! - rxState = RX_TAG; - } - break; - } - - lastRxTime = time; - } - - public void run() { - Util.log("BEGIN mConnectedThread"); - int rxTmp; - while (true) { - try { - rxTmp = mmInStream.read(); - rxByte((byte)rxTmp); - } catch (IOException e) { - connectionLost(); - break; - } - } - } - - public void write(byte[] buffer) { - try { - mmOutStream.write(buffer); - mmOutStream.flush(); - } catch (IOException e) { - Util.log("write() exception"); - } - } - - public void cancel() { - try { - mmSocket.close(); - } catch (IOException e) { - Util.log("socket close() exception"); - } - } - } - } diff --git a/src/java/InputStickAPI/src/com/inputstick/api/bluetooth/PacketReader.java b/src/java/InputStickAPI/src/com/inputstick/api/bluetooth/PacketReader.java new file mode 100644 index 00000000..0ec07f1d --- /dev/null +++ b/src/java/InputStickAPI/src/com/inputstick/api/bluetooth/PacketReader.java @@ -0,0 +1,88 @@ +package com.inputstick.api.bluetooth; + +import android.os.Handler; + +import com.inputstick.api.InputStickError; +import com.inputstick.api.Packet; +import com.inputstick.api.Util; + +public class PacketReader { + + private static final int RX_TIMEOUT = 3000; + + private static final int RX_TAG = 0; + private static final int RX_LENGTH = 1; + private static final int RX_DATA = 2; + + private long lastRxTime; + private int rxState; + private int rxPos; + private int rxLength; + private byte[] rxData; + private int rxWdgCnt; + + private final BTService mBTService; + private final Handler mHandler; + + public PacketReader(BTService btService, Handler handler) { + mBTService = btService; + mHandler = handler; + } + + + public void rxByte(int rxByte) { + byte b = (byte)rxByte; + long time = System.currentTimeMillis(); + if (time > lastRxTime + RX_TIMEOUT) { + rxState = RX_TAG; + } + + + switch (rxState) { + case RX_TAG: + if (b == Packet.START_TAG) { + rxState = RX_LENGTH; + } else { + Util.log("Unexpected RX byte" + b); + if (b == 0xAF) { + rxWdgCnt++; + } + if (rxWdgCnt > 1024) { + rxWdgCnt = 0; + mBTService.event(BTService.EVENT_ERROR, InputStickError.ERROR_HARDWARE_WDG_RESET); + } + } + break; + case RX_LENGTH: + rxLength = b; + rxLength &= 0x3F; + rxLength *= 16; + rxLength += 2; + rxPos = 2; + + rxData = new byte[rxLength]; + rxData[0] = Packet.START_TAG; + rxData[1] = (byte)b; + + rxState = RX_DATA; + break; + case RX_DATA: + if (rxPos < rxLength) { + rxData[rxPos] = b; + rxPos++; + if (rxPos == rxLength) { + //done! + mHandler.obtainMessage(BTService.EVENT_DATA, 0, 0, rxData).sendToTarget(); + rxState = RX_TAG; + } + } else { + //buffer overrun! + rxState = RX_TAG; + } + break; + } + + lastRxTime = time; + } + +} diff --git a/src/java/InputStickAPI/src/com/inputstick/api/hid/ConsumerReport.java b/src/java/InputStickAPI/src/com/inputstick/api/hid/ConsumerReport.java index 859da27e..b13ae68b 100644 --- a/src/java/InputStickAPI/src/com/inputstick/api/hid/ConsumerReport.java +++ b/src/java/InputStickAPI/src/com/inputstick/api/hid/ConsumerReport.java @@ -4,13 +4,24 @@ import com.inputstick.api.Util; public class ConsumerReport extends HIDReport { + public static final byte CONSUMER_REPORT_ID = 1; + public static final byte SYSTEM_REPORT_ID = 2; + public static final byte GAMEPAD_REPORT_ID = 3; + public static final int SIZE = 3; private byte[] data; + public ConsumerReport(byte id, byte b1, byte b2) { + data = new byte[SIZE]; + data[0] = id; + data[1] = b1; + data[2] = b2; + } + public ConsumerReport(int usage) { data = new byte[SIZE]; - data[0] = 1; + data[0] = CONSUMER_REPORT_ID; data[1] = Util.getLSB(usage); data[2] = Util.getMSB(usage); } @@ -26,5 +37,7 @@ public class ConsumerReport extends HIDReport { public int getBytesCount() { return SIZE; } + + } diff --git a/src/java/InputStickAPI/src/com/inputstick/api/hid/GamepadReport.java b/src/java/InputStickAPI/src/com/inputstick/api/hid/GamepadReport.java new file mode 100644 index 00000000..242d4d9d --- /dev/null +++ b/src/java/InputStickAPI/src/com/inputstick/api/hid/GamepadReport.java @@ -0,0 +1,32 @@ +package com.inputstick.api.hid; + +public class GamepadReport extends HIDReport { + + public static final int SIZE = 7; + + private byte[] data; + + public GamepadReport(byte b1, byte b2, byte x, byte y, byte z, byte rx) { + data = new byte[SIZE]; + data[0] = 3; + data[1] = b1; + data[2] = b2; + data[3] = x; + data[4] = y; + data[5] = z; + data[6] = rx; + } + + public GamepadReport() { + this((byte)0, (byte)0, (byte)0, (byte)0, (byte)0, (byte)0); + } + + public byte[] getBytes() { + return data; + } + + public int getBytesCount() { + return SIZE; + } + +} diff --git a/src/java/InputStickAPI/src/com/inputstick/api/hid/HIDKeycodes.java b/src/java/InputStickAPI/src/com/inputstick/api/hid/HIDKeycodes.java index 7edec591..3decb11e 100644 --- a/src/java/InputStickAPI/src/com/inputstick/api/hid/HIDKeycodes.java +++ b/src/java/InputStickAPI/src/com/inputstick/api/hid/HIDKeycodes.java @@ -4,68 +4,68 @@ import android.util.SparseArray; public class HIDKeycodes { - public static final byte NONE = 0x00; + public static final byte NONE = 0x00; - public static final byte CTRL_LEFT = 0x01; - public static final byte SHIFT_LEFT = 0x02; - public static final byte ALT_LEFT = 0x04; - public static final byte GUI_LEFT = 0x08; - public static final byte CTRL_RIGHT = 0x10; - public static final byte SHIFT_RIGHT = 0x20; - public static final byte ALT_RIGHT = 0x40; - public static final byte GUI_RIGHT = (byte)0x80; + public static final byte CTRL_LEFT = 0x01; + public static final byte SHIFT_LEFT = 0x02; + public static final byte ALT_LEFT = 0x04; + public static final byte GUI_LEFT = 0x08; + public static final byte CTRL_RIGHT = 0x10; + public static final byte SHIFT_RIGHT = 0x20; + public static final byte ALT_RIGHT = 0x40; + public static final byte GUI_RIGHT = (byte)0x80; - public static final byte KEY_ENTER = 0x28; - public static final byte KEY_ESCAPE = 0x29; - public static final byte KEY_BACKSPACE = 0x2A; - public static final byte KEY_TAB = 0x2B; - public static final byte KEY_SPACEBAR = 0x2C; + public static final byte KEY_ENTER = 0x28; + public static final byte KEY_ESCAPE = 0x29; + public static final byte KEY_BACKSPACE = 0x2A; + public static final byte KEY_TAB = 0x2B; + public static final byte KEY_SPACEBAR = 0x2C; - public static final byte KEY_CAPS_LOCK = 0x39; + public static final byte KEY_CAPS_LOCK = 0x39; - public static final byte KEY_1 = 0x1E; - public static final byte KEY_2 = 0x1F; - public static final byte KEY_3 = 0x20; - public static final byte KEY_4 = 0x21; - public static final byte KEY_5 = 0x22; - public static final byte KEY_6 = 0x23; - public static final byte KEY_7 = 0x24; - public static final byte KEY_8 = 0x25; - public static final byte KEY_9 = 0x26; - public static final byte KEY_0 = 0x27; + public static final byte KEY_1 = 0x1E; + public static final byte KEY_2 = 0x1F; + public static final byte KEY_3 = 0x20; + public static final byte KEY_4 = 0x21; + public static final byte KEY_5 = 0x22; + public static final byte KEY_6 = 0x23; + public static final byte KEY_7 = 0x24; + public static final byte KEY_8 = 0x25; + public static final byte KEY_9 = 0x26; + public static final byte KEY_0 = 0x27; - public static final byte KEY_F1 = 0x3A; - public static final byte KEY_F2 = 0x3B; - public static final byte KEY_F3 = 0x3C; - public static final byte KEY_F4 = 0x3D; - public static final byte KEY_F5 = 0x3E; - public static final byte KEY_F6 = 0x3F; - public static final byte KEY_F7 = 0x40; - public static final byte KEY_F8 = 0x41; - public static final byte KEY_F9 = 0x42; - public static final byte KEY_F10 = 0x43; - public static final byte KEY_F11 = 0x44; - public static final byte KEY_F12 = 0x45; + public static final byte KEY_F1 = 0x3A; + public static final byte KEY_F2 = 0x3B; + public static final byte KEY_F3 = 0x3C; + public static final byte KEY_F4 = 0x3D; + public static final byte KEY_F5 = 0x3E; + public static final byte KEY_F6 = 0x3F; + public static final byte KEY_F7 = 0x40; + public static final byte KEY_F8 = 0x41; + public static final byte KEY_F9 = 0x42; + public static final byte KEY_F10 = 0x43; + public static final byte KEY_F11 = 0x44; + public static final byte KEY_F12 = 0x45; - public static final byte KEY_PRINT_SCREEN = 0x46; - public static final byte KEY_SCROLL_LOCK = 0x47; - public static final byte KEY_PASUE = 0x48; - public static final byte KEY_INSERT = 0x49; - public static final byte KEY_HOME = 0x4A; - public static final byte KEY_PAGE_UP = 0x4B; - public static final byte KEY_DELETE = 0x4C; - public static final byte KEY_END = 0x4D; - public static final byte KEY_PAGE_DOWN = 0x4E; + public static final byte KEY_PRINT_SCREEN = 0x46; + public static final byte KEY_SCROLL_LOCK = 0x47; + public static final byte KEY_PASUE = 0x48; + public static final byte KEY_INSERT = 0x49; + public static final byte KEY_HOME = 0x4A; + public static final byte KEY_PAGE_UP = 0x4B; + public static final byte KEY_DELETE = 0x4C; + public static final byte KEY_END = 0x4D; + public static final byte KEY_PAGE_DOWN = 0x4E; - public static final byte KEY_ARROW_RIGHT = 0x4F; - public static final byte KEY_ARROW_LEFT = 0x50; - public static final byte KEY_ARROW_DOWN = 0x51; - public static final byte KEY_ARROW_UP = 0x52; + public static final byte KEY_ARROW_RIGHT = 0x4F; + public static final byte KEY_ARROW_LEFT = 0x50; + public static final byte KEY_ARROW_DOWN = 0x51; + public static final byte KEY_ARROW_UP = 0x52; - public static final byte KEY_NUM_LOCK = 0x53; - public static final byte KEY_NUM_BACKSLASH = 0x54; + public static final byte KEY_NUM_LOCK = 0x53; + public static final byte KEY_NUM_SLASH = 0x54; public static final byte KEY_NUM_STAR = 0x55; public static final byte KEY_NUM_MINUS = 0x56; public static final byte KEY_NUM_PLUS = 0x57; @@ -198,7 +198,7 @@ public class HIDKeycodes { keyMap.put(KEY_ARROW_UP , "Up Arrow"); keyMap.put(KEY_NUM_LOCK , "NumLock"); - keyMap.put(KEY_NUM_BACKSLASH , "Num /"); + keyMap.put(KEY_NUM_SLASH , "Num /"); keyMap.put(KEY_NUM_STAR , "Num *"); keyMap.put(KEY_NUM_MINUS , "Num -"); keyMap.put(KEY_NUM_PLUS , "Num +"); diff --git a/src/java/InputStickAPI/src/com/inputstick/api/hid/HIDTransaction.java b/src/java/InputStickAPI/src/com/inputstick/api/hid/HIDTransaction.java index 3dd06973..214820e5 100644 --- a/src/java/InputStickAPI/src/com/inputstick/api/hid/HIDTransaction.java +++ b/src/java/InputStickAPI/src/com/inputstick/api/hid/HIDTransaction.java @@ -38,6 +38,10 @@ public class HIDTransaction { return report; } + public HIDReport getHIDReportAt(int pos) { + return reports.elementAt(pos); + } + public HIDTransaction split(int n) { HIDTransaction result = new HIDTransaction(); HIDReport report; diff --git a/src/java/InputStickAPI/src/com/inputstick/api/hid/HIDTransactionQueue.java b/src/java/InputStickAPI/src/com/inputstick/api/hid/HIDTransactionQueue.java index f6cb57d0..9d9ec7c3 100644 --- a/src/java/InputStickAPI/src/com/inputstick/api/hid/HIDTransactionQueue.java +++ b/src/java/InputStickAPI/src/com/inputstick/api/hid/HIDTransactionQueue.java @@ -25,7 +25,6 @@ public class HIDTransactionQueue { private int mInterfaceType; private boolean mustNotify; - private Vector mBufferEmptyListeners = new Vector(); private Timer t; private boolean timerCancelled; @@ -132,29 +131,17 @@ public class HIDTransactionQueue { return reports; } - public void addBufferEmptyListener(OnEmptyBufferListener listener) { - if (listener != null) { - if ( !mBufferEmptyListeners.contains(listener)) { - mBufferEmptyListeners.add(listener); - } - } - } - - public void removeBufferEmptyListener(OnEmptyBufferListener listener) { - if (listener != null) { - mBufferEmptyListeners.remove(listener); - } - } - private void notifyOnRemoteBufferEmpty() { - for (OnEmptyBufferListener listener : mBufferEmptyListeners) { + Vector listeners = InputStickHID.getBufferEmptyListeners(); + for (OnEmptyBufferListener listener : listeners) { listener.onRemoteBufferEmpty(mInterfaceType); } } private void notifyOnLocalBufferEmpty() { - for (OnEmptyBufferListener listener : mBufferEmptyListeners) { - listener.onRemoteBufferEmpty(mInterfaceType); + Vector listeners = InputStickHID.getBufferEmptyListeners(); + for (OnEmptyBufferListener listener : listeners) { + listener.onLocalBufferEmpty(mInterfaceType); } } diff --git a/src/java/InputStickAPI/src/com/inputstick/api/layout/DanishLayout.java b/src/java/InputStickAPI/src/com/inputstick/api/layout/DanishLayout.java new file mode 100644 index 00000000..ddebe3cd --- /dev/null +++ b/src/java/InputStickAPI/src/com/inputstick/api/layout/DanishLayout.java @@ -0,0 +1,218 @@ +package com.inputstick.api.layout; + +public class DanishLayout extends KeyboardLayout { + + public static final String LOCALE_NAME = "da-DK"; + + public static final int LUT[][] = { + /* 0 */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 1 */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 2 */ { 0 , (int)'1' , 0x0021 , -1 , -1 , -1 } , + /* 3 */ { 0 , (int)'2' , 0x0022 , -1 , 0x0040 , -1 } , + /* 4 */ { 0 , (int)'3' , 0x0023 , -1 , 0x00a3 , -1 } , + /* 5 */ { 0 , (int)'4' , 0x00a4 , -1 , 0x0024 , -1 } , + /* 6 */ { 0 , (int)'5' , 0x0025 , -1 , 0x20ac , -1 } , + /* 7 */ { 0 , (int)'6' , 0x0026 , -1 , -1 , -1 } , + /* 8 */ { 0 , (int)'7' , 0x002f , -1 , 0x007b , -1 } , + /* 9 */ { 0 , (int)'8' , 0x0028 , -1 , 0x005b , -1 } , + /* 0a */ { 0 , (int)'9' , 0x0029 , -1 , 0x005d , -1 } , + /* 0b */ { 0 , (int)'0' , 0x003d , -1 , 0x007d , -1 } , + /* 0c */ { 0 , 0x002b , 0x003f , -1 , -1 , -1 } , + /* 0d */ { 0 , 0x00b4 , 0x0060 , -1 , 0x007c , -1 } , + /* 0e */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 0f */ { -1 , 0 , 0 , 0 , 0 , 0 } , + + /* 10 */ { 1 , (int)'q' , (int)'Q' , -1 , -1 , -1 } , + /* 11 */ { 1 , (int)'w' , (int)'W' , -1 , -1 , -1 } , + /* 12 */ { 1 , (int)'e' , (int)'E' , -1 , 0x20ac , -1 } , + /* 13 */ { 1 , (int)'r' , (int)'R' , -1 , -1 , -1 } , + /* 14 */ { 1 , (int)'t' , (int)'T' , -1 , -1 , -1 } , + /* 15 */ { 1 , (int)'y' , (int)'Y' , -1 , -1 , -1 } , + /* 16 */ { 1 , (int)'u' , (int)'U' , -1 , -1 , -1 } , + /* 17 */ { 1 , (int)'i' , (int)'I' , -1 , -1 , -1 } , + /* 18 */ { 1 , (int)'o' , (int)'O' , -1 , -1 , -1 } , + /* 19 */ { 1 , (int)'p' , (int)'P' , -1 , -1 , -1 } , + /* 1a */ { 1 , 0x00e5 , 0x00c5 , 0x001b , -1 , -1 } , + /* 1b */ { 0 , 0x00a8 , 0x005e , 0x001d , 0x007e , -1 } , + /* 1c */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 1d */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 1e */ { 1 , (int)'a' , (int)'A' , -1 , -1 , -1 } , + /* 1f */ { 1 , (int)'s' , (int)'S' , -1 , -1 , -1 } , + + /* 20 */ { 1 , (int)'d' , (int)'D' , -1 , -1 , -1 } , + /* 21 */ { 1 , (int)'f' , (int)'F' , -1 , -1 , -1 } , + /* 22 */ { 1 , (int)'g' , (int)'G' , -1 , -1 , -1 } , + /* 23 */ { 1 , (int)'h' , (int)'H' , -1 , -1 , -1 } , + /* 24 */ { 1 , (int)'j' , (int)'J' , -1 , -1 , -1 } , + /* 25 */ { 1 , (int)'k' , (int)'K' , -1 , -1 , -1 } , + /* 26 */ { 1 , (int)'l' , (int)'L' , -1 , -1 , -1 } , + /* 27 */ { 1 , 0x00e6 , 0x00c6 , -1 , -1 , -1 } , + /* 28 */ { 1 , 0x00f8 , 0x00d8 , -1 , -1 , -1 } , + /* 29 */ { 0 , 0x00bd , 0x00a7 , 0x001c , -1 , -1 } , + /* 2a */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 2b */ { 0 , 0x0027 , 0x002a , -1 , -1 , -1 } , + /* 2c */ { 1 , (int)'z' , (int)'Z' , -1 , -1 , -1 } , + /* 2d */ { 1 , (int)'x' , (int)'X' , -1 , -1 , -1 } , + /* 2e */ { 1 , (int)'c' , (int)'C' , -1 , -1 , -1 } , + /* 2f */ { 1 , (int)'v' , (int)'V' , -1 , -1 , -1 } , + + /* 30 */ { 1 , (int)'b' , (int)'B' , -1 , -1 , -1 } , + /* 31 */ { 1 , (int)'n' , (int)'N' , -1 , -1 , -1 } , + /* 32 */ { 1 , (int)'m' , (int)'M' , -1 , 0x00b5 , -1 } , + /* 33 */ { 0 , 0x002c , 0x003b , -1 , -1 , -1 } , + /* 34 */ { 0 , 0x002e , 0x003a , -1 , -1 , -1 } , + /* 35 */ { 0 , 0x002d , 0x005f , -1 , -1 , -1 } , + /* 36 */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 37 */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 38 */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 39 */ { 0 , 0x0020 , 0x0020 , 0x0020 , -1 , -1 } , + /* 3a */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 3b */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 3c */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 3d */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 3e */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 3f */ { -1 , 0 , 0 , 0 , 0 , 0 } , + + /* 40 */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 41 */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 42 */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 43 */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 44 */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 45 */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 46 */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 47 */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 48 */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 49 */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 4a */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 4b */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 4c */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 4d */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 4e */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 4f */ { -1 , 0 , 0 , 0 , 0 , 0 } , + + /* 50 */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 51 */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 52 */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 53 */ { 0 , 0x002c , 0x002c , -1 , -1 , -1 } , + /* 54 */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 55 */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 56 */ { 0 , 0x003c , 0x003e , 0x001c , 0x005c , -1 } , + /* 57 */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 58 */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 59 */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 5a */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 5b */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 5c */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 5d */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 5e */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 5f */ { -1 , 0 , 0 , 0 , 0 , 0 } , + + }; + + public static final int DEADKEYS[] = { + 0x00b4, 0x0060, 0x00a8, 0x005e, 0x007e + }; + + public static final int DEADKEY_LUT[][] = { + { 0x00b4 , 0x0061 , 0x00e1 }, + { 0x00b4 , 0x0065 , 0x00e9 }, + { 0x00b4 , 0x0075 , 0x00fa }, + { 0x00b4 , 0x0069 , 0x00ed }, + { 0x00b4 , 0x0079 , 0x00fd }, + { 0x00b4 , 0x006f , 0x00f3 }, + { 0x00b4 , 0x0041 , 0x00c1 }, + { 0x00b4 , 0x0045 , 0x00c9 }, + { 0x00b4 , 0x0055 , 0x00da }, + { 0x00b4 , 0x0049 , 0x00cd }, + { 0x00b4 , 0x0059 , 0x00dd }, + { 0x00b4 , 0x004f , 0x00d3 }, + { 0x00b4 , 0x0020 , 0x00b4 }, + { 0x0060 , 0x0061 , 0x00e0 }, + { 0x0060 , 0x0065 , 0x00e8 }, + { 0x0060 , 0x0075 , 0x00f9 }, + { 0x0060 , 0x0069 , 0x00ec }, + { 0x0060 , 0x006f , 0x00f2 }, + { 0x0060 , 0x0041 , 0x00c0 }, + { 0x0060 , 0x0045 , 0x00c8 }, + { 0x0060 , 0x0055 , 0x00d9 }, + { 0x0060 , 0x0049 , 0x00cc }, + { 0x0060 , 0x004f , 0x00d2 }, + { 0x0060 , 0x0020 , 0x0060 }, + { 0x00a8 , 0x0061 , 0x00e4 }, + { 0x00a8 , 0x0065 , 0x00eb }, + { 0x00a8 , 0x0075 , 0x00fc }, + { 0x00a8 , 0x0069 , 0x00ef }, + { 0x00a8 , 0x0079 , 0x00ff }, + { 0x00a8 , 0x006f , 0x00f6 }, + { 0x00a8 , 0x0041 , 0x00c4 }, + { 0x00a8 , 0x0045 , 0x00cb }, + { 0x00a8 , 0x0055 , 0x00dc }, + { 0x00a8 , 0x0049 , 0x00cf }, + { 0x00a8 , 0x004f , 0x00d6 }, + { 0x00a8 , 0x0020 , 0x00a8 }, + { 0x005e , 0x0061 , 0x00e2 }, + { 0x005e , 0x0065 , 0x00ea }, + { 0x005e , 0x0075 , 0x00fb }, + { 0x005e , 0x0069 , 0x00ee }, + { 0x005e , 0x006f , 0x00f4 }, + { 0x005e , 0x0041 , 0x00c2 }, + { 0x005e , 0x0045 , 0x00ca }, + { 0x005e , 0x0055 , 0x00db }, + { 0x005e , 0x0049 , 0x00ce }, + { 0x005e , 0x004f , 0x00d4 }, + { 0x005e , 0x0020 , 0x005e }, + { 0x007e , 0x006e , 0x00f1 }, + { 0x007e , 0x0061 , 0x00e3 }, + { 0x007e , 0x006f , 0x00f5 }, + { 0x007e , 0x004e , 0x00d1 }, + { 0x007e , 0x0041 , 0x00c3 }, + { 0x007e , 0x004f , 0x00d5 }, + { 0x007e , 0x0020 , 0x007e }, + + }; + + private static DanishLayout instance = new DanishLayout(); + + private DanishLayout() { + } + + public static DanishLayout getInstance() { + return instance; + } + + @Override + public int[][] getLUT() { + return LUT; + } + + @Override + public void type(String text) { + super.type(LUT, DEADKEY_LUT, DEADKEYS, text, (byte)0); + } + + @Override + public void type(String text, byte modifiers) { + super.type(LUT, DEADKEY_LUT, DEADKEYS, text, modifiers); + } + + @Override + public char getChar(int scanCode, boolean capsLock, boolean shift, boolean altGr) { + return super.getChar(LUT, scanCode, capsLock, shift, altGr); + } + + @Override + public String getLocaleName() { + return LOCALE_NAME; + } + + @Override + public int[][] getDeadkeyLUT() { + return DEADKEY_LUT; + } + + @Override + public int[] getDeadkeys() { + return DEADKEYS; + } + +} \ No newline at end of file diff --git a/src/java/InputStickAPI/src/com/inputstick/api/layout/DvorakLayout.java b/src/java/InputStickAPI/src/com/inputstick/api/layout/DvorakLayout.java new file mode 100644 index 00000000..e93f7de6 --- /dev/null +++ b/src/java/InputStickAPI/src/com/inputstick/api/layout/DvorakLayout.java @@ -0,0 +1,160 @@ +package com.inputstick.api.layout; + +public class DvorakLayout extends KeyboardLayout { + + public static final String LOCALE_NAME = "en-DV"; + + public static final int LUT[][] = { + /* 0 */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 1 */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 2 */ { 0 , (int)'1' , 0x021 , -1 , -1 , -1 } , + /* 3 */ { 0 , (int)'2' , 0x040 , -1 , -1 , -1 } , + /* 4 */ { 0 , (int)'3' , 0x023 , -1 , -1 , -1 } , + /* 5 */ { 0 , (int)'4' , 0x024 , -1 , -1 , -1 } , + /* 6 */ { 0 , (int)'5' , 0x025 , -1 , -1 , -1 } , + /* 7 */ { 0 , (int)'6' , 0x05e , -1 , -1 , -1 } , + /* 8 */ { 0 , (int)'7' , 0x026 , -1 , -1 , -1 } , + /* 9 */ { 0 , (int)'8' , 0x02a , -1 , -1 , -1 } , + /* 0a */ { 0 , (int)'9' , 0x028 , -1 , -1 , -1 } , + /* 0b */ { 0 , (int)'0' , 0x029 , -1 , -1 , -1 } , + /* 0c */ { 0 , 0x05b , 0x07b , 0x01b , -1 , -1 } , + /* 0d */ { 0 , 0x05d , 0x07d , 0x01d , -1 , -1 } , + /* 0e */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 0f */ { -1 , 0 , 0 , 0 , 0 , 0 } , + + /* 10 */ { 0 , 0x027 , 0x022 , -1 , -1 , -1 } , + /* 11 */ { 0 , 0x02c , 0x03c , -1 , -1 , -1 } , + /* 12 */ { 0 , 0x02e , 0x03e , -1 , -1 , -1 } , + /* 13 */ { 1 , 'p' , 'P' , -1 , -1 , -1 } , + /* 14 */ { 1 , 'y' , 'Y' , -1 , -1 , -1 } , + /* 15 */ { 1 , 'f' , 'F' , -1 , -1 , -1 } , + /* 16 */ { 1 , 'g' , 'G' , -1 , -1 , -1 } , + /* 17 */ { 1 , 'c' , 'C' , -1 , -1 , -1 } , + /* 18 */ { 1 , 'r' , 'R' , -1 , -1 , -1 } , + /* 19 */ { 1 , 'l' , 'L' , -1 , -1 , -1 } , + /* 1a */ { 0 , 0x02f , 0x03f , -1 , -1 , -1 } , + /* 1b */ { 0 , 0x03d , 0x02b , -1 , -1 , -1 } , + /* 1c */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 1d */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 1e */ { 1 , 'a' , 'A' , -1 , -1 , -1 } , + /* 1f */ { 1 , 'o' , 'O' , -1 , -1 , -1 } , + + /* 20 */ { 1 , 'e' , 'E' , -1 , -1 , -1 } , + /* 21 */ { 1 , 'u' , 'U' , -1 , -1 , -1 } , + /* 22 */ { 1 , 'i' , 'I' , -1 , -1 , -1 } , + /* 23 */ { 1 , 'd' , 'D' , -1 , -1 , -1 } , + /* 24 */ { 1 , 'h' , 'H' , -1 , -1 , -1 } , + /* 25 */ { 1 , 't' , 'T' , -1 , -1 , -1 } , + /* 26 */ { 1 , 'n' , 'N' , -1 , -1 , -1 } , + /* 27 */ { 1 , 's' , 'S' , -1 , -1 , -1 } , + /* 28 */ { 0 , 0x02d , 0x05f , -1 , -1 , -1 } , + /* 29 */ { 0 , 0x060 , 0x07e , -1 , -1 , -1 } , + /* 2a */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 2b */ { 0 , 0x005c , 0x07c , 0x01c , -1 , -1 } , + /* 2c */ { 0 , 0x003b , 0x03a , -1 , -1 , -1 } , + /* 2d */ { 1 , 'q' , 'Q' , -1 , -1 , -1 } , + /* 2e */ { 1 , 'j' , 'J' , -1 , -1 , -1 } , + /* 2f */ { 1 , 'k' , 'K' , -1 , -1 , -1 } , + + /* 30 */ { 1 , 'x' , 'X' , -1 , -1 , -1 } , + /* 31 */ { 1 , 'b' , 'B' , -1 , -1 , -1 } , + /* 32 */ { 1 , 'm' , 'M' , -1 , -1 , -1 } , + /* 33 */ { 1 , 'w' , 'W' , -1 , -1 , -1 } , + /* 34 */ { 1 , 'v' , 'V' , -1 , -1 , -1 } , + /* 35 */ { 1 , 'z' , 'Z' , -1 , -1 , -1 } , + /* 36 */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 37 */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 38 */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 39 */ { 0 , 0x020 , 0x020 , 0x020 , -1 , -1 } , + /* 3a */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 3b */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 3c */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 3d */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 3e */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 3f */ { -1 , 0 , 0 , 0 , 0 , 0 } , + + + /* 40 */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 41 */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 42 */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 43 */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 44 */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 45 */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 46 */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 47 */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 48 */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 49 */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 4a */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 4b */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 4c */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 4d */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 4e */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 4f */ { -1 , 0 , 0 , 0 , 0 , 0 } , + + /* 50 */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 51 */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 52 */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 53 */ { 0 , 0x02e , 0x02e , -1 , -1 , -1 } , + /* 54 */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 55 */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 56 */ { 0 , 0x05c , 0x07c , 0x01c , -1 , -1 } , + /* 57 */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 58 */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 59 */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 5a */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 5b */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 5c */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 5d */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 5e */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 5f */ { -1 , 0 , 0 , 0 , 0 , 0 } , + + }; + + public static final int DEADKEYS[] = null; + public static final int DEADKEY_LUT[][] = null; + + private static DvorakLayout instance = new DvorakLayout(); + + private DvorakLayout() { + } + + public static DvorakLayout getInstance() { + return instance; + } + + @Override + public int[][] getLUT() { + return LUT; + } + + @Override + public void type(String text) { + super.type(LUT, DEADKEY_LUT, DEADKEYS, text, (byte)0); + } + + @Override + public void type(String text, byte modifiers) { + super.type(LUT, DEADKEY_LUT, DEADKEYS, text, modifiers); + } + + @Override + public char getChar(int scanCode, boolean capsLock, boolean shift, boolean altGr) { + return super.getChar(LUT, scanCode, capsLock, shift, altGr); + } + + @Override + public String getLocaleName() { + return LOCALE_NAME; + } + + @Override + public int[][] getDeadkeyLUT() { + return DEADKEY_LUT; + } + + @Override + public int[] getDeadkeys() { + return DEADKEYS; + } + +} \ No newline at end of file diff --git a/src/java/InputStickAPI/src/com/inputstick/api/layout/FinnishLayout.java b/src/java/InputStickAPI/src/com/inputstick/api/layout/FinnishLayout.java new file mode 100644 index 00000000..5383133b --- /dev/null +++ b/src/java/InputStickAPI/src/com/inputstick/api/layout/FinnishLayout.java @@ -0,0 +1,220 @@ +package com.inputstick.api.layout; + +public class FinnishLayout extends KeyboardLayout { + + public static final String LOCALE_NAME = "fi-FI"; + + public static final int LUT[][] = { + /* 0 */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 1 */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 2 */ { 0 , (int)'1' , 0x0021 , -1 , -1 , -1 } , + /* 3 */ { 0 , (int)'2' , 0x0022 , -1 , 0x0040 , -1 } , + /* 4 */ { 0 , (int)'3' , 0x0023 , -1 , 0x00a3 , -1 } , + /* 5 */ { 0 , (int)'4' , 0x00a4 , -1 , 24 , -1 } , + /* 6 */ { 0 , (int)'5' , 0x0025 , -1 , 0x20ac , -1 } , + /* 7 */ { 0 , (int)'6' , 0x0026 , -1 , -1 , -1 } , + /* 8 */ { 0 , (int)'7' , 0x002f , -1 , 0x007b , -1 } , + /* 9 */ { 0 , (int)'8' , 0x0028 , -1 , 0x005b , -1 } , + /* 0a */ { 0 , (int)'9' , 0x0029 , -1 , 0x005d , -1 } , + /* 0b */ { 0 , (int)'0' , 0x003d , -1 , 0x007d , -1 } , + /* 0c */ { 0 , 0x002b , 0x003f , -1 , 0x005c , -1 } , + /* 0d */ { 0 , 0x00b4 , 0x0060 , -1 , -1 , -1 } , + /* 0e */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 0f */ { -1 , 0 , 0 , 0 , 0 , 0 } , + + /* 10 */ { 1 , (int)'q' , (int)'Q' , -1 , -1 , -1 } , + /* 11 */ { 1 , (int)'w' , (int)'W' , -1 , -1 , -1 } , + /* 12 */ { 1 , (int)'e' , (int)'E' , -1 , 0x020ac , -1 } , + /* 13 */ { 1 , (int)'r' , (int)'R' , -1 , -1 , -1 } , + /* 14 */ { 1 , (int)'t' , (int)'T' , -1 , -1 , -1 } , + /* 15 */ { 1 , (int)'y' , (int)'Y' , -1 , -1 , -1 } , + /* 16 */ { 1 , (int)'u' , (int)'U' , -1 , -1 , -1 } , + /* 17 */ { 1 , (int)'i' , (int)'I' , -1 , -1 , -1 } , + /* 18 */ { 1 , (int)'o' , (int)'O' , -1 , -1 , -1 } , + /* 19 */ { 1 , (int)'p' , (int)'P' , -1 , -1 , -1 } , + /* 1a */ { 1 , 0x00e5 , 0x00c5 , 0x001b , -1 , -1 } , + /* 1b */ { 0 , 0x00a8 , 0x005e , 0x001d , 0x007e , -1 } , + /* 1c */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 1d */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 1e */ { 1 , (int)'a' , (int)'A' , -1 , -1 , -1 } , + /* 1f */ { 1 , (int)'s' , (int)'S' , -1 , -1 , -1 } , + + /* 20 */ { 1 , (int)'d' , (int)'D' , -1 , -1 , -1 } , + /* 21 */ { 1 , (int)'f' , (int)'F' , -1 , -1 , -1 } , + /* 22 */ { 1 , (int)'g' , (int)'G' , -1 , -1 , -1 } , + /* 23 */ { 1 , (int)'h' , (int)'H' , -1 , -1 , -1 } , + /* 24 */ { 1 , (int)'j' , (int)'J' , -1 , -1 , -1 } , + /* 25 */ { 1 , (int)'k' , (int)'K' , -1 , -1 , -1 } , + /* 26 */ { 1 , (int)'l' , (int)'L' , -1 , -1 , -1 } , + /* 27 */ { 1 , 0x00f6 , 0x00d6 , -1 , -1 , -1 } , + /* 28 */ { 1 , 0x00e4 , 0x00c4 , -1 , -1 , -1 } , + /* 29 */ { 0 , 0x00a7 , 0x00bd , 0x001c , -1 , -1 } , + /* 2a */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 2b */ { 0 , 0x0027 , 0x002a , -1 , -1 , -1 } , + /* 2c */ { 1 , (int)'z' , (int)'Z' , -1 , -1 , -1 } , + /* 2d */ { 1 , (int)'x' , (int)'X' , -1 , -1 , -1 } , + /* 2e */ { 1 , (int)'c' , (int)'C' , -1 , -1 , -1 } , + /* 2f */ { 1 , (int)'v' , (int)'V' , -1 , -1 , -1 } , + + + /* 30 */ { 1 , (int)'b' , (int)'B' , -1 , -1 , -1 } , + /* 31 */ { 1 , (int)'n' , (int)'N' , -1 , -1 , -1 } , + /* 32 */ { 1 , (int)'m' , (int)'M' , -1 , 0x00b5 , -1 } , + /* 33 */ { 0 , 0x002c , 0x003b , -1 , -1 , -1 } , + /* 34 */ { 0 , 0x002e , 0x003a , -1 , -1 , -1 } , + /* 35 */ { 0 , 0x002d , 0x005f , -1 , -1 , -1 } , + /* 36 */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 37 */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 38 */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 39 */ { 0 , 0x0020 , 0x0020 , 0x0020 , -1 , -1 } , + /* 3a */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 3b */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 3c */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 3d */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 3e */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 3f */ { -1 , 0 , 0 , 0 , 0 , 0 } , + + /* 40 */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 41 */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 42 */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 43 */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 44 */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 45 */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 46 */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 47 */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 48 */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 49 */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 4a */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 4b */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 4c */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 4d */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 4e */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 4f */ { -1 , 0 , 0 , 0 , 0 , 0 } , + + /* 50 */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 51 */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 52 */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 53 */ { 0 , 0x002c , 0x002c , -1 , -1 , -1 } , + /* 54 */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 55 */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 56 */ { 0 , 0x003c , 0x003e , 0x001c , 0x007c , -1 } , + /* 57 */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 58 */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 59 */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 5a */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 5b */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 5c */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 5d */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 5e */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 5f */ { -1 , 0 , 0 , 0 , 0 , 0 } , + + }; + + public static final int DEADKEYS[] = { + 0x00b4, 0x0060, 0x00a8, 0x005e, 0x007e + }; + + public static final int DEADKEY_LUT[][] = { + { 0x00b4 , 0x0061 , 0x00e1 } , + { 0x00b4 , 0x0065 , 0x00e9 } , + { 0x00b4 , 0x0075 , 0x00fa } , + { 0x00b4 , 0x0069 , 0x00ed } , + { 0x00b4 , 0x0079 , 0x00fd } , + { 0x00b4 , 0x006f , 0x00f3 } , + { 0x00b4 , 0x0041 , 0x00c1 } , + { 0x00b4 , 0x0045 , 0x00c9 } , + { 0x00b4 , 0x0055 , 0x00da } , + { 0x00b4 , 0x0049 , 0x00cd } , + { 0x00b4 , 0x0059 , 0x00dd } , + { 0x00b4 , 0x004f , 0x00d3 } , + { 0x00b4 , 0x0020 , 0x00b4 } , + { 0x0060 , 0x0061 , 0x00e0 } , + { 0x0060 , 0x0065 , 0x00e8 } , + { 0x0060 , 0x0075 , 0x00f9 } , + { 0x0060 , 0x0069 , 0x00ec } , + { 0x0060 , 0x006f , 0x00f2 } , + { 0x0060 , 0x0041 , 0x00c0 } , + { 0x0060 , 0x0045 , 0x00c8 } , + { 0x0060 , 0x0055 , 0x00d9 } , + { 0x0060 , 0x0049 , 0x00cc } , + { 0x0060 , 0x004f , 0x00d2 } , + { 0x0060 , 0x0020 , 0x0060 } , + { 0x00a8 , 0x0061 , 0x00e4 } , + { 0x00a8 , 0x0065 , 0x00eb } , + { 0x00a8 , 0x0075 , 0x00fc } , + { 0x00a8 , 0x0069 , 0x00ef } , + { 0x00a8 , 0x0079 , 0x00ff } , + { 0x00a8 , 0x006f , 0x00f6 } , + { 0x00a8 , 0x0041 , 0x00c4 } , + { 0x00a8 , 0x0045 , 0x00cb } , + { 0x00a8 , 0x0055 , 0x00dc } , + { 0x00a8 , 0x0049 , 0x00cf } , + { 0x00a8 , 0x004f , 0x00d6 } , + { 0x00a8 , 0x0020 , 0x00a8 } , + { 0x005e , 0x0061 , 0x00e2 } , + { 0x005e , 0x0065 , 0x00ea } , + { 0x005e , 0x0075 , 0x00fb } , + { 0x005e , 0x0069 , 0x00ee } , + { 0x005e , 0x006f , 0x00f4 } , + { 0x005e , 0x0041 , 0x00c2 } , + { 0x005e , 0x0045 , 0x00ca } , + { 0x005e , 0x0055 , 0x00db } , + { 0x005e , 0x0049 , 0x00ce } , + { 0x005e , 0x004f , 0x00d4 } , + { 0x005e , 0x0020 , 0x005e } , + { 0x007e , 0x006e , 0x00f1 } , + { 0x007e , 0x0061 , 0x00e3 } , + { 0x007e , 0x006f , 0x00f5 } , + { 0x007e , 0x004e , 0x00d1 } , + { 0x007e , 0x0041 , 0x00c3 } , + { 0x007e , 0x004f , 0x00d5 } , + { 0x007e , 0x0020 , 0x007e } , + + + }; + + private static FinnishLayout instance = new FinnishLayout(); + + private FinnishLayout() { + } + + public static FinnishLayout getInstance() { + return instance; + } + + @Override + public int[][] getLUT() { + return LUT; + } + + @Override + public void type(String text) { + super.type(LUT, DEADKEY_LUT, DEADKEYS, text, (byte)0); + } + + @Override + public void type(String text, byte modifiers) { + super.type(LUT, DEADKEY_LUT, DEADKEYS, text, modifiers); + } + + @Override + public char getChar(int scanCode, boolean capsLock, boolean shift, boolean altGr) { + return super.getChar(LUT, scanCode, capsLock, shift, altGr); + } + + @Override + public String getLocaleName() { + return LOCALE_NAME; + } + + @Override + public int[][] getDeadkeyLUT() { + return DEADKEY_LUT; + } + + @Override + public int[] getDeadkeys() { + return DEADKEYS; + } + +} diff --git a/src/java/InputStickAPI/src/com/inputstick/api/layout/FrenchLayout.java b/src/java/InputStickAPI/src/com/inputstick/api/layout/FrenchLayout.java new file mode 100644 index 00000000..fd58774a --- /dev/null +++ b/src/java/InputStickAPI/src/com/inputstick/api/layout/FrenchLayout.java @@ -0,0 +1,206 @@ +package com.inputstick.api.layout; + +public class FrenchLayout extends KeyboardLayout { + + public static final String LOCALE_NAME = "fr-FR"; + + public static final int LUT[][] = { + /* 0 */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 1 */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 2 */ { 1 , 0x26 , (int)'1' , -1 , -1 , -1 } , + /* 3 */ { 1 , 0x00e9 , (int)'2' , -1 , 0x007e , -1 } , + /* 4 */ { 1 , 0x22 , (int)'3' , -1 , 0x23 , -1 } , + /* 5 */ { 1 , 0x27 , (int)'4' , -1 , 0x007b , -1 } , + /* 6 */ { 1 , 0x28 , (int)'5' , -1 , 0x005b , -1 } , + /* 7 */ { 1 , 0x002d , (int)'6' , -1 , 0x007c , -1 } , + /* 8 */ { 1 , 0x00e8 , (int)'7' , -1 , 0x0060 , -1 } , + /* 9 */ { 1 , 0x005f , (int)'8' , -1 , 0x005c , -1 } , + /* 0a */ { 1 , 0x00e7 , (int)'9' , -1 , 0x005e , -1 } , + /* 0b */ { 1 , 0x00e0 , (int)'0' , -1 , 0x40 , -1 } , + /* 0c */ { 1 , 0x29 , 0x00b0 , -1 , 0x005d , -1 } , + /* 0d */ { 1 , 0x003d , 0x002b , -1 , 0x007d , -1 } , + /* 1e */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 1f */ { -1 , 0 , 0 , 0 , 0 , 0 } , + + /* 10 */ { 1 , (int)'a' , (int)'A' , -1 , -1 , -1 } , + /* 11 */ { 1 , (int)'z' , (int)'Z' , -1 , -1 , -1 } , + /* 12 */ { 1 , (int)'e' , (int)'E' , -1 , 0x20ac , -1 } , + /* 13 */ { 1 , (int)'r' , (int)'R' , -1 , -1 , -1 } , + /* 14 */ { 1 , (int)'t' , (int)'T' , -1 , -1 , -1 } , + /* 15 */ { 1 , (int)'y' , (int)'Y' , -1 , -1 , -1 } , + /* 16 */ { 1 , (int)'u' , (int)'U' , -1 , -1 , -1 } , + /* 17 */ { 1 , (int)'i' , (int)'I' , -1 , -1 , -1 } , + /* 18 */ { 1 , (int)'o' , (int)'O' , -1 , -1 , -1 } , + /* 19 */ { 1 , (int)'p' , (int)'P' , -1 , -1 , -1 } , + /* 1a */ { 1 , 0x005e , 0x00a8 , 0x001b , -1 , -1 } , + /* 1b */ { 1 , 0x24 , 0x00a3 , 0x001d , 0x00a4 , -1 } , + /* 1c */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 1d */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 1e */ { 1 , (int)'q' , (int)'Q' , -1 , -1 , -1 } , + /* 1f */ { 1 , (int)'s' , (int)'S' , -1 , -1 , -1 } , + + /* 20 */ { 1 , (int)'d' , (int)'D' , -1 , -1 , -1 } , + /* 21 */ { 1 , (int)'f' , (int)'F' , -1 , -1 , -1 } , + /* 22 */ { 1 , (int)'g' , (int)'G' , -1 , -1 , -1 } , + /* 23 */ { 1 , (int)'h' , (int)'H' , -1 , -1 , -1 } , + /* 24 */ { 1 , (int)'j' , (int)'J' , -1 , -1 , -1 } , + /* 25 */ { 1 , (int)'k' , (int)'K' , -1 , -1 , -1 } , + /* 26 */ { 1 , (int)'l' , (int)'L' , -1 , -1 , -1 } , + /* 27 */ { 1 , (int)'m' , (int)'M' , -1 , -1 , -1 } , + /* 28 */ { 1 , 0x00f9 , 0x25 , -1 , -1 , -1 } , + /* 29 */ { 0 , 0x00b2 , -1 , -1 , -1 , -1 } , + /* 2a */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 2b */ { 1 , 0x002a , 0x00b5 , 0x001c , -1 , -1 } , + /* 2c */ { 1 , (int)'w' , (int)'W' , -1 , -1 , -1 } , + /* 2d */ { 1 , (int)'x' , (int)'X' , -1 , -1 , -1 } , + /* 2e */ { 1 , (int)'c' , (int)'C' , -1 , -1 , -1 } , + /* 2f */ { 1 , (int)'v' , (int)'V' , -1 , -1 , -1 } , + + + /* 30 */ { 1 , (int)'b' , (int)'B' , -1 , -1 , -1 } , + /* 31 */ { 1 , (int)'n' , (int)'N' , -1 , -1 , -1 } , + /* 32 */ { 1 , 0x002c , 0x003f , -1 , -1 , -1 } , + /* 33 */ { 1 , 0x003b , 0x002e , -1 , -1 , -1 } , + /* 34 */ { 1 , 0x003a , 0x002f , -1 , -1 , -1 } , + /* 35 */ { 1 , 0x21 , 0x00a7 , -1 , -1 , -1 } , + /* 36 */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 37 */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 38 */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 39 */ { 0 , 0x20 , 0x20 , 0x20 , -1 , -1 } , + /* 3a */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 3b */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 3c */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 3d */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 3e */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 3f */ { -1 , 0 , 0 , 0 , 0 , 0 } , + + /* 40 */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 41 */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 42 */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 43 */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 44 */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 45 */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 46 */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 47 */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 48 */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 49 */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 4a */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 4b */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 4c */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 4d */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 4e */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 4f */ { -1 , 0 , 0 , 0 , 0 , 0 } , + + /* 50 */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 51 */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 52 */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 53 */ { 0 , 0x002e , 0x002e , -1 , -1 , -1 } , + /* 54 */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 55 */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 56 */ { 0 , 0x003c , 0x003e , 0x001c , -1 , -1 } , + /* 57 */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 58 */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 59 */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 5a */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 5b */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 5c */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 5d */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 5e */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 5f */ { -1 , 0 , 0 , 0 , 0 , 0 } , + + }; + + public static final int DEADKEYS[] = { + 0x007e, 0x0060, 0x005e, 0x00a8, 0x007e + }; + + public static final int DEADKEY_LUT[][] = { + { 0x007e , 0x006e , 0x00f1 } , + { 0x007e , 0x006f , 0x00f5 } , + { 0x007e , 0x0061 , 0x00e3 } , + { 0x007e , 0x004e , 0x00d1 } , + { 0x007e , 0x004f , 0x00d5 } , + { 0x007e , 0x0041 , 0x00c3 } , + { 0x007e , 0x0020 , 0x007e } , + { 0x0060 , 0x0065 , 0x00e8 } , + { 0x0060 , 0x0075 , 0x00f9 } , + { 0x0060 , 0x0069 , 0x00ec } , + { 0x0060 , 0x006f , 0x00f2 } , + { 0x0060 , 0x0061 , 0x00e0 } , + { 0x0060 , 0x0045 , 0x00c8 } , + { 0x0060 , 0x0055 , 0x00d9 } , + { 0x0060 , 0x0049 , 0x00cc } , + { 0x0060 , 0x004f , 0x00d2 } , + { 0x0060 , 0x0041 , 0x00c0 } , + { 0x0060 , 0x0020 , 0x0060 } , + { 0x005e , 0x0065 , 0x00ea } , + { 0x005e , 0x0075 , 0x00fb } , + { 0x005e , 0x0069 , 0x00ee } , + { 0x005e , 0x006f , 0x00f4 } , + { 0x005e , 0x0061 , 0x00e2 } , + { 0x005e , 0x0045 , 0x00ca } , + { 0x005e , 0x0055 , 0x00db } , + { 0x005e , 0x0049 , 0x00ce } , + { 0x005e , 0x004f , 0x00d4 } , + { 0x005e , 0x0041 , 0x00c2 } , + { 0x005e , 0x0020 , 0x005e } , + { 0x00a8 , 0x0065 , 0x00eb } , + { 0x00a8 , 0x0075 , 0x00fc } , + { 0x00a8 , 0x0069 , 0x00ef } , + { 0x00a8 , 0x0079 , 0x00ff } , + { 0x00a8 , 0x006f , 0x00f6 } , + { 0x00a8 , 0x0061 , 0x00e4 } , + { 0x00a8 , 0x0045 , 0x00cb } , + { 0x00a8 , 0x0055 , 0x00dc } , + { 0x00a8 , 0x0049 , 0x00cf } , + { 0x00a8 , 0x004f , 0x00d6 } , + { 0x00a8 , 0x0041 , 0x00c4 } , + { 0x00a8 , 0x0020 , 0x00a8 } , + }; + + private static FrenchLayout instance = new FrenchLayout(); + + private FrenchLayout() { + } + + public static FrenchLayout getInstance() { + return instance; + } + + @Override + public int[][] getLUT() { + return LUT; + } + + @Override + public void type(String text) { + super.type(LUT, DEADKEY_LUT, DEADKEYS, text, (byte)0); + } + + @Override + public void type(String text, byte modifiers) { + super.type(LUT, DEADKEY_LUT, DEADKEYS, text, modifiers); + } + + @Override + public char getChar(int scanCode, boolean capsLock, boolean shift, boolean altGr) { + return super.getChar(LUT, scanCode, capsLock, shift, altGr); + } + + @Override + public String getLocaleName() { + return LOCALE_NAME; + } + + @Override + public int[][] getDeadkeyLUT() { + return DEADKEY_LUT; + } + + @Override + public int[] getDeadkeys() { + return DEADKEYS; + } + +} + diff --git a/src/java/InputStickAPI/src/com/inputstick/api/layout/GermanLayout.java b/src/java/InputStickAPI/src/com/inputstick/api/layout/GermanLayout.java index 75709a39..d85e6917 100644 --- a/src/java/InputStickAPI/src/com/inputstick/api/layout/GermanLayout.java +++ b/src/java/InputStickAPI/src/com/inputstick/api/layout/GermanLayout.java @@ -153,49 +153,6 @@ public class GermanLayout extends KeyboardLayout { }; - public static final int DEADKEYS[] = { - 0x0060, 0x00b4, 0x005e - }; - - public static final int DEADKEY_LUT[][] = { - { 0x00b4 , 0x0079 , 0x00fd } , - { 0x00b4 , 0x0061 , 0x00e1 } , - { 0x00b4 , 0x0065 , 0x00e9 } , - { 0x00b4 , 0x0075 , 0x00fa } , - { 0x00b4 , 0x0069 , 0x00ed } , - { 0x00b4 , 0x006f , 0x00f3 } , - { 0x00b4 , 0x0059 , 0x00dd } , - { 0x00b4 , 0x0041 , 0x00c1 } , - { 0x00b4 , 0x0045 , 0x00c9 } , - { 0x00b4 , 0x0055 , 0x00da } , - { 0x00b4 , 0x0049 , 0x00cd } , - { 0x00b4 , 0x004f , 0x00d3 } , - { 0x00b4 , 0x0020 , 0x00b4 } , - { 0x0060 , 0x0061 , 0x00e0 } , - { 0x0060 , 0x0065 , 0x00e8 } , - { 0x0060 , 0x0075 , 0x00f9 } , - { 0x0060 , 0x0069 , 0x00ec } , - { 0x0060 , 0x006f , 0x00f2 } , - { 0x0060 , 0x0041 , 0x00c0 } , - { 0x0060 , 0x0045 , 0x00c8 } , - { 0x0060 , 0x0055 , 0x00d9 } , - { 0x0060 , 0x0049 , 0x00cc } , - { 0x0060 , 0x004f , 0x00d2 } , - { 0x0060 , 0x0020 , 0x0060 } , - { 0x005e , 0x0061 , 0x00e2 } , - { 0x005e , 0x0065 , 0x00ea } , - { 0x005e , 0x0075 , 0x00fb } , - { 0x005e , 0x0069 , 0x00ee } , - { 0x005e , 0x006f , 0x00f4 } , - { 0x005e , 0x0041 , 0x00c2 } , - { 0x005e , 0x0045 , 0x00ca } , - { 0x005e , 0x0055 , 0x00db } , - { 0x005e , 0x0049 , 0x00ce } , - { 0x005e , 0x004f , 0x00d4 } , - { 0x005e , 0x0020 , 0x005e } , - - }; - private static GermanLayout instance = new GermanLayout(); private GermanLayout() { diff --git a/src/java/InputStickAPI/src/com/inputstick/api/layout/GermanMacLayout.java b/src/java/InputStickAPI/src/com/inputstick/api/layout/GermanMacLayout.java new file mode 100644 index 00000000..018334e1 --- /dev/null +++ b/src/java/InputStickAPI/src/com/inputstick/api/layout/GermanMacLayout.java @@ -0,0 +1,201 @@ +package com.inputstick.api.layout; + +public class GermanMacLayout extends KeyboardLayout { + + public static final String LOCALE_NAME = "de-DE-mac"; + + public static final int LUT[][] = { + // CAPSLOCK, NORMAL , SHIFT , CTRL , ALTGR , SHIFT + ALTGR + /* 0 */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 1 */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 2 */ { 0 , (int)'1' , 0x21 , -1 , -1 , -1 } , + /* 3 */ { 0 , (int)'2' , 0x22 , -1 , -1 , -1 } , + /* 4 */ { 0 , (int)'3' , 0x00a7 , -1 , -1 , -1 } , + /* 5 */ { 0 , (int)'4' , 0x24 , -1 , -1 , -1 } , + /* 6 */ { 0 , (int)'5' , 0x25 , -1 , 0x005b , 0x005b } , + /* 7 */ { 0 , (int)'6' , 0x26 , -1 , 0x005d , 0x005d } , + /* 8 */ { 0 , (int)'7' , 0x002f , -1 , 0x007c , 0x007c } , + /* 9 */ { 0 , (int)'8' , 0x28 , -1 , 0x007b , 0x007b } , + /* 0a */ { 0 , (int)'9' , 0x29 , -1 , 0x007d , 0x007d } , + /* 0b */ { 0 , (int)'0' , 0x003d , -1 , -1 , -1 } , + /* 0c */ { 0 , 0x00df , 0x003f , -1 , -1 , -1 } , + /* 0d */ { 0 , 0x00b4 , 0x0060 , -1 , -1 , -1 } , + /* 0e */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 0f */ { -1 , 0 , 0 , 0 , 0 , 0 } , + + + /* 10 */ { 1 , (int)'q' , (int)'Q' , -1 , -1 , -1 } , + /* 11 */ { 1 , (int)'w' , (int)'W' , -1 , -1 , -1 } , + /* 12 */ { 1 , (int)'e' , (int)'E' , -1 , 0x20ac , -1 } , //euro, same as Windows layout + /* 13 */ { 1 , (int)'r' , (int)'R' , -1 , -1 , -1 } , + /* 14 */ { 1 , (int)'t' , (int)'T' , -1 , -1 , -1 } , + /* 15 */ { 1 , (int)'z' , (int)'Z' , -1 , -1 , -1 } , + /* 16 */ { 1 , (int)'u' , (int)'U' , -1 , -1 , -1 } , + /* 17 */ { 1 , (int)'i' , (int)'I' , -1 , -1 , -1 } , + /* 18 */ { 1 , (int)'o' , (int)'O' , -1 , -1 , -1 } , + /* 19 */ { 1 , (int)'p' , (int)'P' , -1 , -1 , -1 } , + /* 1a */ { 1 , 0x00fc , 0x00dc , 0x001b , -1 , -1 } , + /* 1b */ { 0 , 0x002b , 0x002a , 0x001d , -1 , -1 } , + /* 1c */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 1d */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 1e */ { 1 , (int)'a' , (int)'A' , -1 , -1 , -1 } , + /* 1f */ { 1 , (int)'s' , (int)'S' , -1 , -1 , -1 } , + + /* 20 */ { 1 , (int)'d' , (int)'D' , -1 , -1 , -1 } , + /* 21 */ { 1 , (int)'f' , (int)'F' , -1 , -1 , -1 } , + /* 22 */ { 1 , (int)'g' , (int)'G' , -1 , -1 , -1 } , + /* 23 */ { 1 , (int)'h' , (int)'H' , -1 , -1 , -1 } , + /* 24 */ { 1 , (int)'j' , (int)'J' , -1 , -1 , -1 } , + /* 25 */ { 1 , (int)'k' , (int)'K' , -1 , -1 , -1 } , + /* 26 */ { 1 , (int)'l' , (int)'L' , -1 , 0x0040 , -1 } , + /* 27 */ { 1 , 0x00f6 , 0x00d6 , -1 , -1 , -1 } , + /* 28 */ { 1 , 0x00e4 , 0x00c4 , -1 , -1 , -1 } , + /* 29 */ { 0 , 0x005e , 0x00b0 , -1 , -1 , -1 } , + /* 2a */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 2b */ { 0 , 0x23 , 0x27 , 0x001c , -1 , -1 } , + /* 2c */ { 1 , (int)'y' , (int)'Y' , -1 , -1 , -1 } , + /* 2d */ { 1 , (int)'x' , (int)'X' , -1 , -1 , -1 } , + /* 2e */ { 1 , (int)'c' , (int)'C' , -1 , -1 , -1 } , + /* 2f */ { 1 , (int)'v' , (int)'V' , -1 , -1 , -1 } , + + /* 30 */ { 1 , (int)'b' , (int)'B' , -1 , -1 , -1 } , + /* 31 */ { 1 , (int)'n' , (int)'N' , -1 , 0x007e , 0x007e } , //MAC ~ + /* 32 */ { 1 , (int)'m' , (int)'M' , -1 , 0x00b5 , 0x00b5 } , //"micro" - same as Windwos + /* 33 */ { 0 , 0x002c , 0x003b , -1 , -1 , -1 } , + /* 34 */ { 0 , 0x002e , 0x003a , -1 , -1 , -1 } , + /* 35 */ { 0 , 0x002d , 0x005f , -1 , -1 , -1 } , + /* 36 */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 37 */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 38 */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 39 */ { 0 , 0x20 , 0x20 , 0x20 , -1 , -1 } , + /* 3a */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 3b */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 3c */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 3d */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 3e */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 3f */ { -1 , 0 , 0 , 0 , 0 , 0 } , + + /* 40 */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 41 */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 42 */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 43 */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 44 */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 45 */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 46 */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 47 */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 48 */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 49 */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 4a */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 4b */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 4c */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 4d */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 4e */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 4f */ { -1 , 0 , 0 , 0 , 0 , 0 } , + + /* 50 */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 51 */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 52 */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 53 */ { 0 , 0x002c , 0x002c , -1 , -1 , -1 } , + /* 54 */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 55 */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 56 */ { 0 , 0x003c , 0x003e , -1 , -1 , -1 } , + /* 57 */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 58 */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 59 */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 5a */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 5b */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 5c */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 5d */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 5e */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 5f */ { -1 , 0 , 0 , 0 , 0 , 0 } , + + }; + + public static final int DEADKEYS[] = { + 0x0060, 0x00b4, 0x005e + }; + + public static final int DEADKEY_LUT[][] = { + { 0x00b4 , 0x0079 , 0x00fd } , + { 0x00b4 , 0x0061 , 0x00e1 } , + { 0x00b4 , 0x0065 , 0x00e9 } , + { 0x00b4 , 0x0075 , 0x00fa } , + { 0x00b4 , 0x0069 , 0x00ed } , + { 0x00b4 , 0x006f , 0x00f3 } , + { 0x00b4 , 0x0059 , 0x00dd } , + { 0x00b4 , 0x0041 , 0x00c1 } , + { 0x00b4 , 0x0045 , 0x00c9 } , + { 0x00b4 , 0x0055 , 0x00da } , + { 0x00b4 , 0x0049 , 0x00cd } , + { 0x00b4 , 0x004f , 0x00d3 } , + { 0x00b4 , 0x0020 , 0x00b4 } , + { 0x0060 , 0x0061 , 0x00e0 } , + { 0x0060 , 0x0065 , 0x00e8 } , + { 0x0060 , 0x0075 , 0x00f9 } , + { 0x0060 , 0x0069 , 0x00ec } , + { 0x0060 , 0x006f , 0x00f2 } , + { 0x0060 , 0x0041 , 0x00c0 } , + { 0x0060 , 0x0045 , 0x00c8 } , + { 0x0060 , 0x0055 , 0x00d9 } , + { 0x0060 , 0x0049 , 0x00cc } , + { 0x0060 , 0x004f , 0x00d2 } , + { 0x0060 , 0x0020 , 0x0060 } , + { 0x005e , 0x0061 , 0x00e2 } , + { 0x005e , 0x0065 , 0x00ea } , + { 0x005e , 0x0075 , 0x00fb } , + { 0x005e , 0x0069 , 0x00ee } , + { 0x005e , 0x006f , 0x00f4 } , + { 0x005e , 0x0041 , 0x00c2 } , + { 0x005e , 0x0045 , 0x00ca } , + { 0x005e , 0x0055 , 0x00db } , + { 0x005e , 0x0049 , 0x00ce } , + { 0x005e , 0x004f , 0x00d4 } , + { 0x005e , 0x0020 , 0x005e } , + + }; + + private static GermanMacLayout instance = new GermanMacLayout(); + + private GermanMacLayout() { + } + + public static GermanMacLayout getInstance() { + return instance; + } + + @Override + public int[][] getLUT() { + return LUT; + } + + @Override + public void type(String text) { + super.type(LUT, DEADKEY_LUT, DEADKEYS, text, (byte)0); + } + + @Override + public void type(String text, byte modifiers) { + super.type(LUT, DEADKEY_LUT, DEADKEYS, text, modifiers); + } + + @Override + public char getChar(int scanCode, boolean capsLock, boolean shift, boolean altGr) { + return super.getChar(LUT, scanCode, capsLock, shift, altGr); + } + + @Override + public String getLocaleName() { + return LOCALE_NAME; + } + + @Override + public int[][] getDeadkeyLUT() { + return DEADKEY_LUT; + } + + @Override + public int[] getDeadkeys() { + return DEADKEYS; + } + +} diff --git a/src/java/InputStickAPI/src/com/inputstick/api/layout/HebrewLayout.java b/src/java/InputStickAPI/src/com/inputstick/api/layout/HebrewLayout.java new file mode 100644 index 00000000..e2fdf737 --- /dev/null +++ b/src/java/InputStickAPI/src/com/inputstick/api/layout/HebrewLayout.java @@ -0,0 +1,159 @@ +package com.inputstick.api.layout; + +public class HebrewLayout extends KeyboardLayout { + + public static final String LOCALE_NAME = "he-IL"; + + public static final int LUT[][] = { + /* 0 */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 1 */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 2 */ { 0 , (int)'1' , 0x0021 , -1 , -1 , -1 } , // TODO SGCap + /* 3 */ { 0 , (int)'2' , 0x0040 , -1 , -1 , -1 } , // TODO SGCap + /* 4 */ { 0 , (int)'3' , 0x0023 , -1 , 0x200e , -1 } , // TODO SGCap + /* 5 */ { 0 , (int)'4' , 0x0024 , -1 , 0x200f , 0x20aa } , // TODO SGCap + /* 6 */ { 0 , (int)'5' , 0x0025 , -1 , -1 , -1 } , // TODO SGCap + /* 7 */ { 0 , (int)'6' , 0x005e , -1 , -1 , -1 } , // TODO SGCap + /* 8 */ { 0 , (int)'7' , 0x0026 , -1 , -1 , -1 } , // TODO SGCap + /* 9 */ { 0 , (int)'8' , 0x002a , -1 , -1 , -1 } , // TODO SGCap + /* 0a */ { 0 , (int)'9' , 0x0029 , -1 , -1 , -1 } , // TODO SGCap + /* 0b */ { 0 , (int)'0' , 0x0028 , -1 , -1 , -1 } , // TODO SGCap + /* 0c */ { 0 , 0x002d , 0x005f , -1 , -1 , 0x05bf } , // TODO SGCap + /* 0d */ { 0 , 0x003d , 0x002b , -1 , -1 , -1 } , // TODO SGCap + /* 0e */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 0f */ { -1 , 0 , 0 , 0 , 0 , 0 } , + + /* 10 */ { 1 , 0x002f , (int)'Q' , -1 , -1 , -1 } , + /* 11 */ { 1 , 0x0027 , (int)'W' , -1 , -1 , -1 } , + /* 12 */ { 1 , 0x05e7 , (int)'E' , -1 , -1 , 0x20ac } , + /* 13 */ { 1 , 0x05e8 , (int)'R' , -1 , -1 , -1 } , + /* 14 */ { 1 , 0x05d0 , (int)'T' , -1 , -1 , -1 } , + /* 15 */ { 1 , 0x05d8 , (int)'Y' , -1 , -1 , -1 } , + /* 16 */ { 1 , 0x05d5 , (int)'U' , -1 , -1 , 0x05f0 } , + /* 17 */ { 1 , 0x05df , (int)'I' , -1 , -1 , -1 } , + /* 18 */ { 1 , 0x05dd , (int)'O' , -1 , -1 , -1 } , + /* 19 */ { 1 , 0x05e4 , (int)'P' , -1 , -1 , -1 } , + /* 1a */ { 0 , 0x005d , 0x007d , 0x200e , -1 , -1 } , // TODO SGCap + /* 1b */ { 0 , 0x005b , 0x007b , 0x200f , -1 , -1 } , // TODO SGCap + /* 1c */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 1d */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 1e */ { 1 , 0x05e9 , (int)'A' , -1 , -1 , -1 } , + /* 1f */ { 1 , 0x05d3 , (int)'S' , -1 , -1 , -1 } , + + /* 20 */ { 1 , 0x05d2 , (int)'D' , -1 , -1 , -1 } , + /* 21 */ { 1 , 0x05db , (int)'F' , -1 , -1 , -1 } , + /* 22 */ { 1 , 0x05e2 , (int)'G' , -1 , -1 , -1 } , + /* 23 */ { 1 , 0x05d9 , (int)'H' , -1 , -1 , 0x05f2 } , + /* 24 */ { 1 , 0x05d7 , (int)'J' , -1 , -1 , 0x05f1 } , + /* 25 */ { 1 , 0x05dc , (int)'K' , -1 , -1 , -1 } , + /* 26 */ { 1 , 0x05da , (int)'L' , -1 , -1 , -1 } , + /* 27 */ { 0 , 0x05e3 , 0x003a , -1 , -1 , -1 } , // TODO SGCap + /* 28 */ { 0 , 0x002c , 0x0022 , -1 , -1 , -1 } , // TODO SGCap + /* 29 */ { 0 , 0x003b , 0x007e , -1 , -1 , -1 } , // TODO SGCap + /* 2a */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 2b */ { 0 , 0x005c , 0x007c , 0x001c , -1 , -1 } , // TODO SGCap + /* 2c */ { 1 , 0x05d6 , (int)'Z' , -1 , -1 , -1 } , + /* 2d */ { 1 , 0x05e1 , (int)'X' , -1 , -1 , -1 } , + /* 2e */ { 1 , 0x05d1 , (int)'C' , -1 , -1 , -1 } , + /* 2f */ { 1 , 0x05d4 , (int)'V' , -1 , -1 , -1 } , + + /* 30 */ { 1 , 0x05e0 , (int)'B' , -1 , -1 , -1 } , + /* 31 */ { 1 , 0x05de , (int)'N' , -1 , -1 , -1 } , + /* 32 */ { 1 , 0x05e6 , (int)'M' , -1 , -1 , -1 } , + /* 33 */ { 0 , 0x05ea , 0x003e , -1 , -1 , -1 } , // TODO SGCap + /* 34 */ { 0 , 0x05e5 , 0x003c , -1 , -1 , -1 } , // TODO SGCap + /* 35 */ { 0 , 0x002e , 0x003f , -1 , -1 , -1 } , // TODO SGCap + /* 36 */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 37 */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 38 */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 39 */ { 0 , 0x0020 , 0x0020 , 0x0020 , -1 , -1 } , + /* 3a */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 3b */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 3c */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 3d */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 3e */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 3f */ { -1 , 0 , 0 , 0 , 0 , 0 } , + + /* 40 */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 41 */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 42 */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 43 */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 44 */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 45 */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 46 */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 47 */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 48 */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 49 */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 4a */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 4b */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 4c */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 4d */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 4e */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 4f */ { -1 , 0 , 0 , 0 , 0 , 0 } , + + /* 50 */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 51 */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 52 */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 53 */ { 0 , 0x002e , 0x002e , -1 , -1 , -1 } , + /* 54 */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 55 */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 56 */ { 0 , 0x005c , 0x007c , 0x001c , -1 , -1 } , + /* 57 */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 58 */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 59 */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 5a */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 5b */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 5c */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 5d */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 5e */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 5f */ { -1 , 0 , 0 , 0 , 0 , 0 } , + + }; + + public static final int DEADKEYS[] = null; + public static final int DEADKEY_LUT[][] = null; + + private static HebrewLayout instance = new HebrewLayout(); + + private HebrewLayout() { + } + + public static HebrewLayout getInstance() { + return instance; + } + + @Override + public int[][] getLUT() { + return LUT; + } + + @Override + public void type(String text) { + super.type(LUT, DEADKEY_LUT, DEADKEYS, text, (byte)0); + } + + @Override + public void type(String text, byte modifiers) { + super.type(LUT, DEADKEY_LUT, DEADKEYS, text, modifiers); + } + + @Override + public char getChar(int scanCode, boolean capsLock, boolean shift, boolean altGr) { + return super.getChar(LUT, scanCode, capsLock, shift, altGr); + } + + @Override + public String getLocaleName() { + return LOCALE_NAME; + } + + @Override + public int[][] getDeadkeyLUT() { + return DEADKEY_LUT; + } + + @Override + public int[] getDeadkeys() { + return DEADKEYS; + } + +} diff --git a/src/java/InputStickAPI/src/com/inputstick/api/layout/ItalianLayout.java b/src/java/InputStickAPI/src/com/inputstick/api/layout/ItalianLayout.java new file mode 100644 index 00000000..91fa665d --- /dev/null +++ b/src/java/InputStickAPI/src/com/inputstick/api/layout/ItalianLayout.java @@ -0,0 +1,160 @@ +package com.inputstick.api.layout; + +public class ItalianLayout extends KeyboardLayout { + + public static final String LOCALE_NAME = "it-IT"; + + public static final int LUT[][] = { + /* 0 */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 1 */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 2 */ { 0 , (int)'1' , 0x0021 , -1 , -1 , -1 } , + /* 3 */ { 0 , (int)'2' , 0x0022 , -1 , -1 , -1 } , + /* 4 */ { 0 , (int)'3' , 0x00a3 , -1 , -1 , -1 } , + /* 5 */ { 0 , (int)'4' , 0x0024 , -1 , -1 , -1 } , + /* 6 */ { 0 , (int)'5' , 0x0025 , -1 , 0x20ac , -1 } , + /* 7 */ { 0 , (int)'6' , 0x0026 , -1 , -1 , -1 } , + /* 8 */ { 0 , (int)'7' , 0x002f , -1 , -1 , -1 } , + /* 9 */ { 0 , (int)'8' , 0x0028 , -1 , -1 , -1 } , + /* 0a */ { 0 , (int)'9' , 0x0029 , -1 , -1 , -1 } , + /* 0b */ { 0 , (int)'0' , 0x003d , -1 , -1 , -1 } , + /* 0c */ { 0 , 0x0027 , 0x003f , -1 , -1 , -1 } , + /* 0d */ { 0 , 0x00ec , 0x005e , -1 , -1 , -1 } , + /* 0e */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 0f */ { -1 , 0 , 0 , 0 , 0 , 0 } , + + /* 10 */ { 1 , (int)'q' , (int)'Q' , -1 , -1 , -1 } , + /* 11 */ { 1 , (int)'w' , (int)'W' , -1 , -1 , -1 } , + /* 12 */ { 1 , (int)'e' , (int)'E' , -1 , 0x20ac , -1 } , + /* 13 */ { 1 , (int)'r' , (int)'R' , -1 , -1 , -1 } , + /* 14 */ { 1 , (int)'t' , (int)'T' , -1 , -1 , -1 } , + /* 15 */ { 1 , (int)'y' , (int)'Y' , -1 , -1 , -1 } , + /* 16 */ { 1 , (int)'u' , (int)'U' , -1 , -1 , -1 } , + /* 17 */ { 1 , (int)'i' , (int)'I' , -1 , -1 , -1 } , + /* 18 */ { 1 , (int)'o' , (int)'O' , -1 , -1 , -1 } , + /* 19 */ { 1 , (int)'p' , (int)'P' , -1 , -1 , -1 } , + /* 1a */ { 0 , 0x00e8 , 0x00e9 , 0x001b , 0x005b , 0x007b } , + /* 1b */ { 0 , 0x002b , 0x002a , 0x001d , 0x005d , 0x007d } , + /* 1c */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 1d */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 1e */ { 1 , (int)'a' , (int)'A' , -1 , -1 , -1 } , + /* 1f */ { 1 , (int)'s' , (int)'S' , -1 , -1 , -1 } , + + /* 20 */ { 1 , (int)'d' , (int)'D' , -1 , -1 , -1 } , + /* 21 */ { 1 , (int)'f' , (int)'F' , -1 , -1 , -1 } , + /* 22 */ { 1 , (int)'g' , (int)'G' , -1 , -1 , -1 } , + /* 23 */ { 1 , (int)'h' , (int)'H' , -1 , -1 , -1 } , + /* 24 */ { 1 , (int)'j' , (int)'J' , -1 , -1 , -1 } , + /* 25 */ { 1 , (int)'k' , (int)'K' , -1 , -1 , -1 } , + /* 26 */ { 1 , (int)'l' , (int)'L' , -1 , -1 , -1 } , + /* 27 */ { 0 , 0x00f2 , 0x00e7 , -1 , 0x0040 , -1 } , + /* 28 */ { 0 , 0x00e0 , 0x00b0 , -1 , 0x0023 , -1 } , + /* 29 */ { 0 , 0x005c , 0x007c , -1 , -1 , -1 } , + /* 2a */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 2b */ { 0 , 0x00f9 , 0x00a7 , 0x001c , -1 , -1 } , + /* 2c */ { 1 , (int)'z' , (int)'Z' , -1 , -1 , -1 } , + /* 2d */ { 1 , (int)'x' , (int)'X' , -1 , -1 , -1 } , + /* 2e */ { 1 , (int)'c' , (int)'C' , -1 , -1 , -1 } , + /* 2f */ { 1 , (int)'v' , (int)'V' , -1 , -1 , -1 } , + + + /* 30 */ { 1 , (int)'b' , (int)'B' , -1 , -1 , -1 } , + /* 31 */ { 1 , (int)'n' , (int)'N' , -1 , -1 , -1 } , + /* 32 */ { 1 , (int)'m' , (int)'M' , -1 , -1 , -1 } , + /* 33 */ { 0 , 0x002c , 0x003b , -1 , -1 , -1 } , + /* 34 */ { 0 , 0x002e , 0x003a , -1 , -1 , -1 } , + /* 35 */ { 0 , 0x002d , 0x005f , -1 , -1 , -1 } , + /* 36 */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 37 */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 38 */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 39 */ { 0 , 0x0020 , 0x0020 , 0x0020 , -1 , -1 } , + /* 3a */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 3b */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 3c */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 3d */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 3e */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 3f */ { -1 , 0 , 0 , 0 , 0 , 0 } , + + /* 40 */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 41 */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 42 */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 43 */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 44 */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 45 */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 46 */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 47 */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 48 */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 49 */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 4a */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 4b */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 4c */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 4d */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 4e */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 4f */ { -1 , 0 , 0 , 0 , 0 , 0 } , + + /* 50 */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 51 */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 52 */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 53 */ { 0 , 0x002e , 0x002e , -1 , -1 , -1 } , + /* 54 */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 55 */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 56 */ { 0 , 0x003c , 0x003e , 0x001c , -1 , -1 } , + /* 57 */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 58 */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 59 */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 5a */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 5b */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 5c */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 5d */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 5e */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 5f */ { -1 , 0 , 0 , 0 , 0 , 0 } , + + }; + + public static final int DEADKEYS[] = null; + public static final int DEADKEY_LUT[][] = null; + + private static ItalianLayout instance = new ItalianLayout(); + + private ItalianLayout() { + } + + public static ItalianLayout getInstance() { + return instance; + } + + @Override + public int[][] getLUT() { + return LUT; + } + + @Override + public void type(String text) { + super.type(LUT, DEADKEY_LUT, DEADKEYS, text, (byte)0); + } + + @Override + public void type(String text, byte modifiers) { + super.type(LUT, DEADKEY_LUT, DEADKEYS, text, modifiers); + } + + @Override + public char getChar(int scanCode, boolean capsLock, boolean shift, boolean altGr) { + return super.getChar(LUT, scanCode, capsLock, shift, altGr); + } + + @Override + public String getLocaleName() { + return LOCALE_NAME; + } + + @Override + public int[][] getDeadkeyLUT() { + return DEADKEY_LUT; + } + + @Override + public int[] getDeadkeys() { + return DEADKEYS; + } + +} diff --git a/src/java/InputStickAPI/src/com/inputstick/api/layout/KeyboardLayout.java b/src/java/InputStickAPI/src/com/inputstick/api/layout/KeyboardLayout.java index 7ebe2bbf..975510f7 100644 --- a/src/java/InputStickAPI/src/com/inputstick/api/layout/KeyboardLayout.java +++ b/src/java/InputStickAPI/src/com/inputstick/api/layout/KeyboardLayout.java @@ -2,6 +2,7 @@ package com.inputstick.api.layout; import com.inputstick.api.ConnectionManager; import com.inputstick.api.basic.InputStickHID; +import com.inputstick.api.basic.InputStickKeyboard; import com.inputstick.api.hid.HIDKeycodes; import com.inputstick.api.hid.HIDTransaction; import com.inputstick.api.hid.KeyboardReport; @@ -122,6 +123,8 @@ public abstract class KeyboardLayout { public abstract int[][] getDeadkeyLUT(); public abstract int[] getDeadkeys(); public abstract String getLocaleName(); + + //types text assuming that USB host uses the same keyboard layout public abstract void type(String text); public abstract void type(String text, byte modifiers); public abstract char getChar(int scanCode, boolean capsLock, boolean shift, boolean altGr); @@ -131,9 +134,15 @@ public abstract class KeyboardLayout { char[] chars = text.toCharArray(); HIDTransaction t; for (char c : chars) { - t = getHIDTransaction(lut, deadkeyLUT, deadkeys, c, modifiers); - if (t != null) { - InputStickHID.addKeyboardTransaction(t); + if (c == '\n') { + InputStickKeyboard.pressAndRelease(HIDKeycodes.NONE, HIDKeycodes.KEY_ENTER); + } else if (c == '\t') { + InputStickKeyboard.pressAndRelease(HIDKeycodes.NONE, HIDKeycodes.KEY_TAB); + } else { + t = getHIDTransaction(lut, deadkeyLUT, deadkeys, c, modifiers); + if (t != null) { + InputStickHID.addKeyboardTransaction(t); + } } } } @@ -315,6 +324,7 @@ public abstract class KeyboardLayout { return t; } + //returns layout sepcified by locale (example: "de-DE"). If specified layout is not available, en=US will be returned. public static KeyboardLayout getLayout(String locale) { if (locale != null) { if (locale.equals(UnitedStatesLayout.getInstance().getLocaleName())) { diff --git a/src/java/InputStickAPI/src/com/inputstick/api/layout/NorwegianLayout.java b/src/java/InputStickAPI/src/com/inputstick/api/layout/NorwegianLayout.java new file mode 100644 index 00000000..09f6e135 --- /dev/null +++ b/src/java/InputStickAPI/src/com/inputstick/api/layout/NorwegianLayout.java @@ -0,0 +1,221 @@ +package com.inputstick.api.layout; + +public class NorwegianLayout extends KeyboardLayout { + + public static final String LOCALE_NAME = "nb-NO"; + + public static final int LUT[][] = { + /* 0 */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 1 */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 2 */ { 0 , (int)'1' , 0x21 , -1 , -1 , -1 } , + /* 3 */ { 0 , (int)'2' , 0x22 , -1 , 0x40 , -1 } , + /* 4 */ { 0 , (int)'3' , 0x23 , -1 , 0x00a3 , -1 } , + /* 5 */ { 0 , (int)'4' , 0x00a4 , -1 , 0x24 , -1 } , + /* 6 */ { 0 , (int)'5' , 0x25 , -1 , 0x20ac , -1 } , + /* 7 */ { 0 , (int)'6' , 0x26 , -1 , -1 , -1 } , + /* 8 */ { 0 , (int)'7' , 0x002f , -1 , 0x007b , -1 } , + /* 9 */ { 0 , (int)'8' , 0x28 , -1 , 0x005b , -1 } , + /* 0a */ { 0 , (int)'9' , 0x29 , -1 , 0x005d , -1 } , + /* 0b */ { 0 , (int)'0' , 0x003d , -1 , 0x007d , -1 } , + /* 0c */ { 0 , 0x002b , 0x003f , -1 , -1 , -1 } , + /* 0d */ { 0 , 0x005c , 0x0060 , -1 , 0x00b4 , -1 } , + /* 0e */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 0f */ { -1 , 0 , 0 , 0 , 0 , 0 } , + + /* 10 */ { 1 , (int)'q' , (int)'Q' , -1 , -1 , -1 } , + /* 11 */ { 1 , (int)'w' , (int)'W' , -1 , -1 , -1 } , + /* 12 */ { 1 , (int)'e' , (int)'E' , -1 , 0x20ac , -1 } , + /* 13 */ { 1 , (int)'r' , (int)'R' , -1 , -1 , -1 } , + /* 14 */ { 1 , (int)'t' , (int)'T' , -1 , -1 , -1 } , + /* 15 */ { 1 , (int)'y' , (int)'Y' , -1 , -1 , -1 } , + /* 16 */ { 1 , (int)'u' , (int)'U' , -1 , -1 , -1 } , + /* 17 */ { 1 , (int)'i' , (int)'I' , -1 , -1 , -1 } , + /* 18 */ { 1 , (int)'o' , (int)'O' , -1 , -1 , -1 } , + /* 19 */ { 1 , (int)'p' , (int)'P' , -1 , -1 , -1 } , + /* 1a */ { 1 , 0x00e5 , 0x00c5 , 0x001b , -1 , -1 } , + /* 1b */ { 0 , 0x00a8 , 0x005e , 0x001d , 0x007e , -1 } , + /* 1c */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 1d */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 1e */ { 1 , (int)'a' , (int)'A' , -1 , -1 , -1 } , + /* 1f */ { 1 , (int)'s' , (int)'S' , -1 , -1 , -1 } , + + /* 20 */ { 1 , (int)'d' , (int)'D' , -1 , -1 , -1 } , + /* 21 */ { 1 , (int)'f' , (int)'F' , -1 , -1 , -1 } , + /* 22 */ { 1 , (int)'g' , (int)'G' , -1 , -1 , -1 } , + /* 23 */ { 1 , (int)'h' , (int)'H' , -1 , -1 , -1 } , + /* 24 */ { 1 , (int)'j' , (int)'J' , -1 , -1 , -1 } , + /* 25 */ { 1 , (int)'k' , (int)'K' , -1 , -1 , -1 } , + /* 26 */ { 1 , (int)'l' , (int)'L' , -1 , -1 , -1 } , + /* 27 */ { 1 , 0x00f8 , 0x00d8 , -1 , -1 , -1 } , + /* 28 */ { 1 , 0x00e6 , 0x00c6 , -1 , -1 , -1 } , + /* 29 */ { 0 , 0x007c , 0x00a7 , 0x001c , -1 , -1 } , + /* 2a */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 2b */ { 0 , 0x27 , 0x002a , -1 , -1 , -1 } , + /* 2c */ { 1 , (int)'z' , (int)'Z' , -1 , -1 , -1 } , + /* 2d */ { 1 , (int)'x' , (int)'X' , -1 , -1 , -1 } , + /* 2e */ { 1 , (int)'c' , (int)'C' , -1 , -1 , -1 } , + /* 2f */ { 1 , (int)'v' , (int)'V' , -1 , -1 , -1 } , + + /* 30 */ { 1 , (int)'b' , (int)'B' , -1 , -1 , -1 } , + /* 31 */ { 1 , (int)'n' , (int)'N' , -1 , -1 , -1 } , + /* 32 */ { 1 , (int)'m' , (int)'M' , -1 , 0x00b5 , -1 } , + /* 33 */ { 0 , 0x002c , 0x003b , -1 , -1 , -1 } , + /* 34 */ { 0 , 0x002e , 0x003a , -1 , -1 , -1 } , + /* 35 */ { 0 , 0x002d , 0x005f , -1 , -1 , -1 } , + /* 36 */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 37 */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 38 */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 39 */ { 0 , 0x20 , 0x20 , 0x20 , -1 , -1 } , + /* 3a */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 3b */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 3c */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 3d */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 3e */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 3f */ { -1 , 0 , 0 , 0 , 0 , 0 } , + + /* 40 */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 41 */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 42 */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 43 */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 44 */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 45 */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 46 */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 47 */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 48 */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 49 */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 4a */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 4b */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 4c */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 4d */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 4e */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 4f */ { -1 , 0 , 0 , 0 , 0 , 0 } , + + /* 50 */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 51 */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 52 */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 53 */ { 0 , 0x002c , 0x002c , -1 , -1 , -1 } , + /* 54 */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 55 */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 56 */ { 0 , 0x003c , 0x003e , 0x001c , -1 , -1 } , + /* 57 */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 58 */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 59 */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 5a */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 5b */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 5c */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 5d */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 5e */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 5f */ { -1 , 0 , 0 , 0 , 0 , 0 } , + + }; + + public static final int DEADKEYS[] = { + 0x0060, 0x00b4, 0x00a8, 0x005e, 0x007e + }; + + //0x0060 => 0061 00e0 // a -> à + public static final int DEADKEY_LUT[][] = { + { 0x0060 , 0x0061 , 0x00e0 } , + { 0x0060 , 0x0065 , 0x00e8 } , + { 0x0060 , 0x0075 , 0x00f9 } , + { 0x0060 , 0x0069 , 0x00ec } , + { 0x0060 , 0x006f , 0x00f2 } , + { 0x0060 , 0x0041 , 0x00c0 } , + { 0x0060 , 0x0045 , 0x00c8 } , + { 0x0060 , 0x0055 , 0x00d9 } , + { 0x0060 , 0x0049 , 0x00cc } , + { 0x0060 , 0x004f , 0x00d2 } , + { 0x0060 , 0x0020 , 0x0060 } , + { 0x00b4 , 0x0061 , 0x00e1 } , + { 0x00b4 , 0x0065 , 0x00e9 } , + { 0x00b4 , 0x0075 , 0x00fa } , + { 0x00b4 , 0x0069 , 0x00ed } , + { 0x00b4 , 0x0079 , 0x00fd } , + { 0x00b4 , 0x006f , 0x00f3 } , + { 0x00b4 , 0x0041 , 0x00c1 } , + { 0x00b4 , 0x0045 , 0x00c9 } , + { 0x00b4 , 0x0055 , 0x00da } , + { 0x00b4 , 0x0049 , 0x00cd } , + { 0x00b4 , 0x0059 , 0x00dd } , + { 0x00b4 , 0x004f , 0x00d3 } , + { 0x00b4 , 0x0020 , 0x00b4 } , + { 0x00a8 , 0x0061 , 0x00e4 } , + { 0x00a8 , 0x0065 , 0x00eb } , + { 0x00a8 , 0x0075 , 0x00fc } , + { 0x00a8 , 0x0069 , 0x00ef } , + { 0x00a8 , 0x0079 , 0x00ff } , + { 0x00a8 , 0x006f , 0x00f6 } , + { 0x00a8 , 0x0041 , 0x00c4 } , + { 0x00a8 , 0x0045 , 0x00cb } , + { 0x00a8 , 0x0055 , 0x00dc } , + { 0x00a8 , 0x0049 , 0x00cf } , + { 0x00a8 , 0x004f , 0x00d6 } , + { 0x00a8 , 0x0020 , 0x00a8 } , + { 0x005e , 0x0061 , 0x00e2 } , + { 0x005e , 0x0065 , 0x00ea } , + { 0x005e , 0x0075 , 0x00fb } , + { 0x005e , 0x0069 , 0x00ee } , + { 0x005e , 0x006f , 0x00f4 } , + { 0x005e , 0x0041 , 0x00c2 } , + { 0x005e , 0x0045 , 0x00ca } , + { 0x005e , 0x0055 , 0x00db } , + { 0x005e , 0x0049 , 0x00ce } , + { 0x005e , 0x004f , 0x00d4 } , + { 0x005e , 0x0020 , 0x005e } , + { 0x007e , 0x006e , 0x00f1 } , + { 0x007e , 0x0061 , 0x00e3 } , + { 0x007e , 0x006f , 0x00f5 } , + { 0x007e , 0x004e , 0x00d1 } , + { 0x007e , 0x0041 , 0x00c3 } , + { 0x007e , 0x004f , 0x00d5 } , + { 0x007e , 0x0020 , 0x007e } , + }; + + + + private static NorwegianLayout instance = new NorwegianLayout(); + + private NorwegianLayout() { + } + + public static NorwegianLayout getInstance() { + return instance; + } + + @Override + public int[][] getLUT() { + return LUT; + } + + @Override + public void type(String text) { + super.type(LUT, DEADKEY_LUT, DEADKEYS, text, (byte)0); + } + + @Override + public void type(String text, byte modifiers) { + super.type(LUT, DEADKEY_LUT, DEADKEYS, text, modifiers); + } + + @Override + public char getChar(int scanCode, boolean capsLock, boolean shift, boolean altGr) { + return super.getChar(LUT, scanCode, capsLock, shift, altGr); + } + + @Override + public String getLocaleName() { + return LOCALE_NAME; + } + + @Override + public int[][] getDeadkeyLUT() { + return DEADKEY_LUT; + } + + @Override + public int[] getDeadkeys() { + return DEADKEYS; + } + +} + diff --git a/src/java/InputStickAPI/src/com/inputstick/api/layout/PortugueseBrazilianLayout.java b/src/java/InputStickAPI/src/com/inputstick/api/layout/PortugueseBrazilianLayout.java new file mode 100644 index 00000000..b863f2c6 --- /dev/null +++ b/src/java/InputStickAPI/src/com/inputstick/api/layout/PortugueseBrazilianLayout.java @@ -0,0 +1,226 @@ +package com.inputstick.api.layout; + +public class PortugueseBrazilianLayout extends KeyboardLayout { + +public static final String LOCALE_NAME = "pt-BR"; + + public static final int LUT[][] = { + /* 0 */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 1 */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 2 */ { 0 , (int)'1' , 0x21 , -1 , 0x00b9 , -1 } , + /* 3 */ { 0 , (int)'2' , 0x40 , -1 , 0x00b2 , -1 } , + /* 4 */ { 0 , (int)'3' , 0x23 , -1 , 0x00b3 , -1 } , + /* 5 */ { 0 , (int)'4' , 0x24 , -1 , 0x00a3 , -1 } , + /* 6 */ { 0 , (int)'5' , 0x25 , -1 , 0x00a2 , -1 } , + /* 7 */ { 0 , (int)'6' , 0x00a8 , -1 , 0x00ac , -1 } , + /* 8 */ { 0 , (int)'7' , 0x26 , -1 , -1 , -1 } , + /* 9 */ { 0 , (int)'8' , 0x002a , -1 , -1 , -1 } , + /* 0a */ { 0 , (int)'9' , 0x28 , -1 , -1 , -1 } , + /* 0b */ { 0 , (int)'0' , 0x29 , -1 , -1 , -1 } , + /* 0c */ { 0 , 0x002d , 0x005f , -1 , -1 , -1 } , + /* 0d */ { 0 , 0x003d , 0x002b , -1 , 0x00a7 , -1 } , + /* 0e */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 1f */ { -1 , 0 , 0 , 0 , 0 , 0 } , + + /* 10 */ { 1 , (int)'q' , (int)'Q' , -1 , 0x002f , -1 } , + /* 11 */ { 1 , (int)'w' , (int)'W' , -1 , 0x003f , -1 } , + /* 12 */ { 1 , (int)'e' , (int)'E' , -1 , 0x00b0 , -1 } , + /* 13 */ { 1 , (int)'r' , (int)'R' , -1 , -1 , -1 } , + /* 14 */ { 1 , (int)'t' , (int)'T' , -1 , -1 , -1 } , + /* 15 */ { 1 , (int)'y' , (int)'Y' , -1 , -1 , -1 } , + /* 16 */ { 1 , (int)'u' , (int)'U' , -1 , -1 , -1 } , + /* 17 */ { 1 , (int)'i' , (int)'I' , -1 , -1 , -1 } , + /* 18 */ { 1 , (int)'o' , (int)'O' , -1 , -1 , -1 } , + /* 19 */ { 1 , (int)'p' , (int)'P' , -1 , -1 , -1 } , + /* 1a */ { 0 , 0x00b4 , 0x0060 , -1 , -1 , -1 } , + /* 1b */ { 0 , 0x005b , 0x007b , 0x001b , 0x00aa , -1 } , + /* 1c */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 1d */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 1e */ { 1 , (int)'a' , (int)'A' , -1 , -1 , -1 } , + /* 1f */ { 1 , (int)'s' , (int)'S' , -1 , -1 , -1 } , + + /* 20 */ { 1 , (int)'d' , (int)'D' , -1 , -1 , -1 } , + /* 21 */ { 1 , (int)'f' , (int)'F' , -1 , -1 , -1 } , + /* 22 */ { 1 , (int)'g' , (int)'G' , -1 , -1 , -1 } , + /* 23 */ { 1 , (int)'h' , (int)'H' , -1 , -1 , -1 } , + /* 24 */ { 1 , (int)'j' , (int)'J' , -1 , -1 , -1 } , + /* 25 */ { 1 , (int)'k' , (int)'K' , -1 , -1 , -1 } , + /* 26 */ { 1 , (int)'l' , (int)'L' , -1 , -1 , -1 } , + /* 27 */ { 1 , 0x00e7 , 0x00c7 , 0x001d , -1 , -1 } , + /* 28 */ { 0 , 0x007e , 0x005e , -1 , -1 , -1 } , + /* 29 */ { 0 , 0x27 , 0x22 , -1 , -1 , -1 } , + /* 2a */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 2b */ { 0 , 0x005d , 0x007d , 0x001c , 0x00ba , -1 } , + /* 2c */ { 1 , (int)'z' , (int)'Z' , -1 , -1 , -1 } , + /* 2d */ { 1 , (int)'x' , (int)'X' , -1 , -1 , -1 } , + /* 2e */ { 1 , (int)'c' , (int)'C' , -1 , 0x20a2 , -1 } , + /* 2f */ { 1 , (int)'v' , (int)'V' , -1 , -1 , -1 } , + + /* 30 */ { 1 , (int)'b' , (int)'B' , -1 , -1 , -1 } , + /* 31 */ { 1 , (int)'n' , (int)'N' , -1 , -1 , -1 } , + /* 32 */ { 1 , (int)'m' , (int)'M' , -1 , -1 , -1 } , + /* 33 */ { 0 , 0x002c , 0x003c , -1 , -1 , -1 } , + /* 34 */ { 0 , 0x002e , 0x003e , -1 , -1 , -1 } , + /* 35 */ { 0 , 0x003b , 0x003a , -1 , -1 , -1 } , + /* 36 */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 37 */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 38 */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 39 */ { 0 , 0x20 , 0x20 , 0x20 , -1 , -1 } , + /* 3a */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 3b */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 3c */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 3d */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 3e */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 3f */ { -1 , 0 , 0 , 0 , 0 , 0 } , + + /* 40 */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 41 */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 42 */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 43 */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 44 */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 45 */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 46 */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 47 */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 48 */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 49 */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 4a */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 4b */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 4c */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 4d */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 4e */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 4f */ { -1 , 0 , 0 , 0 , 0 , 0 } , + + /* 50 */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 51 */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 52 */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 53 */ { 0 , 0x002c , 0x002c , -1 , -1 , -1 } , + /* 54 */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 55 */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 56 */ { 0 , 0x005c , 0x007c , 0x001c , -1 , -1 } , + /* 57 */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 58 */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 59 */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 5a */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 5b */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 5c */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 5d */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 5e */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 5f */ { -1 , 0 , 0 , 0 , 0 , 0 } , + + + /* 73 */ /*{ 0 , 002f , 003f , -1 , 00b0 , -1 } ,*/ + /* 7e */ /*{ 0 , 002e , 002e , -1 , -1 , -1 } ,*/ + + + + + }; + + public static final int DEADKEYS[] = { + 0x00a8, 0x00b4, 0x0060, 0x007e, 0x005e + }; + + public static final int DEADKEY_LUT[][] = { + { 0x00a8 , 0x0061 , 0x00e4 } , + { 0x00a8 , 0x0065 , 0x00eb } , + { 0x00a8 , 0x0075 , 0x00fc } , + { 0x00a8 , 0x0069 , 0x00ef } , + { 0x00a8 , 0x0079 , 0x00ff } , + { 0x00a8 , 0x006f , 0x00f6 } , + { 0x00a8 , 0x0041 , 0x00c4 } , + { 0x00a8 , 0x0045 , 0x00cb } , + { 0x00a8 , 0x0055 , 0x00dc } , + { 0x00a8 , 0x0049 , 0x00cf } , + { 0x00a8 , 0x004f , 0x00d6 } , + { 0x00a8 , 0x0020 , 0x00a8 } , + { 0x00b4 , 0x0061 , 0x00e1 } , + { 0x00b4 , 0x0065 , 0x00e9 } , + { 0x00b4 , 0x0075 , 0x00fa } , + { 0x00b4 , 0x0069 , 0x00ed } , + { 0x00b4 , 0x0079 , 0x00fd } , + { 0x00b4 , 0x006f , 0x00f3 } , + { 0x00b4 , 0x0041 , 0x00c1 } , + { 0x00b4 , 0x0045 , 0x00c9 } , + { 0x00b4 , 0x0055 , 0x00da } , + { 0x00b4 , 0x0049 , 0x00cd } , + { 0x00b4 , 0x0059 , 0x00dd } , + { 0x00b4 , 0x004f , 0x00d3 } , + { 0x00b4 , 0x0020 , 0x00b4 } , + { 0x0060 , 0x0061 , 0x00e0 } , + { 0x0060 , 0x0065 , 0x00e8 } , + { 0x0060 , 0x0075 , 0x00f9 } , + { 0x0060 , 0x0069 , 0x00ec } , + { 0x0060 , 0x006f , 0x00f2 } , + { 0x0060 , 0x0041 , 0x00c0 } , + { 0x0060 , 0x0045 , 0x00c8 } , + { 0x0060 , 0x0055 , 0x00d9 } , + { 0x0060 , 0x0049 , 0x00cc } , + { 0x0060 , 0x004f , 0x00d2 } , + { 0x0060 , 0x0020 , 0x0060 } , + { 0x007e , 0x006e , 0x00f1 } , + { 0x007e , 0x0061 , 0x00e3 } , + { 0x007e , 0x006f , 0x00f5 } , + { 0x007e , 0x004e , 0x00d1 } , + { 0x007e , 0x0041 , 0x00c3 } , + { 0x007e , 0x004f , 0x00d5 } , + { 0x007e , 0x0020 , 0x007e } , + { 0x005e , 0x0061 , 0x00e2 } , + { 0x005e , 0x0065 , 0x00ea } , + { 0x005e , 0x0075 , 0x00fb } , + { 0x005e , 0x0069 , 0x00ee } , + { 0x005e , 0x006f , 0x00f4 } , + { 0x005e , 0x0041 , 0x00c2 } , + { 0x005e , 0x0045 , 0x00ca } , + { 0x005e , 0x0055 , 0x00db } , + { 0x005e , 0x0049 , 0x00ce } , + { 0x005e , 0x004f , 0x00d4 } , + { 0x005e , 0x0020 , 0x005e } , + + }; + + private static PortugueseBrazilianLayout instance = new PortugueseBrazilianLayout(); + + private PortugueseBrazilianLayout() { + } + + public static PortugueseBrazilianLayout getInstance() { + return instance; + } + + @Override + public int[][] getLUT() { + return LUT; + } + + @Override + public void type(String text) { + super.type(LUT, DEADKEY_LUT, DEADKEYS, text, (byte)0); + } + + @Override + public void type(String text, byte modifiers) { + super.type(LUT, DEADKEY_LUT, DEADKEYS, text, modifiers); + } + + @Override + public char getChar(int scanCode, boolean capsLock, boolean shift, boolean altGr) { + return super.getChar(LUT, scanCode, capsLock, shift, altGr); + } + + @Override + public String getLocaleName() { + return LOCALE_NAME; + } + + @Override + public int[][] getDeadkeyLUT() { + return DEADKEY_LUT; + } + + @Override + public int[] getDeadkeys() { + return DEADKEYS; + } + + +} diff --git a/src/java/InputStickAPI/src/com/inputstick/api/layout/SlovakLayout.java b/src/java/InputStickAPI/src/com/inputstick/api/layout/SlovakLayout.java new file mode 100644 index 00000000..8cf34f6b --- /dev/null +++ b/src/java/InputStickAPI/src/com/inputstick/api/layout/SlovakLayout.java @@ -0,0 +1,299 @@ +package com.inputstick.api.layout; + +public class SlovakLayout extends KeyboardLayout { + + public static final String LOCALE_NAME = "sk-SK"; + + public static final int LUT[][] = { + /* 0 */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 1 */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 2 */ { 0 , 0x02b , (int)'1' , -1 , 0x007 , 0 } , + /* 3 */ { 0 , 0x13e , (int)'2' , -1 , 0x2c7 , 0 } , + /* 4 */ { 0 , 0x161 , (int)'3' , -1 , 0x05e , 0 } , + /* 5 */ { 0 , 0x10d , (int)'4' , -1 , 0x2d8 , 0 } , + /* 6 */ { 0 , 0x165 , (int)'5' , -1 , 0x0b0 , 0 } , + /* 7 */ { 0 , 0x17e , (int)'6' , -1 , 0x2db , 0 } , + /* 8 */ { 0 , 0x0fd , (int)'7' , -1 , 0x060 , 0 } , + /* 9 */ { 0 , 0x0e1 , (int)'8' , -1 , 0x2d9 , 0 } , + /* 0a */ { 0 , 0x0ed , (int)'9' , -1 , 0x0b4 , 0 } , + /* 0b */ { 0 , 0x0e9 , (int)'0' , -1 , 0x2dd , 0 } , + /* 0c */ { 0 , 0x03d , 0x025 , -1 , 0x0a8 , 0 } , + /* 0d */ { 0 , 0x0b4 , 0x2c7 , -1 , 0x0b8 , 0 } , + /* 0e */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 0f */ { -1 , 0 , 0 , 0 , 0 , 0 } , + + /* 10 */ { 1 , 'q' , 'Q' , -1 , 0x05c , 0 } , + /* 11 */ { 1 , 'w' , 'W' , -1 , 0x07c , 0 } , + /* 12 */ { 1 , 'e' , 'E' , -1 , 0x20ac , 0 } , + /* 13 */ { 1 , 'r' , 'R' , -1 , -1 , 0 } , + /* 14 */ { 1 , 't' , 'T' , -1 , -1 , 0 } , + /* 15 */ { 1 , 'y' , 'Y' , -1 , -1 , 0 } , + /* 16 */ { 1 , 'u' , 'U' , -1 , -1 , 0 } , + /* 17 */ { 1 , 'i' , 'I' , -1 , -1 , 0 } , + /* 18 */ { 1 , 'o' , 'O' , -1 , -1 , 0 } , + /* 19 */ { 1 , 'p' , 'P' , -1 , 0x027 , 0 } , + /* 1a */ { 0 , 0x0fa , 0x02f , -1 , 0x0f7 , 0 } , + /* 1b */ { 0 , 0x0e4 , 0x028 , 0x01b , 0x0d7 , 0 } , + /* 1c */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 1d */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 1e */ { 1 , 'a' , 'A' , -1 , -1 , 0 } , + /* 1f */ { 1 , 's' , 'S' , -1 , 0x111 , 0 } , + + /* 20 */ { 1 , 'd' , 'D' , -1 , 0x110 , 0 } , + /* 21 */ { 1 , 'f' , 'F' , -1 , 0x05b , 0 } , + /* 22 */ { 1 , 'g' , 'G' , -1 , 0x05d , 0 } , + /* 23 */ { 1 , 'h' , 'H' , -1 , -1 , 0 } , + /* 24 */ { 1 , 'j' , 'J' , -1 , -1 , 0 } , + /* 25 */ { 1 , 'k' , 'K' , -1 , 0x142 , 0 } , + /* 26 */ { 1 , 'l' , 'L' , -1 , 0x141 , 0 } , + /* 27 */ { 0 , 0x0f4 , 0x022 , 0x01d , 0x024 , 0 } , + /* 28 */ { 0 , 0x0a7 , 0x021 , -1 , 0x0df , 0 } , + /* 29 */ { 0 , 0x03b , 0x0b0 , -1 , -1 , 0 } , + /* 2a */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 2b */ { 0 , 0x148 , 0x029 , 0x01c , 0x0a4 , 0 } , + /* 2c */ { 1 , 'z' , 'Z' , -1 , 0x03e , 0 } , + /* 2d */ { 1 , 'x' , 'X' , -1 , 0x023 , 0 } , + /* 2e */ { 1 , 'c' , 'C' , -1 , 0x026 , 0 } , + /* 2f */ { 1 , 'v' , 'V' , -1 , 0x040 , 0 } , + + /* 30 */ { 1 , 'b' , 'B' , -1 , 0x07b , 0 } , + /* 31 */ { 1 , 'n' , 'N' , -1 , 0x07d , 0 } , + /* 32 */ { 1 , 'm' , 'M' , -1 , -1 , 0 } , + /* 33 */ { 0 , 0x02c , 0x03f , -1 , 0x03c , 0 } , + /* 34 */ { 0 , 0x02e , 0x03a , -1 , 0x03e , 0 } , + /* 35 */ { 0 , 0x02d , 0x05f , -1 , 0x02a , 0 } , + /* 36 */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 37 */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 38 */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 39 */ { 0 , 0x020 , 0x020 , 0x020 , -1 , 0 } , + /* 3a */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 3b */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 3c */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 3d */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 3e */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 3f */ { -1 , 0 , 0 , 0 , 0 , 0 } , + + /* 40 */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 41 */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 42 */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 43 */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 44 */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 45 */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 46 */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 47 */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 48 */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 49 */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 4a */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 4b */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 4c */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 4d */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 4e */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 4f */ { -1 , 0 , 0 , 0 , 0 , 0 } , + + /* 50 */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 51 */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 52 */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 53 */ { 0 , 0x02c , 0x02c , -1 , -1 , 0 } , + /* 54 */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 55 */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 56 */ { 0 , 0x026 , 0x02a , 0x01c , 0x03c , 0 } , + /* 57 */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 58 */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 59 */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 5a */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 5b */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 5c */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 5d */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 5e */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 5f */ { -1 , 0 , 0 , 0 , 0 , 0 } , + + + + }; + + public static final int DEADKEYS[] = { + 0x02c7, 0x005e, 0x02d8, 0x00b0, 0x02db, 0x02d9, 0x00b4, 0x02dd, 0x00a8, 0x00b4, 0x02c7, 0x00b8, 0x00b0 + }; + + public static final int DEADKEY_LUT[][] = { + { 0x02c7 , 0x006e , 0x0148 } , + { 0x02c7 , 0x0063 , 0x010d } , + { 0x02c7 , 0x007a , 0x017e } , + { 0x02c7 , 0x0064 , 0x010f } , + { 0x02c7 , 0x0073 , 0x0161 } , + { 0x02c7 , 0x006c , 0x013e } , + { 0x02c7 , 0x0065 , 0x011b } , + { 0x02c7 , 0x0072 , 0x0159 } , + { 0x02c7 , 0x0074 , 0x0165 } , + { 0x02c7 , 0x004e , 0x0147 } , + { 0x02c7 , 0x0043 , 0x010c } , + { 0x02c7 , 0x005a , 0x017d } , + { 0x02c7 , 0x0044 , 0x010e } , + { 0x02c7 , 0x0053 , 0x0160 } , + { 0x02c7 , 0x004c , 0x013d } , + { 0x02c7 , 0x0045 , 0x011a } , + { 0x02c7 , 0x0052 , 0x0158 } , + { 0x02c7 , 0x0054 , 0x0164 } , + { 0x02c7 , 0x0020 , 0x02c7 } , + { 0x005e , 0x0061 , 0x00e2 } , + { 0x005e , 0x0069 , 0x00ee } , + { 0x005e , 0x006f , 0x00f4 } , + { 0x005e , 0x0041 , 0x00c2 } , + { 0x005e , 0x0049 , 0x00ce } , + { 0x005e , 0x004f , 0x00d4 } , + { 0x005e , 0x0020 , 0x005e } , + { 0x005e , 0x0061 , 0x0103 } , + { 0x005e , 0x0041 , 0x0102 } , + { 0x005e , 0x0020 , 0x02d8 } , + { 0x00b0 , 0x0075 , 0x016f } , + { 0x00b0 , 0x0055 , 0x016e } , + { 0x00b0 , 0x0020 , 0x00b0 } , + { 0x02db , 0x0061 , 0x0105 } , + { 0x02db , 0x0065 , 0x0119 } , + { 0x02db , 0x0041 , 0x0104 } , + { 0x02db , 0x0045 , 0x0118 } , + { 0x02db , 0x0020 , 0x02db } , + { 0x02d9 , 0x007a , 0x017c } , + { 0x02d9 , 0x005a , 0x017b } , + { 0x02d9 , 0x0020 , 0x02d9 } , + { 0x00b4 , 0x006e , 0x0144 } , + { 0x00b4 , 0x0063 , 0x0107 } , + { 0x00b4 , 0x007a , 0x017a } , + { 0x00b4 , 0x0061 , 0x00e1 } , + { 0x00b4 , 0x0073 , 0x015b } , + { 0x00b4 , 0x006c , 0x013a } , + { 0x00b4 , 0x0065 , 0x00e9 } , + { 0x00b4 , 0x0072 , 0x0155 } , + { 0x00b4 , 0x0075 , 0x00fa } , + { 0x00b4 , 0x0069 , 0x00ed } , + { 0x00b4 , 0x0079 , 0x00fd } , + { 0x00b4 , 0x006f , 0x00f3 } , + { 0x00b4 , 0x004e , 0x0143 } , + { 0x00b4 , 0x0043 , 0x0106 } , + { 0x00b4 , 0x005a , 0x0179 } , + { 0x00b4 , 0x0041 , 0x00c1 } , + { 0x00b4 , 0x0053 , 0x015a } , + { 0x00b4 , 0x004c , 0x0139 } , + { 0x00b4 , 0x0045 , 0x00c9 } , + { 0x00b4 , 0x0052 , 0x0154 } , + { 0x00b4 , 0x0055 , 0x00da } , + { 0x00b4 , 0x0049 , 0x00cd } , + { 0x00b4 , 0x0059 , 0x00dd } , + { 0x00b4 , 0x004f , 0x00d3 } , + { 0x00b4 , 0x0020 , 0x00b4 } , + { 0x02dd , 0x0075 , 0x0171 } , + { 0x02dd , 0x006f , 0x0151 } , + { 0x02dd , 0x0055 , 0x0170 } , + { 0x02dd , 0x004f , 0x0150 } , + { 0x02dd , 0x0020 , 0x02dd } , + { 0x00a8 , 0x0061 , 0x00e4 } , + { 0x00a8 , 0x0065 , 0x00eb } , + { 0x00a8 , 0x0075 , 0x00fc } , + { 0x00a8 , 0x006f , 0x00f6 } , + { 0x00a8 , 0x0041 , 0x00c4 } , + { 0x00a8 , 0x0045 , 0x00cb } , + { 0x00a8 , 0x0055 , 0x00dc } , + { 0x00a8 , 0x004f , 0x00d6 } , + { 0x00a8 , 0x0020 , 0x00a8 } , + { 0x00b4 , 0x006e , 0x0144 } , + { 0x00b4 , 0x0063 , 0x0107 } , + { 0x00b4 , 0x007a , 0x017a } , + { 0x00b4 , 0x0061 , 0x00e1 } , + { 0x00b4 , 0x0073 , 0x015b } , + { 0x00b4 , 0x006c , 0x013a } , + { 0x00b4 , 0x0065 , 0x00e9 } , + { 0x00b4 , 0x0072 , 0x0155 } , + { 0x00b4 , 0x0075 , 0x00fa } , + { 0x00b4 , 0x0069 , 0x00ed } , + { 0x00b4 , 0x0079 , 0x00fd } , + { 0x00b4 , 0x006f , 0x00f3 } , + { 0x00b4 , 0x004e , 0x0143 } , + { 0x00b4 , 0x0043 , 0x0106 } , + { 0x00b4 , 0x005a , 0x0179 } , + { 0x00b4 , 0x0041 , 0x00c1 } , + { 0x00b4 , 0x0053 , 0x015a } , + { 0x00b4 , 0x004c , 0x0139 } , + { 0x00b4 , 0x0045 , 0x00c9 } , + { 0x00b4 , 0x0052 , 0x0154 } , + { 0x00b4 , 0x0055 , 0x00da } , + { 0x00b4 , 0x0049 , 0x00cd } , + { 0x00b4 , 0x0059 , 0x00dd } , + { 0x00b4 , 0x004f , 0x00d3 } , + { 0x00b4 , 0x0020 , 0x00b4 } , + { 0x02c7 , 0x006e , 0x0148 } , + { 0x02c7 , 0x0063 , 0x010d } , + { 0x02c7 , 0x007a , 0x017e } , + { 0x02c7 , 0x0064 , 0x010f } , + { 0x02c7 , 0x0073 , 0x0161 } , + { 0x02c7 , 0x006c , 0x013e } , + { 0x02c7 , 0x0065 , 0x011b } , + { 0x02c7 , 0x0072 , 0x0159 } , + { 0x02c7 , 0x0074 , 0x0165 } , + { 0x02c7 , 0x004e , 0x0147 } , + { 0x02c7 , 0x0043 , 0x010c } , + { 0x02c7 , 0x005a , 0x017d } , + { 0x02c7 , 0x0044 , 0x010e } , + { 0x02c7 , 0x0053 , 0x0160 } , + { 0x02c7 , 0x004c , 0x013d } , + { 0x02c7 , 0x0045 , 0x011a } , + { 0x02c7 , 0x0052 , 0x0158 } , + { 0x02c7 , 0x0054 , 0x0164 } , + { 0x02c7 , 0x0020 , 0x02c7 } , + { 0x00b8 , 0x0063 , 0x00e7 } , + { 0x00b8 , 0x0073 , 0x015f } , + { 0x00b8 , 0x0074 , 0x0163 } , + { 0x00b8 , 0x0043 , 0x00c7 } , + { 0x00b8 , 0x0053 , 0x015e } , + { 0x00b8 , 0x0054 , 0x0162 } , + { 0x00b8 , 0x0020 , 0x00b8 } , + { 0x00b0 , 0x0075 , 0x016f } , + { 0x00b0 , 0x0055 , 0x016e } , + { 0x00b0 , 0x0020 , 0x00b0 } , + + }; + + private static SlovakLayout instance = new SlovakLayout(); + + private SlovakLayout() { + } + + public static SlovakLayout getInstance() { + return instance; + } + + @Override + public int[][] getLUT() { + return LUT; + } + + @Override + public void type(String text) { + super.type(LUT, DEADKEY_LUT, DEADKEYS, text, (byte)0); + } + + @Override + public void type(String text, byte modifiers) { + super.type(LUT, DEADKEY_LUT, DEADKEYS, text, modifiers); + } + + @Override + public char getChar(int scanCode, boolean capsLock, boolean shift, boolean altGr) { + return super.getChar(LUT, scanCode, capsLock, shift, altGr); + } + + @Override + public String getLocaleName() { + return LOCALE_NAME; + } + + @Override + public int[][] getDeadkeyLUT() { + return DEADKEY_LUT; + } + + @Override + public int[] getDeadkeys() { + return DEADKEYS; + } + +} diff --git a/src/java/InputStickAPI/src/com/inputstick/api/layout/SpanishLayout.java b/src/java/InputStickAPI/src/com/inputstick/api/layout/SpanishLayout.java new file mode 100644 index 00000000..3a9e6a91 --- /dev/null +++ b/src/java/InputStickAPI/src/com/inputstick/api/layout/SpanishLayout.java @@ -0,0 +1,222 @@ +package com.inputstick.api.layout; + +public class SpanishLayout extends KeyboardLayout { + + public static final String LOCALE_NAME = "es-ES"; + + public static final int LUT[][] = { + /* 0 */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 1 */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 2 */ { 0 , (int)'1' , 0x21 , -1 , 0x007c , -1 } , + /* 3 */ { 0 , (int)'2' , 0x22 , -1 , 0x40 , -1 } , + /* 4 */ { 0 , (int)'3' , 0x00b7 , -1 , 0x23 , -1 } , + /* 5 */ { 0 , (int)'4' , 0x24 , -1 , 0x007e , -1 } , + /* 6 */ { 0 , (int)'5' , 0x25 , -1 , 0x20ac , -1 } , + /* 7 */ { 0 , (int)'6' , 0x26 , -1 , 0x00ac , -1 } , + /* 8 */ { 0 , (int)'7' , 0x002f , -1 , -1 , -1 } , + /* 9 */ { 0 , (int)'8' , 0x28 , -1 , -1 , -1 } , + /* 0a */ { 0 , (int)'9' , 0x29 , -1 , -1 , -1 } , + /* 0b */ { 0 , (int)'0' , 0x003d , -1 , -1 , -1 } , + /* 0c */ { 0 , 0x27 , 0x003f , -1 , -1 , -1 } , + /* 0d */ { 0 , 0x00a1 , 0x00bf , -1 , -1 , -1 } , + /* 1e */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 1f */ { -1 , 0 , 0 , 0 , 0 , 0 } , + + /* 10 */ { 1 , (int)'q' , (int)'Q' , -1 , -1 , -1 } , + /* 11 */ { 1 , (int)'w' , (int)'W' , -1 , -1 , -1 } , + /* 12 */ { 1 , (int)'e' , (int)'E' , -1 , 0x20ac , -1 } , + /* 13 */ { 1 , (int)'r' , (int)'R' , -1 , -1 , -1 } , + /* 14 */ { 1 , (int)'t' , (int)'T' , -1 , -1 , -1 } , + /* 15 */ { 1 , (int)'y' , (int)'Y' , -1 , -1 , -1 } , + /* 16 */ { 1 , (int)'u' , (int)'U' , -1 , -1 , -1 } , + /* 17 */ { 1 , (int)'i' , (int)'I' , -1 , -1 , -1 } , + /* 18 */ { 1 , (int)'o' , (int)'O' , -1 , -1 , -1 } , + /* 19 */ { 1 , (int)'p' , (int)'P' , -1 , -1 , -1 } , + /* 1a */ { 0 , 0x0060 , 0x005e , 0x001b , 0x005b , -1 } , + /* 1b */ { 0 , 0x002b , 0x002a , 0x001d , 0x005d , -1 } , + /* 1c */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 1d */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 1e */ { 1 , (int)'a' , (int)'A' , -1 , -1 , -1 } , + /* 1f */ { 1 , (int)'s' , (int)'S' , -1 , -1 , -1 } , + + + + /* 20 */ { 1 , (int)'d' , (int)'D' , -1 , -1 , -1 } , + /* 21 */ { 1 , (int)'f' , (int)'F' , -1 , -1 , -1 } , + /* 22 */ { 1 , (int)'g' , (int)'G' , -1 , -1 , -1 } , + /* 23 */ { 1 , (int)'h' , (int)'H' , -1 , -1 , -1 } , + /* 24 */ { 1 , (int)'j' , (int)'J' , -1 , -1 , -1 } , + /* 25 */ { 1 , (int)'k' , (int)'K' , -1 , -1 , -1 } , + /* 26 */ { 1 , (int)'l' , (int)'L' , -1 , -1 , -1 } , + /* 27 */ { 1 , 0x00f1 , 0x00d1 , -1 , -1 , -1 } , + /* 28 */ { 0 , 0x00b4 , 0x00a8 , -1 , 0x007b , -1 } , + /* 29 */ { 0 , 0x00ba , 0x00aa , -1 , 0x005c , -1 } , + /* 2a */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 2b */ { 1 , 0x00e7 , 0x00c7 , 0x001c , 0x007d , -1 } , + /* 2c */ { 1 , (int)'z' , (int)'Z' , -1 , -1 , -1 } , + /* 2d */ { 1 , (int)'x' , (int)'X' , -1 , -1 , -1 } , + /* 2e */ { 1 , (int)'c' , (int)'C' , -1 , -1 , -1 } , + /* 2f */ { 1 , (int)'v' , (int)'V' , -1 , -1 , -1 } , + + + /* 30 */ { 1 , (int)'b' , (int)'B' , -1 , -1 , -1 } , + /* 31 */ { 1 , (int)'n' , (int)'N' , -1 , -1 , -1 } , + /* 32 */ { 1 , (int)'m' , (int)'M' , -1 , -1 , -1 } , + /* 33 */ { 0 , 0x002c , 0x003b , -1 , -1 , -1 } , + /* 34 */ { 0 , 0x002e , 0x003a , -1 , -1 , -1 } , + /* 35 */ { 0 , 0x002d , 0x005f , -1 , -1 , -1 } , + /* 36 */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 37 */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 38 */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 39 */ { 0 , 0x20 , 0x20 , 20 , -1 , -1 } , + /* 3a */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 3b */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 3c */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 3d */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 3e */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 3f */ { -1 , 0 , 0 , 0 , 0 , 0 } , + + /* 40 */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 41 */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 42 */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 43 */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 44 */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 45 */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 46 */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 47 */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 48 */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 49 */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 4a */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 4b */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 4c */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 4d */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 4e */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 4f */ { -1 , 0 , 0 , 0 , 0 , 0 } , + + + /* 50 */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 51 */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 52 */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 53 */ { 0 , 0x002e , 0x002e , -1 , -1 , -1 } , + /* 54 */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 55 */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 56 */ { 0 , 0x003c , 0x003e , 0x001c , -1 , -1 } , + /* 57 */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 58 */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 59 */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 5a */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 5b */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 5c */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 5d */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 5e */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 5f */ { -1 , 0 , 0 , 0 , 0 , 0 } , + + }; + + public static final int DEADKEYS[] = { + 0x007e, 0x0060, 0x005e, 0x00b4,0x00a8 + }; + + public static final int DEADKEY_LUT[][] = { + { 0x007e , 0x006e , 0x00f1 } , + { 0x007e , 0x0061 , 0x00e3 } , + { 0x007e , 0x006f , 0x00f5 } , + { 0x007e , 0x004e , 0x00d1 } , + { 0x007e , 0x0041 , 0x00c3 } , + { 0x007e , 0x004f , 0x00d5 } , + { 0x007e , 0x0020 , 0x007e } , + { 0x0060 , 0x0061 , 0x00e0 } , + { 0x0060 , 0x0065 , 0x00e8 } , + { 0x0060 , 0x0075 , 0x00f9 } , + { 0x0060 , 0x0069 , 0x00ec } , + { 0x0060 , 0x006f , 0x00f2 } , + { 0x0060 , 0x0041 , 0x00c0 } , + { 0x0060 , 0x0045 , 0x00c8 } , + { 0x0060 , 0x0055 , 0x00d9 } , + { 0x0060 , 0x0049 , 0x00cc } , + { 0x0060 , 0x004f , 0x00d2 } , + { 0x0060 , 0x0020 , 0x0060 } , + { 0x005e , 0x0061 , 0x00e2 } , + { 0x005e , 0x0065 , 0x00ea } , + { 0x005e , 0x0075 , 0x00fb } , + { 0x005e , 0x0069 , 0x00ee } , + { 0x005e , 0x006f , 0x00f4 } , + { 0x005e , 0x0041 , 0x00c2 } , + { 0x005e , 0x0045 , 0x00ca } , + { 0x005e , 0x0055 , 0x00db } , + { 0x005e , 0x0049 , 0x00ce } , + { 0x005e , 0x004f , 0x00d4 } , + { 0x005e , 0x0020 , 0x005e } , + { 0x00b4 , 0x0061 , 0x00e1 } , + { 0x00b4 , 0x0065 , 0x00e9 } , + { 0x00b4 , 0x0075 , 0x00fa } , + { 0x00b4 , 0x0069 , 0x00ed } , + { 0x00b4 , 0x0079 , 0x00fd } , + { 0x00b4 , 0x006f , 0x00f3 } , + { 0x00b4 , 0x0041 , 0x00c1 } , + { 0x00b4 , 0x0045 , 0x00c9 } , + { 0x00b4 , 0x0055 , 0x00da } , + { 0x00b4 , 0x0049 , 0x00cd } , + { 0x00b4 , 0x0059 , 0x00dd } , + { 0x00b4 , 0x004f , 0x00d3 } , + { 0x00b4 , 0x0020 , 0x00b4 } , + { 0x00a8 , 0x0061 , 0x00e4 } , + { 0x00a8 , 0x0065 , 0x00eb } , + { 0x00a8 , 0x0075 , 0x00fc } , + { 0x00a8 , 0x0069 , 0x00ef } , + { 0x00a8 , 0x0079 , 0x00ff } , + { 0x00a8 , 0x006f , 0x00f6 } , + { 0x00a8 , 0x0041 , 0x00c4 } , + { 0x00a8 , 0x0045 , 0x00cb } , + { 0x00a8 , 0x0055 , 0x00dc } , + { 0x00a8 , 0x0049 , 0x00cf } , + { 0x00a8 , 0x004f , 0x00d6 } , + { 0x00a8 , 0x0020 , 0x00a8 } , + }; + + private static SpanishLayout instance = new SpanishLayout(); + + private SpanishLayout() { + } + + public static SpanishLayout getInstance() { + return instance; + } + + @Override + public int[][] getLUT() { + return LUT; + } + + @Override + public void type(String text) { + super.type(LUT, DEADKEY_LUT, DEADKEYS, text, (byte)0); + } + + @Override + public void type(String text, byte modifiers) { + super.type(LUT, DEADKEY_LUT, DEADKEYS, text, modifiers); + } + + @Override + public char getChar(int scanCode, boolean capsLock, boolean shift, boolean altGr) { + return super.getChar(LUT, scanCode, capsLock, shift, altGr); + } + + @Override + public String getLocaleName() { + return LOCALE_NAME; + } + + @Override + public int[][] getDeadkeyLUT() { + return DEADKEY_LUT; + } + + @Override + public int[] getDeadkeys() { + return DEADKEYS; + } + +} + diff --git a/src/java/InputStickAPI/src/com/inputstick/api/layout/SwedishLayout.java b/src/java/InputStickAPI/src/com/inputstick/api/layout/SwedishLayout.java new file mode 100644 index 00000000..5d12b6e3 --- /dev/null +++ b/src/java/InputStickAPI/src/com/inputstick/api/layout/SwedishLayout.java @@ -0,0 +1,218 @@ +package com.inputstick.api.layout; + +public class SwedishLayout extends KeyboardLayout { + + public static final String LOCALE_NAME = "sv-SE"; + + public static final int LUT[][] = { + /* 0 */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 1 */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 2 */ { 0 , (int)'1' , 0x21 , -1 , -1 , -1 } , + /* 3 */ { 0 , (int)'2' , 0x22 , -1 , 0x40 , -1 } , + /* 4 */ { 0 , (int)'3' , 0x23 , -1 , 0x00a3 , -1 } , + /* 5 */ { 0 , (int)'4' , 0x00a4 , -1 , 0x24 , -1 } , + /* 6 */ { 0 , (int)'5' , 0x25 , -1 , 0x20ac , -1 } , + /* 7 */ { 0 , (int)'6' , 0x26 , -1 , -1 , -1 } , + /* 8 */ { 0 , (int)'7' , 0x002f , -1 , 0x007b , -1 } , + /* 9 */ { 0 , (int)'8' , 0x28 , -1 , 0x005b , -1 } , + /* 0a */ { 0 , (int)'9' , 0x29 , -1 , 0x005d , -1 } , + /* 0b */ { 0 , (int)'0' , 0x003d , -1 , 0x007d , -1 } , + /* 0c */ { 0 , 0x002b , 0x003f , -1 , 0x005c , -1 } , + /* 0d */ { 0 , 0x00b4 , 0x0060 , -1 , -1 , -1 } , + /* 0e */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 0f */ { -1 , 0 , 0 , 0 , 0 , 0 } , + + /* 10 */ { 1 , (int)'q' , (int)'Q' , -1 , -1 , -1 } , + /* 11 */ { 1 , (int)'w' , (int)'W' , -1 , -1 , -1 } , + /* 12 */ { 1 , (int)'e' , (int)'E' , -1 , 0x20ac , -1 } , + /* 13 */ { 1 , (int)'r' , (int)'R' , -1 , -1 , -1 } , + /* 14 */ { 1 , (int)'t' , (int)'T' , -1 , -1 , -1 } , + /* 15 */ { 1 , (int)'y' , (int)'Y' , -1 , -1 , -1 } , + /* 16 */ { 1 , (int)'u' , (int)'U' , -1 , -1 , -1 } , + /* 17 */ { 1 , (int)'i' , (int)'I' , -1 , -1 , -1 } , + /* 18 */ { 1 , (int)'o' , (int)'O' , -1 , -1 , -1 } , + /* 19 */ { 1 , (int)'p' , (int)'P' , -1 , -1 , -1 } , + /* 1a */ { 1 , 0x00e5 , 0x00c5 , 0x001b , -1 , -1 } , + /* 1b */ { 0 , 0x00a8 , 0x005e , 0x001d , 0x007e , -1 } , + /* 1c */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 1d */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 1e */ { 1 , (int)'a' , (int)'A' , -1 , -1 , -1 } , + /* 1f */ { 1 , (int)'s' , (int)'S' , -1 , -1 , -1 } , + + /* 20 */ { 1 , (int)'d' , (int)'D' , -1 , -1 , -1 } , + /* 21 */ { 1 , (int)'f' , (int)'F' , -1 , -1 , -1 } , + /* 22 */ { 1 , (int)'g' , (int)'G' , -1 , -1 , -1 } , + /* 23 */ { 1 , (int)'h' , (int)'H' , -1 , -1 , -1 } , + /* 24 */ { 1 , (int)'j' , (int)'J' , -1 , -1 , -1 } , + /* 25 */ { 1 , (int)'k' , (int)'K' , -1 , -1 , -1 } , + /* 26 */ { 1 , (int)'l' , (int)'L' , -1 , -1 , -1 } , + /* 27 */ { 1 , 0x00f6 , 0x00d6 , -1 , -1 , -1 } , + /* 28 */ { 1 , 0x00e4 , 0x00c4 , -1 , -1 , -1 } , + /* 29 */ { 0 , 0x00a7 , 0x00bd , 0x001c , -1 , -1 } , + /* 2a */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 2b */ { 0 , 0x27 , 0x002a , -1 , -1 , -1 } , + /* 2c */ { 1 , (int)'z' , (int)'Z' , -1 , -1 , -1 } , + /* 2d */ { 1 , (int)'x' , (int)'X' , -1 , -1 , -1 } , + /* 2e */ { 1 , (int)'c' , (int)'C' , -1 , -1 -1 } , + /* 2f */ { 1 , (int)'v' , (int)'V' , -1 , -1 , -1 } , + + /* 30 */ { 1 , (int)'b' , (int)'B' , -1 , -1 , -1 } , + /* 31 */ { 1 , (int)'n' , (int)'N' , -1 , -1 , -1 } , + /* 32 */ { 1 , (int)'m' , (int)'M' , -1 , 0x00b5 , -1 } , + /* 33 */ { 0 , 0x002c , 0x003b , -1 , -1 , -1 } , + /* 34 */ { 0 , 0x002e , 0x003a , -1 , -1 , -1 } , + /* 35 */ { 0 , 0x002d , 0x005f , -1 , -1 , -1 } , + /* 36 */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 37 */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 38 */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 39 */ { 0 , 0x20 , 0x20 , 0x20 , -1 , -1 } , + /* 3a */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 3b */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 3c */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 3d */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 3e */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 3f */ { -1 , 0 , 0 , 0 , 0 , 0 } , + + /* 40 */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 41 */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 42 */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 43 */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 44 */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 45 */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 46 */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 47 */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 48 */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 49 */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 4a */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 4b */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 4c */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 4d */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 4e */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 4f */ { -1 , 0 , 0 , 0 , 0 , 0 } , + + /* 50 */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 51 */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 52 */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 53 */ { 0 , 0x002c , 0x002c , -1 , -1 , -1 } , + /* 54 */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 55 */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 56 */ { 0 , 0x003c , 0x003e , 0x001c , 0x007c , -1 } , + /* 57 */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 58 */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 59 */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 5a */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 5b */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 5c */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 5d */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 5e */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 5f */ { -1 , 0 , 0 , 0 , 0 , 0 } , + + }; + + public static final int DEADKEYS[] = { + 0x0060, 0x00b4, 0x005e, 0x00a8, 0x007e + }; + + public static final int DEADKEY_LUT[][] = { + { 0x00b4 , 0x0061 , 0x00e1 } , + { 0x00b4 , 0x0065 , 0x00e9 } , + { 0x00b4 , 0x0075 , 0x00fa } , + { 0x00b4 , 0x0069 , 0x00ed } , + { 0x00b4 , 0x0079 , 0x00fd } , + { 0x00b4 , 0x006f , 0x00f3 } , + { 0x00b4 , 0x0041 , 0x00c1 } , + { 0x00b4 , 0x0045 , 0x00c9 } , + { 0x00b4 , 0x0055 , 0x00da } , + { 0x00b4 , 0x0049 , 0x00cd } , + { 0x00b4 , 0x0059 , 0x00dd } , + { 0x00b4 , 0x004f , 0x00d3 } , + { 0x00b4 , 0x0020 , 0x00b4 } , + { 0x0060 , 0x0061 , 0x00e0 } , + { 0x0060 , 0x0065 , 0x00e8 } , + { 0x0060 , 0x0075 , 0x00f9 } , + { 0x0060 , 0x0069 , 0x00ec } , + { 0x0060 , 0x006f , 0x00f2 } , + { 0x0060 , 0x0041 , 0x00c0 } , + { 0x0060 , 0x0045 , 0x00c8 } , + { 0x0060 , 0x0055 , 0x00d9 } , + { 0x0060 , 0x0049 , 0x00cc } , + { 0x0060 , 0x004f , 0x00d2 } , + { 0x0060 , 0x0020 , 0x0060 } , + { 0x00a8 , 0x0061 , 0x00e4 } , + { 0x00a8 , 0x0065 , 0x00eb } , + { 0x00a8 , 0x0075 , 0x00fc } , + { 0x00a8 , 0x0069 , 0x00ef } , + { 0x00a8 , 0x0079 , 0x00ff } , + { 0x00a8 , 0x006f , 0x00f6 } , + { 0x00a8 , 0x0041 , 0x00c4 } , + { 0x00a8 , 0x0045 , 0x00cb } , + { 0x00a8 , 0x0055 , 0x00dc } , + { 0x00a8 , 0x0049 , 0x00cf } , + { 0x00a8 , 0x004f , 0x00d6 } , + { 0x00a8 , 0x0020 , 0x00a8 } , + { 0x005e , 0x0061 , 0x00e2 } , + { 0x005e , 0x0065 , 0x00ea } , + { 0x005e , 0x0075 , 0x00fb } , + { 0x005e , 0x0069 , 0x00ee } , + { 0x005e , 0x006f , 0x00f4 } , + { 0x005e , 0x0041 , 0x00c2 } , + { 0x005e , 0x0045 , 0x00ca } , + { 0x005e , 0x0055 , 0x00db } , + { 0x005e , 0x0049 , 0x00ce } , + { 0x005e , 0x004f , 0x00d4 } , + { 0x005e , 0x0020 , 0x005e } , + { 0x007e , 0x006e , 0x00f1 } , + { 0x007e , 0x0061 , 0x00e3 } , + { 0x007e , 0x006f , 0x00f5 } , + { 0x007e , 0x004e , 0x00d1 } , + { 0x007e , 0x0041 , 0x00c3 } , + { 0x007e , 0x004f , 0x00d5 } , + { 0x007e , 0x0020 , 0x007e } , + }; + + private static SwedishLayout instance = new SwedishLayout(); + + private SwedishLayout() { + } + + public static SwedishLayout getInstance() { + return instance; + } + + @Override + public int[][] getLUT() { + return LUT; + } + + @Override + public void type(String text) { + super.type(LUT, DEADKEY_LUT, DEADKEYS, text, (byte)0); + } + + @Override + public void type(String text, byte modifiers) { + super.type(LUT, DEADKEY_LUT, DEADKEYS, text, modifiers); + } + + @Override + public char getChar(int scanCode, boolean capsLock, boolean shift, boolean altGr) { + return super.getChar(LUT, scanCode, capsLock, shift, altGr); + } + + @Override + public String getLocaleName() { + return LOCALE_NAME; + } + + @Override + public int[][] getDeadkeyLUT() { + return DEADKEY_LUT; + } + + @Override + public int[] getDeadkeys() { + return DEADKEYS; + } + +} + diff --git a/src/java/InputStickAPI/src/com/inputstick/api/layout/SwissFrenchLayout.java b/src/java/InputStickAPI/src/com/inputstick/api/layout/SwissFrenchLayout.java new file mode 100644 index 00000000..217a5182 --- /dev/null +++ b/src/java/InputStickAPI/src/com/inputstick/api/layout/SwissFrenchLayout.java @@ -0,0 +1,199 @@ +package com.inputstick.api.layout; + +public class SwissFrenchLayout extends KeyboardLayout { + + public static final String LOCALE_NAME = "fr-CH"; + + public static final int LUT[][] = { + /* 0 */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 1 */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 2 */ { 0 , (int)'1' , 0x002b , -1 , 0x00a6 , -1 } , + /* 3 */ { 0 , (int)'2' , 0x0022 , -1 , 0x0040 , -1 } , + /* 4 */ { 0 , (int)'3' , 0x002a , -1 , 0x0023 , -1 } , + /* 5 */ { 0 , (int)'4' , 0x00e7 , -1 , 0x00b0 , -1 } , + /* 6 */ { 0 , (int)'5' , 0x0025 , -1 , 0x00a7 , -1 } , + /* 7 */ { 0 , (int)'6' , 0x0026 , -1 , 0x00ac , -1 } , + /* 8 */ { 0 , (int)'7' , 0x002f , -1 , 0x007c , -1 } , + /* 9 */ { 0 , (int)'8' , 0x008 , -1 , 0x00a2 , -1 } , + /* 0a */ { 0 , (int)'9' , 0x0029 , -1 , -1 , -1 } , + /* 0b */ { 0 , (int)'0' , 0x003d , -1 , -1 , -1 } , + /* 0c */ { 0 , 0x0027 , 0x003f , -1 , 0x00b4 , -1 } , + /* 0d */ { 0 , 0x005e , 0x0060 , -1 , 0x007e , -1 } , + /* 0e */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 0f */ { -1 , 0 , 0 , 0 , 0 , 0 } , + + /* 10 */ { 1 , (int)'q' , (int)'Q' , -1 , -1 , -1 } , + /* 11 */ { 1 , (int)'w' , (int)'W' , -1 , -1 , -1 } , + /* 12 */ { 1 , (int)'e' , (int)'E' , -1 , 0x20ac , -1 } , + /* 13 */ { 1 , (int)'r' , (int)'R' , -1 , -1 , -1 } , + /* 14 */ { 1 , (int)'t' , (int)'T' , -1 , -1 , -1 } , + /* 15 */ { 1 , (int)'z' , (int)'Z' , -1 , -1 , -1 } , + /* 16 */ { 1 , (int)'u' , (int)'U' , -1 , -1 , -1 } , + /* 17 */ { 1 , (int)'i' , (int)'I' , -1 , -1 , -1 } , + /* 18 */ { 1 , (int)'o' , (int)'O' , -1 , -1 , -1 } , + /* 19 */ { 1 , (int)'p' , (int)'P' , -1 , -1 , -1 } , + /* 1a */ { 0 , 0x00e8 , 0x00fc , 0x001b , 0x005b , -1 } , + /* 1b */ { 0 , 0x00a8 , 0x0021 , 0x001d , 0x005d , -1 } , + /* 1c */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 1d */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 1e */ { 1 , (int)'a' , (int)'A' , -1 , -1 , -1 } , + /* 1f */ { 1 , (int)'s' , (int)'S' , -1 , -1 , -1 } , + + /* 20 */ { 1 , (int)'d' , (int)'D' , -1 , -1 , -1 } , + /* 21 */ { 1 , (int)'f' , (int)'F' , -1 , -1 , -1 } , + /* 22 */ { 1 , (int)'g' , (int)'G' , -1 , -1 , -1 } , + /* 23 */ { 1 , (int)'h' , (int)'H' , -1 , -1 , -1 } , + /* 24 */ { 1 , (int)'j' , (int)'J' , -1 , -1 , -1 } , + /* 25 */ { 1 , (int)'k' , (int)'K' , -1 , -1 , -1 } , + /* 26 */ { 1 , (int)'l' , (int)'L' , -1 , -1 , -1 } , + /* 27 */ { 0 , 0x00e9 , 0x00f6 , -1 , -1 , -1 } , + /* 28 */ { 0 , 0x00e0 , 0x00e4 , -1 , 0x007b , -1 } , + /* 29 */ { 0 , 0x00a7 , 0x00b0 , -1 , -1 , -1 } , + /* 2a */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 2b */ { 0 , 0x0024 , 0x00a3 , 0x001c , 0x007d , -1 } , + /* 2c */ { 1 , (int)'y' , (int)'Y' , -1 , -1 , -1 } , + /* 2d */ { 1 , (int)'x' , (int)'X' , -1 , -1 , -1 } , + /* 2e */ { 1 , (int)'c' , (int)'C' , -1 , -1 , -1 } , + /* 2f */ { 1 , (int)'v' , (int)'V' , -1 , -1 , -1 } , + + /* 30 */ { 1 , (int)'b' , (int)'B' , -1 , -1 , -1 } , + /* 31 */ { 1 , (int)'n' , (int)'N' , -1 , -1 , -1 } , + /* 32 */ { 1 , (int)'m' , (int)'M' , -1 , -1 , -1 } , + /* 33 */ { 0 , 0x002c , 0x003b , -1 , -1 , -1 } , + /* 34 */ { 0 , 0x002e , 0x003a , -1 , -1 , -1 } , + /* 35 */ { 0 , 0x002d , 0x005f , -1 , -1 , -1 } , + /* 36 */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 37 */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 38 */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 39 */ { 0 , 0x0020 , 0x0020 , 0x0020 , -1 , -1 } , + /* 3a */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 3b */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 3c */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 3d */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 3e */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 3f */ { -1 , 0 , 0 , 0 , 0 , 0 } , + + /* 40 */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 41 */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 42 */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 43 */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 44 */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 45 */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 46 */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 47 */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 48 */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 49 */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 4a */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 4b */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 4c */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 4d */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 4e */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 4f */ { -1 , 0 , 0 , 0 , 0 , 0 } , + + /* 50 */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 51 */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 52 */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 53 */ { 0 , 0x002e , 0x002e , -1 , -1 , -1 } , + /* 54 */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 55 */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 56 */ { 0 , 0x003c , 0x003e , 0x001c , 0x005c , -1 } , + /* 57 */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 58 */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 59 */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 5a */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 5b */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 5c */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 5d */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 5e */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 5f */ { -1 , 0 , 0 , 0 , 0 , 0 } , + + }; + + public static final int DEADKEYS[] = { + 0x0060, 0x00b4, 0x005e + }; + + public static final int DEADKEY_LUT[][] = { + { 0x00b4 , 0x0079 , 0x00fd } , + { 0x00b4 , 0x0061 , 0x00e1 } , + { 0x00b4 , 0x0065 , 0x00e9 } , + { 0x00b4 , 0x0075 , 0x00fa } , + { 0x00b4 , 0x0069 , 0x00ed } , + { 0x00b4 , 0x006f , 0x00f3 } , + { 0x00b4 , 0x0059 , 0x00dd } , + { 0x00b4 , 0x0041 , 0x00c1 } , + { 0x00b4 , 0x0045 , 0x00c9 } , + { 0x00b4 , 0x0055 , 0x00da } , + { 0x00b4 , 0x0049 , 0x00cd } , + { 0x00b4 , 0x004f , 0x00d3 } , + { 0x00b4 , 0x0020 , 0x00b4 } , + { 0x0060 , 0x0061 , 0x00e0 } , + { 0x0060 , 0x0065 , 0x00e8 } , + { 0x0060 , 0x0075 , 0x00f9 } , + { 0x0060 , 0x0069 , 0x00ec } , + { 0x0060 , 0x006f , 0x00f2 } , + { 0x0060 , 0x0041 , 0x00c0 } , + { 0x0060 , 0x0045 , 0x00c8 } , + { 0x0060 , 0x0055 , 0x00d9 } , + { 0x0060 , 0x0049 , 0x00cc } , + { 0x0060 , 0x004f , 0x00d2 } , + { 0x0060 , 0x0020 , 0x0060 } , + { 0x005e , 0x0061 , 0x00e2 } , + { 0x005e , 0x0065 , 0x00ea } , + { 0x005e , 0x0075 , 0x00fb } , + { 0x005e , 0x0069 , 0x00ee } , + { 0x005e , 0x006f , 0x00f4 } , + { 0x005e , 0x0041 , 0x00c2 } , + { 0x005e , 0x0045 , 0x00ca } , + { 0x005e , 0x0055 , 0x00db } , + { 0x005e , 0x0049 , 0x00ce } , + { 0x005e , 0x004f , 0x00d4 } , + { 0x005e , 0x0020 , 0x005e } , + + }; + + private static SwissFrenchLayout instance = new SwissFrenchLayout(); + + private SwissFrenchLayout() { + } + + public static SwissFrenchLayout getInstance() { + return instance; + } + + @Override + public int[][] getLUT() { + return LUT; + } + + @Override + public void type(String text) { + super.type(LUT, DEADKEY_LUT, DEADKEYS, text, (byte)0); + } + + @Override + public void type(String text, byte modifiers) { + super.type(LUT, DEADKEY_LUT, DEADKEYS, text, modifiers); + } + + @Override + public char getChar(int scanCode, boolean capsLock, boolean shift, boolean altGr) { + return super.getChar(LUT, scanCode, capsLock, shift, altGr); + } + + @Override + public String getLocaleName() { + return LOCALE_NAME; + } + + @Override + public int[][] getDeadkeyLUT() { + return DEADKEY_LUT; + } + + @Override + public int[] getDeadkeys() { + return DEADKEYS; + } + +} diff --git a/src/java/InputStickAPI/src/com/inputstick/api/layout/SwissGermanLayout.java b/src/java/InputStickAPI/src/com/inputstick/api/layout/SwissGermanLayout.java new file mode 100644 index 00000000..5ac12d02 --- /dev/null +++ b/src/java/InputStickAPI/src/com/inputstick/api/layout/SwissGermanLayout.java @@ -0,0 +1,220 @@ +package com.inputstick.api.layout; + +public class SwissGermanLayout extends KeyboardLayout { + + public static final String LOCALE_NAME = "de-CH"; + + public static final int LUT[][] = { + /* 0 */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 1 */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 2 */ { 0 , (int)'1' , 0x002b , -1 , 0x00a6 , -1 } , + /* 3 */ { 0 , (int)'2' , 0x0022 , -1 , 0x0040 , -1 } , + /* 4 */ { 0 , (int)'3' , 0x002a , -1 , 0x0023 , -1 } , + /* 5 */ { 0 , (int)'4' , 0x00e7 , -1 , 0x00b0 , -1 } , + /* 6 */ { 0 , (int)'5' , 0x0025 , -1 , 0x00a7 , -1 } , + /* 7 */ { 0 , (int)'6' , 0x0026 , -1 , 0x00ac , -1 } , + /* 8 */ { 0 , (int)'7' , 0x002f , -1 , 0x007c , -1 } , + /* 9 */ { 0 , (int)'8' , 0x0028 , -1 , 0x00a2 , -1 } , + /* 0a */ { 0 , (int)'9' , 0x0029 , -1 , -1 , -1 } , + /* 0b */ { 0 , (int)'0' , 0x003d , -1 , -1 , -1 } , + /* 0c */ { 0 , 0x0027 , 0x003f , -1 , 0x00b4 , -1 } , + /* 0d */ { 0 , 0x005e , 0x0060 , -1 , 0x007e , -1 } , + /* 0e */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 0f */ { -1 , 0 , 0 , 0 , 0 , 0 } , + + /* 10 */ { 1 , (int)'q' , (int)'Q' , -1 , -1 , -1 } , + /* 11 */ { 1 , (int)'w' , (int)'W' , -1 , -1 , -1 } , + /* 12 */ { 1 , (int)'e' , (int)'E' , -1 , 0x20ac , -1 } , + /* 13 */ { 1 , (int)'r' , (int)'R' , -1 , -1 , -1 } , + /* 14 */ { 1 , (int)'t' , (int)'T' , -1 , -1 , -1 } , + /* 15 */ { 1 , (int)'z' , (int)'Z' , -1 , -1 , -1 } , + /* 16 */ { 1 , (int)'u' , (int)'U' , -1 , -1 , -1 } , + /* 17 */ { 1 , (int)'i' , (int)'I' , -1 , -1 , -1 } , + /* 18 */ { 1 , (int)'o' , (int)'O' , -1 , -1 , -1 } , + /* 19 */ { 1 , (int)'p' , (int)'P' , -1 , -1 , -1 } , + /* 1a */ { 0 , 0x00fc , 0x00e8 , 0x001b , 0x005b , -1 } , // TODO SGCap + /* 1b */ { 0 , 0x00a8 , 0x0021 , 0x001d , 0x005d , -1 } , + /* 1c */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 1d */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 1e */ { 1 , (int)'a' , (int)'A' , -1 , -1 , -1 } , + /* 1f */ { 1 , (int)'s' , (int)'S' , -1 , -1 , -1 } , + + /* 20 */ { 1 , (int)'d' , (int)'D' , -1 , -1 , -1 } , + /* 21 */ { 1 , (int)'f' , (int)'F' , -1 , -1 , -1 } , + /* 22 */ { 1 , (int)'g' , (int)'G' , -1 , -1 , -1 } , + /* 23 */ { 1 , (int)'h' , (int)'H' , -1 , -1 , -1 } , + /* 24 */ { 1 , (int)'j' , (int)'J' , -1 , -1 , -1 } , + /* 25 */ { 1 , (int)'k' , (int)'K' , -1 , -1 , -1 } , + /* 26 */ { 1 , (int)'l' , (int)'L' , -1 , -1 , -1 } , + /* 27 */ { 0 , 0x00f6 , 0x00e9 , -1 , -1 , -1 } , // TODO SGCap + /* 28 */ { 0 , 0x00e4 , 0x00e0 , -1 , 0x007b , -1 } , // TODO SGCap + /* 29 */ { 0 , 0x00a7 , 0x00b0 , -1 , -1 , -1 } , + /* 2a */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 2b */ { 0 , 0x0024 , 0x00a3 , 0x001c , 0x007d , -1 } , + /* 2c */ { 1 , (int)'y' , (int)'Y' , -1 , -1 , -1 } , + /* 2d */ { 1 , (int)'x' , (int)'X' , -1 , -1 , -1 } , + /* 2e */ { 1 , (int)'c' , (int)'C' , -1 , -1 , -1 } , + /* 2f */ { 1 , (int)'v' , (int)'V' , -1 , -1 , -1 } , + + /* 30 */ { 1 , (int)'b' , (int)'B' , -1 , -1 , -1 } , + /* 31 */ { 1 , (int)'n' , (int)'N' , -1 , -1 , -1 } , + /* 32 */ { 1 , (int)'m' , (int)'M' , -1 , -1 , -1 } , + /* 33 */ { 0 , 0x002c , 0x003b , -1 , -1 , -1 } , + /* 34 */ { 0 , 0x002e , 0x003a , -1 , -1 , -1 } , + /* 35 */ { 0 , 0x002d , 0x005f , -1 , -1 , -1 } , + /* 36 */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 37 */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 38 */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 39 */ { 0 , 0x0020 , 0x0020 , 0x0020 , -1 , -1 } , + /* 3a */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 3b */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 3c */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 3d */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 3e */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 3f */ { -1 , 0 , 0 , 0 , 0 , 0 } , + + /* 40 */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 41 */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 42 */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 43 */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 44 */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 45 */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 46 */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 47 */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 48 */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 49 */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 4a */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 4b */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 4c */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 4d */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 4e */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 4f */ { -1 , 0 , 0 , 0 , 0 , 0 } , + + /* 50 */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 51 */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 52 */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 53 */ { 0 , 0x002e , 0x002e , -1 , -1 , -1 } , + /* 54 */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 55 */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 56 */ { 0 , 0x003c , 0x003e , 0x001c , 0x005c , -1 } , + /* 57 */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 58 */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 59 */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 5a */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 5b */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 5c */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 5d */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 5e */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 5f */ { -1 , 0 , 0 , 0 , 0 , 0 } , + + }; + + public static final int DEADKEYS[] = { + 0x00b4, 0x005e, 0x0060, 0x007e, 0x00a8 + }; + + public static final int DEADKEY_LUT[][] = { + { 0x00b4 , 0x0079 , 0x00fd } , + { 0x00b4 , 0x0061 , 0x00e1 } , + { 0x00b4 , 0x0065 , 0x00e9 } , + { 0x00b4 , 0x0075 , 0x00fa } , + { 0x00b4 , 0x0069 , 0x00ed } , + { 0x00b4 , 0x006f , 0x00f3 } , + { 0x00b4 , 0x0059 , 0x00dd } , + { 0x00b4 , 0x0041 , 0x00c1 } , + { 0x00b4 , 0x0045 , 0x00c9 } , + { 0x00b4 , 0x0055 , 0x00da } , + { 0x00b4 , 0x0049 , 0x00cd } , + { 0x00b4 , 0x004f , 0x00d3 } , + { 0x00b4 , 0x0020 , 0x00b4 } , + { 0x005e , 0x0061 , 0x00e2 } , + { 0x005e , 0x0065 , 0x00ea } , + { 0x005e , 0x0075 , 0x00fb } , + { 0x005e , 0x0069 , 0x00ee } , + { 0x005e , 0x006f , 0x00f4 } , + { 0x005e , 0x0041 , 0x00c2 } , + { 0x005e , 0x0045 , 0x00ca } , + { 0x005e , 0x0055 , 0x00db } , + { 0x005e , 0x0049 , 0x00ce } , + { 0x005e , 0x004f , 0x00d4 } , + { 0x005e , 0x0020 , 0x005e } , + { 0x0060 , 0x0061 , 0x00e0 } , + { 0x0060 , 0x0065 , 0x00e8 } , + { 0x0060 , 0x0075 , 0x00f9 } , + { 0x0060 , 0x0069 , 0x00ec } , + { 0x0060 , 0x006f , 0x00f2 } , + { 0x0060 , 0x0041 , 0x00c0 } , + { 0x0060 , 0x0045 , 0x00c8 } , + { 0x0060 , 0x0055 , 0x00d9 } , + { 0x0060 , 0x0049 , 0x00cc } , + { 0x0060 , 0x004f , 0x00d2 } , + { 0x0060 , 0x0020 , 0x0060 } , + { 0x007e , 0x006e , 0x00f1 } , + { 0x007e , 0x0061 , 0x00e3 } , + { 0x007e , 0x006f , 0x00f5 } , + { 0x007e , 0x004e , 0x00d1 } , + { 0x007e , 0x0041 , 0x00c3 } , + { 0x007e , 0x004f , 0x00d5 } , + { 0x007e , 0x0020 , 0x007e } , + { 0x00a8 , 0x0079 , 0x00ff } , + { 0x00a8 , 0x0061 , 0x00e4 } , + { 0x00a8 , 0x0065 , 0x00eb } , + { 0x00a8 , 0x0075 , 0x00fc } , + { 0x00a8 , 0x0069 , 0x00ef } , + { 0x00a8 , 0x006f , 0x00f6 } , + { 0x00a8 , 0x0041 , 0x00c4 } , + { 0x00a8 , 0x0045 , 0x00cb } , + { 0x00a8 , 0x0055 , 0x00dc } , + { 0x00a8 , 0x0049 , 0x00cf } , + { 0x00a8 , 0x004f , 0x00d6 } , + { 0x00a8 , 0x0020 , 0x00a8 } , + }; + + + + private static SwissGermanLayout instance = new SwissGermanLayout(); + + private SwissGermanLayout() { + } + + public static SwissGermanLayout getInstance() { + return instance; + } + + @Override + public int[][] getLUT() { + return LUT; + } + + @Override + public void type(String text) { + super.type(LUT, DEADKEY_LUT, DEADKEYS, text, (byte)0); + } + + @Override + public void type(String text, byte modifiers) { + super.type(LUT, DEADKEY_LUT, DEADKEYS, text, modifiers); + } + + @Override + public char getChar(int scanCode, boolean capsLock, boolean shift, boolean altGr) { + return super.getChar(LUT, scanCode, capsLock, shift, altGr); + } + + @Override + public String getLocaleName() { + return LOCALE_NAME; + } + + @Override + public int[][] getDeadkeyLUT() { + return DEADKEY_LUT; + } + + @Override + public int[] getDeadkeys() { + return DEADKEYS; + } + +} + diff --git a/src/java/InputStickAPI/src/com/inputstick/api/layout/UnitedKingdomLayout.java b/src/java/InputStickAPI/src/com/inputstick/api/layout/UnitedKingdomLayout.java new file mode 100644 index 00000000..300685a6 --- /dev/null +++ b/src/java/InputStickAPI/src/com/inputstick/api/layout/UnitedKingdomLayout.java @@ -0,0 +1,160 @@ +package com.inputstick.api.layout; + +public class UnitedKingdomLayout extends KeyboardLayout { + + public static final String LOCALE_NAME = "en-GB"; + + public static final int LUT[][] = { + /* 0 */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 1 */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 2 */ { 0 , (int)'1' , 0x21 , -1 , -1 , -1 } , + /* 3 */ { 0 , (int)'2' , 0x22 , -1 , -1 , -1 } , + /* 4 */ { 0 , (int)'3' , 0x00a3 , -1 , -1 , -1 } , + /* 5 */ { 0 , (int)'4' , 0x24 , -1 , 0x20ac , -1 } , + /* 6 */ { 0 , (int)'5' , 0x25 , -1 , -1 , -1 } , + /* 7 */ { 0 , (int)'6' , 0x005e , -1 , -1 , -1 } , + /* 8 */ { 0 , (int)'7' , 0x26 , -1 , -1 , -1 } , + /* 9 */ { 0 , (int)'8' , 0x002a , -1 , -1 , -1 } , + /* 0a */ { 0 , (int)'9' , 0x28 , -1 , -1 , -1 } , + /* 0b */ { 0 , (int)'0' , 0x29 , -1 , -1 , -1 } , + /* 0c */ { 0 , 0x002d , 0x005f , -1 , -1 , -1 } , + /* 0d */ { 0 , 0x003d , 0x002b , -1 , -1 , -1 } , + /* 0e */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 0f */ { -1 , 0 , 0 , 0 , 0 , 0 } , + + /* 10 */ { 1 , (int)'q' , (int)'Q' , -1 , -1 , -1 } , + /* 11 */ { 1 , (int)'w' , (int)'W' , -1 , -1 , -1 } , + /* 12 */ { 5 , (int)'e' , (int)'E' , -1 , 0x00e9 , 0x00c9 } , + /* 13 */ { 1 , (int)'r' , (int)'R' , -1 , -1 , -1 } , + /* 14 */ { 1 , (int)'t' , (int)'T' , -1 , -1 , -1 } , + /* 15 */ { 1 , (int)'y' , (int)'Y' , -1 , -1 , -1 } , + /* 16 */ { 5 , (int)'u' , (int)'U' , -1 , 0x00fa , 0x00da } , + /* 17 */ { 5 , (int)'i' , (int)'I' , -1 , 0x00ed , 0x00cd } , + /* 18 */ { 5 , (int)'o' , (int)'O' , -1 , 0x00f3 , 0x00d3 } , + /* 19 */ { 1 , (int)'p' , (int)'P' , -1 , -1 , -1 } , + /* 1a */ { 0 , 0x005b , 0x007b , 0x001b , -1 , -1 } , + /* 1b */ { 0 , 0x005d , 0x007d , 0x001d , -1 , -1 } , + /* 1c */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 1d */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 1e */ { 5 , (int)'a' , (int)'A' , -1 , 0x00e1 , 0x00c1 } , + /* 1f */ { 1 , (int)'s' , (int)'S' , -1 , -1 , -1 } , + + /* 20 */ { 1 , (int)'d' , (int)'D' , -1 , -1 , -1 } , + /* 21 */ { 1 , (int)'f' , (int)'F' , -1 , -1 , -1 } , + /* 22 */ { 1 , (int)'g' , (int)'G' , -1 , -1 , -1 } , + /* 23 */ { 1 , (int)'h' , (int)'H' , -1 , -1 , -1 } , + /* 24 */ { 1 , (int)'j' , (int)'J' , -1 , -1 , -1 } , + /* 25 */ { 1 , (int)'k' , (int)'K' , -1 , -1 , -1 } , + /* 26 */ { 1 , (int)'l' , (int)'L' , -1 , -1 , -1 } , + /* 27 */ { 0 , 0x003b , 0x003a , -1 , -1 , -1 } , + /* 28 */ { 0 , 0x27 , 0x40 , -1 , -1 , -1 } , + /* 29 */ { 0 , 0x60 , 0x00ac , -1 , 0x00a6 , -1 } , + /* 2a */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 2b */ { 0 , 0x23 , 0x007e , 0x001c , -1 , -1 } , + /* 2c */ { 1 , (int)'z' , (int)'Z' , -1 , -1 , -1 } , + /* 2d */ { 1 , (int)'x' , (int)'X' , -1 , -1 , -1 } , + /* 2e */ { 1 , (int)'c' , (int)'C' , -1 , -1 , -1 } , + /* 2f */ { 1 , (int)'v' , (int)'V' , -1 , -1 , -1 } , + + /* 30 */ { 1 , (int)'b' , (int)'B' , -1 , -1 , -1 } , + /* 31 */ { 1 , (int)'n' , (int)'N' , -1 , -1 , -1 } , + /* 32 */ { 1 , (int)'m' , (int)'M' , -1 , -1 , -1 } , + /* 33 */ { 0 , 0x002c , 0x003c , -1 , -1 , -1 } , + /* 34 */ { 0 , 0x002e , 0x003e , -1 , -1 , -1 } , + /* 35 */ { 0 , 0x002f , 0x003f , -1 , -1 , -1 } , + /* 36 */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 37 */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 38 */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 39 */ { 0 , 0x20 , 0x20 , 0x20 , -1 , -1 } , + /* 3a */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 3b */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 3c */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 3d */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 3e */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 3f */ { -1 , 0 , 0 , 0 , 0 , 0 } , + + /* 40 */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 41 */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 42 */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 43 */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 44 */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 45 */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 46 */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 47 */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 48 */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 49 */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 4a */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 4b */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 4c */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 4d */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 4e */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 4f */ { -1 , 0 , 0 , 0 , 0 , 0 } , + + /* 50 */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 51 */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 52 */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 53 */ { 0 , 0x002e , 0x002e , -1 , -1 , -1 } , + /* 54 */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 55 */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 56 */ { 0 , 0x005c , 0x007c , 0x001c , -1 , -1 } , + /* 57 */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 58 */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 59 */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 5a */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 5b */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 5c */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 5d */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 5e */ { -1 , 0 , 0 , 0 , 0 , 0 } , + /* 5f */ { -1 , 0 , 0 , 0 , 0 , 0 } , + + + }; + + public static final int DEADKEYS[] = null; + public static final int DEADKEY_LUT[][] = null; + + private static UnitedKingdomLayout instance = new UnitedKingdomLayout(); + + private UnitedKingdomLayout() { + } + + public static UnitedKingdomLayout getInstance() { + return instance; + } + + @Override + public int[][] getLUT() { + return LUT; + } + + @Override + public void type(String text) { + super.type(LUT, DEADKEY_LUT, DEADKEYS, text, (byte)0); + } + + @Override + public void type(String text, byte modifiers) { + super.type(LUT, DEADKEY_LUT, DEADKEYS, text, modifiers); + } + + @Override + public char getChar(int scanCode, boolean capsLock, boolean shift, boolean altGr) { + return super.getChar(LUT, scanCode, capsLock, shift, altGr); + } + + @Override + public String getLocaleName() { + return LOCALE_NAME; + } + + @Override + public int[][] getDeadkeyLUT() { + return DEADKEY_LUT; + } + + @Override + public int[] getDeadkeys() { + return DEADKEYS; + } + +} diff --git a/src/java/InputStickAPI/src/com/inputstick/init/DeviceInfo.java b/src/java/InputStickAPI/src/com/inputstick/init/DeviceInfo.java new file mode 100644 index 00000000..286bed75 --- /dev/null +++ b/src/java/InputStickAPI/src/com/inputstick/init/DeviceInfo.java @@ -0,0 +1,89 @@ +package com.inputstick.init; + +public class DeviceInfo { + + private int firmwareType; + private int versionMajor; + private int versionMinor; + private int versionHardware; + private int securityStatus; + + private boolean passwordProtected; + + public DeviceInfo(byte[] data) { + //cmd, param + firmwareType = data[2]; + versionMajor = data[3]; + versionMinor = data[4]; + versionHardware = data[5]; + + + //6,7,8,9 + //10,11,12,13 + //14,15,16,17 + + //18,19 + securityStatus = data[19]; + if (data[20] == 0) { + passwordProtected = false; + } else { + passwordProtected = true; + } + } + + public int getSecurityStatus() { + return securityStatus; + } + + public boolean isAuthenticated() { + return ((securityStatus & 0x10) != 0); + } + + public boolean isUnlocked() { + if (getFirmwareVersion() < 96) { + return true; + } else { + return ((securityStatus & 0x08) != 0); + } + } + + public int getFirmwareType() { + return firmwareType; + } + + public boolean isPasswordProtected() { + return passwordProtected; + } + + public int getVersionMinor() { + return versionMinor; + } + + public int getVersionMajor() { + return versionMajor; + } + + public int getHardwareVersion() { + return versionHardware; + } + + public int getFirmwareVersion() { + return (versionMajor) * 100 + versionMinor; + } + + + + public boolean supportsEncryption() { + return (getFirmwareVersion() >= 91); + } + + public boolean supportsPinChange() { + return (getFirmwareVersion() >= 97); + } + + public boolean supportsGamepad() { + return (getFirmwareVersion() >= 97); + } + + +} diff --git a/src/java/InputStickAPI/src/com/inputstick/init/InitManager.java b/src/java/InputStickAPI/src/com/inputstick/init/InitManager.java index aa0ade8c..c3c62256 100644 --- a/src/java/InputStickAPI/src/com/inputstick/init/InitManager.java +++ b/src/java/InputStickAPI/src/com/inputstick/init/InitManager.java @@ -32,29 +32,16 @@ public class InitManager { mListener = listener; mPacketManager = packetManager; - initDone = false; + initDone = false; } - //WRONG THREAD! - /*public void startTimeoutCountdown(int timeout) { - t = new Timer(); - t.schedule(new TimerTask() { - @Override - public void run() { - if ( !initDone) { - mListener.onInitFailure(InputStickError.ERROR_INIT_TIMEDOUT); - } - } - }, timeout); - }*/ - public void onConnected() { mListener.onInitReady(); } public void onData(byte[] data) { //byte cmd = data[0]; - //byte param = data[1]; + //byte param = data[1]; } public void sendPacket(Packet p) { diff --git a/src/java/Keepass2AndroidPluginSDK/bin/keepass2androidpluginsdk.jar b/src/java/Keepass2AndroidPluginSDK/bin/keepass2androidpluginsdk.jar index 3ee76d988e123ee032483f24ad2b7120e649156c..9d1e7807115dc8984111248525b768b6ab15a48b 100644 GIT binary patch delta 319 zcmZpl&)7bnkvG7bnMH(wgM)*iq+;hpUUwFkHQU@aMx^kA8JiFAH!*=(lMnD~Pmb{t z*xV>o!w!*SluBWPurd`yAgVSuD)ll$)Hf=5Ojhub+FYWh1eKemaSqDL(VhTdZPNS2 z3NhlJ@k*%VYO^;G3nnv48BI1Y5#9XA&IPJU%jGu=h zFDRqND;*;8+$$c!@ba#KDuywI~3{T&3sEBU`gyG;<3t=4egBqyg9}NIW C*m>pv delta 319 zcmZpl&)7bnkvG7bnMH(wgM)*?&%k;juRDuEcf0Gxh!lP>WAg$2CMGaz@&SJB$uV96 zn;V5{*dcO^QYmZ@R;GdoMAha-rCw%;`bH&>$qGJFn@iM`pmMV`&Ouo@+7lqGO?tmr zAx8W&UI~?4ZT1FY!DL1$qsay)qMIMtxjnyh)*Mg;ptlr74fZrFdY19A&i55Py==RqXC_r BYeE13 diff --git a/src/java/PluginInputStick/AndroidManifest.xml b/src/java/PluginInputStick/AndroidManifest.xml index 95f1099f..e0a5df5c 100644 --- a/src/java/PluginInputStick/AndroidManifest.xml +++ b/src/java/PluginInputStick/AndroidManifest.xml @@ -1,8 +1,8 @@ + android:versionCode="5" + android:versionName="1.31" > + + + +