Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AltBeacon is detected as iBeacon #32

Open
micolous opened this issue Mar 24, 2019 · 0 comments
Open

AltBeacon is detected as iBeacon #32

micolous opened this issue Mar 24, 2019 · 0 comments

Comments

@micolous
Copy link

Steps to reproduce

  1. Get in proximity of an AltBeacon (or simulate one).
  2. Scan for beacons.

Expected behaviour

Beacon is reported as an AltBeacon.

Actual behaviour

Beacon is detected as an iBeacon. The decoded values (UUID, major, minor) appear to be otherwise correct.

Other details

It looks like the issue is here:

@Override
public boolean isEddystone() {
return (getBeaconTypeCode() == TYPE_EDDYSTONE_UID)
|| (getBeaconTypeCode() == TYPE_EDDYSTONE_URL) || (getBeaconTypeCode() == TYPE_EDDYSTONE_TLM);
}
@Override
public BeaconType getBeaconType() {
if (isEddystone()) {
switch (getBeaconTypeCode()) {
case TYPE_IBEACON_ALTBEACON:
return BeaconType.ALTBEACON;
case TYPE_EDDYSTONE_TLM:
return BeaconType.EDDYSTONE_TLM;
case TYPE_EDDYSTONE_UID:
return BeaconType.EDDYSTONE_UID;
case TYPE_EDDYSTONE_URL:
return BeaconType.EDDYSTONE_URL;
default:
return BeaconType.EDDYSTONE;
}
}
return BeaconType.IBEACON;
}

TYPE_IBEACON_ALTBEACON is only tested in a switch statement if isEddystone() == true. But the tests in isEddystone already exclude TYPE_IBEACON_ALTBEACON.

Looking at the upstream matcher (m:2-3=beac), to test for AltBeacon you'd need to look for getBeaconTypeCode() == 0xBEAC.

Version tested

Version 1.2.2 (F-Droid)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant