Using CoreBluetooth/CBCentralManager.h framework - ios

I am using CoreBluetooth framework for first time in my Objective-c code.
My iPhone version is iPhone-3GS.
When I run my code, I get output as "The platform or hardware does not support Bluetooth low energy".
I saw 3GS specifications and got to know that it supports v2.1 with A2DP. But what I expected is whether Bluetooth is powered ON or powered OFF.
How can I get Bluetooth status through objective-c code using CoreBluetooth framework?
How to get Bluetooth status through Objective-c ?
Can anyone share a link or tutorial on this?

CoreBluetooth is the API meant for Bluetooth LE in iOS5+.
It does not support "normal" Bluetooth or any "normal" Bluetooth profiles.
As far as I remember, the first iOS device supporting Bluetooth LE was the iPhone 4S - your 3GS just does not have the correct hardware.
Bluetooth LE is part of Bluetooth 4.0 and meant for reading sensors and alike...
https://en.wikipedia.org/wiki/Bluetooth_low_energy
You will definitely not make it work using your 3GS, sorry.

Related

Using Bluetooth 5 on iPhone

I have application that already uses BLE. I know bluetooth 5 is supported on iPhone 8 and iPhone X. Client wants me to add support for bluetooth 5. I found that CoreBluetooth can be used only to "Communicate with Bluetooth 4.0 low-energy devices". How can I use Bluetooth 5.0 on iOS?
At the time of writing this, Apple has not provided API support for Bluetooth 5 functionality or any of its features (e.g. Long range, 2xSpeed, LE Advert Extensions, etc), so there's nothing you can do at your end. Currently only Bluetooth 4.2 features are supported (e.g. Data Packet Length Extension, LE Secure Connections, etc). Please have a look at the links below:-
https://developer.apple.com/videos/play/wwdc2017/712/
https://developer.apple.com/bluetooth/
I hope this helps.
iOS BLE 4.0 API s are not specific for Bluetooth 4.0 low-energy devices. Whatever works with Bluetooth 4.0 low-energy devices will also work for Bluetooth 5.0 low-energy devices.
Core Bluetooth library was working with BLE.
Its means no need to write different delegates and methods for bluetooth 4.0 or bluetooth 5.0.
All delegates working same for BLE(4.0, 4.1, 4.2 and 5.0 = BLE).

Is there any framework for bluetooth communication for iOS?

I need a library or framework for bluetooth communication for iOS but not for Bluetooth LE.
I want to communicate a device that cast bluetooth package, but my device not support LE. I have iPhone 4, iPhone 4s and newer support Bluetooth LE.
for this iPhone 4s and newer version there ne problem lots of example I can find and also CoreBluetooth library support this.
So I want proper library or framework for this.
Any Idea or Suggestion would be highly welcome.
Core Bluetooth is designed specifically for Bluetooth LE, a.k.a. BLE, Bluetooth 4.0 and Smart Bluetooth.
Core Bluetooth does not work with the older, classic Bluetooth devices. Those require special APIs and hardware available through Apple's MFi program. Already answered

Testing bluetooth from within iOS Simulator

I have followed the instructions on Technical Note TN2295 to enable testing bluetooth within the iOS Simulator, which includes buying a separate Bluetooth 4 dongle. However, within the Simulator when I go to the iOS Bluetooth settings, I can turn bluetooth on, but it never discovers any other bluetooth device (yes, those devices are discoverable).
I have tried the following to narrow things down:
I can pair the MacBook with the bluetooth device (Pebble watch), but it is not clear if I am doing so with the in-built bluetooth, or the bluetooth dongle.
I can plug the dongle into a Windows PC that doesn't have bluetooth, and then pair it to the Pebble watch. This tells me the dongle is working.
Other questions on SO relate to not being able to turn bluetooth on in the Simulator, but I am getting past this point. Can anybody help with the next step?
According to this ReadMe from ExternalAcccessory (non-LE bluetooth) framework's demo, there's no support to connect to real accessories through simulator.
Also, the technical note you mentioned applies only to the CoreBluetooth framework (LE bluetooth).
So you can only connect to Low-energy (Bluetooth 4.0) devices from your iOS simulator.
As far as i know, Pebble watch is using both Bluetooth 2.1 and Bluetooth 4.0 though. In this case, you can try connecting to it using CoreBluetooth framework.

