I am working on an app which can read device information via bluetooth BLE. So far I've been able to connect to the device and read certain properties like state of charge and firmware version number on iOS, Android, and within Chrome. However, now I'm at the point where I need to update the firmware and I am confused how to do so.
Little back story, the app is written in Ionic + Vue + Capacitor so everything is JavaScript/TypeScript. So the BLE plugin I'm using is the Capacitor Community Bluetooth LE. Within the documentation it has a write
method which wants deviceId
, service
, characteristic
, and value
. I know what I need to use for the first 3, but value
is suppose to be DataView
. Somehow I need to take a binary bin file and transmit it via this write command. I noticed that DataView
is an ArrayBuffer
with byteLength
and byteOffset
. I don't really know how to get my file into this format.
Assuming I have deviceId
, service
, characteristic
, how can I grab this file and transmit a DataView
using this write method?
Thanks in advance.
from Transmit binary file to device using BLE
No comments:
Post a Comment