问题描述
我正在尝试为Mac OS创建虚拟的蓝牙键盘客户端.这意味着我的Mac将用作BT KB.我了解了OS X中的蓝牙API(在ObjC中),并且还找到了Mac的HID API(在C中)
I'm trying to create a virtual bluetooth keyboard client for Mac OS. that means my Mac will serve as a BT KB. I read about the bluetooth API in OS X (in ObjC), and I also found an HID API for Mac (in C)
要完成这项工作,我了解我需要声明一个隐藏键盘服务,该服务应在SDP查询中广播.
To make this work I understand I need to declare an hid-keyboard-service that should be broadcasted on SDP queries.
- 如果我使用HID API声明了HID服务,我的服务是否也在蓝牙上可见/广播? (文档似乎仅针对USB指的是HID). -HID服务在蓝牙和USB接口上是否都可见,并且底层连接对我来说是透明的?
- 您是否有任何代码可以帮助我解决此问题?我更喜欢ObjC,但似乎HID API仅是C ...:(
谢谢...!
推荐答案
据我了解,HID设备驱动程序代表操作系统本地以及操作系统中各种其他组件的设备.它不能用于在USB或蓝牙上进行广播".据我所知,OS X不包括蓝牙HID服务,OS X和Mac中的USB芯片组都不支持USB设备模式-或至少它们不公开它.
As far as I understand it, a HID device driver represents a device locally to the OS, and by the OS, to various other components. It is not used to "broadcast" on USB nor on Bluetooth. As far as I know, OS X does not include a Bluetooth HID service, and neither does OS X nor the USB chipsets in Macs support USB device mode -- or at least they do not expose it.
您将要编写蓝牙服务.我还没有这样做,但是文档似乎很广泛.据我了解,您将必须以某种方式基于底层的蓝牙L2CAP传输协议来实现您的HID服务.
You will want to write a Bluetooth service. I have not done that, but the documentation seems extensive. From what I understand, you would somehow have to implement your HID service based on the underlying Bluetooth L2CAP transmission protocol.
由于我既没有研究过蓝牙,也没有研究Mac下的蓝牙支持,所以我无法提供更多帮助.我确实看过HID协议规范,甚至还玩了一下. HID的实现相对来说比较琐碎,但是首先要实现蓝牙服务将有大量工作要做.
Since I have studied neither Bluetooth, nor Bluetooth support under Mac, I am unable to provide any more help. I did take a look at HID protocol specs, and even played with them. HID is relatively trivial to implement, but there will be quite a bit of work on implementing the Bluetooth service first.
这篇关于适用于OS X的虚拟HID键盘的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!