Skip to content

Feature Request: Make autoConnect parameter configurable in connectGatt #45

@quasarsuport-del

Description

@quasarsuport-del

First of all, thank you for your work on the able-recipe library — it's been very helpful!

I’d like to suggest a small improvement to increase the flexibility of the connectGatt method. Currently, the method includes a hardcoded value for the autoConnect parameter:

public void connectGatt(BluetoothDevice device) {
    Log.d(TAG, "connectGatt");
    if (mBluetoothGatt == null) {
        mBluetoothGatt = device.connectGatt(mContext, false, mGattCallback, BluetoothDevice.TRANSPORT_LE);
    } else {
        Log.d(TAG, "BluetoothGatt object exists, use either closeGatt() to close Gatt or BluetoothGatt.connect() to re-connect");
    }
}

device.connectGatt(mContext, false, mGattCallback, BluetoothDevice.TRANSPORT_LE)
In this case, the autoConnect parameter is always set to false. This limits the ability to automatically connect to a device once it becomes available.
Could you consider modifying the library so that the autoConnect value can be passed dynamically (e.g., as a parameter or configuration option)? This would allow developers to choose between direct and automatic connections based on their use case.

Thanks in advance for considering this improvement!

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions