com.buglabs.bug.module.camera
Class CameraModuleControl

java.lang.Object
  extended by com.buglabs.bug.module.camera.CameraModuleControl
All Implemented Interfaces:
ICamera2ModuleControl, ICameraModuleControl, IModuleLEDController, PublicWSProvider, PublicWSProvider2, PublicWSProviderWithParams

public class CameraModuleControl
extends java.lang.Object
implements ICameraModuleControl, ICamera2ModuleControl, IModuleLEDController, PublicWSProviderWithParams


Field Summary
 
Fields inherited from interface com.buglabs.services.ws.PublicWSProvider
DELETE, GET, PACKAGE_ID, POST, PUT
 
Constructor Summary
CameraModuleControl(CameraControl cameraControl, CameraModlet cameraModlet)
           
 
Method Summary
 PublicWSDefinition discover(int operation)
           
 IWSResponse execute(int operation, java.lang.String input)
          Execute a service.
 IWSResponse execute(int operation, java.lang.String input, java.util.Map get, java.util.Map post)
          Execute a service with get and post parameters passed in.
 int getColorEffects()
           
 java.lang.String getDescription()
           
 int getExposureLevel()
           
 int getHorizontalMirror()
           
 java.lang.String getPublicName()
           
 int getSelectedCamera()
          Returns the slot number of the selected camera.
 int getTestPattern()
           
 int getVerticalFlip()
           
 int LEDGreenOff()
           
 int LEDGreenOn()
           
 int LEDRedOff()
           
 int LEDRedOn()
           
 int setColorEffects(int colorEffects)
          Set camera's color effects
 int setExposureLevel(int exposureLevel)
          Set exposure level.
 int setFlashBeamIntensity(int intensity)
          Sets the beam intensity
 int setHorizontalMirror(int horizontalMirror)
          Set horizontal mirror.
 int setLEDFlash(boolean state)
          Turns Flash LED off
 int setLEDFlashOff()
           
 int setLEDFlashOn()
           
 int setLEDGreen(boolean state)
           
 int setLEDRed(boolean state)
           
 void setPublicName(java.lang.String name)
          Set the name of the service.
 int setSelectedCamera(int slot)
          Selects a camera based on slot number.
 int setTestPattern(int testPattern)
          Set camera's test pattern:
 int setVerticalFlip(int verticalFlip)
          Set vertical flip.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CameraModuleControl

public CameraModuleControl(CameraControl cameraControl,
                           CameraModlet cameraModlet)
Method Detail

setSelectedCamera

public int setSelectedCamera(int slot)
                      throws java.io.IOException
Description copied from interface: ICameraModuleControl
Selects a camera based on slot number.

Specified by:
setSelectedCamera in interface ICameraModuleControl
Parameters:
slot - the slot number of the desired camera.
Returns:
negative value if request was not sucessful.
Throws:
java.io.IOException

getSelectedCamera

public int getSelectedCamera()
                      throws java.io.IOException
Description copied from interface: ICameraModuleControl
Returns the slot number of the selected camera.

Specified by:
getSelectedCamera in interface ICameraModuleControl
Returns:
negative value if request was not successful.
Throws:
java.io.IOException

setFlashBeamIntensity

public int setFlashBeamIntensity(int intensity)
                          throws java.io.IOException
Description copied from interface: ICameraModuleControl
Sets the beam intensity

Specified by:
setFlashBeamIntensity in interface ICameraModuleControl
Parameters:
intensity - The intensity of the beam. 0 = low, 1 = high
Returns:
negative value if request was not successful.
Throws:
java.io.IOException

setLEDFlashOff

public int setLEDFlashOff()
                   throws java.io.IOException
Throws:
java.io.IOException

setLEDFlashOn

public int setLEDFlashOn()
                  throws java.io.IOException
Throws:
java.io.IOException

setLEDFlash

public int setLEDFlash(boolean state)
                throws java.io.IOException
Description copied from interface: ICameraModuleControl
Turns Flash LED off

Specified by:
setLEDFlash in interface ICameraModuleControl
Returns:
negative value if request was not successful.
Throws:
java.io.IOException

LEDGreenOff

public int LEDGreenOff()
                throws java.io.IOException
Throws:
java.io.IOException

LEDGreenOn

public int LEDGreenOn()
               throws java.io.IOException
Throws:
java.io.IOException

LEDRedOff

public int LEDRedOff()
              throws java.io.IOException
Throws:
java.io.IOException

LEDRedOn

public int LEDRedOn()
             throws java.io.IOException
Throws:
java.io.IOException

setLEDGreen

