android connections problems with cc2540 - android

I am developing a very simple App for a final year Degree project, It's a simple Proximity Application where once a Bluetooth device moves beyond the range, it creates a supervisor timeout which triggers an alarm.
My main problem is actually trying to make a connection with a TI CC2540 (KeyFob). I have loaded the demo software as provided by TI, all works well with Btool etc. and I am using a HTC Desire C (ICS, BT4.0), which does pair with the CC2540. I have put together an APP, but have recently downloaded the BTChat Example from the Android SDK. The Example App recognises the Keyfob, and even gets the correct Mac Address but as soon as I try to connect with it, it doesn't connect (Establish a Link). I have carried out a lot of research and thought my problem may lie in the area of the UUID (128) but I am unable to find the correct UUID for the device. Incidentally I have used the common one from the Android Dev Website, plus derivatives but with no success.
I eventually found an existing App for an Iphone (Bluetooth Smart Scanner) which did recognise my device but gave a 'null' response for the UUID.
I am at a loss about where to go, could anybody point me in the right direction?
best regards Wayne

According to specification at gsmarena, the HTC Desire C may actually only have Bluetooth 3.0, so not 4.0 "low energy" (HTC's own website does not even mention bluetooth -- see HTC website specs ?). Android SDK does not support bluetooth low energy either... so you may be out of luck. There is somewhat supported Broadcom stack, and Motorola has their own stack... Samsung Galaxy S3 may be hacked to work by reverse engineering existing apps...
If you need a phone which does support Bluetooth LE, Motorola XT885 will do if you download the Motorola ICS_R2 Android SDK add-on. See this post: Motorola BLE API

Related

Android bluetooth settings show duplicate names for same bluetooth device

I am working with a firmware team that writes firmware on a QCC3056 Qualcomm chipset that supports earbuds and I develop an android application that supports the BLE earbud Bluetooth device. The earbuds also support google fast pair and this feature requires the BLE mac address to be rotated every 15 min.
So the issue I am seeing here is the android Bluetooth settings recognize two Bluetooth devices with the same name(one is classic and the other one is BLE). I can tell by the mac addresses that one belongs to classic and the other belongs to the BLE address. We are able to connect to the classic instance. However, we are unable to connect to the BLE instance. We would like just one name to show up and the user should be able to connect to it. The firmware team thinks this is expected behavior(two names showing up). As far as I know, from the android end, we don't have any control over the Bluetooth settings. So I wanted to understand if this behavior is expected. I have tested this scenario with SONY WF-1000XM3 which supports Google Fast Pair and I have noticed only one name showing up.
It would be great if anyone can suggest the best possible approach I can take here.

Android: Limit of simultaneous BLE connections

we are developing an Android app which can connect to multiple heart rate sensors simultaneoulsy via Bluetooth Low Energy.
We have an implementation which is working quite well, so the code is not the problem.
What drives us crazy is the limitation of parallel BLE-connections which seems to be different from device to device.
We have a few test devices here: Motorola MotoE and MotoG, a Samsung Galaxy Tab A and an HTC Nexus 9. All of them are running Android 5 or 6, original vendor versions. None of them is able to connect to more than 7 BLE HR sensors simultaneously.
Then I have tested with my private Samsung Galaxy S4, which is rooted and has Cyanogen CM12 installed. With this device I can easily connect to 12 HR sensors simultaneously which is the number we want to achieve with our app.
I have tested this both with our own app implementation and with the Nordic Semiconductor nRF Master Control Panel which I think is a pretty good generic BLE app: https://play.google.com/store/apps/details?id=no.nordicsemi.android.mcp&hl=de
When I try to connect the app to a 7th BLE sensor on any of our devices, the ADB output prints the following error message:
E/BluetoothLeBasicConn: Connection state changing error: 133
I did some pretty intensive googling about that whole problem, but most of the results I've found were quite old. Some people said, that the limitation came from the Bluetooth Chipset itself, others said it was a software limitation through Android.
Could you help me to find out, where the limitation is coming from?
If it is the chipset, then I would like to know, which devices we should use for supporting as many parallel connections as possible. Sadly it is very hard to find out which Bluetooth chipset is built in the different devices. Hardly any of the hardware specs I found tell anything about this.
If the limitation comes from software side, can we change it somehow without rooting phones or install modded OS?
Thank you very much!
In case that you are still interested in it. The limit comes from
BTA_GATTC_CONN_MAX (hardcoded in android)
Which is set to:
4 on Android 4.3 and
7 on Android 4.4
There is by the way also a limit on the amount of characteristics for which you can activate notifications. (BTA_GATTC_NOTIF_REG_MAX)
which is:
4 on Android 4.3,
7 on Android 4.4 and
15 on Android 5.0

Bluetooth Low Energy Discovery on Android

It seem Bluetooth Low Energy (aka Bluetooth Smart) has no official support on Android, even version 4.2. Anyone know if the standard Android API can discovery BLE devices? (I don't need pairing just discovery would be good)
It is correct that Android took a switch from Bluez -> Broadcom Bluetooth. This switch was causing lots of problems for Android users. Missing BT classic profiles and Wifi v.s. BT coexistence (one probably reset the other since they are in the same chipset in most phones). iPhone and MAC computers suffer a lot from the same problem (BT v.s. Wifi).
The Broadcom Open Source Low Energy API was not included in 4.2.
HTC One X+ got slightly modified (?) Broadcom BLE API on top of Bluez in 4.1.x and it works reasonably good though I have to retry connection sometimes. The package name is htc not broadcom but sometimes Eclipse error messages tells that it is missing some broadcom references.
Also Samsung got a "secret" API for BT BLE with their own package name which can discover devices but seems to be not really robust (which may be why it is "secret")
Google have officially said that "BLE is the next big thing we will release". So maybe in Android 5.0? but hopefully before so Galaxy S2 (which have such a big marketshare and uses the same chipset as iPhone 4s) can get BLE support. (Just speculations and hopes from my side). If Android 5.0 get's BLE API's then Samsung Galaxy S3 should get it as Samsung has listed this as getting Android 5.0.
Only time or Google will tell... It's way overtime getting this old Nokia Research Center technology out in other than Meego and iOS devices.
EDIT 2: Seems like my lucky day is today ;) : new link
EDIT: Seems like today is your lucky day: Open Source API
I guess this answer is not adequate, but it is: on some devices yes, on others no.
A company I worked for did some testing with it and they could pair in on a Galaxy S3 while my HTC One S didn't even discover it.
So if a manufacturer has implemented this feature it will work, but most times it won't.
Some discussion about this: Texas Instruments
Sounds like a standard api will be coming to Android api 18 http://www.androidpolice.com/2013/05/15/bluetooth-low-energy-and-avrcp-1-3-coming-to-android-with-api-level-18/
Devices with the relevant hardware will work with Android 4.3.x support. I just put a Galaxy S2 GT-I9100 to 4.3.1 Slimbean and can now pair it with a Bluetooth 4.0 LE/Smart heart rate monitor. This, in spite of the stock hardware only ever supporting BT 3.0+, according to Samsung.

Bluetooth connection with Android

In my App I need to connect a smartphone with an 4.0 low power Bluetooth-module. Then the module sends frequenly data to the phone.
Do you know some good tutorials for programming Bluetooth connection
with Android?
Can you give me some links where the basics of Bluetooth are
explained? (german if possible)
How can I test it? (I have to programm the Bluetooth device too
and it's not finished jet)
Google havn't understood that sometimes they have to actually create and DRIVE something themselves, not just piggybacking on open source stuff and marketing it as their own.
Unfortunately there are no standardised BT 4.0. Low Energy API's for Android yet. Maybe Google just decided to only go for NFC for Google Wallet or something and then let BLE die. (We really need BOTH!)
Broadcom tried to make an open source API but somehow (maybe Broadcom wanted money from them?) no phones included the ".so" file in their Android build so this API is useless.
TI and Motorola made another API for the RAZR series running on old Android 2.3.3 or something. This actually works but Motorola removed the documentation and source-code from their site.
HTC ONE X+ and newer HTC phones will support a new API "soon" with special HTC libraries according to HTC. (At least it seems they are doing something)
Samsung Galaxy S3 have some "secret" API's that some people can use for discovering devices, scanning services and characteristics (there is an app in google play "semilink Bluetooth Smart Scanner" which on the Galaxy S3 can do those things).
Google asked Broadcom to make a replacement for Bluez in Android 4.2. Unfortunately this release broke a lot of functionality and peripheral compatibility. Maybe because one or more of Wifi/GPS/Bluetooth Classic/Bluetooth Low Energy shares the same HW resources but the drivers doesn't handle that very well. Lot's of people got problems with the newest Android Bluetooth functionality.
So I would expect Broadcom to focus on fixing the mess and THEN with Google move on to add Bluetooth 4.0. Low Energy. Google have said "Low Energy is the next BIG thing we will integrate". At least 1 year too late.
Personally I had to buy an iPhone4S and iPad retina to get platforms which supports low energy. With those we could finish the BLE peripheral sw and get the protocols working. Now we are waiting for Google and Broadcom to clean up the mess. Hopefully with some backwards compatibility so all the old phones with BT4.0. capable chipsets will also open up to the wonderful world of coincell battery driven peripherals ;-) (got to dream).
In reality we must wait for HTC to release their APIs and for Google to choose/drive the standard API.
Windows Phone 8 was supposed to get BLE but it has been postponed for an update. (Lumia 920 is certified but without API's (AGAIN!!) we developers are helpless)
There are nice GATT API's for Windows 8 as well as for MAC "OS"x.
You really should invest in the TI BLE development kit which costs like $50-$100 for a dongle which can be used for BLE sniffing. It comes SOOO handy when you develop your BLE Peripheral SW.

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.

Categories

Resources