added migrated 2.x add-ons

Signed-off-by: Kai Kreuzer <kai@openhab.org>
This commit is contained in:
Kai Kreuzer
2020-09-21 01:58:32 +02:00
parent bbf1a7fd29
commit 6df6783b60
11662 changed files with 1302875 additions and 11 deletions

View File

@@ -0,0 +1,10 @@
<?xml version="1.0" encoding="UTF-8"?>
<features name="org.openhab.binding.freebox-${project.version}" xmlns="http://karaf.apache.org/xmlns/features/v1.4.0">
<repository>mvn:org.openhab.core.features.karaf/org.openhab.core.features.karaf.openhab-core/${ohc.version}/xml/features</repository>
<feature name="openhab-binding-rotel" description="Rotel Binding" version="${project.version}">
<feature>openhab-runtime-base</feature>
<feature>openhab-transport-serial</feature>
<bundle start-level="80">mvn:org.openhab.addons.bundles/org.openhab.binding.rotel/${project.version}</bundle>
</feature>
</features>

View File

@@ -0,0 +1,154 @@
/**
* Copyright (c) 2010-2020 Contributors to the openHAB project
*
* See the NOTICE file(s) distributed with this work for additional
* information.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License 2.0 which is available at
* http://www.eclipse.org/legal/epl-2.0
*
* SPDX-License-Identifier: EPL-2.0
*/
package org.openhab.binding.rotel.internal;
import org.eclipse.jdt.annotation.NonNullByDefault;
import org.openhab.core.thing.ThingTypeUID;
/**
* The {@link RotelBindingConstants} class defines common constants, which are
* used across the whole binding.
*
* @author Laurent Garnier - Initial contribution
*/
@NonNullByDefault
public class RotelBindingConstants {
private static final String BINDING_ID = "rotel";
// List of all Thing Type IDs
public static final String THING_TYPE_ID_RSP1066 = "rsp1066";
public static final String THING_TYPE_ID_RSP1068 = "rsp1068";
public static final String THING_TYPE_ID_RSP1069 = "rsp1069";
public static final String THING_TYPE_ID_RSP1098 = "rsp1098";
public static final String THING_TYPE_ID_RSP1570 = "rsp1570";
public static final String THING_TYPE_ID_RSP1572 = "rsp1572";
public static final String THING_TYPE_ID_RSX1055 = "rsx1055";
public static final String THING_TYPE_ID_RSX1056 = "rsx1056";
public static final String THING_TYPE_ID_RSX1057 = "rsx1057";
public static final String THING_TYPE_ID_RSX1058 = "rsx1058";
public static final String THING_TYPE_ID_RSX1065 = "rsx1065";
public static final String THING_TYPE_ID_RSX1067 = "rsx1067";
public static final String THING_TYPE_ID_RSX1550 = "rsx1550";
public static final String THING_TYPE_ID_RSX1560 = "rsx1560";
public static final String THING_TYPE_ID_RSX1562 = "rsx1562";
public static final String THING_TYPE_ID_A11 = "a11";
public static final String THING_TYPE_ID_A12 = "a12";
public static final String THING_TYPE_ID_A14 = "a14";
public static final String THING_TYPE_ID_CD11 = "cd11";
public static final String THING_TYPE_ID_CD14 = "cd14";
public static final String THING_TYPE_ID_RA11 = "ra11";
public static final String THING_TYPE_ID_RA12 = "ra12";
public static final String THING_TYPE_ID_RA1570 = "ra1570";
public static final String THING_TYPE_ID_RA1572 = "ra1572";
public static final String THING_TYPE_ID_RA1592 = "ra1592";
public static final String THING_TYPE_ID_RAP1580 = "rap1580";
public static final String THING_TYPE_ID_RC1570 = "rc1570";
public static final String THING_TYPE_ID_RC1572 = "rc1572";
public static final String THING_TYPE_ID_RC1590 = "rc1590";
public static final String THING_TYPE_ID_RCD1570 = "rcd1570";
public static final String THING_TYPE_ID_RCD1572 = "rcd1572";
public static final String THING_TYPE_ID_RCX1500 = "rcx1500";
public static final String THING_TYPE_ID_RDD1580 = "rdd1580";
public static final String THING_TYPE_ID_RDG1520 = "rdg1520";
public static final String THING_TYPE_ID_RSP1576 = "rsp1576";
public static final String THING_TYPE_ID_RSP1582 = "rsp1582";
public static final String THING_TYPE_ID_RT09 = "rt09";
public static final String THING_TYPE_ID_RT11 = "rt11";
public static final String THING_TYPE_ID_RT1570 = "rt1570";
public static final String THING_TYPE_ID_T11 = "t11";
public static final String THING_TYPE_ID_T14 = "t14";
// List of all Thing Type UIDs
public static final ThingTypeUID THING_TYPE_RSP1066 = new ThingTypeUID(BINDING_ID, THING_TYPE_ID_RSP1066);
public static final ThingTypeUID THING_TYPE_RSP1068 = new ThingTypeUID(BINDING_ID, THING_TYPE_ID_RSP1068);
public static final ThingTypeUID THING_TYPE_RSP1069 = new ThingTypeUID(BINDING_ID, THING_TYPE_ID_RSP1069);
public static final ThingTypeUID THING_TYPE_RSP1098 = new ThingTypeUID(BINDING_ID, THING_TYPE_ID_RSP1098);
public static final ThingTypeUID THING_TYPE_RSP1570 = new ThingTypeUID(BINDING_ID, THING_TYPE_ID_RSP1570);
public static final ThingTypeUID THING_TYPE_RSP1572 = new ThingTypeUID(BINDING_ID, THING_TYPE_ID_RSP1572);
public static final ThingTypeUID THING_TYPE_RSX1055 = new ThingTypeUID(BINDING_ID, THING_TYPE_ID_RSX1055);
public static final ThingTypeUID THING_TYPE_RSX1056 = new ThingTypeUID(BINDING_ID, THING_TYPE_ID_RSX1056);
public static final ThingTypeUID THING_TYPE_RSX1057 = new ThingTypeUID(BINDING_ID, THING_TYPE_ID_RSX1057);
public static final ThingTypeUID THING_TYPE_RSX1058 = new ThingTypeUID(BINDING_ID, THING_TYPE_ID_RSX1058);
public static final ThingTypeUID THING_TYPE_RSX1065 = new ThingTypeUID(BINDING_ID, THING_TYPE_ID_RSX1065);
public static final ThingTypeUID THING_TYPE_RSX1067 = new ThingTypeUID(BINDING_ID, THING_TYPE_ID_RSX1067);
public static final ThingTypeUID THING_TYPE_RSX1550 = new ThingTypeUID(BINDING_ID, THING_TYPE_ID_RSX1550);
public static final ThingTypeUID THING_TYPE_RSX1560 = new ThingTypeUID(BINDING_ID, THING_TYPE_ID_RSX1560);
public static final ThingTypeUID THING_TYPE_RSX1562 = new ThingTypeUID(BINDING_ID, THING_TYPE_ID_RSX1562);
public static final ThingTypeUID THING_TYPE_A11 = new ThingTypeUID(BINDING_ID, THING_TYPE_ID_A11);
public static final ThingTypeUID THING_TYPE_A12 = new ThingTypeUID(BINDING_ID, THING_TYPE_ID_A12);
public static final ThingTypeUID THING_TYPE_A14 = new ThingTypeUID(BINDING_ID, THING_TYPE_ID_A14);
public static final ThingTypeUID THING_TYPE_CD11 = new ThingTypeUID(BINDING_ID, THING_TYPE_ID_CD11);
public static final ThingTypeUID THING_TYPE_CD14 = new ThingTypeUID(BINDING_ID, THING_TYPE_ID_CD14);
public static final ThingTypeUID THING_TYPE_RA11 = new ThingTypeUID(BINDING_ID, THING_TYPE_ID_RA11);
public static final ThingTypeUID THING_TYPE_RA12 = new ThingTypeUID(BINDING_ID, THING_TYPE_ID_RA12);
public static final ThingTypeUID THING_TYPE_RA1570 = new ThingTypeUID(BINDING_ID, THING_TYPE_ID_RA1570);
public static final ThingTypeUID THING_TYPE_RA1572 = new ThingTypeUID(BINDING_ID, THING_TYPE_ID_RA1572);
public static final ThingTypeUID THING_TYPE_RA1592 = new ThingTypeUID(BINDING_ID, THING_TYPE_ID_RA1592);
public static final ThingTypeUID THING_TYPE_RAP1580 = new ThingTypeUID(BINDING_ID, THING_TYPE_ID_RAP1580);
public static final ThingTypeUID THING_TYPE_RC1570 = new ThingTypeUID(BINDING_ID, THING_TYPE_ID_RC1570);
public static final ThingTypeUID THING_TYPE_RC1572 = new ThingTypeUID(BINDING_ID, THING_TYPE_ID_RC1572);
public static final ThingTypeUID THING_TYPE_RC1590 = new ThingTypeUID(BINDING_ID, THING_TYPE_ID_RC1590);
public static final ThingTypeUID THING_TYPE_RCD1570 = new ThingTypeUID(BINDING_ID, THING_TYPE_ID_RCD1570);
public static final ThingTypeUID THING_TYPE_RCD1572 = new ThingTypeUID(BINDING_ID, THING_TYPE_ID_RCD1572);
public static final ThingTypeUID THING_TYPE_RCX1500 = new ThingTypeUID(BINDING_ID, THING_TYPE_ID_RCX1500);
public static final ThingTypeUID THING_TYPE_RDD1580 = new ThingTypeUID(BINDING_ID, THING_TYPE_ID_RDD1580);
public static final ThingTypeUID THING_TYPE_RDG1520 = new ThingTypeUID(BINDING_ID, THING_TYPE_ID_RDG1520);
public static final ThingTypeUID THING_TYPE_RSP1576 = new ThingTypeUID(BINDING_ID, THING_TYPE_ID_RSP1576);
public static final ThingTypeUID THING_TYPE_RSP1582 = new ThingTypeUID(BINDING_ID, THING_TYPE_ID_RSP1582);
public static final ThingTypeUID THING_TYPE_RT09 = new ThingTypeUID(BINDING_ID, THING_TYPE_ID_RT09);
public static final ThingTypeUID THING_TYPE_RT11 = new ThingTypeUID(BINDING_ID, THING_TYPE_ID_RT11);
public static final ThingTypeUID THING_TYPE_RT1570 = new ThingTypeUID(BINDING_ID, THING_TYPE_ID_RT1570);
public static final ThingTypeUID THING_TYPE_T11 = new ThingTypeUID(BINDING_ID, THING_TYPE_ID_T11);
public static final ThingTypeUID THING_TYPE_T14 = new ThingTypeUID(BINDING_ID, THING_TYPE_ID_T14);
// List of all Channel ids
public static final String CHANNEL_POWER = "power";
public static final String CHANNEL_MAIN_POWER = "mainZone#power";
public static final String CHANNEL_SOURCE = "source";
public static final String CHANNEL_MAIN_SOURCE = "mainZone#source";
public static final String CHANNEL_MAIN_RECORD_SOURCE = "mainZone#recordSource";
public static final String CHANNEL_DSP = "dsp";
public static final String CHANNEL_MAIN_DSP = "mainZone#dsp";
public static final String CHANNEL_VOLUME = "volume";
public static final String CHANNEL_MAIN_VOLUME = "mainZone#volume";
public static final String CHANNEL_MAIN_VOLUME_UP_DOWN = "mainZone#volumeUpDown";
public static final String CHANNEL_MUTE = "mute";
public static final String CHANNEL_MAIN_MUTE = "mainZone#mute";
public static final String CHANNEL_BASS = "bass";
public static final String CHANNEL_MAIN_BASS = "mainZone#bass";
public static final String CHANNEL_TREBLE = "treble";
public static final String CHANNEL_MAIN_TREBLE = "mainZone#treble";
public static final String CHANNEL_PLAY_CONTROL = "playControl";
public static final String CHANNEL_TRACK = "track";
public static final String CHANNEL_FREQUENCY = "frequency";
public static final String CHANNEL_LINE1 = "mainZone#line1";
public static final String CHANNEL_LINE2 = "mainZone#line2";
public static final String CHANNEL_BRIGHTNESS = "brightness";
public static final String CHANNEL_ZONE2_POWER = "zone2#power";
public static final String CHANNEL_ZONE2_SOURCE = "zone2#source";
public static final String CHANNEL_ZONE2_VOLUME = "zone2#volume";
public static final String CHANNEL_ZONE2_VOLUME_UP_DOWN = "zone2#volumeUpDown";
public static final String CHANNEL_ZONE2_MUTE = "zone2#mute";
public static final String CHANNEL_ZONE3_POWER = "zone3#power";
public static final String CHANNEL_ZONE3_SOURCE = "zone3#source";
public static final String CHANNEL_ZONE3_VOLUME = "zone3#volume";
public static final String CHANNEL_ZONE3_MUTE = "zone3#mute";
public static final String CHANNEL_ZONE4_POWER = "zone4#power";
public static final String CHANNEL_ZONE4_SOURCE = "zone4#source";
public static final String CHANNEL_ZONE4_VOLUME = "zone4#volume";
public static final String CHANNEL_ZONE4_MUTE = "zone4#mute";
// List of all properties
public static final String PROPERTY_PROTOCOL = "protocol";
}

View File

@@ -0,0 +1,32 @@
/**
* Copyright (c) 2010-2020 Contributors to the openHAB project
*
* See the NOTICE file(s) distributed with this work for additional
* information.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License 2.0 which is available at
* http://www.eclipse.org/legal/epl-2.0
*
* SPDX-License-Identifier: EPL-2.0
*/
package org.openhab.binding.rotel.internal;
import org.eclipse.jdt.annotation.NonNullByDefault;
/**
* The {@link RotelException} class is used for any exception thrown by the binding
*
* @author Laurent Garnier - Initial contribution
*/
@NonNullByDefault
public class RotelException extends Exception {
private static final long serialVersionUID = 1L;
public RotelException() {
}
public RotelException(String message) {
super(message);
}
}

View File

@@ -0,0 +1,82 @@
/**
* Copyright (c) 2010-2020 Contributors to the openHAB project
*
* See the NOTICE file(s) distributed with this work for additional
* information.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License 2.0 which is available at
* http://www.eclipse.org/legal/epl-2.0
*
* SPDX-License-Identifier: EPL-2.0
*/
package org.openhab.binding.rotel.internal;
import static org.openhab.binding.rotel.internal.RotelBindingConstants.*;
import java.util.Collections;
import java.util.Set;
import java.util.stream.Collectors;
import java.util.stream.Stream;
import org.eclipse.jdt.annotation.NonNullByDefault;
import org.eclipse.jdt.annotation.Nullable;
import org.openhab.binding.rotel.internal.handler.RotelHandler;
import org.openhab.core.io.transport.serial.SerialPortManager;
import org.openhab.core.thing.Thing;
import org.openhab.core.thing.ThingTypeUID;
import org.openhab.core.thing.binding.BaseThingHandlerFactory;
import org.openhab.core.thing.binding.ThingHandler;
import org.openhab.core.thing.binding.ThingHandlerFactory;
import org.osgi.service.component.annotations.Activate;
import org.osgi.service.component.annotations.Component;
import org.osgi.service.component.annotations.Reference;
/**
* The {@link RotelHandlerFactory} is responsible for creating things and thing
* handlers.
*
* @author Laurent Garnier - Initial contribution
*/
@NonNullByDefault
@Component(configurationPid = "binding.rotel", service = ThingHandlerFactory.class)
public class RotelHandlerFactory extends BaseThingHandlerFactory {
private static final Set<ThingTypeUID> SUPPORTED_THING_TYPES_UIDS = Collections.unmodifiableSet(Stream
.of(THING_TYPE_RSP1066, THING_TYPE_RSP1068, THING_TYPE_RSP1069, THING_TYPE_RSP1098, THING_TYPE_RSP1570,
THING_TYPE_RSP1572, THING_TYPE_RSX1055, THING_TYPE_RSX1056, THING_TYPE_RSX1057, THING_TYPE_RSX1058,
THING_TYPE_RSX1065, THING_TYPE_RSX1067, THING_TYPE_RSX1550, THING_TYPE_RSX1560, THING_TYPE_RSX1562,
THING_TYPE_A11, THING_TYPE_A12, THING_TYPE_A14, THING_TYPE_CD11, THING_TYPE_CD14, THING_TYPE_RA11,
THING_TYPE_RA12, THING_TYPE_RA1570, THING_TYPE_RA1572, THING_TYPE_RA1592, THING_TYPE_RAP1580,
THING_TYPE_RC1570, THING_TYPE_RC1572, THING_TYPE_RC1590, THING_TYPE_RCD1570, THING_TYPE_RCD1572,
THING_TYPE_RCX1500, THING_TYPE_RDD1580, THING_TYPE_RDG1520, THING_TYPE_RSP1576, THING_TYPE_RSP1582,
THING_TYPE_RT09, THING_TYPE_RT11, THING_TYPE_RT1570, THING_TYPE_T11, THING_TYPE_T14)
.collect(Collectors.toSet()));
private final SerialPortManager serialPortManager;
private final RotelStateDescriptionOptionProvider stateDescriptionProvider;
@Activate
public RotelHandlerFactory(final @Reference SerialPortManager serialPortManager,
final @Reference RotelStateDescriptionOptionProvider stateDescriptionProvider) {
this.serialPortManager = serialPortManager;
this.stateDescriptionProvider = stateDescriptionProvider;
}
@Override
public boolean supportsThingType(ThingTypeUID thingTypeUID) {
return SUPPORTED_THING_TYPES_UIDS.contains(thingTypeUID);
}
@Override
protected @Nullable ThingHandler createHandler(Thing thing) {
ThingTypeUID thingTypeUID = thing.getThingTypeUID();
if (SUPPORTED_THING_TYPES_UIDS.contains(thingTypeUID)) {
return new RotelHandler(thing, stateDescriptionProvider, serialPortManager);
}
return null;
}
}

View File

