jpmens / qtripp

Queclink Track (air) Interface Protocol Processor
Other
25 stars 8 forks source link

Process Power On and Off Messages? #6

Open ckrey opened 6 years ago

ckrey commented 6 years ago

GL300(W) devices (battery driven, not car connected) send GTPNA / GTPFA messages when manually switched on or off. As these messages do not contain a position (lat/lon), they are not processed

128keaton commented 12 months ago

I had a similar thought and am using something like this already in tline.c:

lat = GET_D(pos + dp -> lat);
lon = GET_D(pos + dp -> lon);

obj = json_mkobject();

if (!isnan(lat) && !isnan(lon)) {
  json_append_member(obj, "lat", json_mkdouble(lat, 6));
  json_append_member(obj, "lon", json_mkdouble(lon, 6));
  json_append_member(obj, "_type", json_mkstring("location"));
} else {
  json_append_member(obj, "_type", json_mkstring("status"));
}

This removes the need for setting the location here