#
# Garmin Tranining Center .tcx (gtrnctr)
#
# reading
rm -f ${TMPDIR}/history~tcx.csv ${TMPDIR}/course~tcx.csv
gpsbabel -i gtrnctr -f ${REFERENCE}/track/history.tcx -t -o unicsv,utc=0 -F ${TMPDIR}/history~tcx.csv
compare ${REFERENCE}/track/history~tcx.csv ${TMPDIR}/history~tcx.csv
gpsbabel -i gtrnctr -f ${REFERENCE}/track/history.tcx -t -o gpx -F ${TMPDIR}/history~tcx.gpx
compare ${REFERENCE}/track/history~tcx.gpx ${TMPDIR}/history~tcx.gpx
gpsbabel -i gtrnctr -f ${REFERENCE}/track/course.tcx -t -o unicsv,utc=0 -F ${TMPDIR}/course~tcx.csv
compare ${REFERENCE}/track/course~tcx.csv ${TMPDIR}/course~tcx.csv
gpsbabel -i gtrnctr -f ${REFERENCE}/track/course.tcx -t -o gpx -F ${TMPDIR}/course~tcx.gpx
compare ${REFERENCE}/track/course~tcx.gpx ${TMPDIR}/course~tcx.gpx
# writing
rm -f ${TMPDIR}tcxtest~gpx-course.tcx ${TMPDIR}tcxtest~gpx-history.tcx
gpsbabel -i gpx -f ${REFERENCE}/track/tcxtest.gpx -o gtrnctr,course=1 -F ${TMPDIR}/tcxtest~gpx-course.tcx
compare ${REFERENCE}/track/tcxtest~gpx-course.tcx ${TMPDIR}/tcxtest~gpx-course.tcx
gpsbabel -i gpx -f ${REFERENCE}/track/tcxtest.gpx -o gtrnctr,course=0 -F ${TMPDIR}/tcxtest~gpx-history.tcx
compare ${REFERENCE}/track/tcxtest~gpx-history.tcx ${TMPDIR}/tcxtest~gpx-history.tcx

# Reading coursepoints
gpsbabel -i gtrnctr -f ${REFERENCE}/track/gtrnctr-readcp.tcx -o gpx -F ${TMPDIR}/tcxtest-readcp.gpx
compare ${REFERENCE}/track/gtrnctr-readcp.gpx  ${TMPDIR}/tcxtest-readcp.gpx
