[英]C# Establishing stream from laptop internal bluetooth 4.0 to Bluetooth Low Energy (BLE) peripheral
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. 我正在尝试编写一个连接到蓝牙低功耗设备(BLE)的程序,然后在更新或给定间隔内读取特征。
My Peripheral is a Texas instruments CC2540 BLE device. 我的外设是德州仪器CC2540 BLE设备。
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 我的出发点是查看TI的示例程序,该程序具有心率监视器: 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). 然而,这使用了加密狗,我的任务是使用内部蓝牙4.0调制解调器(稍后将在Android上制作它,但是现在,我只使用Windows)。
Now my problem is that the dongle creates a COM port, but the internal modem does not. 现在我的问题是加密狗创建了一个COM端口,但内部调制解调器没有。 I still managed to use the 32feet API to scan and succesfully find the CC2540.
我仍然设法使用32feet API扫描并成功找到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.
我已经尝试过调用connect()方法,但它总是无法连接,无论是通过超时还是声明存在死网络。
Any ideas why this happens? 任何想法为什么会这样? Am i supposed to do something else than calling my device.connect() ?
我应该做些什么而不是调用我的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. 我不想误解你,但32feet目前不支持蓝牙低功耗。 (As for Nov 2012).
(至2012年11月)。
There does not seem to be support for Bluetooth Low Energy using the 32Feet library . 似乎没有使用32Feet库支持蓝牙低功耗。 See here .
看到这里 。 Alternatatively you can have a look at this Bluetooth library that does provide support but i have not tried it and cannot claim how good the support is .
另外,你可以看看这个提供支持的蓝牙库,但我还没有尝试过,也无法声称支持有多好。 See here
看这里
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.