public final class CBBeacon
extends java.lang.Object
implements android.os.Parcelable
A Beacon is identified by a unique multi-part identifier, with the first of the ordered identifiers being more significant for the purposes of grouping beacons. A Beacon sends a Bluetooth Low Energy (BLE) advertisement that contains these three identifiers, along with the calibrated tx power (in RSSI) of the Beacon's Bluetooth transmitter. This class may only be instantiated from a BLE packet, and an RSSI measurement for the packet. The class parses out the identifier, along with the calibrated tx power. It then uses the measured RSSI and calibrated tx power to do a rough distance measurement (the accuracy field)
CBRegion.matchesBeacon(CBBeacon)
Modifier and Type | Field and Description |
---|---|
static android.os.Parcelable.Creator<CBBeacon> |
CREATOR |
Modifier and Type | Method and Description |
---|---|
int |
describeContents() |
boolean |
equals(java.lang.Object obj)
Two detected beacons are considered equal if they share the same MAC Address,
proximityUUID, major & minor, regardless of their accuracy or RSSI.
|
double |
getAccuracy()
Provides a calculated estimate of the distance to the beacon based on a running average of
the RSSI and the transmitted power calibration value included in the beacon advertisement.
|
java.lang.String |
getMacAddress()
Gets Bluetooth MAC Address.
|
int |
getMajor()
Gets beacon major.
|
int |
getMinor()
Gets beacon minor.
|
java.lang.String |
getName()
Gets bluetooth device name.
|
Proximity |
getProximity()
Gets the current proximity of detected beacon.
|
java.util.UUID |
getProximityUUID()
Gets beacon proximity UUID.
|
int |
getRssi()
The measured signal strength of the Bluetooth packet when beacon is detected.
|
int |
getTxPower()
The calibrated measured Tx power of the Beacon in RSSI
This value is baked into an Beacon when it is manufactured, and
it is transmitted with each packet to aid in the accuracy estimation.
|
int |
hashCode() |
java.lang.String |
toString()
Formats a beacon as a string showing only its unique identifiers.
|
void |
writeToParcel(android.os.Parcel dest,
int flags) |
public static final android.os.Parcelable.Creator<CBBeacon> CREATOR
public java.lang.String getName()
public java.lang.String getMacAddress()
public java.util.UUID getProximityUUID()
public int getMajor()
public int getMinor()
public int getRssi()
public int getTxPower()
public double getAccuracy()
A double that is an estimate of how far the Beacon is away in meters. Note that this number fluctuates quite a bit with RSSI, so despite the name, it is not super accurate.
public Proximity getProximity()
public int hashCode()
hashCode
in class java.lang.Object
public boolean equals(java.lang.Object obj)
equals
in class java.lang.Object
public java.lang.String toString()
toString
in class java.lang.Object
public int describeContents()
describeContents
in interface android.os.Parcelable
public void writeToParcel(android.os.Parcel dest, int flags)
writeToParcel
in interface android.os.Parcelable