public class MotionSensor extends LegoService
MotionSensorCallbackListener
using LegoService.registerCallbackListener(dk.lego.devicesdk.services.ServiceCallbackListener)
to be notified when a service receives an updated value.Modifier and Type | Class and Description |
---|---|
static class |
MotionSensor.MotionSensorMode
Supported modes for the motion sensor
|
Modifier and Type | Field and Description |
---|---|
static int |
MAX_DISTANCE |
static int |
MIN_DISTANCE |
callbackHelper, connectInfo, inputFormat, io
Modifier and Type | Method and Description |
---|---|
static MotionSensor |
createService(ConnectInfo connectInfo,
IO io) |
boolean |
equals(java.lang.Object o) |
int |
getCount() |
InputFormat |
getDefaultInputFormat()
The default input format that will be uploaded to the device for this service upon discovery of the service.
|
float |
getDistance() |
MotionSensor.MotionSensorMode |
getMotionSensorMode() |
java.lang.String |
getServiceName() |
void |
handleUpdatedValueData(byte[] valueData)
Handle new value data from device (may be overwritten in sub-classes)
|
int |
hashCode() |
void |
setMotionSensorMode(MotionSensor.MotionSensorMode motionSensorMode) |
addValidDataFormat, didReceiveInputFormat, didReceiveValueData, didRequestConnectInfo, getConnectInfo, getDevice, getFloatFromData, getInputFormat, getInputFormatMode, getIntegerFromData, getIo, getNumberFromValueData, getNumberFromValueData, getNumbersFromValueDataSet, getNumbersFromValueDataSet, getValidDataFormats, getValueAsFloat, getValueAsInteger, getValueData, handleUpdatedInputFormat, isInternalService, registerCallbackListener, removeValidDataFormat, sendReadValueRequest, sendResetStateRequest, setDevice, unregisterCallbackListener, updateCurrentInputFormatWithNewMode, updateInputFormat, writeData
public static final int MAX_DISTANCE
public static final int MIN_DISTANCE
public static MotionSensor createService(ConnectInfo connectInfo, IO io)
public java.lang.String getServiceName()
getServiceName
in class LegoService
public InputFormat getDefaultInputFormat()
LegoService
getDefaultInputFormat
in class LegoService
InputFormat
of the servicepublic float getDistance()
public int getCount()
public MotionSensor.MotionSensorMode getMotionSensorMode()
public void setMotionSensorMode(MotionSensor.MotionSensorMode motionSensorMode)
public void handleUpdatedValueData(byte[] valueData) throws LDSDKError
LegoService
handleUpdatedValueData
in class LegoService
valueData
- received value dataLDSDKError
- if received data could not be verifiedpublic boolean equals(java.lang.Object o)
equals
in class LegoService
public int hashCode()
hashCode
in class LegoService