3

我正在尝试将一些数据从 iOS 设备发送到连接到 arduino 的 HM-10 蓝牙 LE 模块。问题是连接到模块后discoverServices没有返回服务的特征。

    func peripheral(peripheral: CBPeripheral, didDiscoverServices error: NSError?) {
    if(error != nil) {
        print(error?.description)
    }
    for service in peripheral.services! {
        let thisService = service as CBService
        print("Service: \(thisService.description)")
        print("Characteristic: \(thisService.characteristics)")
    }
}

这输出:

Service: <CBService: 0x137e84ea0, isPrimary = YES, UUID = FFE0>
Characteristic: nil

我是这个 arduino 和 iOS 的初学者。所以任何建议都会受到欢迎。也许有一种方法可以在不知道特性的情况下写入蓝牙模块......我不知道。

4

1 回答 1

1

我终于设法得到了答案。由于我对 CoreBluetooth 框架的初步了解,我忘记调用discoverCharacteristics. didDiscoverServices嗯,我真的是边做边学。(我不知何故认为discoverServicesdiscoverCharacteristics自称。)

于 2015-12-15T22:49:37.640 回答