Пример #1
0
        private void controller_LeMetaEventReceived(object sender, LeMetaEventReceivedEventArgs e)
        {
            if (e.LeMetaEvent == null)
            {
                return;
            }
            if (e.LeMetaEvent.SubEvent != LeMetaEvent.LeMetaSubEvent.AdvertisingReport)
            {
                return;
            }
            if (e.LeMetaEvent.AdvertisingEvents == null)
            {
                return;
            }

            foreach (var advertisingEvent in e.LeMetaEvent.AdvertisingEvents)
            {
                var beacon = Beacon.Parse(advertisingEvent);
                if (beacon != null)
                {
                    BeaconDetected?.Invoke(this, new BeaconEventArgs(beacon));
                    continue;
                }

                var eddystone = Eddystone.Parse(advertisingEvent);
                if (eddystone != null)
                {
                    EddystoneDetected?.Invoke(this, new EddystoneEventArgs(eddystone));
                    continue;
                }
            }
        }
Пример #2
0
        private void controller_LeMetaEventReceived(object sender, LeMetaEventReceivedEventArgs e)
        {
            if (e.LeMetaEvent == null)
            {
                return;
            }
            if (e.LeMetaEvent.SubEvent != LeMetaEvent.LeMetaSubEvent.AdvertisingReport)
            {
                return;
            }
            if (e.LeMetaEvent.AdvertisingEvents == null)
            {
                return;
            }

            foreach (var advertisingEvent in e.LeMetaEvent.AdvertisingEvents)
            {
                var beacon = Beacon.Parse(advertisingEvent);
                if (beacon != null)
                {
                    OnBeaconDetected(beacon);
                }
            }
        }