Reputation:
I am going to develope a application in VC++ for bluetooth communication.My aim is to pair two bluetooth devices without the passkey communication.For my application am using the BluetoothAPI. Anybody can help me to complete my task by providing the code?
Upvotes: 3
Views: 1732
Reputation: 6588
string BTMac = "00:01:58:08:3D:ED";
BluetoothAddress BTAddress;
BluetoothClient BTClient = new BluetoothClient();
BluetoothEndPoint BTEndPoint;
Guid spguid = BluetoothService.SerialPort;
BTAddress = BluetoothAddress.Parse(BTMac);
BTEndPoint = new BluetoothEndPoint(BTAddress, spguid);
try
{
BluetoothSecurity.PairRequest(BTAddress, strDevicePassKey);
Application.DoEvents();
BTClient = new BluetoothClient();
BTClient.Connect(BTEndPoint);
return true;
}
catch { return false; }
Use a key common to both PC and device in place of strDevicePassKey
.
Upvotes: 1