macos Mac OS X 蓝牙编程示例?

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

Mac OS X bluetooth programming sample?

objective-cmacoscocoabluetoothiobluetooth

提问by tuttu47

I am trying to develop an application using bluetooth in my Mac mini. However, after searching all over net, all that I could find was the "Bluetooth Device Access Guide" from Apple, and not a single sample program!

我正在尝试在 Mac mini 中使用蓝牙开发应用程序。然而,在网上搜索后,我只能找到Apple的“蓝牙设备访问指南”,而不是一个示例程序!

Can anyone suggest of any sample code for this available ?

任何人都可以为此提供任何示例代码吗?

what I am trying to do in my program:

我想在我的程序中做什么:

I want to pair my iPhone with my Mac programmatically over the PAN profile, and then send data (streams) both ways. I paired them manually, and I was successfully able to transfer data. I just want to do that programmatically!

我想通过 PAN 配置文件以编程方式将我的 iPhone 与我的 Mac 配对,然后双向发送数据(流)。我手动配对它们,并且我能够成功传输数据。我只想以编程方式做到这一点!

回答by RyanWilcox

[In 2016] I suspect you want CoreBluetooth

[2016 年] 我怀疑你想要CoreBluetooth

The Core Bluetooth framework provides the classes needed for your iOS and Mac apps to communicate with devices that are equipped with Bluetooth low energy wireless technology

Core Bluetooth 框架提供了 iOS 和 Mac 应用程序与配备低功耗蓝牙无线技术的设备进行通信所需的类

You can do things like discover paired devices around you, read and write, and it documents best practices!

你可以做一些事情,比如发现你周围的配对设备,阅读和写作,它记录了最佳实践!