public static bool Open(string name) // name 设备名
{
try
{
service = BluetoothService.SerialPort;
string printValue = "";
client = new BluetoothClient();
BluetoothRadio.PrimaryRadio.
if (BluetoothRadio.PrimaryRadio.Mode == RadioMode.PowerOff)
{
BluetoothRadio.PrimaryRadio.Mode = RadioMode.Connectable;
}
myDevide = client.DiscoverDevices(24);
for (int i = 0; i < myDevide.Length; i++)
{
if (myDevide

.DeviceName.ToString().ToUpper().Trim() == name.ToUpper().Trim())
{
printValue = myDevide

.DeviceAddress.ToString();
break;
}
}
if (printValue != "")
{
BluetoothAddress btAddress = BluetoothAddress.Parse(printValue);
BluetoothEndPoint endpoint = new BluetoothEndPoint(btAddress, service);
if (client.Connected == false)
{
client.Connect(endpoint);
}
}
这是我参考的一个蓝牙链接的代码,现在可以链接成功,但是我每次链接的时候都需要我输入对方的密码,现在对方的密码是知道的,我想每次链接的时候不需要输入密码,在代码中直接输入密码,然后达到连接的时候不用输入密码,请问该如何做?