]> git.basschouten.com Git - openhab-addons.git/blob
f0f6f4d7b4025ae51d674e66eee17124715521ab
[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.flicbutton.internal;
14
15 import java.util.Collections;
16 import java.util.HashMap;
17 import java.util.Map;
18 import java.util.Set;
19
20 import org.eclipse.jdt.annotation.NonNullByDefault;
21 import org.openhab.core.thing.CommonTriggerEvents;
22 import org.openhab.core.thing.ThingTypeUID;
23
24 /**
25  * The {@link FlicButtonBindingConstants} class defines common constants, which are
26  * used across the whole binding.
27  *
28  * @author Patrick Fink - Initial contribution
29  */
30 @NonNullByDefault
31 public class FlicButtonBindingConstants {
32
33     public static final String BINDING_ID = "flicbutton";
34
35     // List of all Thing Type UIDs
36     public static final ThingTypeUID BRIDGE_THING_TYPE = new ThingTypeUID(BINDING_ID, "flicd-bridge");
37     public static final ThingTypeUID FLICBUTTON_THING_TYPE = new ThingTypeUID(BINDING_ID, "button");
38
39     public static final Set<ThingTypeUID> BRIDGE_THING_TYPES_UIDS = Set.of(BRIDGE_THING_TYPE);
40     public static final Set<ThingTypeUID> SUPPORTED_THING_TYPES_UIDS = Set.of(FLICBUTTON_THING_TYPE);
41
42     // List of all configuration options
43     public static final String CONFIG_HOST_NAME = "hostname";
44     public static final String CONFIG_PORT = "port";
45     public static final String CONFIG_ADDRESS = "address";
46
47     // List of all Channel ids
48     public static final String CHANNEL_ID_RAWBUTTON_EVENTS = "rawbutton";
49     public static final String CHANNEL_ID_BUTTON_EVENTS = "button";
50     public static final String CHANNEL_ID_BATTERY_LEVEL = "battery-level";
51
52     // Other stuff
53     public static final int BUTTON_OFFLINE_GRACE_PERIOD_SECONDS = 60;
54
55     public static final Map<String, String> FLIC_OPENHAB_TRIGGER_EVENT_MAP = Collections
56             .unmodifiableMap(new HashMap<String, String>() {
57                 {
58                     put("ButtonSingleClick", CommonTriggerEvents.SHORT_PRESSED);
59                     put("ButtonDoubleClick", CommonTriggerEvents.DOUBLE_PRESSED);
60                     put("ButtonHold", CommonTriggerEvents.LONG_PRESSED);
61                     put("ButtonDown", CommonTriggerEvents.PRESSED);
62                     put("ButtonUp", CommonTriggerEvents.RELEASED);
63                 }
64             });
65 }