Flutter_blue: Bluetooth Classic support

Created on 9 Oct 2018  Â·  18Comments  Â·  Source: pauldemarco/flutter_blue

Some users would like this library to support Bluetooth Classic devices, such as serial.

This will be the main issue to track support for Bluetooth Classic.

Most helpful comment

Any progress on Bluetooth Classic serial support? I am going to use this library to connect to an ESP 32 device.

All 18 comments

Any progress on Bluetooth Classic serial support? I am going to use this library to connect to an ESP 32 device.

@pauldemarco I assume you do not have much time so maybe there is anything I could do? any task etc?

I'd also be willing to chip in. I really need regular BT support. Not just BLE

Let's get a discussion going about use cases:

What type of device/profile would you like to communicate with?

On Sun, Jan 20, 2019, 1:39 PM Stuart Bowman <[email protected] wrote:

I'd also be willing to chip in. I really need regular BT support. Not just
BLE

—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
https://github.com/pauldemarco/flutter_blue/issues/118#issuecomment-455891123,
or mute the thread
https://github.com/notifications/unsubscribe-auth/AP829ji1jDzm4oRFrf6F8yHL6MaLS-3wks5vFLfngaJpZM4XR3cl
.

I have a use case for a personal project I'm working on. I'd like to connect to a RPI3 and transfer data. I'd prefer to use a classic bluetooth connection, as BLE requires the user to have newer hardware.

I'd like to create a mobile app where multiple modern smartphones can communicate through classic Bluetooth.

Does it make sense to integrate this? iOS has no Bluetooth Classic support (source) and most likely never will.
When it comes to Android, there already is a working Flutter package.

For those looking to use devices such as the HC-05 to communicate with microcontrollers (ie. Arduino), the HM-10 is a valid BLE alternative.

Even though serial communication is not part of the BLE standard, HM-10 (and other BLE chips from the HM series) expose serial comms through the 0xFFE0 service, which has one characteristic, 0xFFE1 (source)

Actually on second thought, I think I've got my RPI3 working with BLE. I'm good with just using Flutter_Blue now :)

@kerberjg iOS devices do connect using Bluetooth Classic, although it must be a MFi certified device in order to connect. https://stackoverflow.com/a/18214742/375209. The changes would mostly require the introduction of a EAAccessory handler in the plugin.

In general, a few things would be different with BTc

  1. Scanning for devices on Android is a little different. You submit a scan request and listen for intents (android.bluetooth.adapter.action.DISCOVERY_FINISHED). On iOS, you let the system scan and prompt the user for the device they want to connect to https://developer.apple.com/documentation/externalaccessory/eaaccessorymanager/1613913-showbluetoothaccessorypicker. So you can do this in-app, but not with app UI.
  1. Connecting to a BTc most likely means connecting RFCOMM on a certain UUID.
    For Android, there is a well-known UUID (https://stackoverflow.com/a/21760106/375209) which connects to RFCOMM serial port. Some devices may support additional UUIDs (which should be discovered). This used to be integer based ports, but the integer based API is hidden.

On iOS, you'd open a EASession to a EAAccessory as discovered earlier: https://developer.apple.com/documentation/externalaccessory/easession

On either platform, once connected, you'll get access to an input & output stream for transfer.

@pauldemarco do you think this is something a flutter_classic_blue plugin would be more suitable? It seems like a different architecture than what you have implemented now.

I would like to entertain the possibility of including Classic into this package. The API would need to be refactored to include that functionality onto the BluetoothDevice class --much like Android has it.

But contrastingly, if the developer is for the most part only ever going to use BLE or Classic, it might make more sense to keep them separate.

I'm leaning towards 2 packages for now... both adapting until they have cleanest/most robust API possible, then reconsider merging together to have an all-in-one solution to Flutter Bluetooth.

@pauldemarco Would be amazing!
I'm looking for something like https://github.com/don/BluetoothSerial

Missing Bluetooth Classic support in Flutter is currently preventing me from giving it a try

@pauldemarco I wonder how there is no single useful library to connect with classical bluetooth devices in flutter?!
That is very important thing to have.
In my case i want to connect the app i want to make with a heart rate sensor through bluetooth and that sensor is not a BLE device, how could i do that know?

I also have a use case for connecting to a heart rate sensor that isn't currently identified by flutter_blue during a scan.

@pauldemarco Hi Paul, may I ask if there is any plans for the Bluetooth Classic support? Thanks.

You should use https://github.com/edufolly/flutter_bluetooth_serial for Bluetooth Classic (Serial) I think.

https://github.com/edufolly/flutter_bluetooth_serial

@PsychoXIVI Unfortunately there is no support for iOS :(

@aytunch It's because iOS does not allow unauthorized (by Apple) apps to use raw Bluetooth sockets API as far I know.

@PsychoXIVI that is correct but the API could probably be integrated into https://github.com/edufolly/flutter_bluetooth_serial to support IOS.

I think flutter_blue should stay just on BLE to keep the API simpler.
Mixing use cases is not a good idea.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

pauldemarco picture pauldemarco  Â·  3Comments

M3sca picture M3sca  Â·  3Comments

Fleximex picture Fleximex  Â·  5Comments

Fleximex picture Fleximex  Â·  3Comments

Ahmadre picture Ahmadre  Â·  5Comments