コード例 #1
0
ファイル: LifxDevice.cs プロジェクト: monkee52/LIFXSharp
        /// <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);
        }
コード例 #2
0
ファイル: LifxDevice.cs プロジェクト: monkee52/LIFXSharp
        /// <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);
        }
コード例 #3
0
 /// <inheritdoc />
 public abstract Task SetLocation(ILifxLocationTag location, int?timeoutMs = null, CancellationToken cancellationToken = default);
コード例 #4
0
ファイル: StateLocation.cs プロジェクト: monkee52/LIFXSharp
 /// <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;
 }