]> git.basschouten.com Git - openhab-addons.git/blob
2290b3e2248c3fb8ba39a49be2a58a663e740fa2
[openhab-addons.git] /
1 /**
2  * Copyright (c) 2010-2023 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.plugwise.internal.protocol;
14
15 import static org.openhab.binding.plugwise.internal.protocol.field.MessageType.DEVICE_ROLE_CALL_REQUEST;
16
17 import org.openhab.binding.plugwise.internal.protocol.field.MACAddress;
18
19 /**
20  * Requests the Circle+ to return the MAC address for a specific node. This message is answered by a
21  * {@link RoleCallResponseMessage} which contains the MAC address. Because a Plugwise network can have 64 devices,
22  * the node ID value has a range from 0 to 63.
23  *
24  * @author Wouter Born, Karel Goderis - Initial contribution
25  */
26 public class RoleCallRequestMessage extends Message {
27
28     private int nodeID;
29
30     public RoleCallRequestMessage(MACAddress macAddress, int nodeID) {
31         super(DEVICE_ROLE_CALL_REQUEST, macAddress);
32         this.nodeID = nodeID;
33     }
34
35     @Override
36     public String getPayload() {
37         return String.format("%02X", nodeID);
38     }
39
40     @Override
41     protected String payloadToHexString() {
42         return String.format("%02X", nodeID);
43     }
44 }