]> git.basschouten.com Git - openhab-addons.git/blob
9b7f4cec65859278c6f829fb9ccf0fbf6a13a4f4
[openhab-addons.git] /
1 /**
2  * Copyright (c) 2010-2024 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.freeathomesystem.internal.util;
14
15 import static org.openhab.binding.freeathomesystem.internal.FreeAtHomeSystemBindingConstants.*;
16
17 import org.eclipse.jdt.annotation.NonNullByDefault;
18 import org.openhab.core.thing.ThingTypeUID;
19 import org.openhab.core.thing.type.ChannelTypeUID;
20
21 /**
22  *
23  * @author Andras Uhrin - Initial contribution
24  *
25  */
26 @NonNullByDefault
27 public class UidUtils {
28
29     public static ChannelTypeUID generateChannelTypeUID(String valueType, boolean isReadOnly) {
30         String channelNameString;
31
32         if (isReadOnly) {
33             channelNameString = valueType + "-ro";
34         } else {
35             channelNameString = valueType;
36         }
37
38         return new ChannelTypeUID(BINDING_ID, channelNameString);
39     }
40
41     public static ThingTypeUID generateThingUID() {
42         return new ThingTypeUID(BINDING_ID, DEVICE_TYPE_ID);
43     }
44 }