]> git.basschouten.com Git - openhab-addons.git/blob
041c0bf640c8c051fa0efa3e722f41671813e6d9
[openhab-addons.git] /
1 /**
2  * Copyright (c) 2010-2024 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 pump status packet specialation of a PentairPacket. Includes public variables for many of the reverse
17  * engineered packet content.
18  *
19  * @author Jeff James - initial contribution
20  *
21  */
22 public class PentairPacketPumpStatus extends PentairPacket { // 15 byte packet format
23
24     protected static final int RUN = 4 + OFFSET;
25     protected static final int MODE = 5 + OFFSET; // Mode in pump status. Means something else in pump write/response?
26     protected static final int DRIVESTATE = 6 + OFFSET; // ?? Drivestate in pump status. Means something else in pump
27                                                         // write/response
28     protected static final int WATTSH = 7 + OFFSET;
29     protected static final int WATTSL = 8 + OFFSET;
30     protected static final int RPMH = 9 + OFFSET;
31     protected static final int RPML = 10 + OFFSET;
32     protected static final int PPC = 11 + OFFSET; // ??
33     protected static final int ERR = 13 + OFFSET;
34     protected static final int TIMER = 14 + OFFSET; // ?? Have to explore
35     protected static final int HOUR = 17 + OFFSET;
36     protected static final int MIN = 18 + OFFSET;
37
38     /** pump is running */
39     public boolean run;
40
41     /** pump mode (1-4) */
42     public int mode;
43
44     /** pump drivestate - not sure what this specifically represents. */
45     public int drivestate;
46     /** pump power - in KW */
47     public int power;
48     /** pump rpm */
49     public int rpm;
50     /** pump ppc? */
51     public int ppc;
52     /** byte in packet indicating an error condition */
53     public int error;
54     /** current timer for pump */
55     public int timer;
56     /** hour or packet (based on Intelliflo time setting) */
57     public int hour;
58     /** minute of packet (based on Intelliflo time setting) */
59     public int min;
60
61     /**
62      * Constructor to create a specialized packet representing the generic packet. Note, the internal buffer array is
63      * not
64      * duplicated. Fills in public class members appropriate with the correct values.
65      *
66      * @param p Generic PentairPacket to create specific Status packet
67      */
68     public PentairPacketPumpStatus(PentairPacket p) {
69         super(p);
70
71         run = (buf[RUN] == (byte) 0x0A);
72         mode = buf[MODE];
73         drivestate = buf[DRIVESTATE];
74         power = (buf[WATTSH] << 8) + buf[WATTSL];
75         rpm = (buf[RPMH] << 8) + buf[RPML];
76         ppc = buf[PPC];
77         error = buf[ERR];
78         timer = buf[TIMER];
79         hour = buf[HOUR];
80         min = buf[MIN];
81     }
82
83     /**
84      * Constructure to create an empty status packet
85      */
86     public PentairPacketPumpStatus() {
87         super();
88     }
89 }