Class Sensor
- java.lang.Object
-
- berlin.yuna.tinkerforgesensor.logic.Sensor
-
- All Implemented Interfaces:
Comparable<Sensor>
public class Sensor extends Object implements Comparable<Sensor>
-
-
Method Summary
-
-
-
Method Detail
-
hasHighContrast
public boolean hasHighContrast()
- Returns:
- true if the sensor uses
SensorHandler.CONFIG_HIGH_CONTRASTseesetHighContrast(boolean)
-
setHighContrast
public Sensor setHighContrast(boolean highContrast)
SetsSensorHandler.CONFIG_HIGH_CONTRASTfor color inputs ofsendColor(Color)used bylikeButtonRGBLedRGBV2- Parameters:
highContrast- setsSensorHandler.CONFIG_HIGH_CONTRAST- Returns:
- self
Sensor
-
hasFrequency
public boolean hasFrequency()
- Returns:
- true if the sensor uses
SensorHandler.CONFIG_FREQUENCYseesetFrequency(int)
-
setFrequency
public Sensor setFrequency(int frequency)
SetsSensorHandler.CONFIG_FREQUENCYfor sensorsused bylikeSpeaker(600Hz - 7100Hz)Speaker(50Hz - 15000Hz)- Parameters:
frequency- setsSensorHandler.CONFIG_FREQUENCY- Returns:
- self
Sensor
-
getBrightness
public int getBrightness()
- Returns:
SensorHandler.CONFIG_BRIGHTNESSvalue seeSensorHandler.setBrightness(int)
-
setBrightness
public Sensor setBrightness(int brightness)
SetsSensorHandler.CONFIG_BRIGHTNESS(0-7) for sensorsused bylikeDisplaySegment,DisplaySegmentV2- Parameters:
brightness- setsSensorHandler.CONFIG_BRIGHTNESS- Returns:
- self
Sensor
-
sendColor
public Sensor sendColor(Color color)
Used for sensors like {@link {@link ButtonRGB }}LedRGBV2- Parameters:
color- value to set for the sensor- Returns:
- self
Sensor
-
sendColor
public Sensor sendColor(Number color)
Used for sensors like {@link {@link ButtonRGB }}LedRGBV2- Parameters:
color- value to set for the sensor- Returns:
- self
Sensor
-
hasStatusLed
public boolean hasStatusLed()
- Returns:
- true if this
Sensorhas a status led
-
setStatusLed
public Sensor setStatusLed(LedStatusType type)
Sets status led toLedStatusType.LED_ON- Returns:
- self
Sensor
-
setStatusLedOn
public Sensor setStatusLedOn()
Sets status led toLedStatusType.LED_ON- Returns:
- self
Sensor
-
setStatusLedOff
public Sensor setStatusLedOff()
Sets status led toLedStatusType.LED_OFF- Returns:
- self
Sensor
-
hasInfoLed
public boolean hasInfoLed()
Sets info led toLedStatusType.LED_ONused bySensors likeImuBrickImuBrickV2AccelerometerAccelerometerV2LedRGBV2LightColorLightColorV2MasterBrick- Returns:
- self
Sensor
-
setInfoLedON
public Sensor setInfoLedON()
Sets info led toLedStatusType.LED_OFFused bySensors likeImuBrickImuBrickV2AccelerometerAccelerometerV2LedRGBV2LightColorLightColorV2MasterBrick- Returns:
- self
Sensor
-
setInfoLedOff
public Sensor setInfoLedOff()
Sets info led toLedStatusType.LED_OFFused bySensors likeImuBrickImuBrickV2AccelerometerAccelerometerV2LedRGBV2LightColorLightColorV2MasterBrick- Returns:
- self
Sensor
-
setStatusLedDefault
public Sensor setStatusLedDefault()
Sets status led toLedStatusType.LED_STATUS- Returns:
- self
Sensor
-
setStatusLedHeartbeat
public Sensor setStatusLedHeartbeat()
Sets status led toLedStatusType.LED_HEARTBEAT- Returns:
- self
Sensor
-
setLedState
public Sensor setLedState(int ledId, LedStatusType ledState)
Set the state of an specific ledused bylikeButtonDualV2- Returns:
- self
Sensor
-
setLedState
public Sensor setLedState(int ledId, int ledState)
Set the state of an specific ledused bylikeButtonDualV2- Returns:
- self
Sensor
-
sendSound
public Sensor sendSound(int durationMs)
Sends a sound - seesendSound(int, int)andsetFrequency(int)used bylikeSpeaker(600Hz - 7100Hz)SpeakerV2(50Hz - 15000Hz)- Parameters:
durationMs- time to send the sound- Returns:
- self
Sensor
-
sendSound
public Sensor sendSound(int durationMs, boolean wait)
Sends a sound - seesendSound(int, int)andsetFrequency(int)used bylikeSpeaker(600Hz - 7100Hz)SpeakerV2(50Hz - 15000Hz)- Parameters:
durationMs- time to send the soundwait- waits until the sound is done- Returns:
- self
Sensor
-
sendSound
public Sensor sendSound(int durationMs, int frequency)
- Parameters:
durationMs- time to send the soundfrequency- frequency for the sound- Returns:
- self
Sensor
-
sendSound
public Sensor sendSound(int durationMs, int frequency, boolean wait)
- Parameters:
durationMs- time to send the soundfrequency- frequency for the soundwait- waits until the sound is done- Returns:
- self
Sensor
-
sendSound
public Sensor sendSound(int durationMs, int frequency, int volume)
Sends a soundused bylikeSpeaker(600Hz - 7100Hz) (no volume)SpeakerV2(50Hz - 15000Hz) (volume: 0-10)- Parameters:
durationMs- time to send the soundfrequency- frequency for the soundvolume- for the sound- Returns:
- self
Sensor
-
handler
public SensorHandler<?> handler()
ASensoris just a wrapper ofSensorHandlerwhich can be identical used directly- Returns:
- self
Sensor
-
getId
public int getId()
-
getUid
public String getUid()
-
getName
public String getName()
-
getStack
public Stack getStack()
-
device
public com.tinkerforge.Device device()
-
getPosition
public char getPosition()
-
getParentUid
public String getParentUid()
-
getPort
public int getPort()
-
setPort
public void setPort(int port)
-
isBrick
public boolean isBrick()
-
isBrick
public void isBrick(boolean brick)
-
is
public IsSensor is()
-
is
public boolean is(Class<?>... types)
-
compareTo
public int compareTo(Sensor o)
- Specified by:
compareToin interfaceComparable<Sensor>
-
-