kisshexuxia 2017-06-12 07:40 采纳率: 50%
浏览 7244
已采纳

win10 下winform调用 ble低耗能蓝牙接口

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();
        }
    }
}
  • 写回答

4条回答 默认 最新

  • QQ309923459 2017-06-12 08:16
    关注

    不好意思表示看不懂,有大神吗?麻烦说一下

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(3条)

报告相同问题?

悬赏问题

  • ¥15 求差集那个函数有问题,有无佬可以解决
  • ¥15 【提问】基于Invest的水源涵养
  • ¥20 微信网友居然可以通过vx号找到我绑的手机号
  • ¥15 寻一个支付宝扫码远程授权登录的软件助手app
  • ¥15 解riccati方程组
  • ¥15 display:none;样式在嵌套结构中的已设置了display样式的元素上不起作用?
  • ¥15 使用rabbitMQ 消息队列作为url源进行多线程爬取时,总有几个url没有处理的问题。
  • ¥15 Ubuntu在安装序列比对软件STAR时出现报错如何解决
  • ¥50 树莓派安卓APK系统签名
  • ¥65 汇编语言除法溢出问题