|
SparshUI_Developer_Guide
This is the WiKi for Sparsh UI developers
Featured
1. Introduction:This document gives a detailed description of the Sparsh UI architecture, the various modules and the protocol used between the clients and the Sparsh gesture Server. The target audience of this document is anybody interested in the development of the Sparsh UI architecture, Multi-touch application developers and enthusiasts. 2. Sparsh UI high level architectureThis section gives a high level overview of the Sparsh UI architecture. It briefly discusses the various modules involved in Sprash UI. We will later discuss in depth about each module. Fig 1. High level architecture diagram of Sparsh UI.Figure 1 shows the high level architecture diagram of Sparsh UI. A high level breakup of the multi-touch framework consists of the following components: 1)Input DeviceInput device refers to the multi-touch device which is being used to obtain the input from the user. Sparsh UI is hardware agnostic in the sense it is compatible to any multi-touch hardware as long it follows the protocol specified by Sparsh UI.The protocol is discussed later. 2)Device DriverThe device driver is the software driver that interacts with the multi-touch hardware and provides the multi-touch events.Since this is dependent on the hardware that is being used it needs to be written for the specific multi-touch hardware one is using. We have provided the hardware for the hardware devices that we are currently using. (FTIR based multi-touch table , Infra-Red bezel ,Stantum multi-touch screen). 3)Sparsh Device Driver AdapterTo make the sparsh gestur recognition framework hardware agnostic , there is a need to standardize the input data format from the device driver. The native device driver may not comply with the format that Sparsh UI requires hence there is a need to write an adapter that sits on top of the device driver and supplies the data in the format required by sparsh UI. 4)Gesture Recognition FrameworkThis is the core engine of the Sparsh UI that takes in the input device data and analyses the gestures from the touch point co-oridinates. Multiple clients can register to the gesture recognition framework and obtain the gesture events for which the client registers.This module will be discussed in depth in later sections. 5)Client AdapterThis is the adapter that the client needs to implement to receive Sparsh UI events. The Client to server protcol adapter is provided as a part of Sparsh UI.The client application needs to implement an interface(abstract class) to receive the events. The handling of various events is done in this Client adapter. 6)ClientThis is the Multi-touch application itself. The client listens on to the various multi-touch events(gesture) and acts accordingly. In the subsequent sections we go over the details of each module in depth. Protocols Used in Sparsh UINote: All the data sent over sockets is in Network Endian Order 1)Input Device ProtocolThis is the protocol between the Input device and the Sparsh UI gesture recognition framework.The Sparsh Adapter (described earlier) is responsible for providing the information in this format. Touch Point StatesIn multi-touch systems a touch point is normally associated with three states namely:
Touch Point data stuctureThe touch point data structure consists of the following fields in the given order:
The touch point state is an enumerator with the following fields enum Touch_Point_State POINT_BIRTH, POINT_DEATH, POINT_MOVE end enum The Input device driver and the Gesture framework communicate over a TCP / IP socket. The Gesture framework runs on port number 5945.The input device on connection sends a byte with value set to 1 indicating that it is an input device. After this the input device can start sending the data. The payload format is given below.
2) Server to Client ProtocolThe Server to client protocol consists of the various messages sent by the server to the client. The protocol consists of exchange of messages for the following : 1. Obtaining the group ID : This is the message sent by the server to the client to obtain the group ID information from the client , given the location information.
The first field is a single byte which is a member of enum MessageType. The second and third field are X and Y Co-ordinates respectively which represent the location of the touch-point screen. These two fields are 4 byte float values. 2. Obtaining the allowed gestures. This message is sent by the server to the client after obtaining a valid group ID.The server uses this information to process only the required gestures for that particular group ID.The message consists of the following fields shown below:
The first field is a single byte which is a member of enum MessageType indicates the type of the message. The second field is the 4 byte integer group Id for which the gestures are being queried for. 3. Gesture Events This message is sent by the server on the occurance of any gesture events. The message consists of the following fields
The gesture specific fields are as follows: Touch Event
Drag Event
Rotate Event
Zoom Event
Spin Event
3) Client to Server ProtocolThe client to server protocol consists of the replies sent by the client to the server for the various queries that the server makes. 1) Group ID This message is sent in response to the Get Group ID message from the server. The message just consists of a single integer.
1) Allowed Gestures This message is sent in response to the Get Allowed Gestures message from the server. The message consists of the following fields:
The first field is the length of the message indicating how many bytes need to be read. The second field is the Gesture identifier. The number of gesture identifiers would be MessageLength / 4. The Gesture identifiers are specified in the enumerator enum GestureType {
DRAG_GESTURE,
MULTI_POINT_DRAG_GESTURE,
ROTATE_GESTURE,
SPIN_GESTURE,
TOUCH_GESTURE,
ZOOM_GESTURE
}Based on the above discussion , the next diagram shows the sequence of exchange of messages between the client and the Sparsh Gesture server.
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||