com.sentilla.system
Class SensorDriver<Q extends javax.measure.quantity.Quantity>

java.lang.Object
  extended by com.sentilla.system.DriverAdapter
      extended by com.sentilla.system.SensorDriver<Q>
All Implemented Interfaces:
Driver
Direct Known Subclasses:
AccelerationSensorDriver, CpuPowerDriver, McuTemperatureDriver, McuVoltageDriver, MotePowerDriver, ParSensorDriver, Sht11HumidityDriver, Sht11TemperatureDriver, TsrSensorDriver

public abstract class SensorDriver<Q extends javax.measure.quantity.Quantity>
extends DriverAdapter

Create new Sensor system objects.

Programmers are recommended to use the static create() function to acquire a sensor instance for attached peripherals and devices in a platform-independent manner.

Information for common sensors, the recommended Quantity type, default sensor units, and the platform-independent driver name for that sensor are shown in the table below.

Sensor type Quantity Class Units Driver Name
Voltage ElectricPotential Volts "volt"
Temperature Temperature Celsius "temp"
Light Illuminance lux "light"
Relative humidity Dimensionless Percent "hum"

When building a new driver that extends SensorDriver, the classes in the com.sentilla.measure.unit are useful for driver builders to provide the functions required by Measurable and Comparable. required by Sensor implementations.

Note: Any platform device must implement a driver for that device. The device driver for the platform must implement all the abstract action function calls defined in its respective Driver, in this case, all sensors must extend and implement function calls in SensorDriver and Sensor.

See Also:
Quantity, Sensor, com.sentilla.measure.unit

Field Summary
 
Fields inherited from class com.sentilla.system.DriverAdapter
m_nextDriver
 
Constructor Summary
SensorDriver()
           
 
Method Summary
static
<Q extends javax.measure.quantity.Quantity>
Sensor<Q>
create(String driver, Class<Q> quantityClass)
          Create a Sensor object for a specific type of sensor with measureable Quantity Q.
abstract  Class<Q> getQuantityClass()
          Get the type of quantity that this sensor provides.
abstract  Sensor<Q> newSensor()
          Creates a new sensor object of quantity Q.
 
Methods inherited from class com.sentilla.system.DriverAdapter
getDriverName, getNextDriver, setNextDriver
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SensorDriver

public SensorDriver()
Method Detail

newSensor

public abstract Sensor<Q> newSensor()
Creates a new sensor object of quantity Q.

Returns:
Sensor instance

getQuantityClass

public abstract Class<Q> getQuantityClass()
Get the type of quantity that this sensor provides.

Returns:
Class of type Q, where Q is a Quantity

create

public static <Q extends javax.measure.quantity.Quantity> Sensor<Q> create(String driver,
                                                                           Class<Q> quantityClass)
Create a Sensor object for a specific type of sensor with measureable Quantity Q.

Type Parameters:
Q - Type of quantity that this sensor measures
Parameters:
driver - Name of the sensor
quantityClass - Class type for the desired measureable quantity
Returns:
Sensor instance that matches the name and measureable quantity
Throws:
NoSuchDriverException - when no driver with the given name and quantity exists


Copyright © 2007 Sentilla Corporation. All Rights Reserved.