Bluetooth Low Energy (Bluetooth 4.0) with Android/Linux - android

Is there a library available to allow applications to utilise Bluetooth LE in Linux?
Similarly, I know the Motorola RAZR offers a proprietary API but do other devices with dual mode Bluetooth chips (i.e. Galaxy S III) offer an API for Bluetooth LE?

As for Linux...
I've been doing a lot of work with this in Python and unfortunately the existing libraries for LE are either bleeding edge or missing some things. The Bluez 5.X series has support for LE through DBUS. The kernel requirements for it were much higher than the device I needed to use so I was left having to do things by using raw sockets.
With Bluez 4.x I think everything can be done by using raw sockets, setting socket options, and very occasionally an ioctl call. In Python, however, a lot of the constants you need aren't there yet. I had to hack together some modules using the Python C API so I could import the constants from the library header files. If you're okay with doing everything in C you'll find full functionality there.

I know many people are using Broadcom BLE for developing BLE on Android devices.

Related

Implementing Internet Protocol Support Profile (IPSP) for Bluetooth Low Energy in Android

Bluetooth 4.1 introduced the Internet Protocol Support Profile, which "proposes the support of exchanging IPv6 packets between devices over the Bluetooth Low Energy transport." This Profile bypasses the regular GAP and GATT protocols and heads down directly to the L2CAP layer. It defines a "Node" and "Router" role. How would this be implemented on the Android side?
file:///Users/shreyashirday/Downloads/INT_IP_Support_Profile_SPEC_V1.0.0%20(1).pdf This was useful for an overview, but I'm not even sure current Android can support this.
I am also curious whether some Android devices support this already or not.
As for the profile, the best way to get an understanding of it is the following 2 RFC's:
https://www.rfc-editor.org/rfc/rfc4944
https://www.rfc-editor.org/rfc/rfc7668
The first one describes 6LoWPAN - IPv6 over low power networks. The second one describes how 6LoWPAN is implemented specifically over Bluetooth LE.
The Bluetooth SIG IPSP spec is light on the implementation details and just provides the framework for the details in these two RFC's.
The two implementations that are available right now seem to be BlueZ running on Linux v. 3.18 or newer, and the Nordic Semiconductor nRF52 development boards. If there are more implementations available I would like to hear about them.
Since IPSP requires L2CAP Credit-based flow control mode, also called LE Data Channels, support for this is mandatory in the Android's Bluetooth stack. It is supported by since a while blueZ.
When that's the case, there could be an internal implementation that has low-level access to the stack. If not, Android would need to support it in the higher level Java APIs.
So, you're best bet would be to get/find an Android device that can run blueZ. There, IPSP is at least in the works if not complete, see e.g. https://github.com/NordicSemiconductor/Linux-ble-6lowpan-joiner/blob/master/readme.md

Rhomobile, BLE112 Bluetooth device - iOS and android app

I have been searching for a while now and decided to post a question here to see if someone had already traveled down this specific road.
I am developing a bluetooth enabled device, using the Bluegiga BLE112 chip. They announce this chip to be easily used with iOS devices (and this was our main reason for choosing it)
The device will need to communicate with an App, that we need to be developed for iOS, Android, Windows Phone, and Blackberry. Due to this need, I've decided to use Rhomobile, as it seems to be the only one that supports developing BT apps for iOS without having to develop further plugins.
I only need to send small messages (like commands, small strings) and sometimes a bigger file to the device's internal memory.
On Rhomobile's BT documentation, they state that for iOS it is only possible to comunicate between iOS devices ( i'm thinking that they say this because of the MiFi limitations imposed by Apple, but that using Bluegigas chip are not a problem...)
My question is:
Since Bluegiga's documentation has examples of devices communicating with iOS using their chip, i should be able to develop using Rhomobile and not suffer from the limitation stated above. I wanted to be as sure as possible before making my company spend money ordering the chips and development board and what not..
Has anyone tried this, is my thinking missing something?
Thank you all for your time.
Daniel
Good Question, I think I can understand the reason for your confusion.
The main reason is many people/products/frameworks does not clearly mention if they are talking about Bluetooth Classic or Bluetooth Low Energy (BLE).
These are both 2 different things and even thougfh they are called "Bluetooth" one cannot talk to the other.
(Some devices can be both Classic and Bluetooth Low Energy, which allows it to connect to either types)
Ok now comming to your Question :
THE bluegiga dongle is BLE
The Rhomobile is refering to the Bluetooth Classic version of the API.
On iOS the BLE APIs are open to applications, but Classic is limited on iOS , one way for Apps to use Classic Bluetooth on iOS is via the Gamekit APIs but that is possible only when talking with iOS devices, so it wont connect to another Android or Win device that is also Classic.
Needless to say with BLE APIs you cannot connect to calssic anyways.
The bluegiga examples are BLE examples, and apple also has good documentation and examples / samples on how to use BLE so yes it is easy to build a device and app using BLE on iOS.
There is nothing special abut any particular chip yo ucan use any BLE chip - there are many vendors today.
BUT Android (and I guess Windows as well) does not yet have BLE APIs for applications to use :( (Bit I think is is comming soon :))
So I hope this clears things up a bit.