@@ -0,0 +1,819 @@
/**
* Copyright (c) 2010-2020 Contributors to the openHAB project
*
* See the NOTICE file(s) distributed with this work for additional
* information.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License 2.0 which is available at
* http://www.eclipse.org/legal/epl-2.0
*
* SPDX-License-Identifier: EPL-2.0
*/
package org.openhab.binding.rotel.internal;
import java.util.ArrayList;
import java.util.List;
import org.eclipse.jdt.annotation.NonNullByDefault;
import org.eclipse.jdt.annotation.Nullable;
import org.openhab.binding.rotel.internal.communication.RotelCommand;
import org.openhab.binding.rotel.internal.communication.RotelConnector;
import org.openhab.binding.rotel.internal.communication.RotelDsp;
import org.openhab.binding.rotel.internal.communication.RotelFlagsMapping;
import org.openhab.binding.rotel.internal.communication.RotelSource;
import org.openhab.core.types.StateOption;
/**
* Represents the different supported models
*
* @author Laurent Garnier - Initial contribution
*/
@NonNullByDefault
public enum RotelModel {
RSP1066("RSP-1066", 19200, 3, 1, false, 90, false, 12, false, RotelCommand.ZONE_SELECT, 1, (byte) 0xC2, 13, 8, true,
RotelFlagsMapping.MAPPING1),
RSP1068("RSP-1068", 19200, 1, 1, true, 96, true, 6, false, RotelCommand.RECORD_FONCTION_SELECT, 2, (byte) 0xA1, 42,
5, true, RotelFlagsMapping.MAPPING2),
RSP1069("RSP-1069", 38400, 1, 3, true, 96, true, 6, false, RotelCommand.RECORD_FONCTION_SELECT, 2, (byte) 0xA2, 42,
5, true, RotelFlagsMapping.MAPPING5),
RSP1098("RSP-1098", 19200, 1, 1, true, 96, true, 6, false, RotelCommand.ZONE_SELECT, 2, (byte) 0xA0, 13, 8, true,
RotelFlagsMapping.MAPPING1),
RSP1570("RSP-1570", 115200, 1, 3, true, 96, true, 6, false, RotelCommand.RECORD_FONCTION_SELECT, 3, (byte) 0xA3, 42,
5, true, RotelFlagsMapping.MAPPING5),
RSP1572("RSP-1572", 115200, 2, 3, true, 96, true, null, false, RotelCommand.RECORD_FONCTION_SELECT, 4, (byte) 0xA5,
42, 5, true, RotelFlagsMapping.MAPPING5),
RSX1055("RSX-1055", 19200, 3, 1, false, 90, false, 12, false, RotelCommand.ZONE_SELECT, 1, (byte) 0xC3, 13, 8, true,
RotelFlagsMapping.MAPPING1),
RSX1056("RSX-1056", 19200, 1, 1, true, 96, true, 12, false, RotelCommand.ZONE_SELECT, 2, (byte) 0xC5, 13, 8, true,
RotelFlagsMapping.MAPPING1),
RSX1057("RSX-1057", 19200, 1, 1, true, 96, true, 6, false, RotelCommand.RECORD_FONCTION_SELECT, 2, (byte) 0xC7, 13,
8, true, RotelFlagsMapping.MAPPING1),
RSX1058("RSX-1058", 38400, 1, 3, true, 96, true, 6, false, RotelCommand.RECORD_FONCTION_SELECT, 2, (byte) 0xC8, 13,
8, true, RotelFlagsMapping.MAPPING4),
RSX1065("RSX-1065", 19200, 3, 1, false, 96, false, 12, false, RotelCommand.ZONE_SELECT, 1, (byte) 0xC1, 42, 5, true,
RotelFlagsMapping.MAPPING2),
RSX1067("RSX-1067", 19200, 1, 1, true, 96, true, 6, false, RotelCommand.RECORD_FONCTION_SELECT, 2, (byte) 0xC4, 42,
5, true, RotelFlagsMapping.MAPPING2),
RSX1550("RSX-1550", 115200, 1, 3, true, 96, true, 6, false, RotelCommand.RECORD_FONCTION_SELECT, 3, (byte) 0xC9, 13,
8, true, RotelFlagsMapping.MAPPING3),
RSX1560("RSX-1560", 115200, 1, 3, true, 96, true, 6, false, RotelCommand.RECORD_FONCTION_SELECT, 3, (byte) 0xCA, 42,
5, true, RotelFlagsMapping.MAPPING5),
RSX1562("RSX-1562", 115200, 2, 3, true, 96, true, null, false, RotelCommand.RECORD_FONCTION_SELECT, 4, (byte) 0xCC,
42, 5, true, RotelFlagsMapping.MAPPING5),
A11("A11", 115200, 4, 96, true, 10, false, -1, false, true, 6, 0, RotelConnector.NO_SPECIAL_CHARACTERS),
A12("A12", 115200, 5, 96, true, 10, false, -1, true, true, 6, 0, RotelConnector.NO_SPECIAL_CHARACTERS),
A14("A14", 115200, 5, 96, true, 10, false, -1, true, true, 6, 0, RotelConnector.NO_SPECIAL_CHARACTERS),
CD11("CD11", 57600, 0, null, false, null, true, -1, false, true, 6, 0, RotelConnector.NO_SPECIAL_CHARACTERS),
CD14("CD14", 57600, 0, null, false, null, true, -1, false, true, 6, 0, RotelConnector.NO_SPECIAL_CHARACTERS),
RA11("RA-11", 115200, 6, 96, true, 10, true, -1, true, false, 6, 0, RotelConnector.SPECIAL_CHARACTERS),
RA12("RA-12", 115200, 6, 96, true, 10, true, -1, true, false, 6, 0, RotelConnector.SPECIAL_CHARACTERS),
RA1570("RA-1570", 115200, 7, 96, true, 10, true, -1, true, false, 6, 0, RotelConnector.SPECIAL_CHARACTERS),
RA1572("RA-1572", 115200, 8, 96, true, 10, false, -1, true, true, 6, 0, RotelConnector.SPECIAL_CHARACTERS),
RA1592("RA-1592", 115200, 9, 96, true, 10, false, -1, true, true, 6, 0, RotelConnector.SPECIAL_CHARACTERS),
RAP1580("RAP-1580", 115200, 11, 96, true, null, false, 5, false, false, -10, 10,
RotelConnector.NO_SPECIAL_CHARACTERS),
RC1570("RC-1570", 115200, 7, 96, true, 10, true, -1, true, false, 6, 0, RotelConnector.SPECIAL_CHARACTERS),
RC1572("RC-1572", 115200, 8, 96, true, 10, false, -1, true, true, 6, 0, RotelConnector.SPECIAL_CHARACTERS),
RC1590("RC-1590", 115200, 9, 96, true, 10, false, -1, true, true, 6, 0, RotelConnector.SPECIAL_CHARACTERS),
RCD1570("RCD-1570", 115200, 0, null, false, null, true, -1, false, true, 6, 0, RotelConnector.SPECIAL_CHARACTERS),
RCD1572("RCD-1572", 57600, 0, null, false, null, true, -1, false, true, 6, 0,
RotelConnector.SPECIAL_CHARACTERS_RCD1572),
RCX1500("RCX-1500", 115200, 17, 86, true, null, true, -1, false, false, null, null,
RotelConnector.SPECIAL_CHARACTERS),
RDD1580("RDD-1580", 115200, 15, null, false, null, true, -1, true, false, null, null,
RotelConnector.NO_SPECIAL_CHARACTERS),
RDG1520("RDG-1520", 115200, 16, null, false, null, true, -1, false, false, null, null,
RotelConnector.SPECIAL_CHARACTERS),
RSP1576("RSP-1576", 115200, 10, 96, true, null, false, 5, false, false, -10, 10,
RotelConnector.NO_SPECIAL_CHARACTERS),
RSP1582("RSP-1582", 115200, 11, 96, true, null, false, 6, false, false, -10, 10,
RotelConnector.NO_SPECIAL_CHARACTERS),
RT11("RT-11", 115200, 12, null, false, null, false, -1, false, true, 6, 0, RotelConnector.NO_SPECIAL_CHARACTERS),
RT1570("RT-1570", 115200, 14, null, false, null, false, -1, false, true, 6, 0,
RotelConnector.NO_SPECIAL_CHARACTERS),
T11("T11", 115200, 12, null, false, null, false, -1, false, true, 6, 0, RotelConnector.NO_SPECIAL_CHARACTERS),
T14("T14", 115200, 13, null, false, null, false, -1, false, true, 6, 0, RotelConnector.NO_SPECIAL_CHARACTERS);
private String name;
private int baudRate;
private RotelCommand powerStateCmd;
private int sourceCategory;
private int nbAdditionalZones;
private boolean additionalCommands;
private @Nullable Integer volumeMax;
private boolean directVolume;
private @Nullable Integer toneLevelMax;
private boolean playControl;
private @Nullable RotelCommand zoneSelectCmd;
private int dspCategory;
private boolean getFrequencyAvailable;
private boolean getDimmerLevelAvailable;
private @Nullable Integer diummerLevelMin;
private @Nullable Integer diummerLevelMax;
private byte deviceId;
private int respNbChars;
private int respNbFlags;
private boolean charsBeforeFlags;
private RotelFlagsMapping flagsMapping;
private byte[][] specialCharacters;
/**
* Constructor
*
* @param name the model name
* @param baudRate the baud rate to be used for the RS232 communication
* @param sourceCategory the category from {@link RotelSource}
* @param nbAdditionalZones the number of additional zones
* @param additionalCommands true if other than primary commands are available
* @param volumeMax the maximum volume or null if no volume management is available
* @param directVolume true if a command to set the volume with a value is available
* @param toneLevelMax the maximum tone level or null if no bass/treble management is available
* @param playControl true if control of source playback is available
* @param zoneSelectCmd the command to be used to select a zone
* @param dspCategory the category from {@link RotelDsp}
* @param deviceId the device id (value to be used in the messages)
* @param respNbChars the number of bytes for the characters in the standard response
* @param respNbFlags the number of bytes for the flags in the standard response
* @param charsBeforeFlags true if the characters are before the flags in the standard response message
* @param flagsMapping the mapping of the flags in the feedback message
*/
private RotelModel(String name, int baudRate, int sourceCategory, int nbAdditionalZones, boolean additionalCommands,
@Nullable Integer volumeMax, boolean directVolume, @Nullable Integer toneLevelMax, boolean playControl,
@Nullable RotelCommand zoneSelectCmd, int dspCategory, byte deviceId, int respNbChars, int respNbFlags,
boolean charsBeforeFlags, RotelFlagsMapping flagsMapping) {
this(name, baudRate, RotelCommand.DISPLAY_REFRESH, sourceCategory, nbAdditionalZones, additionalCommands,
volumeMax, directVolume, toneLevelMax, playControl, zoneSelectCmd, dspCategory, false, false, null,
null, deviceId, respNbChars, respNbFlags, charsBeforeFlags, flagsMapping,
RotelConnector.NO_SPECIAL_CHARACTERS);
}
/**
* Constructor
*
* @param name the model name
* @param baudRate the baud rate to be used for the RS232 communication
* @param sourceCategory the category from {@link RotelSource}
* @param volumeMax the maximum volume or null if no volume management is available
* @param directVolume true if a command to set the volume with a value is available
* @param toneLevelMax the maximum tone level or null if no bass/treble management is available
* @param playControl true if control of source playback is available
* @param dspCategory the category from {@link RotelDsp}
* @param getFrequencyAvailable true if the command to get the frequency for digital source input is available
* @param getDimmerLevelAvailable true if the command to get the front display dimmer level is available
* @param diummerLevelMin the minimum front display dimmer level or null if dimmer control is unavailable
* @param diummerLevelMax the maximum front display dimmer level or null if dimmer control is unavailable
* @param specialCharacters the table of special characters that can be found in the standard response message
*/
private RotelModel(String name, int baudRate, int sourceCategory, @Nullable Integer volumeMax, boolean directVolume,
@Nullable Integer toneLevelMax, boolean playControl, int dspCategory, boolean getFrequencyAvailable,
boolean getDimmerLevelAvailable, @Nullable Integer diummerLevelMin, @Nullable Integer diummerLevelMax,
byte[][] specialCharacters) {
this(name, baudRate, RotelCommand.POWER, sourceCategory, 0, false, volumeMax, directVolume, toneLevelMax,
playControl, null, dspCategory, getFrequencyAvailable, getDimmerLevelAvailable, diummerLevelMin,
diummerLevelMax, (byte) 0, 0, 0, false, RotelFlagsMapping.NO_MAPPING, specialCharacters);
}
/**
* Constructor
*
* @param name the model name
* @param baudRate the baud rate to be used for the RS232 communication
* @param powerStateCmd the command to be used to check the power state of the device
* @param sourceCategory the category from {@link RotelSource}
* @param nbAdditionalZones the number of additional zones
* @param additionalCommands true if other than primary commands are available
* @param volumeMax the maximum volume or null if no volume management is available
* @param directVolume true if a command to set the volume with a value is available
* @param toneLevelMax the maximum tone level or null if no bass/treble management is available
* @param playControl true if control of source playback is available
* @param zoneSelectCmd the command to be used to select a zone
* @param dspCategory the category from {@link RotelDsp}
* @param getFrequencyAvailable true if the command to get the frequency for digital source input is available
* @param getDimmerLevelAvailable true if the command to get the front display dimmer level is available
* @param diummerLevelMin the minimum front display dimmer level or null if dimmer control is unavailable
* @param diummerLevelMax the maximum front display dimmer level or null if dimmer control is unavailable
* @param deviceId the device id (value to be used in the messages)
* @param respNbChars the number of bytes for the characters in the standard response
* @param respNbFlags the number of bytes for the flags in the standard response
* @param charsBeforeFlags true if the characters are before the flags in the standard response message
* @param flagsMapping the mapping of the flags in the feedback message
* @param specialCharacters the table of special characters that can be found in the standard response message
*/
private RotelModel(String name, int baudRate, RotelCommand powerStateCmd, int sourceCategory, int nbAdditionalZones,
boolean additionalCommands, @Nullable Integer volumeMax, boolean directVolume,
@Nullable Integer toneLevelMax, boolean playControl, @Nullable RotelCommand zoneSelectCmd, int dspCategory,
boolean getFrequencyAvailable, boolean getDimmerLevelAvailable, @Nullable Integer diummerLevelMin,
@Nullable Integer diummerLevelMax, byte deviceId, int respNbChars, int respNbFlags,
boolean charsBeforeFlags, RotelFlagsMapping flagsMapping, byte[][] specialCharacters) {
this.name = name;
this.baudRate = baudRate;
this.powerStateCmd = powerStateCmd;
this.sourceCategory = sourceCategory;
this.nbAdditionalZones = nbAdditionalZones;
this.additionalCommands = additionalCommands;
this.volumeMax = volumeMax;
this.directVolume = directVolume;
this.toneLevelMax = toneLevelMax;
this.playControl = playControl;
this.zoneSelectCmd = zoneSelectCmd;
this.dspCategory = dspCategory;
this.getFrequencyAvailable = getFrequencyAvailable;
this.getDimmerLevelAvailable = getDimmerLevelAvailable;
this.diummerLevelMin = diummerLevelMin;
this.diummerLevelMax = diummerLevelMax;
this.deviceId = deviceId;
this.respNbChars = respNbChars;
this.respNbFlags = respNbFlags;
this.charsBeforeFlags = charsBeforeFlags;
this.flagsMapping = flagsMapping;
this.specialCharacters = specialCharacters;
}
/**
* Get the model name
*
* @return the model name
*/
public String getName() {
return name;
}
/**
* Get the baud rate to be used for the RS232 communication
*
* @return the baud rate
*/
public int getBaudRate() {
return baudRate;
}
/**
* Get the command to be used to check the power state of the device
*
* @return the command
*/
public RotelCommand getPowerStateCmd() {
return powerStateCmd;
}
/**
* Inform whether source control is available
*
* @return true if source control is available
*/
public boolean hasSourceControl() {
return sourceCategory >= 1;
}
/**
* Get the number of additional zones
*
* @return the number of additional zones
*/
public int getNbAdditionalZones() {
return nbAdditionalZones;
}
/**
* Inform whether other than primary commands are available
*
* @return true if other than primary commands are available
*/
public boolean hasOtherThanPrimaryCommands() {
return additionalCommands;
}
/**
* Inform whether zone 2 commands are available
*
* @return true if zone 2 commands are available
*/
public boolean hasZone2Commands() {
return nbAdditionalZones >= 1 && additionalCommands;
}
/**
* Inform whether zone 3 commands are available
*
* @return true if zone 3 commands are available
*/
public boolean hasZone3Commands() {
return nbAdditionalZones >= 2 && additionalCommands;
}
/**
* Inform whether zone 4 commands are available
*
* @return true if zone 4 commands are available
*/
public boolean hasZone4Commands() {
return nbAdditionalZones >= 3 && additionalCommands;
}
/**
* Inform whether source control is available in the zone 2
*
* @return true if source control is available
*/
public boolean hasZone2SourceControl() {
return sourceCategory >= 1 && nbAdditionalZones >= 1;
}
/**
* Inform whether source control is available in the zone 3
*
* @return true if source control is available
*/
public boolean hasZone3SourceControl() {
return sourceCategory >= 1 && nbAdditionalZones >= 2;
}
/**
* Inform whether source control is available in the zone 4
*
* @return true if source control is available
*/
public boolean hasZone4SourceControl() {
return sourceCategory >= 1 && nbAdditionalZones >= 3;
}
/**
* Inform whether volume control is available
*
* @return true if volume control is available
*/
public boolean hasVolumeControl() {
return volumeMax != null;
}
/**
* Get the maximum volume
*
* @return the maximum volume or 0 if volume control is unavailable
*/
public int getVolumeMax() {
Integer volumeMax = this.volumeMax;
return volumeMax != null ? volumeMax.intValue() : 0;
}
/**
* Inform whether a command to set the volume with a value is available
*
* @return true if a command to set the volume with a value is available
*/
public boolean hasDirectVolumeControl() {
return directVolume;
}
/**
* Inform whether bass/treble control is available
*
* @return true if bass/treble control is available
*/
public boolean hasToneControl() {
return toneLevelMax != null;
}
/**
* Get the maximum tone level
*
* @return the maximum tone level or 0 if bass/treble control is unavailable
*/
public int getToneLevelMax() {
Integer toneLevelMax = this.toneLevelMax;
return toneLevelMax != null ? toneLevelMax.intValue() : 0;
}
/**
* Inform whether the command to get the current frequency for digital source input is available
*
* @return true if the command is available
*/
public boolean canGetFrequency() {
return getFrequencyAvailable;
}
/**
* Inform whether dimmer control is available
*
* @return true if dimmer control is available
*/
public boolean hasDimmerControl() {
return diummerLevelMin != null && diummerLevelMax != null;
}
/**
* Get the minimum front display dimmer level
*
* @return the minimum front display dimmer level or 0 if dimmer control is unavailable
*/
public int getDimmerLevelMin() {
Integer diummerLevelMin = this.diummerLevelMin;
return diummerLevelMin != null ? diummerLevelMin.intValue() : 0;
}
/**
* Get the maximum front display dimmer level
*
* @return the maximum front display dimmer level or 0 if dimmer control is unavailable
*/
public int getDimmerLevelMax() {
Integer diummerLevelMax = this.diummerLevelMax;
return diummerLevelMax != null ? diummerLevelMax.intValue() : 0;
}
/**
* Inform whether the command to get the front display dimmer level is available
*
* @return true if the command is available
*/
public boolean canGetDimmerLevel() {
return getDimmerLevelAvailable;
}
/**
* Inform whether control of source playback is available
*
* @return true if control of source playback is available
*/
public boolean hasPlayControl() {
return playControl;
}
/**
* Get the command to be used to select a zone
*
* @return the command
*/
public @Nullable RotelCommand getZoneSelectCmd() {
return zoneSelectCmd;
}
/**
* Inform whether DSP control is available
*
* @return true if DSP control is available
*/
public boolean hasDspControl() {
return dspCategory >= 1;
}
/**
* Get the device id (value to be used in the messages)
*
* @return the device id
*/
public byte getDeviceId() {
return deviceId;
}
/**
* Get the number of bytes for the characters in the standard response
*
* @return the number of bytes
*/
public int getRespNbChars() {
return respNbChars;
}
/**
* Get the number of bytes for the flags in the standard response
*
* @return the number of bytes
*/
public int getRespNbFlags() {
return respNbFlags;
}
/**
* Inform whether the characters are before or after the flags in the standard response message
*
* @return true if the characters are before the flags in the standard response message
*/
public boolean isCharsBeforeFlags() {
return charsBeforeFlags;
}
/**
* Get the table of special characters that can be found in the standard response message
*
* @return the table of bytes sequence representing the special characters
*/
public byte[][] getSpecialCharacters() {
return specialCharacters;
}
/**
* Get the list of available {@link RotelSource}
*
* @return the list of available {@link RotelSource}
*/
public List<RotelSource> getSources() {
return hasSourceControl() ? RotelSource.getSources(sourceCategory, 0) : new ArrayList<>();
}
/**
* Get the list of available {@link RotelSource} in the main zone
*
* @return the list of available {@link RotelSource} in the main zone
*/
public List<RotelSource> getMainZoneSources() {
return (hasSourceControl() && hasOtherThanPrimaryCommands()) ? RotelSource.getSources(sourceCategory, 1)
: new ArrayList<>();
}
/**
* Get the list of available {@link RotelSource} in the zone 2
*
* @return the list of available {@link RotelSource} in the zone 2
*/
public List<RotelSource> getZone2Sources() {
return hasZone2SourceControl() ? RotelSource.getSources(sourceCategory, 2) : new ArrayList<>();
}
/**
* Get the list of available {@link RotelSource} in the zone 3
*
* @return the list of available {@link RotelSource} in the zone 3
*/
public List<RotelSource> getZone3Sources() {
return hasZone3SourceControl() ? RotelSource.getSources(sourceCategory, 3) : new ArrayList<>();
}
/**
* Get the list of available {@link RotelSource} in the zone 4
*
* @return the list of available {@link RotelSource} in the zone 4
*/
public List<RotelSource> getZone4Sources() {
return hasZone4SourceControl() ? RotelSource.getSources(sourceCategory, 4) : new ArrayList<>();
}
/**
* Get the list of available {@link RotelSource} for recording
*
* @return the list of available {@link RotelSource} for recording
*/
public List<RotelSource> getRecordSources() {
return hasSourceControl() ? RotelSource.getSources(sourceCategory, 5) : new ArrayList<>();
}
/**
* Get the source associated to a name
*
* @param name the name used to identify the source
*
* @return the source associated to the searched name
*
* @throws RotelException - If no source is associated to the searched name
*/
public RotelSource getSourceFromName(String name) throws RotelException {
return RotelSource.getFromName(sourceCategory, name);
}
/**
* Get the source associated to a command
*
* @param command the command used to identify the source
*
* @return the source associated to the searched command
*
* @throws RotelException - If no source is associated to the searched command
*/
public RotelSource getSourceFromCommand(RotelCommand command) throws RotelException {
return RotelSource.getFromCommand(sourceCategory, command, 0);
}
/**
* Get the main zone source associated to a command
*
* @param command the command used to identify the main zone source
*
* @return the main zone source associated to the searched command
*
* @throws RotelException - If no main zone source is associated to the searched command
*/
public RotelSource getMainZoneSourceFromCommand(RotelCommand command) throws RotelException {
return RotelSource.getFromCommand(sourceCategory, command, 1);
}
/**
* Get the zone 2 source associated to a command
*
* @param command the command used to identify the zone 2 source
*
* @return the zone 2 source associated to the searched command
*
* @throws RotelException - If no zone 2 source is associated to the searched command
*/
public RotelSource getZone2SourceFromCommand(RotelCommand command) throws RotelException {
return RotelSource.getFromCommand(sourceCategory, command, 2);
}
/**
* Get the zone 3 source associated to a command
*
* @param command the command used to identify the zone 3 source
*
* @return the zone 3 source associated to the searched command
*
* @throws RotelException - If no zone 3 source is associated to the searched command
*/
public RotelSource getZone3SourceFromCommand(RotelCommand command) throws RotelException {
return RotelSource.getFromCommand(sourceCategory, command, 3);
}
/**
* Get the zone 4 source associated to a command
*
* @param command the command used to identify the zone 4 source
*
* @return the zone 4 source associated to the searched command
*
* @throws RotelException - If no zone 4 source is associated to the searched command
*/
public RotelSource getZone4SourceFromCommand(RotelCommand command) throws RotelException {
return RotelSource.getFromCommand(sourceCategory, command, 4);
}
/**
* Get the record source associated to a command
*
* @param command the command used to identify the record source
*
* @return the record source associated to the searched command
*
* @throws RotelException - If no record source is associated to the searched command
*/
public RotelSource getRecordSourceFromCommand(RotelCommand command) throws RotelException {
return RotelSource.getFromCommand(sourceCategory, command, 5);
}
/**
* Inform whether the multiple input source is set to ON in the flags
*
* @param flags the flag from the standard response message
*
* @return true if the multiple input source is ON
*
* @throws RotelException - If this information is not present in the flags for this model
*/
public boolean isMultiInputOn(byte[] flags) throws RotelException {
return flagsMapping.isMultiInputOn(flags);
}
/**
* Set the multiple input source to ON or OFF in the flags
*
* @param flags the flag from the standard response message
* @param on true for ON and false for OFF
*
* @throws RotelException - If this information is not present in the flags for this model
*/
public void setMultiInput(byte[] flags, boolean on) throws RotelException {
flagsMapping.setMultiInput(flags, on);
}
/**
* Inform whether the zone 2 is set to ON in the flags
*
* @param flags the flag from the standard response message
*
* @return true if the zone 2 is ON
*
* @throws RotelException - If this information is not present in the flags for this model
*/
public boolean isZone2On(byte[] flags) throws RotelException {
return flagsMapping.isZone2On(flags);
}
/**
* Set the zone 2 to ON or OFF in the flags
*
* @param flags the flag from the standard response message
* @param on true for ON and false for OFF
*
* @throws RotelException - If this information is not present in the flags for this model
*/
public void setZone2(byte[] flags, boolean on) throws RotelException {
flagsMapping.setZone2(flags, on);
}
/**
* Inform whether the zone 3 is set to ON in the flags
*
* @param flags the flag from the standard response message
*
* @return true if the zone 3 is ON
*
* @throws RotelException - If this information is not present in the flags for this model
*/
public boolean isZone3On(byte[] flags) throws RotelException {
return flagsMapping.isZone3On(flags);
}
/**
* Set the zone 3 to ON or OFF in the flags
*
* @param flags the flag from the standard response message
* @param on true for ON and false for OFF
*
* @throws RotelException - If this information is not present in the flags for this model
*/
public void setZone3(byte[] flags, boolean on) throws RotelException {
flagsMapping.setZone3(flags, on);
}
/**
* Inform whether the zone 4 is set to ON in the flags
*
* @param flags the flag from the standard response message
*
* @return true if the zone 4 is ON
*
* @throws RotelException - If this information is not present in the flags for this model
*/
public boolean isZone4On(byte[] flags) throws RotelException {
return flagsMapping.isZone4On(flags);
}
/**
* Set the zone 4 to ON or OFF in the flags
*
* @param flags the flag from the standard response message
* @param on true for ON and false for OFF
*
* @throws RotelException - If this information is not present in the flags for this model
*/
public void setZone4(byte[] flags, boolean on) throws RotelException {
flagsMapping.setZone4(flags, on);
}
/**
* Inform whether more than front left and front right channels are set as active in the flags
*
* @param flags the flag from the standard response message
*
* @return true if more than front left and front right channels are active
*
* @throws RotelException - If this information is not present in the flags for this model
*/
public boolean isMoreThan2Channels(byte[] flags) throws RotelException {
return flagsMapping.isMoreThan2Channels(flags);
}
/**
* Get the list of {@link StateOption} associated to the available DSP modes
*
* @return the list of {@link StateOption} associated to the available DSP modes
*/
public List<StateOption> getDspStateOptions() {
return RotelDsp.getStateOptions(dspCategory);
}
/**
* Get the command used to select a DSP mode
*
* @param name the name used to identify the DSP mode
*
* @return the select command associated to the searched name
*
* @throws RotelException - If no DSP mode is associated to the searched name
*/
public RotelCommand getCommandFromDspName(String name) throws RotelException {
return RotelDsp.getFromName(dspCategory, name).getCommand();
}
/**
* Get the DSP mode identified by a feedback message
*
* @param feedback the feedback message used to identify the DSP mode
*
* @return the DSP mode associated to the searched feedback message
*
* @throws RotelException - If no DSP mode is associated to the searched feedback message
*/
public RotelDsp getDspFromFeedback(String feedback) throws RotelException {
return RotelDsp.getFromFeedback(dspCategory, feedback);
}
/**
* Get the model associated to a name
*
* @param name the name used to identify the model
*
* @return the model associated to the searched name
*
* @throws RotelException - If no model is associated to the searched name
*/
public static RotelModel getFromName(String name) throws RotelException {
for (RotelModel value : RotelModel.values()) {
if (value.getName().equals(name)) {
return value;
}
}
throw new RotelException("Invalid model name: " + name);
}
}

View File

@@ -0,0 +1,27 @@
/**
* Copyright (c) 2010-2020 Contributors to the openHAB project
*
* See the NOTICE file(s) distributed with this work for additional
* information.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License 2.0 which is available at
* http://www.eclipse.org/legal/epl-2.0
*
* SPDX-License-Identifier: EPL-2.0
*/
package org.openhab.binding.rotel.internal;
import org.eclipse.jdt.annotation.NonNullByDefault;
/**
* Represents the different states of a source playback
*
* @author Laurent Garnier - Initial contribution
*/
@NonNullByDefault
public enum RotelPlayStatus {
PLAYING,
PAUSED,
STOPPED
}

View File

@@ -0,0 +1,41 @@
/**
* Copyright (c) 2010-2020 Contributors to the openHAB project
*
* See the NOTICE file(s) distributed with this work for additional
* information.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License 2.0 which is available at
* http://www.eclipse.org/legal/epl-2.0
*
* SPDX-License-Identifier: EPL-2.0
*/
package org.openhab.binding.rotel.internal;
import org.eclipse.jdt.annotation.NonNullByDefault;
import org.openhab.core.thing.binding.BaseDynamicStateDescriptionProvider;
import org.openhab.core.thing.i18n.ChannelTypeI18nLocalizationService;
import org.openhab.core.thing.type.DynamicStateDescriptionProvider;
import org.osgi.service.component.annotations.Component;
import org.osgi.service.component.annotations.Reference;
/**
* Dynamic provider of state options while leaving other state description fields as original.
*
* @author Laurent Garnier - Initial contribution
*/
@Component(service = { DynamicStateDescriptionProvider.class, RotelStateDescriptionOptionProvider.class })
@NonNullByDefault
public class RotelStateDescriptionOptionProvider extends BaseDynamicStateDescriptionProvider {
@Reference
protected void setChannelTypeI18nLocalizationService(
final ChannelTypeI18nLocalizationService channelTypeI18nLocalizationService) {
this.channelTypeI18nLocalizationService = channelTypeI18nLocalizationService;
}
protected void unsetChannelTypeI18nLocalizationService(
final ChannelTypeI18nLocalizationService channelTypeI18nLocalizationService) {
this.channelTypeI18nLocalizationService = null;
}
}

View File

