My problem is setting the PIN without the user being promped to do.
I have tried the InstalledServices but it gives the Serial service ONLY after the device has been connected (so after it has been paired).
Finally I resolved the issue using this code:
InTheHand.Net.BluetoothEndPoint ep = new InTheHand.Net.BluetoothEndPoint(device.DeviceAddress, InTheHand.Net.Bluetooth.BluetoothService.SerialPort);
if (!device.Authenticated)
{
InTheHand.Net.Bluetooth.BluetoothSecurity.SetPin(device.DeviceAddress, pin);
}
client.Connect(ep);
client.Close();
which seems to work (I am still testing it).
Now I have the inverse problem: I want my application to listen on the BT and wait for a serial connection request.
On the request (which might be with security) I want the PIN to be passed by the application (without prompting to the user), and I want the serial connection to be established.
I am looking at BluetoothSerialPort and BluetoothListener classes but I don't see the way to get the device info of the client which is trying to connect to the application.
Any suggestion here ?
Thanks.