相关疑难解决方法(0)

使用32feet.net使用独特的服务协议连接到BTLE设备

我有一个蓝牙低功耗(BTLE)设备,我需要连接到我的电脑.为此,我在桌面WPF应用程序中使用Windows API参考.

蓝牙设备相当简单:1个服务,2个特性(一个读取/通知,一个写入).

To make below code work, add the following references to the WPF (for windows 10):
C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETCore\v4.5\System.Runtime.WindowsRuntime.dll
C:\Program Files (x86)\Windows Kits\10\UnionMetadata\Windows.winmd
Run Code Online (Sandbox Code Playgroud)

C#的Windows API代码

public GattDeviceService BLEService;
public GattCharacteristic BLEData_ReadNotify;
public GattCharacteristic BLEData_Write;
private static readonly Guid Guid_service = new Guid("25FB9E91-1616-448D-B5A3-F70A64BDA73A");
public static readonly Guid Characteristics_ReadNotify = new Guid("C3FBC9E2-676B-9FB5-3749-2F471DCF07B2");
public static readonly Guid Characteristics_Write = new Guid("D6AF9B3C-FE92-1CB2-F74B-7AFB7DE57E6D");


// Find all BTLE devices that have the service Guid: Guid_service
public void findandconnect() { 
    var BTLEdeviceList = await …
Run Code Online (Sandbox Code Playgroud)

c# wpf bluetooth 32feet btle

10
推荐指数
1
解决办法
3112
查看次数

从PC到手机的蓝牙通信,在语音通话期间使用笔记本电脑扬声器和麦克风

我使用32feet.net库连接蓝牙手机.我已成功发现设备,成功与设备配对.我已经使用AT命令在32feet.net和c#蓝牙拨号的帮助下成功拨打了电话

我想在手机上进行语音通话时使用笔记本电脑的扬声器和麦克风.

拨打电话的我的C#代码是

BluetoothEndPoint bep = new BluetoothEndPoint(phone.DeviceAddress,BluetoothService.Handsfree);

cli = new BluetoothClient();

cli.Connect(bep);
peerStream = cli.GetStream();
peerStream = Listofdevices.cli.GetStream();
String dialCmd4 = "ATD"+txtdialer.Text+";\r\n";
Byte[] dcB = System.Text.Encoding.ASCII.GetBytes(dialCmd4);
Listofdevices.peerStream.Write(dcB, 0, dcB.Length);

Byte[] sRes = new Byte[200];
peerStream.Read(sRes, 0, 199);
Run Code Online (Sandbox Code Playgroud)

如何使用我的扬声器和笔记本电脑麦克风进行通话?

c# audio bluetooth stream 32feet

8
推荐指数
0
解决办法
1175
查看次数

如何以编程方式配对蓝牙设备

我最近购买了一块Lilypad Simblee BLE 板,我想以编程方式将其与我的计算机配对(使用C# 中的32feet.NET库)。

我知道StackOverflow 上已经有人询问“如何以编程方式配对蓝牙设备”(例如此处),但是由于某种原因,我所有以编程方式配对设备的尝试都失败了。事实上,我成功地将设备与Windows 10 设置面板中的“管理蓝牙设备”窗口(设置>设备)配对>蓝牙)配对。

首先,我不知道配对方法传统的还是SSP)。Windows 从未要求我输入 PIN 码或其他信息,所以我猜它是 SSP,但我不确定。

我在 Google 上搜索了如何与 32feet.NET 进行SSP配对请求:我发现这个

但是,一旦它发现我的设备(设备发现工作正常),配对请求立即失败。

我的代码:

using InTheHand.Net.Bluetooth;
using InTheHand.Net.Sockets;
using System;
using System.Collections.Generic;

namespace HLK_Client
{
    class HLKBoard
    {
        public event HLKBoardEventHandler HLKBoardConnectionComplete;
        public delegate void HLKBoardEventHandler(object sender, HLKBoardEventArgs e);

        private BluetoothClient _bluetoothClient;
        private BluetoothComponent _bluetoothComponent;
        private …
Run Code Online (Sandbox Code Playgroud)

c# bluetooth bluetooth-lowenergy 32feet windows-10

5
推荐指数
1
解决办法
2万
查看次数

标签 统计

32feet ×3

bluetooth ×3

c# ×3

audio ×1

bluetooth-lowenergy ×1

btle ×1

stream ×1

windows-10 ×1

wpf ×1