data中有00和空格
+(NSString *)transformCharateristicValueFromData:(NSData *)dataValue{
if (!dataValue || [dataValue length] == 0) {
return @"";
}
NSMutableString *destStr = [[NSMutableString alloc]initWithCapacity:[dataValue length]];
[dataValue enumerateByteRangesUsingBlock:^(const void * _Nonnull bytes, NSRange byteRange, BOOL * _Nonnull stop) {
unsigned char *dataBytes = (unsigned char *)bytes;
for (int i = 0; i < byteRange.length; i++) {
NSString *hexStr = [NSString stringWithFormat:@"%x",(dataBytes[i]) & 0xff];
if ([hexStr length] == 2) {
[destStr appendString:hexStr];
}else{
[destStr appendFormat:@"0%@",hexStr];
}
}
}];
return destStr;
}