how to define bluetooth version a system support

Bluetooth 4.0 is same as Bluetooth 4.0 LE? , i.e. iPhone4s supports bluetooth 4.0,
does that mean iPhone4s supports bluetooth 4.0 LE ?
I know that bluetooth 3.0 != bluetooth 3.0 HS
My android phone project, msm7225A platform, bluetooth chip is WCN2243.
which version can be defined?
In short, from hardware and software aspects, how to confirm Bluetooth version
(when using bluez stack, and take android phone for an example)
it is really a problem that confusing me for a long time.
appreciate anyone give some help.
Not sure if I got your questions correctly, but maybe this helps:
Bluetooth 4.0 specifies two modes of operation: "classic" Bluetooth and "Bluetooth Low Energy (LE)". iPhone 4S's Bluetooth is dual mode, i.e. it supports both classic & LE. IOS, though, only supports programming the latter (LE) directly via the public CentralManager API. There is no way to directly access the "classic" Bluetooth stack in IOS.
The standard Android SDKs only support classic Bluetooth. If you want to use LE, this answer suggests to use a manufacturer API.
BlueZ supports LE's GATT server at least. I haven't worked with that though, so I can't tell how complete LE support is. If you're about to use BlueZ directly on Android phones, mind that this will only work if the user has root access.
To answer more generally, LE could/should also have been published without calling it "Bluetooth" at all. So to determine if the hardware/software supports classic and/or LE, you'll have to look at the specs for each platform you're targeting.

BTLE (Bluetooth Low energy) development kit - must have proximity profile

