Package org.altbeacon.beacon
Class Region
- java.lang.Object
-
- org.altbeacon.beacon.Region
-
- All Implemented Interfaces:
Parcelable,Serializable
public class Region extends Object implements Parcelable, Serializable
This class represents a criteria of fields used to match beacons. The uniqueId field is used to distinguish this Region in the system. When you set up monitoring or ranging based on a Region and later want to stop monitoring or ranging, you must do so by passing a Region object that has the same uniqueId field value. If it doesn't match, you can't cancel the operation. There is no other purpose to this field. The region can be constructed from a multi-part identifier. The first identifier is the most significant, the second the second most significant, etc. When constructing a range, any or all of these identifiers may be set to null, which indicates that they are a wildcard and will match any value.- See Also:
- Serialized Form
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface android.os.Parcelable
Parcelable.ClassLoaderCreator<T extends Object>, Parcelable.Creator<T extends Object>
-
-
Field Summary
Fields Modifier and Type Field Description static Parcelable.Creator<Region>CREATORRequired to make class Parcelableprotected StringmBluetoothAddressprotected List<Identifier>mIdentifiersprotected StringmUniqueId-
Fields inherited from interface android.os.Parcelable
CONTENTS_FILE_DESCRIPTOR, PARCELABLE_WRITE_RETURN_VALUE
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedRegion(Parcel in)Region(String uniqueId, String bluetoothAddress)Constructs a new Region object to be used for Ranging or MonitoringRegion(String uniqueId, List<Identifier> identifiers)Constructs a new Region object to be used for Ranging or MonitoringRegion(String uniqueId, List<Identifier> identifiers, String bluetoothAddress)Constructs a new Region object to be used for Ranging or MonitoringRegion(String uniqueId, Identifier id1, Identifier id2, Identifier id3)Constructs a new Region object to be used for Ranging or Monitoring
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description Regionclone()Deprecated.instances of this class are immutable and therefore don't have to be cloned when used in concurrent code.Regionclone(Beacon beacon)intdescribeContents()booleanequals(Object other)StringgetBluetoothAddress()Returns the mac address used to filter for beaconsIdentifiergetId1()Convenience method to get the first identifierIdentifiergetId2()Convenience method to get the second identifierIdentifiergetId3()Convenience method to get the third identifierIdentifiergetIdentifier(int i)Returns the 0-indexed identifier Note: IMPORTANT: to get id1, you would call getIdentifier(0);StringgetUniqueId()Returns the identifier used to start or stop ranging/monitoring this region when calling theBeaconManagermethods.inthashCode()booleanhasSameIdentifiers(Region region)booleanmatchesBeacon(Beacon beacon)Checks to see if an Beacon object is included in the matching criteria of this RegionStringtoString()voidwriteToParcel(Parcel out, int flags)
-
-
-
Field Detail
-
CREATOR
public static final Parcelable.Creator<Region> CREATOR
Required to make class Parcelable
-
mIdentifiers
protected final List<Identifier> mIdentifiers
-
mBluetoothAddress
protected final String mBluetoothAddress
-
mUniqueId
protected final String mUniqueId
-
-
Constructor Detail
-
Region
public Region(String uniqueId, Identifier id1, Identifier id2, Identifier id3)
Constructs a new Region object to be used for Ranging or Monitoring- Parameters:
uniqueId- - A unique identifier used to later cancel Ranging and Monitoring, or change the region being Ranged/Monitoredid1- - most significant identifier (can be null)id2- - second most significant identifier (can be null)id3- - third most significant identifier (can be null)
-
Region
public Region(String uniqueId, List<Identifier> identifiers)
Constructs a new Region object to be used for Ranging or Monitoring- Parameters:
uniqueId- - A unique identifier used to later cancel Ranging and Monitoring, or change the region being Ranged/Monitoredidentifiers- - list of identifiers for this region
-
Region
public Region(String uniqueId, List<Identifier> identifiers, String bluetoothAddress)
Constructs a new Region object to be used for Ranging or Monitoring- Parameters:
uniqueId- - A unique identifier used to later cancel Ranging and Monitoring, or change the region being Ranged/Monitoredidentifiers- - list of identifiers for this regionbluetoothAddress- - mac address
-
Region
public Region(String uniqueId, String bluetoothAddress)
Constructs a new Region object to be used for Ranging or Monitoring- Parameters:
uniqueId- - A unique identifier used to later cancel Ranging and Monitoring, or change the region being Ranged/MonitoredbluetoothAddress- - mac address used to match beacons
-
Region
protected Region(Parcel in)
-
-
Method Detail
-
getId1
public Identifier getId1()
Convenience method to get the first identifier- Returns:
-
getId2
public Identifier getId2()
Convenience method to get the second identifier- Returns:
-
getId3
public Identifier getId3()
Convenience method to get the third identifier- Returns:
-
getIdentifier
public Identifier getIdentifier(int i)
Returns the 0-indexed identifier Note: IMPORTANT: to get id1, you would call getIdentifier(0);- Parameters:
i-- Returns:
-
getUniqueId
public String getUniqueId()
Returns the identifier used to start or stop ranging/monitoring this region when calling theBeaconManagermethods.- Returns:
-
getBluetoothAddress
public String getBluetoothAddress()
Returns the mac address used to filter for beacons
-
matchesBeacon
public boolean matchesBeacon(Beacon beacon)
Checks to see if an Beacon object is included in the matching criteria of this Region- Parameters:
beacon- the beacon to check to see if it is in the Region- Returns:
- true if is covered
-
hasSameIdentifiers
public boolean hasSameIdentifiers(Region region)
-
describeContents
public int describeContents()
- Specified by:
describeContentsin interfaceParcelable
-
writeToParcel
public void writeToParcel(Parcel out, int flags)
- Specified by:
writeToParcelin interfaceParcelable
-
clone
@Deprecated public Region clone()
Deprecated.instances of this class are immutable and therefore don't have to be cloned when used in concurrent code.Returns a clone of this instance.
-
-