How to set a custom connection timeout in 32feet

405 views Asked by At

I am developing code in C# to communicate with a custom Bluetooth device. The code I use to connect to the device essentially looks like this:

BluetoothDeviceInfo device_info = new BluetoothDeviceInfo(BluetoothAddress.Parse(address_str));
try
{
    BluetoothClient connection = new BluetoothClient();
    connection.Connect(device_info.DeviceAddress, BluetoothService.SerialPort);

    if (connection.Connected)
    {
        ...
    }
    else
    {
        ...
    }
}
catch (Exception e)
{
    ...
}

The problem is that the Connect call often times out after about 5s. Sometimes it succeeds after about 3s and I have reason to believe that a connection could be established successfully if I allowed more time. However, I have nowhere set this timeout of 5s. I just call the Connect method and it times out at some point.

Is there a way to configure this timeout somewhere in 32feet?

0

There are 0 answers