BLE Flutter App Advice

Hi All,

I am hoping to make a simple Flutter app to communicate with a Boron via BLE. Required functionality:

  1. Scan and connect to Boron within range.
  2. Send some basic commands from the phone to the boron. eg. Tell Boron to scan for rfid, set some variables etc.
  3. Boron while connected to bluetooth will enter a BLE state in my FSM and continuously collect and send sensor data to the phone.

I’m assuming the correct ‘BLE’ way is just to setup notify characteristics within the particle code and also have a write characteristic to accept commands. But I can also see that maybe the same thing could be easily accomplished with the BLE UART. In this scenario the boron could just start sending a json object to the phone once it has been connected to and the phone could easily send commands to the particle. I am interested in hearing your opinions on one versus the other?


A library I found extremely useful is the ‘BLE WiFi Setup Manager’:

It seems like it’s only for Argon and intended to just send WiFi credentials over BLE (which is what I was using it for) but at its core is just a way to pass JSON to and from a device and can be modified extensively for whatever purpose (for instance, I added a ‘msg_type’ to send a unique user ID of the operator to the device during setup). There is even an implementation of the central side of things in a webpage:

I found it pretty straightforward to adapt aspects of the source of this page to Swift for an iOS app, but I’m not sure what kind of BLE functionality exists in Flutter.

If you’re using a Boron though, it might be much more straightforward to just implement these commands as cloud functions and then call them either from your app or a backend your app interfaces with, unless latency is a big issue or you’re exchanging a tremendous amount of data that is only needed locally.

1 Like