GPSBabel / gpsbabel

GPSBabel: convert, manipulate, and transfer data from GPS programs or GPS receivers. Open Source and supported on MacOS, Windows, Linux, and more. Pointy clicky GUI or a command line version...
https://www.gpsbabel.org
GNU General Public License v2.0
473 stars 126 forks source link

sending routes to a garmin serial device can cause warnings on device #1293

Closed tsteven4 closed 1 month ago

tsteven4 commented 2 months ago

With a GPS12 sending a route to the device can cause messages on the device. Capabilities for routes are A200: D201 D103.

Route Waypoint was Deleted

Received an Invalid WPT

Transfer has been Completed

This is due to the insertion of "links" by garmin::route_waypt_pr

  /*
   * As stupid as this is, libjeeps seems to want an empty
   * waypoint between every link in a route that has nothing
   * but the 'islink' member set.   Rather than "fixing" libjeeps,
   * we just double them up (sigh) and do that here.
   */

Note that for the first waypoint is_rte is set in the "link" by garmin::route_hdr_pr and thus it is handled as a route header (D201_Send). However, since A200_Send doesn't know about links the remaining "links", and the real route waypoints, are send using D103_Send.

Here is a transcript with some extra debugging messages related to waypoint renaming.

$ sudo ./bld/gpsbabel -D5 -r -i unicsv -f test.csv -o garmin -F /dev/ttyS0
GPSBabel Version: 1.9.0
main: Compiled with Qt 6.2.4 for architecture x86_64-little_endian-lp64
main: Running with Qt 6.2.4 on Ubuntu 22.04.4 LTS, x86_64
main: QLocale::system() is en_US
main: QLocale() is en_US
main: QTextCodec::codecForLocale() is UTF-8, mib 106
options: module/option=value: unicsv/datum="WGS 84" (=default)
options: module/option=value: unicsv/prec="6" (=default)
options: module/option=value: unicsv/codec="UTF-8" (=default)
unicsv: Interpreting column "lat" as lat(1).
unicsv: Interpreting column "lon" as lon(2).
unicsv: Interpreting column "name" as name(0).
main: reader unicsv took 0.000 seconds.
GPS Serial Open at 9600
Tx Data:10 fe 00 02 10 03 : ...(PRDREQ  )
Rx Data:10 06 02 fe 00 fa 10 03  .. (ACK     )
Rx Data:10 ff 1b 57 00 cc 01 47 50 53 20 31 32 20 53 4f 46 54 57 41 52 45 20 20 34 2e 36 30 20 00 a2 10 03  W...GPS.12.SOFTWARE..4.60.. (PRDDAT  )
Tx Data:10 06 02 ff 00 f9 10 03 : .....(ACK     )
Unit:   GPS 12 SOFTWARE  4.60 
ID: 87
Version:    4.60
Rx Data:10 fd 3c 50 00 00 4c 01 00 41 0a 00 41 64 00 44 67 00 41 c8 00 44 c9 00 44 67 00 41 2c 01 44 2c 01 41 90 01 44 93 01 41 f4 01 44 f5 01 41 58 02 44 58 02 41 bc 02 44 bc 02 41 20 03 44 20 03 d0 10 03  P..L..A..Ad.Dg.A..D..Dg.A..D..A..D..A..D..AX.DX.A..D..A..D.. (UNKNOWN )
Tx Data:10 06 02 fd 00 fb 10 03 : .....(SESACK  )

Capability A10:
Capability A100: D103
Capability A200: D201 D103
Capability A300: D300
Capability A400: D403
Capability A500: D501
Capability A600: D600
Capability A700: D700
Capability A800: D800
Link_type 1  Device_command 0
Waypoint: Transfer 100 Type 103
Route:    Transfer 200 Header 201 Type 103
Track:    Transfer 300 Type 300
GPS Time: Wed Dec 31 17:00:00 1969
Tx Data:10 0a 02 32 00 c2 10 03 : 2....(CMDDAT  Xfer PVT Stop)
Rx Data:10 06 02 0a 00 ee 10 03  .. (ACK     )
GPS Serial Open at 9600
Tx Data:10 0a 02 05 00 ef 10 03 : .....(CMDDAT  Xfer Time)
Rx Data:10 06 02 0a 00 ee 10 03  .. (ACK     )
Rx Data:10 0e 0c 07 0d e8 07 0b 00 38 2b 0e 53 01 00 13 10 03  ......8..S.. (DATTIM  )
Tx Data:10 06 02 0e 00 ea 10 03 : .....(ACK     )
GPS Serial Open at 9600
Tx Data:10 0a 02 02 00 f2 10 03 : .....(CMDDAT  Xfer Posn)
Rx Data:10 06 02 0a 00 ee 10 03  .. (ACK     )
Rx Data:10 11 10 10 82 ff 47 3b 8c 54 e6 3f e2 b2 23 23 be 64 fd bf 1f 10 03  ..G..T.......d.. (POS     )
Tx Data:10 06 02 11 00 e7 10 03 : .....(ACK     )
Waypoint type: 103
Chosen waypoint length 6
"" 
"RT0000"
"RT0001"
"RT0002"
"RT0003"
"RT0004"
 40.0001 -105 1 0 1
