]> git.basschouten.com Git - openhab-addons.git/blob
381b0003134a5cdd279bc5721a5f2383dfa2837b
[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.pentair.internal;
14
15 /**
16  * Pentair heat set point packet specialization of a PentairPacket. Includes public variables for many of the reverse
17  * engineered
18  * packet content.
19  *
20  * @author Jeff James - initial contribution
21  *
22  */
23 public class PentairPacketHeatSetPoint extends PentairPacket {
24
25     protected static final int POOLTEMP = 5 + OFFSET;
26     protected static final int AIRTEMP = 6 + OFFSET;
27     protected static final int POOLSETPOINT = 7 + OFFSET;
28     protected static final int SPASETPOINT = 8 + OFFSET;
29     protected static final int HEATMODE = 9 + OFFSET;
30     protected static final int SOLARTEMP = 12 + OFFSET;
31
32     protected final String[] heatmodestrs = { "Off", "Heater", "Solar Pref", "Solar" };
33
34     /** pool temperature set point */
35     public int poolsetpoint;
36     /** pool heat mode - 0=Off, 1=Heater, 2=Solar Pref, 3=Solar */
37     public int poolheatmode;
38     /** pool heat mode as a string */
39     public String poolheatmodestr;
40     /** spa temperature set point */
41     public int spasetpoint;
42     /** spa heat mode - 0=Off, 1=Heater, 2=Solar Pref, 3=Solar */
43     public int spaheatmode;
44     /** spa heat mode as a string */
45     public String spaheatmodestr;
46
47     /**
48      * Constructor to create a specialized packet representing the generic packet. Note, the internal buffer array is
49      * not
50      * duplicated. Fills in public class members appropriate with the correct values.
51      *
52      * @param p Generic PentairPacket to create specific Status packet
53      */
54     public PentairPacketHeatSetPoint(PentairPacket p) {
55         super(p);
56
57         poolsetpoint = p.buf[POOLSETPOINT];
58         poolheatmode = p.buf[HEATMODE] & 0x03;
59         poolheatmodestr = heatmodestrs[poolheatmode];
60
61         spasetpoint = p.buf[SPASETPOINT];
62         spaheatmode = (p.buf[HEATMODE] >> 2) & 0x03;
63         spaheatmodestr = heatmodestrs[spaheatmode];
64     }
65
66     /**
67      * Constructure to create an empty status packet
68      */
69     public PentairPacketHeatSetPoint() {
70         super();
71     }
72 }