Пример #1
0
        /// <summary>
        /// Set multiple states across multiple selectors. As documented here: https://api.developer.lifx.com/docs/set-states.
        /// </summary>
        /// <param name="states">A list of states (each which may have a unique selector to chose the light(s) which will be set to said state).</param>
        /// <param name="defaults">A state which contains default properties that are inherited by states that don't explicitely set them.</param>
        /// <returns></returns>
        public async Task <ApiResults> SetStates(List <LightState> states, LightState defaults)
        {
            SetStatesSpec args = new SetStatesSpec(states, defaults);

            try
            {
                return(await lifxApi.SetStates(auth, args));
            }
            catch (Refit.ApiException e)
            {
                return(e.GetContentAs <ApiResults>());
            }
        }
Пример #2
0
 /// Triggers a state cycle effect on the light. During each cycle the light transitions between 2 - 5 predefined states that will inherit properties from the default state. As documented here: https://api.developer.lifx.com/docs/cycle.
 /// <param name="states">A list of states. Within each you can set power, color, brightness, power action duration, and infrared channel value. Must have 2 to 5 entries.</param>
 /// <param name="defaults">A state which contains default properties that are inherited by states that don't explicitely set them.</param>
 /// <param name="direction">Direction in which to cycle through the list of states.</param>
 /// <returns></returns>
 public async Task <ApiResult> Cycle(List <LightState> states, LightState defaults, Direction direction = LifxClient.DEFAULT_DIRECTION)
 {
     return((await Client.Cycle(this, states, defaults, direction)).Results.First());
 }
Пример #3
0
 public SetStatesSpec(List <LightState> states, LightState defaults)
 {
     States   = states;
     Defaults = defaults;
 }
Пример #4
0
 public SetStateSpec(List <LightState> states, LightState defaults, Direction direction)
 {
     States    = states;
     Defaults  = defaults;
     Direction = direction;
 }
Пример #5
0
        /// Triggers a state cycle effect on the light. During each cycle the light transitions between 2 - 5 predefined states that will inherit properties from the default state. As documented here: https://api.developer.lifx.com/docs/cycle.
        /// <param name="states">A list of states. Within each you can set power, color, brightness, power action duration, and infrared channel value. Must have 2 to 5 entries.</param>
        /// <param name="defaults">A state which contains default properties that are inherited by states that don't explicitely set them.</param>
        /// <param name="direction">Direction in which to cycle through the list of states.</param>
        /// <returns></returns>
        public async Task <ApiResults> Cycle(Selector selector, List <LightState> states, LightState defaults, Direction direction = DEFAULT_DIRECTION)
        {
            if (selector == null)
            {
                selector = Selector.All;
            }
            SetStateSpec args = new SetStateSpec(states, defaults, direction);

            try
            {
                return(await lifxApi.Cycle(auth, selector.ToString(), args));
            }
            catch (Refit.ApiException e)
            {
                return(e.GetContentAs <ApiResults>());
            }
        }