How to use bluetooth classic instead of LE
Joels there is a very clear way to use Bluetooth classic on iOS. It is with the External Accessory framework (it also includes direct hardware connections in addition to Bluetooth classic however).
You need to add the ExternalAccessory.framework
and specify "App communicates with an accessory
" in the required background modes inside your plist to get started. It should be noted however that with Bluetooth classic, the user must add your Bluetooth device from the System Bluetooth settings. It is only with Bluetooth LE that we are able to add devices from the app side.
Check out the docs on the External Accessory Framework
In response to your question regarding the MFi program, this should clarify:
I want to develop an iOS app that communicates with an MFi accessory. Do I need to join the MFi Program?
No. iOS app developers do not need to join the MFi Program. Everything app developers need is in the External Accessory Framework,
which is provided in the iOS SDK. To access the iOS SDK, please join
the iOS Developer Program: https://developer.apple.com/programs/ios/.
If you'd like to learn more, consult the MFi FAQ
Should I use Bluetooth Classic or Bluetooth LE to communicate with my mobile application?
It doesn't make a huge difference as most of the things you listed above can be achieved via either method, so it comes down to your personal preference and your existing familiarity with the wireless technology. However, I would personally go for BLE because unlike classic Bluetooth, BLE is now a lot more mature in terms of applications and resources for both Android and iOS. You will end up finding a lot more documentation and source code when it comes to BLE when compared to classic Bluetooth. Futhermore, as Michael Kotzjan mentioned, classic Bluetooth is relatively new on iOS and has a few restrictions.
The links below can maybe give you a nudge in the right direction:-
- Bluetooth classic vs BLE on Android
- Android Bluetooth vs BLE
- Bluetooth security and privacy on iOS
- Classic Bluetooth, BLE or WiFi direct
Can a Bluetooth LE powered device discover a classic Bluetooth device and vice-versa?
The answer depends on if you mean Bluetooth v4.0 device, or BLE device, the two are not the same.
Bluetooth v4.0 = Classic Bluetooth + Bluetooth High Speed + Bluetooth Low Energy
Therefore, Bluetooth Low Energy is only a subset of Bluetooth v4.0. If your question is regarding Bluetooth v4.0 phones (generally phones are not BLE only), then the answer is Yes, Bluetooth v4.0 mobile phones can theoretically discover Bluetooth v3.0 devices and lower.
Bluetooth device is detected as a Low Energy and an ordinary Bluetooth device with the same MAC address and name
Bluetooth LE devices (v4 and up) are usually backwards compatible. That being said, the two types of Bluetooth, classic (< v4) and LE (> v4), are completely different from one another.
Bluetooth Classic works with a classic master-slave connection, where one device sends instructions to the other, and the other obeys.
Bluetooth Low Energy changes this completely and replaces the architecture with a client-server focused architecture. Devices subscribe to the idea of GATT connections, they have specific rules and functions decided by Services and Characteristics. You get the Service channel of a device, hook onto a specific Characteristic and read/write/subscribe to notifications coming from it. This new connection type allows the peripheral device to act only when it is being called on, thus reducing the need for a constant connection polling on the server side and saving energy. It also allows you to connect to multiple BLE devices at once.
I recommend that you use Bluetooth Low Energy with all your connections moving forward. It is more energy-efficient, the connection is generally more stable, and the range of BLE is also greater. Bluetooth Low Energy aims to be backwards compatible, so your app should also be compatible with the newest version of BLE (v5+)
Why do Bluetooth classic and LE device get same name on iOS?
The hint by Emil got me on the right track:
In the LE advertisement the name was "LE FOO". Thus, the iPhone showed the correct name at first. After establishing the connection, iOS automatically asks for the device name characteristic in background. This characteristic returned "FOO" instead of "LE FOO".
So to say a bug on my side. The callback for this characteristic was implemented manually with the wrong constant.
Pairing differences between Bluetooth and Bluetooth LE?
If you mean Bluetooth Classic or BR/EDR by 'normal',the difference depends on the version of Bluetooth in use.
Bluetooth Classic or BR/EDR 2.1 - 4.1 Vs BLE 4.0-4.1
BR/EDR pairing procedures are handled by the LMP layer of the Bluetooth Controller.
BLE Pairing procedures are handled by SMP in the host stack.
BR/EDR uses ECDH Key generation which prevents passive eavesdropping.
BLE legacy pairing does not use ECDH Key generation and so it is susceptible to passive eavesdropping
BR/EDR defines 4 association models; OOB, Passkey entry, Just works, Numeric Comparison
BLE Legacy Pairing defines 3 association models ; OOB, Passkey entry, Just works.
Although they appear similar from the user perspective, they do not provide the same level of security. See #2
BR/EDR generates the Link Key on both devices.
BLE legacy pairing, generates the STK. The Link Key i.e. LTK in use is distributed by the slave
BR/EDR v4.2 Secure Connection vs BLE v4.2 Secure Connection
BLE 4.2 secure connections added ECDH key generation and the Numeric Comparison association model. It also did away with the STK. The LTK is now generated on both slave and master.
Secure connection association models on the BLE link, are equivalent to BR/EDR secure connection association models, in terms of protection against MITM attacks and Passive eavesdropping.
When two BR/EDR/LE devices support Secure Connections over both transports, keys for both transports may be generated during a single pairing procedure. The ability to convert keys from one transport to the other eliminates the need to pair twice.
There are still some differences.
BR/EDR pairing procedures are handled by the LMP layer of the Bluetooth Controller.
BLE Pairing procedures are handled by SMP in the host stack.
BR/EDR cryptographic functions use HMAC-SHA-256.
BLE cyrptographic functions use AES-CMAC.
More information can be found in the Bluetooth core specification here
Related Topics
Comparing Nsdates Without Time Component
iOS 8 Sdk: Modal Uiwebview and Camera/Image Picker
iOS 7 -- Navigationcontroller Is Setting the Contentinset and Contentoffset of My Uiscrollview
Dyld'_Abort_With_Payload: Without an Error Message
Connect Objective-C Framework to Swift iOS 8 App (Parse Framework)
How to Display .Svg Image Using Swift
Use of Unresolved Identifier' in Swift
Afnetworking 3.0 Migration: How to Post with Headers and Http Body
Tablefooterview Property Doesn't Fix the Footer at the Bottom of the Table View
Xcode Nsmanagedobject Subclass Contains Optionals When They Are Marked as Non-Optional
Alternative to Dtsendsignalflag to Identify Key Events in Instruments
Callback Method If User Declines Push Notification Prompt
Uiview Animatewithduration Doesn't Animate Cornerradius Variation
Xcode Stuck at "Your Application Is Being Uploaded"
Working with C APIs from Swift
Setneedslayout VS. Setneedsupdateconstraints and Layoutifneeded VS Updateconstraintsifneeded