C#建立从笔记本电脑内部蓝牙4.0到蓝牙低功耗(BLE)外设的流

我正在尝试编写一个连接到蓝牙低功耗设备(BLE)的程序,然后在更新或给定间隔内读取特征。

我的外设是德州仪器CC2540 BLE设备。

我的出发点是查看TI的示例程序,它有一个心率监视器: http : //processors.wiki.ti.com/index.php/Category : HealthDemo

然而,这使用加密狗,我的任务是使用内部蓝牙4.0调制解调器(稍后将在Android上制作它,但是现在,我只使用Windows)。

现在我的问题是加密狗创建了一个COM端口,但内部调制解调器没有。 我仍然设法使用32feet API扫描并成功找到CC2540。 但是,从这里我不知道该怎么办。 我试过调用connect()方法,但它总是无法连接,无论是超时还是声明存在死网络。

任何想法为什么会这样? 我应该做些什么而不是调用我的device.connect()?

代码段:

BluetoothClient cli; BluetoothDeviceInfo[] peers; BluetoothDeviceInfo device; BluetoothAddress adr; //... skipping code that finds the device and assigns the address to it. if (device.InstalledServices.Length != 0) { try { //MessageBox.Show("attempting to connect"); cli.Connect(device.DeviceAddress, device.InstalledServices[2]); //tbDeviceInfo.AppendText("\n\nConnected " + device.Connected); } catch (Exception ex) { MessageBox.Show(ex.Message); // i always get this exception. } } 

我不想误解你,但32feet目前不支持蓝牙低功耗。 (至2012年11月)。

似乎没有使用32Feet库支持蓝牙低功耗。 看到这里 。 另外,你可以看看这个确实提供支持的蓝牙库,但我还没有尝试过,也无法说明支持有多好。 看这里