]> git.basschouten.com Git - openhab-addons.git/blob
2dadab5f71bfc6c2f5a218e0042e5a779eca25c3
[openhab-addons.git] /
1 /**
2  * Copyright (c) 2010-2023 Contributors to the openHAB project
3  *
4  * See the NOTICE file(s) distributed with this work for additional
5  * information.
6  *
7  * This program and the accompanying materials are made available under the
8  * terms of the Eclipse Public License 2.0 which is available at
9  * http://www.eclipse.org/legal/epl-2.0
10  *
11  * SPDX-License-Identifier: EPL-2.0
12  */
13 package org.openhab.binding.hue.internal.api.dto.clip1;
14
15 import java.util.ArrayList;
16 import java.util.List;
17 import java.util.Map;
18
19 /**
20  * Container for all data on a bridge.
21  *
22  * @author Q42 - Initial contribution
23  * @author Denis Dudnik - moved Jue library source code inside the smarthome Hue binding
24  */
25 public class FullConfig {
26     private Map<String, FullLight> lights;
27     private Map<String, FullGroup> groups;
28     private Config config;
29
30     /**
31      * Returns detailed information about all lights known to the bridge.
32      *
33      * @return detailed lights list
34      */
35     public List<FullLight> getLights() {
36         ArrayList<FullLight> lightsList = new ArrayList<>();
37
38         for (Map.Entry<String, FullLight> entry : lights.entrySet()) {
39             String id = entry.getKey();
40             FullLight light = entry.getValue();
41             light.setId(id);
42             lightsList.add(light);
43         }
44
45         return lightsList;
46     }
47
48     /**
49      * Returns detailed information about all groups on the bridge.
50      *
51      * @return detailed groups list
52      */
53     public List<FullGroup> getGroups() {
54         ArrayList<FullGroup> groupsList = new ArrayList<>();
55
56         for (Map.Entry<String, FullGroup> entry : groups.entrySet()) {
57             String id = entry.getKey();
58             FullGroup group = entry.getValue();
59             group.setId(id);
60             groupsList.add(group);
61         }
62
63         return groupsList;
64     }
65
66     /**
67      * Returns bridge configuration.
68      * Use HueBridge.getConfig() if you only need this.
69      *
70      * @return bridge configuration
71      */
72     public Config getConfig() {
73         return config;
74     }
75 }