@Deprecated
public class BeaconConnection
extends java.lang.Object
EstimoteSDK.initialize(Context, String, String)
prior to connecting to beacon.
Exposes methods to change beacon's UUID, major, minor, advertising advertisingInterval,
broadcasting transmitPower, transmitPower modes values. You can only change those values only if
there is established connection to beacon.
It is very important to close()
connection when it is not needed.
Usage:
BeaconConnection connection = new BeaconConnection(context, beacon, new BeaconConnection.ConnectionCallback() { @Override public void onConnected(BeaconInfo beaconInfo) { Log.d(TAG, "Authenticated to beacon. Info: " + beaconInfo); Log.d(TAG, "Advertising internal: " + connection.advertisingIntervalMillis().get()); Log.d(TAG, "Broadcasting transmitPower: " + connection.broadcastingPower().get()); } @Override public void onAuthenticationError(EstimoteDeviceException exception) { Log.d(TAG, "Authentication Error: " + exception); } @Override public void onDisconnected() { Log.d(TAG, "Disconnected"); } }); connection.authenticate(); // Interact with beacon. // You can update beacon's properties in following way: connection.edit() .set(connection.proximityUuid(), newUuid) .set(connection.major(), newMajor) .set(connection.minor(), newMinor) .commit(new BeaconConnection.WriteCallback() { @Override public void onSuccess() {} @Override public void onError(EstimoteDeviceException exception) {} }); // Do not forget to close connection. connection.close();This class is deprecated. Please use
DeviceConnection
obtained from DeviceConnectionProvider
.Modifier and Type | Class and Description |
---|---|
static interface |
BeaconConnection.CheckFirmwareCallback
Deprecated.
Callback to indicate whether device needs update.
|
static interface |
BeaconConnection.ConnectionCallback
Deprecated.
Callback used to indicate state of the connection to the beacon.
|
class |
BeaconConnection.PropertyChanger
Deprecated.
|
static interface |
BeaconConnection.WriteCallback
Deprecated.
Callback used to indicate status of updating beacon characteristic.
|
Constructor and Description |
---|
BeaconConnection(android.content.Context context,
Beacon beacon,
BeaconConnection.ConnectionCallback connectionCallback)
Deprecated.
Constructs new connection object based on
Beacon object. |
BeaconConnection(android.content.Context context,
MacAddress macAddress)
Deprecated.
Constructs new connection object based on beacon's MAC address.
|
BeaconConnection(android.content.Context context,
MacAddress macAddress,
BeaconConnection.ConnectionCallback connectionCallback)
Deprecated.
Constructs new connection object based on beacon's MAC address.
|
Modifier and Type | Method and Description |
---|---|
void |
addConnectionCallback(BeaconConnection.ConnectionCallback callback)
Deprecated.
Adds new connection callback to connection.
|
<any> |
advertisingIntervalMillis()
Deprecated.
|
void |
authenticate()
Deprecated.
Starts connection flow to device with 10s timeout.
|
<any> |
basicPowerMode()
Deprecated.
|
<any> |
broadcastingPower()
Deprecated.
|
<any> |
broadcastingScheme()
Deprecated.
Broadcasting scheme controls what packet type beacon is broadcasting.
|
void |
checkFirmwareUpdate(BeaconConnection.CheckFirmwareCallback callback)
Deprecated.
Checks whether beacon needs firmware update.
|
void |
clearCallbacks()
Deprecated.
Removes all callbacks from connection.
|
void |
close()
Deprecated.
Closes connection to beacon or cancels in-flight connection flow.
|
<any> |
conditionalBroadcasting()
Deprecated.
Property responsible for setting Flip To Sleep mode.
|
protected BeaconNoCloudConnection |
createNoCloudConnection(android.content.Context context,
MacAddress macAddress)
Deprecated.
|
<any> |
eddystoneInstance()
Deprecated.
Eddystone-UID instance property is 12 hex characters (6 bytes).
|
<any> |
eddystoneNamespace()
Deprecated.
Eddystone-UID namespace property is 20 hex characters (10 bytes).
|
<any> |
eddystoneUrl()
Deprecated.
Eddystone-URL's URL property can be at max 17 characters.
|
BeaconConnection.PropertyChanger |
edit()
Deprecated.
|
java.lang.Integer |
getBatteryPercent()
Deprecated.
|
java.lang.String |
getHardwareVersion()
Deprecated.
|
protected InternalEstimoteCloud |
getInternalEstimoteCloud()
Deprecated.
|
MacAddress |
getMacAddress()
Deprecated.
|
java.lang.String |
getSoftwareVersion()
Deprecated.
|
boolean |
isConnected()
Deprecated.
|
<any> |
major()
Deprecated.
|
<any> |
minor()
Deprecated.
|
<any> |
motionDetectionEnabled()
Deprecated.
Enables or disables the accelerometer allowing to detect if beacon is in motion.
|
<any> |
motionState()
Deprecated.
A flag indicating if the beacon is in motion or not.
|
<any> |
proximityUuid()
Deprecated.
|
void |
removeConnectionCallback(BeaconConnection.ConnectionCallback callback)
Deprecated.
Removes callback from connection.
|
<any> |
secureUUID()
Deprecated.
Property for enabling/disabling Secure UUID.
|
void |
setMotionListener(<any> callback)
Deprecated.
Sets listener to beacon's motion changes.
|
<any> |
smartPowerMode()
Deprecated.
|
<any> |
temperature()
Deprecated.
Property for reading temperature value from beacon.
|
<any> |
temperatureCalibration()
Deprecated.
Calibrates the beacon’s thermometer sensor.
|
void |
updateBeacon(BeaconOta.Callback callback)
Deprecated.
Updates beacon's firmware.
|
void |
writeLocationName(java.lang.String locationName,
BeaconConnection.WriteCallback writeCallback)
Deprecated.
Changes location value of the beacon.
|
public BeaconConnection(android.content.Context context, Beacon beacon, BeaconConnection.ConnectionCallback connectionCallback)
Beacon
object.context
- Android context.beacon
- Beacon
to connect to.connectionCallback
- Connection callback.public BeaconConnection(android.content.Context context, MacAddress macAddress, BeaconConnection.ConnectionCallback connectionCallback)
context
- Android context.macAddress
- MAC address of the beacon.connectionCallback
- Connection callback.public BeaconConnection(android.content.Context context, MacAddress macAddress)
context
- Android context.macAddress
- MAC address of the beacon.public void addConnectionCallback(BeaconConnection.ConnectionCallback callback)
callback
- Adds new callback to connection.public void removeConnectionCallback(BeaconConnection.ConnectionCallback callback)
callback
- Callback to be removed.public void clearCallbacks()
public void authenticate()
public void close()
public boolean isConnected()
public MacAddress getMacAddress()
public java.lang.Integer getBatteryPercent()
public java.lang.String getSoftwareVersion()
public java.lang.String getHardwareVersion()
public <any> broadcastingPower()
public <any> advertisingIntervalMillis()
public <any> proximityUuid()
public <any> major()
public <any> minor()
public <any> basicPowerMode()
public <any> smartPowerMode()
public <any> conditionalBroadcasting()
public <any> temperature()
Note that Property#get()
will return cached value. If you want to read most
up to date temperature value, do use Property#getAsync(Property.Callback)
.
This property is read-only. If you try to write a value, an UnsupportedOperationException
will be thrown.
temperatureCalibration()
public <any> temperatureCalibration()
Beacons are basically calibrated out of the box, but additional manual calibration is recommended in order to minimize measurement error. When the sensor is not calibrated, measurement error is ±4 Celsius degrees. After calibration it’s ±2 Celsius degrees.
To perform calibration you need to keep the beacon at room temperature for a couple of minutes. Use a separate thermometer to read the actual value (in Celsius degrees) and pass it.
This property is write only. If you try to read it, an UnsupportedOperationException
will be thrown.
public <any> motionDetectionEnabled()
public <any> motionState()
This property is read only. If you try to write to it, an UnsupportedOperationException
will be thrown.
public <any> secureUUID()
public void writeLocationName(java.lang.String locationName, BeaconConnection.WriteCallback writeCallback)
locationName
- Location name to be set.writeCallback
- Callback to be invoked when write is completed.public void checkFirmwareUpdate(BeaconConnection.CheckFirmwareCallback callback)
callback
- Callback to indicate firmware status.public <any> broadcastingScheme()
public <any> eddystoneNamespace()
public <any> eddystoneInstance()
public <any> eddystoneUrl()
public void updateBeacon(BeaconOta.Callback callback)
callback
- Callback to indicate status of update.protected BeaconNoCloudConnection createNoCloudConnection(android.content.Context context, MacAddress macAddress)
protected InternalEstimoteCloud getInternalEstimoteCloud()
public void setMotionListener(<any> callback)
callback
- Motion listener callback.public BeaconConnection.PropertyChanger edit()