Bluetooth framework for older iOS devices

My question is related with Bluetooth technology around iOS.
I've watched WWDC about Bluetooth Low Energy 101, what's new, the basics etc, and about using the CoreBluetooth framework available in iOS 5 and later.
I've looked through different sites and documentations trying to find more information about Bluetooth 2.1 and 4, but there is so few.
GameKIt is not an answer, I am developing an app to work with an non-iOS device.
Some of the topics I've went through:
Connecting to a Bluetooth device from iOS, no MFi
iOS - How to integrate bluetooth devices in my app
http://www.bluegiga.com/files/bluegiga/Presentations/BT4_0_for_Apple.pdf
Bluetooth 4.0 with older Bluetooth
IPhone Bluetooth Connectivity to Non IOS Devices
But the supported devices are just 4S and up and latests iPads...
1) will the latest CoreBluetooth framework just fail on older devices?
2) Did apple have any frameworks for BT 2.1 or something? What to do, there are still so many ipad2 and iphone4 users, I can't just ignore them.. So what framework actually to use?
Any help, advice, idea,link will be highly appreciated!
Well...
You need to understand one thing: CoreBluetooth framework is used for Bluetooth Low Energy and ExternalAccessory framework for the "Classic" Bluetooth. It is really two kind of different approchs of what we usually call Bluetooth (as a simple user/consumer).
Only recent iDevices support Bluetooth Low Energy (iPhone from 4S, MacBook Air from 2011, etc.). That's why it doesn't support iOS4 for example.
For your information, Bluetooth Low Energy is kind of a fork of Bluetooth which appears only in Bluetooth 4.0. Even if having a Bluetooth 4.0 device does not ensure that it supports Bluetooth Low Energy (as I said, it's a fork which is not always include).
As a simplistic vision, Bluetooth Low Energy works like a NSDictionnary with a NSDictionnary in it. You get a Peripheral, which as one of more Services which has one or more Characteristics. Quite different from a common device, right ?
Did apple have any frameworks for BT 2.1 or something? What to do, there are still so many ipad2 and iphone4 users, I can't just ignore them.. So what framework actually to use?
To talk to a Bluetooth 2.1 device, you need to be in the Made for iPhone accessory program. The details of it are under NDA, but you should expect things like Apple reviewing your manufacturing processes and auditing your accounts, and putting a custom chip into the accessory. If you don't make the accessory yourself, you're probably out of luck.
The only exceptions are the classes of device that iOS supports natively: keyboards, audio output, car stereos, other iPhones etc. However, you still can't send and receive arbitrary data, you're limited to using whatever APIs exist for the specific functions (e.g. for audio output, Core Audio lets you set a few properties for how Bluetooth devices behave).

iOS and Bluetooth Low Energy

I know that there are a lot of restrictions on bluetooth when it comes to iOS. I wanted some more information on Bluetooth Low Energy (LE) and the CoreBluetooth Framework apple provides from iOS 5.0 and greater.
Can i connect ANY Bluetooth LE device to an iOS device using the Core Bluetooth Framework?
Is there any Bluetooth LE device in production,that comes with a three axis accelerometer and a gyro that i could use like a Human Interface device?
Sagar, Maybe you can explain more about what you want to do.
Any BT4.0 LE device can connect and communicate with a iOS app using the CoreBluetooth Framework.
The CC2540 dev kit does contain a fob that has accelerometer, it does not have a gyro.
The USB dongle that comes with the kit is for communicating with the fob from a PC/Mac, you do not need it for communicating with the iOS device.

Resources