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