roomba.roombanetwork.services.image
Class ColorFinderService

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

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

Provides a color finder service to the Roomba Network. Will consume an image and will find a color blob within the image

Author:
Drew Housten

Field Summary
 
Fields inherited from interface roomba.roombanetwork.services.ServiceStatusProvider
STATUS_ERROR, STATUS_OK
 
Constructor Summary
ColorFinderService(java.lang.String serviceName, java.lang.String rnsHost, int rnsPort, Camera camera)
          Constructor - creates the RNC and will start to grab images from the camera.
 
Method Summary
 void addTrack(Track track)
           
 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
 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

ColorFinderService

public ColorFinderService(java.lang.String serviceName,
                          java.lang.String rnsHost,
                          int rnsPort,
                          Camera camera)
Constructor - creates the RNC and will start to grab images from the camera. Once an image has been received, this will display a gui to allow selection of the target blob

Parameters:
serviceName - Name of the ColorFinderService
rnsHost - The hostname (or IP address) of the RNS
rnsPort - The port of the RNS (default is 7777)
camera - The camera to use
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. The image service does not accept any inputs, so this method does not do anything

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

addTrack

public void addTrack(Track track)