zoukankan      html  css  js  c++  java
  • C#蓝牙开发之查找设备以及配对

               
    BluetoothClient Blueclient = new BluetoothClient();
             Dictionary<string, BluetoothAddress> deviceAddresses = new Dictionary<string, BluetoothAddress>();
             BluetoothRadio BuleRadio = BluetoothRadio.PrimaryRadio;
                BuleRadio.Mode = RadioMode.Connectable;
                BluetoothDeviceInfo[] Devices = Blueclient.DiscoverDevices();
                lsbDevices.Items.Clear();
                deviceAddresses.Clear();
                foreach (BluetoothDeviceInfo device in Devices)
                {
                    //循环将所有搜索到的设备添加进来。
                    lsbDevices.Items.Add(device.DeviceName);
                    deviceAddresses[device.DeviceName] = device.DeviceAddress;
                }
     
    配对:
          Blueclient.SetPin(DeviceAddress, txtPwd.Text.Trim());
          Blueclient.Connect(DeviceAddress, BluetoothService.Handsfree);

    PC上安装Windows Mobile 6.0 SDK和ActiveSync同步软件,ActiveSync目前为4.5版本,通过VS新建的程序便可以部署在相应的设备上面,这里我使用自己的手机来作为测试机,刚好手机也是Windows Mobile的系统.

    点击“Find Devices”开始搜索周围的蓝牙设备

    下图为搜索到的蓝牙设备。图中PC-2012...为我的开发电脑,电脑上面安装了有一个蓝牙的驱动,另一个6690的另一个开了蓝牙的手机.。

    选中一个设备进行连接。

    如果这里不输入对方设置的密码或者输入错误的密码,那么会提示“目标主动拒绝。。。”
     

    如果密码正确,则可以正常配对。
     

    从下图可以看得出已经配对成功了,

    另外,通过VS的远程放大可以捕捉到设备的屏幕,

    BlueTooth
查看全文
  • 相关阅读:
    Java框架第二次课
    知识扩展1——最大似然估计
    知识扩展2——熵 ,KL散度,交叉熵,JS散度,Wasserstein 距离(EarthMover距离)
    知识扩展3——广义线性模型GLM
    3 逻辑回归
    朴素贝叶斯
    GAN 的后序
    mysql 多个字段字符串合并成一个字段
    qt离线下载
    “用户”,你凭什么说改框架?
  • 原文地址:https://www.cnblogs.com/allen0118/p/2657327.html
  • Copyright © 2011-2022 走看看