]> git.basschouten.com Git - openhab-addons.git/blob
2be0d4f53a9048bd8fb1291bbee571f9a08fb233
[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.enocean.internal.eep.Base;
14
15 import static org.openhab.binding.enocean.internal.messages.ESP3Packet.*;
16
17 import org.eclipse.jdt.annotation.NonNullByDefault;
18 import org.openhab.binding.enocean.internal.eep.EEP;
19 import org.openhab.binding.enocean.internal.messages.ERP1Message;
20
21 /**
22  *
23  * @author Daniel Weber - Initial contribution
24  */
25 @NonNullByDefault
26 public abstract class _SIGMessage extends EEP {
27
28     public static final byte MID_ENERGY_STATUS = 0x06;
29
30     public _SIGMessage() {
31         super();
32     }
33
34     public _SIGMessage(ERP1Message packet) {
35         super(packet);
36     }
37
38     @Override
39     protected int getDataLength() {
40         ERP1Message localPacket = packet;
41         if (localPacket != null) {
42             return localPacket.getPayload().length - ESP3_SENDERID_LENGTH - ESP3_RORG_LENGTH - ESP3_STATUS_LENGTH;
43         } else {
44             return bytes.length;
45         }
46     }
47
48     @Override
49     protected boolean validateData(byte[] bytes) {
50         return true;
51     }
52 }