roomba.roombanetwork.services.roomba
Class RoombaService

java.lang.Object
  extended by roomba.roombanetwork.services.roomba.RoombaService
All Implemented Interfaces:
ClientListener, ServiceStatusProvider

public class RoombaService
extends java.lang.Object
implements ClientListener, ServiceStatusProvider

Provides a roomba service to the Roomba Network, handles robot commands, and produces sensor data

Author:
Drew Housten

Field Summary
 
Fields inherited from interface roomba.roombanetwork.services.ServiceStatusProvider
STATUS_ERROR, STATUS_OK
 
Constructor Summary
RoombaService(java.lang.String serviceName, java.lang.String rnsHost, int rnsPort, java.lang.String roombaPortName)
          Constructor - creates the RNC and starts the Roomba
 
Method Summary
 java.lang.String getErrorMessage()
          Returns the error message for the service if any
 RoombaNetworkClient getRNC()
          Gets the Roomba Network Client
 int getStatus()
          Returns the status code for the service
static void main(java.lang.String[] args)
           
 void messageReceived(java.lang.String messageType, java.lang.String[] messageComponents)
          Processes a message received.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

RoombaService

public RoombaService(java.lang.String serviceName,
                     java.lang.String rnsHost,
                     int rnsPort,
                     java.lang.String roombaPortName)
Constructor - creates the RNC and starts the Roomba

Parameters:
serviceName - Name of the Roomba Service
rnsHost - The hostname (or IP address) of the RNS
rnsPort - The port of the RNS (default is 7777)
roombaPortName - The serial port name that the Roomba is connected at
Method Detail

getRNC

public RoombaNetworkClient getRNC()
Gets the Roomba Network Client

Returns:
The client

getStatus

public int getStatus()
Returns the status code for the service

Specified by:
getStatus in interface ServiceStatusProvider
Returns:
Status code (either STATUS_OK or STATUS_ERROR)

getErrorMessage

public java.lang.String getErrorMessage()
Returns the error message for the service if any

Specified by:
getErrorMessage in interface ServiceStatusProvider
Returns:
Error message

messageReceived

public void messageReceived(java.lang.String messageType,
                            java.lang.String[] messageComponents)
Processes a message received.

Specified by:
messageReceived in interface ClientListener
Parameters:
messageType - The message type
messageComponents - The components of the received message

main

public static void main(java.lang.String[] args)