roomba.roombanetwork.server
Class ErrorHandler

java.lang.Object
  extended by roomba.roombanetwork.server.ErrorHandler

public class ErrorHandler
extends java.lang.Object

Handles any messages that produce an error

Author:
Drew Housten

Field Summary
static int ERROR_DISCONNECTEDCLIENT
           
static int ERROR_INCORRECTPROTOCOLVERSION
           
static int ERROR_INVALIDMESSAGE
           
static int ERROR_INVALIDNUMBEROFACTUATORS
           
static int ERROR_INVALIDNUMBEROFFIELDS
           
static int ERROR_INVALIDNUMBEROFSENSORS
           
static int ERROR_INVALIDSENDERID
           
static int ERROR_NUMBERFORMAT
           
static int ERROR_OK
           
static int ERROR_UNEXPECTEDMESSAGE
           
static int ERROR_UNKNOWNMESSAGETYPE
           
static int ERROR_UNKNOWNSENDER
           
 
Constructor Summary
ErrorHandler(RoombaNetworkServer rns)
          Constructor
 
Method Summary
 void handleMessage(java.lang.String messageType, int errorCode, java.lang.String[] messageComponents)
          Handles an incoming message
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ERROR_OK

public static final int ERROR_OK
See Also:
Constant Field Values

ERROR_INVALIDMESSAGE

public static final int ERROR_INVALIDMESSAGE
See Also:
Constant Field Values

ERROR_NUMBERFORMAT

public static final int ERROR_NUMBERFORMAT
See Also:
Constant Field Values

ERROR_UNKNOWNMESSAGETYPE

public static final int ERROR_UNKNOWNMESSAGETYPE
See Also:
Constant Field Values

ERROR_INCORRECTPROTOCOLVERSION

public static final int ERROR_INCORRECTPROTOCOLVERSION
See Also:
Constant Field Values

ERROR_INVALIDNUMBEROFFIELDS

public static final int ERROR_INVALIDNUMBEROFFIELDS
See Also:
Constant Field Values

ERROR_DISCONNECTEDCLIENT

public static final int ERROR_DISCONNECTEDCLIENT
See Also:
Constant Field Values

ERROR_UNKNOWNSENDER

public static final int ERROR_UNKNOWNSENDER
See Also:
Constant Field Values

ERROR_INVALIDNUMBEROFSENSORS

public static final int ERROR_INVALIDNUMBEROFSENSORS
See Also:
Constant Field Values

ERROR_UNEXPECTEDMESSAGE

public static final int ERROR_UNEXPECTEDMESSAGE
See Also:
Constant Field Values

ERROR_INVALIDNUMBEROFACTUATORS

public static final int ERROR_INVALIDNUMBEROFACTUATORS
See Also:
Constant Field Values

ERROR_INVALIDSENDERID

public static final int ERROR_INVALIDSENDERID
See Also:
Constant Field Values
Constructor Detail

ErrorHandler

public ErrorHandler(RoombaNetworkServer rns)
Constructor

Parameters:
rns - The Roomba Network Server that should be used to send outgoing messages
Method Detail

handleMessage

public void handleMessage(java.lang.String messageType,
                          int errorCode,
                          java.lang.String[] messageComponents)
Handles an incoming message

Parameters:
messageType - The message type of the message. If the message type can not be determined, a type of "Unknown" should be used
errorCode - The error code that has been reported
messageComponents - The incoming message components