React-native-ble-plx: Could not figure out the format of the value returned after connecting and reading a specific characteristic

Created on 27 Oct 2017  路  3Comments  路  Source: Polidea/react-native-ble-plx

uuid : "xxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
value : "CAIBAQAAAAAAAAAAAAAAAAAAAAA="

Any insights onto this would help

All 3 comments

You should check documentation before asking questions:
https://polidea.github.io/react-native-ble-plx/#characteristic
Values are in Base64 format.

Yeah . Apologies but i am unable to convert the Value i mentioned above from base64 to integer. Gets an NaN error using base64-int32 module

Your value looks fine and can be decoded as LE or BE int32 value:

var base64 = require("base64-js")
const array = base64.toByteArray("CAIBAQAAAAAAAAAAAAAAAAAAAAA=").buffer
const intLE = new DataView(array).getInt32(0, true)
const intBE = new DataView(array).getInt32(0, false)
console.log("LE: ", intLE, ", BE: ", intBE)
Was this page helpful?
0 / 5 - 0 ratings

Related issues

alfacommunication-alessandro picture alfacommunication-alessandro  路  4Comments

samthui picture samthui  路  4Comments

haohcraft picture haohcraft  路  5Comments

mitaxe picture mitaxe  路  3Comments

SlavaInstinctools picture SlavaInstinctools  路  4Comments