Can anyone point me towards a tried and tested development kit (board) for Bluetooth Low Energy?
I am especially interested in the proximity profile, and compatibility with smartphone (especially iPhones and Android devices - but also any other that would have BTLE).
Also, can you tell me which smartphones would support the proximity profile?
If you are looking for API support for BT LE features then there is very little at the moment. For example, Android at API16 does not support. It is all rather disappointing so far. In many instances the HW supports it but the middleware / upper layers do not. There is SOME support on iOS (with Iphone4s) and with certain Moto phones (need the SDK add on) but it is limited.
iOS is probably your best bet (who'd have thought that).
Personally I am looking to use the GAP and GATT interface on Android (ICS/JB), which is mandatory for a BT4.0 listed device (such as the BT ICs in high end smartphones) but GAP does not seem to be exposed.
Oh, and if you need a dev kit (for SW dev then this link might help > http://blog.bluetooth-smart.com/2011/10/05/bluetooth-low-energy-development-kits-2/)
The Bluegiga DKBLE112 Development Board (out of the box) can communicate with the iPhone 4S on IOS 6. The IOS code tutorials by http://olesitune.mine.nu/blelogg/?page_id=78 and http://olesitune.mine.nu/blelogg/?page_id=180 will discover the DKBLE112, the built-in thermometer service, and the associated characteristics. The code displays the BLE information on the iPhone and in the Xcode Console if the iPhone is tethered through USB. The DKBLE112 is expensive (nearly $400) but it does include many capabilities that I have not yet explored.
I note that tod list devices that have BT4.0 functionality. Of course that does not guarantee that APIs will be exposed in the SDK. If you stick with an already implemented profile then you may be ok but as I said, you certainly will not find that in the Android API16. SO, custom implementations.
One of the nice things with BT LE is that profiles are relatively "light" and hence, you can pretty easily make your own...but if the phone side API does not give access to the lower level (only talking GAP and GATT here) then not much use..
The guys who produce the tod seem to have done pretty well with a BLE device that functions as a proximity sensor.
They've managed to get their device working on the following phones:
iPhone 4s, Droid Razr and Razr Maxx, Samsung Galaxy S3, HTC One S, X, V, LG Optimus LTE2, Droid 4, Droid Incredible 4G LTE, HTC EVO 4g LTE, HTC Desire C, Sony Xperia GX, Sony Xperia SX, ASUS PadFone
So it is possible. My recommendation for a dev kit is the Bluegiga BLE112 with a CC Debugger from Texas Instruments. Your options for programming are either the $4,000 IAR compiler, the proprietary Bluegiga API "BGScript" (if you don't have access to IAR), or use an external microcontroller with the compiler of your choice.
I am using a TI ez430-rf256x development kit with "IAR Embedded Workbench for MSP430 v5.51.5". When TI 1st released the ez430, they were using a crappy stack that was buggy and just wasn't capable. They have now switched to a Bluetopia based stack and it is great! It comes with a LOT of samples, supports ALL profiles (including all the new low energy profiles), and is easy to use. I believe the Bluetopia stack also supports I have it talking to my Galaxy Nexus over classic bluetooth, but unfortunately, as of Android 4.2.2, there is still no support for Bluetooth low energy (which the ez430 does support.) It appears that Google may address this issue in Android 4.2.3. In my opinion, there is no reason to use something like Bluegiga, as you will pay more in licensing costs to them, than you will spend on a compiler like IAR. This is a link to an explanation of the new stack that TI is using: http://www.stonestreetone.com/bluetopiaLE.cfm
I realize this is an old question and in disclosure I am a developer on this project: Anaren Atmosphere.
Anaren has produced a Bluetooth Smart Multi-Sensor Development Board with the A27037 module based on the Broadcom BCM27037 that is compatible with the Wiced SDK. It also features an online development environment that is a GUI/IDE that allows you to both program the module and create associated iOS and android applications to communicate with it.
The development kit is available from various distributors and the development tool is free to use.

Bluetooth Smart (4.0) / GATT support in Android 4.0?

I'm trying to find way to work with Bluetooth 4.0 (AKA Bluetooth Smart) devices using modern Android smartphones, namely - HTC One V.
As I understood, there is some issues using GATT profile even in Android 4.0 with Bluetooth 4.0 hardware because of API limitations.
I saw Motorola released it's own API for BT LE, but not sure it will work for other vendors.
My goal is to get universal support for all smartphones with appropriate hardware.
Any suggestion for solution are highly appreciated.
Alexey
PS: Yes, I saw Android API for HDP, but it seems to be used only with 'classic' Bluetooth devices (not low energy ones, as BT LE does).
Unfortunately there are no Android native GATT APIs simply because Android currently does not support Bluetooth Low Energy at all. This may change in upcoming Android releases, but today manufacturers instead integrate 3rd party Bluetooth stacks with Low Energy support from vendors like Qualcomm, Broadcom or CSR. Those come with their own set of APIs, obviously limiting compatibility to the set of phones using that particular vendor's stack.
The good news is that on other platforms like iOS or Windows 8 there are native GATT BLE APIs, and those are well supported. For Android, we will have to wait until Google decides to integrate the Linux/BlueZ work that has been done on BLE with Android.
After some research I can only say this:
Motorola has sided with Broadcom to develop a proprietary API. It would seem it is extremely limited since it states there's support for existing profiles only. Check it out here.
Samsung fails to provide any information regarding its BLE API, which I can verify exists and is called samsung.bluetoothle. I actually decompiled some apps from Google Play that use the SGSIII's BLE capabilities and found a couple of methods that do not exist in Android's native BT API, and they're names clearly state they're BLE related. I've tried using them through java reflection and am currently working out the possibility of developing a library. But tests I've run so far have had shakey results at best. There is also a thread on Samsung's developer forum, I would suggest making some pressure here if you're interested.
Google has made almost no remarks in this aspect. There's a thread regarding this issues in the Galaxy Nexus, which you should star, with a lot of people complaining. The closest thing to an answer from Google can be found here.
[UPDATE]
Samsung has also modified a couple of Android's classes, more especifically:
BluetoothAdapter
BluetoothDevice
[UPDATE]
Since I've put this issue aside for a while due to lack of support from both Google and Samsung I'll post what I've learned so far:
BluetoothAdapter new methods:
public boolean android.bluetooth.BluetoothAdapter.leTestEnd()
public boolean android.bluetooth.BluetoothAdapter.setAvStreaming(boolean)
public boolean android.bluetooth.BluetoothAdapter.setScanLE(boolean)
public void android.bluetooth.BluetoothAdapter.setScoPathChange(int)
public boolean android.bluetooth.BluetoothAdapter.startLeDiscovery()
To use them do the following:
BluetoothAdapter ba = new BluetoothAdapter();
Method starteLeDiscoveryMethod = null;
starteLeDiscoveryMethod = ba.class.getMethod("startLeDiscovery");
starteLeDiscoveryMethod.invoke(ba);
NOTE: This method in particular works somewhat like the regular startDiscovery() method but, at least for me, it discovers the BLE device 2 out of 5 times.
And remember, this is only for the SGSIII. I haven't gotten around to extracting the new methods in BluetoothDevice but when I do, I'll post them here.
SDK 18 has support for it now. Docs are here:
http://developer.android.com/guide/topics/connectivity/bluetooth-le.html
Testing on my Nexus 4 is crashing the bluetooth stack.
HTC has had BLE support since last year with HTC One X+, Droid DNA and of course the HTC One. Initially the HTC BLE API was upon request but it's now been freely downloadable at http://htcdev.com.
Yes the new standard Android BLE API from Google in Android API Level 18 is coming very soon (see preview from IO video) - but you can wrap third party APIs (HTC, Samsung, etc) in a compatible way to support the new standard API as all the APIs are quite similar in their support of the GATT profile (similar to IOS).
BluetoothGatt api available in andorid
https://developer.android.com/reference/android/bluetooth/BluetoothGatt.html
As discovered, 4.3 has support for BLE, but it so broken, especially on Nexus devices.
At my opinion, it's not ready for production.

Categories

Resources