@@ -0,0 +1,347 @@
/**
* Copyright (c) 2010-2020 Contributors to the openHAB project
*
* See the NOTICE file(s) distributed with this work for additional
* information.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License 2.0 which is available at
* http://www.eclipse.org/legal/epl-2.0
*
* SPDX-License-Identifier: EPL-2.0
*/
package org.openhab.binding.rotel.internal.communication;
import org.eclipse.jdt.annotation.NonNullByDefault;
import org.eclipse.jdt.annotation.Nullable;
import org.openhab.binding.rotel.internal.RotelException;
/**
* Represents the different kinds of commands
*
* @author Laurent Garnier - Initial contribution
*/
@NonNullByDefault
public enum RotelCommand {
POWER_TOGGLE("Power Toggle", RotelConnector.PRIMARY_CMD, (byte) 0x0A, "power_toggle", "power_toggle"),
POWER_OFF("Power Off", RotelConnector.PRIMARY_CMD, (byte) 0x4A, "power_off", "power_off"),
POWER_ON("Power On", RotelConnector.PRIMARY_CMD, (byte) 0x4B, "power_on", "power_on"),
POWER("Request current power status", "get_current_power", "power?"),
ZONE_SELECT("Zone Select", RotelConnector.PRIMARY_CMD, (byte) 0x23),
MAIN_ZONE_POWER_TOGGLE("Main Zone Power Toggle", RotelConnector.MAIN_ZONE_CMD, (byte) 0x0A),
MAIN_ZONE_POWER_OFF("Main Zone Power Off", RotelConnector.MAIN_ZONE_CMD, (byte) 0x4A),
MAIN_ZONE_POWER_ON("Main Zone Power On", RotelConnector.MAIN_ZONE_CMD, (byte) 0x4B),
ZONE2_POWER_TOGGLE("Zone 2 Power Toggle", RotelConnector.ZONE2_CMD, (byte) 0x0A),
ZONE2_POWER_OFF("Zone 2 Power Off", RotelConnector.ZONE2_CMD, (byte) 0x4A),
ZONE2_POWER_ON("Zone 2 Power On", RotelConnector.ZONE2_CMD, (byte) 0x4B),
ZONE3_POWER_TOGGLE("Zone 3 Power Toggle", RotelConnector.ZONE3_CMD, (byte) 0x0A),
ZONE3_POWER_OFF("Zone 3 Power Off", RotelConnector.ZONE3_CMD, (byte) 0x4A),
ZONE3_POWER_ON("Zone 3 Power On", RotelConnector.ZONE3_CMD, (byte) 0x4B),
ZONE4_POWER_TOGGLE("Zone 4 Power Toggle", RotelConnector.ZONE4_CMD, (byte) 0x0A),
ZONE4_POWER_OFF("Zone 4 Power Off", RotelConnector.ZONE4_CMD, (byte) 0x4A),
ZONE4_POWER_ON("Zone 4 Power On", RotelConnector.ZONE4_CMD, (byte) 0x4B),
VOLUME_UP("Volume Up", RotelConnector.PRIMARY_CMD, (byte) 0x0B, "volume_up", "vol_up"),
VOLUME_DOWN("Volume Down", RotelConnector.PRIMARY_CMD, (byte) 0x0C, "volume_down", "vol_dwn"),
VOLUME_SET("Set Volume to level", RotelConnector.VOLUME_CMD, (byte) 0, "volume_", "vol_"),
VOLUME_GET("Request current volume level", "get_volume", "volume?"),
VOLUME_GET_MIN("Request Min volume level", "get_volume_min", null),
VOLUME_GET_MAX("Request Max volume level", "get_volume_max", null),
MUTE_TOGGLE("Mute Toggle", RotelConnector.PRIMARY_CMD, (byte) 0x1E, "mute", "mute"),
MUTE_ON("Mute On", "mute_on", "mute_on"),
MUTE_OFF("Mute Off", "mute_off", "mute_off"),
MUTE("Request current mute status", "get_mute_status", "mute?"),
MAIN_ZONE_VOLUME_UP("Main Zone Volume Up", RotelConnector.MAIN_ZONE_CMD, (byte) 0),
MAIN_ZONE_VOLUME_DOWN("Main Zone Volume Down", RotelConnector.MAIN_ZONE_CMD, (byte) 1),
MAIN_ZONE_MUTE_TOGGLE("Main Zone Mute Toggle", RotelConnector.MAIN_ZONE_CMD, (byte) 0x1E),
MAIN_ZONE_MUTE_ON("Main Zone Mute On", RotelConnector.MAIN_ZONE_CMD, (byte) 0x6C),
MAIN_ZONE_MUTE_OFF("Main Zone Mute Off", RotelConnector.MAIN_ZONE_CMD, (byte) 0x6D),
ZONE2_VOLUME_UP("Zone 2 Volume Up", RotelConnector.ZONE2_CMD, (byte) 0),
ZONE2_VOLUME_DOWN("Zone 2 Volume Down", RotelConnector.ZONE2_CMD, (byte) 1),
ZONE2_VOLUME_SET("Set Zone 2 Volume to level", RotelConnector.ZONE2_VOLUME_CMD, (byte) 0),
ZONE2_MUTE_TOGGLE("Zone 2 Mute Toggle", RotelConnector.ZONE2_CMD, (byte) 0x1E),
ZONE2_MUTE_ON("Zone 2 Mute On", RotelConnector.ZONE2_CMD, (byte) 0x6C),
ZONE2_MUTE_OFF("Zone 2 Mute Off", RotelConnector.ZONE2_CMD, (byte) 0x6D),
ZONE3_VOLUME_UP("Zone 3 Volume Up", RotelConnector.ZONE3_CMD, (byte) 0),
ZONE3_VOLUME_DOWN("Zone 3 Volume Down", RotelConnector.ZONE3_CMD, (byte) 1),
ZONE3_VOLUME_SET("Set Zone 3 Volume to level", RotelConnector.ZONE3_VOLUME_CMD, (byte) 0),
ZONE3_MUTE_TOGGLE("Zone 3 Mute Toggle", RotelConnector.ZONE3_CMD, (byte) 0x1E),
ZONE3_MUTE_ON("Zone 3 Mute On", RotelConnector.ZONE3_CMD, (byte) 0x6C),
ZONE3_MUTE_OFF("Zone 3 Mute Off", RotelConnector.ZONE3_CMD, (byte) 0x6D),
ZONE4_VOLUME_UP("Zone 4 Volume Up", RotelConnector.ZONE4_CMD, (byte) 0),
ZONE4_VOLUME_DOWN("Zone 4 Volume Down", RotelConnector.ZONE4_CMD, (byte) 1),
ZONE4_VOLUME_SET("Set Zone 4 Volume to level", RotelConnector.ZONE4_VOLUME_CMD, (byte) 0),
ZONE4_MUTE_TOGGLE("Zone 4 Mute Toggle", RotelConnector.ZONE4_CMD, (byte) 0x1E),
ZONE4_MUTE_ON("Zone 4 Mute On", RotelConnector.ZONE4_CMD, (byte) 0x6C),
ZONE4_MUTE_OFF("Zone 4 Mute Off", RotelConnector.ZONE4_CMD, (byte) 0x6D),
SOURCE_CD("Source CD", RotelConnector.PRIMARY_CMD, (byte) 0x02, "cd", "cd"),
SOURCE_TUNER("Source Tuner", RotelConnector.PRIMARY_CMD, (byte) 0x03, "tuner", "tuner"),
SOURCE_TAPE("Source Tape", RotelConnector.PRIMARY_CMD, (byte) 0x04, "tape", "tape"),
SOURCE_VIDEO1("Source Video 1", RotelConnector.PRIMARY_CMD, (byte) 0x05, "video1", "video1"),
SOURCE_VIDEO2("Source Video 2", RotelConnector.PRIMARY_CMD, (byte) 0x06, "video2", "video2"),
SOURCE_VIDEO3("Source Video 3", RotelConnector.PRIMARY_CMD, (byte) 0x07, "video3", "video3"),
SOURCE_VIDEO4("Source Video 4", RotelConnector.PRIMARY_CMD, (byte) 0x08, "video4", "video4"),
SOURCE_VIDEO5("Source Video 5", RotelConnector.PRIMARY_CMD, (byte) 0x09, "video5", "video5"),
SOURCE_VIDEO6("Source Video 6", RotelConnector.PRIMARY_CMD, (byte) 0x94, "video6", "video6"),
SOURCE_VIDEO7("Source Video 7", "video7", "video7"),
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_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"),
SOURCE_AUX2("Source Aux 2", "aux2", "aux2"),
SOURCE_AUX1_COAX("Source Aux 1 Coax", "aux1_coax", "aux1_coax"),
SOURCE_AUX1_OPT("Source Aux 1 Optical", "aux1_opt", "aux1_opt"),
SOURCE_COAX1("Source Coax 1", "coax1", "coax1"),
SOURCE_COAX2("Source Coax 2", "coax2", "coax2"),
SOURCE_COAX3("Source Coax 3", "coax3", "coax3"),
SOURCE_OPT1("Source Optical 1", "opt1", "opt1"),
SOURCE_OPT2("Source Optical 2", "opt2", "opt2"),
SOURCE_OPT3("Source Optical 3", "opt3", "opt3"),
SOURCE_BLUETOOTH("Source Bluetooth", "bluetooth", "bluetooth"),
SOURCE_ROTEL_CD("Source Rotel CD", "rcd", null),
SOURCE_XLR("Source XLR", "bal_xlr", "bal_xlr"),
SOURCE_FM("Source FM", "fm", "fm"),
SOURCE_DAB("Source DAB", "dab", "dab"),
SOURCE_PLAYFI("Source PlayFi", "playfi", "playfi"),
SOURCE_IRADIO("Source iRadio", "iradio", "iradio"),
SOURCE_NETWORK("Source Network", "network", "network"),
SOURCE("Request current source", "get_current_source", "source?"),
MAIN_ZONE_SOURCE_CD("Main Zone Source CD", RotelConnector.MAIN_ZONE_CMD, (byte) 0x02, "main_zone_cd",
"main_zone_cd"),
MAIN_ZONE_SOURCE_TUNER("Main Zone Source Tuner", RotelConnector.MAIN_ZONE_CMD, (byte) 0x03, "main_zone_tuner",
"main_zone_tuner"),
MAIN_ZONE_SOURCE_TAPE("Main Zone Source Tape", RotelConnector.MAIN_ZONE_CMD, (byte) 0x04, "main_zone_tape",
"main_zone_tape"),
MAIN_ZONE_SOURCE_VIDEO1("Main Zone Source Video 1", RotelConnector.MAIN_ZONE_CMD, (byte) 0x05, "main_zone_video1",
"main_zone_video1"),
MAIN_ZONE_SOURCE_VIDEO2("Main Zone Source Video 2", RotelConnector.MAIN_ZONE_CMD, (byte) 0x06, "main_zone_video2",
"main_zone_video2"),
MAIN_ZONE_SOURCE_VIDEO3("Main Zone Source Video 3", RotelConnector.MAIN_ZONE_CMD, (byte) 0x07, "main_zone_video3",
"main_zone_video3"),
MAIN_ZONE_SOURCE_VIDEO4("Main Zone Source Video 4", RotelConnector.MAIN_ZONE_CMD, (byte) 0x08, "main_zone_video4",
"main_zone_video4"),
MAIN_ZONE_SOURCE_VIDEO5("Main Zone Source Video 5", RotelConnector.MAIN_ZONE_CMD, (byte) 0x09, "main_zone_video5",
"main_zone_video5"),
MAIN_ZONE_SOURCE_VIDEO6("Main Zone Source Video 6", RotelConnector.MAIN_ZONE_CMD, (byte) 0x94, "main_zone_video6",
"main_zone_video6"),
MAIN_ZONE_SOURCE_USB("Main Zone Source Front USB", RotelConnector.MAIN_ZONE_CMD, (byte) 0x8E, "main_zone_usb",
"main_zone_usb"),
MAIN_ZONE_SOURCE_MULTI_INPUT("Main Zone Source Multi Input", RotelConnector.MAIN_ZONE_CMD, (byte) 0x15,
"main_zone_multi_input", "main_zone_multi_input"),
RECORD_SOURCE_CD("Record Source CD", RotelConnector.RECORD_SRC_CMD, (byte) 0x02, "record_cd", "record_cd"),
RECORD_SOURCE_TUNER("Record Source Tuner", RotelConnector.RECORD_SRC_CMD, (byte) 0x03, "record_tuner",
"record_tuner"),
RECORD_SOURCE_TAPE("Record Source Tape", RotelConnector.RECORD_SRC_CMD, (byte) 0x04, "record_tape", "record_tape"),
RECORD_SOURCE_VIDEO1("Record Source Video 1", RotelConnector.RECORD_SRC_CMD, (byte) 0x05, "record_video1",
"record_video1"),
RECORD_SOURCE_VIDEO2("Record Source Video 2", RotelConnector.RECORD_SRC_CMD, (byte) 0x06, "record_video2",
"record_video2"),
RECORD_SOURCE_VIDEO3("Record Source Video 3", RotelConnector.RECORD_SRC_CMD, (byte) 0x07, "record_video3",
"record_video3"),
RECORD_SOURCE_VIDEO4("Record Source Video 4", RotelConnector.RECORD_SRC_CMD, (byte) 0x08, "record_video4",
"record_video4"),
RECORD_SOURCE_VIDEO5("Record Source Video 5", RotelConnector.RECORD_SRC_CMD, (byte) 0x09, "record_video5",
"record_video5"),
RECORD_SOURCE_VIDEO6("Record Source Video 6", RotelConnector.RECORD_SRC_CMD, (byte) 0x94, "record_video6",
"record_video6"),
RECORD_SOURCE_USB("Record Source Front USB", RotelConnector.RECORD_SRC_CMD, (byte) 0x8E, "record_usb",
"record_usb"),
RECORD_SOURCE_MAIN("Record Follow Main Zone Source", RotelConnector.RECORD_SRC_CMD, (byte) 0x6B,
"record_follow_main", "record_follow_main"),
ZONE2_SOURCE_CD("Zone 2 Source CD", RotelConnector.ZONE2_CMD, (byte) 0x02, "zone2_cd", "zone2_cd"),
ZONE2_SOURCE_TUNER("Zone 2 Source Tuner", RotelConnector.ZONE2_CMD, (byte) 0x03, "zone2_tuner", "zone2_tuner"),
ZONE2_SOURCE_TAPE("Zone 2 Source Tape", RotelConnector.ZONE2_CMD, (byte) 0x04, "zone2_tape", "zone2_tape"),
ZONE2_SOURCE_VIDEO1("Zone 2 Source Video 1", RotelConnector.ZONE2_CMD, (byte) 0x05, "zone2_video1", "zone2_video1"),
ZONE2_SOURCE_VIDEO2("Zone 2 Source Video 2", RotelConnector.ZONE2_CMD, (byte) 0x06, "zone2_video2", "zone2_video2"),
ZONE2_SOURCE_VIDEO3("Zone 2 Source Video 3", RotelConnector.ZONE2_CMD, (byte) 0x07, "zone2_video3", "zone2_video3"),
ZONE2_SOURCE_VIDEO4("Zone 2 Source Video 4", RotelConnector.ZONE2_CMD, (byte) 0x08, "zone2_video4", "zone2_video4"),
ZONE2_SOURCE_VIDEO5("Zone 2 Source Video 5", RotelConnector.ZONE2_CMD, (byte) 0x09, "zone2_video5", "zone2_video5"),
ZONE2_SOURCE_VIDEO6("Zone 2 Source Video 6", RotelConnector.ZONE2_CMD, (byte) 0x94, "zone2_video6", "zone2_video6"),
ZONE2_SOURCE_USB("Zone 2 Source Front USB", RotelConnector.ZONE2_CMD, (byte) 0x8E, "zone2_usb", "zone2_usb"),
ZONE2_SOURCE_MAIN("Zone 2 Follow Main Zone Source", RotelConnector.ZONE2_CMD, (byte) 0x6B, "zone2_follow_main",
"zone2_follow_main"),
ZONE3_SOURCE_CD("Zone 3 Source CD", RotelConnector.ZONE3_CMD, (byte) 0x02, "zone3_cd", "zone3_cd"),
ZONE3_SOURCE_TUNER("Zone 3 Source Tuner", RotelConnector.ZONE3_CMD, (byte) 0x03, "zone3_tuner", "zone3_tuner"),
ZONE3_SOURCE_TAPE("Zone 3 Source Tape", RotelConnector.ZONE3_CMD, (byte) 0x04, "zone3_tape", "zone3_tape"),
ZONE3_SOURCE_VIDEO1("Zone 3 Source Video 1", RotelConnector.ZONE3_CMD, (byte) 0x05, "zone3_video1", "zone3_video1"),
ZONE3_SOURCE_VIDEO2("Zone 3 Source Video 2", RotelConnector.ZONE3_CMD, (byte) 0x06, "zone3_video2", "zone3_video2"),
ZONE3_SOURCE_VIDEO3("Zone 3 Source Video 3", RotelConnector.ZONE3_CMD, (byte) 0x07, "zone3_video3", "zone3_video3"),
ZONE3_SOURCE_VIDEO4("Zone 3 Source Video 4", RotelConnector.ZONE3_CMD, (byte) 0x08, "zone3_video4", "zone3_video4"),
ZONE3_SOURCE_VIDEO5("Zone 3 Source Video 5", RotelConnector.ZONE3_CMD, (byte) 0x09, "zone3_video5", "zone3_video5"),
ZONE3_SOURCE_VIDEO6("Zone 3 Source Video 6", RotelConnector.ZONE3_CMD, (byte) 0x94, "zone3_video6", "zone3_video6"),
ZONE3_SOURCE_USB("Zone 3 Source Front USB", RotelConnector.ZONE3_CMD, (byte) 0x8E, "zone3_usb", "zone3_usb"),
ZONE3_SOURCE_MAIN("Zone 3 Follow Main Zone Source", RotelConnector.ZONE3_CMD, (byte) 0x6B, "zone3_follow_main",
"zone3_follow_main"),
ZONE4_SOURCE_CD("Zone 4 Source CD", RotelConnector.ZONE4_CMD, (byte) 0x02, "zone4_cd", "zone4_cd"),
ZONE4_SOURCE_TUNER("Zone 4 Source Tuner", RotelConnector.ZONE4_CMD, (byte) 0x03, "zone4_tuner", "zone4_tuner"),
ZONE4_SOURCE_TAPE("Zone 4 Source Tape", RotelConnector.ZONE4_CMD, (byte) 0x04, "zone4_tape", "zone4_tape"),
ZONE4_SOURCE_VIDEO1("Zone 4 Source Video 1", RotelConnector.ZONE4_CMD, (byte) 0x05, "zone4_video1", "zone4_video1"),
ZONE4_SOURCE_VIDEO2("Zone 4 Source Video 2", RotelConnector.ZONE4_CMD, (byte) 0x06, "zone4_video2", "zone4_video2"),
ZONE4_SOURCE_VIDEO3("Zone 4 Source Video 3", RotelConnector.ZONE4_CMD, (byte) 0x07, "zone4_video3", "zone4_video3"),
ZONE4_SOURCE_VIDEO4("Zone 4 Source Video 4", RotelConnector.ZONE4_CMD, (byte) 0x08, "zone4_video4", "zone4_video4"),
ZONE4_SOURCE_VIDEO5("Zone 4 Source Video 5", RotelConnector.ZONE4_CMD, (byte) 0x09, "zone4_video5", "zone4_video5"),
ZONE4_SOURCE_VIDEO6("Zone 4 Source Video 6", RotelConnector.ZONE4_CMD, (byte) 0x94, "zone4_video6", "zone4_video6"),
ZONE4_SOURCE_USB("Zone 4 Source Front USB", RotelConnector.ZONE4_CMD, (byte) 0x8E, "zone4_usb", "zone4_usb"),
ZONE4_SOURCE_MAIN("Zone 4 Follow Main Zone Source", RotelConnector.ZONE4_CMD, (byte) 0x6B, "zone4_follow_main",
"zone4_follow_main"),
STEREO("Stereo", RotelConnector.PRIMARY_CMD, (byte) 0x11, "2channel", "2channel"),
STEREO3("Dolby 3 Stereo ", RotelConnector.PRIMARY_CMD, (byte) 0x12, "3channel", "3channel"),
STEREO5("5 Channel Stereo", RotelConnector.PRIMARY_CMD, (byte) 0x5B, "5channel", "5channel"),
STEREO7("7 Channel Stereo", RotelConnector.PRIMARY_CMD, (byte) 0x5C, "7channel", "7channel"),
STEREO9("9 Channel Stereo", "9channel", "9channel"),
STEREO11("11 Channel Stereo", "11channel", "11channel"),
DSP1("DSP 1", RotelConnector.PRIMARY_CMD, (byte) 0x57),
DSP2("DSP 2", RotelConnector.PRIMARY_CMD, (byte) 0x58),
DSP3("DSP 3", RotelConnector.PRIMARY_CMD, (byte) 0x59),
DSP4("DSP 4", RotelConnector.PRIMARY_CMD, (byte) 0x5A),
PROLOGIC("Dolby Pro Logic", RotelConnector.PRIMARY_CMD, (byte) 0x5F),
PLII_CINEMA("Dolby PLII Cinema", RotelConnector.PRIMARY_CMD, (byte) 0x5D, "prologic_movie", "prologic_movie"),
PLII_MUSIC("Dolby PLII Music", RotelConnector.PRIMARY_CMD, (byte) 0x5E, "prologic_music", "prologic_music"),
PLII_GAME("Dolby PLII Game", RotelConnector.PRIMARY_CMD, (byte) 0x74, "prologic_game", "prologic_game"),
PLIIZ("Dolby PLIIz", RotelConnector.PRIMARY_CMD, (byte) 0x92, "prologic_iiz", "prologic_iiz"),
NEO6_MUSIC("dts Neo:6 Music", RotelConnector.PRIMARY_CMD, (byte) 0x60, "neo6_music", "neo6_music"),
NEO6_CINEMA("dts Neo:6 Cinema", RotelConnector.PRIMARY_CMD, (byte) 0x61, "neo6_cinema", "neo6_cinema"),
ATMOS("Dolby Atmos", "dolby_atmos", "dolby_atmos"),
NEURAL_X("dts Neural:X", "dts_neural", "dts_neural"),
BYPASS("Analog Bypass", RotelConnector.PRIMARY_CMD, (byte) 0x11, "bypass", "bypass"),
DSP_MODE("Request current DSP mode", "get_dsp_mode", "dsp_mode"),
TONE_MAX("Request Max tone level", "get_tone_max", null),
TONE_CONTROL_SELECT("Tone Control Select", RotelConnector.PRIMARY_CMD, (byte) 0x67),
TREBLE_UP("Treble Up", RotelConnector.PRIMARY_CMD, (byte) 0x0D, "treble_up", "treble_up"),
TREBLE_DOWN("Treble Down", RotelConnector.PRIMARY_CMD, (byte) 0x0E, "treble_down", "treble_down"),
TREBLE_SET("Set Treble to level", "treble_", "treble_"),
TREBLE("Request current treble level", "get_treble", "treble?"),
BASS_UP("Bass Up", RotelConnector.PRIMARY_CMD, (byte) 0x0F, "bass_up", "bass_up"),
BASS_DOWN("Bass Down", RotelConnector.PRIMARY_CMD, (byte) 0x10, "bass_down", "bass_down"),
BASS_SET("Set Bass to level", "bass_", "bass_"),
BASS("Request current bass level", "get_bass", "bass?"),
RECORD_FONCTION_SELECT("Record Function Select", RotelConnector.PRIMARY_CMD, (byte) 0x17),
PLAY("Play Source", RotelConnector.PRIMARY_CMD, (byte) 0x04, "play", "play"),
STOP("Stop Source", RotelConnector.PRIMARY_CMD, (byte) 0x06, "stop", "stop"),
PAUSE("Pause Source", RotelConnector.PRIMARY_CMD, (byte) 0x05, "pause", "pause"),
CD_PLAY_STATUS("Request CD play status", "get_cd_play_status", null),
PLAY_STATUS("Request source play status", "get_play_status", "status"),
TRACK_FORWARD("Track Forward", RotelConnector.PRIMARY_CMD, (byte) 0x09, "track_fwd", "trkf"),
TRACK_BACKWORD("Track Backward", RotelConnector.PRIMARY_CMD, (byte) 0x08, "track_back", "trkb"),
TRACK("Request current CD track number", null, "track"),
FREQUENCY("Request current frequency for digital source input", "get_current_freq", "freq"),
DISPLAY_REFRESH("Display Refresh", RotelConnector.PRIMARY_CMD, (byte) 0xFF),
DIMMER_LEVEL_GET("Request current front display dimmer level", "get_current_dimmer", "dimmer"),
DIMMER_LEVEL_SET("Set front display dimmer to level", "dimmer_", "dimmer_"),
UPDATE_AUTO("Set Update to Auto", "display_update_auto", "rs232_update_on"),
UPDATE_MANUAL("Set Update to Manual", "display_update_manual", "rs232_update_off");
public static final byte PRIMARY_COMMAND = (byte) 0x10;
private String name;
private byte hexType;
private byte hexKey;
private @Nullable String asciiCommandV1;
private @Nullable String asciiCommandV2;
/**
* Constructor when the textual commands are undefined
*
* @param name the command name
* @param hexType the the command type (HEX protocol)
* @param hexKey the the command key (HEX protocol)
*/
private RotelCommand(String name, byte hexType, byte hexKey) {
this(name, hexType, hexKey, null, null);
}
/**
* Constructor when the HEX command is undefined
*
* @param name the command name
* @param asciiCommandV1 the textual command (ASCII protocol V1)
* @param asciiCommandV2 the textual command (ASCII protocol V2)
*/
private RotelCommand(String name, @Nullable String asciiCommandV1, @Nullable String asciiCommandV2) {
this(name, (byte) 0, (byte) 0, asciiCommandV1, asciiCommandV2);
}
/**
* Constructor
*
* @param name the command name
* @param hexType the the command type (HEX protocol)
* @param hexKey the the command key (HEX protocol)
* @param asciiCommandV1 the textual command (ASCII protocol V1)
* @param asciiCommandV2 the textual command (ASCII protocol V2)
*/
private RotelCommand(String name, byte hexType, byte hexKey, @Nullable String asciiCommandV1,
@Nullable String asciiCommandV2) {
this.name = name;
this.hexType = hexType;
this.hexKey = hexKey;
this.asciiCommandV1 = asciiCommandV1;
this.asciiCommandV2 = asciiCommandV2;
}
/**
* Get the command name
*
* @return the command name
*/
public String getName() {
return name;
}
/**
* Get the command type (HEX protocol)
*
* @return the command type
*/
public byte getHexType() {
return hexType;
}
/**
* Get the command key (HEX protocol)
*
* @return the command key
*/
public byte getHexKey() {
return hexKey;
}
/**
* Get the textual command (ASCII protocol V1)
*
* @return the textual command
*/
public @Nullable String getAsciiCommandV1() {
return asciiCommandV1;
}
/**
* Get the textual command (ASCII protocol V2)
*
* @return the textual command
*/
public @Nullable String getAsciiCommandV2() {
return asciiCommandV2;
}
/**
* Get the command associated to a textual command
*
* @param text the textual command used to identify the command
*
* @return the command associated to the searched textual command
*
* @throws RotelException - If no command is associated to the searched textual command
*/
public static RotelCommand getFromAsciiCommandV2(String text) throws RotelException {
for (RotelCommand value : RotelCommand.values()) {
if (text.equals(value.getAsciiCommandV2())) {
return value;
}
}
throw new RotelException("Invalid textual command: " + text);
}
}

View File

