Example #1
0
        /// <inheritdoc />
        public virtual async Task <ILifxHostInfo> GetHostInfo(bool forceRefresh = false, int?timeoutMs = null, CancellationToken cancellationToken = default)
        {
            if (!forceRefresh && this.hostInfo != null)
            {
                return(this.hostInfo);
            }

            Messages.GetHostInfo getInfo = new Messages.GetHostInfo();

            Messages.StateHostInfo info = await this.Lifx.SendWithResponse <Messages.StateHostInfo>(this, getInfo, timeoutMs, cancellationToken);

            this.hostInfo = info;

            return(info);
        }
Example #2
0
 /// <summary>
 /// Initializes a new instance of the <see cref="StateHostInfo"/> class.
 /// </summary>
 /// <param name="hostInfo">The <see cref="ILifxHostInfo"/> to initialize this message from.</param>
 public StateHostInfo(ILifxHostInfo hostInfo) : this()
 {
     this.Signal           = hostInfo.Signal;
     this.TransmittedBytes = hostInfo.TransmittedBytes;
     this.ReceivedBytes    = hostInfo.ReceivedBytes;
 }