use of org.altbeacon.beacon.AltBeaconParser in project android-beacon-library by AltBeacon.
the class ScanFilterUtilsTest method testGetAltBeaconScanFilter.
@Test
public void testGetAltBeaconScanFilter() throws Exception {
org.robolectric.shadows.ShadowLog.stream = System.err;
BeaconParser parser = new AltBeaconParser();
// no manifest available in robolectric
BeaconManager.setManifestCheckingDisabled(true);
List<ScanFilterUtils.ScanFilterData> scanFilterDatas = new ScanFilterUtils().createScanFilterDataForBeaconParser(parser, null);
assertEquals("scanFilters should be of correct size", 1, scanFilterDatas.size());
ScanFilterUtils.ScanFilterData sfd = scanFilterDatas.get(0);
assertEquals("manufacturer should be right", 0x0118, sfd.manufacturer);
assertEquals("mask length should be right", 2, sfd.mask.length);
assertArrayEquals("mask should be right", new byte[] { (byte) 0xff, (byte) 0xff }, sfd.mask);
assertArrayEquals("filter should be right", new byte[] { (byte) 0xbe, (byte) 0xac }, sfd.filter);
}
use of org.altbeacon.beacon.AltBeaconParser in project android-beacon-library by AltBeacon.
the class BeaconSimulatorTest method testSetBeacons.
@Test
public void testSetBeacons() {
StaticBeaconSimulator staticBeaconSimulator = new StaticBeaconSimulator();
byte[] beaconBytes = hexStringToByteArray("02011a1bff1801beac2f234454cf6d4a0fadf2f4911ba9ffa600010002c509");
Beacon beacon = new AltBeaconParser().fromScanData(beaconBytes, -55, null, 123456L);
ArrayList<Beacon> beacons = new ArrayList<Beacon>();
beacons.add(beacon);
staticBeaconSimulator.setBeacons(beacons);
assertEquals("getBeacons should match values entered with setBeacons", staticBeaconSimulator.getBeacons(), beacons);
}
Aggregations