首页 > 代码库 > CBCharacteristic
CBCharacteristic
Identifying a Characteristic
@property(readonly, nonatomic) CBUUID *UUID@property(weak, readonly, nonatomic) CBService *service
Accessing Characteristic Data
@property(retain, readonly) NSData *value//例如体温检测服务,value为温度@property(retain, readonly) NSArray *descriptors//CBDescriptor对象数组,value外的其他值等@property(readonly, nonatomic) CBCharacteristicProperties properties//The properties of a characteristic determine how the characteristic’s value and descriptors can be used and accessed. @property(readonly) BOOL isNotifying@property(readonly) BOOL isBroadcasted//IOS8以后不使用
Constants
typedef enum { CBCharacteristicPropertyBroadcast = 0x01 , CBCharacteristicPropertyRead = 0x02 , CBCharacteristicPropertyWriteWithoutResponse = 0x04 , CBCharacteristicPropertyWrite = 0x08 , CBCharacteristicPropertyNotify = 0x10 , CBCharacteristicPropertyIndicate = 0x20 , CBCharacteristicPropertyAuthenticatedSignedWrites = 0x40 , CBCharacteristicPropertyExtendedProperties = 0x80 , CBCharacteristicPropertyNotifyEncryptionRequired = 0x100 , CBCharacteristicPropertyIndicateEncryptionRequired = 0x200 ,} CBCharacteristicProperties;
Values representing the possible properties of a characteristic. Since characteristic properties can be combined, a characteristic may have multiple property values set.
1.read,调用readValueForCharacteristic方法,然后数据更新的时候会调用peripheral:didUpdateValueForCharacteristic:error:方法。此时读取value值即可。
2.write,使用 writeValue:forCharacteristic:type:方法写数据。type值表明是否有response。(没有response的比有response的数值可以更长?)
CBCharacteristic
声明:以上内容来自用户投稿及互联网公开渠道收集整理发布,本网站不拥有所有权,未作人工编辑处理,也不承担相关法律责任,若内容有误或涉及侵权可进行投诉: 投诉/举报 工作人员会在5个工作日内联系你,一经查实,本站将立刻删除涉嫌侵权内容。