]> git.basschouten.com Git - openhab-addons.git/blob
b09dc582899d21fb616c6aea820824e8df627b76
[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.responses;
14
15 import org.eclipse.jdt.annotation.NonNullByDefault;
16 import org.openhab.binding.enocean.internal.messages.Response;
17
18 /**
19  *
20  * @author Daniel Weber - Initial contribution
21  */
22 @NonNullByDefault
23 public class SMACKTeachInResponse extends Response {
24
25     // set response time to 250ms
26     static final byte RESPONSE_TIME_HVALUE = 0;
27     static final byte RESPONSE_TIME_LVALUE = (byte) 0xFA;
28
29     static final byte TEACH_IN = 0x00;
30     static final byte TEACH_OUT = 0x20;
31     static final byte REPEATED_TEACH_IN = 0x01;
32     static final byte NOPLACE_FOR_MAILBOX = 0x12;
33     static final byte BAD_RSSI = 0x14;
34
35     public SMACKTeachInResponse() {
36         super(4, 0, new byte[] { Response.ResponseType.RET_OK.getValue(), RESPONSE_TIME_HVALUE, RESPONSE_TIME_LVALUE,
37                 TEACH_IN });
38     }
39
40     public void setTeachOutResponse() {
41         data[3] = TEACH_OUT;
42     }
43
44     public boolean isTeachOut() {
45         return data[3] == TEACH_OUT;
46     }
47
48     public void setRepeatedTeachInResponse() {
49         data[3] = REPEATED_TEACH_IN;
50     }
51
52     public void setNoPlaceForFurtherMailbox() {
53         data[3] = NOPLACE_FOR_MAILBOX;
54     }
55
56     public void setBadRSSI() {
57         data[3] = BAD_RSSI;
58     }
59
60     public void setTeachIn() {
61         data[3] = TEACH_IN;
62     }
63
64     public boolean isTeachIn() {
65         return data[3] == TEACH_IN;
66     }
67 }