public abstract class LegoDeviceImpl extends java.lang.Object implements LegoDevice
LegoDevice.DeviceCategory, LegoDevice.DeviceFunction, LegoDevice.DeviceState
Modifier and Type | Field and Description |
---|---|
protected java.lang.Integer |
batteryLevel |
protected boolean |
buttonPressed |
protected DeviceCallbackHelper |
callbackHelper |
protected LegoDevice.DeviceCategory |
category |
protected LegoDevice.DeviceState |
connectState |
protected java.lang.String |
deviceId |
protected DeviceInfo |
deviceInfo |
protected int |
lastConnectedNetworkId |
protected boolean |
lowVoltage |
protected java.lang.String |
name |
protected java.util.List<LegoService> |
services |
protected LegoDevice.DeviceFunction |
supportedFunctions |
static java.lang.String |
UNDEFINED_DEVICE_ID |
Constructor and Description |
---|
LegoDeviceImpl() |
Modifier and Type | Method and Description |
---|---|
java.lang.Integer |
getBatteryLevel()
The battery level of the device in percentage
If no battery level has been received from the Device, the value is null
|
LegoDevice.DeviceState |
getConnectState()
Returns the current state of the connection.
|
java.lang.String |
getDeviceId()
A unique identifier for the device
|
DeviceInfo |
getDeviceInfo()
Info about the device hardware, firmware, and software revision
|
java.util.List<LegoService> |
getExternalServices()
An external service is a service that represent and IO that can be attached to the device Hub.
|
java.util.List<LegoService> |
getInternalServices()
An internal service is a service that is inherent to the Device - something that can never be 'detached'.
|
java.lang.String |
getName()
The most recent value of the name property read from the Hub.
|
java.util.List<LegoService> |
getServices()
The currently available inputs and outputs
|
boolean |
isButtonPressed()
The most recent button pressed state read from the Device.
|
void |
registerCallbackListener(DeviceCallbackListener listener)
If a callback listener is registered it receives callbacks on changes to offered services,
as well as properties of the device like name and color.
|
void |
unregisterCallbackListener(DeviceCallbackListener listener)
Remove callback listener from this device
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getCategory, getLastConnectedNetworkId, getSupportedFunctions, isLowVoltage, setName
public static final java.lang.String UNDEFINED_DEVICE_ID
protected LegoDevice.DeviceState connectState
protected java.lang.String deviceId
protected java.lang.String name
protected boolean buttonPressed
protected java.lang.Integer batteryLevel
protected DeviceInfo deviceInfo
protected java.util.List<LegoService> services
protected boolean lowVoltage
protected LegoDevice.DeviceCategory category
protected LegoDevice.DeviceFunction supportedFunctions
protected int lastConnectedNetworkId
protected DeviceCallbackHelper callbackHelper
public java.util.List<LegoService> getServices()
LegoDevice
getServices
in interface LegoDevice
public java.util.List<LegoService> getInternalServices()
LegoDevice
getInternalServices
in interface LegoDevice
public java.util.List<LegoService> getExternalServices()
LegoDevice
getExternalServices
in interface LegoDevice
public LegoDevice.DeviceState getConnectState()
LegoDevice
getConnectState
in interface LegoDevice
public java.lang.String getDeviceId()
LegoDevice
getDeviceId
in interface LegoDevice
public java.lang.String getName()
LegoDevice
getName
in interface LegoDevice
public boolean isButtonPressed()
LegoDevice
isButtonPressed
in interface LegoDevice
public java.lang.Integer getBatteryLevel()
LegoDevice
getBatteryLevel
in interface LegoDevice
public DeviceInfo getDeviceInfo()
LegoDevice
getDeviceInfo
in interface LegoDevice
public void registerCallbackListener(DeviceCallbackListener listener)
LegoDevice
registerCallbackListener
in interface LegoDevice
listener
- The delegate to addpublic void unregisterCallbackListener(DeviceCallbackListener listener)
LegoDevice
unregisterCallbackListener
in interface LegoDevice
listener
- The delegate to remove