objective c - Best way to read Beacon Manufacture Data in iOS -
i trying read beacon(ble device) manufacture data in below image
and getting response as,
and code is,
id manufacturedata = [advertisementdata objectornilforkey:@"kcbadvdatamanufacturerdata"]; if ([manufacturedata iskindofclass:[nsdata class]]) { int8_t measuredpower = 0; nsuinteger datalength = [manufacturedata length]; (int = 0; < datalength; i++) { nsrange powerrange = nsmakerange(i, 1); [manufacturedata getbytes:&measuredpower range:powerrange]; nslog(@"index :%@ info :%hhd", [nsstring stringwithformat:@"%d", i+1],measuredpower); } }
is correct way read manufacture data, here trying read battery address value. have show.
this correct way of reading through returned nsdata
.
given this, information returning 32 battery value, seem correct?
if not, can find out if manufacturer device little endian or big endian? link explanation here if not know means.
the short version of endianness question if info coming big endian processor nsdata
backwards. making battery value 77
one quick note: not sound ibeacon implementation. ibeacons not same ble enabled devices. ble enabled device , not ibeacon.
Comments
Post a Comment