Mac OS X 上 Lazarus/FreePascal 上的蓝牙
有人在 Mac OS X 上使用 Lazarus 或 FreePascal 蓝牙吗?有一个蓝牙单元,但目前仅支持Linux。
现有单位信息: http://wiki.freepascal.org/Bluetooth
我计划增强此功能以支持 Mac OS,但是如果有人已经编写了在 Mac OS 上使用蓝牙的代码以避免重复工作,那就太好了。
另一方面,如果您使用 XCode 来访问蓝牙,您使用了哪些库?我确信我可以通过打开一些蓝牙应用程序使用 XCode 分析器发现这一点。
注意:Mac OS X 似乎没有使用 Linux 拥有的 BlueZ 库,因此我认为解决方案不像更改库路径那么简单。相反,它有 IOBluetooth“框架”,位于 /System/Library/Frameworks/IOBluetooth.framework。
看一下,它看起来像:
kaikei.ocn.ntt.com:IOBluetooth.framework $ file * CodeResources: XML document text Headers: directory IOBluetooth: Mach-O universal binary with 3 architectures IOBluetooth (for architecture x86_64): Mach-O 64-bit dynamically linked shared library x86_64 IOBluetooth (for architecture i386): Mach-O dynamically linked shared library i386 IOBluetooth (for architecture ppc7400): Mach-O dynamically linked shared library ppc Resources: directory Versions: directory
另一方面,我想如果有人已经这样做了,我可能可以在谷歌上找到它......如果我错了,请回复并让我知道。
澄清:我之前已经为普通共享库创建了绑定(fe sqlite3),但没有为“框架”创建绑定。如果没有人创建过绑定或以其他方式使用 FreePascal 的 MacOS 蓝牙框架,那么关于如何使用 FreePascal 的框架功能的建议将受到赞赏。 (通常我要移植的函数是基于 C 的,而不是 Obj-C,所以我不确定如何在 FPK 中声明 Obj-C 方法,尽管我确信如果继续搜索,我将能够找到一些示例)。
Has anyone used Bluetooth on Mac OS X with Lazarus or FreePascal? There is a bluetooth unit, but it currently only supports Linux.
Information about existing unit:
http://wiki.freepascal.org/Bluetooth
I plan to enhance this to support Mac OS, but it would be nice to know if anyone has written any code to use BlueTooth on Mac OS already to avoid duplicated work.
On the other hand, if you have used XCode to access Bluetooth, what libraries did you use? I am sure I can discover this with the XCode profiler by opening some Bluetooth applications.
Note: Mac OS X doesn't appear to use the BlueZ library that Linux has, so I don't think the solution is as easy as changing the library path. Instead, it has IOBluetooth "Framework", located at /System/Library/Frameworks/IOBluetooth.framework.
Having a look, it looks like:
kaikei.ocn.ntt.com:IOBluetooth.framework $ file * CodeResources: XML document text Headers: directory IOBluetooth: Mach-O universal binary with 3 architectures IOBluetooth (for architecture x86_64): Mach-O 64-bit dynamically linked shared library x86_64 IOBluetooth (for architecture i386): Mach-O dynamically linked shared library i386 IOBluetooth (for architecture ppc7400): Mach-O dynamically linked shared library ppc Resources: directory Versions: directory
On the other hand, I think if anyone had done this already, I would probably be able to find it on Google.... On the off chance I am wrong, please reply and let me know.
Clarification: I have created bindings for normal shared libraries before (f.e. sqlite3), but not for a "framework". If nobody has created bindings or otherwise used the MacOS Bluetooth framework from FreePascal, advice on how to use framework functions from FreePascal in general woule be appreciated. (And normally the functions I am porting are C based, not Obj-C, so I am not sure how to declare Obj-C methods in FPK, although I am sure I will be able to find some samples if I keep searching).
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
翻译后的 Mac OS X 框架 C 标头的主要 svn 存储库是 http: //svn.freepascal.org/svn/macosxintf/trunk
有时,FPC 版本会与那里托管的最新版本同步。请注意,该存储库(在 MPPInterfaces 子目录中)中的文件采用通用格式,可以自动转换为 FPC、GPC 或 CodeWarrior Pascal 版本。
要生成 FPC 版本,请使用“make fpcpinterfaces”,并在 Build/FPCPinterfaces 文件夹中找到结果。
要翻译新标头,请从 macosxintf 存储库的签出副本中执行类似以下操作:
./Scripts/Convert.pl /System/Library/Frameworks/IOBluetooth.framework/Headers/IOBluetooth.h FORCE MPPInterfaces
之后,您仍然需要编辑生成的文件以添加/删除单元并清理一些自动翻译过程未处理的其他事项。完成后,您可能需要在 bugs.freepascal.org 上提交包含已完成单元的错误报告。
(注意:因为我未注册,所以我只能在每个帖子中添加一个 url,因此下一个 url 有点混乱,以绕过该限制)
您还可以订阅 Mac Pascal 列表 (lists.sonic.net/mailman /listinfo/mac-pascal)并询问是否有人已经翻译了这些标题。
蓝牙框架确实还包含一些 Objective-C 标头。 Objective-Pascal 支持仅在最新的 FPC svn 版本中可用,如 FPC wiki (google FPC_PasCocoa) 上所述。您需要此支持才能与 Objective-C 交互。
使用 FPC svn 中其他地方的脚本(svn.freepascal.org/svn/fpc/trunk/packages/cocoaint/utils/)翻译 Objective-C 可能是最简单的,
您可能想在上述 Mac Pascal 列表上寻求帮助,因为所有维护上述翻译和翻译工具的人都在那里订阅。
The main svn repository for translated Mac OS X framework C headers is http://svn.freepascal.org/svn/macosxintf/trunk
From time to time, FPC releases are synchronised with the latest versions hosted there. Note that the files in that repository (in the MPPInterfaces subdirectory) are in a generic format that can be automatically translated into either FPC, GPC or CodeWarrior Pascal versions.
To generate the FPC versions, use "make fpcpinterfaces", and find the results in the Build/FPCPinterfaces folder.
To translate new headers, execute something like this from inside a checked out copy of the macosxintf repository:
./Scripts/Convert.pl /System/Library/Frameworks/IOBluetooth.framework/Headers/IOBluetooth.h FORCE MPPInterfaces
Afterwards, you'll still have to edit the resulting file to add/remove units and clean up some other things not handled by the automatic translation process. Once finished, you may want to submit a bug report at bugs.freepascal.org with the finished units.
(note: because I'm unregistered, I can only add in one url per post, so the next url's are a bit mangled to get around that restriction)
You can also subscribe to the Mac Pascal list (lists.sonic.net/mailman/listinfo/mac-pascal) and ask there whether someone already translated those headers.
The Bluetooth framework indeed also contains some Objective-C headers. Objective-Pascal support is only available in the latest FPC svn versions, as described on the FPC wiki (google FPC_PasCocoa). You need this support in order to interface with Objective-C.
Translating Objective-C is probably easiest using the script elsewhere in FPC's svn (svn.freepascal.org/svn/fpc/trunk/packages/cocoaint/utils/)
You may want to ask for help on the above-mentioned Mac Pascal list, as all people maintaining the aforementioned translations and translation tools are subscribed there.