Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## com.datecs.api.universalreader
Class TouchEvent

    java.lang.Object
      com.datecs.api.universalreader.TouchEvent

    public final class TouchEvent

extends java.lang.Object

This class is used to report single touch event from touch screen peripherals.

Field Summary
`static int` | `ACTION_DOWN` A pressed gesture has started, the touch event contains a valid location of event.
`static int` | `ACTION_UP` A pressed gesture has finished, the touch event does not contains a valid location.

Constructor Summary
`TouchEvent(int x, int y, int pressure, int elapse)` Constructs a `TouchEvent`, filling in all of the basic values that define the touch.

Method Summary
`int` | `getAction()` Gets the kind of action being performed.
`int` | `getElapse()` Gets the time between this event and the previous one.
`int` | `getPressure()` Gets the current pressure of this event.
`int` | `getX()` Gets the X coordinate of this event.
`int` | `getY()` Gets the Y coordinate of this event.
`static TouchEvent[]` | `obtainArray(byte[] data)` Constructs a new instance of this class from a given byte array.
`java.lang.String` | `toString()` Returns the string representation of object.

Methods inherited from class java.lang.Object
`equals, getClass, hashCode, notify, notifyAll, wait, wait, wait`

Field Detail

### ACTION_DOWN

    public static final int ACTION_DOWN

  A pressed gesture has started, the touch event contains a valid location of event.

  See Also:
    Constant Field Values

### ACTION_UP

    public static final int ACTION_UP

  A pressed gesture has finished, the touch event does not contains a valid location.

  See Also:
    Constant Field Values

Constructor Detail

### TouchEvent

    public TouchEvent(int x,
                      int y,
                      int pressure,
                      int elapse)

  Constructs a `TouchEvent`, filling in all of the basic values that define the touch.

  Parameters:
    `x` - the X coordinate of this event.
    `y` - the Y coordinate of this event.
    `pressure` - the current pressure of this event.
    `elapse` - the time (in ms) between this event and the previous one.

Method Detail

### obtainArray

    public static TouchEvent[] obtainArray(byte[] data)

  Constructs a new instance of this class from a given byte array.

  Every touch event in array must be defined in block of 4 bytes, in format: X coordinate, Y coordinate, pressure, elapse (4 ms units).

  If `data` is `null`, a `NullPointerException` is thrown.

  If `(data.length % 4) != 0`, a `IllegalArgumentException` is thrown.

  Parameters:
    `data` - the byte array contains blocks with touch events.
  Returns:
    an instance of `TouchEvent[]`.

### getX

    public int getX()

  Gets the X coordinate of this event.

  Returns:
    the X coordinate of this event.

### getY

    public int getY()

  Gets the Y coordinate of this event.

  Returns:
    the X coordinate of this event.

### getPressure

    public int getPressure()

  Gets the current pressure of this event.

  Returns:
    the current pressure of this event.

### getElapse

    public int getElapse()

  Gets the time between this event and the previous one.

  Returns:
    the time (in milliseconds) between this event and the previous one. If the time is greater then 1 seconds, -1 is returned.

### getAction

    public int getAction()

  Gets the kind of action being performed.

  Returns:
    the kind of action being performed - one of either `ACTION_DOWN` or `ACTION_UP`.

### toString

    public java.lang.String toString()

  Returns the string representation of object.

  Overrides:
    `toString` in class `java.lang.Object`

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD