Good afternoon . I'm working on a application that is suppose to transfer files from Computer to a Smartphone through Bluetooth but the pairing isn't working how i expected.
Pairing with 32feets Library :
BluetoothEndPoint remoteEndPoint = new BluetoothEndPoint(selecteddevice.DeviceAddress,BluetoothService.ObexFileTransfer);
The last parameter is suppose to be the Bluetooth adapter GUID . If i feed it by
BluetoothService.SerialPort . I can connect only to Iphone SE
BluetoothService.ObexFileTransfer . I can connect only with Allview Soul Xtream Mini . Also i got a galaxy tab 2 which i can't connect in either ways . I used a catch and the error is the following :
- ex {"The requested address is not valid in its context 4CBCA5CAA8A0:0000110600001000800000805f9b34fb"} System.Net.Sockets.SocketException
I have done some research and this is what i found : https://32feet.codeplex.com/wikipage?title=Errors
Pairing code :
private void Connect()
{
SelectBluetoothDeviceDialog bldialog = new SelectBluetoothDeviceDialog();
serviceClass = BluetoothService.SerialPort;
bldialog.ShowAuthenticated = true;
bldialog.ShowRemembered = true;
bldialog.ShowUnknown = true;
if (bldialog.ShowDialog() == System.Windows.Forms.DialogResult.OK)
{
if (bldialog.SelectedDevice == null)
{
System.Windows.Forms.MessageBox.Show("No device selected", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
return;
}
BluetoothDeviceInfo selecteddevice = bldialog.SelectedDevice;
BluetoothEndPoint remoteEndPoint = new BluetoothEndPoint(selecteddevice.DeviceAddress, BluetoothService.ObexFileTransfer);
client = new BluetoothClient();
try
{
client.Connect(remoteEndPoint);
}
catch (SocketException ex)
{
return;
}
catch (ObjectDisposedException ex)
{
return;
}
catch (IOException ex)
{
return;
}
textBox.Text += string.Format("Connected to: {0}", selecteddevice.DeviceName);
textBox.Text += string.Format("Bluetooth Device Browser. Current Device: {0}", selecteddevice.DeviceName);
}
}
As Bluetooth i'm using ASUS USB-BT400 . What could i do in order to solve my connection problems ?