OGeek|极客世界-中国程序员成长平台

标题: ios - 核心蓝牙 : what is the Service UUID FFE0 shorten for? [打印本页]

作者: 菜鸟教程小白    时间: 2022-12-12 13:46
标题: ios - 核心蓝牙 : what is the Service UUID FFE0 shorten for?

我正在做一个项目,将 iOS 与配备 Bluetooth 4.0 的设备连接起来。

设备是从第三方购买的。 (我的 iPhone 作为中心角色)连接后,我打印它的 UUID

 for (CBService *service in peripheral.services) {

        NSLog(@"service :%@", service);
        NSLog(@"service uuid %@", service.UUID);

        [peripheral discoverCharacteristics:nil forService:service];
    }

输出是

2015-01-13 10:09:03.474 TestBTCC[3149:828116] service :<CBService: 0x17406f000, isPrimary = YES, UUID = FFE0>
2015-01-13 10:09:03.474 TestBTCC[3149:828116] service uuid FFE0

UUID 应为 128 位。而16bit应该是一些预定义的UUID的缩短格式。这是什么?

根据https://developer.apple.com/library/ios/documentation/NetworkingInternetWeb/Conceptual/CoreBluetooth_concepts/PerformingCommonPeripheralRoleTasks/PerformingCommonPeripheralRoleTasks.html#//apple_ref/doc/uid/TP40013257-CH4-SW8 ,我可以使用预定义的缩短16bit来生成CBUUID,比如

 CBUUID *heartRateServiceUUID = [CBUUID UUIDWithString: @"180D"];

我可以直接写吗:

 CBUUID *heartRateServiceUUID = [CBUUID UUIDWithString: @"FFE0"];

不管是什么意思?



Best Answer-推荐答案


FFE0 是一个温度特性,您将没有对该特性的写入权限,并且温度将以摄氏度为单位读出。您可以阅读特征或订阅其更新。

更多信息可以找到here .

关于ios - 核心蓝牙 : what is the Service UUID FFE0 shorten for?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27914223/






欢迎光临 OGeek|极客世界-中国程序员成长平台 (http://ogeek.cn/) Powered by Discuz! X3.4