C++中的蓝牙
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/10254910/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Bluetooth in C++
提问by crocboy
I am looking to communicate via RFCOMM to another Bluetooth device. I want to use C++ (VS2008) for the application. I already know of the 32feet library, but was unsure if it would work for C++. Does anyone know of a good starting point for this kind of project? Or possibly 32feet samples written in C++? I want a simple, easy to use API for Bluetooth using C++.
我希望通过 RFCOMM 与另一个蓝牙设备进行通信。我想对应用程序使用 C++ (VS2008)。我已经知道 32feet 库,但不确定它是否适用于 C++。有谁知道此类项目的良好起点?或者可能是用 C++ 编写的 32feet 样本?我想要一个使用 C++ 的简单易用的蓝牙 API。
采纳答案by TJD
You can do Bluetooth programming using BT sockets into the OS Bluetooth stack. This page discusses socket usage: http://msdn.microsoft.com/en-us/library/windows/desktop/aa362928(v=vs.85).aspx
您可以使用 BT 套接字进入操作系统蓝牙堆栈进行蓝牙编程。此页面讨论套接字使用:http: //msdn.microsoft.com/en-us/library/windows/desktop/aa362928(v=vs.85).aspx
This page has links to download Bluetooth SDK from Microsoft: http://msdn.microsoft.com/en-us/library/windows/desktop/aa363058(v=vs.85).aspx
此页面包含从 Microsoft 下载蓝牙 SDK 的链接:http: //msdn.microsoft.com/en-us/library/windows/desktop/aa363058(v=vs.85).aspx
回答by Raanan W
This question is rather old, I know.
这个问题很老了,我知道。
Just wanted to update, that Qt Framework has now Qt Bluetooth for C++ that looks very promising -- http://doc.qt.io/qt-5/qtbluetooth-module.html
只是想更新一下,Qt 框架现在有用于 C++ 的 Qt 蓝牙,看起来非常有前途 -- http://doc.qt.io/qt-5/qtbluetooth-module.html
回答by Pierre
Building apps using the Microsoft stack works fairly well (XP and Vista work great, trying to run the same apps under Windows 7-64bit does not work so well...)
使用 Microsoft 堆栈构建应用程序效果很好(XP 和 Vista 效果很好,尝试在 Windows 7-64 位下运行相同的应用程序效果不佳......)
The real advantage to 32feet.net is that the Bluetooth support on Windows is heavily Balkanized - you never know on a given machine whether it is using the Microsoft, Broadcom, Toshiba, BlueSolei, or some other stack. While these are all mostly compatible over-the-air, the APIs are completely different for each. Building with 32feet.net lets your application run on a larger subset of machines... That said, I have not tried building it into a C++ application - sorry.
32feet.net 的真正优势在于 Windows 上的蓝牙支持严重分裂 - 您永远不知道在给定的机器上它是使用 Microsoft、Broadcom、Toshiba、BlueSolei 还是其他一些堆栈。虽然这些大部分都是无线兼容的,但每个 API 完全不同。使用 32feet.net 构建可以让您的应用程序在更大的机器子集上运行...也就是说,我还没有尝试将它构建到 C++ 应用程序中 - 抱歉。