@@ -0,0 +1,255 @@
/**
* Copyright (c) 2010-2020 Contributors to the openHAB project
*
* See the NOTICE file(s) distributed with this work for additional
* information.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License 2.0 which is available at
* http://www.eclipse.org/legal/epl-2.0
*
* SPDX-License-Identifier: EPL-2.0
*/
package org.openhab.binding.rotel.internal.communication;
import java.util.ArrayList;
import java.util.List;
import org.eclipse.jdt.annotation.NonNullByDefault;
import org.openhab.binding.rotel.internal.RotelException;
import org.openhab.core.types.StateOption;
/**
* Represents the different DSP modes available for the Rotel equipments
*
* @author Laurent Garnier - Initial contribution
*/
@NonNullByDefault
public enum RotelDsp {
CAT1_NONE(1, "NONE", "No DSP", RotelCommand.STEREO, "stereo"),
CAT1_STEREO3(1, "STEREO3", "Dolby 3 Stereo", RotelCommand.STEREO3, "dolby_3_stereo"),
CAT1_STEREO5(1, "STEREO5", "5 Channel Stereo", RotelCommand.STEREO5, "5_channel_stereo"),
CAT1_STEREO7(1, "STEREO7", "7 Channel Stereo", RotelCommand.STEREO7, "7_channel_stereo"),
CAT1_MUSIC1(1, "MUSIC1", "Music 1", RotelCommand.DSP1, "dsp1"),
CAT1_MUSIC2(1, "MUSIC2", "Music 2", RotelCommand.DSP2, "dsp2"),
CAT1_MUSIC3(1, "MUSIC3", "Music 3", RotelCommand.DSP3, "dsp3"),
CAT1_MUSIC4(1, "MUSIC4", "Music 4", RotelCommand.DSP4, "dsp4"),
CAT1_PROLOGIC(1, "PROLOGIC", "Dolby Pro Logic", RotelCommand.PROLOGIC, "dolby_prologic"),
CAT1_PLII_CINEMA(1, "PLIICINEMA", "Dolby PLII Cinema", RotelCommand.PLII_CINEMA, "dolby_plii_movie"),
CAT1_PLII_MUSIC(1, "PLIIMUSIC", "Dolby PLII Music", RotelCommand.PLII_MUSIC, "dolby_plii_music"),
CAT1_NEO6_CINEMA(1, "NEO6CINEMA", "dts Neo:6 Cinema", RotelCommand.NEO6_CINEMA, "dts_neo:6_cinema"),
CAT1_NEO6_MUSIC(1, "NEO6MUSIC", "dts Neo:6 Music", RotelCommand.NEO6_MUSIC, "dts_neo:6_music"),
CAT2_NONE(2, "NONE", "No DSP", RotelCommand.STEREO, "stereo"),
CAT2_STEREO3(2, "STEREO3", "Dolby 3 Stereo", RotelCommand.STEREO3, "dolby_3_stereo"),
CAT2_STEREO5(2, "STEREO5", "5 Channel Stereo", RotelCommand.STEREO5, "5_channel_stereo"),
CAT2_STEREO7(2, "STEREO7", "7 Channel Stereo", RotelCommand.STEREO7, "7_channel_stereo"),
CAT2_MUSIC1(2, "MUSIC1", "Music 1", RotelCommand.DSP1, "dsp1"),
CAT2_MUSIC2(2, "MUSIC2", "Music 2", RotelCommand.DSP2, "dsp2"),
CAT2_MUSIC3(2, "MUSIC3", "Music 3", RotelCommand.DSP3, "dsp3"),
CAT2_MUSIC4(2, "MUSIC4", "Music 4", RotelCommand.DSP4, "dsp4"),
CAT2_PROLOGIC(2, "PROLOGIC", "Dolby Pro Logic", RotelCommand.PROLOGIC, "dolby_prologic"),
CAT2_PLII_CINEMA(2, "PLIICINEMA", "Dolby PLII Cinema", RotelCommand.PLII_CINEMA, "dolby_plii_movie"),
CAT2_PLII_MUSIC(2, "PLIIMUSIC", "Dolby PLII Music", RotelCommand.PLII_MUSIC, "dolby_plii_music"),
CAT2_PLII_GAME(2, "PLIIGAME", "Dolby PLII Game", RotelCommand.PLII_GAME, "dolby_plii_game"),
CAT2_NEO6_CINEMA(2, "NEO6CINEMA", "dts Neo:6 Cinema", RotelCommand.NEO6_CINEMA, "dts_neo:6_cinema"),
CAT2_NEO6_MUSIC(2, "NEO6MUSIC", "dts Neo:6 Music", RotelCommand.NEO6_MUSIC, "dts_neo:6_music"),
CAT3_BYPASS(3, "BYPASS", "Analog Bypass", RotelCommand.BYPASS, "analog_bypass"),
CAT3_NONE(3, "NONE", "No DSP", RotelCommand.STEREO, "stereo"),
CAT3_STEREO3(3, "STEREO3", "Dolby 3 Stereo", RotelCommand.STEREO3, "dolby_3_stereo"),
CAT3_STEREO5(3, "STEREO5", "5 Channel Stereo", RotelCommand.STEREO5, "5_channel_stereo"),
CAT3_STEREO7(3, "STEREO7", "7 Channel Stereo", RotelCommand.STEREO7, "7_channel_stereo"),
CAT3_DSP1(3, "DSP1", "DSP 1", RotelCommand.DSP1, "dsp1"),
CAT3_DSP2(3, "DSP2", "DSP 2", RotelCommand.DSP2, "dsp2"),
CAT3_DSP3(3, "DSP3", "DSP 3", RotelCommand.DSP3, "dsp3"),
CAT3_DSP4(3, "DSP4", "DSP 4", RotelCommand.DSP4, "dsp4"),
CAT3_PROLOGIC(3, "PROLOGIC", "Dolby Pro Logic", RotelCommand.PROLOGIC, "dolby_prologic"),
CAT3_PLII_CINEMA(3, "PLIICINEMA", "Dolby PLII/PLIIx Cinema", RotelCommand.PLII_CINEMA, "dolby_plii_movie"),
CAT3_PLII_MUSIC(3, "PLIIMUSIC", "Dolby PLII/PLIIx Music", RotelCommand.PLII_MUSIC, "dolby_plii_music"),
CAT3_PLII_GAME(3, "PLIIGAME", "Dolby PLII/PLIIx Game", RotelCommand.PLII_GAME, "dolby_plii_game"),
CAT3_NEO6_CINEMA(3, "NEO6CINEMA", "dts Neo:6 Cinema", RotelCommand.NEO6_CINEMA, "dts_neo:6_cinema"),
CAT3_NEO6_MUSIC(3, "NEO6MUSIC", "dts Neo:6 Music", RotelCommand.NEO6_MUSIC, "dts_neo:6_music"),
CAT4_BYPASS(4, "BYPASS", "Analog Bypass", RotelCommand.BYPASS, "analog_bypass"),
CAT4_NONE(4, "NONE", "No DSP", RotelCommand.STEREO, "stereo"),
CAT4_STEREO3(4, "STEREO3", "Dolby 3 Stereo", RotelCommand.STEREO3, "dolby_3_stereo"),
CAT4_STEREO5(4, "STEREO5", "5 Channel Stereo", RotelCommand.STEREO5, "5_channel_stereo"),
CAT4_STEREO7(4, "STEREO7", "7 Channel Stereo", RotelCommand.STEREO7, "7_channel_stereo"),
CAT4_DSP1(4, "DSP1", "DSP 1", RotelCommand.DSP1, "dsp1"),
CAT4_DSP2(4, "DSP2", "DSP 2", RotelCommand.DSP2, "dsp2"),
CAT4_DSP3(4, "DSP3", "DSP 3", RotelCommand.DSP3, "dsp3"),
CAT4_DSP4(4, "DSP4", "DSP 4", RotelCommand.DSP4, "dsp4"),
CAT4_PROLOGIC(4, "PROLOGIC", "Dolby Pro Logic", RotelCommand.PROLOGIC, "dolby_prologic"),
CAT4_PLII_CINEMA(4, "PLIICINEMA", "Dolby PLII/PLIIx Cinema", RotelCommand.PLII_CINEMA, "dolby_plii_movie"),
CAT4_PLII_MUSIC(4, "PLIIMUSIC", "Dolby PLII/PLIIx Music", RotelCommand.PLII_MUSIC, "dolby_plii_music"),
CAT4_PLII_GAME(4, "PLIIGAME", "Dolby PLII/PLIIx Game", RotelCommand.PLII_GAME, "dolby_plii_game"),
CAT4_PLIIZ(4, "PLIIZ", "Dolby PLIIz", RotelCommand.PLIIZ, "dolby_pliiz"),
CAT4_NEO6_CINEMA(4, "NEO6CINEMA", "dts Neo:6 Cinema", RotelCommand.NEO6_CINEMA, "dts_neo:6_cinema"),
CAT4_NEO6_MUSIC(4, "NEO6MUSIC", "dts Neo:6 Music", RotelCommand.NEO6_MUSIC, "dts_neo:6_music"),
CAT5_BYPASS(5, "BYPASS", "Analog Bypass", RotelCommand.BYPASS, "analog_bypass"),
CAT5_NONE(5, "NONE", "No DSP", RotelCommand.STEREO, "stereo"),
CAT5_STEREO3(5, "STEREO3", "Dolby 3 Stereo", RotelCommand.STEREO3, "dolby_3_stereo"),
CAT5_STEREO5(5, "STEREO5", "5 Channel Stereo", RotelCommand.STEREO5, "5_channel_stereo"),
CAT5_STEREO7(5, "STEREO7", "7 Channel Stereo", RotelCommand.STEREO7, "7_channel_stereo"),
CAT5_STEREO9(5, "STEREO9", "9 Channel Stereo", RotelCommand.STEREO9, "9_channel_stereo"),
CAT5_STEREO11(5, "STEREO11", "11 Channel Stereo", RotelCommand.STEREO11, "11_channel_stereo"),
CAT5_ATMOS(5, "ATMOS", "Dolby Atmos", RotelCommand.ATMOS, "dolby atmos surround"),
CAT5_NEURAL_X(5, "NEURALX", "dts Neural:X", RotelCommand.NEURAL_X, "dts neural:x"),
CAT6_BYPASS(6, "BYPASS", "Analog Bypass", RotelCommand.BYPASS, "analog_bypass"),
CAT6_NONE(6, "NONE", "No DSP", RotelCommand.STEREO, "stereo"),
CAT6_STEREO3(6, "STEREO3", "Dolby 3 Stereo", RotelCommand.STEREO3, "dolby_3_stereo"),
CAT6_STEREO5(6, "STEREO5", "5 Channel Stereo", RotelCommand.STEREO5, "5_channel_stereo"),
CAT6_STEREO7(6, "STEREO7", "7 Channel Stereo", RotelCommand.STEREO7, "7_channel_stereo"),
CAT6_PLII_CINEMA(6, "PLIICINEMA", "Dolby PLII/PLIIx Cinema", RotelCommand.PLII_CINEMA, "dolby_plii_movie"),
CAT6_PLII_MUSIC(6, "PLIIMUSIC", "Dolby PLII/PLIIx Music", RotelCommand.PLII_MUSIC, "dolby_plii_music"),
CAT6_PLII_GAME(6, "PLIIGAME", "Dolby PLII/PLIIx Game", RotelCommand.PLII_GAME, "dolby_plii_game"),
CAT6_PLIIZ(6, "PLIIZ", "Dolby PLIIz", RotelCommand.PLIIZ, "dolby_pliiz"),
CAT6_NEO6_CINEMA(6, "NEO6CINEMA", "dts Neo:6 Cinema", RotelCommand.NEO6_CINEMA, "dts_neo:6_cinema"),
CAT6_NEO6_MUSIC(6, "NEO6MUSIC", "dts Neo:6 Music", RotelCommand.NEO6_MUSIC, "dts_neo:6_music");
private int category;
private String name;
private String label;
private RotelCommand command;
private String feedback;
/**
* Constructor
*
* @param category a category of models for which the DSP mode is available
* @param name the name of the DSP mode
* @param label the label of the DSP mode
* @param command the command to select the DSP mode
* @param feedback the feedback message identifying the DSP mode
*/
private RotelDsp(int category, String name, String label, RotelCommand command, String feedback) {
this.category = category;
this.name = name;
this.label = label;
this.command = command;
this.feedback = feedback;
}
/**
* Get the category of models for the current DSP mode
*
* @return the category of models
*/
public int getCategory() {
return category;
}
/**
* Get the name of the current DSP mode
*
* @return the name
*/
public String getName() {
return name;
}
/**
* Get the label of the current DSP mode
*
* @return the label
*/
public String getLabel() {
return label;
}
/**
* Get the command to select the current DSP mode
*
* @return the command
*/
public RotelCommand getCommand() {
return command;
}
/**
* Get the feedback message identifying the current DSP mode
*
* @return the feedback message
*/
public String getFeedback() {
return feedback;
}
/**
* Get the list of {@link StateOption} associated to the available DSP modes for a particular category of models
*
* @param category a category of models
*
* @return the list of {@link StateOption} associated to the available DSP modes for a provided category of models
*/
public static List<StateOption> getStateOptions(int category) {
List<StateOption> options = new ArrayList<>();
for (RotelDsp value : RotelDsp.values()) {
if (value.getCategory() == category) {
options.add(new StateOption(value.getName(), value.getLabel()));
}
}
return options;
}
/**
* Get the DSP mode associated to a name for a particular category of models
*
* @param category a category of models
* @param name the name used to identify the DSP mode
*
* @return the DSP mode associated to the searched name for the provided category of models
*
* @throws RotelException - If no DSP mode is associated to the searched name for the provided category
*/
public static RotelDsp getFromName(int category, String name) throws RotelException {
for (RotelDsp value : RotelDsp.values()) {
if (value.getCategory() == category && value.getName().equals(name)) {
return value;
}
}
throw new RotelException("Invalid name for a DSP mode: " + name);
}
/**
* Get the DSP mode identified by a feedback message for a particular category of models
*
* @param category a category of models
* @param feedback the feedback message used to identify the DSP mode
*
* @return the DSP mode associated to the searched feedback message for the provided category of models
*
* @throws RotelException - If no DSP mode is associated to the searched feedback message for the provided category
*/
public static RotelDsp getFromFeedback(int category, String feedback) throws RotelException {
for (RotelDsp value : RotelDsp.values()) {
if (value.getCategory() == category && value.getFeedback().equals(feedback)) {
return value;
}
}
throw new RotelException("Invalid feedback for a DSP mode: " + feedback);
}
/**
* Get the DSP mode associated to a command for a particular category of models
*
* @param category a category of models
* @param command the command used to identify the DSP mode
*
* @return the DSP mode associated to the searched command for the provided category of models
*
* @throws RotelException - If no DSP mode is associated to the searched command for the provided category
*/
public static RotelDsp getFromCommand(int category, RotelCommand command) throws RotelException {
for (RotelDsp value : RotelDsp.values()) {
if (value.getCategory() == category && value.getCommand() == command) {
return value;
}
}
throw new RotelException("Invalid command for a DSP mode: " + command.getName());
}
}

View File

@@ -0,0 +1,259 @@
/**
* Copyright (c) 2010-2020 Contributors to the openHAB project
*
* See the NOTICE file(s) distributed with this work for additional
* information.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License 2.0 which is available at
* http://www.eclipse.org/legal/epl-2.0
*
* SPDX-License-Identifier: EPL-2.0
*/
package org.openhab.binding.rotel.internal.communication;
import org.eclipse.jdt.annotation.NonNullByDefault;
import org.openhab.binding.rotel.internal.RotelException;
/**
* Class managing the mapping of message flags with indicators
*
* @author Laurent Garnier - Initial contribution
*/
@NonNullByDefault
public class RotelFlagsMapping {
public static final RotelFlagsMapping MAPPING1 = new RotelFlagsMapping(3, 1, 5, 0, -1, -1, -1, -1, 8, 6, 8, 4, 8,
3);
public static final RotelFlagsMapping MAPPING2 = new RotelFlagsMapping(-1, -1, 4, 7, -1, -1, -1, -1, 5, 6, 5, 4, 5,
3);
public static final RotelFlagsMapping MAPPING3 = new RotelFlagsMapping(4, 7, 1, 7, 2, 7, 6, 2, 5, 6, 5, 4, 5, 3);
public static final RotelFlagsMapping MAPPING4 = new RotelFlagsMapping(3, 1, 1, 7, 2, 7, 6, 2, 8, 6, 8, 4, 8, 3);
public static final RotelFlagsMapping MAPPING5 = new RotelFlagsMapping(-1, -1, 3, 2, 4, 2, 4, 1, 5, 6, 5, 4, 5, 3);
public static final RotelFlagsMapping NO_MAPPING = new RotelFlagsMapping(-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1);
private int multiInputFlagNumber;
private int multiInputBitNumber;
private int zone2FlagNumber;
private int zone2BitNumber;
private int zone3FlagNumber;
private int zone3BitNumber;
private int zone4FlagNumber;
private int zone4BitNumber;
private int centerFlagNumber;
private int centerBitNumber;
private int surroundLeftFlagNumber;
private int surroundLeftBitNumber;
private int surroundRightFlagNumber;
private int surroundRightBitNumber;
/**
* Constructor
*
* For each flag number, value 1 means the first flag; a negative value is used for an undefined indicator.
* For each bit number, value is from 0 to 7; a negative value is used for an undefined indicator.
*
* @param multiInputFlagNumber the flag number in the standard feedback message in which to find the multi input
* indicator
* @param multiInputBitNumber the bit number in the flag in which to find the multi input indicator
* @param zone2FlagNumber the flag number in the standard feedback message in which to find the zone 2 indicator
* @param zone2BitNumber the bit number in the flag in which to find the zone 2 indicator
* @param zone3FlagNumber the flag number in the standard feedback message in which to find the zone 3 indicator
* @param zone3BitNumber the bit number in the flag in which to find the zone 3 indicator
* @param zone4FlagNumber the flag number in the standard feedback message in which to find the zone 4 indicator
* @param zone4BitNumber the bit number in the flag in which to find the zone 4 indicator
* @param centerFlagNumber the flag number in the standard feedback message in which to find the center channel
* indicator
* @param centerBitNumber the bit number in the flag in which to find the center channel indicator
* @param surroundLeftFlagNumber the flag number in the standard feedback message in which to find the surround left
* channel indicator
* @param surroundLeftBitNumber the bit number in the flag in which to find the surround left channel indicator
* @param surroundRightFlagNumber the flag number in the standard feedback message in which to find the surround
* right channel indicator
* @param surroundRightBitNumber the bit number in the flag in which to find the surround right channel indicator
*/
private RotelFlagsMapping(int multiInputFlagNumber, int multiInputBitNumber, int zone2FlagNumber,
int zone2BitNumber, int zone3FlagNumber, int zone3BitNumber, int zone4FlagNumber, int zone4BitNumber,
int centerFlagNumber, int centerBitNumber, int surroundLeftFlagNumber, int surroundLeftBitNumber,
int surroundRightFlagNumber, int surroundRightBitNumber) {
this.multiInputFlagNumber = multiInputFlagNumber;
this.multiInputBitNumber = multiInputBitNumber;
this.zone2FlagNumber = zone2FlagNumber;
this.zone2BitNumber = zone2BitNumber;
this.zone3FlagNumber = zone3FlagNumber;
this.zone3BitNumber = zone3BitNumber;
this.zone4FlagNumber = zone4FlagNumber;
this.zone4BitNumber = zone4BitNumber;
this.centerFlagNumber = centerFlagNumber;
this.centerBitNumber = centerBitNumber;
this.surroundLeftFlagNumber = surroundLeftFlagNumber;
this.surroundLeftBitNumber = surroundLeftBitNumber;
this.surroundRightFlagNumber = surroundRightFlagNumber;
this.surroundRightBitNumber = surroundRightBitNumber;
}
/**
* Get the multi input indicator
*
* @param flags the table of flags
*
* @return true if the indicator is ON in the flags or false if OFF
*
* @throws RotelException in case the multi input indicator is undefined
*/
public boolean isMultiInputOn(byte[] flags) throws RotelException {
return RotelFlagsMapping.isBitFlagOn(flags, multiInputFlagNumber, multiInputBitNumber);
}
/**
* Set the multi input indicator
*
* @param flags the table of flags
* @param on true to set the indicator to ON or false to set it to OFF
*
* @throws RotelException in case the multi input indicator is undefined
*/
public void setMultiInput(byte[] flags, boolean on) throws RotelException {
RotelFlagsMapping.setBitFlag(flags, multiInputFlagNumber, multiInputBitNumber, on);
}
/**
* Get the zone 2 indicator
*
* @param flags the table of flags
*
* @return true if the indicator is ON in the flags or false if OFF
*
* @throws RotelException in case the zone 2 indicator is undefined
*/
public boolean isZone2On(byte[] flags) throws RotelException {
return RotelFlagsMapping.isBitFlagOn(flags, zone2FlagNumber, zone2BitNumber);
}
/**
* Set the zone 2 indicator
*
* @param flags the table of flags
* @param on true to set the indicator to ON or false to set it to OFF
*
* @throws RotelException in case the zone 2 indicator is undefined
*/
public void setZone2(byte[] flags, boolean on) throws RotelException {
RotelFlagsMapping.setBitFlag(flags, zone2FlagNumber, zone2BitNumber, on);
}
/**
* Get the zone 3 indicator
*
* @param flags the table of flags
*
* @return true if the indicator is ON in the flags or false if OFF
*
* @throws RotelException in case the zone 3 indicator is undefined
*/
public boolean isZone3On(byte[] flags) throws RotelException {
return RotelFlagsMapping.isBitFlagOn(flags, zone3FlagNumber, zone3BitNumber);
}
/**
* Set the zone 3 indicator
*
* @param flags the table of flags
* @param on true to set the indicator to ON or false to set it to OFF
*
* @throws RotelException in case the zone 3 indicator is undefined
*/
public void setZone3(byte[] flags, boolean on) throws RotelException {
RotelFlagsMapping.setBitFlag(flags, zone3FlagNumber, zone3BitNumber, on);
}
/**
* Get the zone 4 indicator
*
* @param flags the table of flags
*
* @return true if the indicator is ON in the flags or false if OFF
*
* @throws RotelException in case the zone 4 indicator is undefined
*/
public boolean isZone4On(byte[] flags) throws RotelException {
return RotelFlagsMapping.isBitFlagOn(flags, zone4FlagNumber, zone4BitNumber);
}
/**
* Set the zone 4 indicator
*
* @param flags the table of flags
* @param on true to set the indicator to ON or false to set it to OFF
*
* @throws RotelException in case the zone 4 indicator is undefined
*/
public void setZone4(byte[] flags, boolean on) throws RotelException {
RotelFlagsMapping.setBitFlag(flags, zone4FlagNumber, zone4BitNumber, on);
}
/**
* Check whether more than front channels are ON
*
* @param flags the table of flags
*
* @return true if the indicators show that center or surround channels are ON in the flags
*
* @throws RotelException in case the center or surround channel indicators are undefined
*/
public boolean isMoreThan2Channels(byte[] flags) throws RotelException {
return (centerFlagNumber >= 1 && centerFlagNumber <= flags.length
&& RotelFlagsMapping.isBitFlagOn(flags, centerFlagNumber, centerBitNumber))
|| (surroundLeftFlagNumber >= 1 && surroundLeftFlagNumber <= flags.length
&& RotelFlagsMapping.isBitFlagOn(flags, surroundLeftFlagNumber, surroundLeftBitNumber))
|| (surroundRightFlagNumber >= 1 && surroundRightFlagNumber <= flags.length
&& RotelFlagsMapping.isBitFlagOn(flags, surroundRightFlagNumber, surroundRightBitNumber));
}
/**
* Get a bit value inside the provided table of flags
*
* @param flags the table of flags
* @param flagNumber the flag number to consider
* @param bitNumber the bit number in the flag to consider
*
* @return true if the bit value in the flag is 1 or false if 0
*
* @throws RotelException in case of out of bounds value for the flag number or the bit number
*/
public static boolean isBitFlagOn(byte[] flags, int flagNumber, int bitNumber) throws RotelException {
if (flagNumber < 1 || flagNumber > flags.length) {
throw new RotelException("Flag number out of bounds");
}
if (bitNumber < 0 || bitNumber > 7) {
throw new RotelException("Bit number out of bounds");
}
int val = flags[flagNumber - 1] & 0x000000FF;
return (val & (1 << bitNumber)) != 0;
}
/**
* Set a bit value to 1 or 0 in the provided table of flags
*
* @param flags the table of flags
* @param flagNumber the flag number to consider
* @param bitNumber the bit number in the flag to consider
* @param on true to set the bit value to 1 or false to set it to 0
*
* @throws RotelException in case of out of bounds value for the flag number or the bit number
*/
private static void setBitFlag(byte[] flags, int flagNumber, int bitNumber, boolean on) throws RotelException {
if (flagNumber < 1 || flagNumber > flags.length) {
throw new RotelException("Flag number out of bounds");
}
if (bitNumber < 0 || bitNumber > 7) {
throw new RotelException("Bit number out of bounds");
}
if (on) {
flags[flagNumber - 1] |= (1 << bitNumber);
} else {
flags[flagNumber - 1] &= ~(1 << bitNumber);
}
}
}

View File

@@ -0,0 +1,135 @@
/**
* Copyright (c) 2010-2020 Contributors to the openHAB project
*
* See the NOTICE file(s) distributed with this work for additional
* information.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License 2.0 which is available at
* http://www.eclipse.org/legal/epl-2.0
*
* SPDX-License-Identifier: EPL-2.0
*/
package org.openhab.binding.rotel.internal.communication;
import java.io.DataInputStream;
import java.io.DataOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.InterruptedIOException;
import java.net.Socket;
import java.net.SocketTimeoutException;
import java.util.Map;
import org.eclipse.jdt.annotation.NonNullByDefault;
import org.eclipse.jdt.annotation.Nullable;
import org.openhab.binding.rotel.internal.RotelException;
import org.openhab.binding.rotel.internal.RotelModel;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
* Class for communicating with the Rotel device through a IP connection or a serial over IP connection
*
* @author Laurent Garnier - Initial contribution
*/
@NonNullByDefault
public class RotelIpConnector extends RotelConnector {
private final Logger logger = LoggerFactory.getLogger(RotelIpConnector.class);
private String address;
private int port;
private @Nullable Socket clientSocket;
/**
* Constructor
*
* @param address the IP address of the projector
* @param port the TCP port to be used
* @param model the projector model in use
* @param protocol the protocol to be used
* @param readerThreadName the name of thread to be created
*/
public RotelIpConnector(String address, Integer port, RotelModel model, RotelProtocol protocol,
Map<RotelSource, String> sourcesLabels, String readerThreadName) {
super(model, protocol, sourcesLabels, false, readerThreadName);
this.address = address;
this.port = port;
}
@Override
public synchronized void open() throws RotelException {
logger.debug("Opening IP connection on IP {} port {}", this.address, this.port);
try {
Socket clientSocket = new Socket(this.address, this.port);
clientSocket.setSoTimeout(100);
dataOut = new DataOutputStream(clientSocket.getOutputStream());
dataIn = new DataInputStream(clientSocket.getInputStream());
Thread thread = new RotelReaderThread(this, readerThreadName);
setReaderThread(thread);
thread.start();
this.clientSocket = clientSocket;
setConnected(true);
logger.debug("IP connection opened");
} catch (IOException | SecurityException | IllegalArgumentException e) {
setConnected(false);
logger.debug("Opening IP connection failed: {}", e.getMessage());
throw new RotelException("Opening IP connection failed: " + e.getMessage());
}
}
@Override
public synchronized void close() {
logger.debug("Closing IP connection");
super.cleanup();
Socket clientSocket = this.clientSocket;
if (clientSocket != null) {
try {
clientSocket.close();
} catch (IOException e) {
}
this.clientSocket = null;
}
setConnected(false);
logger.debug("IP connection closed");
}
/**
* Reads some number of bytes from the input stream and stores them into the buffer array b. The number of bytes
* actually read is returned as an integer.
* In case of socket timeout, the returned value is 0.
*
* @param dataBuffer the buffer into which the data is read.
*
* @return the total number of bytes read into the buffer, or -1 if there is no more data because the end of the
* stream has been reached.
*
* @throws RotelException - If the input stream is null, if the first byte cannot be read for any reason
* other than the end of the file, if the input stream has been closed, or if some other I/O error
* occurs.
* @throws InterruptedIOException - if the thread was interrupted during the reading of the input stream
*/
@Override
protected int readInput(byte[] dataBuffer) throws RotelException, InterruptedIOException {
InputStream dataIn = this.dataIn;
if (dataIn == null) {
throw new RotelException("readInput failed: input stream is null");
}
try {
return dataIn.read(dataBuffer);
} catch (SocketTimeoutException e) {
return 0;
} catch (IOException e) {
logger.debug("readInput failed: {}", e.getMessage());
throw new RotelException("readInput failed: " + e.getMessage());
}
}
}

