Hello,
I am working on a project and this is the first time using Ubidots and IoT devices. I am trying to put a geofence in, and it seems like I just need to have my output be in this format -
{“position”: {“value”:1, “context”:{“lat”:25.7742700, “lng”: -80.1936600}}}
but I’m struggling with how to do that. My decoder is:
function Decoder(bytes, port)
{
var longitude_int, latitude_int;
var decoded = {};
if (port === 2) {
if(bytes[0]==9) // check if the header byte is 9.
{
latitude_int = (bytes[1] << 24) | (bytes[2] << 16) | (bytes[3] << 8) | (bytes[4]);
decoded.latitude = latitude_int / 100000;
longitude_int = (bytes[6] << 24) | (bytes[7] << 16) | (bytes[8] << 8) | (bytes[9]);
decoded.longitude = longitude_int / 100000;
return decoded;
}
}
}
But at the same time, my map widget updates, so I would think the event would work too. What else can I check if the format isn’t the issue?