public interface LegoDevice
LegoDeviceManager
can be used to scan for and connect to a LegoDevice
.
Implement the DeviceCallbackListener
to be notified about changes to the device.Modifier and Type | Interface and Description |
---|---|
static class |
LegoDevice.DeviceCategory
The Category of the Device
|
static class |
LegoDevice.DeviceFunction
The Function a Device will support
|
static class |
LegoDevice.DeviceState
The connect state of the Device
|
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.DeviceCategory |
getCategory()
The System Category of the connected Device
|
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'.
|
int |
getLastConnectedNetworkId()
The ID of the network this Device was connected to last
|
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
|
LegoDevice.DeviceFunction |
getSupportedFunctions()
The Fuction(s) supported by the connected Device
|
boolean |
isButtonPressed()
The most recent button pressed state read from the Device.
|
boolean |
isLowVoltage()
True if the a low voltage alert has been received from the Device, indicating that batteries should be changed/charged
|
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 |
setName(java.lang.String name)
Writing a new name will immediately update the property value, even though the actual write to the
hardware is asynchronously, and may potentially fail.
|
void |
unregisterCallbackListener(DeviceCallbackListener listener)
Remove callback listener from this device
|
java.util.List<LegoService> getServices()
java.util.List<LegoService> getInternalServices()
java.util.List<LegoService> getExternalServices()
LegoDevice.DeviceState getConnectState()
java.lang.String getDeviceId()
java.lang.String getName()
void setName(java.lang.String name)
DeviceCallbackListener.didChangeNameFrom(dk.lego.devicesdk.device.LegoDevice, java.lang.String, java.lang.String)
is invoked.boolean isButtonPressed()
LegoDevice.DeviceCategory getCategory()
LegoDevice.DeviceFunction getSupportedFunctions()
int getLastConnectedNetworkId()
java.lang.Integer getBatteryLevel()
boolean isLowVoltage()
DeviceInfo getDeviceInfo()
void registerCallbackListener(DeviceCallbackListener listener)
listener
- The delegate to addvoid unregisterCallbackListener(DeviceCallbackListener listener)
listener
- The delegate to remove