public override bool Equals(object obj) { if (obj is BeaconDevice) { BeaconDevice other = (BeaconDevice)obj; return(other.Device.IPAddress.Equals(this.Device.IPAddress) && this.Port == other.Port); } return(false); }
// Use this for initialization void Awake() { if (currentBeacon != null) { GameObject.Destroy(this.gameObject); return; } else { currentBeacon = this; DontDestroyOnLoad(gameObject); } currentBeaconDevice = new BeaconDevice(Device.CurrentDevice, Port); currentBeaconDeviceJSONData = Encoding.UTF8.GetBytes(JsonUtility.ToJson(currentBeaconDevice)); }
void HandleDeviceDectected(BeaconDevice device) { lock (thisLock) { var existingDevice = BackgroundThreadDetectedBeacons.Find(d => d.Equals(device)); if (existingDevice == null) { device.LastDetectionTime = TimeUtils.GetCurrentUnixTimestamp(); Logger.LogInfo("New device detect " + device, Loglevel); BackgroundThreadDetectedBeacons.Add(device); needListSync = true; } else { existingDevice.LastDetectionTime = TimeUtils.GetCurrentUnixTimestamp(); } } }