cork.module.sharp
Class GP2D15

cork.module.sharp.GP2D15
All Implemented Interfaces:
Device

public class GP2D15
implements Device

Driver for the Sharp GP2D15 IR Proximity detector.

Version:
0.1.0
Author:
Brill Pappin

Constructor Summary
GP2D15(com.ajile.drivers.gpio.GpioPin pin)
          Constructor for the GP2D15 object
GP2D15(com.ajile.drivers.gpio.GpioPin pin, int index)
          Constructor for the GP2D15 object
 
Method Summary
 void addListener(DeviceEventListener listener)
          Adds a listener to the GP2D15 object.
 void assertEvent(boolean active)
          Used internally to signal a device event when the sensors logic leve changes.
 java.lang.String getDeviceDestription()
          Gets the destription attribute of the Device object
 java.lang.String getDeviceName()
          Gets the title attribute of the Device object
 int getIndex()
          Returns the index of the device.
 com.ajile.drivers.gpio.GpioPin getIOPin()
          Gets the GPIO pin that the divice is attached to.
 boolean isObjectDetected()
          Tests the state of the device.
 void removeListener(DeviceEventListener listener)
          Removes a listener to the GP2D15 object.
 void setIndex(int index)
          Sets the index of the device.
 

Constructor Detail

GP2D15

public GP2D15(com.ajile.drivers.gpio.GpioPin pin)
Constructor for the GP2D15 object
Parameters:
pin - com.ajile.drivers.gpio.GpioPin the GPIO pin that the device is connected to.
Since:
0.1.0

GP2D15

public GP2D15(com.ajile.drivers.gpio.GpioPin pin,
              int index)
Constructor for the GP2D15 object
Parameters:
pin - com.ajile.drivers.gpio.GpioPin the GPIO pin that the device is connected to.
index - int This is used when there are multiple devices in the system, to differentiate devices in the event model.
Since:
0.1.0
Method Detail

assertEvent

public void assertEvent(boolean active)
Used internally to signal a device event when the sensors logic leve changes.
Parameters:
active - boolean logic state of the device
Since:
0.1.0

addListener

public void addListener(DeviceEventListener listener)
Adds a listener to the GP2D15 object.
Parameters:
listener - cork.event.DeviceEventListener the listener who will listen for changed in teh device.
Since:
0.1.0

removeListener

public void removeListener(DeviceEventListener listener)
Removes a listener to the GP2D15 object.
Parameters:
listener - cork.event.DeviceEventListener the listener who was listening for changed in teh device.
Since:
0.1.0

isObjectDetected

public boolean isObjectDetected()
Tests the state of the device.
Returns:
boolean true if tehre is an object within range, false otherwise.
Since:
0.1.0

getIOPin

public com.ajile.drivers.gpio.GpioPin getIOPin()
Gets the GPIO pin that the divice is attached to.
Returns:
com.ajile.drivers.gpio.GpioPin the GPIO pin.
Since:
0.1.0

getIndex

public int getIndex()
Returns the index of the device. This is used when there are multiple devices in the system, to differentiate devices in the event model.
Returns:
int the index of the device
Since:
0.1.0

getDeviceName

public java.lang.String getDeviceName()
Gets the title attribute of the Device object
Specified by:
getDeviceName in interface Device
Returns:
The title value
Since:
0.1.0

getDeviceDestription

public java.lang.String getDeviceDestription()
Gets the destription attribute of the Device object
Specified by:
getDeviceDestription in interface Device
Returns:
The destription value
Since:
0.1.0

setIndex

public void setIndex(int index)
Sets the index of the device. This is used when there are multiple devices in the system, to differentiate devices in the event model.
Parameters:
index - int the new index value
Since:
0.1.0