Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
Copyright (C) 2013 George Reese Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
 
 package com.imaginary.home.lighting;
 
 
 import  javax.annotation.Nonnegative;
 import  javax.annotation.Nonnull;
 import  javax.annotation.Nullable;
A light that may be an individual light bulb or a lamp containing many different bulbs. Lights may be white or color or have the ability to change color.
 
 public interface Light extends PoweredDevice {
    
General purpose method for changing the color of a bulb regardless of the underlying color support mechanism. If the new color is non-white (not ColorMode.CT) and the underlying light bulb is not color, this method will simply return a future with a false return value.

Parameters:
newColor the new color to which the bulb should be set
transitionTime the time period over which the transition should be made
Returns:
true if the bulb changed state as a result of this call
Throws:
CommunicationException an error occurred talking with the API call
 
     public @Nonnull Future<BooleanchangeColor(@Nonnull Color newColor, @Nullable TimePeriod<?> transitionTimethrows CommunicationException;

    
Convenience operation for setting color in the ColorMode.CIEXYZ color space. Note that specifying a Z value is neither expected nor necessary.

Parameters:
x the X value in the CIEXYZ color space (valid values are sorta 0.0 to 1.0)
y the Y value in the CIEXYZ color space (valid values are sorta 0.0 to 1.0)
transitionTime the time period over which the transition should be made
Returns:
true if the bulb changed state as a result of this call
Throws:
CommunicationException an error occurred talking with the API call
 
     public @Nonnull Future<BooleanchangeColorCIEXYZ(@Nonnegative float x, @Nonnegative float y, @Nullable TimePeriod<?> transitionTimethrows CommunicationException;

    
Convenience operation for setting color in the ColorMode.HSV color space.

Parameters:
hue the hue as a number of degrees from 0.0 to 360.0
saturation saturation as a percentage from 0.0 to 100.0
transitionTime the time period over which the transition should be made
Returns:
true if the bulb changed state as a result of this call
Throws:
CommunicationException an error occurred talking with the API call
 
     public @Nonnull Future<BooleanchangeColorHSV(@Nonnegative float hue, @Nonnegative float saturation, @Nullable TimePeriod<?> transitionTimethrows CommunicationException;

    
Convenience operation for setting color in the ColorMode.RGB color space.

Parameters:
red a percentage value between 0.0 and 100.0 representing the amount of red
green a percentage value between 0.0 and 100.0 representing the amount of green
blue a percentage value between 0.0 and 100.0 representing the amount of blue
transitionTime the time period over which the transition should be made
Returns:
true if the bulb changed state as a result of this call
 
     public @Nonnull Future<BooleanchangeColorRGB(@Nonnegative float red, @Nonnegative float green, @Nonnegative float blue, @Nullable TimePeriod<?> transitionTimethrows CommunicationException;

    
Convenience operation for setting "color" in the ColorMode.CT color space.

Parameters:
warmthInMireds the new warmth for the bulb in mireds (valid values are between 154 and 500)
brightness percent brightness (valid values are 0.0 to 100.0)
transitionTime the time period over which the transition should be made
Returns:
true if the bulb changed state as a result of this call
Throws:
CommunicationException an error occurred talking with the API
 
     public @Nonnull Future<BooleanchangeWhite(final @Nonnegative int warmthInMiredsfinal @Nonnegative float brightnessfinal @Nullable TimePeriod<?> transitionTimethrows CommunicationException;

    
Fades a bulb's brightness within it's current color space from the current value to 0 and then turns the bulb off. The fading process will take place evenly over the course of the specified transition time.

Parameters:
transitionTime the time period over which the fade out will occur
Returns:
true if the fade resulted in a change of state to the bulb
Throws:
CommunicationException an error occurred talking with the API
 
     public @Nonnull Future<BooleanfadeOff(final @Nonnull  TimePeriod<?> transitionTimethrows CommunicationException;

    
Fades a bulb's brightness up from the current value to 100% within the current color space. The fading process will occur evenly over the course of the specified transition time.

Parameters:
transitionTime the time period over which the fade will occur
Returns:
true if the fade resulted in a change of state to the bulb
Throws:
CommunicationException an error occurred talking with the API
 
    public @Nonnull Future<BooleanfadeOn(final @Nonnull TimePeriod<?> transitionTimethrows CommunicationException;

    
Fades a bulb's brightness up or down from the current value to the target percentage. The fading process will occur evenly over the course of the specified transition time.

Parameters:
transitionTime the time period over which the fade will occur
targetBrightness the target brightness as a percentage (0.0% to 100.0%)
Returns:
true if the fade resulted in a change of state to the bulb
Throws:
CommunicationException an error occurred talking with the API
    public @Nonnull Future<BooleanfadeOn(final @Nonnull TimePeriod<?> transitionTimefinal @Nonnegative float targetBrightnessthrows CommunicationException;
    public @Nonnegative float getBrightness() throws CommunicationException;
    public @Nonnull Color getColor() throws CommunicationException;
    public @Nonnull ColorMode getColorMode() throws CommunicationException;
    public Future<Booleanstrobe(final @Nonnull TimePeriod<?> intervalfinal @Nullable TimePeriod<?> durationfinal @Nonnull Color ... colorsthrows CommunicationException;
    public boolean supportsBrightnessChanges() throws CommunicationException;
    public boolean supportsColor() throws CommunicationException;
    public boolean supportsColorChanges() throws CommunicationException;
New to GrepCode? Check out our FAQ X