Exchange strings between Mac OS X and iOS via Bluetooth - ios

For a project, I have to send informations such as strings or ints from an iOS app (on iPhone 5) to a Mac OS X app (on a MacBook Pro), while both the iPhone and the MacBook Pro are in place without Wifi. The obvious solution is using Bluetooth. So the question is: Can I do that, and how?

You should use the CoreBluetooth framework.
For Mac: you'll need either a Macbook Air or Mac-mini
For iOS: you'll need an iPhone 4s, iPhone 5, iPad 3, iPad 4, or new iPod touch.
--A short overview:
You'll need to host both the CBCentralManager and the CBPeripheralManager on one device, and then host just the CBPeripheralManager on the other device.
The CBCentralManager is responsible for connecting and maintaining connections to external devices.
The CBPeripheralManager is responsible for writing and reading from those connections.
You can either send a write/read request or you can advertise a custom CBService that contains a CBCharacteristic with your string/int value.
Look at the header files and docs because there are tons of methods you need to adopt. There's also really good WWDC2012 videos that illustrate these methods in depth.
(However, if you want to use just a Macbook Pro, you'll need to use the standard IOBluetoothFramework on Mac and external accessory framework on iOS )

This project should help you with the iOS side of sharing strings over Bluetooth: SimpleShare
It lets you easily send and receive arrays of strings from your iOS device over Bluetooth LE. You'd just need to manage the CBCentralManager on the Mac.

Related

iOS 9 an 10, Bluetooth connection with Bluetooth 3 device

I have a request of implementing an iOS application which will be able to communicate with bluetooth device. The chip on that device has Bluetooth 3. The App will be privately distributed, so we don't need AppStore review and we can use anything - the only requirement is, no iPhone jailbreaking. The purpose of the application in reading diagnostic data from the device and sending a few commands to it - like turn left, turn right, setValue - nothing special (it is a special valve, which can be remotely controlled).
Now if a learned correctly the options with using Bluetooth on iOS are:
CoreBluetooth: library for Bluetooth 4.0 LE devices. It cannot be used, because Bluetooth chip is 3.0
ExternalAccessory: the device must be MFI certified, if this option is about to be used. Quite hard that hardware producer will go into the MFI certification, so at the moment not an options.
Bluetooth.framework: private framework which sounded like a good option (I have managed to make it run on iOS9 and iOS10) but the communication with devices on iOS10 does not work anymore. On iOS 9.3.5 on iPhone5 I made it work, but only iOS9 is not an option
BTStack: available via Cydia, but this packages if I have learned correctly require iPhone jailbreaking. Sadly again not an option
The situation clearly does not look good here. I have also read rumors, that it might be possible to use HID bluetooth profile for communication (anyone tried that). is there any C Bluetooth library which could be run on iOS device and work with iOS10?
Thanks for any iadeas.

USB programming, transfer file from iOS device to Embedded os device?

I really need to know whether a iOS device can transfer a huge file to a embedded OS device through USB via my app. It is like the embedded os device has only a usb port. So is it achievable like the file transfer happens through the iOS device's data cable, through iOS USB programming?
In order to use the 30 pin or Lightning connectors on an iOS device you will need to join the Mfi program and use MFi chips in your embedded device, so the short answer is probably "no".

How to send file from iPhone to mac over bluetooth

I have created universal device application to transfer any kind of files via bluetooth using GameKit Framework.
My question is how to create on Desktop Application with same process or there any Framework? That can communicate also on the device. Can i have any sample please or tips how to do it.
There is Core Bluetooth that used low energy protocol. But i don't know how?
Anyone please give some idea or anything that i can use it.
Thank you
The Bluetooth functionality of the GameKit framework is iOS-only (see GKSession), so you won’t be able to use that on a Mac.
The CoreBluetooth framework on the other hand is available on both Mac and iOS devices supporting Bluetooth LE, with the one difference that the CBPeripheralManager is not available on Mac, so you can’t advertise a service on Mac. However you can have your iOS device act as a peripheral and connect from the Mac acting as a central. Data transfer should still work both ways.
The BTLE Central Peripheral Transfer sample code should be a good starting point.

iOS to Mac OS X [core] bluetooth data transfer

My objective here is to create a connection between a device running iOS to a device running Mac OS X, via bluetooth. I know that I might be able to use CoreBluetooth for this but I don't understand how since I don't see a method to setup a service on the iOS device and broadcast it as an available service for a device running Mac OS X. In other words, I simply want to setup a connection to get the iOS device to send data to the Mac OS X device. Also, how would I go about to specify how to setup properties of the service. I've tried researching this stuff but most of the documentation makes little sense to me. The data transfer is small so bluetooth is good enough for the job. I'm trying to avoid Bonjour for this, and the Game center framework for P2P since OS X can't handle that (I think).
In iOS6 the iPhone 4S, 5 and New iPad can work both as Peripheral and as Central in Bluetooth Smart / Low Energy mode.
Try downloading "LightBlue" APP from APP Store. It let's you put the iPhone4S or 5 into Peripheral mode with random Services which you can then read from the Mac (if you have a newer one with BT Low Energy, I use the Retina for that but also the new iMac and Mac Mini got BT Low Energy).
You are correct that Core Bluetooth only give access to Bluetooth Low Energy which doesn't allow for the MFI chip.
Just ran across this today... and just wanted to give another answer to anyone needing to communicate to a non-Bluetooth LE device from your Mac.
The way to go is with IOBluetooth, and IOBluetoothUI.
They are both frameworks for the Mac, and they allow you to communicate with both old bluetooth, and Bluetooth LE 4.0, I believe. Also, I'm pretty positive you can act as a Central and Peripheral Device using this framework.

Bluetooth programming in iPhone

I am planning to develop an iPhone application to transfer files/data to/from my Windows Desktop using Bluetooth.
Please let me know whether the programming interface(SDK)is available in iPhone SDK for this purpose.
In Windows Mobile, I can transfer the file either using a FTP profile or writing application on top of Serial Port Profile(RFComm).
Can anybody tell me, whether this can be possible with an iPhone by writing appropriate application. If not, please let me know alternative way to transfer files/data over bluetooth from iPhone to a Windows Desktop PC.
No, FTP or SPP bluetooth profile are not open in iPhone...
If you get into the made for ipod program, you might develop a bluetooth dongle for a computer (it can't use the normal one built into the computer as it needs a custom apple chip for encoding). This is the only method that could do something like what you want over bluetooth and get your app into the app store. You can implement a similar functionality more readily over wifi.
Yes you can. Use the Human Interface Device profile, and have your USB device pretend to be a keyboard. You can then have your app receive text input from the "keyboard". simply encode your data as ASCII encoded hex or base 64 and transmit. Whether or not your app would be allowed in the app store is a different matter.
There are 2 requirements to use iOS BT Classic for data transmission over RFCOMM.
1) You need to be enrolled in Apple MFi program.
2) The BT accessory which will be connected to iPhone needs to have a special HW chip called "MFi Coprocessor".
Both requirements need to be satisfied if you are developing FW for the BT accessory.
The latter one is required when you are coding iOS app.
BTW, you will not be able to communicate with Windows machine unless you have a BT dongle with MFi chip inside - see the second requirement.

Resources