/// <summary> /// Callback for when the device information is collected. /// </summary> /// <param name="eurekaIn"></param> private void SetDeviceInformation(DeviceEureka eurekaIn) { var discoveredDevice = new DiscoveredDevice { IPAddress = eurekaIn.GetIpAddress(), Name = eurekaIn.GetName(), Port = 8009, Protocol = "", Usn = null, IsGroup = false, AddedByDeviceInfo = true, Eureka = eurekaIn }; OnDeviceAvailable(discoveredDevice); if (eurekaIn?.Multizone?.Groups == null) { return; } foreach (var group in eurekaIn.Multizone.Groups) { discoveredDevice = new DiscoveredDevice { IPAddress = GetIpOfGroup(group, eurekaIn), Name = group.Name, Port = GetPortOfGroup(group, eurekaIn), Protocol = "", Usn = null, IsGroup = true, AddedByDeviceInfo = true, Eureka = eurekaIn, Group = group }; // Add the group. if (group.Elected_leader == "self") { OnDeviceAvailable(discoveredDevice); } // Get device information from unknown devices. if (!deviceList.Any(x => x.GetHost() == GetIpOfGroup(group, eurekaIn))) { applicationLogic.StartTask(DeviceInformation.GetDeviceInformation(discoveredDevice, SetDeviceInformation, logger)); } } }
/// <summary> /// Callback for when the device information is collected. /// </summary> /// <param name="eurekaIn"></param> private void SetDeviceInformation(DeviceEureka eurekaIn) { var discoveredDevice = new DiscoveredDevice { IPAddress = eurekaIn.GetIpAddress(), MACAddress = eurekaIn.GetMacAddress(), Name = eurekaIn.GetName(), Port = 8009, Protocol = "", Usn = null, IsGroup = false, AddedByDeviceInfo = true, Eureka = eurekaIn }; OnDeviceAvailable(discoveredDevice); }
/// <summary> /// Set the device information. /// </summary> /// <param name="eureka"></param> private void SetDeviceInformation(DeviceEureka eurekaIn) { SetDeviceName(eurekaIn.GetName()); eureka = eurekaIn; setDeviceInformationCallback?.Invoke(eureka); }