public interface KontaktDeviceConnection
Modifier and Type | Interface and Description |
---|---|
static interface |
KontaktDeviceConnection.ConnectionListener |
Modifier and Type | Method and Description |
---|---|
void |
acceptProfile(Preset profile,
WriteBatchListener<Preset> writeBatchListener)
Accepts predefined profile (
Preset ) and changes parameters for Beacon. |
void |
applyConfig(Config config,
WriteBatchListener<Config> writeBatchListener)
Applies pending configuration (
Config ) for Device. |
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 |
enableDfuMode(java.lang.String masterPassword,
WriteListener writeListener)
Enables dfu mode.
|
void |
enableNonConnectableMode(java.lang.String masterPassword,
WriteListener writeListener)
Changes Device mode to non-connectable.
|
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 |
overwriteAdvertisingInterval(long millis,
WriteListener writeListener)
Changes Beacon advertising interval.
|
void |
overwriteInstanceId(java.lang.String instanceId,
WriteListener writeListener)
Overwrite instance id.
|
void |
overwriteMajor(int value,
WriteListener writeListener)
Changes Beacon major value.
|
void |
overwriteMinor(int value,
WriteListener writeListener)
Writes minor value.
|
void |
overwriteModelName(java.lang.String newModelName,
WriteListener writeListener)
Changes Beacon model name.
|
void |
overwriteNamespaceId(java.lang.String namespaceId,
WriteListener writeListener)
Overwrites namespace id.
|
void |
overwritePassword(java.lang.String newPassword,
WriteListener writeListener)
Changes beacon password.
|
void |
overwritePowerLevel(int powerLevel,
WriteListener writeListener)
Changes Beacon power level.
|
void |
overwriteProximityUUID(java.util.UUID proximity,
WriteListener writeListener)
Changes Beacon Proximity UUID value.
|
void |
overwriteUrl(java.lang.String newUrl,
WriteListener writeListener)
Overwrites url.
|
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 |
resetDevice(WriteListener writeListener)
Resets device so that connection is established once again.
|
void |
restoreDefaultSettings(java.lang.String masterPassword,
WriteListener writeListener)
Restores default Beacon settings.
|
void |
switchToDeviceProfile(DeviceProfile deviceProfile,
WriteListener writeListener)
Switch to device profile.
|
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 applyConfig(Config config, WriteBatchListener<Config> writeBatchListener)
Config
) for Device.
IllegalOperationException
if provided RemoteBluetoothDevice
is in version 4.0 or
higherconfig
- the configwriteBatchListener
- the write batch listenervoid acceptProfile(Preset profile, WriteBatchListener<Preset> writeBatchListener)
Preset
) and changes parameters for Beacon.
IllegalOperationException
if provided RemoteBluetoothDevice
is in version 4.0 or
higherprofile
- the profilewriteBatchListener
- the write batch listenervoid overwriteMinor(int value, WriteListener writeListener)
IllegalOperationException
if provided RemoteBluetoothDevice
is in version 4.0 or
highervalue
- the valuewriteListener
- the write listenervoid enableNonConnectableMode(java.lang.String masterPassword, WriteListener writeListener)
Credentials
)
IllegalOperationException
if provided RemoteBluetoothDevice
is in version 4.0 or
highermasterPassword
- the beacon master passwordwriteListener
- the write listenervoid overwriteMajor(int value, WriteListener writeListener)
IllegalOperationException
if provided RemoteBluetoothDevice
is in version 4.0 or
highervalue
- new valuewriteListener
- the write listenervoid overwriteProximityUUID(java.util.UUID proximity, WriteListener writeListener)
IllegalOperationException
if provided RemoteBluetoothDevice
is in version 4.0 or
higherproximity
- the proximity UUIDwriteListener
- the write listenervoid overwritePassword(java.lang.String newPassword, WriteListener writeListener)
IllegalOperationException
if provided RemoteBluetoothDevice
is in version 4.0 or
highernewPassword
- the new passwordwriteListener
- the write listenervoid overwriteModelName(java.lang.String newModelName, WriteListener writeListener)
IllegalOperationException
if provided RemoteBluetoothDevice
is in version 4.0 or
highernewModelName
- the new model namewriteListener
- the write listenervoid overwriteAdvertisingInterval(long millis, WriteListener writeListener)
IllegalOperationException
if provided RemoteBluetoothDevice
is in version 4.0 or
highermillis
- the interval milliswriteListener
- the write listenervoid overwritePowerLevel(int powerLevel, WriteListener writeListener)
IllegalOperationException
if provided RemoteBluetoothDevice
is in version 4.0 or
higherpowerLevel
- the power levelwriteListener
- the write listenervoid switchToDeviceProfile(DeviceProfile deviceProfile, WriteListener writeListener)
IllegalOperationException
if provided RemoteBluetoothDevice
is in version 4.0 or
higherdeviceProfile
- the device profilewriteListener
- the write listenervoid resetDevice(WriteListener writeListener)
IllegalOperationException
if provided RemoteBluetoothDevice
is in version 4.0 or
higherwriteListener
- the write listenervoid enableDfuMode(java.lang.String masterPassword, WriteListener writeListener)
IllegalOperationException
if provided RemoteBluetoothDevice
is in version 4.0 or
highermasterPassword
- the master passwordwriteListener
- the write listenervoid overwriteUrl(java.lang.String newUrl, WriteListener writeListener)
IllegalOperationException
if provided RemoteBluetoothDevice
is in version 4.0 or
highernewUrl
- the new urlwriteListener
- the write listenervoid overwriteNamespaceId(java.lang.String namespaceId, WriteListener writeListener)
IllegalOperationException
if provided RemoteBluetoothDevice
is in version 4.0 or
highernamespaceId
- the namespace idwriteListener
- the write listenervoid overwriteInstanceId(java.lang.String instanceId, WriteListener writeListener)
IllegalOperationException
if provided RemoteBluetoothDevice
is in version 4.0 or
higherinstanceId
- the instance idwriteListener
- the write listenervoid restoreDefaultSettings(java.lang.String masterPassword, WriteListener writeListener)
IllegalOperationException
if provided RemoteBluetoothDevice
is in version 4.0 or
highermasterPassword
- the master passwordwriteListener
- the write listenervoid authorize(AuthToken token, AuthorizationCallback callback)
readTime(ReadListener)
readLightSensor(ReadListener)
token
- AuthToken
instance required for authorization.callback
- Authorization result callback.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 readLightSensor(ReadListener<java.lang.Integer> listener)
authorize(AuthToken, AuthorizationCallback)
listener
- Read listenervoid 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 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.void syncTime(WriteListener writeListener)
authorize(AuthToken, AuthorizationCallback)
writeListener
- Write listener (extra will always be null in this case)RemoteBluetoothDevice getDevice()
boolean connect()
boolean connect(RemoteBluetoothDevice remoteBluetoothDevice)
remoteBluetoothDevice
- device to connect to.void close()
boolean isConnected()
boolean isAuthenticated()
boolean isClosed()