Skip to content

Commit

Permalink
Merge pull request #1 from openhab/master
Browse files Browse the repository at this point in the history
Merge with master

Merge pull request #2 from openhab/master

Merge with master

initial contribution of the pulseaudio binding, including discovery
service

Signed-off-by: Tobias Bräutigam <[email protected]>

- check if the server is connectable before creating a bridge for it
- add binding to pom.xml

Signed-off-by: Tobias Bräutigam <[email protected]>

use real pulseaudio item names

Signed-off-by: Tobias Bräutigam <[email protected]>

- finer grained thing definitions
- sink-inputs can be rerouted

Signed-off-by: Tobias Bräutigam <[email protected]>

- fixed misdefined channel
- some code cleanup

Signed-off-by: Tobias Bräutigam <[email protected]>

the mdns bundles name has changed

Signed-off-by: Tobias Bräutigam <[email protected]>

missing part of the last commit

Signed-off-by: Tobias Bräutigam <[email protected]>

changes due to Kai´s code review

Signed-off-by: Tobias Bräutigam <[email protected]>

log message removed

Signed-off-by: Tobias Bräutigam <[email protected]>

moved client connection into a scheduled runnable

Signed-off-by: Tobias Bräutigam <[email protected]>
  • Loading branch information
peuter committed Apr 6, 2015
1 parent 6b05a95 commit 47fea44
Show file tree
Hide file tree
Showing 32 changed files with 2,548 additions and 0 deletions.
7 changes: 7 additions & 0 deletions addons/binding/org.openhab.binding.pulseaudio/.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.pulseaudio/.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.pulseaudio</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="pulseaudio"
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>Pulseaudio Binding</name>
<description>This is the binding for Pulseaudio.</description>
<author>Tobias Bräutigam</author>

</binding:binding>
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
<?xml version="1.0" encoding="UTF-8"?>
<thing:thing-descriptions bindingId="pulseaudio"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:thing="http://eclipse.org/smarthome/schemas/thing-description/v1.0.0"
xsi:schemaLocation="http://eclipse.org/smarthome/schemas/thing-description/v1.0.0 org.eclipse.smarthome.thing-description.xsd">

<bridge-type id="bridge">
<label>Pulseaudio server</label>
<description>This bridge represents a pulseaudio server.</description>

<config-description>
<parameter name="host" type="text">
<label>Hostname</label>
<description>Hostname or IP address of the pulseaudio server</description>
<default>localhost</default>
<required>true</required>
</parameter>
<parameter name="port" type="integer">
<label>Port</label>
<description>Port of the pulseaudio server</description>
<default>4712</default>
<required>false</required>
</parameter>
<parameter name="refreshInterval" type="integer">
<label>Refresh Interval</label>
<description>The refresh interval in ms which is used to poll given pulseaudio server.</description>
<default>30000</default>
<required>false</required>
</parameter>

</config-description>
</bridge-type>

</thing:thing-descriptions>
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
<?xml version="1.0" encoding="UTF-8"?>
<thing:thing-descriptions bindingId="pulseaudio"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:thing="http://eclipse.org/smarthome/schemas/thing-description/v1.0.0"
xsi:schemaLocation="http://eclipse.org/smarthome/schemas/thing-description/v1.0.0 http://eclipse.org/smarthome/schemas/thing-description-1.0.0.xsd">

<channel-type id="volume">
<item-type>Dimmer</item-type>
<label>Volume</label>
<description>Volume of an audio item in percent</description>
<category>SoundVolume</category>
<state min="0" max="100" step="1" pattern="%d" readOnly="false">
</state>
</channel-type>
<channel-type id="mute">
<item-type>Switch</item-type>
<label>Mute</label>
<description>Mutes the device</description>
</channel-type>
<channel-type id="state" advanced="true">
<item-type>String</item-type>
<label>State</label>
<description>Current state of the device</description>
<state readOnly="true">
<options>
<option value="SUSPENDED">Suspended</option>
<option value="IDLE">Idle</option>
<option value="RUNNING">Running</option>
<option value="CORKED">Corked</option>
<option value="DRAINED">Drained</option>
</options>
</state>
</channel-type>
<channel-type id="slaves" advanced="true">
<item-type>String</item-type>
<label>Slaves</label>
<description>Slave sinks of a combined sink</description>
</channel-type>
<channel-type id="routeToSink" advanced="true">
<item-type>String</item-type>
<label>Route to sink</label>
<description>Shows the sink a sink-input is currently routed to</description>
</channel-type>
</thing:thing-descriptions>
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
<?xml version="1.0" encoding="UTF-8"?>
<thing:thing-descriptions bindingId="pulseaudio"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:thing="http://eclipse.org/smarthome/schemas/thing-description/v1.0.0"
xsi:schemaLocation="http://eclipse.org/smarthome/schemas/thing-description/v1.0.0 http://eclipse.org/smarthome/schemas/thing-description-1.0.0.xsd">

