码迷,mamicode.com
首页 > 其他好文 > 详细

CBCharacteristic

时间:2014-09-20 20:23:59      阅读:176      评论:0      收藏:0      [点我收藏+]

标签:des   blog   http   io   os   使用   ar   for   数据   

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

标签:des   blog   http   io   os   使用   ar   for   数据   

原文地址:http://www.cnblogs.com/zhongriqianqian/p/3983449.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!