2 * Copyright (c) 2010-2024 Contributors to the openHAB project
4 * See the NOTICE file(s) distributed with this work for additional
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
11 * SPDX-License-Identifier: EPL-2.0
13 package org.openhab.binding.pentair.internal;
16 * Pentair Intellichlor specialation of a PentairPacket. Includes public variables for many of the reverse engineered
17 * packet content. Note, Intellichlor packet is of a different format and all helper functions in the base PentairPacket
20 * This packet can be a 3 or 4 data byte packet.
22 * 10 02 50 00 00 62 10 03
23 * 10 02 00 01 00 00 13 10 03
25 * @author Jeff James - initial contribution
28 public class PentairPacketIntellichlor extends PentairPacket { // 29 byte packet format
29 protected static final int CMD = 3; // not sure what this is, needs to be 11 for SALT_OUTPUT or SALINITY to be valid
32 protected static final int SALTOUTPUT = 4;
35 protected static final int SALINITY = 4;
37 /** length of the packet - 3 or 4 data bytes */
39 /** for a saltoutput packet, represents the salt output percent */
40 public int saltoutput;
41 /** for a salinity packet, is value of salinity. Must be multiplied by 50 to get the actual salinity value. */
45 * Constructor for Intellichlor packet. Does not call super constructure since the Intellichlor packet is structure
51 public PentairPacketIntellichlor(byte[] buf, int length) {
56 saltoutput = buf[SALTOUTPUT];
57 } else if (length == 4) {
58 salinity = buf[SALINITY] & 0xFF; // make sure it is positive
63 * Constructor for empty Intellichlor packet
65 public PentairPacketIntellichlor() {
72 * @see org.openhab.binding.pentair.PentairPacket#getLength()
75 public int getLength() {
82 * @see org.openhab.binding.pentair.PentairPacket#setLength(int)
85 public void setLength(int length) {
86 if (length != this.length) {
87 buf = new byte[length + 2];
93 * Gets the command byte for this packet
102 public String toString() {
103 return bytesToHex(buf, length + 5);