Multiple BLE Connections using Flutter - flutter

I am working on a cross-platform mobile app that will connect to 5 or more BLE devices simultaneously and send/receive data. These BLE devices are trackers that monitor objects movement and transmit data intermittently.
I have a few questions regarding this and I couldn't find any clear answers online:
Is flutter a good choice for this application considering BLE communication is the primary concern?
How many stable simultaneous connections are possible using flutter for both iOS and Android?
Sending/Receiving data from multiple BLE devices simultaneously (can be asynchronous) is achievable? Are there any existing issues in this?
Does flutter library automatically handle multiple connections and simultaneously send/receive data?
Any recommended libraries for this application?
Any example of cross-platform app that has multiple BLE connections and communication. (preferably flutter)
Thanks.

Both iOS and Android support multiple BLE connections. It all depends on the Bluetooth controller's maximum number of connections and if the phone manufacturer has added additional restrictions. 5 should definitely be supported on most phones.
All BLE stacks and libraries I've seen support send/receive for multiple devices out-of-the-box since you will get one object/handle per device or connection.
So to all your Bluetooth-specific questions I would answer "yes". Just note that once you reach the maximum number of connections, you might get different various errors or that it simply never connects to the next device, since this is not handled in a unified way, at least not on Android.
Now, Flutter itself is just a UI toolkit and has not really so much to do with the Bluetooth stack's stability and features. Since Flutter uses Dart as programming language you however have to write a bridge between native bluetooth code and Dart (or use an existing plugin someone else has already written). If this is a "good choice" is out of scope for Stack overflow since that is an opinion-based question. But there are a lot of people using Flutter for BLE apps...
Library recommendations are also out of scope for Stack Overflow.

Related

how can i make my flutter application detects other phones using ble?

I'm using an app that uses Bluetooth low energy to scan and detect devices however it does not detects other phones
is there a specific way on flutter to make it detect other mobile phones
You can only detect BLE devices that are advertising their services. A mobile phone often does not do that on its own. There are two solutions:
Use an already available app on the other device to advertise some service. One of the possible apps I personally use is nRF Connect, another one would be BLE Peripheral.
This might not be sufficient depending on your project and goal this might not be sufficient. If you need some specific service or characteristic that can't be generated by pre-existing apps you have to develop your own app for advertising. This would be possible with flutter_ble_peripheral (limited functionality on iOS)

Peer-to-peer communication between iOS devices

I am trying to prototype a solution to a problem and am currently exploring multiple routes I could try. Is it possible for one iOS device, running a certain app, to communicate directly with another iOS device, running the same application - without the need to be on the same LAN?
Solutions I am currently investigating are using Bluetooth and ad-hoc wireless connections.
Ideally, the application when installed would ask the user for the required permissions, and then would accept and/or send data to/from another client after a handshake had happened.
My concern with Bluetooth is that 'pairing' would need to happen with every device, rather than happen in the background once the user has installed the app. I have a feeling what I am talking about isn't possible from what I've been reading elsewhere on Stackoverflow.
Take a look at Bluetooth Low Energy.
https://developer.apple.com/library/ios/#samplecode/BTLE_Transfer/Introduction/Intro.html#//apple_ref/doc/uid/DTS40012927
Here is another example,
https://github.com/KhaosT/CBPeripheralManager-Demo
You might also want to look into GameKit and peer-to-peer connectivity there.
I can't tell you anything about it, but you might try looking at iOS 7. If that's an option, I'd take a look. Can't talk about what it is because of NDA though.
Depending on what you need to communicate, you could try checking out this project, which lets you share arrays of strings between iOS devices over Bluetooth LE.
You don't need to "pair" the devices and it can still communicate while the app is in the background. SimpleShare
Hope it helps!
From the documentation of MultipeerGroupChat:
MultipeerGroupChat sample application utilizes the Multipeer Connectivity framework to enable nearby users to discover, connected, and send data between each other. This sample simulates a simple chat interface where up to 8 devices can connect with each other and send text messages or images to each other. Here you will learn how to bring up framework UI for discovery and connections and also how to monitor session state, listen for incoming data and resources, and send data and resources.
This is an excellent example at developer.apple.com here is the link
https://developer.apple.com/library/ios/samplecode/MultipeerGroupChat/Introduction/Intro.html
Also this tutorial from Ralf Ebert demonstrates how to use Multipeer Connectivity framework for peer communication should help you.
https://www.ralfebert.de/tutorials/ios-swift-multipeer-connectivity/

Application that receives DVB-H broadcast signal

