简体   繁体   English

iOS应用程序可以在不创建OS X应用程序的情况下通过蓝牙与Mac上的Java应用程序通信吗?

[英]Can an iOS application communicate with a Java application on my Mac via bluetooth without creating an OS X application?

I have an iOS application with a tableview which I would like to send text strings via bluetooth to my Macbook indicating which cell was selected by the user. 我有一个带有表视图的iOS应用程序,我想通过蓝牙将文本字符串发送到Macbook,以指示用户选择了哪个单元格。 Both have bluetooth 4.0. 两者都具有蓝牙4.0。 This information will be fed into a Java application. 该信息将被馈送到Java应用程序中。 From a CoreBluetooth perspective, the iOS device will be a peripheral and my Mac would be the central. 从CoreBluetooth角度来看,iOS设备将是外围设备,而Mac将是中心设备。

The problem I'm having is around setting up the central. 我遇到的问题是围绕中央系统的设置。 Apple documentation gives a lot detail around building a central manager within a Mac OS X application (xcode, CBCentralManager). Apple文档提供了有关在Mac OS X应用程序(xcode,CBCentralManager)中构建中央管理器的详细信息。 However, I'd like the data to be pulled into a Java application running on my Mac. 但是,我希望将数据提取到Mac上运行的Java应用程序中。

Do I need to build a Mac OS X application to wrap my Java application to build this type of communication? 我是否需要构建Mac OS X应用程序来包装Java应用程序以构建此类通信? Should I consider another method of bluetooth communication ie BluetoothManager.Framework? 我是否应该考虑另一种蓝牙通信方法,即BluetoothManager.Framework? I do not need to submit this to the Apple Store. 我不需要将此提交到Apple Store。 Is this a TCP/IP problem? 这是TCP / IP问题吗?

I figured it out. 我想到了。 My solution is based on Ray Wenderlich's Network Tutorial for iOS . 我的解决方案基于Ray Wenderlich的iOS网络教程 I created the python server, tethered my iOS device via bluetooth to my Mac, and transmitted messages via port 80 on my Bluetooth PAN IP address. 我创建了python服务器,通过蓝牙将iOS设备绑定到我的Mac,并通过蓝牙PAN IP地址上的端口80传输了消息。 Then I created a Java client to connect to the python server to receive the messages! 然后,我创建了一个Java客户端以连接到python服务器以接收消息!

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM