[Fixed] How to BLE disconnect an Argon from a central device? (any timeout?)

Hey there,

I would like to know if an Argon, acting as a BLE peripheral, can disconnect itself from the central device (let’s say a mobile app).
Looking at the docs, there are BLE.disconnect() functions but they seem geared to be used on central mode (or when an Argon acts as a central device).

Is there a way to protect the firmware from a connection that is left open for too long?
Is there a timeout in the BLE implementation of a Particle device?


BLE.disconnect() with no parameter can be used in peripheral mode to disconnect the central. There’s no parameter since a peripheral can only be connected to one central device at a time.

The overload that takes a BlePeerDevice is used in central mode to know which peripheral to disconnect, since there could be more than one.

There is no automatic disconnect, but you can implement your own timeout and use BLE.disconnect().

1 Like

Alright, thank you.

Below is a little twist to the story that I would like to confirm with Particle.

This is my situation:
I have Argon 1 working in central mode and connected to Argon 2. This uses the BLE_group library provided by Particle.
I also have a mobile app that connects to Argon 1. I understand in this connection Argon 1 is using peripheral mode.

This is what I observe:
When Argon 1 executes BLE.disconnect(), it disconnects the mobile app, but it keeps the BLE_group connection on.
This is great! since this is what I want to happen.

This is what I want to confirm with Particle:
It seems that the BLE.disconnect() targets only connections in peripheral mode, although the docs say:
Disconnects all peers.

It seems that BLE.disconnect(peripheral) targets only connections in central mode.
And this is in line with the docs:
Typically used in central mode when making connections to multiple peripherals to disconnect a single peripheral.

Can you confirm that BLE.disconnect() targets only connections in peripheral mode and will not affect connections in central mode?

Apologies if this looks like nit-picking!

The docs are wrong. The disconnectAll() method disconnects all peers. The behavior of the command with no parameter should match the comment in the source:

Awesome! Thank you for digging into the code and confirming.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.