public interface KontaktDeviceConnection
Modifier and Type | Interface and Description |
---|---|
static interface |
KontaktDeviceConnection.ConnectionListener |
Modifier and Type | Method and Description |
---|---|
void |
applySecureConfig(Config config,
AuthToken token,
WriteListener writeListener)
Method for writing secure config offline.
|
void |
applySecureConfig(java.lang.String encryptedConfig,
WriteListener writeListener)
Method for writing secure config.
|
void |
authorize(AuthToken token,
AuthorizationCallback callback)
Authorizes with beacon.
|
void |
close()
Closes Beacon connection releases provided resources.
|
boolean |
connect()
Initializes connection to device provided in the KontaktDeviceConnection constructor.
|
boolean |
connect(RemoteBluetoothDevice remoteBluetoothDevice)
Initializes connection to given device.
|
void |
executeSecureCommand(java.lang.String secureCommand,
WriteListener writeListener)
Executes Secure Command.
|
RemoteBluetoothDevice |
getDevice()
Gets beacon that the connection is established with.
|
boolean |
isAuthenticated()
Returns true if Beacon was successfully authenticated.
|
boolean |
isClosed()
Returns true if connection is closed.
|
boolean |
isConnected()
Returns true if Connection with Beacon is established.
|
void |
readAll(AuthToken token,
ReadListener<Config> listener)
Operation that returns beacon's current configuration wrapped in a
Config object. |
void |
readLightSensor(ReadListener<java.lang.Integer> listener)
Operation that returns current light sensor reading on a device.
|
void |
readTime(ReadListener<Time> listener)
Operation that returns current UTC time on a device.
|
void |
syncTime(WriteListener writeListener)
Operation that synchronizes current UTC time with the beacon.
|
void |
updateFirmware(Firmware firmware,
byte[] fileBytes,
KontaktCloud kontaktCloud,
FirmwareUpdateListener firmwareUpdateListener)
Method for initializing firmware update for Kontakt.io devices with secure profile (for now: Beacon PRO only).
|
void |
updateFirmware(Firmware firmware,
KontaktCloud kontaktCloud,
FirmwareUpdateListener firmwareUpdateListener)
Method for initializing firmware update for Kontakt.io devices with secure profile (for now: Beacon PRO only)
|
void authorize(AuthToken token, AuthorizationCallback callback)
readTime(ReadListener)
readLightSensor(ReadListener)
token
- AuthToken
instance required for authorization.callback
- Authorization result callback.void applySecureConfig(java.lang.String encryptedConfig, WriteListener writeListener)
IllegalOperationException
if provided device's firmware does not support this operation
*void applySecureConfig(Config config, AuthToken token, WriteListener writeListener)
IllegalOperationException
if provided device's firmware does not support this operationconfig
- Config that is about to be applied.token
- AuthToken
token.writeListener
- Operation listenervoid executeSecureCommand(java.lang.String secureCommand, WriteListener writeListener)
secureCommand
- String representing secure command.writeListener
- Execution listener.void readAll(AuthToken token, ReadListener<Config> listener)
Config
object.authorize(AuthToken,
AuthorizationCallback)
.token
- AuthToken
instance.listener
- Read listener.void readTime(ReadListener<Time> listener)
authorize(AuthToken, AuthorizationCallback)
listener
- Read listenervoid syncTime(WriteListener writeListener)
authorize(AuthToken, AuthorizationCallback)
writeListener
- Write listener (extra will always be null in this case)void readLightSensor(ReadListener<java.lang.Integer> listener)
authorize(AuthToken, AuthorizationCallback)
listener
- Read listenervoid updateFirmware(Firmware firmware, KontaktCloud kontaktCloud, FirmwareUpdateListener firmwareUpdateListener)
firmware
- Firmware
instance.kontaktCloud
- KontaktCloud
instance. This is required for Beacon authorization and downloading firmware file.firmwareUpdateListener
- FirmwareUpdateListener
instance. Listener that will report firmware update progress and errors.void updateFirmware(Firmware firmware, byte[] fileBytes, KontaktCloud kontaktCloud, FirmwareUpdateListener firmwareUpdateListener)
firmware
- Firmware
instance.fileBytes
- Firmware file bytes.kontaktCloud
- KontaktCloud
instance. This is required for Beacon authorization.firmwareUpdateListener
- FirmwareUpdateListener
instance. Listener that will report firmware update progress and errors.RemoteBluetoothDevice getDevice()
boolean connect()
boolean connect(RemoteBluetoothDevice remoteBluetoothDevice)
remoteBluetoothDevice
- device to connect to.void close()
boolean isConnected()
boolean isAuthenticated()
boolean isClosed()