com.buglabs.bug.module.camera
Class CameraModlet

java.lang.Object
  extended by com.buglabs.bug.module.camera.CameraModlet
All Implemented Interfaces:
ICameraDevice, IModlet, IModuleControl, PublicWSProvider

public class CameraModlet
extends java.lang.Object
implements IModlet, ICameraDevice, PublicWSProvider, IModuleControl

Author:
kgilmer

Field Summary
static java.lang.String MODULE_ID
           
static java.lang.String PROPERTY_CAMERA_SNAPSHOTS
           
 
Fields inherited from interface com.buglabs.services.ws.PublicWSProvider
DELETE, GET, PACKAGE_ID, POST, PUT
 
Constructor Summary
CameraModlet(org.osgi.framework.BundleContext context, int slotId, java.lang.String moduleName)
           
 
Method Summary
 PublicWSDefinition discover(int operation)
           
 IWSResponse execute(int operation, java.lang.String input)
          Execute a service.
 java.lang.String getDescription()
           
 java.lang.String getFormat()
           
 byte[] getImage()
           
 java.io.InputStream getImageInputStream()
           
 java.lang.String getModuleId()
          Return the MODULE ID.
 java.lang.String getModuleName()
          Get the human-readable name of this module.
 java.util.List getModuleProperties()
          Return a list of IModuleProperty elements.
 java.lang.String getPublicName()
           
 int getSlotId()
           
 boolean setModuleProperty(IModuleProperty property)
          Set a property.
 void setup()
          Connect to any devices or do any initialization.
 void start()
          Begin modlet.
 void stop()
          Unregister services and release any resources.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

PROPERTY_CAMERA_SNAPSHOTS

public static final java.lang.String PROPERTY_CAMERA_SNAPSHOTS
See Also:
Constant Field Values

MODULE_ID

public static final java.lang.String MODULE_ID
See Also:
Constant Field Values
Constructor Detail

CameraModlet

public CameraModlet(org.osgi.framework.BundleContext context,
                    int slotId,
                    java.lang.String moduleName)
Method Detail

getModuleId

public java.lang.String getModuleId()
Description copied from interface: IModlet
Return the MODULE ID. This comes from the hardware.

Specified by:
getModuleId in interface IModlet
Returns:

getSlotId

public int getSlotId()
Specified by:
getSlotId in interface IModlet
Specified by:
getSlotId in interface IModuleControl
Returns:
Slot that the Module is currently connected to.

setup

public void setup()
           throws java.lang.Exception
Description copied from interface: IModlet
Connect to any devices or do any initialization. This is a good place to throw an exception if the expected hardware environment is not valid.

Specified by:
setup in interface IModlet
Throws:
java.lang.Exception

start

public void start()
           throws java.lang.Exception
Description copied from interface: IModlet
Begin modlet. Any services that the modlet supports should be registered here.

Specified by:
start in interface IModlet
Throws:
java.lang.Exception

stop

public void stop()
          throws java.lang.Exception
Description copied from interface: IModlet
Unregister services and release any resources.

Specified by:
stop in interface IModlet
Throws:
java.lang.Exception

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.

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:

getPublicName

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

getModuleProperties

public java.util.List getModuleProperties()
Description copied from interface: IModuleControl
Return a list of IModuleProperty elements.

Specified by:
getModuleProperties in interface IModuleControl
Returns:

getModuleName

public java.lang.String getModuleName()
Description copied from interface: IModuleControl
Get the human-readable name of this module.

Specified by:
getModuleName in interface IModuleControl
Returns:

setModuleProperty

public boolean setModuleProperty(IModuleProperty property)
Description copied from interface: IModuleControl
Set a property. This is from a client request.

Specified by:
setModuleProperty in interface IModuleControl
Returns:

getImage

public byte[] getImage()
Specified by:
getImage in interface ICameraDevice

getImageInputStream

public java.io.InputStream getImageInputStream()
Specified by:
getImageInputStream in interface ICameraDevice

getFormat

public java.lang.String getFormat()
Specified by:
getFormat in interface ICameraDevice

getDescription

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