View File

@@ -0,0 +1,44 @@
/**
* Copyright (c) 2010-2020 Contributors to the openHAB project
*
* See the NOTICE file(s) distributed with this work for additional
* information.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License 2.0 which is available at
* http://www.eclipse.org/legal/epl-2.0
*
* SPDX-License-Identifier: EPL-2.0
*/
package org.openhab.binding.rotel.internal.communication;
import java.util.EventObject;
import org.eclipse.jdt.annotation.NonNullByDefault;
/**
* Rotel event used to notify changes coming from messages received from the Rotel device
*
* @author Laurent Garnier - Initial contribution
*/
@NonNullByDefault
public class RotelMessageEvent extends EventObject {
private static final long serialVersionUID = 1L;
private String key;
private String value;
public RotelMessageEvent(Object source, String key, String value) {
super(source);
this.key = key;
this.value = value;
}
public String getKey() {
return key;
}
public String getValue() {
return value;
}
}

View File

@@ -0,0 +1,34 @@
/**
* Copyright (c) 2010-2020 Contributors to the openHAB project
*
* See the NOTICE file(s) distributed with this work for additional
* information.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License 2.0 which is available at
* http://www.eclipse.org/legal/epl-2.0
*
* SPDX-License-Identifier: EPL-2.0
*/
package org.openhab.binding.rotel.internal.communication;
import java.util.EventListener;
import java.util.EventObject;
import org.eclipse.jdt.annotation.NonNullByDefault;
/**
* Rotel Event Listener interface. Handles incoming Rotel message events
*
* @author Laurent Garnier - Initial contribution
*/
@NonNullByDefault
public interface RotelMessageEventListener extends EventListener {
/**
* Event handler method for incoming Rotel message events
*
* @param event the event object
*/
public void onNewMessageEvent(EventObject event);
}

View File

@@ -0,0 +1,67 @@
/**
* Copyright (c) 2010-2020 Contributors to the openHAB project
*
* See the NOTICE file(s) distributed with this work for additional
* information.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License 2.0 which is available at
* http://www.eclipse.org/legal/epl-2.0
*
* SPDX-License-Identifier: EPL-2.0
*/
package org.openhab.binding.rotel.internal.communication;
import org.eclipse.jdt.annotation.NonNullByDefault;
import org.openhab.binding.rotel.internal.RotelException;
/**
* Represents the different kinds of protocols
*
* @author Laurent Garnier - Initial contribution
*/
@NonNullByDefault
public enum RotelProtocol {
HEX("HEX"),
ASCII_V1("ASCII_V1"),
ASCII_V2("ASCII_V2");
private String name;
/**
* Constructor
*
* @param name the protocol name
*/
private RotelProtocol(String name) {
this.name = name;
}
/**
* Get the protocol name
*
* @return the protocol name
*/
public String getName() {
return name;
}
/**
* Get the protocol associated to a name
*
* @param name the name used to identify the protocol
*
* @return the protocol associated to the searched name
*
* @throws RotelException - If no protocol is associated to the searched name
*/
public static RotelProtocol getFromName(String name) throws RotelException {
for (RotelProtocol value : RotelProtocol.values()) {
if (value.getName().equals(name)) {
return value;
}
}
throw new RotelException("Invalid protocol name: " + name);
}
}

View File

@@ -0,0 +1,116 @@
/**
* Copyright (c) 2010-2020 Contributors to the openHAB project
*
* See the NOTICE file(s) distributed with this work for additional
* information.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License 2.0 which is available at
* http://www.eclipse.org/legal/epl-2.0
*
* SPDX-License-Identifier: EPL-2.0
*/
package org.openhab.binding.rotel.internal.communication;
import java.io.InterruptedIOException;
import java.util.Arrays;
import org.eclipse.jdt.annotation.NonNullByDefault;
import org.openhab.binding.rotel.internal.RotelException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
* A class that reads messages from the Rotel device in a dedicated thread
*
* @author Laurent Garnier - Initial contribution
*/
@NonNullByDefault
public class RotelReaderThread extends Thread {
private final Logger logger = LoggerFactory.getLogger(RotelReaderThread.class);
private static final int READ_BUFFER_SIZE = 16;
private RotelConnector connector;
/**
* Constructor
*
* @param connector the object that should handle the received message
* @param threadName the name of the thread
*/
public RotelReaderThread(RotelConnector connector, String threadName) {
super(threadName);
this.connector = connector;
}
@Override
public void run() {
logger.debug("Data listener started");
RotelProtocol protocol = connector.getProtocol();
final int size = (protocol == RotelProtocol.HEX)
? (6 + connector.getModel().getRespNbChars() + connector.getModel().getRespNbFlags())
: 64;
byte[] readDataBuffer = new byte[READ_BUFFER_SIZE];
byte[] dataBuffer = new byte[size];
boolean startCodeReached = false;
int count = 0;
int index = 0;
final char terminatingChar = (protocol == RotelProtocol.ASCII_V1) ? '!' : '$';
try {
while (!Thread.interrupted()) {
int len = connector.readInput(readDataBuffer);
if (len > 0) {
for (int i = 0; i < len; i++) {
if (protocol == RotelProtocol.HEX) {
if (readDataBuffer[i] == RotelConnector.START) {
startCodeReached = true;
count = 0;
index = 0;
}
if (startCodeReached) {
if (index < size) {
dataBuffer[index++] = readDataBuffer[i];
}
if (index == 2) {
count = readDataBuffer[i];
} else if ((count > 0) && (index == (count + 3))) {
if ((readDataBuffer[i] & 0x000000FF) == 0x000000FD) {
count++;
} else {
byte[] msg = Arrays.copyOf(dataBuffer, index);
connector.handleIncomingMessage(msg);
startCodeReached = false;
}
}
}
} else {
if (index < size) {
dataBuffer[index++] = readDataBuffer[i];
}
if (readDataBuffer[i] == terminatingChar) {
if (index >= size) {
dataBuffer[index - 1] = (byte) terminatingChar;
}
byte[] msg = Arrays.copyOf(dataBuffer, index);
connector.handleIncomingMessage(msg);
index = 0;
}
}
}
}
}
} catch (InterruptedIOException e) {
Thread.currentThread().interrupt();
logger.debug("Interrupted via InterruptedIOException");
} catch (RotelException e) {
logger.debug("Reading failed: {}", e.getMessage(), e);
connector.handleIncomingMessage(RotelConnector.READ_ERROR);
}
logger.debug("Data listener stopped");
}
}

View File

@@ -0,0 +1,143 @@
/**
* Copyright (c) 2010-2020 Contributors to the openHAB project
*
* See the NOTICE file(s) distributed with this work for additional
* information.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License 2.0 which is available at
* http://www.eclipse.org/legal/epl-2.0
*
* SPDX-License-Identifier: EPL-2.0
*/
package org.openhab.binding.rotel.internal.communication;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.UnsupportedEncodingException;
import java.util.Map;
import org.eclipse.jdt.annotation.NonNullByDefault;
import org.eclipse.jdt.annotation.Nullable;
import org.openhab.binding.rotel.internal.RotelException;
import org.openhab.binding.rotel.internal.RotelModel;
import org.openhab.core.io.transport.serial.PortInUseException;
import org.openhab.core.io.transport.serial.SerialPort;
import org.openhab.core.io.transport.serial.SerialPortIdentifier;
import org.openhab.core.io.transport.serial.SerialPortManager;
import org.openhab.core.io.transport.serial.UnsupportedCommOperationException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
* Class for communicating with the Rotel device through a serial connection
*
* @author Laurent Garnier - Initial contribution
*/
@NonNullByDefault
public class RotelSerialConnector extends RotelConnector {
private final Logger logger = LoggerFactory.getLogger(RotelSerialConnector.class);
private String serialPortName;
private SerialPortManager serialPortManager;
private @Nullable SerialPort serialPort;
/**
* Constructor
*
* @param serialPortManager the serial port manager
* @param serialPortName the serial port name to be used
* @param model the projector model in use
* @param protocol the protocol to be used
* @param readerThreadName the name of thread to be created
*/
public RotelSerialConnector(SerialPortManager serialPortManager, String serialPortName, RotelModel model,
RotelProtocol protocol, Map<RotelSource, String> sourcesLabels, String readerThreadName) {
super(model, protocol, sourcesLabels, false, readerThreadName);
this.serialPortManager = serialPortManager;
this.serialPortName = serialPortName;
}
@Override
public synchronized void open() throws RotelException {
logger.debug("Opening serial connection on port {}", serialPortName);
try {
SerialPortIdentifier portIdentifier = serialPortManager.getIdentifier(serialPortName);
if (portIdentifier == null) {
setConnected(false);
logger.debug("Opening serial connection failed: No Such Port: {}", serialPortName);
throw new RotelException("Opening serial connection failed: No Such Port");
}
SerialPort commPort = portIdentifier.open(this.getClass().getName(), 2000);
commPort.setSerialPortParams(getModel().getBaudRate(), SerialPort.DATABITS_8, SerialPort.STOPBITS_1,
SerialPort.PARITY_NONE);
commPort.enableReceiveThreshold(1);
commPort.enableReceiveTimeout(100);
commPort.setFlowControlMode(SerialPort.FLOWCONTROL_NONE);
InputStream dataIn = commPort.getInputStream();
OutputStream dataOut = commPort.getOutputStream();
if (dataOut != null) {
dataOut.flush();
}
if (dataIn != null && dataIn.markSupported()) {
try {
dataIn.reset();
} catch (IOException e) {
}
}
Thread thread = new RotelReaderThread(this, readerThreadName);
setReaderThread(thread);
thread.start();
this.serialPort = commPort;
this.dataIn = dataIn;
this.dataOut = dataOut;
setConnected(true);
logger.debug("Serial connection opened");
} catch (PortInUseException e) {
setConnected(false);
logger.debug("Opening serial connection failed: Port in Use Exception: {}", e.getMessage(), e);
throw new RotelException("Opening serial connection failed: Port in Use Exception");
} catch (UnsupportedCommOperationException e) {
setConnected(false);
logger.debug("Opening serial connection failed: Unsupported Comm Operation Exception: {}", e.getMessage(),
e);
throw new RotelException("Opening serial connection failed: Unsupported Comm Operation Exception");
} catch (UnsupportedEncodingException e) {
setConnected(false);
logger.debug("Opening serial connection failed: Unsupported Encoding Exception: {}", e.getMessage(), e);
throw new RotelException("Opening serial connection failed: Unsupported Encoding Exception");
} catch (IOException e) {
setConnected(false);
logger.debug("Opening serial connection failed: IO Exception: {}", e.getMessage(), e);
throw new RotelException("Opening serial connection failed: IO Exception");
}
}
@Override
public synchronized void close() {
logger.debug("Closing serial connection");
SerialPort serialPort = this.serialPort;
if (serialPort != null) {
serialPort.removeEventListener();
}
super.cleanup();
if (serialPort != null) {
serialPort.close();
this.serialPort = null;
}
setConnected(false);
logger.debug("Serial connection closed");
}
}

View File

