2 * Copyright (c) 2010-2023 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.pioneeravr.internal.protocol;
15 import org.slf4j.Logger;
16 import org.slf4j.LoggerFactory;
19 * Represents the display status message send by the Pioneer AV receiver
20 * (response to "?FL" request)
22 * @author Rainer Ostendorf - Initial contribution
24 public class DisplayInformation {
26 private final Logger logger = LoggerFactory.getLogger(DisplayInformation.class);
28 private Boolean volumeDisplay; // 1-light, 0-OFF
29 private Boolean guidIcon; // 1-light, 0-OFF
30 private String infoText = ""; // the actual display text
33 * parse the display status text send from the receiver
35 * @param responsePayload the responses payload, that is without the leading "FL"
37 public DisplayInformation(String responsePayload) {
38 volumeDisplay = false;
42 // Example from Pioneer docs: When " [)(]DIGITAL EX " is displayed, response command is:
43 // FL000005064449474954414C00455800<CR+LF>
45 // first byte holds the two special flags
46 byte firstByte = (byte) Integer.parseInt(responsePayload.substring(0, 1), 16);
48 if ((firstByte & (1 << 0)) == (1 << 0)) {
51 if ((firstByte & (1 << 1)) == (1 << 1)) {
55 // convert the ascii values back to string
56 StringBuilder sb = new StringBuilder();
57 for (int i = 2; i < responsePayload.length() - 1; i += 2) {
58 String hexAsciiValue = responsePayload.substring(i, i + 2);
60 sb.append((char) Integer.parseInt(hexAsciiValue, 16));
61 } catch (Exception e) {
62 logger.error("parsing string failed '{}'", responsePayload, e);
65 infoText = sb.toString();
68 public String getInfoText() {
72 public void setInfoText(String infoText) {
73 this.infoText = infoText;
76 public Boolean getVolumeDisplay() {
80 public Boolean getGuidIcon() {