RT0000 40.0001 -105 0 128 0
 40.001 -105.001 1 0 0
RT0001 40.001 -105.001 0 128 0
 40.002 -105.002 1 0 0
RT0002 40.002 -105.002 0 128 0
 40.003 -105.003 1 0 0
RT0003 40.003 -105.003 0 128 0
 40.004 -105.004 1 0 0
RT0004 40.004 -105.004 0 128 0
GPS Serial Open at 9600
Tx Data:10 1b 02 0a 00 d9 10 03 : .....(RECORD  )
Rx Data:10 06 02 1b 00 dd 10 03  .. (ACK     )
Tx Data:10 1d 15 00 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 4e 10 03 : .....................N..(RTEHDR  )
Rx Data:10 06 02 1d 00 db 10 03  .. (ACK     )
Tx Data:10 1e 3c 52 54 30 30 30 30 c5 cb 71 1c ac 50 55 b5 00 00 00 00 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 12 ff 0c 10 03 : RT0000..q..PU..................................................(RTEWPT  )
Rx Data:10 06 02 1e 00 da 10 03  .. (ACK     )
Tx Data:10 1e 3c 20 20 20 20 20 20 b7 f5 71 1c bb 26 55 b5 00 00 00 00 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 ff ff c4 10 03 : ........q...U..................................................(RTEWPT  )
Rx Data:10 06 02 1e 00 da 10 03  .. (ACK     )
Tx Data:10 1e 3c 52 54 30 30 30 31 b7 f5 71 1c bb 26 55 b5 00 00 00 00 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 12 ff 0a 10 03 : RT0001..q...U..................................................(RTEWPT  )
Rx Data:10 06 02 1e 00 da 10 03  .. (ACK     )
Tx Data:10 1e 3c 20 20 20 20 20 20 51 24 72 1c 20 f8 54 b5 00 00 00 00 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 ff ff c4 10 03 : ......Q.r...T..................................................(RTEWPT  )
Rx Data:10 06 02 1e 00 da 10 03  .. (ACK     )
Tx Data:10 1e 3c 52 54 30 30 30 32 51 24 72 1c 20 f8 54 b5 00 00 00 00 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 12 ff 09 10 03 : RT0002Q.r...T..................................................(RTEWPT  )
Rx Data:10 06 02 1e 00 da 10 03  .. (ACK     )
Tx Data:10 1e 3c 20 20 20 20 20 20 ec 52 72 1c 86 c9 54 b5 00 00 00 00 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 ff ff c4 10 03 : .......Rr...T..................................................(RTEWPT  )
Rx Data:10 06 02 1e 00 da 10 03  .. (ACK     )
Tx Data:10 1e 3c 52 54 30 30 30 33 ec 52 72 1c 86 c9 54 b5 00 00 00 00 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 12 ff 08 10 03 : RT0003.Rr...T..................................................(RTEWPT  )
Rx Data:10 06 02 1e 00 da 10 03  .. (ACK     )
Tx Data:10 1e 3c 20 20 20 20 20 20 86 81 72 1c eb 9a 54 b5 00 00 00 00 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 ff ff c5 10 03 : ........r...T..................................................(RTEWPT  )
Rx Data:10 06 02 1e 00 da 10 03  .. (ACK     )
Tx Data:10 1e 3c 52 54 30 30 30 34 86 81 72 1c eb 9a 54 b5 00 00 00 00 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 12 ff 08 10 03 : RT0004..r...T..................................................(RTEWPT  )
Rx Data:10 06 02 1e 00 da 10 03  .. (ACK     )
Tx Data:10 0c 02 07 00 eb 10 03 : .....(XFRCMP  )
Rx Data:10 06 02 0c 00 ec 10 03  .. (ACK     )
main: writer garmin took 3.137 seconds.
tsteven4 commented 2 months ago

A dirty fix, which relies on a real waypoint following each "link", is to ignore the "links" in GPS_A200_Send.

diff --git a/jeeps/gpsapp.cc b/jeeps/gpsapp.cc
index 5a091e87..df72df08 100644
--- a/jeeps/gpsapp.cc
+++ b/jeeps/gpsapp.cc
@@ -3190,6 +3190,8 @@ int32_t GPS_A200_Send(const char* port, GPS_PWay* way, int32_t n)
         GPS_Error("A200_Send: Unknown route protocol");
         return PROTOCOL_ERROR;
       }
+    } else if (way[i]->islink) {
+      continue; // links not supported.  can cause "Route Waypoint was Deleted" and "Received an Invalid WPT" on device.
     } else {
       method = LINK_ID[gps_link_type].Pid_Rte_Wpt_Data;

This results in only the message

Transfer has been Completed and a complete transfer of the route.

tsteven4 commented 2 months ago

The insertion of "links" goes back to the introduction of the capability to write routes in 2004 https://github.com/GPSBabel/gpsbabel/commit/0d5b7f0