CoreBluetooth cannot find devices but iOS can - ios

I have a bluetooth barcode scanner whose spec says it's bluetooth 2.0, class 2. It is strange because my iPhone 5 (iOS7) could find and connect it. I thought iOS only connects BLE devices. But in my app I couldn't scan this device. I've no idea if this is because its bluetooth spec. I wish someone could give me some advices about how to connect this device in my app using CoreBluetooth or some other valid libs.
By the way my code is correct because I could find LightBlue app on another iPhone. My code is as following:
// state is PowerOn
[_centeralManager scanForPeripheralsWithServices:nil options:nil];

I guess you detect it via Settings.app/Bluetooth? If that's so, that's a "classical" bluetooth device. It's not a Bluetooth Low-Energy one. If you want to connect to "classical" bluetooth device, you'll have to use ExternalAccessory.Framework.
Bluetooth 4.0 contains two types of Bluetooth : Bluetooth "classical" and Bluetooth Low-Energy (as a fork). So that's why your iPhone can detect it.

Related

Bluetooth device not visible on iOS but visible on MacOS

I'm trying to discover a bluetooth device from an iOS app I developed. The device is an industrial sensor which send a measure every x ms.
I dont understand why I can see and connect to the device from my MacBook but not from my iPhone. The device is not visible in iPhone bluetooth settings. I dont find it through CoreBluetooth too (by using 'scanForPeripheral' method). Is there particular specifications on iOS?
I'm allowed to setup every data I want on the BT device (profil, CoD, UUID, etc.)
The iOS app is basic and simple. I'm using CoreBluetooth framework.

HM-10 bluetooth pairing with iPhone

I am using a HM-10 bluetooth to pair with my iPhone but I noticed that HM-10 can't be paired with iPhone using the "settings". It just won't show up in my bluetooth list. I will need a special app like "Lightblue" or "Bluecap" to pair it.
My question is, if I need a certain app to pair the bluetooth module with my iPhone, why is that many devices such as bluetooth speakers could be paired using the "settings" even without having an app?
Are there any bluetooth modules that could be paired without having an app like "Lightblue" or "Bluecap"?
Pairing through settings is only available for devices that use legacy profiles such as handsfree or A2DP.
Bluetooth Low Energy devices, such as the HM-10 are discoverable by any app using Core Bluetooth. Apps, like LightBlue, are just general purpose BLE apps that let you explore available BLE devices.
BLE devices only require pairing if they are using encryption on their characteristics. In this case, iOS will show the pairing dialog and complete the pairing process when the app attempts to read the encrypted characteristic.
To use the HM-10 you will need to write your own app to perform whatever communication task you are trying to achieve.
You can use nrf52832 as Bluetooth module.
If you are not making hobby project hm10 is very bad choice
I shifted from hm10 to nrf52832 before 6 months

iOS BLE Supported Connection Types

I'm working on a BLE device that part of its requirements is that it'll only use connect mode between the iPhone and the peripheral (no pairing nor bonding).
According to Apple documentation Bluetooth Accessory
Design Guidelines for
Apple Products
section 3.7 Apple is using Random device address. As much as I know, when using Random device address one need to pair (in order to get the IRK).
Is there a way to have a BLE device who works with iOS and only does connect with no pairing or bonding?

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.

iOS - discovering roving network's RN-42 BTLE chip

I am working on a project where I have to discover a bluetooth chip provided by Roving Networks - RN-42. The development kit come with an ios application which shows how to communicate with the chip but first we have to connect/pair (manually) with the chip using iOS settings. It uses EAAccessory Framework and works fine.
What I want is to discover the bluetooth chip from my application and then connect/pair with it automatically but I cannot find a way on how to do that. I am using CoreBluetooth framework to discovery the chip but nothing comes up. Here is how I try to scann for BT devices using CBCentralManager
[self.centralManager scanForPeripheralsWithServices:nil
options:nil];
But I don't get anything back in the callback.
Thanks
CoreBluetooth framework only allows you to discover Bluetooth LE capable devices, and does not show classical Bluetooth (BT3.0 and older) devices at all.
Apple had API calls to discover classical Bluetooth devices, but I think they have been removed lately.
You need a product like this in order to do in App pairing and connections:
http://www.bluegiga.com/BLE113_Bluetooth_Smart_module

Resources