@@ -0,0 +1,459 @@
/**
* Copyright (c) 2010-2020 Contributors to the openHAB project
*
* See the NOTICE file(s) distributed with this work for additional
* information.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License 2.0 which is available at
* http://www.eclipse.org/legal/epl-2.0
*
* SPDX-License-Identifier: EPL-2.0
*/
package org.openhab.binding.rotel.internal.communication;
import java.util.ArrayList;
import java.util.List;
import org.eclipse.jdt.annotation.NonNullByDefault;
import org.eclipse.jdt.annotation.Nullable;
import org.openhab.binding.rotel.internal.RotelException;
/**
* Represents the different sources available for the Rotel device
*
* @author Laurent Garnier - Initial contribution
*/
@NonNullByDefault
public enum RotelSource {
CAT0_CD(0, "CD", "CD", RotelCommand.SOURCE_CD),
CAT1_CD(1, "CD", "CD", RotelCommand.SOURCE_CD, RotelCommand.RECORD_SOURCE_CD, RotelCommand.MAIN_ZONE_SOURCE_CD,
RotelCommand.ZONE2_SOURCE_CD, RotelCommand.ZONE3_SOURCE_CD, RotelCommand.ZONE4_SOURCE_CD),
CAT1_TUNER(1, "TUNER", "TUNER", RotelCommand.SOURCE_TUNER, RotelCommand.RECORD_SOURCE_TUNER,
RotelCommand.MAIN_ZONE_SOURCE_TUNER, RotelCommand.ZONE2_SOURCE_TUNER, RotelCommand.ZONE3_SOURCE_TUNER,
RotelCommand.ZONE4_SOURCE_TUNER),
CAT1_TAPE(1, "TAPE", "TAPE", RotelCommand.SOURCE_TAPE, RotelCommand.RECORD_SOURCE_TAPE,
RotelCommand.MAIN_ZONE_SOURCE_TAPE, RotelCommand.ZONE2_SOURCE_TAPE, RotelCommand.ZONE3_SOURCE_TAPE,
RotelCommand.ZONE4_SOURCE_TAPE),
CAT1_VIDEO1(1, "VIDEO1", "VIDEO 1", RotelCommand.SOURCE_VIDEO1, RotelCommand.RECORD_SOURCE_VIDEO1,
RotelCommand.MAIN_ZONE_SOURCE_VIDEO1, RotelCommand.ZONE2_SOURCE_VIDEO1, RotelCommand.ZONE3_SOURCE_VIDEO1,
RotelCommand.ZONE4_SOURCE_VIDEO1),
CAT1_VIDEO2(1, "VIDEO2", "VIDEO 2", RotelCommand.SOURCE_VIDEO2, RotelCommand.RECORD_SOURCE_VIDEO2,
RotelCommand.MAIN_ZONE_SOURCE_VIDEO2, RotelCommand.ZONE2_SOURCE_VIDEO2, RotelCommand.ZONE3_SOURCE_VIDEO2,
RotelCommand.ZONE4_SOURCE_VIDEO2),
CAT1_VIDEO3(1, "VIDEO3", "VIDEO 3", RotelCommand.SOURCE_VIDEO3, RotelCommand.RECORD_SOURCE_VIDEO3,
RotelCommand.MAIN_ZONE_SOURCE_VIDEO3, RotelCommand.ZONE2_SOURCE_VIDEO3, RotelCommand.ZONE3_SOURCE_VIDEO3,
RotelCommand.ZONE4_SOURCE_VIDEO3),
CAT1_VIDEO4(1, "VIDEO4", "VIDEO 4", RotelCommand.SOURCE_VIDEO4, RotelCommand.RECORD_SOURCE_VIDEO4,
RotelCommand.MAIN_ZONE_SOURCE_VIDEO4, RotelCommand.ZONE2_SOURCE_VIDEO4, RotelCommand.ZONE3_SOURCE_VIDEO4,
RotelCommand.ZONE4_SOURCE_VIDEO4),
CAT1_VIDEO5(1, "VIDEO5", "VIDEO 5", RotelCommand.SOURCE_VIDEO5, RotelCommand.RECORD_SOURCE_VIDEO5,
RotelCommand.MAIN_ZONE_SOURCE_VIDEO5, RotelCommand.ZONE2_SOURCE_VIDEO5, RotelCommand.ZONE3_SOURCE_VIDEO5,
RotelCommand.ZONE4_SOURCE_VIDEO5),
CAT1_MULTI(1, "MULTI", "MULTI", RotelCommand.SOURCE_MULTI_INPUT, null, RotelCommand.MAIN_ZONE_SOURCE_MULTI_INPUT,
null, null, null),
CAT1_FOLLOW_MAIN(1, "MAIN", "Follow Main Zone Source", null, RotelCommand.RECORD_SOURCE_MAIN, null,
RotelCommand.ZONE2_SOURCE_MAIN, RotelCommand.ZONE3_SOURCE_MAIN, RotelCommand.ZONE4_SOURCE_MAIN),
CAT2_CD(2, "CD", "CD", RotelCommand.SOURCE_CD, RotelCommand.RECORD_SOURCE_CD, RotelCommand.MAIN_ZONE_SOURCE_CD,
RotelCommand.ZONE2_SOURCE_CD, RotelCommand.ZONE3_SOURCE_CD, RotelCommand.ZONE4_SOURCE_CD),
CAT2_TUNER(2, "TUNER", "TUNER", RotelCommand.SOURCE_TUNER, RotelCommand.RECORD_SOURCE_TUNER,
RotelCommand.MAIN_ZONE_SOURCE_TUNER, RotelCommand.ZONE2_SOURCE_TUNER, RotelCommand.ZONE3_SOURCE_TUNER,
RotelCommand.ZONE4_SOURCE_TUNER),
CAT2_VIDEO1(2, "VIDEO1", "VIDEO 1", RotelCommand.SOURCE_VIDEO1, RotelCommand.RECORD_SOURCE_VIDEO1,
RotelCommand.MAIN_ZONE_SOURCE_VIDEO1, RotelCommand.ZONE2_SOURCE_VIDEO1, RotelCommand.ZONE3_SOURCE_VIDEO1,
RotelCommand.ZONE4_SOURCE_VIDEO1),
CAT2_VIDEO2(2, "VIDEO2", "VIDEO 2", RotelCommand.SOURCE_VIDEO2, RotelCommand.RECORD_SOURCE_VIDEO2,
RotelCommand.MAIN_ZONE_SOURCE_VIDEO2, RotelCommand.ZONE2_SOURCE_VIDEO2, RotelCommand.ZONE3_SOURCE_VIDEO2,
RotelCommand.ZONE4_SOURCE_VIDEO2),
CAT2_VIDEO3(2, "VIDEO3", "VIDEO 3", RotelCommand.SOURCE_VIDEO3, RotelCommand.RECORD_SOURCE_VIDEO3,
RotelCommand.MAIN_ZONE_SOURCE_VIDEO3, RotelCommand.ZONE2_SOURCE_VIDEO3, RotelCommand.ZONE3_SOURCE_VIDEO3,
RotelCommand.ZONE4_SOURCE_VIDEO3),
CAT2_VIDEO4(2, "VIDEO4", "VIDEO 4", RotelCommand.SOURCE_VIDEO4, RotelCommand.RECORD_SOURCE_VIDEO4,
RotelCommand.MAIN_ZONE_SOURCE_VIDEO4, RotelCommand.ZONE2_SOURCE_VIDEO4, RotelCommand.ZONE3_SOURCE_VIDEO4,
RotelCommand.ZONE4_SOURCE_VIDEO4),
CAT2_VIDEO5(2, "VIDEO5", "VIDEO 5", RotelCommand.SOURCE_VIDEO5, RotelCommand.RECORD_SOURCE_VIDEO5,
RotelCommand.MAIN_ZONE_SOURCE_VIDEO5, RotelCommand.ZONE2_SOURCE_VIDEO5, RotelCommand.ZONE3_SOURCE_VIDEO5,
RotelCommand.ZONE4_SOURCE_VIDEO5),
CAT2_VIDEO6(2, "VIDEO6", "VIDEO 6", RotelCommand.SOURCE_VIDEO6, RotelCommand.RECORD_SOURCE_VIDEO6,
RotelCommand.MAIN_ZONE_SOURCE_VIDEO6, RotelCommand.ZONE2_SOURCE_VIDEO6, RotelCommand.ZONE3_SOURCE_VIDEO6,
RotelCommand.ZONE4_SOURCE_VIDEO6),
CAT2_USB(2, "USB", "USB", RotelCommand.SOURCE_USB, RotelCommand.RECORD_SOURCE_USB,
RotelCommand.MAIN_ZONE_SOURCE_USB, RotelCommand.ZONE2_SOURCE_USB, RotelCommand.ZONE3_SOURCE_USB,
RotelCommand.ZONE4_SOURCE_USB),
CAT2_MULTI(2, "MULTI", "MULTI", RotelCommand.SOURCE_MULTI_INPUT, null, RotelCommand.MAIN_ZONE_SOURCE_MULTI_INPUT,
null, null, null),
CAT2_FOLLOW_MAIN(2, "MAIN", "Follow Main Zone Source", null, RotelCommand.RECORD_SOURCE_MAIN, null,
RotelCommand.ZONE2_SOURCE_MAIN, RotelCommand.ZONE3_SOURCE_MAIN, RotelCommand.ZONE4_SOURCE_MAIN),
CAT3_CD(3, "CD", "CD", RotelCommand.SOURCE_CD, RotelCommand.RECORD_SOURCE_CD, RotelCommand.MAIN_ZONE_SOURCE_CD,
RotelCommand.ZONE2_SOURCE_CD, RotelCommand.ZONE3_SOURCE_CD, RotelCommand.ZONE4_SOURCE_CD),
CAT3_TUNER(3, "TUNER", "TUNER", RotelCommand.SOURCE_TUNER, RotelCommand.RECORD_SOURCE_TUNER,
RotelCommand.MAIN_ZONE_SOURCE_TUNER, RotelCommand.ZONE2_SOURCE_TUNER, RotelCommand.ZONE3_SOURCE_TUNER,
RotelCommand.ZONE4_SOURCE_TUNER),
CAT3_TAPE(3, "TAPE", "TAPE", RotelCommand.SOURCE_TAPE, RotelCommand.RECORD_SOURCE_TAPE,
RotelCommand.MAIN_ZONE_SOURCE_TAPE, RotelCommand.ZONE2_SOURCE_TAPE, RotelCommand.ZONE3_SOURCE_TAPE,
RotelCommand.ZONE4_SOURCE_TAPE),
CAT3_VIDEO1(3, "VIDEO1", "VIDEO 1", RotelCommand.SOURCE_VIDEO1, RotelCommand.RECORD_SOURCE_VIDEO1,
RotelCommand.MAIN_ZONE_SOURCE_VIDEO1, RotelCommand.ZONE2_SOURCE_VIDEO1, RotelCommand.ZONE3_SOURCE_VIDEO1,
RotelCommand.ZONE4_SOURCE_VIDEO1),
CAT3_VIDEO2(3, "VIDEO2", "VIDEO 2", RotelCommand.SOURCE_VIDEO2, RotelCommand.RECORD_SOURCE_VIDEO2,
RotelCommand.MAIN_ZONE_SOURCE_VIDEO2, RotelCommand.ZONE2_SOURCE_VIDEO2, RotelCommand.ZONE3_SOURCE_VIDEO2,
RotelCommand.ZONE4_SOURCE_VIDEO2),
CAT3_VIDEO3(3, "VIDEO3", "VIDEO 3", RotelCommand.SOURCE_VIDEO3, RotelCommand.RECORD_SOURCE_VIDEO3,
RotelCommand.MAIN_ZONE_SOURCE_VIDEO3, RotelCommand.ZONE2_SOURCE_VIDEO3, RotelCommand.ZONE3_SOURCE_VIDEO3,
RotelCommand.ZONE4_SOURCE_VIDEO3),
CAT3_VIDEO4(3, "VIDEO4", "VIDEO 4", RotelCommand.SOURCE_VIDEO4, RotelCommand.RECORD_SOURCE_VIDEO4,
RotelCommand.MAIN_ZONE_SOURCE_VIDEO4, RotelCommand.ZONE2_SOURCE_VIDEO4, RotelCommand.ZONE3_SOURCE_VIDEO4,
RotelCommand.ZONE4_SOURCE_VIDEO4),
CAT3_VIDEO5(3, "VIDEO5", "VIDEO 5", RotelCommand.SOURCE_VIDEO5, RotelCommand.RECORD_SOURCE_VIDEO5,
RotelCommand.MAIN_ZONE_SOURCE_VIDEO5, RotelCommand.ZONE2_SOURCE_VIDEO5, RotelCommand.ZONE3_SOURCE_VIDEO5,
RotelCommand.ZONE4_SOURCE_VIDEO5),
CAT3_MULTI(3, "MULTI", "MULTI", RotelCommand.SOURCE_MULTI_INPUT, null, RotelCommand.MAIN_ZONE_SOURCE_MULTI_INPUT,
null, null, null),
CAT4_CD(4, "CD", "CD", RotelCommand.SOURCE_CD),
CAT4_AUX1(4, "AUX1", "Aux 1", RotelCommand.SOURCE_AUX1),
CAT4_TUNER(4, "TUNER", "Tuner", RotelCommand.SOURCE_TUNER),
CAT4_PHONO(4, "PHONO", "Phono", RotelCommand.SOURCE_PHONO),
CAT4_BLUETOOTH(4, "BLUETOOTH", "Bluetooth", RotelCommand.SOURCE_BLUETOOTH),
CAT5_CD(5, "CD", "CD", RotelCommand.SOURCE_CD),
CAT5_COAX1(5, "COAX1", "Coax 1", RotelCommand.SOURCE_COAX1),
CAT5_COAX2(5, "COAX2", "Coax 2", RotelCommand.SOURCE_COAX2),
CAT5_OPTICAL1(5, "OPTICAL1", "Optical 1", RotelCommand.SOURCE_OPT1),
CAT5_OPTICAL2(5, "OPTICAL2", "Optical 2", RotelCommand.SOURCE_OPT2),
CAT5_AUX1(5, "AUX1", "Aux 1", RotelCommand.SOURCE_AUX1),
CAT5_AUX2(5, "AUX2", "Aux 2", RotelCommand.SOURCE_AUX2),
CAT5_TUNER(5, "TUNER", "Tuner", RotelCommand.SOURCE_TUNER),
CAT5_PHONO(5, "PHONO", "Phono", RotelCommand.SOURCE_PHONO),
CAT5_USB(5, "USB", "Front USB", RotelCommand.SOURCE_USB),
CAT5_PCUSB(5, "PCUSB", "PC USB", RotelCommand.SOURCE_PCUSB),
CAT5_BLUETOOTH(5, "BLUETOOTH", "Bluetooth", RotelCommand.SOURCE_BLUETOOTH),
CAT6_RCD(6, "RCD", "Rotel CD", RotelCommand.SOURCE_ROTEL_CD),
CAT6_CD(6, "CD", "CD", RotelCommand.SOURCE_CD),
CAT6_COAX1(6, "COAX1", "Coax 1", RotelCommand.SOURCE_COAX1),
CAT6_COAX2(6, "COAX2", "Coax 2", RotelCommand.SOURCE_COAX2),
CAT6_OPTICAL1(6, "OPTICAL1", "Optical 1", RotelCommand.SOURCE_OPT1),
CAT6_OPTICAL2(6, "OPTICAL2", "Optical 2", RotelCommand.SOURCE_OPT2),
CAT6_AUX1(6, "AUX1", "Aux 1", RotelCommand.SOURCE_AUX1),
CAT6_AUX2(6, "AUX2", "Aux 2", RotelCommand.SOURCE_AUX2),
CAT6_TUNER(6, "TUNER", "Tuner", RotelCommand.SOURCE_TUNER),
CAT6_PHONO(6, "PHONO", "Phono", RotelCommand.SOURCE_PHONO),
CAT6_USB(6, "USB", "Front USB", RotelCommand.SOURCE_USB),
CAT7_RCD(7, "RCD", "Rotel CD", RotelCommand.SOURCE_ROTEL_CD),
CAT7_CD(7, "CD", "CD", RotelCommand.SOURCE_CD),
CAT7_COAX1(7, "COAX1", "Coax 1", RotelCommand.SOURCE_COAX1),
CAT7_COAX2(7, "COAX2", "Coax 2", RotelCommand.SOURCE_COAX2),
CAT7_OPTICAL1(7, "OPTICAL1", "Optical 1", RotelCommand.SOURCE_OPT1),
CAT7_OPTICAL2(7, "OPTICAL2", "Optical 2", RotelCommand.SOURCE_OPT2),
CAT7_AUX1(7, "AUX1", "Aux 1", RotelCommand.SOURCE_AUX1),
CAT7_AUX2(7, "AUX2", "Aux 2", RotelCommand.SOURCE_AUX2),
CAT7_TUNER(7, "TUNER", "Tuner", RotelCommand.SOURCE_TUNER),
CAT7_PHONO(7, "PHONO", "Phono", RotelCommand.SOURCE_PHONO),
CAT7_USB(7, "USB", "Front USB", RotelCommand.SOURCE_USB),
CAT7_PCUSB(7, "PCUSB", "PC USB", RotelCommand.SOURCE_PCUSB),
CAT7_XLR(7, "XLR", "XLR", RotelCommand.SOURCE_XLR),
CAT8_CD(8, "CD", "CD", RotelCommand.SOURCE_CD),
CAT8_COAX1(8, "COAX1", "Coax 1", RotelCommand.SOURCE_COAX1),
CAT8_COAX2(8, "COAX2", "Coax 2", RotelCommand.SOURCE_COAX2),
CAT8_OPTICAL1(8, "OPTICAL1", "Optical 1", RotelCommand.SOURCE_OPT1),
CAT8_OPTICAL2(8, "OPTICAL2", "Optical 2", RotelCommand.SOURCE_OPT2),
CAT8_AUX(8, "AUX", "Aux", RotelCommand.SOURCE_AUX),
CAT8_TUNER(8, "TUNER", "Tuner", RotelCommand.SOURCE_TUNER),
CAT8_PHONO(8, "PHONO", "Phono", RotelCommand.SOURCE_PHONO),
CAT8_USB(8, "USB", "Front USB", RotelCommand.SOURCE_USB),
CAT8_PCUSB(8, "PCUSB", "PC USB", RotelCommand.SOURCE_PCUSB),
CAT8_BLUETOOTH(8, "BLUETOOTH", "Bluetooth", RotelCommand.SOURCE_BLUETOOTH),
CAT8_XLR(8, "XLR", "XLR", RotelCommand.SOURCE_XLR),
CAT9_RCD(9, "RCD", "Rotel CD", RotelCommand.SOURCE_ROTEL_CD),
CAT9_CD(9, "CD", "CD", RotelCommand.SOURCE_CD),
CAT9_COAX1(9, "COAX1", "Coax 1", RotelCommand.SOURCE_COAX1),
CAT9_COAX2(9, "COAX2", "Coax 2", RotelCommand.SOURCE_COAX2),
CAT9_COAX3(9, "COAX3", "Coax 3", RotelCommand.SOURCE_COAX3),
CAT9_OPTICAL1(9, "OPTICAL1", "Optical 1", RotelCommand.SOURCE_OPT1),
CAT9_OPTICAL2(9, "OPTICAL2", "Optical 2", RotelCommand.SOURCE_OPT2),
CAT9_OPTICAL3(9, "OPTICAL3", "Optical 3", RotelCommand.SOURCE_OPT3),
CAT9_AUX(9, "AUX", "Aux", RotelCommand.SOURCE_AUX),
CAT9_TUNER(9, "TUNER", "Tuner", RotelCommand.SOURCE_TUNER),
CAT9_PHONO(9, "PHONO", "Phono", RotelCommand.SOURCE_PHONO),
CAT9_USB(9, "USB", "Front USB", RotelCommand.SOURCE_USB),
CAT9_PCUSB(9, "PCUSB", "PC USB", RotelCommand.SOURCE_PCUSB),
CAT9_BLUETOOTH(9, "BLUETOOTH", "Bluetooth", RotelCommand.SOURCE_BLUETOOTH),
CAT9_XLR(9, "XLR", "XLR", RotelCommand.SOURCE_XLR),
CAT10_CD(10, "CD", "CD", RotelCommand.SOURCE_CD),
CAT10_TUNER(10, "TUNER", "Tuner", RotelCommand.SOURCE_TUNER),
CAT10_PHONO(10, "PHONO", "Phono", RotelCommand.SOURCE_PHONO),
CAT10_VIDEO1(10, "VIDEO1", "VIDEO 1", RotelCommand.SOURCE_VIDEO1),
CAT10_VIDEO2(10, "VIDEO2", "VIDEO 2", RotelCommand.SOURCE_VIDEO2),
CAT10_VIDEO3(10, "VIDEO3", "VIDEO 3", RotelCommand.SOURCE_VIDEO3),
CAT10_VIDEO4(10, "VIDEO4", "VIDEO 4", RotelCommand.SOURCE_VIDEO4),
CAT10_VIDEO5(10, "VIDEO5", "VIDEO 5", RotelCommand.SOURCE_VIDEO5),
CAT10_VIDEO6(10, "VIDEO6", "VIDEO 6", RotelCommand.SOURCE_VIDEO6),
CAT10_VIDEO7(10, "VIDEO7", "VIDEO 7", RotelCommand.SOURCE_VIDEO7),
CAT10_USB(10, "USB", "Front USB", RotelCommand.SOURCE_USB),
CAT10_PCUSB(10, "PCUSB", "PC USB", RotelCommand.SOURCE_PCUSB),
CAT10_BLUETOOTH(10, "BLUETOOTH", "Bluetooth", RotelCommand.SOURCE_BLUETOOTH),
CAT10_XLR(10, "XLR", "XLR", RotelCommand.SOURCE_XLR),
CAT10_MULTI(10, "MULTI", "MULTI", RotelCommand.SOURCE_MULTI_INPUT),
CAT11_CD(11, "CD", "CD", RotelCommand.SOURCE_CD),
CAT11_TUNER(11, "TUNER", "Tuner", RotelCommand.SOURCE_TUNER),
CAT11_PHONO(11, "PHONO", "Phono", RotelCommand.SOURCE_PHONO),
CAT11_VIDEO1(11, "VIDEO1", "VIDEO 1", RotelCommand.SOURCE_VIDEO1),
CAT11_VIDEO2(11, "VIDEO2", "VIDEO 2", RotelCommand.SOURCE_VIDEO2),
CAT11_VIDEO3(11, "VIDEO3", "VIDEO 3", RotelCommand.SOURCE_VIDEO3),
CAT11_VIDEO4(11, "VIDEO4", "VIDEO 4", RotelCommand.SOURCE_VIDEO4),
CAT11_VIDEO5(11, "VIDEO5", "VIDEO 5", RotelCommand.SOURCE_VIDEO5),
CAT11_VIDEO6(11, "VIDEO6", "VIDEO 6", RotelCommand.SOURCE_VIDEO6),
CAT11_VIDEO7(11, "VIDEO7", "VIDEO 7", RotelCommand.SOURCE_VIDEO7),
CAT11_VIDEO8(11, "VIDEO8", "VIDEO 8", RotelCommand.SOURCE_VIDEO8),
CAT11_USB(11, "USB", "Front USB", RotelCommand.SOURCE_USB),
CAT11_PCUSB(11, "PCUSB", "PC USB", RotelCommand.SOURCE_PCUSB),
CAT11_BLUETOOTH(11, "BLUETOOTH", "Bluetooth", RotelCommand.SOURCE_BLUETOOTH),
CAT11_XLR(11, "XLR", "XLR", RotelCommand.SOURCE_XLR),
CAT11_MULTI(11, "MULTI", "MULTI", RotelCommand.SOURCE_MULTI_INPUT),
CAT12_FM(12, "FM", "FM", RotelCommand.SOURCE_FM),
CAT12_DAB(12, "DAB", "DAB", RotelCommand.SOURCE_DAB),
CAT13_FM(13, "FM", "FM", RotelCommand.SOURCE_FM),
CAT13_DAB(13, "DAB", "DAB", RotelCommand.SOURCE_DAB),
CAT13_PLAYFI(13, "PLAYFI", "PlayFi", RotelCommand.SOURCE_PLAYFI),
CAT14_FM(14, "FM", "FM", RotelCommand.SOURCE_FM),
CAT14_DAB(14, "DAB", "DAB", RotelCommand.SOURCE_DAB),
CAT14_IRADIO(14, "IRADIO", "iRadio", RotelCommand.SOURCE_IRADIO),
CAT14_NETWORK(14, "NETWORK", "Network", RotelCommand.SOURCE_NETWORK),
CAT15_COAX1(15, "COAX1", "Coax 1", RotelCommand.SOURCE_COAX1),
CAT15_COAX2(15, "COAX2", "Coax 2", RotelCommand.SOURCE_COAX2),
CAT15_OPTICAL1(15, "OPTICAL1", "Optical 1", RotelCommand.SOURCE_OPT1),
CAT15_OPTICAL2(15, "OPTICAL2", "Optical 2", RotelCommand.SOURCE_OPT2),
CAT15_USB(15, "USB", "Front USB", RotelCommand.SOURCE_USB),
CAT15_PCUSB(15, "PCUSB", "PC USB", RotelCommand.SOURCE_PCUSB),
CAT16_IRADIO(16, "IRADIO", "iRadio", RotelCommand.SOURCE_IRADIO),
CAT16_NETWORK(16, "NETWORK", "Network", RotelCommand.SOURCE_NETWORK),
CAT16_AUX1_COAX(16, "AUX1_COAX", "Aux 1 Coax", RotelCommand.SOURCE_AUX1_COAX),
CAT16_AUX1_OPTICAL(16, "AUX1_OPTICAL", "Aux 1 Optical", RotelCommand.SOURCE_AUX1_OPT),
CAT16_FM(16, "FM", "FM", RotelCommand.SOURCE_FM),
CAT16_DAB(16, "DAB", "DAB", RotelCommand.SOURCE_DAB),
CAT16_USB(16, "USB", "USB", RotelCommand.SOURCE_USB),
CAT17_CD(17, "CD", "CD", RotelCommand.SOURCE_CD),
CAT17_IRADIO(17, "IRADIO", "iRadio", RotelCommand.SOURCE_IRADIO),
CAT17_NETWORK(17, "NETWORK", "Network", RotelCommand.SOURCE_NETWORK),
CAT17_AUX1_COAX(17, "AUX1_COAX", "Aux 1 Coax", RotelCommand.SOURCE_AUX1_COAX),
CAT17_AUX1_OPTICAL(17, "AUX1_OPTICAL", "Aux 1 Optical", RotelCommand.SOURCE_AUX1_OPT),
CAT17_AUX2(17, "AUX2", "Aux 2", RotelCommand.SOURCE_AUX2),
CAT17_FM(17, "FM", "FM", RotelCommand.SOURCE_FM),
CAT17_DAB(17, "DAB", "DAB", RotelCommand.SOURCE_DAB),
CAT17_USB(17, "USB", "USB", RotelCommand.SOURCE_USB);
private int category;
private String name;
private String label;
private @Nullable RotelCommand command;
private @Nullable RotelCommand recordCommand;
private @Nullable RotelCommand mainZoneCommand;
private @Nullable RotelCommand zone2Command;
private @Nullable RotelCommand zone3Command;
private @Nullable RotelCommand zone4Command;
/**
* Constructor
*
* @param category a category of models for which the source is available
* @param name the name of the source
* @param label the label of the source
* @param command the command to select the source
*/
private RotelSource(int category, String name, String label, @Nullable RotelCommand command) {
this(category, name, label, command, null, null, null, null, null);
}
/**
* Constructor
*
* @param category a category of models for which the source is available
* @param name the name of the source
* @param label the label of the source
* @param command the command to select the source
* @param recordCommand the command to select the source as source to be recorded
* @param mainZoneCommand the command to select the source in the main zone
* @param zone2Command the command to select the source in the zone 2
* @param zone3Command the command to select the source in the zone 3
* @param zone4Command the command to select the source in the zone 4
*/
private RotelSource(int category, String name, String label, @Nullable RotelCommand command,
@Nullable RotelCommand recordCommand, @Nullable RotelCommand mainZoneCommand,
@Nullable RotelCommand zone2Command, @Nullable RotelCommand zone3Command,
@Nullable RotelCommand zone4Command) {
this.category = category;
this.name = name;
this.label = label;
this.command = command;
this.recordCommand = recordCommand;
this.mainZoneCommand = mainZoneCommand;
this.zone2Command = zone2Command;
this.zone3Command = zone3Command;
this.zone4Command = zone4Command;
}
/**
* Get the category of models for the source
*
* @return the category of models
*/
public int getCategory() {
return category;
}
/**
* Get the name of the source
*
* @return the name
*/
public String getName() {
return name;
}
/**
* Get the label of the source
*
* @return the label
*/
public String getLabel() {
return label;
}
/**
* Get the command to select the source
*
* @return the command
*/
public @Nullable RotelCommand getCommand() {
return command;
}
/**
* Get the command to select the source as source to be recorded
*
* @return the command
*/
public @Nullable RotelCommand getRecordCommand() {
return recordCommand;
}
/**
* Get the command to select the source in the main zone
*
* @return the command
*/
public @Nullable RotelCommand getMainZoneCommand() {
return mainZoneCommand;
}
/**
* Get the command to select the source in the zone 2
*
* @return the command
*/
public @Nullable RotelCommand getZone2Command() {
return zone2Command;
}
/**
* Get the command to select the source in the zone 3
*
* @return the command
*/
public @Nullable RotelCommand getZone3Command() {
return zone3Command;
}
/**
* Get the command to select the source in the zone 4
*
* @return the command
*/
public @Nullable RotelCommand getZone4Command() {
return zone4Command;
}
/**
* Get the list of {@link RotelSource} available for a particular category of models
*
* @param category a category of models
* @param type a source type (0 for global source, 1 for main zone, 2 for zone 2, 3 for zone 3, 4 for zone 4 and 5
* for record source)
*
* @return the list of {@link RotelSource} available in a zone for a provided category of models
*/
public static List<RotelSource> getSources(int category, int type) {
List<RotelSource> sources = new ArrayList<>();
for (RotelSource value : RotelSource.values()) {
if (value.getCategory() == category && ((type == 0 && value.getCommand() != null)
|| (type == 1 && value.getMainZoneCommand() != null)
|| (type == 2 && value.getZone2Command() != null) || (type == 3 && value.getZone3Command() != null)
|| (type == 4 && value.getZone4Command() != null)
|| (type == 5 && value.getRecordCommand() != null))) {
sources.add(value);
}
}
return sources;
}
/**
* Get the source associated to a name for a particular category of models
*
* @param category a category of models
* @param name the name used to identify the source
*
* @return the source associated to the searched name for the provided category of models
*
* @throws RotelException - If no source is associated to the searched name for the provided category
*/
public static RotelSource getFromName(int category, String name) throws RotelException {
for (RotelSource value : RotelSource.values()) {
if (value.getCategory() == category && value.getName().equals(name)) {
return value;
}
}
throw new RotelException("Invalid name for a source: " + name);
}
/**
* Get the source associated to a command for a particular category of models
*
* @param category a category of models
* @param command the command used to identify the source
* @param type a source type (0 for global source, 1 for main zone, 2 for zone 2, 3 for zone 3, 4 for zone 4 and 5
* for record source)
*
* @return the source associated to the searched command for the provided category of models
*
* @throws RotelException - If no source is associated to the searched command for the provided category
*/
public static RotelSource getFromCommand(int category, RotelCommand command, int type) throws RotelException {
for (RotelSource value : RotelSource.values()) {
if (value.getCategory() == category && ((type == 0 && value.getCommand() == command)
|| (type == 1 && value.getMainZoneCommand() == command)
|| (type == 2 && value.getZone2Command() == command)
|| (type == 3 && value.getZone3Command() == command)
|| (type == 4 && value.getZone4Command() == command)
|| (type == 5 && value.getRecordCommand() == command))) {
return value;
}
}
throw new RotelException("Invalid command for a source: " + command.getName());
}
}

View File

@@ -0,0 +1,41 @@
/**
* Copyright (c) 2010-2020 Contributors to the openHAB project
*
* See the NOTICE file(s) distributed with this work for additional
* information.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License 2.0 which is available at
* http://www.eclipse.org/legal/epl-2.0
*
* SPDX-License-Identifier: EPL-2.0
*/
package org.openhab.binding.rotel.internal.configuration;
import org.eclipse.jdt.annotation.NonNullByDefault;
/**
* The {@link RotelThingConfiguration} class contains fields mapping thing configuration parameters.
*
* @author Laurent Garnier - Initial contribution
*/
@NonNullByDefault
public class RotelThingConfiguration {
public @NonNullByDefault({}) String serialPort;
public @NonNullByDefault({}) String host;
public @NonNullByDefault({}) Integer port;
public @NonNullByDefault({}) String inputLabelCd;
public @NonNullByDefault({}) String inputLabelTuner;
public @NonNullByDefault({}) String inputLabelTape;
public @NonNullByDefault({}) String inputLabelPhono;
public @NonNullByDefault({}) String inputLabelVideo1;
public @NonNullByDefault({}) String inputLabelVideo2;
public @NonNullByDefault({}) String inputLabelVideo3;
public @NonNullByDefault({}) String inputLabelVideo4;
public @NonNullByDefault({}) String inputLabelVideo5;
public @NonNullByDefault({}) String inputLabelVideo6;
public @NonNullByDefault({}) String inputLabelUsb;
public @NonNullByDefault({}) String inputLabelMulti;
public @NonNullByDefault({}) String protocol;
}

View File

@@ -0,0 +1,11 @@
<?xml version="1.0" encoding="UTF-8"?>
<binding:binding id="rotel" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:binding="https://openhab.org/schemas/binding/v1.0.0"
xsi:schemaLocation="https://openhab.org/schemas/binding/v1.0.0 https://openhab.org/schemas/binding-1.0.0.xsd">
<name>Rotel Binding</name>
<description>The Rotel binding controls a Rotel audio device like a surround processor, a surround receiver, a stereo
preamplifier, an integrated amplifier, a CD player or a tuner.</description>
<author>Laurent Garnier</author>
</binding:binding>

View File

@@ -0,0 +1,328 @@
<?xml version="1.0" encoding="UTF-8"?>
<config-description:config-descriptions
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:config-description="https://openhab.org/schemas/config-description/v1.0.0"
xsi:schemaLocation="https://openhab.org/schemas/config-description/v1.0.0
https://openhab.org/schemas/config-description-1.0.0.xsd">
<config-description uri="thing-type:rotel:serial">
<parameter name="serialPort" type="text" required="false">
<context>serial-port</context>
<limitToOptions>false</limitToOptions>
<label>Serial Port</label>
<description>Serial port to use for connecting to the Rotel device</description>
</parameter>
<parameter name="host" type="text" required="false">
<context>network-address</context>
<label>Address</label>
<description>Host name or IP address of the machine connected to the Rotel device (serial over IP)</description>
</parameter>
<parameter name="port" type="integer" required="false">
<label>Port</label>
<description>Communication port (serial over IP)</description>
</parameter>
</config-description>
<config-description uri="thing-type:rotel:serialandip">
<parameter name="serialPort" type="text" required="false">
<context>serial-port</context>
<limitToOptions>false</limitToOptions>
<label>Serial Port</label>
<description>Serial port to use for connecting to the Rotel device</description>
</parameter>
<parameter name="host" type="text" required="false">
<context>network-address</context>
<label>Address</label>
<description>Host name or IP address of the Rotel device (IP connection) or the machine connected to the Rotel device
(serial over IP)</description>
</parameter>
<parameter name="port" type="integer" required="false">
<label>Port</label>
<description>Communication port (IP or serial over IP). For IP connection to the Rotel device, keep the default port
9590</description>
<default>9590</default>
</parameter>
</config-description>
<config-description uri="thing-type:rotel:serialandip2">
<parameter name="serialPort" type="text" required="false">
<context>serial-port</context>
<limitToOptions>false</limitToOptions>
<label>Serial Port</label>
<description>Serial port to use for connecting to the Rotel device</description>
</parameter>
<parameter name="host" type="text" required="false">
<context>network-address</context>
<label>Address</label>
<description>Host name or IP address of the Rotel device (IP connection) or the machine connected to the Rotel device
(serial over IP)</description>
</parameter>
<parameter name="port" type="integer" required="false">
<label>Port</label>
<description>Communication port (IP or serial over IP). For IP connection to the Rotel device, keep the default port
9590</description>
<default>9596</default>
</parameter>
</config-description>
<config-description uri="thing-type:rotel:serialandipandprotocol">
<parameter name="serialPort" type="text" required="false">
<context>serial-port</context>
<limitToOptions>false</limitToOptions>
<label>Serial Port</label>
<description>Serial port to use for connecting to the Rotel device</description>
</parameter>
<parameter name="host" type="text" required="false">
<context>network-address</context>
<label>Address</label>
<description>Host name or IP address of the Rotel device (IP connection) or the machine connected to the Rotel device
(serial over IP)</description>
</parameter>
<parameter name="port" type="integer" required="false">
<label>Port</label>
<description>Communication port (IP or serial over IP). For IP connection to the Rotel device, keep the default port
9590</description>
<default>9590</default>
</parameter>
<parameter name="protocol" type="text" required="false">
<label>Protocol Version</label>
<description>Choose one of the two protocol versions (depends on your device firmware)</description>
<limitToOptions>true</limitToOptions>
<options>
<option value="ASCII_V1">ASCII V1</option>
<option value="ASCII_V2">ASCII V2</option>
</options>
<default>ASCII_V2</default>
<advanced>true</advanced>
</parameter>
</config-description>
<config-description uri="thing-type:rotel:serialandprotocol">
<parameter name="serialPort" type="text" required="false">
<context>serial-port</context>
<limitToOptions>false</limitToOptions>
<label>Serial Port</label>
<description>Serial port to use for connecting to the Rotel device</description>
</parameter>
<parameter name="host" type="text" required="false">
<context>network-address</context>
<label>Address</label>
<description>Host name or IP address of the machine connected to the Rotel device (serial over IP)</description>
</parameter>
<parameter name="port" type="integer" required="false">
<label>Port</label>
<description>Communication port (serial over IP)</description>
</parameter>
<parameter name="protocol" type="text" required="false">
<label>Protocol Version</label>
<description>Choose one of the two protocol versions (depends on your device firmware)</description>
<limitToOptions>true</limitToOptions>
<options>
<option value="ASCII_V1">ASCII V1</option>
<option value="ASCII_V2">ASCII V2</option>
</options>
<default>ASCII_V2</default>
<advanced>true</advanced>
</parameter>
</config-description>
<config-description uri="thing-type:rotel:serial2">
<parameter name="serialPort" type="text" required="false">
<context>serial-port</context>
<limitToOptions>false</limitToOptions>
<label>Serial Port</label>
<description>Serial port to use for connecting to the Rotel device</description>
</parameter>
<parameter name="host" type="text" required="false">
<context>network-address</context>
<label>Address</label>
<description>Host name or IP address of the machine connected to the Rotel device (serial over IP)</description>
</parameter>
<parameter name="port" type="integer" required="false">
<label>Port</label>
<description>Communication port (serial over IP)</description>
</parameter>
<parameter name="inputLabelVideo1" type="text" required="false">
<label>Input Label Video 1</label>
<description>Label setup for the source Video 1</description>
</parameter>
<parameter name="inputLabelVideo2" type="text" required="false">
<label>Input Label Video 2</label>
<description>Label setup for the source Video 2</description>
</parameter>
<parameter name="inputLabelVideo3" type="text" required="false">
<label>Input Label Video 3</label>
<description>Label setup for the source Video 3</description>
</parameter>
<parameter name="inputLabelVideo4" type="text" required="false">
<label>Input Label Video 4</label>
<description>Label setup for the source Video 4</description>
</parameter>
<parameter name="inputLabelVideo5" type="text" required="false">
<label>Input Label Video 5</label>
<description>Label setup for the source Video 5</description>
</parameter>
</config-description>
<config-description uri="thing-type:rotel:serial3">
<parameter name="serialPort" type="text" required="false">
<context>serial-port</context>
<limitToOptions>false</limitToOptions>
<label>Serial Port</label>
<description>Serial port to use for connecting to the Rotel device</description>
</parameter>
<parameter name="host" type="text" required="false">
<context>network-address</context>
<label>Address</label>
<description>Host name or IP address of the machine connected to the Rotel device (serial over IP)</description>
</parameter>
<parameter name="port" type="integer" required="false">
<label>Port</label>
<description>Communication port (serial over IP)</description>
</parameter>
<parameter name="inputLabelCd" type="text" required="false">
<label>Input Label CD</label>
<description>Label setup for the source CD</description>
</parameter>
<parameter name="inputLabelTuner" type="text" required="false">
<label>Input Label Tuner</label>
<description>Label setup for the source Tuner</description>
</parameter>
<parameter name="inputLabelTape" type="text" required="false">
<label>Input Label Tape</label>
<description>Label setup for the source Tape</description>
</parameter>
<parameter name="inputLabelVideo1" type="text" required="false">
<label>Input Label Video 1</label>
<description>Label setup for the source Video 1</description>
</parameter>
<parameter name="inputLabelVideo2" type="text" required="false">
<label>Input Label Video 2</label>
<description>Label setup for the source Video 2</description>
</parameter>
<parameter name="inputLabelVideo3" type="text" required="false">
<label>Input Label Video 3</label>
<description>Label setup for the source Video 3</description>
</parameter>
<parameter name="inputLabelVideo4" type="text" required="false">
<label>Input Label Video 4</label>
<description>Label setup for the source Video 4</description>
</parameter>
<parameter name="inputLabelVideo5" type="text" required="false">
<label>Input Label Video 5</label>
<description>Label setup for the source Video 5</description>
</parameter>
</config-description>
<config-description uri="thing-type:rotel:serial4">
<parameter name="serialPort" type="text" required="false">
<context>serial-port</context>
<limitToOptions>false</limitToOptions>
<label>Serial Port</label>
<description>Serial port to use for connecting to the Rotel device</description>
</parameter>
<parameter name="host" type="text" required="false">
<context>network-address</context>
<label>Address</label>
<description>Host name or IP address of the machine connected to the Rotel device (serial over IP)</description>
</parameter>
<parameter name="port" type="integer" required="false">
<label>Port</label>
<description>Communication port (serial over IP)</description>
</parameter>
<parameter name="inputLabelCd" type="text" required="false">
<label>Input Label CD</label>
<description>Label setup for the source CD</description>
</parameter>
<parameter name="inputLabelTuner" type="text" required="false">
<label>Input Label Tuner</label>
<description>Label setup for the source Tuner</description>
</parameter>
<parameter name="inputLabelTape" type="text" required="false">
<label>Input Label Tape</label>
<description>Label setup for the source Tape</description>
</parameter>
<parameter name="inputLabelVideo1" type="text" required="false">
<label>Input Label Video 1</label>
<description>Label setup for the source Video 1</description>
</parameter>
<parameter name="inputLabelVideo2" type="text" required="false">
<label>Input Label Video 2</label>
<description>Label setup for the source Video 2</description>
</parameter>
<parameter name="inputLabelVideo3" type="text" required="false">
<label>Input Label Video 3</label>
<description>Label setup for the source Video 3</description>
</parameter>
<parameter name="inputLabelVideo4" type="text" required="false">
<label>Input Label Video 4</label>
<description>Label setup for the source Video 4</description>
</parameter>
<parameter name="inputLabelVideo5" type="text" required="false">
<label>Input Label Video 5</label>
<description>Label setup for the source Video 5</description>
</parameter>
<parameter name="inputLabelMulti" type="text" required="false">
<label>Input Label Multi Input</label>
<description>Label setup for the source Multi Input</description>
</parameter>
</config-description>
<config-description uri="thing-type:rotel:serial5">
<parameter name="serialPort" type="text" required="false">
<context>serial-port</context>
<limitToOptions>false</limitToOptions>
<label>Serial Port</label>
<description>Serial port to use for connecting to the Rotel device</description>
</parameter>
<parameter name="host" type="text" required="false">
<context>network-address</context>
<label>Address</label>
<description>Host name or IP address of the machine connected to the Rotel device (serial over IP)</description>
</parameter>
<parameter name="port" type="integer" required="false">
<label>Port</label>
<description>Communication port (serial over IP)</description>
</parameter>
<parameter name="inputLabelCd" type="text" required="false">
<label>Input Label CD</label>
<description>Label setup for the source CD</description>
</parameter>
<parameter name="inputLabelTuner" type="text" required="false">
<label>Input Label Tuner</label>
<description>Label setup for the source Tuner</description>
</parameter>
<parameter name="inputLabelUsb" type="text" required="false">
<label>Input Label USB</label>
<description>Label setup for the source USB</description>
</parameter>
<parameter name="inputLabelVideo1" type="text" required="false">
<label>Input Label Video 1</label>
<description>Label setup for the source Video 1</description>
</parameter>
<parameter name="inputLabelVideo2" type="text" required="false">
<label>Input Label Video 2</label>
<description>Label setup for the source Video 2</description>
</parameter>
<parameter name="inputLabelVideo3" type="text" required="false">
<label>Input Label Video 3</label>
<description>Label setup for the source Video 3</description>
</parameter>
<parameter name="inputLabelVideo4" type="text" required="false">
<label>Input Label Video 4</label>
<description>Label setup for the source Video 4</description>
</parameter>
<parameter name="inputLabelVideo5" type="text" required="false">
<label>Input Label Video 5</label>
<description>Label setup for the source Video 5</description>
</parameter>
<parameter name="inputLabelVideo6" type="text" required="false">
<label>Input Label Video 6</label>
<description>Label setup for the source Video 6</description>
</parameter>
<parameter name="inputLabelMulti" type="text" required="false">
<label>Input Label Multi Input</label>
<description>Label setup for the source Multi Input</description>
</parameter>
</config-description>
</config-description:config-descriptions>

