Package com.tinkerforge
Class BrickletMotionDetector
- java.lang.Object
-
- com.tinkerforge.DeviceBase
-
- com.tinkerforge.Device
-
- com.tinkerforge.BrickletMotionDetector
-
public class BrickletMotionDetector extends Device
Passive infrared (PIR) motion sensor with 7m range
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static interface
BrickletMotionDetector.DetectionCycleEndedListener
This listener is called when the detection cycle ended.static interface
BrickletMotionDetector.MotionDetectedListener
This listener is called after a motion was detected.-
Nested classes/interfaces inherited from class com.tinkerforge.Device
Device.Identity
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.String
DEVICE_DISPLAY_NAME
static int
DEVICE_IDENTIFIER
static byte
FUNCTION_GET_IDENTITY
static byte
FUNCTION_GET_MOTION_DETECTED
static byte
FUNCTION_GET_STATUS_LED_CONFIG
static byte
FUNCTION_SET_STATUS_LED_CONFIG
static short
MOTION_DETECTED
static short
MOTION_NOT_DETECTED
static short
STATUS_LED_CONFIG_OFF
static short
STATUS_LED_CONFIG_ON
static short
STATUS_LED_CONFIG_SHOW_STATUS
-
Constructor Summary
Constructors Constructor Description BrickletMotionDetector(java.lang.String uid, IPConnection ipcon)
Creates an object with the unique device ID \c uid.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addDetectionCycleEndedListener(BrickletMotionDetector.DetectionCycleEndedListener listener)
Adds a DetectionCycleEnded listener.void
addMotionDetectedListener(BrickletMotionDetector.MotionDetectedListener listener)
Adds a MotionDetected listener.Device.Identity
getIdentity()
Returns the UID, the UID where the Bricklet is connected to, the position, the hardware and firmware version as well as the device identifier.short
getMotionDetected()
Returns 1 if a motion was detected.short
getStatusLEDConfig()
Returns the configuration as set bysetStatusLEDConfig(short)
.void
removeDetectionCycleEndedListener(BrickletMotionDetector.DetectionCycleEndedListener listener)
Removes a DetectionCycleEnded listener.void
removeMotionDetectedListener(BrickletMotionDetector.MotionDetectedListener listener)
Removes a MotionDetected listener.void
setStatusLEDConfig(short config)
Sets the status led configuration.-
Methods inherited from class com.tinkerforge.DeviceBase
getAPIVersion, getResponseExpected, setResponseExpected, setResponseExpectedAll
-
-
-
-
Field Detail
-
DEVICE_IDENTIFIER
public static final int DEVICE_IDENTIFIER
- See Also:
- Constant Field Values
-
DEVICE_DISPLAY_NAME
public static final java.lang.String DEVICE_DISPLAY_NAME
- See Also:
- Constant Field Values
-
FUNCTION_GET_MOTION_DETECTED
public static final byte FUNCTION_GET_MOTION_DETECTED
- See Also:
- Constant Field Values
-
FUNCTION_SET_STATUS_LED_CONFIG
public static final byte FUNCTION_SET_STATUS_LED_CONFIG
- See Also:
- Constant Field Values
-
FUNCTION_GET_STATUS_LED_CONFIG
public static final byte FUNCTION_GET_STATUS_LED_CONFIG
- See Also:
- Constant Field Values
-
FUNCTION_GET_IDENTITY
public static final byte FUNCTION_GET_IDENTITY
- See Also:
- Constant Field Values
-
MOTION_NOT_DETECTED
public static final short MOTION_NOT_DETECTED
- See Also:
- Constant Field Values
-
MOTION_DETECTED
public static final short MOTION_DETECTED
- See Also:
- Constant Field Values
-
STATUS_LED_CONFIG_OFF
public static final short STATUS_LED_CONFIG_OFF
- See Also:
- Constant Field Values
-
STATUS_LED_CONFIG_ON
public static final short STATUS_LED_CONFIG_ON
- See Also:
- Constant Field Values
-
STATUS_LED_CONFIG_SHOW_STATUS
public static final short STATUS_LED_CONFIG_SHOW_STATUS
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
BrickletMotionDetector
public BrickletMotionDetector(java.lang.String uid, IPConnection ipcon)
Creates an object with the unique device ID \c uid. and adds it to the IP Connection \c ipcon.
-
-
Method Detail
-
getMotionDetected
public short getMotionDetected() throws TinkerforgeException
Returns 1 if a motion was detected. How long this returns 1 after a motion was detected can be adjusted with one of the small potentiometers on the Motion Detector Bricklet, see :ref:`here <motion_detector_bricklet_sensitivity_delay_block_time>`. There is also a blue LED on the Bricklet that is on as long as the Bricklet is in the "motion detected" state.- Throws:
TinkerforgeException
-
setStatusLEDConfig
public void setStatusLEDConfig(short config) throws TinkerforgeException
Sets the status led configuration. By default the status LED turns on if a motion is detected and off is no motion is detected. You can also turn the LED permanently on/off. .. versionadded:: 2.0.1$nbsp;(Plugin)- Throws:
TinkerforgeException
-
getStatusLEDConfig
public short getStatusLEDConfig() throws TinkerforgeException
Returns the configuration as set bysetStatusLEDConfig(short)
. .. versionadded:: 2.0.1$nbsp;(Plugin)- Throws:
TinkerforgeException
-
getIdentity
public Device.Identity getIdentity() throws TinkerforgeException
Returns the UID, the UID where the Bricklet is connected to, the position, the hardware and firmware version as well as the device identifier. The position can be 'a', 'b', 'c', 'd', 'e', 'f', 'g' or 'h' (Bricklet Port). A Bricklet connected to an :ref:`Isolator Bricklet <isolator_bricklet>` is always at position 'z'. The device identifier numbers can be found :ref:`here <device_identifier>`. |device_identifier_constant|- Specified by:
getIdentity
in classDevice
- Throws:
TinkerforgeException
-
addMotionDetectedListener
public void addMotionDetectedListener(BrickletMotionDetector.MotionDetectedListener listener)
Adds a MotionDetected listener.
-
removeMotionDetectedListener
public void removeMotionDetectedListener(BrickletMotionDetector.MotionDetectedListener listener)
Removes a MotionDetected listener.
-
addDetectionCycleEndedListener
public void addDetectionCycleEndedListener(BrickletMotionDetector.DetectionCycleEndedListener listener)
Adds a DetectionCycleEnded listener.
-
removeDetectionCycleEndedListener
public void removeDetectionCycleEndedListener(BrickletMotionDetector.DetectionCycleEndedListener listener)
Removes a DetectionCycleEnded listener.
-
-