android - Retrieving a large 32 bit unsigned integer from a Bluetooth low energy GATT characteristic -


i attempting retrieve large (potentially 2^32 - 1) unsigned 32 bit integer bluetooth 4.0 characteristic using getintvalue method of bluetoothgattcharacteristic instance.

i passing format_uint32 getintvalue, because returns integer can't return number larger 2^31 - 1. when try getting value larger 2^31 - 1 incorrectly returns negative integer.

what's point of getintvalue accepting format_uint32 if can't possibly return unsigned 32 bit integer? there missing?

is option use getvalue() , manually convert long?

looks works me:

long value = characteristic.getintvalue(bluetoothgattcharacteristic.format_uint32, 0) & 0x00000000ffffffffl; 

Comments

Popular posts from this blog

android - Inheriting from Theme.AppCompat* -

broadcastreceiver - android BOOT_COMPLETED not received if not activity intent-filter -

basic authentication with http post params android -