寻找触手可及通用的蓝牙设备 [英] Finding generic Bluetooth devices within reach

查看:321
本文介绍了寻找触手可及通用的蓝牙设备的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们正在使用iOS的私人框架BluetoothManager了一个简单的实验 - 找伸手可及发现的通用的(非iOS版)BT设备。现在,只有下面一行返回设备:

We are using the iOS private framework BluetoothManager for a simple experiment -- to find discoverable generic (non-iOS) BT devices within reach. Now, only the following line returns devices:

为(BluetoothDevice类*在[[BluetoothManager sharedInstance] pairedDevices]设备)

不幸的是它只返回已配对的设备,这是不太我们想要的。使用 connectingDevices 而不是 pairedDevices 根本不返回任何设备。那么,我们有什么办法才能够触手可及检测到任何蓝牙设备?我不认为我可以使用的GameKit,因为我想要探索非iOS设备。

Unfortunately it only returns devices already paired, which isn't quite what we want. Using connectingDevices instead of pairedDevices does not return any device at all. So, what options do we have to be able to detect any Bluetooth device within reach? I don't think I can use GameKit because I want to discover non-iOS devices.

任何建议都欢迎。

推荐答案

我已经搞乱了几天的私有的框架,并得到附近的设备列表是pretty简单。

I've been messing with the private framework for a few days, and getting a list of nearby devices is pretty straightforward.

首先,你必须使用,使设备扫描:

First, you have to enable device scanning using:

[[BluetoothManager sharedInstance] setDeviceScanningEnabled:YES];

如果有内的其他设备将开始发布的 BluetoothDeviceDiscoveredNotification 通知到通知中心。订阅这些,并在NSNotification对象传递到回调将是类型 BluetoothDevice类的*

If there are devices within range it will start posting BluetoothDeviceDiscoveredNotification notifications to the notification center. Subscribe to these and the object in the NSNotification delivered to the callback will be of type BluetoothDevice*.

我敢肯定,BluetoothManager卖场发现任何地方的设备,但我只是把一切都变成我自己的NSMutableArray。

I'm sure the BluetoothManager stores any discovered devices somewhere, but I just threw everything into my own NSMutableArray.

不幸的是我还没有想出如何真正与设备使用私有API配对。

Unfortunately I still haven't figured out how to actually pair with a device using the private API.

这篇关于寻找触手可及通用的蓝牙设备的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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