use of org.altbeacon.beacon.service.scanner.ScanFilterUtils in project android-beacon-library by AltBeacon.
the class ScanFilterUtilsTest method testGenericScanFilter.
@Test
public void testGenericScanFilter() throws Exception {
org.robolectric.shadows.ShadowLog.stream = System.err;
BeaconParser parser = new BeaconParser();
parser.setBeaconLayout("m:2-3=1111,i:4-6,p:24-24");
// 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", 0x004c, 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) 0x11, (byte) 0x11 }, sfd.filter);
assertNull("serviceUuid should be null", sfd.serviceUuid);
}
Aggregations