Tag: bluetooth

从C#中的蓝牙设备获取数据

我正在尝试从医疗BT设备获取数据,我已经配对了代码和通信协议。 寻找一些代码,我有这个代码: using System; using System.Collections.Generic; using System.Linq; using System.Text; using InTheHand.Net.Sockets; using InTheHand.Net; using InTheHand.Net.Bluetooth; using InTheHand.Windows.Forms; using System.Net.Sockets; using System.Diagnostics; using System.Threading; namespace dConsoleApp { static class Program { // My BT USB adapter private static BluetoothEndPoint EP = new BluetoothEndPoint(BluetoothAddress.Parse(“00:02:72:CD:9A:33”), BluetoothService.BluetoothBase); private static BluetoothClient BC = new BluetoothClient(EP); // The BT device […]

c#蓝牙LE – 写配置错误 – 从未调用ValueChanged

所以我尝试将我的c#WPF程序连接到BLE设备,这是连接到设备的代码: private async Task ConnectToWatcher(DeviceInformation deviceInfo) { try { // get the device BluetoothLEDevice device = await BluetoothLEDevice.FromIdAsync(deviceInfo.Id); // get the GATT service Thread.Sleep(150); var gattServicesResult = await device.GetGattServicesForUuidAsync(new Guid(RX_SERVICE_UUID)); service = gattServicesResult.Services[0]; // get the GATT characteristic Thread.Sleep(150); var gattCharacteristicsResult = await service.GetCharacteristicsForUuidAsync(new Guid(RX_CHAR_UUID)); characteristic = gattCharacteristicsResult.Characteristics[0]; // register for notifications Thread.Sleep(150); characteristic.ValueChanged += […]

如何在C#中以编程方式禁用(或重置)网络适配器

我需要在Windows XP Embedded上使用C#(.NET 2.0)以编程方式禁用网络适配器。 背景原因 :在PC上安装蓝牙堆栈后,蓝牙PAN适配器会阻止蓝牙管理器程序(在系统托盘中运行)。 如果我禁用蓝牙PAN,那么蓝牙管理器工作正常。 此问题仅在Windows XP Embedded计算机上发生。

Windows 10上使用32feet.NET的蓝牙配对(SSP)

我刚刚开始了一个项目,要求我将Windows 10平板电脑与另一个蓝牙设备配对。 我决定从一个简单的Windows窗体应用程序开始,以熟悉这个过程。 我在我的解决方案中添加了32feet.NET NuGet包,并且很快就成功搜索了设备并填充了列表框。 client = new BluetoothClient(); devices = client.DiscoverDevices(); if (devices.Length > 0) { foreach (var device in devices) { lstBTDevices.Items.Add(device.DeviceName); } } else { MessageBox.Show(“Unable to detect any bluetooth devices”); } 然后我添加了一个事件处理程序,以便我可以选择一个检测到的设备并尝试与它配对。 private void LstBTDevices_SelectedIndexChanged(object sender, EventArgs e) { BluetoothDeviceInfo selectedDevice = devices[lstBTDevices.SelectedIndex]; if (MessageBox.Show(String.Format(“Would you like to attempt to pair […]

连接蓝牙设备/如何设置rfcommfunction

我正在尝试连接到BlueTooth设备 我已配对它,当我搜索它时,我发现它: private async void Grid_DoubleTapped(object sender, DoubleTappedRoutedEventArgs e) { ListBox1.Items.Clear(); var devices = await DeviceInformation.FindAllAsync(RfcommDeviceService.GetDeviceSelector(RfcommServiceId.SerialPort)); var device = devices.FirstOrDefault(c => c.Name.Contains(“BMMTCA32”)); foreach (var element in device.Properties) { var strMessage = element.Key + (element.Value == null ? “” : ” = ” + element.Value.ToString()); ListBox1.Items.Add(strMessage); } } 这是我的ListBox中的输出: System.ItemNameDisplay = BMMTCA32-01 System.Devices.DeviceInstanceId = BTHENUM\{00001101-0000-1000-8000-00805f9b34fb}_LOCALMFG&0048\8&f358302&0&0012F31DECF3_C00000000 System.Devices.Icon […]

Windows Phone 8蓝牙错误HRESULT:0x8007271D

我一直在尝试开发我的Windows Phone 8应用程序来访问配对的蓝牙设备(打印机)并发送一些打印数据。 我正在开发Windows 8 64位并使用VS2012 Express。 由于仿真器不支持蓝牙,我一直在将该版本上传到诺基亚Lumia 820进行测试。 我使用了以下两个站点作为参考: http://msdn.microsoft.com/en-us/library/windowsphone/develop/jj207007(v=vs.105).aspx http://www.geekchamp.com/articles/getting-started-with-bluetooth-in-windows-phone-8 应用程序找到配对设备并通过Debug命令输出打印机名称。 代码一直运行到这一点: await socket.ConnectAsync(selectedDevice.HostName, “1”); 然后它打破了以下exception: ********** EXCEPTION OCCURED ********** Data: System.Collections.ListDictionaryInternal InnerException: Message: An attempt was made to access a socket in a way forbidden by its access permissions. (Exception from HRESULT: 0x8007271D) StackTrace: at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at System.Runtime.CompilerServices.TaskAwaiter.GetResult() […]

C#和蓝牙编程

如何才能做到这一点?

如何在c#中找到蓝牙设备的COM端口号?

我公司开发了一种使用虚拟COM端口通过蓝牙与PC通信的设备。 现在我们需要用户首先将设备与PC(MS Windows操作系统)配对,然后手动输入它的com端口号到我们的应用程序中(我敢打赌,95%的用户会因此而失败)。 所以我希望我的应用程序向用户提供配对蓝牙设备列表(他们的“友好名称”列表),之后我想自动找出被选中设备的COM端口号。 我怎么能在c#中做到这一点? (赞赏独立于安装的蓝牙堆栈的解决方案)。 提前致谢。

C#中的蓝牙,哪个堆栈,哪个SDK?

我们有一个应用程序需要能够使用蓝牙满足以下要求: 从蓝牙设备接收文件(同时最多2台设备) 显示范围内的所有蓝牙设备 将文件发送到蓝牙设备 扫描蓝牙设备并同时传输文件 我们在Windows XP上运行。 我做了一些环顾四周,似乎有3个主要堆栈: BlueSoleil的 在BlueSoleil网站上,在他们的SDK部分中,似乎只提到支持1个连接,这显然不太好。 视窗 似乎只支持1个蓝牙加密狗,这可能意味着我们无法满足我们的所有要求。 WIDCOMM 昂贵且可能过度杀伤? 更复杂的API? 思考? 对于C#的SDK,正在考虑Franson Bluetools,有人使用过这个API吗? 谢谢