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