public bool IsBeaconInRegion(Beacon beacon) { if (!this.Uuid.Equals(beacon.Uuid)) { return(false); } if (this.Major == null && this.Minor == null) { return(true); } if (this.Major != beacon.Major) { return(false); } if (this.Minor == null || this.Minor == beacon.Minor) { return(true); } return(false); }
public static bool IsBeaconInRegion(this BeaconRegion region, Beacon beacon) { if (!region.Uuid.Equals(beacon.Uuid)) { return(false); } if (region.Major == null && region.Minor == null) { return(true); } if (region.Major != beacon.Major) { return(false); } if (region.Minor == null || region.Minor == beacon.Minor) { return(true); } return(false); }
protected virtual IEnumerable <BeaconRegionStatus> GetRegionStatesForBeacon(IEnumerable <BeaconRegion> regionList, Beacon beacon) { var copy = this.regionStates.ToDictionary(x => x.Key, x => x.Value); foreach (var region in regionList) { var state = copy[region.ToString()]; if (state.Region.IsBeaconInRegion(beacon)) { yield return(state); } } }