CoreBluetooth and BluetoothManager, device is not BLE - ios

Connect and receive data via bluetooth.
We are developing an app for a client. It is a toy for babies that connects via bluetooth and we're having trouble connecting and transferring data.
After all the research we did, we found two alternatives: CoreBluetooth and BluetoothManager. As far as I know CoreBluetooth only connects with Bluetooth Low Energy (I think it is the latest bluetooth version) and with it I am not able to find my client's device. With the second option, BluetoothManager i can find the device but I can not transfer data.
This makes me think that my client device is not BLE. Is there any way to connect and transfer data with this device, considering that CoreBluetooth doesn't locate the device and only BluetoothManager does?
Could you please provide alternatives and/or examples of how to make this communication? And if you can not do, let me know in order to tell my client.

To communicate with lower versions of Bluetooth you need to use ExternalAccessory framework, but it is for MFi devices, so I guess you need to sign to Apple MFi Program: https://developer.apple.com/programs/mfi/
This answer describes possible ways of working with Bluetooth on iOS:
https://stackoverflow.com/a/16852224/4495995

CoreBluetooth is only intended to connect to devices equipped with Bluetooth Low Energy. Which while it does share some concepts with its namesake, is a completely different technology. So as of Bluetooth 4.0 we have:
Low Energy (or Smart) - slower, simpler, energy efficient
Basic Rate / Extended Data Rate (or Classic, High Speed, Smart Ready) - older, more complex, faster, less energy efficient
It seems that because of the energy efficiency as a normal developer you are only allowed to use BLE. If you want to use BR/EDR you need to apply for to the MFi Program, and use special hardware.

Related

Does BLE Data Transfer require pairing (pairless bt data transfer)

For a project of mine I need a pairless bluetooth data transfer. I have first thought about doing it with BLE IBeacons but they can only advertise a very limited amount of data. I looked further through the Apple documentation and found this tutorial about Central/ Peripheral
BLE data transfer. I've implemented the code in my project but even though the devices were very close together they could not "see" each other. I have since looked up on the Internet and could not find a hint about whether the devices need pairing or not and what the problem of mine could be(the code is not throwing any errors nor warnings).
If it does require pairing, is there some way to do that in the background without requiring the user to perform an action, so that I could theoretically advertise some kind of pair request via. IBeacons to then transfer the data? If that's not the case, is there even a way to transfer data (mono directional, round about 512 bytes) between nearby bluetooth devices without user actions?
greets from germany!
To get started with Bluetooth Low Energy or any other protocol, it's best to learn how it works. At least basics.
Simplifying. BLE allows you to send data:
"Passive" (without conncetion) - over Advertisement Data. The size of the packages depends on the BLE version.
"Active" (requires connection with the device) - bidrirectional comunication. In this case size of the data package also depends on the BLE version.
Bonding and pairing is a separate issues.
I suggested you look at the following book:
https://www.oreilly.com/library/view/getting-started-with/9781491900550/
The websites of BLE module manufacturers also offer a lot of information about this technology. For example Nordic or TI. Very often with sample programs for various platforms.
For iOS:
https://developer.apple.com/videos/play/wwdc2017/712/
https://developer.apple.com/bluetooth/
You may also be interested in sending more data without connection using version BLE 5.0
https://www.bluetooth.com/blog/exploring-bluetooth5-whats-new-in-advertising/

ios receive audio over bluetooth

