Skip to content
This repository has been archived by the owner on May 7, 2020. It is now read-only.

Commit

Permalink
Initial contribution of the generic Bluetooth binding with BlueZ support
Browse files Browse the repository at this point in the history
Also-By: Chris Jackson <chris@cd-jackson.com>
Signed-off-by: Kai Kreuzer <kai@openhab.org>
  • Loading branch information
kaikreuzer committed Feb 1, 2018
1 parent da57eda commit d006f91
Show file tree
Hide file tree
Showing 60 changed files with 6,341 additions and 2 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<?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.8"/>
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
<classpathentry kind="src" path="src/main/java"/>
<classpathentry kind="lib" path="lib/tinyb-0.5.1.jar"/>
<classpathentry kind="output" path="target/classes"/>
</classpath>
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>org.eclipse.smarthome.binding.bluetooth.bluez</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,27 @@
<?xml version="1.0" encoding="UTF-8"?>
<thing:thing-descriptions bindingId="bluetooth" 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">

<bridge-type id="bluez">
<label>Bluetooth BlueZ Adapter</label>
<description>Linux built-in Bluetooth support</description>

<representation-property>address</representation-property>

<config-description>
<parameter name="address" type="text" required="true">
<label>Address</label>
<description>The Bluetooth address of the adapter in format XX:XX:XX:XX:XX:XX</description>
</parameter>
<parameter name="discovery" type="boolean">
<label>Device Discovery</label>
<description>Whether this adapter actively participates in Bluetooth device discovery</description>
<advanced>true</advanced>
<default>true</default>
</parameter>
</config-description>

</bridge-type>

</thing:thing-descriptions>
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: BlueZ Bluetooth Adapter
Bundle-SymbolicName: org.eclipse.smarthome.binding.bluetooth.bluez;singleton:=true
Bundle-Vendor: Eclipse.org/SmartHome
Bundle-Version: 0.10.0.qualifier
Bundle-RequiredExecutionEnvironment: JavaSE-1.8
Bundle-ClassPath: .,
lib/tinyb-0.5.1.jar
Bundle-NativeCode:
lib/armv6hf/libjavatinyb.so;lib/armv6hf/libtinyb.so;processor=arm;osname=linux,
*
Import-Package: org.eclipse.jdt.annotation;resolution:=optional,
org.eclipse.smarthome.binding.bluetooth,
org.eclipse.smarthome.binding.bluetooth.bluez,
org.eclipse.smarthome.binding.bluetooth.bluez.handler,
org.eclipse.smarthome.binding.bluetooth.discovery,
org.eclipse.smarthome.binding.bluetooth.notification,
org.eclipse.smarthome.config.core,
org.eclipse.smarthome.config.discovery,
org.eclipse.smarthome.core.common,
org.eclipse.smarthome.core.common.registry,
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.osgi.framework,
org.slf4j
Service-Component: OSGI-INF/*.xml
Export-Package: org.eclipse.smarthome.binding.bluetooth.bluez,
org.eclipse.smarthome.binding.bluetooth.bluez.handler
Bundle-ActivationPolicy: lazy
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
This content is produced and maintained by the Eclipse SmartHome project.

* Project home: https://eclipse.org/smarthome/

== 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/eclipse/smarthome

== Copyright Holders

See the NOTICE file distributed with the source code at
https://github.com/eclipse/smarthome/blob/master/NOTICE
for detailed information regarding copyright ownership.

== Third-party Content

TinyB Version: 0.5.1
* License: MIT License
* Project: https://github.com/intel-iot-devkit/tinyb
* Source: https://github.com/intel-iot-devkit/tinyb/tree/v0.5.1

== Third-party license(s)

=== MIT License

The MIT License (MIT)
Copyright © 2015-2016 Intel Corporation

Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:

The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/*.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
## Bluetooth BlueZ Adapter

This extension supports Bluetooth access via BlueZ on Linux (ARMv6hf).

## Supported Things

It defines the following bridge type:

| Bridge Type ID | Description |
|----------------|---------------------------------------------------------------------------|
| bluez | A Bluetooth adapter that is supported by BlueZ |


## Discovery

If BlueZ is enabled and can be accessed, all available adapters are automatically discovered.

## Bridge Configuration

The bluez bridge requires the configuration parameter `address`, which corresponds to the Bluetooth address of the adapter (in format "XX:XX:XX:XX:XX:XX").
Additionally, the parameter `discovery` can be set to true/false.When set to true, any Bluetooth device of which broadcasts are received is added to the Inbox.

## Example

This is how an BlueZ adapter can be configured textually in a *.things file:

```
Bridge bluetooth:bluez:hci0 [ address="12:34:56:78:90:AB", discovery=false ]
```
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
source..=src/main/java/
output..=target/classes
bin.includes = META-INF/,\
.,\
OSGI-INF/,\
ESH-INF/,\
NOTICE,\
lib/
Binary file not shown.
Binary file not shown.
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<?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.eclipse.smarthome.binding</groupId>
<artifactId>pom</artifactId>
<version>0.10.0-SNAPSHOT</version>
</parent>

<artifactId>org.eclipse.smarthome.binding.bluetooth.bluez</artifactId>

<name>Eclipse SmartHome BlueZ Bluetooth Adapter</name>
<packaging>eclipse-plugin</packaging>

</project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
/**
* Copyright (c) 2014,2018 Contributors to the Eclipse Foundation
*
* See the NOTICE file(s) distributed with this work for additional
* information regarding copyright ownership.
*
* 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.eclipse.smarthome.binding.bluetooth.bluez;

import org.eclipse.jdt.annotation.NonNullByDefault;
import org.eclipse.smarthome.binding.bluetooth.BluetoothBindingConstants;
import org.eclipse.smarthome.core.thing.ThingTypeUID;

/**
* The {@link BlueZAdapterConstants} class defines common constants, which are
* used across the whole binding.
*
* @author Kai Kreuzer - Initial contribution and API
*/
@NonNullByDefault
public class BlueZAdapterConstants {

// List of all Thing Type UIDs
public static final ThingTypeUID THING_TYPE_BLUEZ = new ThingTypeUID(BluetoothBindingConstants.BINDING_ID, "bluez");

// Properties
public static final String PROPERTY_ADDRESS = "address";
public static final String PROPERTY_DISCOVERY = "discovery";

}
Loading

0 comments on commit d006f91

Please sign in to comment.