]> git.basschouten.com Git - openhab-addons.git/blob
209694dac469c8b70ca3197a42b005dcff50efe7
[openhab-addons.git] /
1 /**
2  * Copyright (c) 2010-2022 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.lutron.internal.radiora.protocol;
14
15 import org.eclipse.jdt.annotation.NonNullByDefault;
16
17 /**
18  * Feedback (LMP) that gives the state of all phantom LEDs
19  * <p>
20  * <b>Syntax:</b>
21  *
22  * <pre>
23  * {@code
24  * LMP,<LED States>
25  * }
26  * </pre>
27  *
28  * <b>Example:</b>
29  * <p>
30  * Phantom LEDs 1 and 5 are ON, all others are OFF
31  *
32  * <pre>
33  * LMP,100010000000000
34  * </pre>
35  *
36  * @author Jeff Lauterbach - Initial Contribution
37  *
38  */
39 @NonNullByDefault
40 public class LEDMapFeedback extends RadioRAFeedback {
41
42     private String bitmap; // 15 bit String of (0,1). 1 is ON, 0 is OFF
43
44     public LEDMapFeedback(String msg) {
45         String[] params = parse(msg, 1);
46
47         bitmap = params[1];
48     }
49
50     public String getBitmap() {
51         return bitmap;
52     }
53
54     public char getZoneValue(int zone) {
55         if (zone < 1 || zone > bitmap.length()) {
56             return '0';
57         }
58
59         return bitmap.charAt(zone - 1);
60     }
61 }