如何将所有MFI devies列入iOS应用程序? [英] How to list out all MFI devies into the iOS app?

查看:122
本文介绍了如何将所有MFI devies列入iOS应用程序?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想显示所有MFI通过的苹果设备的列表,这些设备之前没有从iOS设置中配对。

I want to display the list of all MFI passed apple devices which are not paired before from iOS settings.

我可以使用以下代码列出连接的设备:

I can list out the connected devices using below code:

NSArray *accessories = [[EAAccessoryManager sharedAccessoryManager]

                               connectedAccessories];

所以我的查询是:


  1. 我可以使用外部配件框架扫描所有可用的未配对的MFI设备到iOS应用程序,然后我可以从iOS应用程序配对它们。

请帮我缩短时间。

提前多多谢谢.....

Lots of thanks in advance.....

推荐答案

是的,你可以。

来自iOS 6 EA Framework提供内置的蓝牙配对功能在应用程序内。

From iOS 6 EA Framework provides built-in bluetooth pairing function within app.

检查:

[[EAAccessoryManager sharedAccessoryManager] showBluetoothAccessoryPickerWithNameFilter:nil completion:^(NSError *error) {

}];

您还可以使用过滤器参数来过滤您的设备。

You can also use filter parameters to filter your devices.


但请记住,如果您通过MFI从设备发送或接收数据,您可能需要在Info中添加
协议字符串。 plist on支持的外部附件协议

But remember, if you send or receive data from device via MFI, you may need to add protocol string into Info.plist on "Supported external accessory protocols"

编辑:

好的,我将逐步列出MFI世界。

OK, I will list step by step of MFI world.


1.以上代码在做什么?

1.What above code is doing?

它会弹出一个小的tableView来显示所有可用的蓝牙设备。

It pops up a small tableView to show all available Bluetooth devices.


2。如何配对?

2.How to pair?

只需点击表格中显示的单元格即可。它会自动连接到设备。

Just click a cell shown in the table. It will automatically connect to device.


3.如何识别设备是否配对?

3.How to identify device is paired or not?

检查以下代码,您应该了解它是什么。

Check following code, You should understand what is it.

[[EAAccessoryManager sharedAccessoryManager] showBluetoothAccessoryPickerWithNameFilter:nil completion:^(NSError *error) {
        if (error) {
            NSLog(@"error :%@", error);
        }
        else{
            NSLog(@"You make it! Well done!!!");
        }
    }];




4.Notification connect or disconnect?

4.Notification connect or disconnect?

检查以下通知。

EAAccessoryDidConnectNotification
EAAccessoryDidDisconnectNotification

您可以在MFI上研究很多东西,所以最好通过Apple文档和示例代码深入理解。

There are a lot things you can research on MFI, so it is better go through Apple documents and example code to understand it deeply.

这篇关于如何将所有MFI devies列入iOS应用程序?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