Gallagher Mobile Connect SDK
Public Member Functions | Static Public Member Functions | Public Attributes | List of all members
com.gallagher.security.mobileaccess.ReaderDistance Enum Reference

Public Member Functions

 ReaderDistance (int value)
 
int getValue ()
 

Static Public Member Functions

static ReaderDistance parse (int i)
 
static ReaderDistance calculate (double txPower, double autoConnectPathLoss, double manualConnectPathLoss, double measuredPathLoss)
 

Public Attributes

 NEAR =(0)
 
 MEDIUM =(1)
 
 FAR =(2)
 

Detailed Description

If Bluetooth signals are visible from multiple readers at a given physical location, ReaderDistance can be used to infer which reader is physically closer to the phone.

Note: These values do not adhere to any particular unit of measure, and two phones in the same play may disagree on values for a given reader due to the margin of error inherent in measuring a Bluetooth signal. If you use them, you should only do so in an abstract way, such as showing different colored icons for a near vs far reader.

Constructor & Destructor Documentation

◆ ReaderDistance()

com.gallagher.security.mobileaccess.ReaderDistance.ReaderDistance ( int  value)
26 {
27 mValue = value;
28 }

Member Function Documentation

◆ calculate()

static ReaderDistance com.gallagher.security.mobileaccess.ReaderDistance.calculate ( double  txPower,
double  autoConnectPathLoss,
double  manualConnectPathLoss,
double  measuredPathLoss 
)
static
44 {
45 if(manualConnectPathLoss <= 0) { // if manual connect is disabled we never see the reader until we're right on top of it
46 return NEAR;
47 }
48 // 100 is the "max" RSSI we've seen in testing, so adjust the max PL we think we should theoretically see
49 double manualPL = Math.min(manualConnectPathLoss, 100 + txPower);
50
51 // although you can configure auto pathloss down to 1, I've never seen lower than about 15 or so. Use this as our lower limit
52 double autoPL = Math.max(15, autoConnectPathLoss);
53
54 double plRange = manualPL - autoPL;
55 if(plRange < 5) {
56 // if the difference between manual and auto connect range is small, we're not really going to get a meaningful value
57 // also this prevents a possible divide-by-zero below
58 return NEAR;
59 }
60
61 double plInRange = measuredPathLoss - autoPL;
62
63 double result = plInRange / plRange;
64 if(result < 0.4) {
65 return NEAR;
66 } else if(result < 0.75) {
67 return MEDIUM;
68 } else {
69 return FAR;
70 }
71 }
FAR
Definition: ReaderDistance.java:23
NEAR
Definition: ReaderDistance.java:19
MEDIUM
Definition: ReaderDistance.java:21

◆ getValue()

int com.gallagher.security.mobileaccess.ReaderDistance.getValue ( )
30 {
31 return mValue;
32 }

◆ parse()

static ReaderDistance com.gallagher.security.mobileaccess.ReaderDistance.parse ( int  i)
static

Returns null if the int can't be parsed

35 {
36 for(ReaderDistance r : values()) {
37 if(r.mValue == i) {
38 return r;
39 }
40 }
41 return null;
42 }

Member Data Documentation

◆ FAR

com.gallagher.security.mobileaccess.ReaderDistance.FAR =(2)

The SDK believes this reader is far away

◆ MEDIUM

com.gallagher.security.mobileaccess.ReaderDistance.MEDIUM =(1)

The SDK believes this reader is a medium distance away

◆ NEAR

com.gallagher.security.mobileaccess.ReaderDistance.NEAR =(0)

The SDK believes this reader is close to the phone


The documentation for this enum was generated from the following file: