Can you obtain WiFi settings from iOS and pass it to a BLE device (similar to Withings)? - ios

The Withings iOS app has the ability to obtain your wifi settings and pass it to the body scale via Classic Bluetooth (see screenshot below). From what I learnt it's a feature only available through the MFi program, which the Withings Scale is.
I'm building an app that talks to external BLE devices. Since MFi is not required for BLE devices, I'm wondering if there's a way to do the same thing with CoreBluetooth or other frameworks?
From Apple's MFi FAQ page:
"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."
Related question on ClassicBluetooth / MFi:
Can you pass WiFi settings from an iOS device to an ExternalAccessory object?

Related

Xamarin.iOS and RFComm

I was exploring codes for bluetooth communication using rfcomm. I was able to implement this in xamarin.android native, but for xamarin.ios I was not even able to find a sample, just found samples with BLE. So can you please forward me or even better- answer if the rfcomm is possible with xamarin.ios? Many thanks
iOS devices do not implement the Bluetooth RFCOMM (SPP) profile
• Instead Bluetooth accessories can use iAP profile to exchange data with iOS devices
– iAP is RFCOMM based connection (similar to SPP)
– It uses Apple proprietary iAP application protocol
– Allows data exchange between Apps and the accessory
Via: Silicon Labs Wireless and RF Solutions website
If your bluetooth device is MFi (Made For iPhone) compatible:
Apple's MFi Program
CoreBluetooth

What's the difference between the CoreBluetooth and ExternalAccessory frameworks?

Apple provides the following two frameworks for communicating with nearby Bluetooth devices with iOS.
CoreBluetooth:
The Core Bluetooth framework provides the classes needed for your iOS and Mac apps to communicate with devices that are equipped with Bluetooth low energy wireless technology.
ExternalAccessory:
The External Accessory framework provides support for communicating with external hardware connected to an iOS-based device through either the Apple Lightning or 30-pin connector, or wirelessly using Bluetooth.
I have previously used the CoreBluetooth framework to successfully communicate with Bluetooth devices. However, I am now trying to communicate with a Bluetooth printer and it doesn't show up in the scan for nearby devices. Using the ExternalAccessory framework, it does.
How do these two frameworks differ as far as communicating with Bluetooth devices is concerned? Why do different Bluetooth devices require the use of different frameworks?
There are two kinds of Bluetooth, Bluetooth LE which is very limited in bandwidth but that doesn't require any user pairing in the settings app and Bluetooth Classic, which requires the user to pair the device but gives you more functionality and bandwidth. CoreBluetooth supports Bluetooth LE and you can use it with a developer account. Bluetooth Classic requires that you join the Apple MFi program.
Core Bluetooth only allows you to communicate with Bluetooth Low Energy devices using the GATT profile.
The External Accessory framework allows communication with 'legacy' Bluetooth devices using profiles such as the Serial Port Protocol (SPP). In order to communicate with devices using the External Accessory framework, the device must be certified under the MFi program.
I also believe that in order to get an app that can communicate with with an MFi device using the External Accessory Framework approved, the MFi licensee (i.e. the printer vendor) needs to provide some paperwork to authorise your app.

Connecting a Bluetooth® 2.1 + EDR class 2 device with an iOS App

I have a Bluetooth® device which is on version 2.1 with EDR. I want to connect and read the services that it transmits in my iOS app. This device is based on Personal Area Network (PAN) profile which is supported by apple. I believe, for supported profiles, there is no need to enroll for the MFI program.
The problem i am facing is the device is not discoverable with the iOS devices even in the Settings --> Bluetooth page. What could be the issue ?
While iOS supports the PAN profile, this is only for the purposes of Internet tethering -
Personal Area Network Profile
(PAN) Personal Area Network Profile
provides network connectivity over Bluetooth. With iOS, this is common
with multiplayer games and Personal Hotspot on iPhone. Learn more
about peer-to-peer connectivity*.
iPod touch and iPad with iOS 4.3 or later support Internet tethering
from an iPhone with iOS 4.2.6 or later through PAN.
You will not be able to interact with a PAN profile device from your own app, there simply isn't a framework that exposes this level of Bluetooth connectivity.
In general you can only write apps to work with BLE GATT profile devices unless you are enrolled in the MFi program (You can send audio streams to supported devices using the AV framework and a keyboard will work with any app using the HID profile, but you can't control pairing etc from your app)

Can an app receive bluetooth data if it is locked?

Simply that question. You see other devices stating that they can, but built on older platforms. Any sample code would be great.
Yes, it is possible. You need to set UIBackgroundModes to "bluetooth-central" in info.plist file.
Note also, that Technical Q&A QA1657 in iOS Developer Library says the following
The External Accessory framework is designed to allow iOS applications to communicate only with hardware accessories that are developed under Apple's MFi licensee program. MFi compliant accessories can be implemented as wired devices, meaning they plug in to the iOS device's 30-pin connector, or as wireless devices, whereby they use Bluetooth as the communication channel. Either way, an application that uses the External Accessory framework will not be notified of an accessory's presence unless the accessory identifies itself as being MFi compliant, i.e., it was specifically designed to interface with an iOS application.
Developer reference also says that there is a Core Bluetooth framework for Low Energy devices in iOS5, but it's for Bluetooth 4.0 devices (BTLE) only, currently on the iPhone 4S.

Is it possible to develop an iOS app with bluetooth capabilities?

Would the following be possible?
Let's say I have a scale with Bluetooth capabilities, when I turn it on, it sends the weight via BT.
Is it technically possible to develop an iOS app which pairs with the scale and receives the data from it?
According to Apple:
Technical Q&A QA1657: Using External
Accessory framework with Bluetooth
devices.
Q: I understand that the External Accessory framework in iOS 3.0 and later will allow my application to communicate with Bluetooth devices. So why doesn't my application see the Bluetooth accessory sitting next to my iPhone?
A: The External Accessory framework is designed to allow iOS applications to communicate only with hardware accessories that are developed under Apple's MFi licensee program. MFi compliant accessories can be implemented as wired devices, meaning they plug in to the Apple device's 30-pin or Lightning connector, or as wireless devices, whereby they use Bluetooth as the communication channel. Either way, an application that uses the External Accessory framework will not be notified of an accessory's presence unless the accessory identifies itself as being MFi compliant, i.e., it was specifically designed to interface with an iOS application.
Yes, we can connect Bluetooth devices with iOS application through Core bluetooth framework. This framework is supported on the iPhone 4s, iPhone5,iPhone 5S ,iPad3. We can use BLE 4.0 for the communication between scale and iOS application. Here, iOS application become the client and scale become the peripheral. You Can set as well as get data from the weighing scale.
While the External Accessory Framework with Bluetooth is one of the possible solutions, it has additional requirements to be built as per Apple MFi, here Bluetooth reference is to the Classic Bluetooth (Version 3.x and below)
The best solution for the use case you have defined is to use the Bluetooth Low Energy (LE) (aka Bluetooth Smart) technology (Bluetooth 4.0) and it is available to applications as part of the Core Bluetooth Frameworks
Here are the APIs for Core Bluetooth that applications can use.
While currently Bluetooth Low Energy is supported on the latest iPhone 4S, New Mac Mini & Macbook Air - its expected most new Apple & Others hardware will have this standard.

Resources