c# 低功耗蓝牙_C#中建立从笔记本电脑内置蓝牙4.0流蓝牙低功耗(BLE)外设

本文档描述了尝试使用C#编程连接蓝牙低功耗(BLE)设备,特别是Texas Instruments CC2540设备时遇到的问题。问题在于内置的蓝牙4.0调制解调器不创建COM端口,而dongle可以。尽管能够通过32feet API扫描并找到设备,但尝试连接时失败。解决方案指出,截至2012年11月,32feet库尚不支持BLE。
摘要由CSDN通过智能技术生成

I am trying to write a program that connects to a Bluetooth Low Energy device (BLE), and then read a characteristic either on updates, or on a given interval.

My Peripheral is a Texas instruments CC2540 BLE device.

My starting point was looking at the example program from TI, that has a heart rate monitor:

http://processors.wiki.ti.com/index.php/Category:HealthDemo

However, this uses the dongle, and I am tasked at using the internal bluetooth 4.0 modem (going to make it on android later on, but for now, I just use windows).

Now my problem is that the dongle creates a COM port, but the internal modem does not. I still managed to use the 32feet API to scan and succesfully find the CC2540. However, from here I do not know what to do. I've tried calling the connect() method, but it always fails to connect, either by timeout or stating that there is a dead network.

Any ideas why this happens? Am i supposed to do something else than calling my device.connect() ?

Code snippet:

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.

}

}

解决方案

I do not want to mistake you , but 32feet currently does not support Bluetooth low energy. (As for Nov 2012).

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值