View File

@@ -0,0 +1,29 @@
<?xml version="1.0" encoding="UTF-8"?>
<thing:thing-descriptions bindingId="rotel"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:thing="https://openhab.org/schemas/thing-description/v1.0.0"
xsi:schemaLocation="https://openhab.org/schemas/thing-description/v1.0.0 https://openhab.org/schemas/thing-description-1.0.0.xsd">
<!-- Rotel A11 Connection Thing Type -->
<thing-type id="a11">
<label>A11 Integrated Amplifier</label>
<description>Connection to the Rotel A11 integrated amplifier</description>
<channels>
<channel id="power" typeId="system.power"/>
<channel id="source" typeId="source"/>
<channel id="volume" typeId="system.volume"/>
<channel id="mute" typeId="system.mute"/>
<channel id="bass" typeId="bass"/>
<channel id="treble" typeId="treble"/>
<channel id="brightness" typeId="brightness"/>
</channels>
<properties>
<property name="protocol">ASCII_V2</property>
</properties>
<config-description-ref uri="thing-type:rotel:serial"/>
</thing-type>
</thing:thing-descriptions>

View File

@@ -0,0 +1,30 @@
<?xml version="1.0" encoding="UTF-8"?>
<thing:thing-descriptions bindingId="rotel"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:thing="https://openhab.org/schemas/thing-description/v1.0.0"
xsi:schemaLocation="https://openhab.org/schemas/thing-description/v1.0.0 https://openhab.org/schemas/thing-description-1.0.0.xsd">
<!-- Rotel A12 Connection Thing Type -->
<thing-type id="a12">
<label>A12 Integrated Amplifier</label>
<description>Connection to the Rotel A12 integrated amplifier</description>
<channels>
<channel id="power" typeId="system.power"/>
<channel id="source" typeId="source"/>
<channel id="volume" typeId="system.volume"/>
<channel id="mute" typeId="system.mute"/>
<channel id="bass" typeId="bass"/>
<channel id="treble" typeId="treble"/>
<channel id="frequency" typeId="frequency"/>
<channel id="brightness" typeId="brightness"/>
</channels>
<properties>
<property name="protocol">ASCII_V2</property>
</properties>
<config-description-ref uri="thing-type:rotel:serial"/>
</thing-type>
</thing:thing-descriptions>

View File

@@ -0,0 +1,30 @@
<?xml version="1.0" encoding="UTF-8"?>
<thing:thing-descriptions bindingId="rotel"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:thing="https://openhab.org/schemas/thing-description/v1.0.0"
xsi:schemaLocation="https://openhab.org/schemas/thing-description/v1.0.0 https://openhab.org/schemas/thing-description-1.0.0.xsd">
<!-- Rotel A14 Connection Thing Type -->
<thing-type id="a14">
<label>A14 Integrated Amplifier</label>
<description>Connection to the Rotel A14 integrated amplifier</description>
<channels>
<channel id="power" typeId="system.power"/>
<channel id="source" typeId="source"/>
<channel id="volume" typeId="system.volume"/>
<channel id="mute" typeId="system.mute"/>
<channel id="bass" typeId="bass"/>
<channel id="treble" typeId="treble"/>
<channel id="frequency" typeId="frequency"/>
<channel id="brightness" typeId="brightness"/>
</channels>
<properties>
<property name="protocol">ASCII_V2</property>
</properties>
<config-description-ref uri="thing-type:rotel:serialandip"/>
</thing-type>
</thing:thing-descriptions>

View File

@@ -0,0 +1,26 @@
<?xml version="1.0" encoding="UTF-8"?>
<thing:thing-descriptions bindingId="rotel"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:thing="https://openhab.org/schemas/thing-description/v1.0.0"
xsi:schemaLocation="https://openhab.org/schemas/thing-description/v1.0.0 https://openhab.org/schemas/thing-description-1.0.0.xsd">
<!-- Rotel CD11 Connection Thing Type -->
<thing-type id="cd11">
<label>CD11 CD Player</label>
<description>Connection to the Rotel CD11 CD player</description>
<channels>
<channel id="power" typeId="system.power"/>
<channel id="playControl" typeId="system.media-control"/>
<channel id="track" typeId="track"/>
<channel id="brightness" typeId="brightness"/>
</channels>
<properties>
<property name="protocol">ASCII_V2</property>
</properties>
<config-description-ref uri="thing-type:rotel:serial"/>
</thing-type>
</thing:thing-descriptions>

View File

@@ -0,0 +1,26 @@
<?xml version="1.0" encoding="UTF-8"?>
<thing:thing-descriptions bindingId="rotel"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:thing="https://openhab.org/schemas/thing-description/v1.0.0"
xsi:schemaLocation="https://openhab.org/schemas/thing-description/v1.0.0 https://openhab.org/schemas/thing-description-1.0.0.xsd">
<!-- Rotel CD14 Connection Thing Type -->
<thing-type id="cd14">
<label>CD14 CD Player</label>
<description>Connection to the Rotel CD14 CD player</description>
<channels>
<channel id="power" typeId="system.power"/>
<channel id="playControl" typeId="system.media-control"/>
<channel id="track" typeId="track"/>
<channel id="brightness" typeId="brightness"/>
</channels>
<properties>
<property name="protocol">ASCII_V2</property>
</properties>
<config-description-ref uri="thing-type:rotel:serial"/>
</thing-type>
</thing:thing-descriptions>

View File

@@ -0,0 +1,200 @@
<?xml version="1.0" encoding="UTF-8"?>
<thing:thing-descriptions bindingId="rotel"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:thing="https://openhab.org/schemas/thing-description/v1.0.0"
xsi:schemaLocation="https://openhab.org/schemas/thing-description/v1.0.0 https://openhab.org/schemas/thing-description-1.0.0.xsd">
<channel-group-type id="mainZoneType1">
<label>Main Zone</label>
<description>The controls of the main zone</description>
<channels>
<channel id="power" typeId="system.power"/>
<channel id="source" typeId="source"/>
<channel id="recordSource" typeId="recordSource"/>
<channel id="dsp" typeId="dsp"/>
<channel id="volume" typeId="system.volume"/>
<channel id="mute" typeId="system.mute"/>
<channel id="bass" typeId="bass"/>
<channel id="treble" typeId="treble"/>
<channel id="line1" typeId="frontPanelLine"/>
<channel id="line2" typeId="frontPanelLine"/>
</channels>
</channel-group-type>
<channel-group-type id="mainZoneType2">
<label>Main Zone</label>
<description>The controls of the main zone</description>
<channels>
<channel id="power" typeId="system.power"/>
<channel id="source" typeId="source"/>
<channel id="recordSource" typeId="recordSource"/>
<channel id="dsp" typeId="dsp"/>
<channel id="volume" typeId="system.volume"/>
<channel id="mute" typeId="system.mute"/>
<channel id="line1" typeId="frontPanelLine"/>
<channel id="line2" typeId="frontPanelLine"/>
</channels>
</channel-group-type>
<channel-group-type id="mainZoneType3">
<label>Main Zone</label>
<description>The controls of the main zone</description>
<channels>
<channel id="power" typeId="system.power"/>
<channel id="source" typeId="source"/>
<channel id="recordSource" typeId="recordSource"/>
<channel id="dsp" typeId="dsp"/>
<channel id="volume" typeId="system.volume"/>
<channel id="mute" typeId="system.mute"/>
<channel id="bass" typeId="bass"/>
<channel id="treble" typeId="treble"/>
<channel id="line1" typeId="frontPanelLine"/>
</channels>
</channel-group-type>
<channel-group-type id="mainZoneType4">
<label>Main Zone</label>
<description>The controls of the main zone</description>
<channels>
<channel id="power" typeId="system.power"/>
<channel id="source" typeId="source"/>
<channel id="recordSource" typeId="recordSource"/>
<channel id="dsp" typeId="dsp"/>
<channel id="volumeUpDown" typeId="volumeUpDown"/>
<channel id="mute" typeId="system.mute"/>
<channel id="bass" typeId="bass"/>
<channel id="treble" typeId="treble"/>
<channel id="line1" typeId="frontPanelLine"/>
<channel id="line2" typeId="frontPanelLine"/>
</channels>
</channel-group-type>
<channel-group-type id="mainZoneType5">
<label>Main Zone</label>
<description>The controls of the main zone</description>
<channels>
<channel id="power" typeId="system.power"/>
<channel id="source" typeId="source"/>
<channel id="recordSource" typeId="recordSource"/>
<channel id="dsp" typeId="dsp"/>
<channel id="volumeUpDown" typeId="volumeUpDown"/>
<channel id="mute" typeId="system.mute"/>
<channel id="bass" typeId="bass"/>
<channel id="treble" typeId="treble"/>
<channel id="line1" typeId="frontPanelLine"/>
</channels>
</channel-group-type>
<channel-group-type id="zone2type1">
<label>Zone 2</label>
<description>The controls of the zone 2</description>
<channels>
<channel id="power" typeId="system.power"/>
<channel id="source" typeId="source"/>
<channel id="volume" typeId="system.volume"/>
<channel id="mute" typeId="system.mute"/>
</channels>
</channel-group-type>
<channel-group-type id="zone2type2">
<label>Zone 2</label>
<description>The controls of the zone 2</description>
<channels>
<channel id="power" typeId="system.power"/>
<channel id="source" typeId="source"/>
<channel id="volumeUpDown" typeId="volumeUpDown"/>
</channels>
</channel-group-type>
<channel-group-type id="zone3">
<label>Zone 3</label>
<description>The controls of the zone 3</description>
<channels>
<channel id="power" typeId="system.power"/>
<channel id="source" typeId="source"/>
<channel id="volume" typeId="system.volume"/>
<channel id="mute" typeId="system.mute"/>
</channels>
</channel-group-type>
<channel-group-type id="zone4">
<label>Zone 4</label>
<description>The controls of the zone 4</description>
<channels>
<channel id="power" typeId="system.power"/>
<channel id="source" typeId="source"/>
<channel id="volume" typeId="system.volume"/>
<channel id="mute" typeId="system.mute"/>
</channels>
</channel-group-type>
<channel-type id="source">
<item-type>String</item-type>
<label>Source Input</label>
<description>Select the source input</description>
</channel-type>
<channel-type id="recordSource" advanced="true">
<item-type>String</item-type>
<label>Record Source</label>
<description>Select the source to be recorded</description>
</channel-type>
<channel-type id="dsp">
<item-type>String</item-type>
<label>DSP Mode</label>
<description>Select the DSP mode</description>
</channel-type>
<channel-type id="volumeUpDown">
<item-type>Number</item-type>
<label>Volume</label>
<description>Increase or decrease the volume</description>
<category>SoundVolume</category>
<state pattern="%d" readOnly="false"/>
<autoUpdatePolicy>veto</autoUpdatePolicy>
</channel-type>
<channel-type id="bass" advanced="true">
<item-type>Number</item-type>
<label>Bass Adjustment</label>
<description>Adjust the bass</description>
<state pattern="%d" readOnly="false"/>
<autoUpdatePolicy>veto</autoUpdatePolicy>
</channel-type>
<channel-type id="treble" advanced="true">
<item-type>Number</item-type>
<label>Treble Adjustment</label>
<description>Adjust the treble</description>
<state pattern="%d" readOnly="false"/>
<autoUpdatePolicy>veto</autoUpdatePolicy>
</channel-type>
<channel-type id="track" advanced="true">
<item-type>Number</item-type>
<label>Current Track</label>
<description>The current CD track number</description>
<state pattern="%d" readOnly="true"/>
</channel-type>
<channel-type id="frequency" advanced="true">
<item-type>Number</item-type>
<label>Current Frequency</label>
<description>The current frequency (in kHz) for digital source input</description>
<state readOnly="true"/>
</channel-type>
<channel-type id="frontPanelLine" advanced="true">
<item-type>String</item-type>
<label>Front Panel Line</label>
<description>The line content displayed on the device front panel</description>
</channel-type>
<channel-type id="brightness" advanced="true">
<item-type>Dimmer</item-type>
<label>Front Panel Display Brightness</label>
<description>The backlight brightness level (in %) of the device front panel</description>
</channel-type>
</thing:thing-descriptions>

View File

@@ -0,0 +1,31 @@
<?xml version="1.0" encoding="UTF-8"?>
<thing:thing-descriptions bindingId="rotel"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:thing="https://openhab.org/schemas/thing-description/v1.0.0"
xsi:schemaLocation="https://openhab.org/schemas/thing-description/v1.0.0 https://openhab.org/schemas/thing-description-1.0.0.xsd">
<!-- Rotel RA-11 Connection Thing Type -->
<thing-type id="ra11">
<label>RA-11 Integrated Amplifier</label>
<description>Connection to the Rotel RA-11 integrated amplifier</description>
<channels>
<channel id="power" typeId="system.power"/>
<channel id="source" typeId="source"/>
<channel id="volume" typeId="system.volume"/>
<channel id="mute" typeId="system.mute"/>
<channel id="bass" typeId="bass"/>
<channel id="treble" typeId="treble"/>
<channel id="playControl" typeId="system.media-control"/>
<channel id="frequency" typeId="frequency"/>
<channel id="brightness" typeId="brightness"/>
</channels>
<properties>
<property name="protocol">ASCII_V1</property>
</properties>
<config-description-ref uri="thing-type:rotel:serial"/>
</thing-type>
</thing:thing-descriptions>

View File

@@ -0,0 +1,31 @@
<?xml version="1.0" encoding="UTF-8"?>
<thing:thing-descriptions bindingId="rotel"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:thing="https://openhab.org/schemas/thing-description/v1.0.0"
xsi:schemaLocation="https://openhab.org/schemas/thing-description/v1.0.0 https://openhab.org/schemas/thing-description-1.0.0.xsd">
<!-- Rotel RA-12 Connection Thing Type -->
<thing-type id="ra12">
<label>RA-12 Integrated Amplifier</label>
<description>Connection to the Rotel RA-12 integrated amplifier</description>
<channels>
<channel id="power" typeId="system.power"/>
<channel id="source" typeId="source"/>
<channel id="volume" typeId="system.volume"/>
<channel id="mute" typeId="system.mute"/>
<channel id="bass" typeId="bass"/>
<channel id="treble" typeId="treble"/>
<channel id="playControl" typeId="system.media-control"/>
<channel id="frequency" typeId="frequency"/>
<channel id="brightness" typeId="brightness"/>
</channels>
<properties>
<property name="protocol">ASCII_V1</property>
</properties>
<config-description-ref uri="thing-type:rotel:serial"/>
</thing-type>
</thing:thing-descriptions>

View File

@@ -0,0 +1,31 @@
<?xml version="1.0" encoding="UTF-8"?>
<thing:thing-descriptions bindingId="rotel"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:thing="https://openhab.org/schemas/thing-description/v1.0.0"
xsi:schemaLocation="https://openhab.org/schemas/thing-description/v1.0.0 https://openhab.org/schemas/thing-description-1.0.0.xsd">
<!-- Rotel RA-1570 Connection Thing Type -->
<thing-type id="ra1570">
<label>RA-1570 Integrated Amplifier</label>
<description>Connection to the Rotel RA-1570 integrated amplifier</description>
<channels>
<channel id="power" typeId="system.power"/>
<channel id="source" typeId="source"/>
<channel id="volume" typeId="system.volume"/>
<channel id="mute" typeId="system.mute"/>
<channel id="bass" typeId="bass"/>
<channel id="treble" typeId="treble"/>
<channel id="playControl" typeId="system.media-control"/>
<channel id="frequency" typeId="frequency"/>
<channel id="brightness" typeId="brightness"/>
</channels>
<properties>
<property name="protocol">ASCII_V1</property>
</properties>
<config-description-ref uri="thing-type:rotel:serial"/>
</thing-type>
</thing:thing-descriptions>

View File

@@ -0,0 +1,26 @@
<?xml version="1.0" encoding="UTF-8"?>
<thing:thing-descriptions bindingId="rotel"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:thing="https://openhab.org/schemas/thing-description/v1.0.0"
xsi:schemaLocation="https://openhab.org/schemas/thing-description/v1.0.0 https://openhab.org/schemas/thing-description-1.0.0.xsd">
<!-- Rotel RA-1572 Connection Thing Type -->
<thing-type id="ra1572">
<label>RA-1572 Integrated Amplifier</label>
<description>Connection to the Rotel RA-1572 integrated amplifier</description>
<channels>
<channel id="power" typeId="system.power"/>
<channel id="source" typeId="source"/>
<channel id="volume" typeId="system.volume"/>
<channel id="mute" typeId="system.mute"/>
<channel id="bass" typeId="bass"/>
<channel id="treble" typeId="treble"/>
<channel id="frequency" typeId="frequency"/>
<channel id="brightness" typeId="brightness"/>
</channels>
<config-description-ref uri="thing-type:rotel:serialandipandprotocol"/>
</thing-type>
</thing:thing-descriptions>

View File

@@ -0,0 +1,26 @@
<?xml version="1.0" encoding="UTF-8"?>
<thing:thing-descriptions bindingId="rotel"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:thing="https://openhab.org/schemas/thing-description/v1.0.0"
xsi:schemaLocation="https://openhab.org/schemas/thing-description/v1.0.0 https://openhab.org/schemas/thing-description-1.0.0.xsd">
<!-- Rotel RA-1592 Connection Thing Type -->
<thing-type id="ra1592">
<label>RA-1592 Integrated Amplifier</label>
<description>Connection to the Rotel RA-1592 integrated amplifier</description>
<channels>
<channel id="power" typeId="system.power"/>
<channel id="source" typeId="source"/>
<channel id="volume" typeId="system.volume"/>
<channel id="mute" typeId="system.mute"/>
<channel id="bass" typeId="bass"/>
<channel id="treble" typeId="treble"/>
<channel id="frequency" typeId="frequency"/>
<channel id="brightness" typeId="brightness"/>
</channels>
<config-description-ref uri="thing-type:rotel:serialandipandprotocol"/>
</thing-type>
</thing:thing-descriptions>

View File

@@ -0,0 +1,28 @@
<?xml version="1.0" encoding="UTF-8"?>
<thing:thing-descriptions bindingId="rotel"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:thing="https://openhab.org/schemas/thing-description/v1.0.0"
xsi:schemaLocation="https://openhab.org/schemas/thing-description/v1.0.0 https://openhab.org/schemas/thing-description-1.0.0.xsd">
<!-- Rotel RAP-1580 Connection Thing Type -->
<thing-type id="rap1580">
<label>RAP-1580 Surround Amplified Processor</label>
<description>Connection to the Rotel RAP-1580 surround amplified processor</description>
<channels>
<channel id="power" typeId="system.power"/>
<channel id="source" typeId="source"/>
<channel id="dsp" typeId="dsp"/>
<channel id="volume" typeId="system.volume"/>
<channel id="mute" typeId="system.mute"/>
<channel id="brightness" typeId="brightness"/>
</channels>
<properties>
<property name="protocol">ASCII_V1</property>
</properties>
<config-description-ref uri="thing-type:rotel:serialandip2"/>
</thing-type>
</thing:thing-descriptions>

View File

@@ -0,0 +1,31 @@
<?xml version="1.0" encoding="UTF-8"?>
<thing:thing-descriptions bindingId="rotel"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:thing="https://openhab.org/schemas/thing-description/v1.0.0"
xsi:schemaLocation="https://openhab.org/schemas/thing-description/v1.0.0 https://openhab.org/schemas/thing-description-1.0.0.xsd">
<!-- Rotel RC-1570 Connection Thing Type -->
<thing-type id="rc1570">
<label>RC-1570 Stereo Preamplifier</label>
<description>Connection to the Rotel RC-1570 stereo preamplifier</description>
<channels>
<channel id="power" typeId="system.power"/>
<channel id="source" typeId="source"/>
<channel id="volume" typeId="system.volume"/>
<channel id="mute" typeId="system.mute"/>
<channel id="bass" typeId="bass"/>
<channel id="treble" typeId="treble"/>
<channel id="playControl" typeId="system.media-control"/>
<channel id="frequency" typeId="frequency"/>
<channel id="brightness" typeId="brightness"/>
</channels>
<properties>
<property name="protocol">ASCII_V1</property>
</properties>
<config-description-ref uri="thing-type:rotel:serial"/>
</thing-type>
</thing:thing-descriptions>

View File

@@ -0,0 +1,26 @@
<?xml version="1.0" encoding="UTF-8"?>
<thing:thing-descriptions bindingId="rotel"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:thing="https://openhab.org/schemas/thing-description/v1.0.0"
xsi:schemaLocation="https://openhab.org/schemas/thing-description/v1.0.0 https://openhab.org/schemas/thing-description-1.0.0.xsd">
<!-- Rotel RC-1572 Connection Thing Type -->
<thing-type id="rc1572">
<label>RC-1572 Stereo Preamplifier</label>
<description>Connection to the Rotel RC-1572 stereo preamplifier</description>
<channels>
<channel id="power" typeId="system.power"/>
<channel id="source" typeId="source"/>
<channel id="volume" typeId="system.volume"/>
<channel id="mute" typeId="system.mute"/>
<channel id="bass" typeId="bass"/>
<channel id="treble" typeId="treble"/>
<channel id="frequency" typeId="frequency"/>
<channel id="brightness" typeId="brightness"/>
</channels>
<config-description-ref uri="thing-type:rotel:serialandipandprotocol"/>
</thing-type>
</thing:thing-descriptions>

View File

@@ -0,0 +1,26 @@
<?xml version="1.0" encoding="UTF-8"?>
<thing:thing-descriptions bindingId="rotel"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:thing="https://openhab.org/schemas/thing-description/v1.0.0"
xsi:schemaLocation="https://openhab.org/schemas/thing-description/v1.0.0 https://openhab.org/schemas/thing-description-1.0.0.xsd">
<!-- Rotel RC-1590 Connection Thing Type -->
<thing-type id="rc1590">
<label>RC-1590 Stereo Preamplifier</label>
<description>Connection to the Rotel RC-1590 stereo preamplifier</description>
<channels>
<channel id="power" typeId="system.power"/>
<channel id="source" typeId="source"/>
<channel id="volume" typeId="system.volume"/>
<channel id="mute" typeId="system.mute"/>
<channel id="bass" typeId="bass"/>
<channel id="treble" typeId="treble"/>
<channel id="frequency" typeId="frequency"/>
<channel id="brightness" typeId="brightness"/>
</channels>
<config-description-ref uri="thing-type:rotel:serialandipandprotocol"/>
</thing-type>
</thing:thing-descriptions>

