我将在 VC++ 中开发一个用于蓝牙通信的应用程序。我的目标是在没有密钥通信的情况下配对两个蓝牙设备。因为我的应用程序正在使用蓝牙 API。任何人都可以通过提供代码来帮助我完成任务吗?
			
			1643 次
		
1 回答
            1        
        
		
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; }
使用 PC 和设备通用的密钥代替strDevicePassKey.
于 2012-07-24T07:45:59.557   回答