连接到配对的蓝牙设备iOS8

连接到配对的蓝牙设备iOS8

本文介绍了连接到配对的蓝牙设备iOS8.1的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

CoreBlooth的所有事物的新手.我已经成功编写了一个小应用程序,可以连接到Wahoo Blue HR心率监测器并获取我的心率等的bpm.我使用了下面的教程,但是将代码重写为swift.

链接至教程

我现在正在尝试编写一个简单的应用程序,以从我拥有的Bluetooth LE BP阅读器中检索血压读数.有问题的模型是iHealth BP5.

当我使用以下代码扫描此设备时,我什么也没得到.

func centralManagerDidUpdateState(central: CBCentralManager!) {

    if central.state == CBCentralManagerState.PoweredOff {
        println("CoreBluetooth BLE hardware is powered off")
    }
    else if central.state == CBCentralManagerState.PoweredOn {
        println("CoreBluetooth BLE hardware is powered on and ready")
        let IHEALTHBP5_BP_DEVICE_INFO_SERVICE_UUID = CBUUID(string:"1810")
        let services = [IHEALTHBP5_BP_DEVICE_INFO_SERVICE_UUID]
        centralManager!.scanForPeripheralsWithServices(services, options: nil)
    }

}

我显然已将服务UUID更改为BP监视器,并使用运行LightBlue并启动血压服务的iPad进行了检查.它可以在iPad上模拟BP服务,但不能模拟BP5设备本身吗?

我一直在阅读有关制造商能够隐藏设备的信息?这可能是正在发生的事情.

我注意到BP5设备实际上必须通过iOS蓝牙设置进行配对"才能与官方应用程序一起使用,而心率监视器却没有.这是否表明除了BP5的连接类型更安全以外,其他任何人都可以播放心率监测器?

很抱歉,如果该术语已停用,但我是蓝牙世界的新手.

任何帮助或指导表示赞赏.

致谢

Olly

PS在检查蓝牙设置应用程序中的设备是否已连接"并且设备上的蓝牙指示灯从闪烁变为稳定后,我使用了以下方法,但返回的结果为零.

let connectedPeripherals =   centralManager!.retrieveConnectedPeripheralsWithServices(services)
        println("Number of Connected Devices : \(connectedPeripherals.count)")
解决方案

该产品的网页指出,它使用无线通信:Bluetooth V3.0 + EDR 2类SPP",这是一种传统"蓝牙串行端口协议,而不是Bluetooth Low Energy/Bluetooth 4.0.这与您关于需要配对设备和Core Bluetooth不可见的设备的描述相符.

这种类型的设备由外部附件框架管理.您将需要标识他们已在MFi程序下注册的供应商ID,然后在其协议上找到文档或对它们的协议进行反向工程,因为它与使用GATT协议的BLE BP监视器不同./p>

Newbie to all things CoreBlooth here. I have successfully written a small app to connect to a Wahoo Blue HR heart rate monitor and retrieve the bpm for my heart rate etc. I used the tutorial below but rewrote the code into swift.

Link to tutorial

I am now trying to write a simple app to retrieve the Blood Pressure readings from a Bluetooth LE BP reader I have. The model in question is an iHealth BP5.

When I scan for this device using the following code I get nothing.

func centralManagerDidUpdateState(central: CBCentralManager!) {

    if central.state == CBCentralManagerState.PoweredOff {
        println("CoreBluetooth BLE hardware is powered off")
    }
    else if central.state == CBCentralManagerState.PoweredOn {
        println("CoreBluetooth BLE hardware is powered on and ready")
        let IHEALTHBP5_BP_DEVICE_INFO_SERVICE_UUID = CBUUID(string:"1810")
        let services = [IHEALTHBP5_BP_DEVICE_INFO_SERVICE_UUID]
        centralManager!.scanForPeripheralsWithServices(services, options: nil)
    }

}

I have obviously changed the service UUID to a BP monitor and checked using an iPad running LightBlue and starting a blood pressure service. It works fine with the iPad simulating a BP service but not the BP5 device itself?

I have been reading something about manufacturers being able to hide devices? Could this be what is happening.

I have noticed that the BP5 device has to actually be 'Paired' through the iOS Bluetooth settings to work with the official app whereas the heart rate monitor did not. Does this suggest the heart rate monitor broadcasts to anyone but the BP5 has a more secure connection type?

Apologies if the terminology is off but I am new to the bluetooth world.

Any help or guidance appreciated.

regards

Olly

PS After checking the device was 'connected' in the bluetooth settings app and by the bluetooth light on the device moving from flashing to solid, I used the following method but this returned a result of zero.

let connectedPeripherals =   centralManager!.retrieveConnectedPeripheralsWithServices(services)
        println("Number of Connected Devices : \(connectedPeripherals.count)")
解决方案

The product's web page states that it uses "Wireless communication: Bluetooth V3.0+EDR Class 2 SPP", which is a "legacy" Bluetooth serial port protocol, not Bluetooth Low Energy/Bluetooth 4.0. This matches with your description of needing to pair the device and the device not being visible to Core Bluetooth.

This type of device is managed by the External Accessory Framework. You would need to identify the vendor ID that they have registered under the MFi program and then either find documentation on their protocol or reverse engineer their protocol as it won't be the same as a BLE BP monitor, which uses the GATT protocol.

这篇关于连接到配对的蓝牙设备iOS8.1的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-30 06:32