winform调用 ble低耗能蓝牙接口 InTheHand.Net.Personal.dll不支持ble低耗能蓝牙
用WIN10自带的await BluetoothLEDevice.FromIdAsyn没有反应
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using Windows.Devices.Bluetooth;
namespace WindowsFormsApplication1
{
public partial class Form1 : Form
{
private BluetoothLEDevice bluetoothLeDevice = null;
public Form1()
{
InitializeComponent();
}
private async void ConnectButton_Click()
{
try
{
// BT_Code: BluetoothLEDevice.FromIdAsync must be called from a UI thread because it may prompt for consent.
bluetoothLeDevice = await BluetoothLEDevice.FromIdAsync("BluetoothLE#BluetoothLEb8:86:87:f6:1e:a5-78:a5:04:91:db:fc");
}
catch (Exception ex) when ((uint)ex.HResult == 0x800710df)
{
// ERROR_DEVICE_NOT_AVAILABLE because the Bluetooth radio is not on.
}
}
private void button1_Click(object sender, EventArgs e)
{
ConnectButton_Click();
}
}
}
不好意思表示看不懂,有大神吗?麻烦说一下
BluetoothLE#BluetoothLEb8:86:87:f6:1e:a5-78:a5:04:91:db:fc 这个不是ID这个是MAC地址 b8:86:87:f6:1e:a5是本机的蓝牙地址。78:a5:04:91:db:fc这是你要连的那个设备的地址。
using Windows.Devices.Bluetooth;
我的winfrom找不到这个东西,怎么才能弄进去?
找不到的话可以发邮件给我 fail572872916@163.com
请问你可以扫描到BLE的设备了吗?可不可以分享给我学习学习,1256824300@qq.com