public class Beacon extends java.lang.Object implements java.lang.Comparable<Beacon>
Modifier and Type | Class and Description |
---|---|
static interface |
Beacon.BeaconStatus
Annotation defining the possible beacon status
|
Modifier and Type | Field and Description |
---|---|
static int |
STATUS_LOST
Beacon is lost
|
static int |
STATUS_LOW_BATTERY
Beacon battery is low
|
static int |
STATUS_NEEDS_MAINTENANCE
Beacon needs maintenance
|
static int |
STATUS_NO_BATTERY
Beacon battery is empty
|
static int |
STATUS_OK
Beacon is working
|
static int |
STATUS_OUT_OF_ORDER
Beacon is out of order
|
static java.lang.String |
TYPE
String containing the Beacon type
|
Constructor and Description |
---|
Beacon(android.bluetooth.BluetoothDevice device,
int rssi,
byte[] scanRecord)
Deprecated.
Use the
Beacon(BluetoothDevice, int, byte[],
Building, Floor) Constructor. |
Beacon(android.bluetooth.BluetoothDevice device,
int rssi,
byte[] scanRecord,
Building building,
Floor floor)
Beacon constructor.
|
Modifier and Type | Method and Description |
---|---|
static java.lang.String |
bytesToHex(byte[] bytes,
int start,
int end)
This method converts an array of bytes to an hexadecimal string.
|
int |
compareTo(Beacon another) |
double |
computeAccuracy(double rssi)
This method computes an estimation of the accuracy according to the
RSSI level received.
|
static boolean |
detect(byte[] scanRecord)
This method checks that the BLE broadcasted message corresponds to an
Beacon or Eddystone Beacon.
|
boolean |
equals(java.lang.Object o) |
java.lang.String |
getBuilding()
Getter for the Beacon Building ID.
|
java.lang.String |
getFloor()
Getter for the Beacon Floor ID.
|
int |
getFloorNumber()
Getter for the Beacon Floor number.
|
java.lang.String |
getId()
Getter for the Beacon ID.
|
java.lang.String |
getIdentifier()
This method provides an identifier for the Beacon that can be used
across the different platforms.
|
double |
getLatitude()
Getter for the Beacon latitude.
|
double |
getLongitude()
Getter for the Beacon longitude.
|
int |
getMajor()
Getter for the Beacon major.
|
int |
getMinor()
Getter for the Beacon minor.
|
java.lang.String |
getScanDate()
Getter for the Beacon scan date.
|
int |
getStatus()
Getter for the Beacon status.
|
int |
getTxPower()
Getter for the Beacon transmission power.
|
java.lang.String |
getType()
Deprecated.
|
java.lang.String |
getUuid()
Getter for the Beacon proximity UUID.
|
double |
getX()
Deprecated.
Use
getLongitude() instead. |
double |
getY()
Deprecated.
Use
getLatitude() instead. |
int |
hashCode() |
void |
setBuilding(java.lang.String building)
Setter for the Beacon Building ID.
|
void |
setFloor(java.lang.String floor)
Setter for the Beacon Floor ID.
|
void |
setFloorNumber(int floorNumber)
Setter for the Beacon Floor number.
|
void |
setId(java.lang.String id)
Setter for the Beacon ID.
|
void |
setLatitude(double lat)
Setter for the Beacon latitude.
|
void |
setLongitude(double lon)
Setter for the Beacon longitude.
|
void |
setMajor(int major)
Setter for the Beacon major.
|
void |
setMinor(int minor)
Setter for the Beacon minor.
|
void |
setScanDate(java.lang.String scanDate)
Setter for the Beacon scan date.
|
void |
setStatus(int status)
Setter for the Beacon status.
|
void |
setTxPower(int txPower)
Setter for the Beacon transmission power.
|
void |
setType(java.lang.String type)
Deprecated.
|
void |
setUuid(java.lang.String uuid)
Setter for the Beacon proximity UUID.
|
void |
setX(double x)
Deprecated.
Use
setLongitude(double) instead. |
void |
setY(double y)
Deprecated.
Use
setLatitude(double) instead. |
public static final java.lang.String TYPE
public static final int STATUS_OK
public static final int STATUS_LOW_BATTERY
public static final int STATUS_LOST
public static final int STATUS_NEEDS_MAINTENANCE
public static final int STATUS_OUT_OF_ORDER
public static final int STATUS_NO_BATTERY
public Beacon(android.bluetooth.BluetoothDevice device, int rssi, byte[] scanRecord, Building building, Floor floor)
device
- BluetoothDevice object that identifies the remote devicerssi
- The RSSI value for the remote device as reported by the
Bluetooth hardwarescanRecord
- The content of the advertisement record offered by the
remote devicebuilding
- Building objectfloor
- Floor numberpublic Beacon(android.bluetooth.BluetoothDevice device, int rssi, byte[] scanRecord)
Beacon(BluetoothDevice, int, byte[],
Building, Floor)
Constructor.device
- BluetoothDevice object that identifies the remote devicerssi
- The RSSI value for the remote device as reported by the
Bluetooth hardwarescanRecord
- The content of the advertisement record offered by the
remote devicepublic static boolean detect(byte[] scanRecord)
scanRecord
- The content of the advertisement record offered by the
remote devicepublic static java.lang.String bytesToHex(byte[] bytes, int start, int end)
bytes
- Byte array to be decodedstart
- Initial position to be decodedend
- Last position to be decodedpublic int compareTo(Beacon another)
compareTo
in interface java.lang.Comparable<Beacon>
public boolean equals(java.lang.Object o)
equals
in class java.lang.Object
public int hashCode()
hashCode
in class java.lang.Object
public double computeAccuracy(double rssi)
rssi
- The RSSI value for the remote device as reported by the Bluetooth hardwarepublic java.lang.String getIdentifier()
public java.lang.String getId()
public double getLatitude()
public void setLatitude(double lat)
lat
- The Beacon latitude to be setpublic void setId(java.lang.String id)
id
- The Beacon ID to be setpublic double getLongitude()
public void setLongitude(double lon)
lon
- The Beacon longitude to be set@Deprecated public double getX()
getLongitude()
instead.@Deprecated public void setX(double x)
setLongitude(double)
instead.x
- The Beacon longitude to be set@Deprecated public double getY()
getLatitude()
instead.@Deprecated public void setY(double y)
setLatitude(double)
instead.y
- The Beacon latitude to be setpublic int getMajor()
public void setMajor(int major)
major
- The Beacon major to be setpublic int getMinor()
public void setMinor(int minor)
minor
- The Beacon minorpublic int getTxPower()
public void setTxPower(int txPower)
txPower
- The Beacon transmission power to be setpublic java.lang.String getUuid()
public void setUuid(java.lang.String uuid)
uuid
- The Beacon proximity UUID to be setpublic java.lang.String getBuilding()
public void setBuilding(java.lang.String building)
building
- The Beacon Building ID to be setpublic java.lang.String getFloor()
public void setFloor(java.lang.String floor)
floor
- The Beacon Floor ID to be setpublic int getFloorNumber()
public void setFloorNumber(int floorNumber)
floorNumber
- The Beacon Floor number to be set@Deprecated public java.lang.String getType()
@Deprecated public void setType(java.lang.String type)
type
- The Beacon type to be setpublic java.lang.String getScanDate()
public void setScanDate(java.lang.String scanDate)
scanDate
- The Beacon scan date to be setpublic int getStatus()
public void setStatus(int status)
status
- The Beacon status to be set