public void gattBeaconExtraDataIsNotReturned() { Beacon extraDataBeacon = getGattBeaconExtraData(); ExtraDataBeaconTracker tracker = new ExtraDataBeaconTracker(); Beacon trackedBeacon = tracker.Track(extraDataBeacon); AssertEx.Null("trackedBeacon should be null", trackedBeacon); }
public void TestParseGattIdentifierThatRunsOverPduLength() { var bytes = HexStringToByteArray("0201060303aafe0d16aafe10e702676f6f676c65000c09526164426561636f6e204700000000000000000000000000000000000000000000000000000000"); var parser = new BeaconParser(); parser.SetAllowPduOverflow(Java.Lang.Boolean.False); parser.SetBeaconLayout("s:0-1=feaa,m:2-2=10,p:3-3:-41,i:4-20"); var beacon = parser.FromScanData(bytes, -55, null); AssertEx.Null("beacon should not be parsed", beacon); }
public void TestParseManufacturerIdentifierThatRunsOverPduLength() { // Note that the length field below is 0x16 instead of 0x1b, indicating that the packet ends // one byte before the second identifier field starts var bytes = HexStringToByteArray("02011a16ff1801beac2f234454cf6d4a0fadf2f4911ba9ffa600010002c509000000"); var parser = new BeaconParser(); parser.SetAllowPduOverflow(Java.Lang.Boolean.False); parser.SetBeaconLayout("m:2-3=beac,i:4-19,i:20-21,i:22-23,p:24-24,d:25-25"); var beacon = parser.FromScanData(bytes, -55, null); AssertEx.Null("beacon should not be parsed", beacon); }
public void testGenericScanFilter() { BeaconParser parser = new BeaconParser(); parser.SetBeaconLayout("m:2-3=1111,i:4-6,p:24-24"); BeaconManager.SetsManifestCheckingDisabled(true); // no manifest available in robolectric var scanFilterDatas = new ScanFilterUtils().CreateScanFilterDataForBeaconParser(parser); AssertEx.AreEqual("scanFilters should be of correct size", 1, scanFilterDatas.Count); ScanFilterUtils.ScanFilterData sfd = scanFilterDatas[0]; AssertEx.AreEqual("manufacturer should be right", 0x004c, sfd.Manufacturer); AssertEx.AreEqual("mask length should be right", 2, sfd.Mask.Count); AssertEx.AreEqual("mask should be right", new byte[] { (byte)0xff, (byte)0xff }, sfd.Mask.ToArray()); AssertEx.AreEqual("filter should be right", new byte[] { (byte)0x11, (byte)0x11 }, sfd.Filter.ToArray()); AssertEx.Null("serviceUuid should be null", sfd.ServiceUuid); }
public void DoesNotCashWithOverflowingByteCodeComparisonOnPdu() { // Test for https://github.com/AltBeacon/android-beacon-library/issues/323 // Note that the length field below is 0x16 instead of 0x1b, indicating that the packet ends // one byte before the second identifier field starts var bytes = HexStringToByteArray("02010604ffe000be"); var parser = new BeaconParser(); parser.SetBeaconLayout("m:2-3=beac,i:4-19,i:20-21,i:22-23,p:24-24,d:25-25"); var beacon = parser.FromScanData(bytes, -55, null); AssertEx.Null("beacon not be parsed without an exception being thrown", beacon); }