Hi All,
I have recently migrated from V2 where I had a gateway and a GPS end device running , This was fine with the device being visable on “Advanced maps”.
Now having migrated to V3 my device is no longer visable , and I think it it is the payload decoder ,
being honest , I copied and pasted the old decoder into the new decoder area.
Is that where I went wrong ? below is the decoder. Any help , greatly appreciated .
The odd thing is a few weeks back the decoder worked on V3, however it now refuses to decode the payload.
Has anything changed in V3 recently that would produce this result or could it be I have some codeing wrong.
I can confirm the payload decoder alone works on V2 .
Hi Nick,
Thanks for the prompt reply
Not sure what you mean about a “Wrapper” however here is my payload followed by the decoder script
4F9AFF650108342C35322E3436343600000000
function Decoder(b, port) {
var lng = (b[0] | b[1]<<8 | b[2]<<16 | (b[2] & 0x80 ? 0xFF<<24 : 0)) / 10000;
var lat = (b[3] | b[4]<<8 | b[5]<<16 | (b[5] & 0x80 ? 0xFF<<24 : 0)) / 10000;
return {
location: {
longitude: lng,
latitude: lat
},
Woodbank : "**Seismet** Test_Node "
};
}
function decodeUplink(input) {
var data = input.bytes;
var valid = true;
if (typeof Decoder === "function") {
data = Decoder(data, input.fPort);
}
if (typeof Converter === "function") {
data = Converter(data, input.fPort);
}
if (typeof Validator === "function") {
valid = Validator(data, input.fPort);
}
if (valid) {
return {
data: data
};
} else {
return {
data: {},
errors: ["Invalid data received"]
};
}
}
The lower section below “Woodbank” is the adapter form the link in previous post , and I confirm when I fist set it up in V3 it did decode the payload.
Using the above payload and decoder only, and in the V2 stack it does decode ok ?
I suspect its down to my joining snippits together and relating to these things { and } .
I am not a coder but am trying to make sense of it all .
Best regards
Moderator Edit: Moved mouse to </> on toolbar to format code …
The extra code from the Munich blog - the one that wraps up the v2 code to make it v3 like.
That’s getting a bit old and is up there with the “I’m not good with Maths” grin. What level of coder do you have to be before you stop saying that?
Anyway, works for me, both with & without the “wrapper” - but I’d have expected it to break as how would it know which function to call? The v2 or the v3 one?
so , are you saying that it decodes in V3 ?
which is what I am trying to get it to do (it works fine in V2 then also in V3 till it broke)
By saying I am not a coder,
I meant I cant write the code but when I see it written down some parts I understand which I suppose is how we all started ! Maybe ?