使用 IOBluetooth(osx 蓝牙堆栈)的 l2cap 服务器/客户端
我无法理解 API 来设置在 OSX 上运行的 l2cap(或 RFCOMM)客户端/服务器,就像我在 Linux 上使用 BlueZ 一样。
在 Linux 上,我只需打开一个套接字、绑定、监听并进行连接即可。然后接受服务器,&客户端的套接字、绑定、连接(带有我要使用的设备的 BT 地址的绑定)。此外,还没有完成配对。
我不知道如何配置我的应用程序以开始侦听特定设备上的连接(或者如果 OSX 一次仅支持 1 个 BT 适配器,那么如何侦听任何传入连接)。
我也无法弄清楚如何配置我的应用程序以使用特定设备发送到一台 BT 设备(如果 OSX 一次仅支持 1 个,则这是无关紧要的)。
另外,OSX 堆栈是否要求两个设备之间先进行配对,然后才能通过 l2cap?
任何语言示例都将受到赞赏,尽管 C/C++ 是首选。
谢谢
I'm having trouble understanding the API to set up a l2cap (or RFCOMM) client/server running on OSX like I can with BlueZ on Linux.
On Linux, I simply open a socket, bind, listen & then accept for the server, & socket, bind, connect for the client (w/ the bind taking in the BT address of the device I want to use). Also, there's no pairing done.
I can't figure out how to configure my application to start listening for connections on a particular device (or if OSX only supports 1 BT adapater at a time, then how to listen for any incoming connections).
I also can't figure out how to configure my application to send to one BT device using a particular device (this is irrelevant if OSX only supports 1 at a time).
Also, does the OSX stack require pairing to have occured between 2 devices before it'll pass through l2cap?
Any language examples would be appreciated, although C/C++ would be preferred.
Thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
在 Mac OS X 10.5 中,有一个示例(在 /Developer/Examples/Bluetooth 中,标题为 RFCOMM_Open_SPP_Example),显示连接到蓝牙设备并从中读取数据(我用它从 BT GPS 接收器读取 NMEA 线)。另请参阅: Leopard 和蓝牙 RFCOMM 通道
不幸的是,我在任何地方都找不到示例项目的副本。
代码示例似乎已替换为: 开发蓝牙应用程序
In Mac OS X 10.5 there's an example (in /Developer/Examples/Bluetooth, titled RFCOMM_Open_SPP_Example) that shows connecting to and reading data from a bluetooth device (i've used it to read NMEA lines from a BT GPS receiver). See also: Leopard & Bluetooth RFCOMM channels
Unfortunately I can't find a copy of the example project anywhere.
It looks like the code samples have been replaced with: Developing Bluetooth Applications