Skip to content

Commit

Permalink
Initial Russound Implementation (openhab#1225)
Browse files Browse the repository at this point in the history
Signed-off-by: Tim Roberts <troberts@bigfoot.com>
  • Loading branch information
tmrobert8 committed Sep 22, 2016
1 parent a9ae5d5 commit 2f4f031
Show file tree
Hide file tree
Showing 40 changed files with 6,211 additions and 0 deletions.
7 changes: 7 additions & 0 deletions addons/binding/org.openhab.binding.russound/.classpath
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.7"/>
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
<classpathentry kind="src" path="src/main/java"/>
<classpathentry kind="output" path="target/classes"/>
</classpath>
33 changes: 33 additions & 0 deletions addons/binding/org.openhab.binding.russound/.project
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>org.openhab.binding.russound</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.pde.ManifestBuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.pde.SchemaBuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.pde.ds.core.builder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.pde.PluginNature</nature>
<nature>org.eclipse.jdt.core.javanature</nature>
</natures>
</projectDescription>
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<?xml version="1.0" encoding="UTF-8"?>
<binding:binding id="russound"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:binding="http://eclipse.org/smarthome/schemas/binding/v1.0.0"
xsi:schemaLocation="http://eclipse.org/smarthome/schemas/binding/v1.0.0 http://eclipse.org/smarthome/schemas/binding-1.0.0.xsd">

<name>Russound Binding</name>
<description>This is the binding for Russound.</description>
<author>Tim Roberts</author>

</binding:binding>
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# binding
binding.russound.name = <Your localized Binding name>
binding.russound.description = <Your localized Binding description>

# thing types
thing-type.russound.sample.label = <Your localized Thing label>
thing-type.russound.sample.description = <Your localized Thing description>

# channel types
channel-type.russound.sample-channel.label = <Your localized Channel label>
channel-type.russound.sample-channel.description = <Your localized Channel description>

Large diffs are not rendered by default.

24 changes: 24 additions & 0 deletions addons/binding/org.openhab.binding.russound/META-INF/MANIFEST.MF
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: Russound Binding
Bundle-SymbolicName: org.openhab.binding.russound;singleton:=true
Bundle-Vendor: openHAB
Bundle-Version: 2.0.0.qualifier
Bundle-RequiredExecutionEnvironment: JavaSE-1.7
Bundle-ClassPath: .
Import-Package:
com.google.common.collect;version="10.0.1",
org.apache.commons.lang;version="2.6.0",
org.eclipse.smarthome.config.core,
org.eclipse.smarthome.core.library.types,
org.eclipse.smarthome.core.thing,
org.eclipse.smarthome.core.thing.binding,
org.eclipse.smarthome.core.thing.binding.builder,
org.eclipse.smarthome.core.thing.type,
org.eclipse.smarthome.core.types,
org.openhab.binding.russound,
org.openhab.binding.russound.rio,
org.slf4j
Service-Component: OSGI-INF/*.xml
Export-Package: org.openhab.binding.russound,
org.openhab.binding.russound.rio
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
Copyright (c) 2014-2016 by the respective copyright holders.
All rights reserved. This program and the accompanying materials
are made available under the terms of the Eclipse Public License v1.0
which accompanies this distribution, and is available at
http://www.eclipse.org/legal/epl-v10.html
-->
<scr:component xmlns:scr="http://www.osgi.org/xmlns/scr/v1.1.0" immediate="true" name="binding.russound">

<implementation class="org.openhab.binding.russound.internal.RussoundHandlerFactory"/>

<service>
<provide interface="org.eclipse.smarthome.core.thing.binding.ThingHandlerFactory"/>
</service>

</scr:component>
439 changes: 439 additions & 0 deletions addons/binding/org.openhab.binding.russound/README.md

Large diffs are not rendered by default.

6 changes: 6 additions & 0 deletions addons/binding/org.openhab.binding.russound/build.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
source.. = src/main/java/
output.. = target/classes
bin.includes = META-INF/,\
.,\
OSGI-INF/,\
ESH-INF/
19 changes: 19 additions & 0 deletions addons/binding/org.openhab.binding.russound/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://maven.apache.org/POM/4.0.0" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">

<modelVersion>4.0.0</modelVersion>

<parent>
<groupId>org.openhab.binding</groupId>
<artifactId>pom</artifactId>
<version>2.0.0-SNAPSHOT</version>
</parent>

<groupId>org.openhab.binding</groupId>
<artifactId>org.openhab.binding.russound</artifactId>
<version>2.0.0-SNAPSHOT</version>

<name>Russound Binding</name>
<packaging>eclipse-plugin</packaging>

</project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
/**
* Copyright (c) 2014-2015 openHAB UG (haftungsbeschraenkt) and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*/
package org.openhab.binding.russound;

/**
* The {@link RussoundBinding} class defines common constants, which are
* used across the whole binding.
*
* @author Tim Roberts - Initial contribution
*/
public class RussoundBindingConstants {

public static final String BINDING_ID = "russound";
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
/**
* Copyright (c) 2014 openHAB UG (haftungsbeschraenkt) and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*/
package org.openhab.binding.russound.internal;

import java.util.Set;

import org.eclipse.smarthome.core.thing.Bridge;
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.openhab.binding.russound.rio.RioConstants;
import org.openhab.binding.russound.rio.bank.RioBankHandler;
import org.openhab.binding.russound.rio.controller.RioControllerHandler;
import org.openhab.binding.russound.rio.favorites.RioFavoriteHandler;
import org.openhab.binding.russound.rio.preset.RioPresetHandler;
import org.openhab.binding.russound.rio.source.RioSourceHandler;
import org.openhab.binding.russound.rio.system.RioSystemHandler;
import org.openhab.binding.russound.rio.zone.RioZoneHandler;

import com.google.common.collect.ImmutableSet;

/**
* The {@link RussoundHandlerFactory} is responsible for creating bridge and thing
* handlers.
*
* @author Tim Roberts - Initial contribution
*/
public class RussoundHandlerFactory extends BaseThingHandlerFactory {

private final static Set<ThingTypeUID> SUPPORTED_THING_TYPES_UIDS = ImmutableSet.of(RioConstants.BRIDGE_TYPE_RIO,
RioConstants.BRIDGE_TYPE_CONTROLLER, RioConstants.BRIDGE_TYPE_SOURCE, RioConstants.BRIDGE_TYPE_ZONE,
RioConstants.BRIDGE_TYPE_BANK, RioConstants.THING_TYPE_BANK_PRESET, RioConstants.THING_TYPE_ZONE_PRESET,
RioConstants.THING_TYPE_SYSTEM_FAVORITE, RioConstants.THING_TYPE_ZONE_FAVORITE);

@Override
public boolean supportsThingType(ThingTypeUID thingTypeUID) {
return SUPPORTED_THING_TYPES_UIDS.contains(thingTypeUID);
}

@Override
protected ThingHandler createHandler(Thing thing) {

ThingTypeUID thingTypeUID = thing.getThingTypeUID();

if (thingTypeUID.equals(RioConstants.BRIDGE_TYPE_RIO)) {
return new RioSystemHandler((Bridge) thing);
} else if (thingTypeUID.equals(RioConstants.BRIDGE_TYPE_CONTROLLER)) {
return new RioControllerHandler((Bridge) thing);
} else if (thingTypeUID.equals(RioConstants.BRIDGE_TYPE_SOURCE)) {
return new RioSourceHandler((Bridge) thing);
} else if (thingTypeUID.equals(RioConstants.BRIDGE_TYPE_ZONE)) {
return new RioZoneHandler((Bridge) thing);
} else if (thingTypeUID.equals(RioConstants.BRIDGE_TYPE_BANK)) {
return new RioBankHandler((Bridge) thing);
} else if (thingTypeUID.equals(RioConstants.THING_TYPE_BANK_PRESET)) {
return new RioPresetHandler(thing);
} else if (thingTypeUID.equals(RioConstants.THING_TYPE_ZONE_PRESET)) {
return new RioPresetHandler(thing);
} else if (thingTypeUID.equals(RioConstants.THING_TYPE_SYSTEM_FAVORITE)) {
return new RioFavoriteHandler(thing);
} else if (thingTypeUID.equals(RioConstants.THING_TYPE_ZONE_FAVORITE)) {
return new RioFavoriteHandler(thing);
}

return null;
}
}
Loading

0 comments on commit 2f4f031

Please sign in to comment.