# Class ServerToClientProtocol

java.lang.Object
com.sparshui.common.ClientProtocol
com.sparshui.server.ServerToClientProtocol

public class ServerToClientProtocol extends ClientProtocol
Represents the server to client connection.

Author:
  Tony Ross

## Nested Class Summary

### Nested classes/interfaces inherited from class ClientProtocol

`ClientProtocol.MessageType`

## Field Summary

### Fields inherited from class ClientProtocol

`_in, _out, _socket`

## Constructor Summary

Constructors
Constructor
Description
`ServerToClientProtocol(Socket socket)`
Constructs a new connection to the client.

## Method Summary

Modifier and Type
Method
Description
`Lst<GestureType>`
`getGestures(int groupID)`
Retrieve a list of allowed gestures for the provided group id.
`int`
`getGroupID(TouchPoint touchPoint)`
Retrieve a list of allowed gestures for the provided group id.
`void`
`processError(int errCode)`
Send an error message to the client.
`void`
`processEvents(int groupID, Lst<Event> events)`
Instruct the client to process the events that have been generated by a group.

### Methods inherited from class Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

## Constructor Details

### ServerToClientProtocol

public ServerToClientProtocol(Socket socket) throws IOException
Constructs a new connection to the client.

Parameters:
  `socket` - The socket that has been opened to the client.
Throws:
  `IOException`

## Method Details

### getGestures

public Lst<GestureType> getGestures(int groupID) throws IOException
Retrieve a list of allowed gestures for the provided group id. The message sent is of the following format: 1 byte - Event Type 4 bytes - Message Length 4 bytes - GroupID

Parameters:
  `groupID` - The ID of the group to obtain allowed gestures for
Returns:
  A list containing string identifiers for all allowed gestures
Throws:
  `IOException` - If an error occurs while communication with the client.

### getGroupID

public int getGroupID(TouchPoint touchPoint) throws IOException
Retrieve a list of allowed gestures for the provided group id. The message sent is of the following format: 1 byte - Event Type 4 bytes - Message Length 4 bytes - x coordinate 4 bytes - y coordinate

Parameters:
  `touchPoint` - The data point for the group to retrieve from
Returns:
  The Group ID
Throws:
  `IOException` - If an error occurs during communication with the client.

### processEvents

public void processEvents(int groupID, Lst<Event> events) throws IOException
Instruct the client to process the events that have been generated by a group.

Parameters:
  `groupID` - The group ID these events have been generated on.
  `events` -
Throws:
  `IOException` - If there is a communication error.

### processError

public void processError(int errCode) throws IOException
Send an error message to the client.

Parameters:
  `errCode` - EventType.DRIVER_NONE
Throws:
  `IOException` - If there is a communication error.