public int setLEDGreen(boolean state)
                throws java.io.IOException
Specified by:
setLEDGreen in interface IModuleLEDController
Throws:
java.io.IOException

setLEDRed

public int setLEDRed(boolean state)
              throws java.io.IOException
Specified by:
setLEDRed in interface IModuleLEDController
Parameters:
state - on = true, off = false;
Returns:
the return of the underlying ioctl.
Throws:
java.io.IOException

getTestPattern

public int getTestPattern()
Specified by:
getTestPattern in interface ICamera2ModuleControl
Returns:
test pattern setting or negative value if error

setTestPattern

public int setTestPattern(int testPattern)
Description copied from interface: ICamera2ModuleControl
Set camera's test pattern:

Specified by:
setTestPattern in interface ICamera2ModuleControl
Parameters:
testPattern - 0=Disabled, 1=Walking 1's
Returns:
0 if successful, negative value otherwise.

getColorEffects

public int getColorEffects()
Specified by:
getColorEffects in interface ICamera2ModuleControl
Returns:
color effects setting or negative value if error

setColorEffects

public int setColorEffects(int colorEffects)
Description copied from interface: ICamera2ModuleControl
Set camera's color effects

Specified by:
setColorEffects in interface ICamera2ModuleControl
Parameters:
colorEffects - 0=Disabled, 1=Black & White, 2=Sepia, 3=Negative, 4=Solarize
Returns:
0 if successful, negative value otherwise.

getVerticalFlip

public int getVerticalFlip()
Specified by:
getVerticalFlip in interface ICamera2ModuleControl
Returns:
vertical flip setting or negative value if error

setVerticalFlip

public int setVerticalFlip(int verticalFlip)
Description copied from interface: ICamera2ModuleControl
Set vertical flip.

Specified by:
setVerticalFlip in interface ICamera2ModuleControl
Parameters:
verticalFlip - 0=Disabled, 1=Flipped
Returns:
0 if successful, negative value otherwise.

getHorizontalMirror

public int getHorizontalMirror()
Specified by:
getHorizontalMirror in interface ICamera2ModuleControl
Returns:
horizontal mirror setting or negative value if error

setHorizontalMirror

public int setHorizontalMirror(int horizontalMirror)
Description copied from interface: ICamera2ModuleControl
Set horizontal mirror.

Specified by:
setHorizontalMirror in interface ICamera2ModuleControl
Parameters:
horizontalMirror - 0=Disabled, 1=Mirrored
Returns:
0 if successful, negative value otherwise.

getExposureLevel

public int getExposureLevel()
Specified by:
getExposureLevel in interface ICamera2ModuleControl
Returns:
exposure level or negative value if error

setExposureLevel

public int setExposureLevel(int exposureLevel)
Description copied from interface: ICamera2ModuleControl
Set exposure level.

Specified by:
setExposureLevel in interface ICamera2ModuleControl
Parameters:
exposureLevel - in the range 0-255 (default is 55)
Returns:

setPublicName

public void setPublicName(java.lang.String name)
Description copied from interface: PublicWSProvider2
Set the name of the service. This can be done on registration.

Specified by:
setPublicName in interface PublicWSProvider2

discover

public PublicWSDefinition discover(int operation)
Specified by:
discover in interface PublicWSProvider
Parameters:
operation - HTTP operation. See IPublicServiceProvider.GET, etc.
Returns:
The description of what the service requires and provides, or null of service does not support the passed operation.

execute

public IWSResponse execute(int operation,
                           java.lang.String input)
Description copied from interface: PublicWSProvider
Execute a service. This is a proxy to a native OSGi style service.

Specified by:
execute in interface PublicWSProvider
Parameters:
operation - PublicWSProvider.GET, .PUT, .POST, .DELETE
Returns:

execute

public IWSResponse execute(int operation,
                           java.lang.String input,
                           java.util.Map get,
                           java.util.Map post)
Description copied from interface: PublicWSProviderWithParams
Execute a service with get and post parameters passed in.

Specified by:
execute in interface PublicWSProviderWithParams
Parameters:
operation - PublicWSProvider.GET, .PUT, .POST, .DELETE
input - Request path starting with the public name of the PublicWSProviderWithParams
get - Key value pairs of the parameters passed in via the query string
post - Key value pairs passed in via POST data.
Returns:

getPublicName

public java.lang.String getPublicName()
Specified by:
getPublicName in interface PublicWSProvider
Returns:
Name that this service uses.

getDescription

public java.lang.String getDescription()
Specified by:
getDescription in interface PublicWSProvider
Returns:
A brief description of the service.