public class SyncableKontaktDeviceConnection
extends java.lang.Object
KontaktDeviceConnection and KontaktApiClient functionalities.
The syncable iBeacon connection allows for immediate pushes to both Bluetooth iBeacon and its
representation in kontakt.io Web API.| Modifier and Type | Class and Description |
|---|---|
static class |
SyncableKontaktDeviceConnection.SyncWriteBatchListener<T>
Abstract class used as listener to notify about batch updating device and syncing with REST API
|
static class |
SyncableKontaktDeviceConnection.SyncWriteListener
Abstract class used as listener to notify about updating device and syncing with REST API
|
| Constructor and Description |
|---|
SyncableKontaktDeviceConnection(Context context,
RemoteBluetoothDevice remoteBluetoothDevice,
IKontaktDeviceConnection.ConnectionListener connectionListener)
Instantiates a new Syncable Kontakt device connection.
|
| Modifier and Type | Method and Description |
|---|---|
void |
applyConfig(IConfig config,
SyncableKontaktDeviceConnection.SyncWriteBatchListener<IConfig> syncWriteBatchListener)
Applies pending configuration (
Config) for Beacon. |
void |
applySecureConfig(SecureSingleConfig secureConfig,
SyncableKontaktDeviceConnection.SyncWriteListener syncWriteListener)
Writes secure config and tries to sync with REST API
|
void |
close()
Closes Beacon connection releases provided resources.
|
boolean |
connectToDevice()
Connects to beacon device
|
RemoteBluetoothDevice |
getDevice()
Gets devices that the connection is established with.
|
boolean |
isConnectedToDevice()
Returns true if Connection with Beacon is established.
|
boolean |
isDeviceAuthenticated()
Returns true if Beacon was successfully authenticated.
|
void |
overwriteAdvertisingInterval(long interval,
SyncableKontaktDeviceConnection.SyncWriteListener syncWriteListener)
Writes advertising interval and tries to sync with REST API
|
void |
overwriteInstanceId(java.lang.String instanceId,
SyncableKontaktDeviceConnection.SyncWriteListener syncWriteListener)
Overwrites instanceId
|
void |
overwriteMajor(int value,
SyncableKontaktDeviceConnection.SyncWriteListener syncWriteListener)
Writes major value and tries to sync with REST API
|
void |
overwriteMinor(int value,
SyncableKontaktDeviceConnection.SyncWriteListener syncWriteListener)
Writes minor value and tries to sync with REST API
|
void |
overwriteModelName(java.lang.String modelName,
SyncableKontaktDeviceConnection.SyncWriteListener syncWriteListener)
Writes model name and tries to sync with REST API
|
void |
overwriteNamespace(java.lang.String namespaceId,
SyncableKontaktDeviceConnection.SyncWriteListener syncWriteListener)
Overwrites namespae
|
void |
overwritePassword(java.lang.String password,
SyncableKontaktDeviceConnection.SyncWriteListener syncWriteListener)
Writes password and tries to sync with REST API
|
void |
overwritePowerLevel(int value,
SyncableKontaktDeviceConnection.SyncWriteListener syncWriteListener)
Writes power level and tries to sync with REST API
|
void |
overwriteProximityUUID(java.util.UUID proximityUUID,
SyncableKontaktDeviceConnection.SyncWriteListener syncWriteListener)
Writes proximity uuid value and tries to sync with REST API
|
void |
overwriteUrl(java.lang.String url,
SyncableKontaktDeviceConnection.SyncWriteListener syncWriteListener)
Overwrites url
|
void |
resetDevice(WriteListener writeListener)
Resets device so that connection is established once again.
|
public SyncableKontaktDeviceConnection(Context context,
RemoteBluetoothDevice remoteBluetoothDevice,
IKontaktDeviceConnection.ConnectionListener connectionListener)
context - the contextremoteBluetoothDevice - the beacon deviceconnectionListener - the connection listenerpublic boolean connectToDevice()
public boolean isConnectedToDevice()
public void close()
public RemoteBluetoothDevice getDevice()
public boolean isDeviceAuthenticated()
public void overwriteMinor(int value,
SyncableKontaktDeviceConnection.SyncWriteListener syncWriteListener)
value - the minor value to setsyncWriteListener - SyncableKontaktDeviceConnection.SyncWriteListenerpublic void overwriteMajor(int value,
SyncableKontaktDeviceConnection.SyncWriteListener syncWriteListener)
value - the major valuesyncWriteListener - SyncableKontaktDeviceConnection.SyncWriteListenerpublic void overwritePowerLevel(int value,
SyncableKontaktDeviceConnection.SyncWriteListener syncWriteListener)
value - the power levelsyncWriteListener - SyncableKontaktDeviceConnection.SyncWriteListenerpublic void overwriteProximityUUID(java.util.UUID proximityUUID,
SyncableKontaktDeviceConnection.SyncWriteListener syncWriteListener)
proximityUUID - the proximity UUIDsyncWriteListener - SyncableKontaktDeviceConnection.SyncWriteListenerpublic void overwritePassword(java.lang.String password,
SyncableKontaktDeviceConnection.SyncWriteListener syncWriteListener)
password - the password for devicesyncWriteListener - SyncableKontaktDeviceConnection.SyncWriteListenerpublic void overwriteAdvertisingInterval(long interval,
SyncableKontaktDeviceConnection.SyncWriteListener syncWriteListener)
interval - advertising intervalsyncWriteListener - SyncableKontaktDeviceConnection.SyncWriteListenerpublic void overwriteModelName(java.lang.String modelName,
SyncableKontaktDeviceConnection.SyncWriteListener syncWriteListener)
modelName - model namesyncWriteListener - SyncableKontaktDeviceConnection.SyncWriteListenerpublic void resetDevice(WriteListener writeListener)
writeListener - SyncableKontaktDeviceConnection.SyncWriteListenerpublic void overwriteUrl(java.lang.String url,
SyncableKontaktDeviceConnection.SyncWriteListener syncWriteListener)
url - the urlsyncWriteListener - SyncableKontaktDeviceConnection.SyncWriteListenerpublic void overwriteNamespace(java.lang.String namespaceId,
SyncableKontaktDeviceConnection.SyncWriteListener syncWriteListener)
namespaceId - the namespacesyncWriteListener - SyncableKontaktDeviceConnection.SyncWriteListenerpublic void overwriteInstanceId(java.lang.String instanceId,
SyncableKontaktDeviceConnection.SyncWriteListener syncWriteListener)
instanceId - the instanceIdsyncWriteListener - SyncableKontaktDeviceConnection.SyncWriteListenerpublic void applyConfig(IConfig config, SyncableKontaktDeviceConnection.SyncWriteBatchListener<IConfig> syncWriteBatchListener)
Config) for Beacon.
* It is possible to encounter problems during batch (the Config in this case)
write operation which results in launching error handle callback method.
Once the write batch operation failes, the Write Batch Processor
will attempt performing rollback write batch operation aiming at
restoring original Beacon configuration.
The rollback operation however may not succeed as well leaving Beacon device
changed partially.
Therefore it is strongly advisable to write batches in relatively close distance
to Beacon device. Thus, the risk of leaving Beacon in unspecified state may
be avoided.
If batch write succeed attempt to sync with REST API will be doneconfig - ConfigsyncWriteBatchListener - SyncableKontaktDeviceConnection.SyncWriteBatchListenerpublic void applySecureConfig(SecureSingleConfig secureConfig, SyncableKontaktDeviceConnection.SyncWriteListener syncWriteListener)
secureConfig - the secureConfigsyncWriteListener - SyncableKontaktDeviceConnection.SyncWriteListener