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