public bool ConnectBlueTooth()
{
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; }
}
Hiç yorum yok:
Yorum Gönder