Cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Sending Float32Array to companion results in UInt8Array?

Im trying to send sensor readings to a companion app, due to the high frequency of readings im trying to reduce their size so they can be sent over the messaging API by storing them as different types, however if i send a typed array using the messaging API it gets turned into a UInt8Array when i check it in the companion, which loses too much precision. 

 

Does anyone know why this is? Or if there is another way to reduce the size of the readings?

 

Best Answer
0 Votes
1 REPLY 1

You could try encoding the data on the device using CBOR, the decoding it in the companion.

 

import { decode, encode } from "cbor";
let encodedData = encode({some: "object"});
let decodedData = decode(encodedData);

 

Best Answer
0 Votes