This repository has been archived by the owner on Sep 21, 2020. It is now read-only.
/
HueClient.java
105 lines (94 loc) · 3.31 KB
/
HueClient.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
/**
* Copyright (c) 2010-2019 Contributors to the openHAB project
*
* See the NOTICE file(s) distributed with this work for additional
* information.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License 2.0 which is available at
* http://www.eclipse.org/legal/epl-2.0
*
* SPDX-License-Identifier: EPL-2.0
*/
package org.openhab.binding.hue.internal.handler;
import org.eclipse.jdt.annotation.NonNullByDefault;
import org.eclipse.jdt.annotation.Nullable;
import org.openhab.binding.hue.internal.ConfigUpdate;
import org.openhab.binding.hue.internal.FullLight;
import org.openhab.binding.hue.internal.FullSensor;
import org.openhab.binding.hue.internal.StateUpdate;
/**
* Access to the Hue system for light handlers.
*
* @author Simon Kaufmann - initial contribution and API
* @author Samuel Leisering - Added support for sensor API
* @author Christoph Weitkamp - Added support for sensor API
*/
@NonNullByDefault
public interface HueClient {
/**
* Register a light status listener.
*
* @param lightStatusListener the light status listener
* @return {@code true} if the collection of listeners has changed as a result of this call
*/
boolean registerLightStatusListener(LightStatusListener lightStatusListener);
/**
* Unregister a light status listener.
*
* @param lightStatusListener the light status listener
* @return {@code true} if the collection of listeners has changed as a result of this call
*/
boolean unregisterLightStatusListener(LightStatusListener lightStatusListener);
/**
* Register a sensor status listener.
*
* @param sensorStatusListener the sensor status listener
* @return {@code true} if the collection of listeners has changed as a result of this call
*/
boolean registerSensorStatusListener(SensorStatusListener sensorStatusListener);
/**
* Unregister a sensor status listener.
*
* @param sensorStatusListener the sensor status listener
* @return {@code true} if the collection of listeners has changed as a result of this call
*/
boolean unregisterSensorStatusListener(SensorStatusListener sensorStatusListener);
/**
* Get the light by its ID.
*
* @param lightId the light ID
* @return the full light representation of {@code null} if it could not be found
*/
@Nullable
FullLight getLightById(String lightId);
/**
* Get the sensor by its ID.
*
* @param sensorId the sensor ID
* @return the full sensor representation of {@code null} if it could not be found
*/
@Nullable
FullSensor getSensorById(String sensorId);
/**
* Updates the given light.
*
* @param light the light to be updated
* @param stateUpdate the state update
*/
void updateLightState(FullLight light, StateUpdate stateUpdate);
/**
* Updates the given sensors config.
*
* @param sensor the light to be updated
* @param configUpdate the config update
*/
void updateSensorConfig(FullSensor sensor, ConfigUpdate configUpdate);
/**
* Updates the given sensor.
*
* @param sensor the sensor to be updated
* @param stateUpdate the state update
*/
void updateSensorState(FullSensor sensor, StateUpdate stateUpdate);
}