Any examples of a custom ENcoder?

I’ve seen a lot of examples of ciustom DEcoders, but I have yet to find an example of a working chirpstack compatible ENcodfer.

Does anyone know of any ENcoder examples out there?

Thanks!

Jason

An encoder is really device dependent, so there is no example which works for all devices. But essentially what it does is turning a JavaScript object into an array of bytes (where a decoder turns an array of bytes into a JavaScript object).

2 Likes

No worries, I understand what it is for. It was just a bit confusing how to implement in chirpstack given that the stub functions I’ve seen all include 3 parameters:

function Encode(fPort, obj, variables) {

But the on-screen text describes two:

And TTN encode functions seem to return the port# in addition to the array of bytes, but I assume based on the text that chirpstack does not.

So I thought a working example may clarify things. In the end the function parameters likely don’t matter I guess as long as all I need to return is an array of bytes, and not port or anything else.

Did you get some code?

Nope, and I haven’t had time to circle back to it yet to attempt via trial and error.

1 Like