]> git.basschouten.com Git - openhab-addons.git/commitdiff
[rotel] Fix command to select PC USB source (ASCII v2 mode) (#10165)
authorlolodomo <lg.hc@free.fr>
Wed, 17 Feb 2021 10:38:27 +0000 (11:38 +0100)
committerGitHub <noreply@github.com>
Wed, 17 Feb 2021 10:38:27 +0000 (11:38 +0100)
Signed-off-by: Laurent Garnier <lg.hc@free.fr>
bundles/org.openhab.binding.rotel/src/main/java/org/openhab/binding/rotel/internal/communication/RotelCommand.java
bundles/org.openhab.binding.rotel/src/main/java/org/openhab/binding/rotel/internal/handler/RotelHandler.java

index 3333ef96d6205781cb478ed8eb52ef427d3b1ca4..a454430847601eebd280a53111bdae35a5ae8219 100644 (file)
@@ -87,7 +87,7 @@ public enum RotelCommand {
     SOURCE_VIDEO8("Source Video 8", "video8", "video8"),
     SOURCE_PHONO("Source Phono", RotelConnector.PRIMARY_CMD, (byte) 0x35, "phono", "phono"),
     SOURCE_USB("Source Front USB", RotelConnector.PRIMARY_CMD, (byte) 0x8E, "usb", "usb"),
-    SOURCE_PCUSB("Source PC USB", "pc_usb", "pc_usb"),
+    SOURCE_PCUSB("Source PC USB", "pc_usb", "pcusb"),
     SOURCE_MULTI_INPUT("Source Multi Input", RotelConnector.PRIMARY_CMD, (byte) 0x15, "multi_input", "multi_input"),
     SOURCE_AUX("Source Aux", "aux", "aux"),
     SOURCE_AUX1("Source Aux 1", "aux1", "aux1"),
@@ -336,9 +336,9 @@ public enum RotelCommand {
      *
      * @throws RotelException - If no command is associated to the searched textual command
      */
-    public static RotelCommand getFromAsciiCommandV2(String text) throws RotelException {
+    public static RotelCommand getFromAsciiCommand(String text) throws RotelException {
         for (RotelCommand value : RotelCommand.values()) {
-            if (text.equals(value.getAsciiCommandV2())) {
+            if (text.equals(value.getAsciiCommandV1()) || text.equals(value.getAsciiCommandV2())) {
                 return value;
             }
         }
index 943b82fe3bfd816ae22d2e99594368470fdbd95e..d2fb766920bbf7fd7afb9fbd6b9d0034a383a138 100644 (file)
@@ -1293,28 +1293,28 @@ public class RotelHandler extends BaseThingHandler implements RotelMessageEventL
                     updateChannelState(CHANNEL_MAIN_TREBLE);
                     break;
                 case RotelConnector.KEY_SOURCE:
-                    source = connector.getModel().getSourceFromCommand(RotelCommand.getFromAsciiCommandV2(value));
+                    source = connector.getModel().getSourceFromCommand(RotelCommand.getFromAsciiCommand(value));
                     updateChannelState(CHANNEL_SOURCE);
                     updateChannelState(CHANNEL_MAIN_SOURCE);
                     break;
                 case RotelConnector.KEY_RECORD:
                     recordSource = connector.getModel()
-                            .getRecordSourceFromCommand(RotelCommand.getFromAsciiCommandV2(value));
+                            .getRecordSourceFromCommand(RotelCommand.getFromAsciiCommand(value));
                     updateChannelState(CHANNEL_MAIN_RECORD_SOURCE);
                     break;
                 case RotelConnector.KEY_SOURCE_ZONE2:
                     sourceZone2 = connector.getModel()
-                            .getZone2SourceFromCommand(RotelCommand.getFromAsciiCommandV2(value));
+                            .getZone2SourceFromCommand(RotelCommand.getFromAsciiCommand(value));
                     updateChannelState(CHANNEL_ZONE2_SOURCE);
                     break;
                 case RotelConnector.KEY_SOURCE_ZONE3:
                     sourceZone3 = connector.getModel()
-                            .getZone3SourceFromCommand(RotelCommand.getFromAsciiCommandV2(value));
+                            .getZone3SourceFromCommand(RotelCommand.getFromAsciiCommand(value));
                     updateChannelState(CHANNEL_ZONE3_SOURCE);
                     break;
                 case RotelConnector.KEY_SOURCE_ZONE4:
                     sourceZone4 = connector.getModel()
-                            .getZone4SourceFromCommand(RotelCommand.getFromAsciiCommandV2(value));
+                            .getZone4SourceFromCommand(RotelCommand.getFromAsciiCommand(value));
                     updateChannelState(CHANNEL_ZONE4_SOURCE);
                     break;
                 case RotelConnector.KEY_DSP_MODE: