-
-
Notifications
You must be signed in to change notification settings - Fork 3.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[nuvo] Nuvo Whole House Audio Binding - initial contribution (#7651)
Signed-off-by: Michael Lobstein <[email protected]>
- Loading branch information
Showing
30 changed files
with
3,096 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<classpath> | ||
<classpathentry kind="src" output="target/classes" path="src/main/java"> | ||
<attributes> | ||
<attribute name="optional" value="true"/> | ||
<attribute name="maven.pomderived" value="true"/> | ||
</attributes> | ||
</classpathentry> | ||
<classpathentry excluding="**" kind="src" output="target/classes" path="src/main/resources"> | ||
<attributes> | ||
<attribute name="maven.pomderived" value="true"/> | ||
</attributes> | ||
</classpathentry> | ||
<classpathentry kind="src" output="target/test-classes" path="src/test/java"> | ||
<attributes> | ||
<attribute name="optional" value="true"/> | ||
<attribute name="maven.pomderived" value="true"/> | ||
<attribute name="test" value="true"/> | ||
</attributes> | ||
</classpathentry> | ||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8"> | ||
<attributes> | ||
<attribute name="maven.pomderived" value="true"/> | ||
</attributes> | ||
</classpathentry> | ||
<classpathentry kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER"> | ||
<attributes> | ||
<attribute name="maven.pomderived" value="true"/> | ||
</attributes> | ||
</classpathentry> | ||
<classpathentry kind="output" path="target/classes"/> | ||
</classpath> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<projectDescription> | ||
<name>org.openhab.binding.nuvo</name> | ||
<comment></comment> | ||
<projects> | ||
</projects> | ||
<buildSpec> | ||
<buildCommand> | ||
<name>org.eclipse.jdt.core.javabuilder</name> | ||
<arguments> | ||
</arguments> | ||
</buildCommand> | ||
<buildCommand> | ||
<name>org.eclipse.m2e.core.maven2Builder</name> | ||
<arguments> | ||
</arguments> | ||
</buildCommand> | ||
</buildSpec> | ||
<natures> | ||
<nature>org.eclipse.jdt.core.javanature</nature> | ||
<nature>org.eclipse.m2e.core.maven2Nature</nature> | ||
</natures> | ||
</projectDescription> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
This content is produced and maintained by the openHAB project. | ||
|
||
* Project home: https://www.openhab.org | ||
|
||
== Declared Project Licenses | ||
|
||
This program and the accompanying materials are made available under the terms | ||
of the Eclipse Public License 2.0 which is available at | ||
https://www.eclipse.org/legal/epl-2.0/. | ||
|
||
== Source Code | ||
|
||
https://github.com/openhab/openhab-addons |
Large diffs are not rendered by default.
Oops, something went wrong.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
<?xml version="1.0" encoding="UTF-8" standalone="no"?> | ||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> | ||
|
||
<modelVersion>4.0.0</modelVersion> | ||
|
||
<parent> | ||
<groupId>org.openhab.addons.bundles</groupId> | ||
<artifactId>org.openhab.addons.reactor.bundles</artifactId> | ||
<version>2.5.9-SNAPSHOT</version> | ||
</parent> | ||
|
||
<artifactId>org.openhab.binding.nuvo</artifactId> | ||
|
||
<name>openHAB Add-ons :: Bundles :: Nuvo Binding</name> | ||
|
||
</project> |
10 changes: 10 additions & 0 deletions
10
bundles/org.openhab.binding.nuvo/src/main/feature/feature.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<features name="org.openhab.binding.nuvo-${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-nuvo" description="Nuvo Whole House Audio 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.nuvo/${project.version}</bundle> | ||
</feature> | ||
</features> |
27 changes: 27 additions & 0 deletions
27
...enhab.binding.nuvo/src/main/java/org/openhab/binding/nuvo/internal/INuvoThingActions.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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.nuvo.internal; | ||
|
||
import org.eclipse.jdt.annotation.NonNullByDefault; | ||
|
||
/** | ||
* The {@link INuvoThingActions} defines the interface for all thing actions supported by the binding. | ||
* These methods, parameters, and return types are explained in {@link NuvoThingActions}. | ||
* | ||
* @author Michael Lobstein - Initial contribution | ||
*/ | ||
@NonNullByDefault | ||
public interface INuvoThingActions { | ||
|
||
void sendNuvoCommand(String rawCommand); | ||
} |
85 changes: 85 additions & 0 deletions
85
...ab.binding.nuvo/src/main/java/org/openhab/binding/nuvo/internal/NuvoBindingConstants.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,85 @@ | ||
/** | ||
* 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.nuvo.internal; | ||
|
||
import org.eclipse.jdt.annotation.NonNullByDefault; | ||
import org.eclipse.smarthome.core.thing.ThingTypeUID; | ||
|
||
/** | ||
* The {@link NuvoBindingConstants} class defines common constants, which are | ||
* used across the whole binding. | ||
* | ||
* @author Michael Lobstein - Initial contribution | ||
*/ | ||
@NonNullByDefault | ||
public class NuvoBindingConstants { | ||
|
||
public static final String BINDING_ID = "nuvo"; | ||
|
||
// List of all Thing Type UIDs | ||
public static final ThingTypeUID THING_TYPE_AMP = new ThingTypeUID(BINDING_ID, "amplifier"); | ||
|
||
// List of all Channel types | ||
// system | ||
public static final String CHANNEL_TYPE_ALLOFF = "alloff"; | ||
public static final String CHANNEL_TYPE_ALLMUTE = "allmute"; | ||
public static final String CHANNEL_TYPE_PAGE = "page"; | ||
public static final String CHANNEL_TYPE_SENDCMD = "sendcmd"; | ||
|
||
// zone | ||
public static final String CHANNEL_TYPE_POWER = "power"; | ||
public static final String CHANNEL_TYPE_SOURCE = "source"; | ||
public static final String CHANNEL_TYPE_VOLUME = "volume"; | ||
public static final String CHANNEL_TYPE_MUTE = "mute"; | ||
public static final String CHANNEL_TYPE_CONTROL = "control"; | ||
public static final String CHANNEL_TYPE_TREBLE = "treble"; | ||
public static final String CHANNEL_TYPE_BASS = "bass"; | ||
public static final String CHANNEL_TYPE_BALANCE = "balance"; | ||
public static final String CHANNEL_TYPE_LOUDNESS = "loudness"; | ||
public static final String CHANNEL_TYPE_DND = "dnd"; | ||
public static final String CHANNEL_TYPE_LOCK = "lock"; | ||
public static final String CHANNEL_TYPE_PARTY = "party"; | ||
|
||
// source | ||
public static final String CHANNEL_DISPLAY_LINE = "display_line"; | ||
public static final String CHANNEL_DISPLAY_LINE1 = "display_line1"; | ||
public static final String CHANNEL_DISPLAY_LINE2 = "display_line2"; | ||
public static final String CHANNEL_DISPLAY_LINE3 = "display_line3"; | ||
public static final String CHANNEL_DISPLAY_LINE4 = "display_line4"; | ||
public static final String CHANNEL_PLAY_MODE = "play_mode"; | ||
public static final String CHANNEL_TRACK_LENGTH = "track_length"; | ||
public static final String CHANNEL_TRACK_POSITION = "track_position"; | ||
public static final String CHANNEL_BUTTON_PRESS = "button_press"; | ||
|
||
// Message types | ||
public static final String TYPE_VERSION = "version"; | ||
public static final String TYPE_ALLOFF = "alloff"; | ||
public static final String TYPE_ALLMUTE = "allmute"; | ||
public static final String TYPE_PAGE = "page"; | ||
public static final String TYPE_SOURCE_UPDATE = "source_update"; | ||
public static final String TYPE_ZONE_UPDATE = "zone_update"; | ||
public static final String TYPE_ZONE_BUTTON = "zone_button"; | ||
public static final String TYPE_ZONE_CONFIG = "zone_config"; | ||
|
||
// misc | ||
public static final String ON = "ON"; | ||
public static final String OFF = "OFF"; | ||
public static final String ONE = "1"; | ||
public static final String ZERO = "0"; | ||
public static final String BLANK = ""; | ||
public static final String DISPLINE = "DISPLINE"; | ||
public static final String DISPINFO = "DISPINFO,"; // yes comma here | ||
public static final String NAME_QUOTE = "NAME\""; | ||
public static final String MUTE = "MUTE"; | ||
public static final String VOL = "VOL"; | ||
} |
36 changes: 36 additions & 0 deletions
36
...g.openhab.binding.nuvo/src/main/java/org/openhab/binding/nuvo/internal/NuvoException.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
/** | ||
* 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.nuvo.internal; | ||
|
||
import org.eclipse.jdt.annotation.NonNullByDefault; | ||
|
||
/** | ||
* The {@link NuvoException} class is used for any exception thrown by the binding | ||
* | ||
* @author Michael Lobstein - Initial contribution | ||
*/ | ||
@NonNullByDefault | ||
public class NuvoException extends Exception { | ||
private static final long serialVersionUID = 1L; | ||
|
||
public NuvoException() { | ||
} | ||
|
||
public NuvoException(String message, Throwable t) { | ||
super(message, t); | ||
} | ||
|
||
public NuvoException(String message) { | ||
super(message); | ||
} | ||
} |
71 changes: 71 additions & 0 deletions
71
...nhab.binding.nuvo/src/main/java/org/openhab/binding/nuvo/internal/NuvoHandlerFactory.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
/** | ||
* 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.nuvo.internal; | ||
|
||
import static org.openhab.binding.nuvo.internal.NuvoBindingConstants.*; | ||
|
||
import java.util.Collections; | ||
import java.util.Set; | ||
|
||
import org.eclipse.jdt.annotation.NonNullByDefault; | ||
import org.eclipse.jdt.annotation.Nullable; | ||
import org.eclipse.smarthome.core.thing.Thing; | ||
import org.eclipse.smarthome.core.thing.ThingTypeUID; | ||
import org.eclipse.smarthome.core.thing.binding.BaseThingHandlerFactory; | ||
import org.eclipse.smarthome.core.thing.binding.ThingHandler; | ||
import org.eclipse.smarthome.core.thing.binding.ThingHandlerFactory; | ||
import org.eclipse.smarthome.io.transport.serial.SerialPortManager; | ||
import org.openhab.binding.nuvo.internal.handler.NuvoHandler; | ||
import org.osgi.service.component.annotations.Activate; | ||
import org.osgi.service.component.annotations.Component; | ||
import org.osgi.service.component.annotations.Reference; | ||
|
||
/** | ||
* The {@link NuvoHandlerFactory} is responsible for creating things and thing | ||
* handlers. | ||
* | ||
* @author Michael Lobstein - Initial contribution | ||
*/ | ||
@NonNullByDefault | ||
@Component(configurationPid = "binding.nuvo", service = ThingHandlerFactory.class) | ||
public class NuvoHandlerFactory extends BaseThingHandlerFactory { | ||
|
||
private static final Set<ThingTypeUID> SUPPORTED_THING_TYPES_UIDS = Collections.singleton(THING_TYPE_AMP); | ||
|
||
private final SerialPortManager serialPortManager; | ||
|
||
private final NuvoStateDescriptionOptionProvider stateDescriptionProvider; | ||
|
||
@Override | ||
public boolean supportsThingType(ThingTypeUID thingTypeUID) { | ||
return SUPPORTED_THING_TYPES_UIDS.contains(thingTypeUID); | ||
} | ||
|
||
@Activate | ||
public NuvoHandlerFactory(final @Reference NuvoStateDescriptionOptionProvider provider, | ||
final @Reference SerialPortManager serialPortManager) { | ||
this.stateDescriptionProvider = provider; | ||
this.serialPortManager = serialPortManager; | ||
} | ||
|
||
@Override | ||
protected @Nullable ThingHandler createHandler(Thing thing) { | ||
ThingTypeUID thingTypeUID = thing.getThingTypeUID(); | ||
|
||
if (SUPPORTED_THING_TYPES_UIDS.contains(thingTypeUID)) { | ||
return new NuvoHandler(thing, stateDescriptionProvider, serialPortManager); | ||
} | ||
|
||
return null; | ||
} | ||
} |
41 changes: 41 additions & 0 deletions
41
...o/src/main/java/org/openhab/binding/nuvo/internal/NuvoStateDescriptionOptionProvider.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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.nuvo.internal; | ||
|
||
import org.eclipse.jdt.annotation.NonNullByDefault; | ||
import org.eclipse.smarthome.core.thing.binding.BaseDynamicStateDescriptionProvider; | ||
import org.eclipse.smarthome.core.thing.i18n.ChannelTypeI18nLocalizationService; | ||
import org.eclipse.smarthome.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 Michael Lobstein - Initial contribution | ||
*/ | ||
@Component(service = { DynamicStateDescriptionProvider.class, NuvoStateDescriptionOptionProvider.class }) | ||
@NonNullByDefault | ||
public class NuvoStateDescriptionOptionProvider extends BaseDynamicStateDescriptionProvider { | ||
|
||
@Reference | ||
protected void setChannelTypeI18nLocalizationService( | ||
final ChannelTypeI18nLocalizationService channelTypeI18nLocalizationService) { | ||
this.channelTypeI18nLocalizationService = channelTypeI18nLocalizationService; | ||
} | ||
|
||
protected void unsetChannelTypeI18nLocalizationService( | ||
final ChannelTypeI18nLocalizationService channelTypeI18nLocalizationService) { | ||
this.channelTypeI18nLocalizationService = null; | ||
} | ||
} |
Oops, something went wrong.