Comments (5)
Hi,
My assumption is that the ttn side implementation no longer has .slice
implemented.
Can you try: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/slice#calling_slice_on_non-array_objects
E.g.:
Array.prototype.slice.call(bytes, x, x + 1)
in your case and see if that works? If not, then we'll need to provide a slice implementation or manually pick the right bytes.
from lora-serialization.
Many thanks @joscha for the (indirect) hint, I found the error!
Turned out the bytes
parameter was a dictionary, containing another key called bytes
. Running the following snippet:
function decodeUplink(bytes) {
throw new Error(JSON.stringify(bytes))
}
shows the passed bytes
object:
{
"bytes": [1, 2, 3],
"fPort":10
}
Now we can convert them using
data.fPort = uint8(bytes.bytes.slice(x, x + 1));
BR, Christian :-)
from lora-serialization.
I see, great! Did you copy that sample from somewhere in the docs? If yes, would you mind opening a PR to fix it, please?
from lora-serialization.
No, the bytes
data sample was from one of my tests. I just used the converter snippets from the README.md, like:
uint8(bytes.slice(x, x + 1)) // 10
I can however create a PR to replace the bytes
with bytes.bytes
or probably more understandable payload.bytes
, if you want.
from lora-serialization.
from lora-serialization.
Related Issues (18)
- Create encoder that takes encoder functions HOT 2
- Sending GPS data to TTN using TinyGPS++ HOT 2
- Decode Bitmap returns wrong values if the first bit is false. HOT 3
- Issue with library name HOT 1
- Decoding on an Arduino HOT 2
- class c support? HOT 3
- a sample on lmic please HOT 2
- Integration of opcodes HOT 3
- TTN Encoder and Payload Format HOT 5
- Boolean Datatype HOT 2
- Decoder in Java HOT 1
- Decoder on .cpp ? HOT 1
- Is this library still active and relevant? HOT 4
- 4-byte Float Functions not provided in archive visible to Arduino Library Manager HOT 6
- Version mismatch between release archive (v3.0.1) and library.properties (v3.0.0) HOT 2
- Missing LoraEncoder::getLength() HOT 9
- sign of temperature values ignored HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from lora-serialization.