Decode Python struct on TTN using Javascript
-
Hey everyone,
I'm having some trouble in my attempt to send multiple pieces of data over LoRa. I'm currently just messing around with the python struct module and sending random float values.I'm using the struct.pack('>f', <value>), but since I'm needing to send multiple values I'm unsure if my method of simply adding the byte strings together (using the above function twice and adding the string together) will get me what I need. Anyways my problem mostly comes out on the decoder side. If I send two floats, that comes out to a total of 8 bytes. How exactly can I pull out the individual values on the Javascript end using the TTN decoder. I've looked around for a while and have seen some answers as far as decoding goes. I mostly looked at this thread here for lat and long, but most people encode the data before sending it and modify it back on the other end.
So my basic question is, if I send data packed using struct.pack() (assume big endian format), how can I pull those values out in Javascript?
-
Found my answer after hours of looking around.
Found this beautiful post on TTN regarding decoding the values of different types and what have you found here by
Arjanvanb on TTNThe main answer was posted on Stackoverflow by Ilya Bursov.
Hello! It looks like you're interested in this conversation, but you don't have an account yet.
Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.
With your input, this post could be even better 💗
Register Login