I'm most likely not using the correct terminology in my question.
Is it somehow possible for an iphone to receive an "audio stream" from other iPhones over Bluetooth?
The idea is to make an app that makes it possible to listen to the music libraries of other iPhones in the Bluetooth range. All while not having access to the internet and not needing to pair up and transfer the actual song onto the phone.
The thing you ask of is doable, but is not something trivial. Bluetooth communication can be implemented to work like a TCP/IP socket implementation, the only problem is, there is no actual protocol to follow. Usually the apps that implement bluetooth communication use they own protocols definitions in order to serve the purpose of the app.
There are several steps that have to take in consideration:
The transfer speed over bluetooth, it's not fast but it's not slow either, the main problem with the transfer over bluetooth is that you have to implement the data transfer, for example in TCP/IP the whole package exchange (send/acknowledge/receive) is done by the system, there's no general protocol implementation to do such thing using bluetooth.
The connection handling, this is something really tricky depending on OS & OS version, especially on iOS the connect/disconnect handling is clumsy & often buggy.
Security, without pairing and bonding there's no security. Even with pairing & bonding the security is flacky. Without security you might get your app hammered down and bricked by a simple bluetooth sniffer.
Other apps that use bluetooth, for IoT or other gadgets this is not an actual problem, but when you have a client/server like approach via bluetooth using two mobile phone you might get in trouble because of other apps that wrongly use the bluetooth (don't close connections, try to scan to frequently) and you can't do anything about it.
These are the things that cross trough my mind about the bluetooth communication, I've worked on several apps that connect to IoT and I can tell you it's not something trivial to implement. You get a lot of headache for things that you can't imagine.
As an alternative you could use WI-FI without internet connection, there was a trending post some time ago about Mesh Networks that use only the WIFI signal to transmit data, not even actual wifi network, worth checking out IMO.

iOS Communicate with LTE Similar to BLE Interaction

I have a device that can be communicated with over LTE with the same functionality as you normally get through BLE.
However, I'm having a hard time understanding how you communicate with, and get callbacks from an LTE device in the same way you do with BLE.
It doesn't seem that there is a library like CoreLTE but is there a standard way to use LTE like we use BLE (CoreBLE)?
In other words, how does one do essentially something line:
func lteCentralManager(lteCentral:LTECentralManager, didDiscoverPeripheral ltePeripheral:LTEPeripheral,
...
lteManager.connectPeripheral(ltePeripheral, options:nil)
...
NOTE: I realize that the technologies are different. The above is only meant to make the point of what I'm trying to do - not imply that the calls would be the same.
If there is no standard way to do this, does anyone know a good place to start figuring it out with iOS? I've read the standards. I'm just looking for how to use it now in iOS.
Thanks for the help.
iOS does not offer APIs to interact with the LTE modem directly, so this is impossible - not to mention, even if the hardware and software was capable of it, why would the scammercarrier allow you to talk to nearby devices directly instead of going through their network where they would charge you for that bandwidth?
If you need short-range communication between iOS and Mac devices you might want to take a look at Multipeer Connectivity. Firechat uses it successfully to enable off-network chat between nearby devices.

HM-10 and iOS/iBeacon. Communicating between the two

I am trying to wrap my head around the possibilities of the HM-10 but am very new to a lot of how it works. I am only familiar with higher level things.
I originally thought I was going to use the hm-10 as an iBeacon but quickly found out it's limitations. Here was the original plan prior:
iBeacon(HM-10) broadcast in a particular room, when I walk in with my iPhone, it detects my iPhone and then does something, i.e Sets one of its Pins to High.
But based on my research now, this is not possible with iBeacon? I need to use iBeacon broadcasting in hand with regular bluetooth?
As in, upon my App/Phone detecting the iBeacon it then pairs with the HM-10 and sends an AT- command to set one of the pins HIGH.
Does all of this make sense? Could anyone provide some more input?
I am in the process of putting together an iPhone App but just wanted to know if I am on the right track.
Since the HM-10 is based on the CC2540, it should be possible to turn it into a Bluetooth LE beacon, including one that supports an iBeacon format.
A few thoughts to help your understanding:
Standard Bluetooth LE beacons (AltBeacon, iBeacon, URL beacon) are transmit only devices that don't detect phones -- phones detect them using a custom app. So when you say "it detects my iPhone and then does something" this is diverging from a standard Bluetooth LE beacon.
The concept of "pairing" with a Bluetooth device is typically related to Bluetooth classic (e.g. pre-4.0) technology. Bluetooth LE devices like the beacons mentioned above have the concept of connecting to read and write GATT characteristics.
If you do build a custom BLE device that out of a HM-10/CC2540, it would be possible to make it "detect" mobile phones, perhaps by advertising a GATT service, and then doing something upon connecting and/or writing to a characteristic. Since the CC2540 contains GPIO pins, it would be possible to make it "do something" by making a pin go high.
There are two big chunks of work to doing what you describe: (1) writing custom firmware for the CC2540 and (2) writing an iPhone app using CoreBluetooth and/or CoreLocation iBeacon APIs. Before starting on the iOS side, you need to figure out how the Bluetooth device is going to work.

BTLE 4.0 - ConnectBlue Low Energy Serial Port Service

I am looking for a way to load data from an embedded device via a serial port (RS232) to an iPhone. The app needs to be on the AppStore and our company is not part of the MFI program.
Before you say, it can't be done, we are looking into Bluetooth Low Energy 4.0 as a possible solution. We can create a device that can turn ConnectBlue's OBS421 module into a serial port adapter (with the speed bursts limitation). To that effect, connectBlue provides their own protocol called Serial Port Service, but it is documented only on a very high level.
Does anyone have any experience in using this protocol? If so, can you provide an example(objective C) code that establishes communication in this way?
Has anyone submitted an app to Apple that does this without getting rejected for infringing MFI rules?
One more question.. The device I am trying to connect only supports serial commands in the EZII Escape Computer Command Set standard (PROG ID of "EZ2 2.0" and higher). They look different than the common ATT-Commands. Example: <ESC>Gc100<EOT>.
Any idea if I can send such commands via ConnectBlue's LE-SPS?
Your help is much appreciated.
Thank you!
I haven't used this protocol but from the documentation it seems quite straight-forward. You should be able to take any of the core-bluetooth examples and adapt it fairly quickly.
You need to look for a peripheral that is offering service 0x2456e1b926e28f83e744f34f01e9d701
This service exposes two characteristics -
0x2456e1b926e28f83e744f34f01e9d703 to read & write to the serial port
0x2456e1b926e28f83e744f34f01e9d704 for "credits" if you need flow control. Essentially it seems that this value indicates the number of bytes you can send to the device and you can write a value to indicate the number of bytes you are prepared to receive from the device
The device should support a full 8-bit data path, so I don't see why you would have a problem sending the serial commands.
Bluetooth Low Energy is specifically excluded from the MFI program, so you won't get rejected on that basis -
I want to develop an accessory that communicates with an Apple device
using only Bluetooth Low Energy. Do I need to join the MFi Program?
No. Accessories which connect to an Apple device using only Bluetooth
Low Energy/BTLE/Bluetooth 4.0 or standard Bluetooth profiles supported
by iOS are not part of the MFi Program.
Bluetooth Low Energy does not have a SPP defined as a standard protocol.
You have to program it yourself using the GATT service/characteristics, you just need to generate your own 128bit UUID (google it, there are plenty of UUID generators and even on Mac or Linux it's easy to generate from command prompt)
GATT sends smaller chunks of data which you would have to concatenate yourself in the other end.
Be aware that the throughput of BLE is quite low compared to Bluetooth Classic SPP. Maybe around 3kbytes/sec.

Resources