org.bluemelon.bluesense
Class Device

java.lang.Object
  extended by org.bluemelon.bluesense.Device
Direct Known Subclasses:
AdcInputDevice, DacOutputDevice, MotorDevice, OCOutputDevice, RelayOutputDevice, RouterDevice, ServoDevice, StepperDevice, SwitchInputDevice, UnknownDevice

public abstract class Device
extends java.lang.Object

The device class holds common information for all BlueSense devices (eg. the identifier). It also defines some operations which can be done on all types of devices.


Method Summary
 void addDeviceEventListener(DeviceEventListener l)
           
 boolean detect(int timeOut)
          Tries to detect this device.
 int getFirmwareVersion()
           
 int getId()
           
 int getType()
           
 java.lang.String getTypeName()
           
 boolean isAccessible()
          Checks if the device is accessible.
 void removeDeviceEventListener(DeviceEventListener l)
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

isAccessible

public boolean isAccessible()
Checks if the device is accessible. The device is inaccessible when a wrong the device's identifier points to a device of another type. Or when the device type has not been registered with the master. eg. @see AdcInputDevice#register(Master)

Returns:
true if accessible

detect

public boolean detect(int timeOut)
Tries to detect this device.

Parameters:
timeOut - how long to detect
Returns:
true if found, false if still inaccessible.

getType

public int getType()
Returns:
Returns the type identifier

getTypeName

public java.lang.String getTypeName()

getId

public int getId()
Returns:
the device's unique identifier

getFirmwareVersion

public int getFirmwareVersion()
Returns:
software firmware version of a device

addDeviceEventListener

public void addDeviceEventListener(DeviceEventListener l)

removeDeviceEventListener

public void removeDeviceEventListener(DeviceEventListener l)