Wednesday 9 September 2015

API update


Updated API.

InputStick Broadcasts - new, easy way to use InputStick in your app:

Starting with 1.40 version of InputStickUtility (update will be available on GooglePlay in a few hours) it is possible to send data using broadcasts. Typing text is now this easy:

        InputStickBroadcast.type(MainActivity.this, "some text to type");

(each call results in sending a broadcast to InputStickUtility, which puts appropriate action into FIFO queue, see com.inputstick.api.broadcast.InputStickBroadcast class for more details).

InputStickUtility takes care of everything:
  • enables Bluetooth,
  • asks user to select InputStick device (if more than one is available),
  • establishes Bluetooth connection,
  • select keyboard layout and typing speed (can be set in preferences),
  • closes connection (when application requests to do so or after reaching max inactivity period),
  • if anything goes wrong, handles all InputStick-related errors.
Using broadcasts introduces additional latency, compared to "standard API". If precise timing, direct control over connection and buffers are necessary in your use case, you should use "standard API".
Example:
  • password manager app: latency increased by several milliseconds most likely won't be even noticed.
  • remote control app: additional latency can make such app unusable in many situations.

For more details, please download latest API and take a look at "BroadcastDemo" example.

Adjustable typing speed:

Text typing speed can be decreased by multiplying number of HID reports. The more reports USB host will receive, the longer it will take to type.
Example (typing "a" character, 3 reports - 100% typing speed):
  • Report 1: keys released,
  • Report 2: "A" pressed,
  • Report 3: keys released.

Example (typing "a" character, 6 reports - 50% typing speed):
  • Report 1: keys released,
  • Report 2: keys released,
  • Report 3: "A" pressed,
  • Report 4: "A" pressed,
  • Report 5: keys released,
  • Report 6: keys released.

Decreasing typing speed can help to solve missing characters problems, which can occur when working with BIOS (due to simplified keyboard implementation) or advanced text editors (due to spell-checking, auto-complete and similar features).

Easier way to use keyboard layouts:

It is no longer necessary to get KeyboardLayout:

        KeyboardLayout layout = KeyboardLayout.getLayout("pl-PL");
        layout.type("some text in Polish");

now you can simply call:

        InputStickKeyboard.type("some text in Polish", "pl-PL");

Other changes:

  • fixed "init" package name (com.inputstick.init to com.inputstick.api.init),
  • fixed problem when connection gets stuck on "USB not ready" step,
  • BT4.0 connection timeout now works properly,
  • optimized look-up-tables for keyboard layouts,
  • fixed Swedish keyboard layout (could cause app crash),
  • case is now ignored when using layout codes ("en-US" = "en-us" = "EN-US").

Protocol documentation.

  • fixed mistakes in command examples.
  • added info about known bugs in 0.97 firmware version.

No comments:

Post a Comment