2 * Copyright (c) 2010-2021 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.bluetooth.daikinmadoka.internal.model;
15 import java.nio.ByteBuffer;
17 import org.eclipse.jdt.annotation.NonNullByDefault;
18 import org.eclipse.jdt.annotation.Nullable;
21 * This class is in charge of serializing/deserializing values from a message
23 * @author Benjamin Lafois - Initial contribution
26 public class MadokaValue {
30 private byte @Nullable [] rawValue;
32 public MadokaValue(int id, int size, byte[] rawValue) {
35 this.rawValue = rawValue;
38 public MadokaValue() {
45 public void setId(int id) {
49 public int getSize() {
53 public void setSize(int size) {
57 public byte @Nullable [] getRawValue() {
61 public void setRawValue(byte[] rawValue) {
62 this.rawValue = rawValue;
65 public long getComputedValue() {
72 return ByteBuffer.wrap(v, 0, 2).getShort();
74 return ByteBuffer.wrap(v, 0, 4).getInt();