/// <inheritdoc /> public async Task <ILifxLocationTag> GetLocation(bool forceRefresh = false, int?timeoutMs = null, CancellationToken cancellationToken = default) { if (!forceRefresh && this.location != null) { return(this.location); } Messages.GetLocation getLocation = new Messages.GetLocation(); Messages.StateLocation location = await this.Lifx.SendWithResponse <Messages.StateLocation>(this, getLocation, timeoutMs, cancellationToken); this.location = location; this.Lifx.UpdateLocationMembershipInformation(this, location); return(location); }
/// <inheritdoc /> public async Task SetLocation(ILifxLocationTag location, int?timeoutMs = null, CancellationToken cancellationToken = default) { if (location is null) { throw new ArgumentNullException(nameof(location)); } Messages.SetLocation setLocation = new Messages.SetLocation() { Location = location.Location, Label = location.Label, UpdatedAt = DateTime.UtcNow, }; await this.Lifx.SendWithAcknowledgement(this, setLocation, timeoutMs, cancellationToken); this.Lifx.UpdateLocationMembershipInformation(this, location); }
/// <inheritdoc /> public abstract Task SetLocation(ILifxLocationTag location, int?timeoutMs = null, CancellationToken cancellationToken = default);
/// <summary> /// Initializes a new instance of the <see cref="StateLocation"/> class. /// </summary> /// <param name="location">The <see cref="ILifxLocationTag"/> to initialize this message from.</param> public StateLocation(ILifxLocationTag location) : this() { this.Location = location.Location; this.Label = location.Label; this.UpdatedAt = location.UpdatedAt; }