在 base64 中编码一个整数以通过 BLE 发送

问题描述

我正在开发这个使用蓝牙库 (https://github.com/Polidea/react-native-ble-plx) 的应用程序,我需要使用 base64 (https://github.com/eranbo/react-native-base64#readme) 将一个整数作为状态保存到蓝牙模块。有没有办法使用 base64 发送整数?

根据文档,我们需要如下写-

device.writeCharacteristicWithResponseForService(

serviceUUID: UUID,characteristicUUID: UUID,valueBase64: Base64)

然后写入模块:

device.writeCharacteristicWithResponseForService('uuidServ','uuidCharc',base64Data) 

这是我迄今为止尝试过的:

const base64Data = base64.encode(bytes(this.state.totalSec)); 
console.log(base64Data); 

有没有办法获取 base64 数据以便我可以将其发送到 BLE 模块?

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)