如何通过蓝牙将流数据从 iPhone/iPod Touch 发送到 Windows C++ 应用程序?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/3055028/
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

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-15 14:40:07  来源:igfitidea点击:

How to send stream data via Bluetooth from an iPhone/iPod Touch to a Windows C++ application?

c++iphonewindowstcpbluetooth

提问by PLinhol

I need to develop an iPhone/iPod Touch application that creates a server to send some data stream (characters or bytes) to a Windows C++ application via Bluetooth. I'm thinking of creating a TCP connection, but don't know where to start.

我需要开发一个 iPhone/iPod Touch 应用程序,它创建一个服务器以通过蓝牙将一些数据流(字符或字节)发送到 Windows C++ 应用程序。我正在考虑创建一个 TCP 连接,但不知道从哪里开始。

What iPhone API should I use do to something like this? Does anyone knows some code examples that i can use to do this?

我应该使用什么 iPhone API 来做这样的事情?有谁知道我可以用来执行此操作的一些代码示例?

And in Windows, what should I use to support this kind of communication?

而在 Windows 中,我应该使用什么来支持这种通信?

Thanks

谢谢

采纳答案by manifest

Yes. From what it looks like you can use the PANbluetooth profile(the same profile used for tethering) with everything except the original iPhone.

是的。从外观上看,您可以将PAN蓝牙配置文件(用于网络共享的相同配置文件)用于除原始 iPhone 之外的所有内容。

Here'san article doing bluetooth over iPhone/iPad using GameKit. The article notes that you would need at least 2 iPhone/iPad devices running iPhone OS 3.0, but I wouldn't take that as an impossibility to talk to any other bluetooth capable device.

是一篇使用 GameKit 通过 iPhone/iPad 进行蓝牙连接的文章。文章指出,您至少需要 2 台运行 iPhone OS 3.0 的 iPhone/iPad 设备,但我不认为这是不可能与任何其他支持蓝牙的设备通话的。

UpdateThis forumindicates that the iPhone is only capable of headset pairing. It could be that the iPhone is "picky" about what you can pair it with.

更新论坛显示 iPhone 仅支持耳机配对。可能是 iPhone 对你可以与之配对的东西很“挑剔”。

"The iPhone only recognizes the "headset" profile. Another well thought out idea from Apple. No A2DP profiles, no OBEX." -sapporobaby

“iPhone 只识别“耳机”配置文件。Apple 的另一个深思熟虑的想法。没有 A2DP 配置文件,没有 OBEX。” -札幌宝贝

Update 2As jamone as indicated iPhone 3.0 supportsA2DP. How nice is that?

更新 2正如 jamone 所示,iPhone 3.0支持A2DP。那有多好?

Here's a tablelisting of iPhone/iPad bluetooth supported profiles

这是 iPhone/iPad 蓝牙支持配置文件的表格列表

回答by Frank Schmitt

I'm pretty sure third-party developers don't have sufficient access to the Bluetooth stack to do this via published APIs (i.e. via an app you publish to the App Store).

我很确定第三方开发人员没有足够的权限访问蓝牙堆栈,无法通过已发布的 API(即通过您发布到 App Store 的应用程序)执行此操作。

Is using WiFi an option? That's what most developers seem to be using for client/server communications. If that's the case, see if you can distribute Apple's Bonjour runtime with your app. If you search the developer site for Bonjour, they have code samples (though probably no Windows examples).

使用 WiFi 是一种选择吗?这就是大多数开发人员似乎用于客户端/服务器通信的内容。如果是这种情况,请查看您是否可以将 Apple 的 Bonjour 运行时与您的应用程序一起分发。如果您在开发人员网站上搜索 Bonjour,他们会提供代码示例(尽管可能没有 Windows 示例)。