加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 综合聚焦 > 服务器 > Windows > 正文

如何在Windows 7桌面上接受传入的蓝牙连接(使用c或c#程序)

发布时间:2020-12-13 20:59:17 所属栏目:Windows 来源:网络整理
导读:我正在Android上编写一个BT应用程序来连接到实验室设备/硬件。目前我有一个贷款的设备。然而,在我正在开发它(通勤,出城等)的时候,我总是不可能有一个,所以我正在为它创建一个模拟器,并将在我的Windows桌面上运行该仿真器,以便我的Android客户端代码可
我正在Android上编写一个BT应用程序来连接到实验室设备/硬件。目前我有一个贷款的设备。然而,在我正在开发它(通勤,出城等)的时候,我总是不可能有一个,所以我正在为它创建一个模拟器,并将在我的Windows桌面上运行该仿真器,以便我的Android客户端代码可以连接到它。

android代码是用.NET / xamarin构建的,可以很好地连接到真实的设备。

我喜欢桌面上的C或C#。

我已经找到这个代码http://www.codeproject.com/Articles/252882/Bluetooth-Server-Programming-on-Windows在线创建和接受BT连接。它似乎是一个非常好的开始,我想做的 – 这是构建一个状态机/模拟器来模仿真实的设备。但是我无法将我的Android设备连接到它。

注意 – 连接是串行端口连接。 (来自Android设备的UUI是“众所周知”的串口连接(“00001101-0000-1000-8000-00805F9B34FB”)

我不知道如何配置Windows 7桌面和蓝牙服务,以允许此服务器/模拟器程序接受连接。

我已配对设备,但无法连接。

如何在Win7桌面上运行的C或C#代码中接受传入的蓝芽串行连接?

如果你想做一些低级的东西,比如通过C#应用程序通过蓝牙建立连接,那么你需要通过它的API访问蓝牙堆栈。如果您的设备正在运行Microsofts蓝牙堆栈,那么您可以查看32feet.net的Microsofts蓝牙API的托管包装器。如果您有Widcomm堆栈,那么您将必须找到Widcomm的API。
要访问微软蓝牙堆栈,您可以使用BthUtil.dll。
BthUtil.dll是一个非托管DLL,它是Microsoft蓝牙堆栈的一部分。它通常用于通过称为BthSetMode的功能打开或关闭蓝牙无线电的任务
(有关文档,请参阅MSDN – http://msdn2.microsoft.com/EN-US/library/aa456007.aspx)

您可以查看以下链接:

http://www.youtube.com/watch?v=Jn05CU3mxzo

另外,查看32feet.Net
32feet.Net的简要说明

32feet.NET is a shared-source project to make personal area networking technologies such as Bluetooth,Infrared (IrDA) and more,easily accessible from .NET code.
Supports desktop,mobile or embedded systems.
32feet.NET is free for commercial or non-commercial use.
If you use the binaries you can just use the library as-is,if you make modifications to the source you need to include the 32feet.NET License.txt document and ensure the file headers are not modified/removed. The project currently consists of the following libraries:-
Bluetooth
IrDA
Object Exchange
Bluetooth support requires a device with either the Microsoft,Widcomm,BlueSoleil,or Stonestreet One Bluetopia Bluetooth stack. Requires .NET Compact Framework v3.5 or above and Windows CE.NET 4.2 or above,or .NET Framework v3.5 for desktop Windows XP,Vista,7 and 8.

链接
http://32feet.codeplex.com/

32feet.Net的功能链接
http://32feet.codeplex.com/wikipage?title=Feature%20support%20table&referringTitle=Documentation

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读