Package com.tinkerforge
Class BrickletPiezoBuzzer
- java.lang.Object
-
- com.tinkerforge.DeviceBase
-
- com.tinkerforge.Device
-
- com.tinkerforge.BrickletPiezoBuzzer
-
public class BrickletPiezoBuzzer extends Device
Creates 1kHz beep
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static interface
BrickletPiezoBuzzer.BeepFinishedListener
This listener is triggered if a beep set bybeep(long)
is finishedstatic interface
BrickletPiezoBuzzer.MorseCodeFinishedListener
This listener is triggered if the playback of the morse code set bymorseCode(String)
is finished.-
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_BEEP
static byte
FUNCTION_GET_IDENTITY
static byte
FUNCTION_MORSE_CODE
-
Constructor Summary
Constructors Constructor Description BrickletPiezoBuzzer(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
addBeepFinishedListener(BrickletPiezoBuzzer.BeepFinishedListener listener)
Adds a BeepFinished listener.void
addMorseCodeFinishedListener(BrickletPiezoBuzzer.MorseCodeFinishedListener listener)
Adds a MorseCodeFinished listener.void
beep(long duration)
Beeps for the given duration.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.void
morseCode(java.lang.String morse)
Sets morse code that will be played by the piezo buzzer.void
removeBeepFinishedListener(BrickletPiezoBuzzer.BeepFinishedListener listener)
Removes a BeepFinished listener.void
removeMorseCodeFinishedListener(BrickletPiezoBuzzer.MorseCodeFinishedListener listener)
Removes a MorseCodeFinished listener.-
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_BEEP
public static final byte FUNCTION_BEEP
- See Also:
- Constant Field Values
-
FUNCTION_MORSE_CODE
public static final byte FUNCTION_MORSE_CODE
- See Also:
- Constant Field Values
-
FUNCTION_GET_IDENTITY
public static final byte FUNCTION_GET_IDENTITY
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
BrickletPiezoBuzzer
public BrickletPiezoBuzzer(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
-
beep
public void beep(long duration) throws TinkerforgeException
Beeps for the given duration.- Throws:
TinkerforgeException
-
morseCode
public void morseCode(java.lang.String morse) throws TinkerforgeException
Sets morse code that will be played by the piezo buzzer. The morse code is given as a string consisting of "." (dot), "-" (minus) and " " (space) for *dits*, *dahs* and *pauses*. Every other character is ignored. For example: If you set the string "...---...", the piezo buzzer will beep nine times with the durations "short short short long long long short short short".- 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
-
addBeepFinishedListener
public void addBeepFinishedListener(BrickletPiezoBuzzer.BeepFinishedListener listener)
Adds a BeepFinished listener.
-
removeBeepFinishedListener
public void removeBeepFinishedListener(BrickletPiezoBuzzer.BeepFinishedListener listener)
Removes a BeepFinished listener.
-
addMorseCodeFinishedListener
public void addMorseCodeFinishedListener(BrickletPiezoBuzzer.MorseCodeFinishedListener listener)
Adds a MorseCodeFinished listener.
-
removeMorseCodeFinishedListener
public void removeMorseCodeFinishedListener(BrickletPiezoBuzzer.MorseCodeFinishedListener listener)
Removes a MorseCodeFinished listener.
-
-