ios - 如何检测我的苹果设备是否支持低功耗蓝牙

标签 ios bluetooth bluetooth-lowenergy

是否有 API 可让我判断运行我的应用程序的 Apple 设备 (iPad/iPod/iPhone) 是否支持低功耗蓝牙 (BTLE)。

最佳答案

假设您有一个 iOS5 或 iOS6 设备并且您有一个 CBCentralManager 对象,您可以使用以下方法检查它的 CBCentralManagerState:

switch ([_manager state])
{
    case CBCentralManagerStateUnsupported:
        state = @"This device does not support Bluetooth Low Energy.";
        break;
    case CBCentralManagerStateUnauthorized:
        state = @"This app is not authorized to use Bluetooth Low Energy.";
        break;
    case CBCentralManagerStatePoweredOff:
        state = @"Bluetooth on this device is currently powered off.";
        break;
    case CBCentralManagerStateResetting:
        state = @"The BLE Manager is resetting; a state update is pending.";
        break;
    case CBCentralManagerStatePoweredOn:
        state = @"Bluetooth LE is turned on and ready for communication.";
        break;
    case CBCentralManagerStateUnknown:
        state = @"The state of the BLE Manager is unknown.";
        break;
    default:
        state = @"The state of the BLE Manager is unknown.";

}

您还需要监视 centralManagerDidUpdateState:central 委托(delegate)更新,然后在您的应用中采取适当的操作。

关于ios - 如何检测我的苹果设备是否支持低功耗蓝牙,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13585218/

相关文章:

swift - 使用存储的服务扫描特定的 ble 设备

Android:直接在应用程序中使用 HID over GATT(Gadget=HID → 控制应用程序)

Android BLE - 如何检测心率传感器

ios - 核心数据查找列表项中包含的对象

windows - 重命名设备(硬编码设备名称)

ios - 创建 UIViewController 时什么时候使用 init()?

安卓蓝牙 : Slow data rates calculated from BluetoothSocket

bluetooth - 如何在Raspberry Pi上设置gatttool的BLE连接超时?

ios - 如何更改标签以与 iOS 中的图像相对应?

ios - 如何在 Quickblox iOS SDK 中检查 session 是否有效或过期?