Search in sources :

Example 11 with Beacon

use of org.altbeacon.beacon.Beacon in project android-beacon-library by AltBeacon.

the class ExtraDataBeaconTrackerTest method gattBeaconExtraDataGetUpdated.

@Test
public void gattBeaconExtraDataGetUpdated() {
    Beacon beacon = getGattBeacon();
    Beacon extraDataBeacon = getGattBeaconExtraData();
    Beacon extraDataBeacon2 = getGattBeaconExtraData2();
    ExtraDataBeaconTracker tracker = new ExtraDataBeaconTracker();
    tracker.track(beacon);
    tracker.track(extraDataBeacon);
    tracker.track(extraDataBeacon2);
    Beacon trackedBeacon = tracker.track(beacon);
    assertEquals("extra data is updated", extraDataBeacon2.getDataFields(), trackedBeacon.getExtraDataFields());
}
Also used : Beacon(org.altbeacon.beacon.Beacon) Test(org.junit.Test)

Example 12 with Beacon

use of org.altbeacon.beacon.Beacon in project android-beacon-library by AltBeacon.

the class ExtraDataBeaconTrackerTest method gattBeaconExtraDataAreNotOverwritten.

@Test
public void gattBeaconExtraDataAreNotOverwritten() {
    Beacon beacon = getGattBeacon();
    Beacon extraDataBeacon = getGattBeaconExtraData();
    ExtraDataBeaconTracker tracker = new ExtraDataBeaconTracker();
    tracker.track(beacon);
    tracker.track(extraDataBeacon);
    Beacon trackedBeacon = tracker.track(beacon);
    assertEquals("extra data should not be overwritten", extraDataBeacon.getDataFields(), trackedBeacon.getExtraDataFields());
}
Also used : Beacon(org.altbeacon.beacon.Beacon) Test(org.junit.Test)

Example 13 with Beacon

use of org.altbeacon.beacon.Beacon in project android-beacon-library by AltBeacon.

the class ExtraDataBeaconTrackerTest method gattBeaconFieldsGetUpdated.

@Test
public void gattBeaconFieldsGetUpdated() {
    Beacon beacon = getGattBeacon();
    Beacon beaconUpdate = getGattBeaconUpdate();
    Beacon extraDataBeacon = getGattBeaconExtraData();
    ExtraDataBeaconTracker tracker = new ExtraDataBeaconTracker();
    tracker.track(beacon);
    Beacon trackedBeacon = tracker.track(beaconUpdate);
    assertEquals("rssi should be updated", beaconUpdate.getRssi(), trackedBeacon.getRssi());
    assertEquals("data fields should be updated", beaconUpdate.getDataFields(), trackedBeacon.getDataFields());
}
Also used : Beacon(org.altbeacon.beacon.Beacon) Test(org.junit.Test)

Example 14 with Beacon

use of org.altbeacon.beacon.Beacon in project android-beacon-library by AltBeacon.

the class ExtraDataBeaconTrackerTest method trackingManufacturerBeaconReturnsSelf.

@Test
public void trackingManufacturerBeaconReturnsSelf() {
    Beacon beacon = getManufacturerBeacon();
    ExtraDataBeaconTracker tracker = new ExtraDataBeaconTracker();
    Beacon trackedBeacon = tracker.track(beacon);
    assertEquals("Returns itself", trackedBeacon, beacon);
}
Also used : Beacon(org.altbeacon.beacon.Beacon) Test(org.junit.Test)

Example 15 with Beacon

use of org.altbeacon.beacon.Beacon in project android-beacon-library by AltBeacon.

the class ExtraDataBeaconTrackerTest method multiFrameBeaconProgramaticParserAssociationDifferentServiceUUIDFieldsGetUpdated.

@Test
public void multiFrameBeaconProgramaticParserAssociationDifferentServiceUUIDFieldsGetUpdated() {
    Beacon beacon = getMultiFrameBeacon();
    Beacon beaconUpdate = getMultiFrameBeaconUpdateDifferentServiceUUID();
    ExtraDataBeaconTracker tracker = new ExtraDataBeaconTracker(false);
    tracker.track(beacon);
    tracker.track(beaconUpdate);
    Beacon trackedBeacon = tracker.track(beacon);
    assertEquals("rssi should be updated", beaconUpdate.getRssi(), trackedBeacon.getRssi());
    assertEquals("data fields should be updated", beaconUpdate.getDataFields(), trackedBeacon.getExtraDataFields());
}
Also used : Beacon(org.altbeacon.beacon.Beacon) Test(org.junit.Test)

Aggregations

Beacon (org.altbeacon.beacon.Beacon)17 Test (org.junit.Test)13 ArrayList (java.util.ArrayList)7 Context (android.content.Context)2 Parcel (android.os.Parcel)2 AltBeacon (org.altbeacon.beacon.AltBeacon)2 BeaconParser (org.altbeacon.beacon.BeaconParser)2 Identifier (org.altbeacon.beacon.Identifier)2 Region (org.altbeacon.beacon.Region)2 RangingData (org.altbeacon.beacon.service.RangingData)2 StaticBeaconSimulator (org.altbeacon.beacon.simulator.StaticBeaconSimulator)2 HashMap (java.util.HashMap)1 RejectedExecutionException (java.util.concurrent.RejectedExecutionException)1 AltBeaconParser (org.altbeacon.beacon.AltBeaconParser)1 ModelSpecificDistanceCalculator (org.altbeacon.beacon.distance.ModelSpecificDistanceCalculator)1 BluetoothCrashResolver (org.altbeacon.bluetooth.BluetoothCrashResolver)1