public class DeviceConnection
extends java.lang.Object
DeviceConnectionProvider
.Modifier and Type | Class and Description |
---|---|
static interface |
DeviceConnection.CheckFirmwareCallback
Callback to indicate whether device needs update.
|
static interface |
DeviceConnection.FirmwareUpdateCallback
Callback to indicate status of beacon's update.
|
static interface |
DeviceConnection.SyncSettingsCallback
Callback for synchronising device with cloud
|
Constructor and Description |
---|
DeviceConnection(DeviceSettingBuilder builder) |
Modifier and Type | Method and Description |
---|---|
CallbackHandler |
checkForFirmwareUpdate(DeviceConnection.CheckFirmwareCallback callback)
Checks if there is new firmware available for connected device.
|
void |
close()
Closes connection to device.
|
void |
connect(DeviceConnectionCallback callback)
If no current connection is opened, it creates one and attaches callback.
|
void |
destroy()
Destroys this object callback from internal device connection object.
|
SettingsEditor |
edit()
Settings editor that allows to conveniently change more than one device setting.
|
boolean |
isConnected()
Check if device is connected.
|
CallbackHandler |
readRssi(SettingCallback<java.lang.Integer> callback)
Reads remote RSSI value from connection.
|
void |
reconnect()
Does reconnection using the same callback object as provided while
first usage of
connect(DeviceConnectionCallback) |
CallbackHandler |
syncSettings(DeviceConnection.SyncSettingsCallback callback)
Allows to synchronise device settings with cloud.
|
CallbackHandler |
updateDevice(DeviceConnection.FirmwareUpdateCallback callback)
Updates device firmware.
|
public final Settings settings
public DeviceConnection(DeviceSettingBuilder builder)
public void connect(DeviceConnectionCallback callback)
callback
- public boolean isConnected()
destroy()
was called.public void reconnect()
connect(DeviceConnectionCallback)
public void destroy()
public void close()
reconnect()
or connect(DeviceConnectionCallback)
.
New connection must be obtained using DeviceConnectionProvider
.public CallbackHandler readRssi(SettingCallback<java.lang.Integer> callback)
callback
- Callback that returns RSSI value.public CallbackHandler updateDevice(DeviceConnection.FirmwareUpdateCallback callback)
checkForFirmwareUpdate(CheckFirmwareCallback)
to check
if firmware update is really needed.callback
- Callback to inform about firmware update progress.public CallbackHandler checkForFirmwareUpdate(DeviceConnection.CheckFirmwareCallback callback)
updateDevice(FirmwareUpdateCallback)
should be used to perform update.public CallbackHandler syncSettings(DeviceConnection.SyncSettingsCallback callback)
callback
- Callback to be notified about the resultspublic SettingsEditor edit()