I was trying to make a connection between two devices initially using bluetooth ( To send messages and files ) , the first framework I found to do this kind of thing was the GameKit but unfortunately it was discontinued and I was forced to use the MultipeerConnectivity framework.
Recently I learned of the Core-Bluetooth framework that can communicate with other peripherals , performing an internet search I realized that most of the tutorials related to it, are temperature peripherals and heart monitor. Unfortunately I do not know if it is possible to connect two devices with this framework and hold an exchange of information ( messages and files ) the same way you do with MultipeerConnectivity framework, it is possible?
In this case there are only these three frameworks that can connect via bluetooth or are there others?
Core Bluetooth is all that you need to connect two devices. There is no need for third-party frameworks. Even though most tutorials and examples are related to temperature and heart monitors, they demonstrate the basic concepts of connecting to peripherals and transferring data between the two. Also, if you are using a third party Bluetooth or BLE chip, reference the API that came along with it.
This tutorial should be enough to get you going. It demonstrates basic broadcasting, connecting the transferring data:
Practical Core Bluetooth Tutorial
And if you want to learn about the more inner-workings of Core Bluetooth, check out Apple's Docs:
About Core Bluetooth
Checkout LGBluetooth. It is a lightweight library for interacting with CoreBluetooth. It lets you send serial data to connected devices and peripherals.
Related
For a project of mine I need a pairless bluetooth data transfer. I have first thought about doing it with BLE IBeacons but they can only advertise a very limited amount of data. I looked further through the Apple documentation and found this tutorial about Central/ Peripheral
BLE data transfer. I've implemented the code in my project but even though the devices were very close together they could not "see" each other. I have since looked up on the Internet and could not find a hint about whether the devices need pairing or not and what the problem of mine could be(the code is not throwing any errors nor warnings).
If it does require pairing, is there some way to do that in the background without requiring the user to perform an action, so that I could theoretically advertise some kind of pair request via. IBeacons to then transfer the data? If that's not the case, is there even a way to transfer data (mono directional, round about 512 bytes) between nearby bluetooth devices without user actions?
greets from germany!
To get started with Bluetooth Low Energy or any other protocol, it's best to learn how it works. At least basics.
Simplifying. BLE allows you to send data:
"Passive" (without conncetion) - over Advertisement Data. The size of the packages depends on the BLE version.
"Active" (requires connection with the device) - bidrirectional comunication. In this case size of the data package also depends on the BLE version.
Bonding and pairing is a separate issues.
I suggested you look at the following book:
https://www.oreilly.com/library/view/getting-started-with/9781491900550/
The websites of BLE module manufacturers also offer a lot of information about this technology. For example Nordic or TI. Very often with sample programs for various platforms.
For iOS:
https://developer.apple.com/videos/play/wwdc2017/712/
https://developer.apple.com/bluetooth/
You may also be interested in sending more data without connection using version BLE 5.0
https://www.bluetooth.com/blog/exploring-bluetooth5-whats-new-in-advertising/
I was looking at a couple CoreBluetooth tutorials for iOS. Based on the tutorials, it looks like one device is transmitting data and the other device is receiving. Like in this example: http://www.raywenderlich.com/52080/introduction-core-bluetooth-building-heart-rate-monitor the heart rate monitor is transmitting and the iphone is receiving. Is there a way to just connect to device to control it?
For example, I have a soundbar that is Bluetooth and can I write an app to do the same thing the remote it comes with does (volume up, volume down, input source change, power off)?
Adafruit proposes a lot of tutorials / material to learn how to use BLE (Bluetooth low energy)
tutorial about their BLE module (that could run with an Arduino): https://learn.adafruit.com/getting-started-with-the-nrf8001-bluefruit-le-breakout
tutorial about their iOS app (to connect to the previous module): https://learn.adafruit.com/bluefruit-le-connect-for-ios
iOS app source code to connect to BLE devices or play with previous module: https://github.com/adafruit/Bluefruit_LE_Connect
If you need one way transmission with the maximun data rate you need to read this article:
http://www.tbideas.com/blog/2013/04/Optimizing-Bluetooth-Low-Energy-Performance/
it talks about CBCharacteristicWriteWithoutResponse
Stackoverflow thread about the same one way communication subject:
iOS. BLE. CBCharacteristicWriteWithoutResponse - How to make it work?
Hope this helps!
I am working on a project where I need a two-way communication channel between iOS and a Ubuntu server for exchanging string messages.
Question
Is there a single Bluetooth profile for accomplishing this? I think Object Push Profile allows for this kind of interaction. But looking at iOS: Supported Bluetooth profiles it seems that iOS does not support this profile.
How else can I accomplish this? Any supporting links to sample code or doc for implementing the services and characteristics on either sides much appreciated.
Literature survey
I found two tutorials - Arduino Tutorial: Integrating Bluetooth LE and iOS with Swift and Using Bluetooth.
The first one provides sample code for creating a BT service for transferring small amounts of data from iOS to Arduino. The second link describes how to implement the Headset Profile (HSP). However, these only address 1-way communication.
I am new to Objective c and I want to send simple strings from an iPhone to an arduino an vice versa with Bluetooth. I have read apples information about Core Bluetooth, but I am having trouble understanding it. As I said, all I need the iPhone to do is: 1) connect to the BLE device of the arduino. 2) Send instructions (in the form of strings) 3)get a response from the arduino when the instructions have been carried out, so that the next set of instructions can be sent. I would be very happy if somebody is able to help me with this project
Thanks
You should follow the wwdc presentation on core bluetooth.
You should probably start here
I suggest operate your device with YMSCoreBluetooth.
The basic step to operation bluetooth device is:
Search all nearby device by blue tooth scan, you will find all nearby device.
Stop your scan. Connect one of the devices found in response.
Discover all services on the device.
Discover all character in service found by service discover action.
Write your content into character found in 4.
You can read character value from device.
YMSCoreBluetooth let you write your logic in one code block instead of separate delegate.
I am making an app to control the an iOS app (A) in a device remotely from another iOS device using another app(B). App B will send some data to A and B will get the response data from A. The data might be text or images. This data transmission can be done by using bluetooth.
So the problem is once A and B gets connected. In the next launch both should be connected automatically if they are in the available bluetooth range.
I go through Game-kit , Multi-peer connectivity, core bluetooth, externalAccessory frameworks. What i observed from these.
Using GameKit and multi-peer connectivity frameworks every time we should send and accept the invitation in different devices.
And from core bluetooth we can send data only and can't receive data except we implement the two way peripheral and central.
And from external Accessory framework we can access an iOS device from an external peripheral.(I think the classic bluetooth can be implemented using externalAccessory framework)
So what my question how can i accomplish this.And can i achieve the above using Bonjour via bluetooth?. And I am right for the details.If not correct me. and guide me in the proper direction to achieve this.