public ZwaveGateway(IMessageQueue messageQueue, IList<ICommandClassHandler> commandClassHandlers) : base("zwave") { _messageQueue = messageQueue; _commandClassHandlers = commandClassHandlers; _canCreateDevices = false; _comPortName = ConfigurationManager.AppSettings["zwave.port"]; _library = new ZwaveDeviceLibrary(); _nodeCommandQueues = new Dictionary<byte, ZwaveCommandQueue>(); }
public static void Resolve(ZwaveDeviceLibrary library, ZwaveDevice device) { var devices = library.Devices .Where(d => d.ManufacturerId.Equals(device.ManufacturerId)) .Where(d => d.ProductId.Equals(device.ProductId)) .ToList(); devices = Filter(devices, d => d.ProductTypeId.Equals(device.ProductType)); devices = Filter(devices, d => d.OemVersion.Equals(device.Application, StringComparison.OrdinalIgnoreCase)); devices = Filter(devices, d => d.FrequencyName.ToLowerInvariant().Contains("europe")); var libraryDevice = devices.FirstOrDefault(); if (libraryDevice != null) { device.Manufacturer = libraryDevice.Brand; device.ProductName = libraryDevice.Name; device.ProductDescription = libraryDevice.Description; device.ImagePath = libraryDevice.Image; } }