Question

We were given a bluetooth device that we were asked to connect both iOS and Android devices to a particular custom peripheral.

The demo app seems to bring up a list of devices, asking which to use, then brings up a list of protocols, which includes one defined in the info.plist under "Supported external accessory protocols" as com.(company).bt.

I looked all over and found nothing about this process being standard with Bluetooth, and the entire workflow appears to be different on Android. I've tried using the bluetooth sample app to connect to this device but the red connected LED never lights up, and depending on the UUID given, I either receive 1 byte or 7. The sample code I was given doesn't even touch the InputStream unless the stream has reached 16 bytes (Which of course, never happens)

Is there some sort of guide on how to connect to this device? Based on what I read from the code, a message isn't even sent until the user presses a button, but the LED is lit long before this is even an option in iOS.

Edit: I finally found something from clicking around - it seems that the plist entry has to do with mfi (Which I guess the documentation is only available to those in the program?) With that said, does that mean this device will only work with iOS devices?

Was it helpful?

Solution

As you mentioned connection in Android and iOS is done differently.

The protocol defined in info.plist should be the protocol you are meant to use with the particular Bluetooth chip you have.

There is a guide explaining how to connect in iOS, you should probably also check which Bluetooth version it is. If it is lower than Bluetooth 4.0 (BLE- Bluetooth Low Energy) or not. I assume it isn't BLE since you mentioned it is MFI...

1)If it is BLE use Core Bluetooth

2)Otherwise have a look at the following link: Introduction to Stream Programming Guide for Cocoa.

It is a bit hard to understand what you mean about the red LED because we don't know what device you are using. Considering you are receiving some bytes from the device it means that the communication was established. You can start debugging and perhaps understand better the code by changing it to "touch" the InputStream even if 1 byte is received...

Hope this helps. Cheers!

EDIT: Just read the title again, I am not sure what you mean by saying you want to convert the code to Android? You only described your attempt to connect in iOS. A quick Google search would give you the following links for Android guide:

1) Bluetooth (not BLE)

2) BLE

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top