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"
39 public DisplayInformation(String responsePayload) {
40 volumeDisplay = false;
44 // Example from Pioneer docs: When " [)(]DIGITAL EX " is displayed, response command is:
45 // FL000005064449474954414C00455800<CR+LF>
47 // first byte holds the two special flags
48 byte firstByte = (byte) Integer.parseInt(responsePayload.substring(0, 1), 16);
50 if ((firstByte & (1 << 0)) == (1 << 0)) {
53 if ((firstByte & (1 << 1)) == (1 << 1)) {
57 // convert the ascii values back to string
58 StringBuilder sb = new StringBuilder();
59 for (int i = 2; i < responsePayload.length() - 1; i += 2) {
60 String hexAsciiValue = responsePayload.substring(i, i + 2);
62 sb.append((char) Integer.parseInt(hexAsciiValue, 16));
63 } catch (Exception e) {
64 logger.error("parsing string failed '{}'", responsePayload, e);
67 infoText = sb.toString();
70 public String getInfoText() {
74 public void setInfoText(String infoText) {
75 this.infoText = infoText;
78 public Boolean getVolumeDisplay() {
82 public Boolean getGuidIcon() {