<!-- Sample Thing Type -->
<thing-type id="combinedSink">
<supported-bridge-type-refs>
<bridge-type-ref id="bridge" />
</supported-bridge-type-refs>
<label>A Pulseaudio Combined Sink</label>
<description>represents a group of pulseaudio sinks, which are combined for synchronous audio</description>

<channels>
<channel id="volume" typeId="volume"/>
<channel id="mute" typeId="mute"/>
<channel id="state" typeId="state"/>
<channel id="slaves" typeId="slaves"/>
</channels>
<config-description>
<parameter name="name" type="text">
<label>Name</label>
<description>The name of the combined sink.</description>
<required>true</required>
</parameter>
</config-description>
</thing-type>

</thing:thing-descriptions>
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
<?xml version="1.0" encoding="UTF-8"?>
<thing:thing-descriptions bindingId="pulseaudio"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:thing="http://eclipse.org/smarthome/schemas/thing-description/v1.0.0"
xsi:schemaLocation="http://eclipse.org/smarthome/schemas/thing-description/v1.0.0 http://eclipse.org/smarthome/schemas/thing-description-1.0.0.xsd">

<!-- Sample Thing Type -->
<thing-type id="sinkInput">
<supported-bridge-type-refs>
<bridge-type-ref id="bridge" />
</supported-bridge-type-refs>
<label>A Pulseaudio sink-input</label>
<description>represents a pulseaudio sink-input</description>

<channels>
<channel id="volume" typeId="volume"/>
<channel id="mute" typeId="mute"/>
<channel id="state" typeId="state"/>
<channel id="routeToSink" typeId="routeToSink"/>
</channels>
<config-description>
<parameter name="name" type="text">
<label>Name</label>
<description>The name of one specific device.</description>
<required>true</required>
</parameter>
</config-description>
</thing-type>

</thing:thing-descriptions>
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
<?xml version="1.0" encoding="UTF-8"?>
<thing:thing-descriptions bindingId="pulseaudio"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:thing="http://eclipse.org/smarthome/schemas/thing-description/v1.0.0"
xsi:schemaLocation="http://eclipse.org/smarthome/schemas/thing-description/v1.0.0 http://eclipse.org/smarthome/schemas/thing-description-1.0.0.xsd">

<!-- Sample Thing Type -->
<thing-type id="sink">
<supported-bridge-type-refs>
<bridge-type-ref id="bridge" />
</supported-bridge-type-refs>
<label>A Pulseaudio sink</label>
<description>represents a pulseaudio sink</description>

<channels>
<channel id="volume" typeId="volume"/>
<channel id="mute" typeId="mute"/>
<channel id="state" typeId="state"/>
</channels>
<config-description>
<parameter name="name" type="text">
<label>Name</label>
<description>The name of one specific device.</description>
<required>true</required>
</parameter>
</config-description>
</thing-type>

</thing:thing-descriptions>
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
<?xml version="1.0" encoding="UTF-8"?>
<thing:thing-descriptions bindingId="pulseaudio"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:thing="http://eclipse.org/smarthome/schemas/thing-description/v1.0.0"
xsi:schemaLocation="http://eclipse.org/smarthome/schemas/thing-description/v1.0.0 http://eclipse.org/smarthome/schemas/thing-description-1.0.0.xsd">

