public class SyncableIBeaconConnection
extends java.lang.Object
IBeaconConnection
and KontaktApiClient
functionalities.
The syncable iBeacon connection allows for immediate pushes to both Bluetooth iBeacon and its
representation int kontakt.io Web API.Modifier and Type | Class and Description |
---|---|
static class |
SyncableIBeaconConnection.SyncWriteBatchListener<T>
Abstract class used as listener to notify about batch updating device and syncing with REST API
|
static class |
SyncableIBeaconConnection.SyncWriteListener
Abstract class used as listener to notify about updating device and syncing with REST API
|
Constructor and Description |
---|
SyncableIBeaconConnection(android.content.Context context,
IBeaconDevice beaconDevice,
IBeaconConnection.ConnectionListener connectionListener)
Instantiates a new Syncable i beacon connection.
|
Modifier and Type | Method and Description |
---|---|
void |
applyConfig(Config config,
SyncableIBeaconConnection.SyncWriteBatchListener<Config> syncWriteBatchListener)
Applies pending configuration (
Config ) for Beacon. |
void |
close()
Closes Beacon connection releases provided resources.
|
boolean |
connectToDevice()
Connects to beacon device
|
IBeaconDevice |
getDevice()
Gets beacon 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,
SyncableIBeaconConnection.SyncWriteListener syncWriteListener)
Writes advertising interval and tries to sync with REST API
|
void |
overwriteMajor(int value,
SyncableIBeaconConnection.SyncWriteListener syncWriteListener)
Writes major value and tries to sync with REST API
|
void |
overwriteMinor(int value,
SyncableIBeaconConnection.SyncWriteListener syncWriteListener)
Writes minor value and tries to sync with REST API
|
void |
overwriteModelName(java.lang.String modelName,
SyncableIBeaconConnection.SyncWriteListener syncWriteListener)
Writes model name and tries to sync with REST API
|
void |
overwritePassword(java.lang.String password,
SyncableIBeaconConnection.SyncWriteListener syncWriteListener)
Writes password and tries to sync with REST API
|
void |
overwritePowerLevel(int value,
SyncableIBeaconConnection.SyncWriteListener syncWriteListener)
Writes power level and tries to sync with REST API
|
void |
overwriteProximityUUID(java.util.UUID proximityUUID,
SyncableIBeaconConnection.SyncWriteListener syncWriteListener)
Writes proximity uuid value and tries to sync with REST API
|
void |
resetDevice(IBeaconConnection.WriteListener writeListener)
Resets device so that connection is established once again.
|
public SyncableIBeaconConnection(android.content.Context context, IBeaconDevice beaconDevice, IBeaconConnection.ConnectionListener connectionListener)
context
- the contextbeaconDevice
- the beacon deviceconnectionListener
- the connection listenerpublic boolean connectToDevice()
public boolean isConnectedToDevice()
public void close()
public IBeaconDevice getDevice()
public boolean isDeviceAuthenticated()
public void overwriteMinor(int value, SyncableIBeaconConnection.SyncWriteListener syncWriteListener)
value
- the minor value to setsyncWriteListener
- SyncableIBeaconConnection.SyncWriteListener
public void overwriteMajor(int value, SyncableIBeaconConnection.SyncWriteListener syncWriteListener)
value
- the major valuesyncWriteListener
- SyncableIBeaconConnection.SyncWriteListener
public void overwritePowerLevel(int value, SyncableIBeaconConnection.SyncWriteListener syncWriteListener)
value
- the power levelsyncWriteListener
- SyncableIBeaconConnection.SyncWriteListener
public void overwriteProximityUUID(java.util.UUID proximityUUID, SyncableIBeaconConnection.SyncWriteListener syncWriteListener)
proximityUUID
- the proximity UUID
syncWriteListener
- SyncableIBeaconConnection.SyncWriteListener
public void overwritePassword(java.lang.String password, SyncableIBeaconConnection.SyncWriteListener syncWriteListener)
password
- the password for devicesyncWriteListener
- SyncableIBeaconConnection.SyncWriteListener
public void overwriteAdvertisingInterval(long interval, SyncableIBeaconConnection.SyncWriteListener syncWriteListener)
interval
- advertising intervalsyncWriteListener
- SyncableIBeaconConnection.SyncWriteListener
public void overwriteModelName(java.lang.String modelName, SyncableIBeaconConnection.SyncWriteListener syncWriteListener)
modelName
- model namesyncWriteListener
- SyncableIBeaconConnection.SyncWriteListener
public void resetDevice(IBeaconConnection.WriteListener writeListener)
writeListener
- SyncableIBeaconConnection.SyncWriteListener
public void applyConfig(Config config, SyncableIBeaconConnection.SyncWriteBatchListener<Config> syncWriteBatchListener)
Config
) for Beacon.
* It is possible to encounter problems during batch (the Config in this case)
write operation which result 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
- Config
syncWriteBatchListener
- SyncableIBeaconConnection.SyncWriteBatchListener