ios - Reading Ble device Battery value -


i'm trying read battery level bluetooth ble device using corebluetooth , gatt. connect device, right list of services shown in debug below :

diddiscoverservices:( "<cbservice: 0x170273440, isprimary = yes, uuid = device information>", "<cbservice: 0x170273700, isprimary = yes, uuid = 1803>", "<cbservice: 0x170273740, isprimary = yes, uuid = 1802>", "<cbservice: 0x170273780, isprimary = yes, uuid = 1804>", "<cbservice: 0x1702737c0, isprimary = yes, uuid = battery>", "<cbservice: 0x170273800, isprimary = yes, uuid = heart rate>", "<cbservice: 0x170273840, isprimary = yes, uuid = fff0>", "<cbservice: 0x170273880, isprimary = yes, uuid = fff3>") 

obviously 1 want here has "battery" uuid. has 1 service :

<cbcharacteristic: 0x1700bf500, uuid = battery level, properties = 0x12, value = <64>, notifying = no> 

so save characteristic variable later reading. call "readvalueforcharacteristic" , wait "didupdatevalueforcharacteristic" bring me update. works fine until point. value seems wrong. it's 1 bit equals <64> , whatever never changes. 100% while doing :

byte *rsp = (byte*)[value bytes]; nsstring percent = [nsstring stringwithformat:@"%hhu",rsp[0]]; 

did miss ?


Comments

Popular posts from this blog

What is happening when Matlab is starting a "parallel pool"? -

angular - DownloadURL return null in below code -

php - Cannot override Laravel Spark authentication with own implementation -