<!-- Sample Thing Type -->
<thing-type id="sourceOutput">
<supported-bridge-type-refs>
<bridge-type-ref id="bridge" />
</supported-bridge-type-refs>
<label>A Pulseaudio source output</label>
<description>represents a pulseaudio source-output</description>

<channels>
<channel id="volume" typeId="volume"/>
<channel id="mute" typeId="mute"/>
<channel id="state" typeId="state"/>
</channels>
<config-description>
<parameter name="name" type="text">
<label>Name</label>
<description>The name of one specific device.</description>
<required>true</required>
</parameter>
</config-description>
</thing-type>

</thing:thing-descriptions>
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
<?xml version="1.0" encoding="UTF-8"?>
<thing:thing-descriptions bindingId="pulseaudio"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:thing="http://eclipse.org/smarthome/schemas/thing-description/v1.0.0"
xsi:schemaLocation="http://eclipse.org/smarthome/schemas/thing-description/v1.0.0 http://eclipse.org/smarthome/schemas/thing-description-1.0.0.xsd">

<!-- Sample Thing Type -->
<thing-type id="source">
<supported-bridge-type-refs>
<bridge-type-ref id="bridge" />
</supported-bridge-type-refs>
<label>A Pulseaudio source</label>
<description>represents a pulseaudio source</description>

<channels>
<channel id="volume" typeId="volume"/>
<channel id="mute" typeId="mute"/>
<channel id="state" typeId="state"/>
</channels>
<config-description>
<parameter name="name" type="text">
<label>Name</label>
<description>The name of one specific device.</description>
<required>true</required>
</parameter>
</config-description>
</thing-type>

</thing:thing-descriptions>
27 changes: 27 additions & 0 deletions addons/binding/org.openhab.binding.pulseaudio/META-INF/MANIFEST.MF
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: Pulseaudio Binding
Bundle-SymbolicName: org.openhab.binding.pulseaudio;singleton:=true
Bundle-Vendor: openHAB
Bundle-Version: 2.0.0.qualifier
Bundle-RequiredExecutionEnvironment: JavaSE-1.7
Bundle-ClassPath: .
Import-Package: com.google.common.collect,
javax.jmdns,
org.apache.commons.lang,
org.eclipse.smarthome.config.core,
org.eclipse.smarthome.config.discovery,
org.eclipse.smarthome.core.library.types,
org.eclipse.smarthome.core.thing,
org.eclipse.smarthome.core.thing.binding,
org.eclipse.smarthome.core.types,
org.eclipse.smarthome.io.transport.mdns.discovery,
org.jupnp,
org.jupnp.model,
org.jupnp.model.meta,
org.jupnp.model.types,
org.osgi.framework,
org.slf4j
Service-Component: OSGI-INF/*.xml
Export-Package: org.openhab.binding.pulseaudio,
org.openhab.binding.pulseaudio.handler
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
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
-->
<scr:component xmlns:scr="http://www.osgi.org/xmlns/scr/v1.1.0" immediate="true" name="org.openhab.binding.pulseaudio.internal.discovery">
<implementation class="org.openhab.binding.pulseaudio.internal.discovery.PulseaudioDiscoveryParticipant"/>
<service>
<provide interface="org.eclipse.smarthome.io.transport.mdns.discovery.MDNSDiscoveryParticipant"/>
</service>
</scr:component>
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
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
-->
<scr:component xmlns:scr="http://www.osgi.org/xmlns/scr/v1.1.0" immediate="true" name="org.openhab.binding.pulseaudio.internal.PulseaudioHandlerFactory">

<implementation class="org.openhab.binding.pulseaudio.internal.PulseaudioHandlerFactory"/>

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

</scr:component>
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/
24 changes: 24 additions & 0 deletions addons/binding/org.openhab.binding.pulseaudio/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
<?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</groupId>
<artifactId>binding</artifactId>
<version>2.0.0-SNAPSHOT</version>
</parent>

<properties>
<bundle.symbolicName>org.openhab.binding.pulseaudio</bundle.symbolicName>
<bundle.namespace>org.openhab.binding.pulseaudio</bundle.namespace>
</properties>

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

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

</project>
Loading

0 comments on commit 47fea44

Please sign in to comment.