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.sinope.internal.core.appdata;
15 import java.nio.ByteBuffer;
16 import java.nio.ByteOrder;
19 * The Class SinopeRoomTempData.
21 * @author Pascal Larin - Initial contribution
23 public class SinopeRoomTempData extends SinopeAppData {
26 * Instantiates a new sinope room temp data.
28 public SinopeRoomTempData() {
29 super(new byte[] { 0x00, 0x00, 0x02, 0x03 }, new byte[] { 0, 0 });
35 * @return the room temp
37 public int getRoomTemp() {
38 if (getData() != null) {
39 ByteBuffer bb = ByteBuffer.wrap(getData());
40 bb.order(ByteOrder.LITTLE_ENDIAN);
47 * @see org.openhab.binding.sinope.internal.core.appdata.SinopeAppData#toString()
50 public String toString() {
51 StringBuilder sb = new StringBuilder();
52 sb.append(super.toString());
53 if (getData() != null) {
54 sb.append(String.format("\n\tRoom temperature is %2.2f C", this.getRoomTemp() / 100.0));