]> git.basschouten.com Git - openhab-addons.git/blob
0fd24dfab9195641687f1c000692df4e2173a6ad
[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.POWER_BUFFER_REQUEST;
16
17 import org.openhab.binding.plugwise.internal.protocol.field.MACAddress;
18
19 /**
20  * Requests the historical pulse measurements at a certain log address from a device (Circle, Circle+, Stealth). This
21  * message is answered by a {@link PowerBufferResponseMessage}.
22  *
23  * @author Wouter Born, Karel Goderis - Initial contribution
24  */
25 public class PowerBufferRequestMessage extends Message {
26
27     private int logAddress;
28
29     public PowerBufferRequestMessage(MACAddress macAddress, int logAddress) {
30         super(POWER_BUFFER_REQUEST, macAddress);
31         this.logAddress = logAddress;
32     }
33
34     @Override
35     protected String payloadToHexString() {
36         return String.format("%08X", (logAddress * 32 + 278528));
37     }
38 }