sputnikdev / bluetooth-manager

Java Bluetooth Manager. A library/framework for managing bluetooth adapters, bluetooth devices, GATT services and characteristics
Apache License 2.0
93 stars 22 forks source link

BluetoothManagerBuilder Example + Questions #11

Open goncalosoares opened 6 years ago

goncalosoares commented 6 years ago

Hello sputnikdev,

Really cool BT framework you got here. :-)

I was trying to use it and I Tried to create the Bluetooth Manager but somehow I cannot include the BluetoothManagerBuilder: import org.sputnikdev.bluetooth.manager.impl.BluetoothManagerBuilder bt_manager = new BluetoothManagerBuilder().withTinyBTransport(true).build() The import fails. :-(

Also do you an example on how to to make a simple discover connect and read a characteristic? I have gotten as far as trying like this...

bt_manager.start(true) Set discoveredDevices = bt_manager.getDiscoveredDevices() discoveredDevices.each { device -> println(device.getName()) }

Am I on the right track?

Also When including the BlueGiga Lib I get a following error:

Could not find com.zsmartsystems.bluetooth.bluegiga:com.zsmartsystems.bluetooth.bluegiga:1.0.0-SNAPSHOT.

Once again, awesome framework!!! :-)

vkolotov commented 6 years ago

Hi @ElCuervoSoares, see examples here: https://github.com/sputnikdev/bluetooth-cli/tree/master/src/main/java/org/sputnikdev/bluetooth/examples

Could not find com.zsmartsystems.bluetooth.bluegiga:com.zsmartsystems.bluetooth.bluegiga:1.0.0-SNAPSHOT.

How do you include BlueGiga transport/lib?

vkolotov commented 6 years ago

Your project pom should be like that (see dependencies section, you don't have to include zsmartsystems library, it is supplied with bluegiga transport lib): https://github.com/sputnikdev/eclipse-smarthome-bluetooth-binding-bluegiga-transport/blob/master/pom.xml See update below

Also make sure that you use RELEASE versions for the references (from Maven Central repo). The framework is under a heavy development, so might be unstable.

vkolotov commented 6 years ago

Please disregard my message above in regards bluegiga dependency, I have confused it with another project. Yes, you will need to install that library locally, like that: sh .travis/install-dependencies.sh in the root folder of the https://github.com/sputnikdev/bluetooth-manager-bluegiga project.

The bluegiga library is not yet released, so we have to do this still. Although it is quite stable.

goncalosoares commented 6 years ago

Thank you for the answers... I will try it out :-)

It is still funny why I cannot import the BluetoothManagerBuilder... eventough the class is there

import org.sputnikdev.bluetooth.manager.impl.BluetoothManagerBuilder bt_manager = new BluetoothManagerBuilder().withTinyBTransport(true).build()

goncalosoares commented 6 years ago

I am importing through gradle like this: compile group: 'org.sputnikdev', name: 'bluetooth-manager', version: '1.3'

goncalosoares commented 6 years ago

I found out that if I use the 1.4-SNAPSHOT, it is there. :-)

I have now gotten the following failure: Exception in thread "main" java.lang.IllegalStateException: java.lang.IllegalStateException: Native libraries for TinyB transport could not be loaded. at org.sputnikdev.bluetooth.manager.impl.BluetoothManagerBuilder.loadTinyBTransport(BluetoothManagerBuilder.java:210)

Is there any other libraries I need installed?