safehome.device
Interface interfaceSensor

All Known Implementing Classes:
DeviceMotionDetector, DeviceWinDoorSensor

public interface interfaceSensor

The safehome.device.inferfaceSensor interface defines a common interface for motion detectors and window/door sensors.

Author:
cs550 TA

Method Summary
 void disable()
          Disables the sensor.
 void enable()
          Enables the sensor to detect intrusion.
 int getID()
          Returns a sensor ID.
 boolean isEnabled()
          Tests the sensor is enabled or not.
 boolean read()
          Reads the status of the sensor.
 

Method Detail

getID

int getID()
Returns a sensor ID. A sensor ID is unique in a same type. The sensor's ID will be given sequentially when a new sensor object is allocated. It starts from 1 and increases by 1

Returns:
a sensor ID

read

boolean read()
Reads the status of the sensor.

Returns:
true if door is open. Otherwise, false.

enable

void enable()
Enables the sensor to detect intrusion.


disable

void disable()
Disables the sensor. The disabled sensor does not detect intrusion.


isEnabled

boolean isEnabled()
Tests the sensor is enabled or not.

Returns:
true if the sensor is enabled. Otherwise, false.