DVB-H is a fairly new broadcasting medium. One purpose it is used for is to broadcast TV channels to TV phones and mobile decoders.
The software supplied by the service provider for windows does the job, but the display is small. I want to explore the possibilities of creating my own software that receives the signal and displays it to the screen. Also perhaps create an application to do the same on Blackberry and Android phones.
Anyone with any leads as to where I can get more info on coding with for DVB-H Broadcasts?
If you are working with Linux, you can probably best use Linux API (see this) under the LinuxTV project.
Alternatively, in J2ME based platforms you can follow JSR272 to access the DVB-H receiver. See this and this for more reference.
Unfortunately DVB-H based devices are specialized, so you need to specify which devices you want to support.

App communication in nearby devices without user intervention

Is it possible to communicate two instances of an app:
In nearby devices (Android or iPhone)
Without user intervention (aside from starting the app once)
Without internet (but not network) connection?
How?
Android to Android?
iPhone to iPhone?
Android to iPhone and vice-versa?
Let us ignore the issues associated with implementing the network communication at the application level and focus on the system design problem your question raises.
You want an application on one device to connect to another associated application on another device without any user intervention/interaction beyond launching the device. In order for this to work your system is going to need a 3rd party separate from the two devices/applications that provides a lookup service.
What will need to happen is each application will need to communicate with this service, ask for the data regarding other device it should connect to, if it exists, and then attempt that connection. This is basically how a bittorrent tracker works.
Keep in mind that there's quite a bit more involved in the implementation than that simple scenario suggests. For example, the proper registering/unregistering of devices, registration timeouts, security, etc.
Unless I misunderstand your question, you should be able to just use standard sockets (TCP or UDP depending on your needs) for communication between any/all devices. For iPhone, you could probably use the NSStream classes and for Android you'd use the Socket classes.
Can the new NFC feature be an answer to this?

Is it possible, in principle, for an Android device to interface with an iPhone over Bluetooth/GameKit?

(I am not interested in pure theory, but as a practical near or mid-term possibility, say within 12-24 months.)
As a developer familiar with (but not specializing in) two major smartphone platforms, should I expect an Android library to come out which can spoof itself onto an iPhone app's GameKit-based network. It seems reasonable that a Bluetooth interface between platforms might square the opportunity to make useful applications, in the same way that modems benefited PC/Mac platforms via Metcalfe's Law.
I am looking for one of two answers:
Is this obviously not likely (e.g. because of encryption)? If so, what is the reason? Is it possible in principle, but requiring years of reverse-engineering (like SMB/CIFS/Samba)? Or is it a no-brainer and just a matter of time? Please give evidence supporting your reason.
Is there an alternative way to have direct peer-to-peer networking besides GameKit? For example, a hand-rolled network using Bluetooth or ad-hoc WiFi? It would be nice to spoof an Android device into an existing iPhone app but my main question is, can the devices speak with each other at all!
Yes, it is possible. GameKit is a protocol using TCP and/or UDP over a BNEP Bluetooth connection. It also uses a trick to identify other iOS devices using the Extended Inquiry mechanism in Bluetooth 2.1+.
I was able to simulate the EIR responses, now, someone needs to reverse engineer the GameKit protocol. This doesn't need Bluetooth, as it is also used for GameKit connections over WLAN.
If anybody can re-implment GameKit for WLAN connections, I can finish the Bluetooth version.
No, and it wont come soon or even at all... Apple pride themselves with their security features, and bluetooth connections can access private data. There will probably not be any cross platform bluetooth framework until something is agreed upon by both companies.
Bump as said by a previous answerer uses a remote server, and the data transferred is not via BT.
GameKit is Bonjour so a Bonjour (which is on IP) over Bluetooth on Android should work.
That should be possible as Bluetooth is capable of setting up tcp/ip networks. Though I have no knowledge of the IPhone SDK whatsoever, but Android does have a BluetoothSocket and BluetoothServerSocket for TCP connections.
This article, http://blog.moritzhaarmann.de/blog/2014/04/27/sorry-state-of-p2p/ written in 2014, suggest it is possible via Bluetooth LE. Available in Android 4.3+ and iOS6+
Two issues:
According to the Android Dashboard only around 30 percent of Android devices support Bluetooth LE https://developer.android.com/about/dashboards/index.html?utm_source=ausdroid.net
Communication between Android-to-Android must be done using some other method (which is not a big problem) because Android devices cannot act as server for B LE connections.
Bounjour on the iPhone gives you full access to all of the Bluetooth protocols, so you don't have to use GameKit. As for when someone will provide an easy to use iPhone to Android GameKit like framework - hard to tell.
An iPhone can already talk to any other Bluetooth device using Bonjour today.
-t
It is absolutely possible! In fact I am amazed that more people haven't done it!
Theory:
Bluetooth is just a wireless socket that you push data across and it comes across the other side, just like tcp/ip.
Practice:
http://www.techcrunch.com/2009/11/11/bump-goes-cross-platform-with-new-android-app-upgrades-iphone-version-too/
Better yet, Bump is cross-platform, which means that you can bump an Android phone with an iPhone and it should work seamlessly.