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
Post a Comment