2 * Copyright (c) 2010-2024 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;
16 import java.nio.ByteOrder;
18 import org.eclipse.jdt.annotation.NonNullByDefault;
19 import org.eclipse.jdt.annotation.Nullable;
22 * This class is in charge of serializing/deserializing values from a message
24 * @author Benjamin Lafois - Initial contribution
27 public class MadokaValue {
31 private byte @Nullable [] rawValue;
33 public MadokaValue(int id, int size, byte[] rawValue) {
36 this.rawValue = rawValue;
39 public MadokaValue() {
46 public void setId(int id) {
50 public int getSize() {
54 public void setSize(int size) {
58 public byte @Nullable [] getRawValue() {
62 public void setRawValue(byte[] rawValue) {
63 this.rawValue = rawValue;
67 * For backward compatibility
71 public long getComputedValue() {
72 return getComputedValue(ByteOrder.BIG_ENDIAN);
75 public long getComputedValue(ByteOrder e) {
83 bb = ByteBuffer.wrap(v, 0, 2);
87 bb = ByteBuffer.wrap(v, 0, 4);