]> git.basschouten.com Git - openhab-addons.git/blob
ce19528af36f08a07aa0d09819ed37a83d055645
[openhab-addons.git] /
1 /**
2  * Copyright (c) 2010-2021 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.F6_01;
14
15 import org.openhab.binding.enocean.internal.eep.Base._RPSMessage;
16 import org.openhab.binding.enocean.internal.messages.ERP1Message;
17 import org.openhab.core.config.core.Configuration;
18 import org.openhab.core.thing.CommonTriggerEvents;
19
20 /**
21  *
22  * @author Daniel Weber - Initial contribution
23  */
24 public class F6_01_01 extends _RPSMessage {
25
26     public F6_01_01() {
27         super();
28     }
29
30     public F6_01_01(ERP1Message packet) {
31         super(packet);
32     }
33
34     @Override
35     protected String convertToEventImpl(String channelId, String channelTypeId, String lastEvent,
36             Configuration config) {
37         if (!isValid()) {
38             return null;
39         }
40
41         return getBit(bytes[0], 4) ? CommonTriggerEvents.PRESSED : CommonTriggerEvents.RELEASED;
42     }
43
44     @Override
45     protected boolean validateData(byte[] bytes) {
46         return super.validateData(bytes) && !getBit(bytes[0], 7);
47     }
48 }