C# 32Feet.net: Invalid connection argument

28 views Asked by At

I'm trying to make a bluetooth connection between two devices,

the end result would be to create a working chat with bluetooth, but first I need to be able to connect.

so I wrote the following code:

BluetoothDeviceInfo device;
BluetoothClient client = new BluetoothClient();

IReadOnlyCollection<BluetoothDeviceInfo> devices = client.DiscoverDevices();

if (devices.Count > 0)
{
    device = devices.ElementAt(0);
    Console.WriteLine(device.DeviceName.ToString());
    Console.WriteLine(device.DeviceAddress.ToString());

}
else
{
    Console.WriteLine("Nessun dispositivo Bluetooth trovato.");
    return;
}

if (device != null)
{
    try
    {
        client.Connect(device.DeviceAddress, BluetoothService.SerialPort);

        if (client.Connected)
        {
            Console.WriteLine("Connessione al dispositivo Bluetooth riuscita.");
        }
        else
        {
            Console.WriteLine("Impossibile connettersi al dispositivo Bluetooth.");
        }
    }
    catch (Exception ex)
    {
        Console.WriteLine("Errore durante la connessione al dispositivo Bluetooth: " + ex.Message);
    }
}

The output I get is the following:

ORION
84144D92F6CF
Error connecting to Bluetooth device: Invalid argument supplied. 84144D92F6CF:00001101-0000-1000-8000-00805f9b34fb (0)

I'm using 32feet.net version: 4.1.40 and the devices I'm trying to connect are two computers

0

There are 0 answers