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.plugwise.internal.protocol;
15 import static org.openhab.binding.plugwise.internal.protocol.field.MessageType.NODE_AVAILABLE_RESPONSE;
18 * Response to a device when its {@link NodeAvailableMessage} is "accepted".
20 * @author Wouter Born, Karel Goderis - Initial contribution
22 public class NodeAvailableResponseMessage extends Message {
24 private boolean acceptanceCode;
26 private String destinationMAC;
28 public NodeAvailableResponseMessage(boolean code, String destination) {
29 super(NODE_AVAILABLE_RESPONSE);
30 acceptanceCode = code;
31 destinationMAC = destination;
34 public boolean isAcceptanceCode() {
35 return acceptanceCode;
39 protected String payloadToHexString() {
40 return String.format("%02X", acceptanceCode ? 1 : 0) + destinationMAC;