2 * Copyright (c) 2010-2023 Contributors to the openHAB project
4 * See the NOTICE file(s) distributed with this work for additional
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
11 * SPDX-License-Identifier: EPL-2.0
13 package org.openhab.binding.urtsi.internal.mapping;
16 * The {@code UrtsiChannelMapping} is responsible for mapping the channel you select at the URTSI II device to the
17 * channel which is transmitted via the serial port.
19 * @author Oliver Libutzki - Initial contribution
22 public class UrtsiChannelMapping {
25 * Returns the mapped channel which is used to communicate with the URTSI II device. Returns null if the given
26 * channel is not valid.
28 * @param configuredChannel the channel selected at the URTSI II device
29 * @return returns the mapped channel, returns null is the given channel is not valid.
31 public static String getMappedChannel(String configuredChannel) {
32 int channel = Integer.parseInt(configuredChannel, 16);
36 if (channel < 1 || channel > 16) {
39 return String.format("%02d", channel);