简体   繁体   English

如何通过蓝牙将硬件设备连接到Iphone应用程序

[英]How to connect hardware device to an Iphone application over Bluetooth

I have a hardware device which would communicate with a third party application on Android and IOS over Bluetooth to send to and fro data. 我有一个硬件设备,可以通过蓝牙与Android和IOS上的第三方应用程序进行通信,以往返发送数据。 With Android I am able to achieve this, however in case of IOS I don't have any information. 使用Android,我能够实现这一目标,但是在IOS的情况下,我没有任何信息。

Till now the information gathered to work with IOS devices is: 1. Application runs on Iphone 5 2. Hardware is MFI enabled 3. IAP2 is supported 到目前为止,收集到的可与IOS设备一起使用的信息是:1.在Iphone 5上运行应用程序2.启用了MFI的硬件3.支持IAP2

Please guide how to connect the hardware to an application and what other information is essential? 请指导如何将硬件连接到应用程序以及哪些其他必要信息? Is AppName, BundleID, BundleSeedID and ProtocolName required to connect? 连接需要AppName,BundleID,BundleSeedID和ProtocolName吗? If yes how we can get these details? 如果是,我们如何获得这些详细信息?

I tried unzipping the application but the Info.plist file looks garbled and not able to get much info from that. 我尝试将应用程序解压缩,但是Info.plist文件看起来乱码,无法从中获取很多信息。

Currently I am able to connect the hardware with IPhone over Bluetooth, but my real concern is how to communicate with a specific application on it. 目前,我能够通过蓝牙将硬件与iPhone相连,但我真正关心的是如何与它上的特定应用程序通信。

Also if you can provide some link or pseudo code to initiate a session between hardware and IOS application. 另外,如果您可以提供一些链接或伪代码来启动硬件和IOS应用程序之间的会话。

I assume you've already connected the SPP profile on Android. 我假设您已经在Android上连接了SPP配置文件。 However for iOS the SPP(BLE is another story and do not need MFi) was hidden but need MFi authentication for raw data links. 但是对于iOS,SPP(BLE是另一回事,不需要MFi)被隐藏了,但需要MFi身份验证才能进行原始数据链接。

Since you want to establish the raw data link between your hardware device and your iPhone, you need: 由于要在硬件设备和iPhone之间建立原始数据链接,因此需要:

  1. Make sure your hardware has MFi chip, generally this chip is connected with your hardware by I2C. 确保您的硬件具有MFi芯片,通常该芯片通过I2C与您的硬件连接。
  2. After step 1 make sure you can communicate with this chip at your hardware, fortunately the hardware vendor or MFi vendor will support this kind of code or binary. 完成第1步后,请确保您可以在硬件上与此芯片进行通信,幸运的是,硬件供应商或MFi供应商将支持这种代码或二进制文件。
  3. The MFi channel have a specific UUID(which may defined by Apple?) to replace the SPP official(which defined by Bluetooth SIG) UUID, hence if you want to make connection between your hardware and your iPhone, you need register the iOS defined UUID and make them as same as the normal SPP profile. MFi通道具有特定的UUID(可能由Apple定义)来代替SPP官方(由Bluetooth SIG定义)UUID,因此,如果要在硬件和iPhone之间建立连接,则需要注册iOS定义的UUID并使它们与普通的SPP配置文件相同。
  4. After the RFCOMM channel created, iOS would first authenticate the link, just like 3-way handshaking or something, so your hardware just communicate with the MFi chip and transfer the token to iOS. 创建RFCOMM通道后,iOS将首先对链接进行身份验证,就像三向握手之类的方式一样,因此您的硬件只需与MFi芯片进行通信并将令牌传输到iOS。
  5. After that iOS would set this RFCOMM channel(same as SPP actually) for your hardware, then you can send/recv data between them. 之后,iOS将为您的硬件设置此RFCOMM通道(实际上与SPP相同),然后可以在它们之间发送/接收数据。

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

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