]> git.basschouten.com Git - openhab-addons.git/blob
a03a9a4393ff1e99fb8900d30eac78e97bdd473f
[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.messages;
14
15 import org.eclipse.jdt.annotation.NonNullByDefault;
16
17 /**
18  *
19  * @author Daniel Weber - Initial contribution
20  */
21 @NonNullByDefault
22 class CCMessage extends BasePacket {
23
24     public enum CCMessageType {
25         CO_RD_VERSION((byte) 3, 1),
26         CO_WR_IDBASE((byte) 7, 5),
27         CO_RD_IDBASE((byte) 8, 1),
28         CO_WR_REPEATER((byte) 9, 3),
29         CO_RD_REPEATER((byte) 10, 1),
30         CO_RD_SECUREDEVICE_PSK((byte) 0x22, 1),
31         CO_RD_DUTYCYCLE_LIMIT((byte) 0x23, 1),
32         CO_GET_FREQUENCY_INFO((byte) 0x25, 1);
33
34         private byte value;
35         private int dataLength;
36
37         CCMessageType(byte value, int dataLength) {
38             this.value = value;
39             this.dataLength = dataLength;
40         }
41
42         public byte getValue() {
43             return this.value;
44         }
45
46         public int getDataLength() {
47             return dataLength;
48         }
49     }
50
51     private CCMessageType type;
52
53     public CCMessage(CCMessageType type) {
54         this(type, new byte[] { type.getValue() });
55     }
56
57     public CCMessage(CCMessageType type, byte[] payload) {
58         super(type.getDataLength(), 0, ESPPacketType.COMMON_COMMAND, payload);
59
60         this.type = type;
61     }
62
63     public CCMessageType getCCMessageType() {
64         return type;
65     }
66 }