/// <summary> /// Initializes a new instance of the <see cref="LifxDevice"/> class. /// </summary> /// <param name="lifx">The <c>LifxNetwork</c> the device belongs to.</param> /// <param name="macAddress">The MAC address of the device.</param> /// <param name="endPoint">The <c>IPEndPoint</c> of the device.</param> /// <param name="version">The version of the device.</param> protected internal LifxDevice(LifxNetwork lifx, MacAddress macAddress, IPEndPoint endPoint, ILifxVersion version) { this.Lifx = lifx; this.MacAddress = macAddress; this.EndPoint = endPoint; this.version = version; this.LastSeen = DateTime.MinValue; // Get product features ILifxProduct features = LifxNetwork.GetFeaturesForProduct(version); this.VendorName = features.VendorName; this.ProductName = features.ProductName; this.SupportsColor = features.SupportsColor; this.SupportsInfrared = features.SupportsInfrared; this.IsMultizone = features.IsMultizone; this.IsChain = features.IsChain; this.IsMatrix = features.IsMatrix; this.MinKelvin = features.MinKelvin; this.MaxKelvin = features.MaxKelvin; }
/// <inheritdoc /> public async Task <ILifxVersion> GetVersion(bool forceRefresh = false, int?timeoutMs = null, CancellationToken cancellationToken = default) { if (!forceRefresh && this.version != null) { return(this.version); } Messages.GetVersion getVersion = new Messages.GetVersion(); Messages.StateVersion version = await this.Lifx.SendWithResponse <Messages.StateVersion>(this, getVersion, timeoutMs, cancellationToken); this.version = version; return(version); }
/// <summary> /// Initializes a new instance of the <see cref="StateVersion"/> class. /// </summary> /// <param name="version">The <see cref="ILifxVersion"/> to initialize this message from.</param> public StateVersion(ILifxVersion version) : this() { this.VendorId = version.VendorId; this.ProductId = version.ProductId; this.Version = version.Version; }
/// <summary> /// Initializes a new instance of the <see cref="LifxStandardMultizoneLight"/> class. /// </summary> /// <param name="lifx">The <see cref="LifxNetwork"/> that the device belongs to.</param> /// <param name="macAddress">The <see cref="MacAddress"/> of the device.</param> /// <param name="endPoint">The <see cref="IPEndPoint"/> of the device.</param> /// <param name="version">The <see cref="ILifxVersion"/> of the device.</param> /// <param name="hostFirmware">The <see cref="ILifxHostFirmware"/> of the device.</param> protected internal LifxStandardMultizoneLight(LifxNetwork lifx, MacAddress macAddress, IPEndPoint endPoint, ILifxVersion version, ILifxHostFirmware hostFirmware) : base(lifx, macAddress, endPoint, version, hostFirmware) { // Empty }
/// <summary> /// Initializes a new instance of the <see cref="LifxInfraredLight"/> class. /// </summary> /// <param name="lifx">The <see cref="LifxNetwork"/> that the device belongs to.</param> /// <param name="macAddress">The <see cref="MacAddress"/> of the device.</param> /// <param name="endPoint">The <see cref="IPEndPoint"/> of the device.</param> /// <param name="version">The <see cref="ILifxVersion"/> of the device.</param> protected internal LifxInfraredLight(LifxNetwork lifx, MacAddress macAddress, IPEndPoint endPoint, ILifxVersion version) : base(lifx, macAddress, endPoint, version) { // Empty }
/// <summary> /// Initializes a new instance of the <see cref="LifxMultizoneLight"/> class. /// </summary> /// <param name="lifx">The <see cref="LifxNetwork"/> that the device belongs to.</param> /// <param name="macAddress">The <see cref="MacAddress"/> of the device.</param> /// <param name="endPoint">The <see cref="IPEndPoint"/> of the device.</param> /// <param name="version">The <see cref="ILifxVersion"/> of the device.</param> /// <param name="hostFirmware">The <see cref="ILifxHostFirmware"/> of the device.</param> protected internal LifxMultizoneLight(LifxNetwork lifx, MacAddress macAddress, IPEndPoint endPoint, ILifxVersion version, ILifxHostFirmware hostFirmware) : base(lifx, macAddress, endPoint, version) { this.SetHostFirmwareCachedValue(hostFirmware); }