2 * Copyright (c) 2010-2021 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.lutron.internal.radiora;
15 import org.openhab.binding.lutron.internal.radiora.protocol.LEDMapFeedback;
16 import org.openhab.binding.lutron.internal.radiora.protocol.LocalZoneChangeFeedback;
17 import org.openhab.binding.lutron.internal.radiora.protocol.RadioRAFeedback;
18 import org.openhab.binding.lutron.internal.radiora.protocol.ZoneMapFeedback;
19 import org.slf4j.Logger;
20 import org.slf4j.LoggerFactory;
23 * This class handles decoding message types from RadioRA
25 * @author Jeff Lauterbach - Initial Contribution
28 public class RS232MessageParser {
30 private Logger logger = LoggerFactory.getLogger(RS232MessageParser.class);
32 public RadioRAFeedback parse(String msg) {
33 String prefix = parsePrefix(msg);
37 return new LEDMapFeedback(msg);
39 return new LocalZoneChangeFeedback(msg);
41 return new ZoneMapFeedback(msg);
43 // No action to take when this message is received but handle
44 // it to prevent the the default log statement from occurring.
48 logger.debug("Unhandled msg received from RS232 [{}]", msg);
55 protected String parsePrefix(String msg) {
56 String[] arr = msg.split(",");
58 logger.debug("Unexpected msg received from RS232 [{}]", msg);