View File

@@ -0,0 +1,25 @@
<?xml version="1.0" encoding="UTF-8"?>
<thing:thing-descriptions bindingId="rotel"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:thing="https://openhab.org/schemas/thing-description/v1.0.0"
xsi:schemaLocation="https://openhab.org/schemas/thing-description/v1.0.0 https://openhab.org/schemas/thing-description-1.0.0.xsd">
<!-- Rotel RCD-1570 Connection Thing Type -->
<thing-type id="rcd1570">
<label>RCD-1570 CD Player</label>
<description>Connection to the Rotel RCD-1570 CD player</description>
<channels>
<channel id="power" typeId="system.power"/>
<channel id="playControl" typeId="system.media-control"/>
<channel id="brightness" typeId="brightness"/>
</channels>
<properties>
<property name="protocol">ASCII_V1</property>
</properties>
<config-description-ref uri="thing-type:rotel:serial"/>
</thing-type>
</thing:thing-descriptions>

View File

@@ -0,0 +1,22 @@
<?xml version="1.0" encoding="UTF-8"?>
<thing:thing-descriptions bindingId="rotel"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:thing="https://openhab.org/schemas/thing-description/v1.0.0"
xsi:schemaLocation="https://openhab.org/schemas/thing-description/v1.0.0 https://openhab.org/schemas/thing-description-1.0.0.xsd">
<!-- Rotel RCD-1572 Connection Thing Type -->
<thing-type id="rcd1572">
<label>RCD-1572 CD Player</label>
<description>Connection to the Rotel RCD-1572 CD player</description>
<channels>
<channel id="power" typeId="system.power"/>
<channel id="playControl" typeId="system.media-control"/>
<channel id="track" typeId="track"/>
<channel id="brightness" typeId="brightness"/>
</channels>
<config-description-ref uri="thing-type:rotel:serialandprotocol"/>
</thing-type>
</thing:thing-descriptions>

View File

@@ -0,0 +1,27 @@
<?xml version="1.0" encoding="UTF-8"?>
<thing:thing-descriptions bindingId="rotel"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:thing="https://openhab.org/schemas/thing-description/v1.0.0"
xsi:schemaLocation="https://openhab.org/schemas/thing-description/v1.0.0 https://openhab.org/schemas/thing-description-1.0.0.xsd">
<!-- Rotel RCX-1500 Connection Thing Type -->
<thing-type id="rcx1500">
<label>RCX-1500 Stereo Receiver</label>
<description>Connection to the Rotel RCX-1500 stereo receiver</description>
<channels>
<channel id="power" typeId="system.power"/>
<channel id="source" typeId="source"/>
<channel id="volume" typeId="system.volume"/>
<channel id="mute" typeId="system.mute"/>
<channel id="playControl" typeId="system.media-control"/>
</channels>
<properties>
<property name="protocol">ASCII_V1</property>
</properties>
<config-description-ref uri="thing-type:rotel:serial"/>
</thing-type>
</thing:thing-descriptions>

View File

@@ -0,0 +1,26 @@
<?xml version="1.0" encoding="UTF-8"?>
<thing:thing-descriptions bindingId="rotel"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:thing="https://openhab.org/schemas/thing-description/v1.0.0"
xsi:schemaLocation="https://openhab.org/schemas/thing-description/v1.0.0 https://openhab.org/schemas/thing-description-1.0.0.xsd">
<!-- Rotel RDD-1580 Connection Thing Type -->
<thing-type id="rdd1580">
<label>RDD-1580 Stereo DAC</label>
<description>Connection to the Rotel RDD-1580 stereo DAC</description>
<channels>
<channel id="power" typeId="system.power"/>
<channel id="source" typeId="source"/>
<channel id="playControl" typeId="system.media-control"/>
<channel id="frequency" typeId="frequency"/>
</channels>
<properties>
<property name="protocol">ASCII_V1</property>
</properties>
<config-description-ref uri="thing-type:rotel:serial"/>
</thing-type>
</thing:thing-descriptions>

View File

@@ -0,0 +1,25 @@
<?xml version="1.0" encoding="UTF-8"?>
<thing:thing-descriptions bindingId="rotel"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:thing="https://openhab.org/schemas/thing-description/v1.0.0"
xsi:schemaLocation="https://openhab.org/schemas/thing-description/v1.0.0 https://openhab.org/schemas/thing-description-1.0.0.xsd">
<!-- Rotel RDG-1520 Connection Thing Type -->
<thing-type id="rdg1520">
<label>RDG-1520 Tuner</label>
<description>Connection to the Rotel RDG-1520 tuner</description>
<channels>
<channel id="power" typeId="system.power"/>
<channel id="source" typeId="source"/>
<channel id="playControl" typeId="system.media-control"/>
</channels>
<properties>
<property name="protocol">ASCII_V1</property>
</properties>
<config-description-ref uri="thing-type:rotel:serial"/>
</thing-type>
</thing:thing-descriptions>

View File

@@ -0,0 +1,24 @@
<?xml version="1.0" encoding="UTF-8"?>
<thing:thing-descriptions bindingId="rotel"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:thing="https://openhab.org/schemas/thing-description/v1.0.0"
xsi:schemaLocation="https://openhab.org/schemas/thing-description/v1.0.0 https://openhab.org/schemas/thing-description-1.0.0.xsd">
<!-- Rotel RSP-1066 Connection Thing Type -->
<thing-type id="rsp1066">
<label>RSP-1066 Surround Processor</label>
<description>Connection to the Rotel RSP-1066 surround processor</description>
<channel-groups>
<channel-group id="mainZone" typeId="mainZoneType5"/>
<channel-group id="zone2" typeId="zone2type2"/>
</channel-groups>
<properties>
<property name="protocol">HEX</property>
</properties>
<config-description-ref uri="thing-type:rotel:serial2"/>
</thing-type>
</thing:thing-descriptions>

View File

@@ -0,0 +1,24 @@
<?xml version="1.0" encoding="UTF-8"?>
<thing:thing-descriptions bindingId="rotel"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:thing="https://openhab.org/schemas/thing-description/v1.0.0"
xsi:schemaLocation="https://openhab.org/schemas/thing-description/v1.0.0 https://openhab.org/schemas/thing-description-1.0.0.xsd">
<!-- Rotel RSP-1068 Connection Thing Type -->
<thing-type id="rsp1068">
<label>RSP-1068 Surround Processor</label>
<description>Connection to the Rotel RSP-1068 surround processor</description>
<channel-groups>
<channel-group id="mainZone" typeId="mainZoneType1"/>
<channel-group id="zone2" typeId="zone2type1"/>
</channel-groups>
<properties>
<property name="protocol">HEX</property>
</properties>
<config-description-ref uri="thing-type:rotel:serial3"/>
</thing-type>
</thing:thing-descriptions>

View File

@@ -0,0 +1,26 @@
<?xml version="1.0" encoding="UTF-8"?>
<thing:thing-descriptions bindingId="rotel"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:thing="https://openhab.org/schemas/thing-description/v1.0.0"
xsi:schemaLocation="https://openhab.org/schemas/thing-description/v1.0.0 https://openhab.org/schemas/thing-description-1.0.0.xsd">
<!-- Rotel RSP-1069 Connection Thing Type -->
<thing-type id="rsp1069">
<label>RSP-1069 Surround Processor</label>
<description>Connection to the Rotel RSP-1069 surround processor</description>
<channel-groups>
<channel-group id="mainZone" typeId="mainZoneType1"/>
<channel-group id="zone2" typeId="zone2type1"/>
<channel-group id="zone3" typeId="zone3"/>
<channel-group id="zone4" typeId="zone4"/>
</channel-groups>
<properties>
<property name="protocol">HEX</property>
</properties>
<config-description-ref uri="thing-type:rotel:serial3"/>
</thing-type>
</thing:thing-descriptions>

View File

@@ -0,0 +1,24 @@
<?xml version="1.0" encoding="UTF-8"?>
<thing:thing-descriptions bindingId="rotel"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:thing="https://openhab.org/schemas/thing-description/v1.0.0"
xsi:schemaLocation="https://openhab.org/schemas/thing-description/v1.0.0 https://openhab.org/schemas/thing-description-1.0.0.xsd">
<!-- Rotel RSP-1098 Connection Thing Type -->
<thing-type id="rsp1098">
<label>RSP-1098 Surround Processor</label>
<description>Connection to the Rotel RSP-1098 surround processor</description>
<channel-groups>
<channel-group id="mainZone" typeId="mainZoneType3"/>
<channel-group id="zone2" typeId="zone2type1"/>
</channel-groups>
<properties>
<property name="protocol">HEX</property>
</properties>
<config-description-ref uri="thing-type:rotel:serial3"/>
</thing-type>
</thing:thing-descriptions>

View File

@@ -0,0 +1,26 @@
<?xml version="1.0" encoding="UTF-8"?>
<thing:thing-descriptions bindingId="rotel"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:thing="https://openhab.org/schemas/thing-description/v1.0.0"
xsi:schemaLocation="https://openhab.org/schemas/thing-description/v1.0.0 https://openhab.org/schemas/thing-description-1.0.0.xsd">
<!-- Rotel RSP-1570 Connection Thing Type -->
<thing-type id="rsp1570">
<label>RSP-1570 Surround Processor</label>
<description>Connection to the Rotel RSP-1570 surround processor</description>
<channel-groups>
<channel-group id="mainZone" typeId="mainZoneType1"/>
<channel-group id="zone2" typeId="zone2type1"/>
<channel-group id="zone3" typeId="zone3"/>
<channel-group id="zone4" typeId="zone4"/>
</channel-groups>
<properties>
<property name="protocol">HEX</property>
</properties>
<config-description-ref uri="thing-type:rotel:serial4"/>
</thing-type>
</thing:thing-descriptions>

View File

@@ -0,0 +1,26 @@
<?xml version="1.0" encoding="UTF-8"?>
<thing:thing-descriptions bindingId="rotel"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:thing="https://openhab.org/schemas/thing-description/v1.0.0"
xsi:schemaLocation="https://openhab.org/schemas/thing-description/v1.0.0 https://openhab.org/schemas/thing-description-1.0.0.xsd">
<!-- Rotel RSP-1572 Connection Thing Type -->
<thing-type id="rsp1572">
<label>RSP-1572 Surround Processor</label>
<description>Connection to the Rotel RSP-1572 surround processor</description>
<channel-groups>
<channel-group id="mainZone" typeId="mainZoneType2"/>
<channel-group id="zone2" typeId="zone2type1"/>
<channel-group id="zone3" typeId="zone3"/>
<channel-group id="zone4" typeId="zone4"/>
</channel-groups>
<properties>
<property name="protocol">HEX</property>
</properties>
<config-description-ref uri="thing-type:rotel:serial5"/>
</thing-type>
</thing:thing-descriptions>

View File

@@ -0,0 +1,28 @@
<?xml version="1.0" encoding="UTF-8"?>
<thing:thing-descriptions bindingId="rotel"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:thing="https://openhab.org/schemas/thing-description/v1.0.0"
xsi:schemaLocation="https://openhab.org/schemas/thing-description/v1.0.0 https://openhab.org/schemas/thing-description-1.0.0.xsd">
<!-- Rotel RSP-1576 Connection Thing Type -->
<thing-type id="rsp1576">
<label>RSP-1576 Surround Processor</label>
<description>Connection to the Rotel RSP-1576 surround processor</description>
<channels>
<channel id="power" typeId="system.power"/>
<channel id="source" typeId="source"/>
<channel id="dsp" typeId="dsp"/>
<channel id="volume" typeId="system.volume"/>
<channel id="mute" typeId="system.mute"/>
<channel id="brightness" typeId="brightness"/>
</channels>
<properties>
<property name="protocol">ASCII_V1</property>
</properties>
<config-description-ref uri="thing-type:rotel:serialandip2"/>
</thing-type>
</thing:thing-descriptions>

View File

@@ -0,0 +1,28 @@
<?xml version="1.0" encoding="UTF-8"?>
<thing:thing-descriptions bindingId="rotel"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:thing="https://openhab.org/schemas/thing-description/v1.0.0"
xsi:schemaLocation="https://openhab.org/schemas/thing-description/v1.0.0 https://openhab.org/schemas/thing-description-1.0.0.xsd">
<!-- Rotel RSP-1582 Connection Thing Type -->
<thing-type id="rsp1582">
<label>RSP-1582 Surround Processor</label>
<description>Connection to the Rotel RSP-1582 surround processor</description>
<channels>
<channel id="power" typeId="system.power"/>
<channel id="source" typeId="source"/>
<channel id="dsp" typeId="dsp"/>
<channel id="volume" typeId="system.volume"/>
<channel id="mute" typeId="system.mute"/>
<channel id="brightness" typeId="brightness"/>
</channels>
<properties>
<property name="protocol">ASCII_V1</property>
</properties>
<config-description-ref uri="thing-type:rotel:serialandip2"/>
</thing-type>
</thing:thing-descriptions>

View File

@@ -0,0 +1,24 @@
<?xml version="1.0" encoding="UTF-8"?>
<thing:thing-descriptions bindingId="rotel"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:thing="https://openhab.org/schemas/thing-description/v1.0.0"
xsi:schemaLocation="https://openhab.org/schemas/thing-description/v1.0.0 https://openhab.org/schemas/thing-description-1.0.0.xsd">
<!-- Rotel RSX-1055 Connection Thing Type -->
<thing-type id="rsx1055">
<label>RSX-1055 Surround Receiver</label>
<description>Connection to the Rotel RSX-1055 surround receiver</description>
<channel-groups>
<channel-group id="mainZone" typeId="mainZoneType5"/>
<channel-group id="zone2" typeId="zone2type2"/>
</channel-groups>
<properties>
<property name="protocol">HEX</property>
</properties>
<config-description-ref uri="thing-type:rotel:serial2"/>
</thing-type>
</thing:thing-descriptions>

View File

@@ -0,0 +1,24 @@
<?xml version="1.0" encoding="UTF-8"?>
<thing:thing-descriptions bindingId="rotel"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:thing="https://openhab.org/schemas/thing-description/v1.0.0"
xsi:schemaLocation="https://openhab.org/schemas/thing-description/v1.0.0 https://openhab.org/schemas/thing-description-1.0.0.xsd">
<!-- Rotel RSX-1056 Connection Thing Type -->
<thing-type id="rsx1056">
<label>RSX-1056 Surround Receiver</label>
<description>Connection to the Rotel RSX-1056 surround receiver</description>
<channel-groups>
<channel-group id="mainZone" typeId="mainZoneType3"/>
<channel-group id="zone2" typeId="zone2type1"/>
</channel-groups>
<properties>
<property name="protocol">HEX</property>
</properties>
<config-description-ref uri="thing-type:rotel:serial3"/>
</thing-type>
</thing:thing-descriptions>

View File

@@ -0,0 +1,24 @@
<?xml version="1.0" encoding="UTF-8"?>
<thing:thing-descriptions bindingId="rotel"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:thing="https://openhab.org/schemas/thing-description/v1.0.0"
xsi:schemaLocation="https://openhab.org/schemas/thing-description/v1.0.0 https://openhab.org/schemas/thing-description-1.0.0.xsd">
<!-- Rotel RSX-1057 Connection Thing Type -->
<thing-type id="rsx1057">
<label>RSX-1057 Surround Receiver</label>
<description>Connection to the Rotel RSX-1057 surround receiver</description>
<channel-groups>
<channel-group id="mainZone" typeId="mainZoneType3"/>
<channel-group id="zone2" typeId="zone2type1"/>
</channel-groups>
<properties>
<property name="protocol">HEX</property>
</properties>
<config-description-ref uri="thing-type:rotel:serial3"/>
</thing-type>
</thing:thing-descriptions>

View File

@@ -0,0 +1,26 @@
<?xml version="1.0" encoding="UTF-8"?>
<thing:thing-descriptions bindingId="rotel"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:thing="https://openhab.org/schemas/thing-description/v1.0.0"
xsi:schemaLocation="https://openhab.org/schemas/thing-description/v1.0.0 https://openhab.org/schemas/thing-description-1.0.0.xsd">
<!-- Rotel RSX-1058 Connection Thing Type -->
<thing-type id="rsx1058">
<label>RSX-1058 Surround Receiver</label>
<description>Connection to the Rotel RSX-1058 surround receiver</description>
<channel-groups>
<channel-group id="mainZone" typeId="mainZoneType3"/>
<channel-group id="zone2" typeId="zone2type1"/>
<channel-group id="zone3" typeId="zone3"/>
<channel-group id="zone4" typeId="zone4"/>
</channel-groups>
<properties>
<property name="protocol">HEX</property>
</properties>
<config-description-ref uri="thing-type:rotel:serial3"/>
</thing-type>
</thing:thing-descriptions>

View File

@@ -0,0 +1,24 @@
<?xml version="1.0" encoding="UTF-8"?>
<thing:thing-descriptions bindingId="rotel"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:thing="https://openhab.org/schemas/thing-description/v1.0.0"
xsi:schemaLocation="https://openhab.org/schemas/thing-description/v1.0.0 https://openhab.org/schemas/thing-description-1.0.0.xsd">
<!-- Rotel RSX-1065 Connection Thing Type -->
<thing-type id="rsx1065">
<label>RSX-1065 Surround Receiver</label>
<description>Connection to the Rotel RSX-1065 surround receiver</description>
<channel-groups>
<channel-group id="mainZone" typeId="mainZoneType4"/>
<channel-group id="zone2" typeId="zone2type2"/>
</channel-groups>
<properties>
<property name="protocol">HEX</property>
</properties>
<config-description-ref uri="thing-type:rotel:serial2"/>
</thing-type>
</thing:thing-descriptions>

View File

@@ -0,0 +1,24 @@
<?xml version="1.0" encoding="UTF-8"?>
<thing:thing-descriptions bindingId="rotel"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:thing="https://openhab.org/schemas/thing-description/v1.0.0"
xsi:schemaLocation="https://openhab.org/schemas/thing-description/v1.0.0 https://openhab.org/schemas/thing-description-1.0.0.xsd">
<!-- Rotel RSX-1067 Connection Thing Type -->
<thing-type id="rsx1067">
<label>RSX-1067 Surround Receiver</label>
<description>Connection to the Rotel RSX-1067 surround receiver</description>
<channel-groups>
<channel-group id="mainZone" typeId="mainZoneType1"/>
<channel-group id="zone2" typeId="zone2type1"/>
</channel-groups>
<properties>
<property name="protocol">HEX</property>
</properties>
<config-description-ref uri="thing-type:rotel:serial3"/>
</thing-type>
</thing:thing-descriptions>

View File

@@ -0,0 +1,26 @@
<?xml version="1.0" encoding="UTF-8"?>
<thing:thing-descriptions bindingId="rotel"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:thing="https://openhab.org/schemas/thing-description/v1.0.0"
xsi:schemaLocation="https://openhab.org/schemas/thing-description/v1.0.0 https://openhab.org/schemas/thing-description-1.0.0.xsd">
<!-- Rotel RSX-1550 Connection Thing Type -->
<thing-type id="rsx1550">
<label>RSX-1550 Surround Receiver</label>
<description>Connection to the Rotel RSX-1550 surround receiver</description>
<channel-groups>
<channel-group id="mainZone" typeId="mainZoneType3"/>
<channel-group id="zone2" typeId="zone2type1"/>
<channel-group id="zone3" typeId="zone3"/>
<channel-group id="zone4" typeId="zone4"/>
</channel-groups>
<properties>
<property name="protocol">HEX</property>
</properties>
<config-description-ref uri="thing-type:rotel:serial4"/>
</thing-type>
</thing:thing-descriptions>

View File

@@ -0,0 +1,26 @@
<?xml version="1.0" encoding="UTF-8"?>
<thing:thing-descriptions bindingId="rotel"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:thing="https://openhab.org/schemas/thing-description/v1.0.0"
xsi:schemaLocation="https://openhab.org/schemas/thing-description/v1.0.0 https://openhab.org/schemas/thing-description-1.0.0.xsd">
<!-- Rotel RSX-1560 Connection Thing Type -->
<thing-type id="rsx1560">
<label>RSX-1560 Surround Receiver</label>
<description>Connection to the Rotel RSX-1560 surround receiver</description>
<channel-groups>
<channel-group id="mainZone" typeId="mainZoneType1"/>
<channel-group id="zone2" typeId="zone2type1"/>
<channel-group id="zone3" typeId="zone3"/>
<channel-group id="zone4" typeId="zone4"/>
</channel-groups>
<properties>
<property name="protocol">HEX</property>
</properties>
<config-description-ref uri="thing-type:rotel:serial4"/>
</thing-type>
</thing:thing-descriptions>

View File

@@ -0,0 +1,26 @@
<?xml version="1.0" encoding="UTF-8"?>
<thing:thing-descriptions bindingId="rotel"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:thing="https://openhab.org/schemas/thing-description/v1.0.0"
xsi:schemaLocation="https://openhab.org/schemas/thing-description/v1.0.0 https://openhab.org/schemas/thing-description-1.0.0.xsd">
<!-- Rotel RSX-1562 Connection Thing Type -->
<thing-type id="rsx1562">
<label>RSX-1562 Surround Receiver</label>
<description>Connection to the Rotel RSX-1562 surround receiver</description>
<channel-groups>
<channel-group id="mainZone" typeId="mainZoneType2"/>
<channel-group id="zone2" typeId="zone2type1"/>
<channel-group id="zone3" typeId="zone3"/>
<channel-group id="zone4" typeId="zone4"/>
</channel-groups>
<properties>
<property name="protocol">HEX</property>
</properties>
<config-description-ref uri="thing-type:rotel:serial5"/>
</thing-type>
</thing:thing-descriptions>

View File

@@ -0,0 +1,26 @@
<?xml version="1.0" encoding="UTF-8"?>
<thing:thing-descriptions bindingId="rotel"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:thing="https://openhab.org/schemas/thing-description/v1.0.0"
xsi:schemaLocation="https://openhab.org/schemas/thing-description/v1.0.0 https://openhab.org/schemas/thing-description-1.0.0.xsd">
<!-- Rotel RT-09 Connection Thing Type -->
<thing-type id="rt09">
<label>RT-09 Tuner</label>
<description>Connection to the Rotel RT-09 tuner</description>
<channels>
<channel id="power" typeId="system.power"/>
<channel id="source" typeId="source"/>
<channel id="playControl" typeId="system.media-control"/>
<channel id="brightness" typeId="brightness"/>
</channels>
<properties>
<property name="protocol">ASCII_V1</property>
</properties>
<config-description-ref uri="thing-type:rotel:serial"/>
</thing-type>
</thing:thing-descriptions>

View File

@@ -0,0 +1,25 @@
<?xml version="1.0" encoding="UTF-8"?>
<thing:thing-descriptions bindingId="rotel"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:thing="https://openhab.org/schemas/thing-description/v1.0.0"
xsi:schemaLocation="https://openhab.org/schemas/thing-description/v1.0.0 https://openhab.org/schemas/thing-description-1.0.0.xsd">
<!-- Rotel RT-11 Connection Thing Type -->
<thing-type id="rt11">
<label>RT-11 Tuner</label>
<description>Connection to the Rotel RT-11 tuner</description>
<channels>
<channel id="power" typeId="system.power"/>
<channel id="source" typeId="source"/>
<channel id="brightness" typeId="brightness"/>
</channels>
<properties>
<property name="protocol">ASCII_V1</property>
</properties>
<config-description-ref uri="thing-type:rotel:serial"/>
</thing-type>
</thing:thing-descriptions>

View File

@@ -0,0 +1,25 @@
<?xml version="1.0" encoding="UTF-8"?>
<thing:thing-descriptions bindingId="rotel"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:thing="https://openhab.org/schemas/thing-description/v1.0.0"
xsi:schemaLocation="https://openhab.org/schemas/thing-description/v1.0.0 https://openhab.org/schemas/thing-description-1.0.0.xsd">
<!-- Rotel RT-1570 Connection Thing Type -->
<thing-type id="rt1570">
<label>RT-1570 Tuner</label>
<description>Connection to the Rotel RT-1570 tuner</description>
<channels>
<channel id="power" typeId="system.power"/>
<channel id="source" typeId="source"/>
<channel id="brightness" typeId="brightness"/>
</channels>
<properties>
<property name="protocol">ASCII_V1</property>
</properties>
<config-description-ref uri="thing-type:rotel:serial"/>
</thing-type>
</thing:thing-descriptions>

View File

@@ -0,0 +1,25 @@
<?xml version="1.0" encoding="UTF-8"?>
<thing:thing-descriptions bindingId="rotel"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:thing="https://openhab.org/schemas/thing-description/v1.0.0"
xsi:schemaLocation="https://openhab.org/schemas/thing-description/v1.0.0 https://openhab.org/schemas/thing-description-1.0.0.xsd">
<!-- Rotel T11 Connection Thing Type -->
<thing-type id="t11">
<label>T11 Tuner</label>
<description>Connection to the Rotel T11 tuner</description>
<channels>
<channel id="power" typeId="system.power"/>
<channel id="source" typeId="source"/>
<channel id="brightness" typeId="brightness"/>
</channels>
<properties>
<property name="protocol">ASCII_V1</property>
</properties>
<config-description-ref uri="thing-type:rotel:serial"/>
</thing-type>
</thing:thing-descriptions>

View File

@@ -0,0 +1,25 @@
<?xml version="1.0" encoding="UTF-8"?>
<thing:thing-descriptions bindingId="rotel"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:thing="https://openhab.org/schemas/thing-description/v1.0.0"
xsi:schemaLocation="https://openhab.org/schemas/thing-description/v1.0.0 https://openhab.org/schemas/thing-description-1.0.0.xsd">
<!-- Rotel T14 Connection Thing Type -->
<thing-type id="t14">
<label>T14 Tuner</label>
<description>Connection to the Rotel T14 tuner</description>
<channels>
<channel id="power" typeId="system.power"/>
<channel id="source" typeId="source"/>
<channel id="brightness" typeId="brightness"/>
</channels>
<properties>
<property name="protocol">ASCII_V2</property>
</properties>
<config-description-ref uri="thing-type:rotel:serial"/>
</thing-type>
</thing:thing-descriptions>