[garmindev] 07/12: Imported Upstream version 0.3.4
Jaromír Mikeš
mira-guest at moszumanska.debian.org
Sat Apr 25 15:28:43 UTC 2015
This is an automated email from the git hooks/post-receive script.
mira-guest pushed a commit to branch master
in repository garmindev.
commit 47007e9273be63c93a4e8e22dce1fdf7b5f89217
Author: Jaromír Mikeš <mira.mikes at seznam.cz>
Date: Sat Apr 25 17:27:49 2015 +0200
Imported Upstream version 0.3.4
---
CMakeLists.txt | 17 +-
CMakeLists.txt.user | 164 +++++++++
changelog.txt | 11 +
src/CUSB.cpp | 12 +-
src/EtrexLegendC/loader.cpp | 1 +
src/ForeRunner/CDevice.cpp | 673 +++++++++++++++++++++++++++++++++++++
src/ForeRunner/CDevice.h | 75 +++++
src/ForeRunner/CMakeLists.txt | 29 ++
src/ForeRunner/Makefile | 261 ++++++++++++++
src/ForeRunner/cmake_install.cmake | 34 ++
src/ForeRunner/loader.cpp | 49 +++
src/GPSMap60CSx/CDevice.cpp | 53 +--
src/GPSMap60CSx/loader.cpp | 3 +
src/Garmin.cpp | 34 +-
src/Garmin.h | 21 +-
src/IDevice.h | 18 +-
src/IDeviceDefault.cpp | 4 +
17 files changed, 1417 insertions(+), 42 deletions(-)
diff --git a/CMakeLists.txt b/CMakeLists.txt
index ab629a4..51b72e7 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -9,12 +9,12 @@ endif(COMMAND cmake_policy)
#this one is for the API version check
set(VER_MAJOR 01)
-set(VER_MINOR 17)
+set(VER_MINOR 18)
#this one is for the release version
set(PACKAGE_VER_MAJOR 0)
set(PACKAGE_VER_MINOR 3)
-set(PACKAGE_VER_PATCH 3)
+set(PACKAGE_VER_PATCH 4)
add_definitions(-DVER_MAJOR=${VER_MAJOR} -DVER_MINOR=${VER_MINOR})
@@ -46,13 +46,13 @@ include_directories(
if(APPLE)
set(SHARED_LIB_EXT ".dylib")
set(QLANDKARTEGT_BUILD_DIR "../build_QLandkarteGT"
- CACHE PATH "location of the QLandkarteGT build folder")
+ CACHE PATH "location of the QLandkarteGT build folder")
add_custom_target(mac-deploy
- COMMAND
- rm -rf "${QLANDKARTEGT_BUILD_DIR}/bin/QLandkarte\ GT.app/Contents/Resources/Drivers" &&
- mkdir -p "${QLANDKARTEGT_BUILD_DIR}/bin/QLandkarte\ GT.app/Contents/Resources/Drivers" &&
- tar -cpf - --exclude '*.a' -C ${LIBRARY_OUTPUT_PATH} . |
- tar -xpf - -C "${QLANDKARTEGT_BUILD_DIR}/bin/QLandkarte\ GT.app/Contents/Resources/Drivers"
+ COMMAND
+ rm -rf "${QLANDKARTEGT_BUILD_DIR}/bin/QLandkarte\ GT.app/Contents/Resources/Drivers" &&
+ mkdir -p "${QLANDKARTEGT_BUILD_DIR}/bin/QLandkarte\ GT.app/Contents/Resources/Drivers" &&
+ tar -cpf - --exclude '*.a' -C ${LIBRARY_OUTPUT_PATH} . |
+ tar -xpf - -C "${QLANDKARTEGT_BUILD_DIR}/bin/QLandkarte\ GT.app/Contents/Resources/Drivers"
)
elseif(UNIX)
set(SHARED_LIB_EXT ".so")
@@ -67,6 +67,7 @@ add_subdirectory(./src/EtrexLegendC)
add_subdirectory(./src/EtrexLegend)
add_subdirectory(./src/EtrexH)
add_subdirectory(./src/whatGarmin)
+add_subdirectory(./src/ForeRunner)
install(
DIRECTORY
diff --git a/CMakeLists.txt.user b/CMakeLists.txt.user
new file mode 100644
index 0000000..6dc6ee3
--- /dev/null
+++ b/CMakeLists.txt.user
@@ -0,0 +1,164 @@
+<!DOCTYPE QtCreatorProject>
+<qtcreator>
+ <data>
+ <variable>activeRunConfiguration</variable>
+ <value type="int">0</value>
+ </data>
+ <data>
+ <variable>activebuildconfiguration</variable>
+ <value type="QString">all</value>
+ </data>
+ <data>
+ <variable>buildConfiguration-all</variable>
+ <valuemap type="QVariantMap">
+ <value key="ProjectExplorer.BuildConfiguration.DisplayName" type="QString">all</value>
+ <value key="buildDirectory" type="QString">/home/oeichler/data/cpp/build_GarminDev</value>
+ <value key="msvcVersion" type="QString"></value>
+ </valuemap>
+ </data>
+ <data>
+ <variable>buildconfiguration-all-buildstep0</variable>
+ <valuemap type="QVariantMap">
+ <value key="ProjectExplorer.BuildConfiguration.DisplayName" type="QString">all</value>
+ <valuelist key="abstractProcess.Environment" type="QVariantList">
+ <value type="QString">COLORTERM=1</value>
+ <value type="QString">CPU=x86_64</value>
+ <value type="QString">CSHEDIT=emacs</value>
+ <value type="QString">CVS_RSH=ssh</value>
+ <value type="QString">DBUS_SESSION_BUS_ADDRESS=unix:abstract=/tmp/dbus-MWaTkAosos,guid=81e4d1222652271161bd5b894befa52c</value>
+ <value type="QString">DESKTOP_SESSION=default</value>
+ <value type="QString">DISPLAY=:0</value>
+ <value type="QString">DM_CONTROL=/var/run/xdmctl</value>
+ <value type="QString">ENV=/etc/bash.bashrc</value>
+ <value type="QString">FROM_HEADER=</value>
+ <value type="QString">GPG_AGENT_INFO=/tmp/gpg-6GvjOy/S.gpg-agent:2023:1</value>
+ <value type="QString">GS_LIB=/home/oeichler/.fonts</value>
+ <value type="QString">GTK2_RC_FILES=/etc/gtk-2.0/gtkrc:/usr/share/themes//QtCurve/gtk-2.0/gtkrc:/home/oeichler/.gtkrc-2.0-qtengine:/home/oeichler/.gtkrc-2.0:/home/oeichler/.kde4/share/config/gtkrc-2.0</value>
+ <value type="QString">GTK_IM_MODULE=cedilla</value>
+ <value type="QString">GTK_RC_FILES=/etc/gtk/gtkrc:/home/oeichler/.gtkrc::/home/oeichler/.kde4/share/config/gtkrc</value>
+ <value type="QString">G_BROKEN_FILENAMES=1</value>
+ <value type="QString">G_FILENAME_ENCODING=@locale,UTF-8,ISO-8859-15,CP1252</value>
+ <value type="QString">HISTSIZE=1000</value>
+ <value type="QString">HOME=/home/oeichler</value>
+ <value type="QString">HOST=linux-1jnh</value>
+ <value type="QString">HOSTNAME=linux-1jnh</value>
+ <value type="QString">HOSTTYPE=x86_64</value>
+ <value type="QString">INPUTRC=/home/oeichler/.inputrc</value>
+ <value type="QString">JAVA_BINDIR=/usr/lib64/jvm/java/bin</value>
+ <value type="QString">JAVA_HOME=/usr/lib64/jvm/java</value>
+ <value type="QString">JAVA_ROOT=/usr/lib64/jvm/java</value>
+ <value type="QString">JDK_HOME=/usr/lib64/jvm/java</value>
+ <value type="QString">JRE_HOME=/usr//jvm/jre</value>
+ <value type="QString">KDE_FULL_SESSION=true</value>
+ <value type="QString">KDE_MULTIHEAD=false</value>
+ <value type="QString">KDE_SESSION_UID=1000</value>
+ <value type="QString">KDE_SESSION_VERSION=4</value>
+ <value type="QString">LANG=de_DE.UTF-8</value>
+ <value type="QString">LANGUAGE=</value>
+ <value type="QString">LD_LIBRARY_PATH=/opt/qtcreator-1.3.1/lib/qtcreator:/usr/lib64/mpi/gcc/openmpi/lib64</value>
+ <value type="QString">LESS=-M -I</value>
+ <value type="QString">LESSCLOSE=lessclose.sh %s %s</value>
+ <value type="QString">LESSKEY=/etc/lesskey.bin</value>
+ <value type="QString">LESSOPEN=lessopen.sh %s</value>
+ <value type="QString">LESS_ADVANCED_PREPROCESSOR=no</value>
+ <value type="QString">LOGNAME=oeichler</value>
+ <value type="QString">LS_COLORS=no=00:fi=00:di=01;34:ln=00;36:pi=40;33:so=01;35:do=01;35:bd=40;33;01:cd=40;33;01:or=41;33;01:ex=00;32:*.cmd=00;32:*.exe=01;32:*.com=01;32:*.bat=01;32:*.btm=01;32:*.dll=01;32:*.tar=00;31:*.tbz=00;31:*.tgz=00;31:*.rpm=00;31:*.deb=00;31:*.arj=00;31:*.taz=00;31:*.lzh=00;31:*.lzma=00;31:*.zip=00;31:*.zoo=00;31:*.z=00;31:*.Z=00;31:*.gz=00;31:*.bz2=00;31:*.tb2=00;31:*.tz2=00;31:*.tbz2=00;31:*.xz=00;31:*.avi=01;35:*.bmp=01;35:*.fli=01;35:*.gif=01;35:*.jpg=01;3 [...]
+ <value type="QString">LS_OPTIONS=-N --color=tty -T 0</value>
+ <value type="QString">MACHTYPE=x86_64-suse-linux</value>
+ <value type="QString">MAIL=/var/spool/mail/oeichler</value>
+ <value type="QString">MANPATH=/usr/lib64/mpi/gcc/openmpi/share/man:/usr/local/man:/usr/local/share/man:/usr/share/man:/usr/man</value>
+ <value type="QString">MINICOM=-c on</value>
+ <value type="QString">MORE=-sl</value>
+ <value type="QString">NNTPSERVER=news</value>
+ <value type="QString">OSTYPE=linux</value>
+ <value type="QString">PAGER=less</value>
+ <value type="QString">PATH=/opt/qtcreator-1.3.1/bin/:/usr/lib64/mpi/gcc/openmpi/bin:/usr/local/bin:/usr/bin:/bin:/usr/bin/X11:/usr/X11R6/bin:/usr/games:/opt/kde3/bin:/usr/lib/mit/bin:/usr/lib/mit/sbin:/usr/lib/qt3/bin</value>
+ <value type="QString">PROFILEREAD=true</value>
+ <value type="QString">PWD=/home/oeichler</value>
+ <value type="QString">PYTHONSTARTUP=/etc/pythonstart</value>
+ <value type="QString">QTDIR=/usr/lib/qt3</value>
+ <value type="QString">QT_IM_MODULE=xim</value>
+ <value type="QString">QT_IM_SWITCHER=imsw-multi</value>
+ <value type="QString">QT_PLUGIN_PATH=/home/oeichler/.kde4/lib64/kde4/plugins/:/usr/lib64/kde4/plugins/</value>
+ <value type="QString">QT_SYSTEM_DIR=/usr/share/desktop-data</value>
+ <value type="QString">SDK_HOME=/usr/lib64/jvm/java</value>
+ <value type="QString">SESSION_MANAGER=local/linux-1jnh:@/tmp/.ICE-unix/2737,unix/linux-1jnh:/tmp/.ICE-unix/2737</value>
+ <value type="QString">SHELL=/bin/bash</value>
+ <value type="QString">SHLVL=1</value>
+ <value type="QString">SSH_AGENT_PID=2024</value>
+ <value type="QString">SSH_ASKPASS=/usr/lib64/ssh/x11-ssh-askpass</value>
+ <value type="QString">SSH_AUTH_SOCK=/tmp/ssh-prWUj1940/agent.1940</value>
+ <value type="QString">TERM=xterm</value>
+ <value type="QString">TMPDIR=/tmp</value>
+ <value type="QString">USER=oeichler</value>
+ <value type="QString">USE_FAM=</value>
+ <value type="QString">WINDOWMANAGER=/usr/bin/startkde</value>
+ <value type="QString">WINDOWPATH=7</value>
+ <value type="QString">XAUTHLOCALHOSTNAME=linux-1jnh</value>
+ <value type="QString">XCURSOR_THEME=Oxygen_Blue</value>
+ <value type="QString">XDG_CONFIG_DIRS=/etc/xdg</value>
+ <value type="QString">XDG_DATA_DIRS=/usr/local/share:/usr/share:/etc/opt/kde3/share:/opt/kde3/share</value>
+ <value type="QString">XDG_SESSION_COOKIE=00ae16e1b7de5857b484b7014aef75cb-1273996585.770895-1731118709</value>
+ <value type="QString">XDM_MANAGED=method=classic,auto</value>
+ <value type="QString">XKEYSYMDB=/usr/share/X11/XKeysymDB</value>
+ <value type="QString">XMODIFIERS=@im=local</value>
+ <value type="QString">XNLSPATH=/usr/share/X11/nls</value>
+ <value type="QString">XSESSION_IS_UP=yes</value>
+ </valuelist>
+ <value key="abstractProcess.IgnoreReturnValue" type="bool">false</value>
+ <valuelist key="abstractProcess.arguments" type="QVariantList"/>
+ <value key="abstractProcess.command" type="QString">make</value>
+ <value key="abstractProcess.enabled" type="bool">true</value>
+ <value key="abstractProcess.workingDirectory" type="QString">/home/oeichler/data/cpp/build_GarminDev</value>
+ </valuemap>
+ </data>
+ <data>
+ <variable>buildconfiguration-all-cleanstep0</variable>
+ <valuemap type="QVariantMap">
+ <value key="ProjectExplorer.BuildConfiguration.DisplayName" type="QString">all</value>
+ <valuelist key="additionalArguments" type="QVariantList">
+ <value type="QString">clean</value>
+ </valuelist>
+ <value key="cleanConfig" type="bool">true</value>
+ </valuemap>
+ </data>
+ <data>
+ <variable>buildconfigurations</variable>
+ <valuelist type="QVariantList">
+ <value type="QString">all</value>
+ </valuelist>
+ </data>
+ <data>
+ <variable>buildstep0</variable>
+ <valuemap type="QVariantMap">
+ <value key="ProjectExplorer.BuildConfiguration.DisplayName" type="QString"></value>
+ </valuemap>
+ </data>
+ <data>
+ <variable>buildsteps</variable>
+ <valuelist type="QVariantList">
+ <value type="QString">CMakeProjectManager.MakeStep</value>
+ </valuelist>
+ </data>
+ <data>
+ <variable>cleanstep0</variable>
+ <valuemap type="QVariantMap">
+ <value key="ProjectExplorer.BuildConfiguration.DisplayName" type="QString"></value>
+ <value key="clean" type="bool">true</value>
+ </valuemap>
+ </data>
+ <data>
+ <variable>cleansteps</variable>
+ <valuelist type="QVariantList">
+ <value type="QString">CMakeProjectManager.MakeStep</value>
+ </valuelist>
+ </data>
+ <data>
+ <variable>defaultFileEncoding</variable>
+ <value type="QByteArray">UTF-8</value>
+ </data>
+ <data>
+ <variable>project</variable>
+ <valuemap type="QVariantMap"/>
+ </data>
+</qtcreator>
diff --git a/changelog.txt b/changelog.txt
index 6065844..710174a 100644
--- a/changelog.txt
+++ b/changelog.txt
@@ -1,3 +1,13 @@
+--- 2010.06.06 ---
+
+Bug #11:
+Fix screenshot rotation for 60SCx
+
+Request #12:
+add driver for Forerunner 305
+
+
+
--- 2010.02.06 ---
Request #10:
@@ -60,3 +70,4 @@ Initial Release
+
diff --git a/src/CUSB.cpp b/src/CUSB.cpp
index 9119c46..ea04881 100644
--- a/src/CUSB.cpp
+++ b/src/CUSB.cpp
@@ -288,9 +288,9 @@ void CUSB::start(struct usb_device *dev)
}
if (dev->config == 0) {
- stringstream msg;
- msg << "USB device has no configuration: " << usb_strerror();
- throw exce_t(errOpen,msg.str());
+ stringstream msg;
+ msg << "USB device has no configuration: " << usb_strerror();
+ throw exce_t(errOpen,msg.str());
}
if (usb_set_configuration(udev, dev->config->bConfigurationValue) < 0) {
@@ -440,6 +440,12 @@ void CUSB::syncup(void)
uint16_t CUSB::getDataType(int data_no, char tag, uint16_t protocol)
{
+
+ if (protocolArraySize == 0)
+ {
+ return 0;
+ }
+
// Find the right tag D<Data_no> for <tag><protocol>
for (uint32_t i=0; i < protocolArraySize-1-data_no; i++) {
if ((char)protocolArray[i].tag == tag) {
diff --git a/src/EtrexLegendC/loader.cpp b/src/EtrexLegendC/loader.cpp
index 0560a11..af0580f 100644
--- a/src/EtrexLegendC/loader.cpp
+++ b/src/EtrexLegendC/loader.cpp
@@ -61,6 +61,7 @@ extern "C" WIN_EXPORT Garmin::IDevice * initGPSMap60C(const char * version)
return EtrexLegendC::device;
}
+
extern "C" WIN_EXPORT Garmin::IDevice * initGPSMap60CS(const char * version)
{
if(strncmp(version,INTERFACE_VERSION,5) != 0) {
diff --git a/src/ForeRunner/CDevice.cpp b/src/ForeRunner/CDevice.cpp
new file mode 100644
index 0000000..83e7c5b
--- /dev/null
+++ b/src/ForeRunner/CDevice.cpp
@@ -0,0 +1,673 @@
+/**********************************************************************************************
+ Copyright (C) 2007 Oliver Eichler oliver.eichler at gmx.de
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111 USA
+
+ Garmin and MapSource are registered trademarks or trademarks of Garmin Ltd.
+ or one of its subsidiaries.
+
+**********************************************************************************************/
+#include "../Platform.h"
+#include "CDevice.h"
+#include <Garmin.h>
+
+#include <cstdio>
+#include <errno.h>
+#include <iostream>
+#include <sstream>
+#include <stdio.h>
+
+using namespace FR305;
+using namespace Garmin;
+using namespace std;
+
+#if defined(HAVE_BIGENDIAN) || !defined(CAN_UNALIGNED)
+# define DBG_SHOW_WAYPOINT
+# define UNTESTED throw exce_t(errSync, "This function has not yet been tested on your platform.")
+#else
+# define UNTESTED
+#endif
+
+namespace FR305
+{
+
+ class CMutexLocker
+ {
+ public:
+ CMutexLocker(pthread_mutex_t& mutex)
+ : mutex(mutex) {
+ pthread_mutex_lock(&mutex);
+ }
+
+ ~CMutexLocker() {
+ pthread_mutex_unlock(&mutex);
+ }
+ private:
+ pthread_mutex_t& mutex;
+
+ };
+
+ void * rtThread(void *ptr) {
+ cout << "start thread" << endl;
+ Packet_t command;
+ Packet_t response;
+
+ CDevice * dev = (CDevice*)ptr;
+ CMutexLocker lock(dev->mutex);
+ try
+ {
+ pthread_mutex_lock(&dev->dataMutex);
+ dev->_acquire();
+
+ command.type = GUSB_APPLICATION_LAYER;
+ command.id = Pid_Command_Data;
+ command.size = 2;
+ *(uint16_t*)command.payload = gar_endian(uint16_t, Cmnd_Start_Pvt_Data);
+ dev->usb->write(command);
+
+ while(dev->doRealtimeThread) {
+ pthread_mutex_unlock(&dev->dataMutex);
+
+ if(dev->usb->read(response)) {
+ if(response.id == Pid_Pvt_Data) {
+ D800_Pvt_Data_t * srcPvt = (D800_Pvt_Data_t*)response.payload;
+ pthread_mutex_lock(&dev->dataMutex);
+ dev->PositionVelocityTime << *srcPvt;
+ pthread_mutex_unlock(&dev->dataMutex);
+ }
+ }
+
+ pthread_mutex_lock(&dev->dataMutex);
+ }
+
+ command.type = GUSB_APPLICATION_LAYER;
+ command.id = Pid_Command_Data;
+ command.size = 2;
+ *(uint16_t*)command.payload = gar_endian(uint16_t, Cmnd_Stop_Pvt_Data);
+ dev->usb->write(command);
+
+ dev->_release();
+ pthread_mutex_unlock(&dev->dataMutex);
+ }
+ catch(exce_t& e) {
+ pthread_mutex_trylock(&dev->dataMutex);
+ dev->lasterror = "Realtime thread failed. " + e.msg;
+ dev->doRealtimeThread = false;
+ pthread_mutex_unlock(&dev->dataMutex);
+ }
+ cout << "stop thread" << endl;
+ return 0;
+ }
+
+}
+
+
+CDevice::CDevice()
+:
+devname("Forerunner305")
+,devid(0)
+,usb(0)
+,doRealtimeThread(false)
+,skip_if_no_signal(true)
+{
+ pthread_mutex_init(&dataMutex, NULL);
+}
+
+
+CDevice::~CDevice()
+{
+ //if(pScreen) delete [] pScreen;
+}
+
+
+const string& CDevice::getCopyright()
+{
+ copyright = "<h1>QLandkarte Device Driver for Garmin " + devname + "</h1>"
+ "<h2>Driver I/F Ver. " INTERFACE_VERSION "</h2>"
+ "<p>© 2007 by Oliver Eichler (oliver.eichler at gmx.de)</p>"
+ "<p>© Venture HC Screenshot support by Torsten Reuschel (me at fuesika.de)</p>"
+ "<p>This driver is distributed in the hope that it will be useful, "
+ "but WITHOUT ANY WARRANTY; without even the implied warranty of "
+ "MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the "
+ "GNU General Public License for more details. </p>";
+ return copyright;
+}
+
+
+void CDevice::_acquire()
+{
+ usb = new CUSB();
+ usb->open();
+ usb->syncup();
+
+ //std::cout<< usb->getProductString()<<std::endl;
+
+ if(strncmp(usb->getProductString().c_str(), devname.c_str(), devname.size()) != 0) {
+
+ string msg = "No " + devname + " unit detected. Please retry to select other device driver.";
+ //std::cerr<<msg<<std::endl;
+ throw exce_t(errSync,msg);
+ }
+}
+
+
+void CDevice::_downloadWaypoints(list<Garmin::Wpt_t>& waypoints)
+{
+ waypoints.clear();
+ if(usb == 0) return;
+
+ Packet_t command;
+ Packet_t response;
+
+ // ???
+ command.type = GUSB_APPLICATION_LAYER;
+ command.id = 0x1C;
+ command.size = 2;
+ *(uint16_t*)command.payload = 0x0000;
+ usb->write(command);
+
+ // request waypoints
+ command.type = GUSB_APPLICATION_LAYER;
+ command.id = Pid_Command_Data;
+ command.size = 2;
+ *(uint16_t*)command.payload = gar_endian(uint16_t, Cmnd_Transfer_Wpt);
+ usb->write(command);
+
+ while(1) {
+ if(!usb->read(response)) continue;
+
+ if(response.id == Pid_Records) {
+#ifdef DBG_SHOW_WAYPOINT
+ cout << "number of waypoints:" << gar_ptr_load(uint16_t, response.payload) << endl;
+#endif
+ }
+
+ if(response.id == Pid_Wpt_Data) {
+ D110_Wpt_t * srcWpt = (D110_Wpt_t*)response.payload;
+ waypoints.push_back(Wpt_t());
+ Wpt_t& tarWpt = waypoints.back();
+
+ tarWpt << *srcWpt;
+ }
+
+ if(response.id == Pid_Xfer_Cmplt) {
+ break;
+ }
+
+ }
+
+ // request proximity waypoints
+ command.type = GUSB_APPLICATION_LAYER;
+ command.id = Pid_Command_Data;
+ command.size = 2;
+ *(uint16_t*)command.payload = gar_endian(uint16_t, Cmnd_Transfer_Prx);
+ usb->write(command);
+
+ while(1) {
+
+ if(!usb->read(response)) continue;
+
+ if(response.id == Pid_Records) {
+ //TODO read data
+#ifdef DBG_SHOW_WAYPOINT
+ cout << "number of proximity waypoints:" << gar_ptr_load(uint16_t, response.payload) << endl;
+#endif
+ }
+
+ if(response.id == Pid_Prx_Wpt_Data) {
+ D110_Wpt_t * srcWpt = (D110_Wpt_t*)response.payload;
+ waypoints.push_back(Wpt_t());
+ Wpt_t& tarWpt = waypoints.back();
+
+ tarWpt << *srcWpt;
+ }
+
+ if(response.id == Pid_Xfer_Cmplt) {
+ break;
+ }
+
+ }
+
+#ifdef DBG_SHOW_WAYPOINT
+ list<Wpt_t>::const_iterator wpt = waypoints.begin();
+ while(wpt != waypoints.end()) {
+ cout << "-------------------------" << endl;
+ cout << "class " << hex << (int)wpt->wpt_class << endl;
+ cout << "dspl_color " << hex << (int)wpt->dspl_color << endl;
+ cout << "dspl_attr " << hex << (int)wpt->dspl_attr << endl;
+ cout << "smbl " << dec <<(int)wpt->smbl << endl;
+ cout << "lat " << wpt->lat << endl;
+ cout << "lon " << wpt->lon << endl;
+ cout << "alt " << wpt->alt << endl;
+ cout << "dpth " << wpt->dpth << endl;
+ cout << "dist " << wpt->dist << endl;
+ cout << "state " << wpt->state << endl;
+ cout << "cc " << wpt->cc << endl;
+ cout << "ete " << wpt->ete << endl;
+ cout << "temp " << wpt->temp << endl;
+ cout << "time " << wpt->time << endl;
+ cout << "category " << wpt->wpt_cat << endl;
+ cout << "ident " << wpt->ident << endl;
+ cout << "comment " << wpt->comment << endl;
+ cout << "facility " << wpt->facility << endl;
+ cout << "city " << wpt->city << endl;
+ cout << "addr " << wpt->addr << endl;
+ cout << "crossroad " << wpt->crossroad << endl;
+
+ ++wpt;
+ }
+#endif
+
+}
+
+
+void CDevice::_uploadWaypoints(std::list<Garmin::Wpt_t>& waypoints)
+{
+ if(usb == 0) return;
+ // count number of proximity waypoints
+ uint16_t prx_wpt_cnt = 0;
+ list<Wpt_t>::const_iterator wpt = waypoints.begin();
+ while(wpt != waypoints.end()) {
+ if(wpt->dist != 1e25f) ++prx_wpt_cnt;
+ ++wpt;
+ }
+
+ Packet_t command;
+ Packet_t response;
+
+ // ???
+ command.type = GUSB_APPLICATION_LAYER;
+ command.id = 0x1C;
+ command.size = 2;
+ *(uint16_t*)command.payload = 0x0000;
+ usb->write(command);
+
+ // transmit proximity waypoints first
+ if(prx_wpt_cnt) {
+ //announce number of records
+ command.type = GUSB_APPLICATION_LAYER;
+ command.id = Pid_Records;
+ command.size = 2;
+ *(uint16_t*)command.payload = gar_endian(uint16_t, prx_wpt_cnt);
+ usb->write(command);
+
+ wpt = waypoints.begin();
+ while(wpt != waypoints.end()) {
+ if(wpt->dist != 1e25f) {
+ command.type = GUSB_APPLICATION_LAYER;
+ command.id = Pid_Prx_Wpt_Data;
+
+ D110_Wpt_t * p = (D110_Wpt_t *)command.payload;
+ command.size = *wpt >> *p;
+
+ usb->write(command);
+
+ }
+ ++wpt;
+ }
+
+ //announce number of records
+ command.type = GUSB_APPLICATION_LAYER;
+ command.id = Pid_Xfer_Cmplt;
+ command.size = 2;
+ *(uint16_t*)command.payload = gar_endian(uint16_t, Cmnd_Transfer_Prx);
+ usb->write(command);
+
+ }
+
+ //transmit _all_ waypoints
+ //announce number of records
+ command.type = GUSB_APPLICATION_LAYER;
+ command.id = Pid_Records;
+ command.size = 2;
+ *(uint16_t*)command.payload = gar_endian(uint16_t, waypoints.size());
+ usb->write(command);
+
+ wpt = waypoints.begin();
+ while(wpt != waypoints.end()) {
+
+ command.type = GUSB_APPLICATION_LAYER;
+ command.id = Pid_Wpt_Data;
+
+ D110_Wpt_t * p = (D110_Wpt_t *)command.payload;
+ command.size = *wpt >> *p;
+
+ usb->write(command);
+
+ ++wpt;
+ }
+
+ //announce number of records
+ command.type = GUSB_APPLICATION_LAYER;
+ command.id = Pid_Xfer_Cmplt;
+ command.size = 2;
+ *(uint16_t*)command.payload = gar_endian(uint16_t, Cmnd_Transfer_Wpt);
+ usb->write(command);
+
+}
+
+
+void CDevice::_downloadTracks(std::list<Garmin::Track_t>& tracks)
+{
+ tracks.clear();
+ if(usb == 0) return;
+
+ Packet_t command;
+ Packet_t response;
+
+ // ???
+ command.type = GUSB_APPLICATION_LAYER;
+ command.id = 0x1C;
+ command.size = 2;
+ *(uint16_t*)command.payload = 0x0000;
+ usb->write(command);
+
+ command.type = GUSB_APPLICATION_LAYER;
+ command.id = Pid_Command_Data;
+ command.size = 2;
+ *(uint16_t*)command.payload = gar_endian(uint16_t, Cmnd_Transfer_Trk);
+ usb->write(command);
+
+ int trackidx = 0;
+ string name;
+ Track_t * track = 0;
+ int cancel = 0;
+ int npts = 0;
+ int ntotal = 65535;
+ callback(0,0,&cancel,"Download tracks ...",0);
+
+ while(!cancel) {
+
+ if(!usb->read(response)) continue;
+
+ //read track header
+ if(response.id == Pid_Trk_Hdr) {
+ trackidx = 0;
+ D311_Trk_Hdr_t * hdr = (D311_Trk_Hdr_t*)response.payload;
+ tracks.push_back(Track_t());
+ track = &tracks.back();
+
+ *track << *hdr;
+ name = hdr->ident;
+ }
+
+ if(response.id == Pid_Records) {
+ ntotal = gar_ptr_load(uint16_t, response.payload);
+ }
+
+ if(response.id == Pid_Trk_Data) {
+ D304_Trk_t * data = (D304_Trk_t*)response.payload;
+ TrkPt_t pt;
+
+ pt << *data;
+
+ if( data->lat==int32_t(2147483647) && data->lon==int32_t(2147483647)) {
+ if(!skip_if_no_signal)
+ track->track.push_back(pt);
+ }
+ else {
+ track->track.push_back(pt);
+ }
+
+ if (++npts % 100 == 0) {
+ double progress = (npts * 100.0) / ntotal;
+ callback(progress,0,&cancel,0,"Transferring track data.");
+ }
+ }
+
+ if(response.id == Pid_Xfer_Cmplt) {
+ break;
+ }
+ }
+ if (cancel) {
+ command.type = GUSB_APPLICATION_LAYER;
+ command.id = Pid_Command_Data;
+ command.size = 2;
+ *(uint16_t*)command.payload = gar_endian(uint16_t, Cmnd_Abort_Transfer);
+ usb->write(command);
+ }
+
+ callback(100,0,&cancel,0,"done");
+}
+
+
+void CDevice::_downloadRoutes(std::list<Garmin::Route_t>& routes)
+{
+ routes.clear();
+ if(usb == 0) return;
+
+ Packet_t command;
+ Packet_t response;
+
+ // ???
+ command.type = GUSB_APPLICATION_LAYER;
+ command.id = 0x1C;
+ command.size = 2;
+ *(uint16_t*)command.payload = 0x0000;
+ usb->write(command);
+
+ command.type = GUSB_APPLICATION_LAYER;
+ command.id = Pid_Command_Data;
+ command.size = 2;
+ *(uint16_t*)command.payload = gar_endian(uint16_t, Cmnd_Transfer_Rte);
+ usb->write(command);
+
+ int routeidx = 0;
+ string name;
+ Route_t * route = 0;
+ int cancel = 0;
+ int npts = 0;
+ int ntotal = 65535;
+ callback(0,0,&cancel,"Download routes ...",0);
+
+ while(!cancel) {
+
+ if(!usb->read(response)) continue;
+
+ if(response.id == Pid_Rte_Hdr) {
+ routeidx = 0;
+ D202_Rte_Hdr_t * hdr = (D202_Rte_Hdr_t*)response.payload;
+ routes.push_back(Route_t());
+ route = &routes.back();
+
+ *route << *hdr;
+ name = hdr->ident;
+ }
+
+ if(response.id == Pid_Records) {
+ ntotal = gar_ptr_load(uint16_t, response.payload);
+ }
+
+ if(response.id == Pid_Rte_Wpt_Data) {
+ D110_Wpt_t * p = (D110_Wpt_t*)response.payload;
+ route->route.push_back(RtePt_t());
+ RtePt_t& rtept = route->route.back();
+ rtept << *p;
+
+ if (++npts % 50 == 0) {
+ double progress = (npts * 100.0) / ntotal;
+ callback(progress,0,&cancel,0,"Transferring route data.");
+ }
+ }
+
+ if(response.id == Pid_Rte_Link_Data) {
+ D210_Rte_Link_t * l = (D210_Rte_Link_t*)response.payload;
+ RtePt_t& rtept = route->route.back();
+ rtept << *l;
+ }
+
+ if(response.id == Pid_Xfer_Cmplt) {
+ break;
+ }
+ }
+ if (cancel) {
+ command.type = GUSB_APPLICATION_LAYER;
+ command.id = Pid_Command_Data;
+ command.size = 2;
+ *(uint16_t*)command.payload = gar_endian(uint16_t, Cmnd_Abort_Transfer);
+ usb->write(command);
+ }
+
+ callback(100,0,&cancel,0,"done");
+}
+
+
+void CDevice::_uploadRoutes(list<Garmin::Route_t>& routes)
+{
+ if(usb == 0) return;
+
+ if(devid == 0x0231) return IDeviceDefault::_uploadRoutes(routes);
+
+ // count number of proximity waypoints
+
+ Packet_t command;
+ Packet_t response;
+
+ // ???
+ command.type = GUSB_APPLICATION_LAYER;
+ command.id = 0x1C;
+ command.size = 2;
+ *(uint16_t*)command.payload = 0x0000;
+ usb->write(command);
+
+ list<Garmin::Route_t>::const_iterator route = routes.begin();
+ while(route != routes.end()) {
+ //announce number of records
+ // D202_Rte_Hdr_t + (D110_Wpt_t + D210_Rte_Link_t) * number of route points
+ uint16_t nrec = 1 + route->route.size() * 2;
+ command.type = GUSB_APPLICATION_LAYER;
+ command.id = Pid_Records;
+ command.size = 2;
+ *(uint16_t*)command.payload = gar_endian(uint16_t, nrec);
+ usb->write(command);
+
+ // write route header
+ command.type = GUSB_APPLICATION_LAYER;
+ command.id = Pid_Rte_Hdr;
+ D202_Rte_Hdr_t * r = (D202_Rte_Hdr_t *)command.payload;
+ command.size = *route >> *r;
+ usb->write(command);
+
+ vector<RtePt_t>::const_iterator rtept = route->route.begin();
+
+ command.type = GUSB_APPLICATION_LAYER;
+ command.id = Pid_Rte_Wpt_Data;
+ D110_Wpt_t * p = (D110_Wpt_t *)command.payload;
+ command.size = *rtept >> *p;
+ usb->write(command);
+
+ ++rtept;
+
+ while(rtept != route->route.end()) {
+
+ command.type = GUSB_APPLICATION_LAYER;
+ command.id = Pid_Rte_Link_Data;
+ D210_Rte_Link_t * l = (D210_Rte_Link_t *)command.payload;
+ command.size = *rtept >> *l;
+ usb->write(command);
+
+ command.type = GUSB_APPLICATION_LAYER;
+ command.id = Pid_Rte_Wpt_Data;
+ D110_Wpt_t * p = (D110_Wpt_t *)command.payload;
+ command.size = *rtept >> *p;
+ usb->write(command);
+
+ ++rtept;
+ }
+
+ // finish block
+ command.type = GUSB_APPLICATION_LAYER;
+ command.id = Pid_Xfer_Cmplt;
+ command.size = 2;
+ *(uint16_t*)command.payload = gar_endian(uint16_t, Cmnd_Transfer_Rte);
+ usb->write(command);
+ ++route;
+ }
+
+}
+
+
+void CDevice::_setRealTimeMode(bool on)
+{
+ CMutexLocker lock(dataMutex);
+ if(doRealtimeThread == on) return;
+ doRealtimeThread = on;
+ if(doRealtimeThread) {
+ pthread_create(&thread,NULL,rtThread, this);
+ }
+
+}
+
+
+void CDevice::_getRealTimePos(Garmin::Pvt_t& pvt)
+{
+ if(pthread_mutex_trylock(&mutex) != EBUSY) {
+ pthread_mutex_unlock(&mutex);
+ throw exce_t(errRuntime,lasterror);
+ }
+
+ CMutexLocker lock(dataMutex);
+ pvt = PositionVelocityTime;
+}
+
+
+void CDevice::_release()
+{
+ if(usb == 0) return;
+
+ usb->close2();
+ delete usb;
+ usb = 0;
+}
+
+
+void CDevice::_getDevProperties(Garmin::DevProperties_t& dev_properties)
+{
+ if(usb == 0) return;
+ Packet_t command;
+ Packet_t response;
+
+ // ask for SD Ram capacity
+ command.type = GUSB_APPLICATION_LAYER;
+ command.id = Pid_Command_Data;
+ command.size = 2;
+ *(uint16_t*)command.payload = gar_endian(uint16_t, Cmnd_Transfer_Mem);
+ usb->write(command);
+
+ // try to read SD Ram capacity
+ uint32_t memory = 0;
+ uint16_t tile_limit = 0;
+ while(usb->read(response)) {
+ if(response.id == Pid_Capacity_Data) {
+ tile_limit = gar_ptr_load(uint16_t, response.payload + 2);
+ memory = gar_ptr_load(uint32_t, response.payload + 4);
+ }
+ }
+ if(tile_limit == 0) {
+ throw exce_t(errRuntime,"Failed to send map: Unable to find the tile limit of the GPS");
+ }
+ if(memory == 0) {
+ throw exce_t(errRuntime,"Failed to send map: Unable to find the available memory of the GPS");
+ }
+
+ // add to the properties list
+ properties.memory_limit = memory;
+ properties.set.item.memory_limit = 1;
+ properties.maps_limit = tile_limit;
+ properties.set.item.maps_limit = 1;
+
+ // return the properties
+ dev_properties = properties;
+}
diff --git a/src/ForeRunner/CDevice.h b/src/ForeRunner/CDevice.h
new file mode 100644
index 0000000..70e5bb8
--- /dev/null
+++ b/src/ForeRunner/CDevice.h
@@ -0,0 +1,75 @@
+/**********************************************************************************************
+ Copyright (C) 2007 Oliver Eichler oliver.eichler at gmx.de
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111 USA
+
+ Garmin and MapSource are registered trademarks or trademarks of Garmin Ltd.
+ or one of its subsidiaries.
+
+**********************************************************************************************/
+#ifndef CDEVICE_H_FR305
+#define CDEVICE_H_FR305
+
+#include "IDeviceDefault.h"
+#include "CUSB.h"
+
+namespace FR305
+{
+
+ class CDevice : public Garmin::IDeviceDefault
+ {
+ public:
+ CDevice();
+ virtual ~CDevice();
+
+ std::string devname;
+ uint32_t devid;
+
+ const std::string& getCopyright();
+
+ private:
+ friend void * rtThread(void *ptr);
+
+ void _acquire();
+ void _downloadWaypoints(std::list<Garmin::Wpt_t>& waypoints);
+ void _uploadWaypoints(std::list<Garmin::Wpt_t>& waypoints);
+ void _downloadTracks(std::list<Garmin::Track_t>& tracks);
+ //void _uploadTracks(std::list<Garmin::Track_t>& tracks);
+ void _downloadRoutes(std::list<Garmin::Route_t>& routes);
+ void _uploadRoutes(std::list<Garmin::Route_t>& routes);
+
+ void _getDevProperties(Garmin::DevProperties_t& dev_properties);
+
+ void _setRealTimeMode(bool on);
+ void _getRealTimePos(Garmin::Pvt_t& pvt);
+ void _release();
+
+ Garmin::CUSB * usb;
+
+ /// realtime mode thread
+ pthread_t thread;
+ /// mutex to serialize any data access
+ pthread_mutex_t dataMutex;
+ /// keep alive flag for the realtime mode thread
+ bool doRealtimeThread;
+
+ Garmin::Pvt_t PositionVelocityTime;
+
+ // Skip Trackpoint if no GPS signal when downloading the tracks
+ bool skip_if_no_signal;
+ };
+
+}
+#endif //CDEVICE_H
diff --git a/src/ForeRunner/CMakeLists.txt b/src/ForeRunner/CMakeLists.txt
new file mode 100644
index 0000000..140e4a9
--- /dev/null
+++ b/src/ForeRunner/CMakeLists.txt
@@ -0,0 +1,29 @@
+
+set(CMAKE_VERBOSE_MAKEFILE ON)
+
+set(SRCS
+ loader.cpp
+ CDevice.cpp
+)
+
+set(HDRS
+ CDevice.h
+)
+
+include_directories(../ ${LIBUSB_INCLUDE_DIRS})
+add_library(Forerunner305 SHARED ${SRCS} ${HDRS})
+target_link_libraries(Forerunner305 garmin ${LIBUSB_LIBRARIES} pthread)
+
+set(ALIASES
+
+)
+
+foreach(var ${ALIASES})
+ message(" ${var}")
+ add_custom_command( TARGET Forerunner305
+ POST_BUILD
+ COMMAND ln ARGS -sf libForerunner305${SHARED_LIB_EXT} lib${var}${SHARED_LIB_EXT}
+ WORKING_DIRECTORY ${LIBRARY_OUTPUT_PATH}
+ )
+endforeach(var)
+
diff --git a/src/ForeRunner/Makefile b/src/ForeRunner/Makefile
new file mode 100644
index 0000000..2fd3cbb
--- /dev/null
+++ b/src/ForeRunner/Makefile
@@ -0,0 +1,261 @@
+# CMAKE generated file: DO NOT EDIT!
+# Generated by "Unix Makefiles" Generator, CMake Version 2.8
+
+# Default target executed when no arguments are given to make.
+default_target: all
+.PHONY : default_target
+
+#=============================================================================
+# Special targets provided by cmake.
+
+# Disable implicit rules so canoncical targets will work.
+.SUFFIXES:
+
+# Remove some rules from gmake that .SUFFIXES does not remove.
+SUFFIXES =
+
+.SUFFIXES: .hpux_make_needs_suffix_list
+
+# Produce verbose output by default.
+VERBOSE = 1
+
+# Suppress display of executed commands.
+$(VERBOSE).SILENT:
+
+# A target that is always out of date.
+cmake_force:
+.PHONY : cmake_force
+
+#=============================================================================
+# Set environment variables for the build.
+
+# The shell in which to execute make rules.
+SHELL = /bin/sh
+
+# The CMake executable.
+CMAKE_COMMAND = /usr/bin/cmake
+
+# The command to remove a file.
+RM = /usr/bin/cmake -E remove -f
+
+# The program to use to edit the cache.
+CMAKE_EDIT_COMMAND = /usr/bin/ccmake
+
+# The top-level source directory on which CMake was run.
+CMAKE_SOURCE_DIR = /home/all/PP/usb/GarminDev
+
+# The top-level build directory on which CMake was run.
+CMAKE_BINARY_DIR = /home/all/PP/usb/GarminDev
+
+#=============================================================================
+# Targets provided globally by CMake.
+
+# Special rule for the target edit_cache
+edit_cache:
+ @$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --cyan "Running CMake cache editor..."
+ /usr/bin/ccmake -H$(CMAKE_SOURCE_DIR) -B$(CMAKE_BINARY_DIR)
+.PHONY : edit_cache
+
+# Special rule for the target edit_cache
+edit_cache/fast: edit_cache
+.PHONY : edit_cache/fast
+
+# Special rule for the target install
+install: preinstall
+ @$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --cyan "Install the project..."
+ /usr/bin/cmake -P cmake_install.cmake
+.PHONY : install
+
+# Special rule for the target install
+install/fast: preinstall/fast
+ @$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --cyan "Install the project..."
+ /usr/bin/cmake -P cmake_install.cmake
+.PHONY : install/fast
+
+# Special rule for the target install/local
+install/local: preinstall
+ @$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --cyan "Installing only the local directory..."
+ /usr/bin/cmake -DCMAKE_INSTALL_LOCAL_ONLY=1 -P cmake_install.cmake
+.PHONY : install/local
+
+# Special rule for the target install/local
+install/local/fast: install/local
+.PHONY : install/local/fast
+
+# Special rule for the target install/strip
+install/strip: preinstall
+ @$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --cyan "Installing the project stripped..."
+ /usr/bin/cmake -DCMAKE_INSTALL_DO_STRIP=1 -P cmake_install.cmake
+.PHONY : install/strip
+
+# Special rule for the target install/strip
+install/strip/fast: install/strip
+.PHONY : install/strip/fast
+
+# Special rule for the target list_install_components
+list_install_components:
+ @$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --cyan "Available install components are: \"Unspecified\""
+.PHONY : list_install_components
+
+# Special rule for the target list_install_components
+list_install_components/fast: list_install_components
+.PHONY : list_install_components/fast
+
+# Special rule for the target package
+package: preinstall
+ @$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --cyan "Run CPack packaging tool..."
+ cd /home/all/PP/usb/GarminDev && /usr/bin/cpack --config ./CPackConfig.cmake
+.PHONY : package
+
+# Special rule for the target package
+package/fast: package
+.PHONY : package/fast
+
+# Special rule for the target package_source
+package_source:
+ @$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --cyan "Run CPack packaging tool for source..."
+ cd /home/all/PP/usb/GarminDev && /usr/bin/cpack --config ./CPackSourceConfig.cmake /home/all/PP/usb/GarminDev/CPackSourceConfig.cmake
+.PHONY : package_source
+
+# Special rule for the target package_source
+package_source/fast: package_source
+.PHONY : package_source/fast
+
+# Special rule for the target rebuild_cache
+rebuild_cache:
+ @$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --cyan "Running CMake to regenerate build system..."
+ /usr/bin/cmake -H$(CMAKE_SOURCE_DIR) -B$(CMAKE_BINARY_DIR)
+.PHONY : rebuild_cache
+
+# Special rule for the target rebuild_cache
+rebuild_cache/fast: rebuild_cache
+.PHONY : rebuild_cache/fast
+
+# The main all target
+all: cmake_check_build_system
+ cd /home/all/PP/usb/GarminDev && $(CMAKE_COMMAND) -E cmake_progress_start /home/all/PP/usb/GarminDev/CMakeFiles /home/all/PP/usb/GarminDev/src/FR305/CMakeFiles/progress.marks
+ cd /home/all/PP/usb/GarminDev && $(MAKE) -f CMakeFiles/Makefile2 src/FR305/all
+ $(CMAKE_COMMAND) -E cmake_progress_start /home/all/PP/usb/GarminDev/CMakeFiles 0
+.PHONY : all
+
+# The main clean target
+clean:
+ cd /home/all/PP/usb/GarminDev && $(MAKE) -f CMakeFiles/Makefile2 src/FR305/clean
+.PHONY : clean
+
+# The main clean target
+clean/fast: clean
+.PHONY : clean/fast
+
+# Prepare targets for installation.
+preinstall: all
+ cd /home/all/PP/usb/GarminDev && $(MAKE) -f CMakeFiles/Makefile2 src/FR305/preinstall
+.PHONY : preinstall
+
+# Prepare targets for installation.
+preinstall/fast:
+ cd /home/all/PP/usb/GarminDev && $(MAKE) -f CMakeFiles/Makefile2 src/FR305/preinstall
+.PHONY : preinstall/fast
+
+# clear depends
+depend:
+ cd /home/all/PP/usb/GarminDev && $(CMAKE_COMMAND) -H$(CMAKE_SOURCE_DIR) -B$(CMAKE_BINARY_DIR) --check-build-system CMakeFiles/Makefile.cmake 1
+.PHONY : depend
+
+# Convenience name for target.
+src/FR305/CMakeFiles/FR305.dir/rule:
+ cd /home/all/PP/usb/GarminDev && $(MAKE) -f CMakeFiles/Makefile2 src/FR305/CMakeFiles/FR305.dir/rule
+.PHONY : src/FR305/CMakeFiles/FR305.dir/rule
+
+# Convenience name for target.
+FR305: src/FR305/CMakeFiles/FR305.dir/rule
+.PHONY : FR305
+
+# fast build rule for target.
+FR305/fast:
+ cd /home/all/PP/usb/GarminDev && $(MAKE) -f src/FR305/CMakeFiles/FR305.dir/build.make src/FR305/CMakeFiles/FR305.dir/build
+.PHONY : FR305/fast
+
+CDevice.o: CDevice.cpp.o
+.PHONY : CDevice.o
+
+# target to build an object file
+CDevice.cpp.o:
+ cd /home/all/PP/usb/GarminDev && $(MAKE) -f src/FR305/CMakeFiles/FR305.dir/build.make src/FR305/CMakeFiles/FR305.dir/CDevice.cpp.o
+.PHONY : CDevice.cpp.o
+
+CDevice.i: CDevice.cpp.i
+.PHONY : CDevice.i
+
+# target to preprocess a source file
+CDevice.cpp.i:
+ cd /home/all/PP/usb/GarminDev && $(MAKE) -f src/FR305/CMakeFiles/FR305.dir/build.make src/FR305/CMakeFiles/FR305.dir/CDevice.cpp.i
+.PHONY : CDevice.cpp.i
+
+CDevice.s: CDevice.cpp.s
+.PHONY : CDevice.s
+
+# target to generate assembly for a file
+CDevice.cpp.s:
+ cd /home/all/PP/usb/GarminDev && $(MAKE) -f src/FR305/CMakeFiles/FR305.dir/build.make src/FR305/CMakeFiles/FR305.dir/CDevice.cpp.s
+.PHONY : CDevice.cpp.s
+
+loader.o: loader.cpp.o
+.PHONY : loader.o
+
+# target to build an object file
+loader.cpp.o:
+ cd /home/all/PP/usb/GarminDev && $(MAKE) -f src/FR305/CMakeFiles/FR305.dir/build.make src/FR305/CMakeFiles/FR305.dir/loader.cpp.o
+.PHONY : loader.cpp.o
+
+loader.i: loader.cpp.i
+.PHONY : loader.i
+
+# target to preprocess a source file
+loader.cpp.i:
+ cd /home/all/PP/usb/GarminDev && $(MAKE) -f src/FR305/CMakeFiles/FR305.dir/build.make src/FR305/CMakeFiles/FR305.dir/loader.cpp.i
+.PHONY : loader.cpp.i
+
+loader.s: loader.cpp.s
+.PHONY : loader.s
+
+# target to generate assembly for a file
+loader.cpp.s:
+ cd /home/all/PP/usb/GarminDev && $(MAKE) -f src/FR305/CMakeFiles/FR305.dir/build.make src/FR305/CMakeFiles/FR305.dir/loader.cpp.s
+.PHONY : loader.cpp.s
+
+# Help Target
+help:
+ @echo "The following are some of the valid targets for this Makefile:"
+ @echo "... all (the default if no target is provided)"
+ @echo "... clean"
+ @echo "... depend"
+ @echo "... FR305"
+ @echo "... edit_cache"
+ @echo "... install"
+ @echo "... install/local"
+ @echo "... install/strip"
+ @echo "... list_install_components"
+ @echo "... package"
+ @echo "... package_source"
+ @echo "... rebuild_cache"
+ @echo "... CDevice.o"
+ @echo "... CDevice.i"
+ @echo "... CDevice.s"
+ @echo "... loader.o"
+ @echo "... loader.i"
+ @echo "... loader.s"
+.PHONY : help
+
+
+
+#=============================================================================
+# Special targets to cleanup operation of make.
+
+# Special rule to run CMake to check the build system integrity.
+# No rule that depends on this can have commands that come from listfiles
+# because they might be regenerated.
+cmake_check_build_system:
+ cd /home/all/PP/usb/GarminDev && $(CMAKE_COMMAND) -H$(CMAKE_SOURCE_DIR) -B$(CMAKE_BINARY_DIR) --check-build-system CMakeFiles/Makefile.cmake 0
+.PHONY : cmake_check_build_system
+
diff --git a/src/ForeRunner/cmake_install.cmake b/src/ForeRunner/cmake_install.cmake
new file mode 100644
index 0000000..b13a7b0
--- /dev/null
+++ b/src/ForeRunner/cmake_install.cmake
@@ -0,0 +1,34 @@
+# Install script for directory: /home/all/PP/usb/GarminDev/src/FR305
+
+# Set the install prefix
+IF(NOT DEFINED CMAKE_INSTALL_PREFIX)
+ SET(CMAKE_INSTALL_PREFIX "/usr/local")
+ENDIF(NOT DEFINED CMAKE_INSTALL_PREFIX)
+STRING(REGEX REPLACE "/$" "" CMAKE_INSTALL_PREFIX "${CMAKE_INSTALL_PREFIX}")
+
+# Set the install configuration name.
+IF(NOT DEFINED CMAKE_INSTALL_CONFIG_NAME)
+ IF(BUILD_TYPE)
+ STRING(REGEX REPLACE "^[^A-Za-z0-9_]+" ""
+ CMAKE_INSTALL_CONFIG_NAME "${BUILD_TYPE}")
+ ELSE(BUILD_TYPE)
+ SET(CMAKE_INSTALL_CONFIG_NAME "RelWithDebInfo")
+ ENDIF(BUILD_TYPE)
+ MESSAGE(STATUS "Install configuration: \"${CMAKE_INSTALL_CONFIG_NAME}\"")
+ENDIF(NOT DEFINED CMAKE_INSTALL_CONFIG_NAME)
+
+# Set the component getting installed.
+IF(NOT CMAKE_INSTALL_COMPONENT)
+ IF(COMPONENT)
+ MESSAGE(STATUS "Install component: \"${COMPONENT}\"")
+ SET(CMAKE_INSTALL_COMPONENT "${COMPONENT}")
+ ELSE(COMPONENT)
+ SET(CMAKE_INSTALL_COMPONENT)
+ ENDIF(COMPONENT)
+ENDIF(NOT CMAKE_INSTALL_COMPONENT)
+
+# Install shared libraries without execute permission?
+IF(NOT DEFINED CMAKE_INSTALL_SO_NO_EXE)
+ SET(CMAKE_INSTALL_SO_NO_EXE "1")
+ENDIF(NOT DEFINED CMAKE_INSTALL_SO_NO_EXE)
+
diff --git a/src/ForeRunner/loader.cpp b/src/ForeRunner/loader.cpp
new file mode 100644
index 0000000..256efec
--- /dev/null
+++ b/src/ForeRunner/loader.cpp
@@ -0,0 +1,49 @@
+/**********************************************************************************************
+ Copyright (C) 2007 Oliver Eichler oliver.eichler at gmx.de
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111 USA
+
+ Garmin and MapSource are registered trademarks or trademarks of Garmin Ltd.
+ or one of its subsidiaries.
+
+**********************************************************************************************/
+#include "config.h"
+#include "CDevice.h"
+
+namespace FR305
+{
+ static CDevice * device = 0;
+}
+
+
+#ifdef WIN32
+#define WIN_EXPORT __declspec(dllexport)
+#else
+#define WIN_EXPORT
+#endif
+
+extern "C" WIN_EXPORT Garmin::IDevice * initForerunner305(const char * version)
+{
+ if(strncmp(version,INTERFACE_VERSION,5) != 0) {
+ return 0;
+ }
+ if(FR305::device == 0) {
+ FR305::device = new FR305::CDevice();
+ }
+ FR305::device->devname = "Forerunner305";
+ // FR305::device->screenwidth = 160;
+ // FR305::device->screenheight = 240;
+ return FR305::device;
+}
diff --git a/src/GPSMap60CSx/CDevice.cpp b/src/GPSMap60CSx/CDevice.cpp
index f219ad6..7dee617 100644
--- a/src/GPSMap60CSx/CDevice.cpp
+++ b/src/GPSMap60CSx/CDevice.cpp
@@ -828,11 +828,11 @@ void CDevice::_uploadTracks(std::list<Garmin::Track_t>& tracks)
command.id = Pid_Trk_Data;
D302_Trk_t * p = (D302_Trk_t *)command.payload;
command.size = *trkpt >> *p;
-// cout << "lat " << trkpt->lat << endl;
-// cout << "lon " << trkpt->lon << endl;
-// cout << "time " << trkpt->time << endl;
-// cout << "alt " << trkpt->alt << endl;
-// cout << "size " << command.size << endl;
+ // cout << "lat " << trkpt->lat << endl;
+ // cout << "lon " << trkpt->lon << endl;
+ // cout << "time " << trkpt->time << endl;
+ // cout << "alt " << trkpt->alt << endl;
+ // cout << "size " << command.size << endl;
usb->write(command);
@@ -1021,7 +1021,7 @@ void CDevice::_uploadCustomIcons(list<Garmin::Icon_t>& icons)
{
cout << "running uploadCustomIcons for device " << hex << devid << endl;
- if(usb == 0) return;
+ if(usb == 0) return;
if(devid == 0x0231) return IDeviceDefault::_uploadCustomIcons(icons);
@@ -1188,35 +1188,38 @@ void CDevice::_screenshot(char *& clrtbl, char *& data, int& width, int& height)
cout << "device " << devname << " hor " << screenhflip << " vert " << screenvflip << endl;
if(screenhflip) {
- // screen shot is horizontally flipped
- if(screenvflip) {
- // screen shot is also vertically flipped
+ // screen shot is horizontally flipped
+ if(screenvflip) {
+ // screen shot is also vertically flipped
for(int r = 0; r < screenheight; ++r) {
for(int c = 0; c < screenwidth; ++c) {
pScreen[r * screenwidth + c] = buffer[(screenheight - r) * screenwidth - c - 1];
}
}
- } else {
- // vertical organisation of the screen shot is fine
+ }
+ else {
+ // vertical organisation of the screen shot is fine
for(int r = 0; r < screenheight; ++r) {
for(int c = 0; c < screenwidth; ++c) {
pScreen[r * screenwidth + c] = buffer[(r + 1) * screenwidth - c - 1];
}
}
- }
- } else {
- // horizontal organisation of the screen shot is fine
- if(screenvflip) {
- // screen shot is vertically flipped
- for(int r = 0; r < screenheight; ++r) {
- memcpy(pScreen + r * screenwidth,
- buffer + (screenheight - 1 - r) * screenwidth,
- screenwidth);
- }
- } else {
- // vertical organisation of the screen shot is fine
- memcpy(pScreen, buffer, screenheight * screenwidth);
- }
+ }
+ }
+ else {
+ // horizontal organisation of the screen shot is fine
+ if(screenvflip) {
+ // screen shot is vertically flipped
+ for(int r = 0; r < screenheight; ++r) {
+ memcpy(pScreen + r * screenwidth,
+ buffer + (screenheight - 1 - r) * screenwidth,
+ screenwidth);
+ }
+ }
+ else {
+ // vertical organisation of the screen shot is fine
+ memcpy(pScreen, buffer, screenheight * screenwidth);
+ }
}
clrtbl = aClrtbl;
diff --git a/src/GPSMap60CSx/loader.cpp b/src/GPSMap60CSx/loader.cpp
index 2208736..88b6411 100644
--- a/src/GPSMap60CSx/loader.cpp
+++ b/src/GPSMap60CSx/loader.cpp
@@ -93,6 +93,8 @@ extern "C" WIN_EXPORT Garmin::IDevice * initGPSMap60CSx(const char * version)
GPSMap60CSx::device->devname = "GPSMap60CSX";
GPSMap60CSx::device->screenwidth = 160;
GPSMap60CSx::device->screenheight = 240;
+ GPSMap60CSx::device->screenhflip = false;
+ GPSMap60CSx::device->screenvflip = true;
return GPSMap60CSx::device;
}
@@ -235,6 +237,7 @@ extern "C" WIN_EXPORT Garmin::IDevice * initEtrexSummitHC(const char * version)
return GPSMap60CSx::device;
}
+
extern "C" WIN_EXPORT Garmin::IDevice * initEtrexLegendCx(const char * version)
{
if(strncmp(version,INTERFACE_VERSION,5) != 0) {
diff --git a/src/Garmin.cpp b/src/Garmin.cpp
index 59090d7..3a4e8e4 100644
--- a/src/Garmin.cpp
+++ b/src/Garmin.cpp
@@ -27,6 +27,8 @@
#include "Garmin.h"
#include "IDevice.h"
+#include <iostream>
+#include <sstream>
#define INT32_TO_DEG(x) ((double)((int32_t)(x)) * 360.0 / 4294967296.0)
#define DEG_TO_INT32(x) ((int32_t)((x) * 4294967296.0/360.0 + 0.5))
@@ -310,6 +312,14 @@ namespace Garmin
tar.ident = src.ident;
}
+ void operator<<(Track_t& tar, const D311_Trk_Hdr_t& src) {
+ std::stringstream strs;
+ strs << int(src.ident);
+ tar.ident = strs.str();
+ tar.ident= std::string(4-tar.ident.size(),'0')+tar.ident;
+ //std::cout<<"track: "<< tar.ident<<" -- "<< tar.ident<<std::endl;
+ }
+
void operator<<(Track_t& tar, const D312_Trk_Hdr_t& src) {
tar.dspl = src.dspl;
tar.color = src.color;
@@ -345,14 +355,34 @@ namespace Garmin
}
int operator>>(const TrkPt_t& src, D302_Trk_t& tar) {
- tar.lat = gar_endian(int32_t, DEG_TO_INT32(src.lat));
+ tar.lat = gar_endian(int32_t, DEG_TO_INT32(src.lat));
tar.lon = gar_endian(int32_t, DEG_TO_INT32(src.lon));
tar.time = gar_endian(uint32_t, src.time);
tar.alt = gar_endian(float, src.alt);
-// tar.dpth = gar_endian(float, src.dpth);
+ // tar.dpth = gar_endian(float, src.dpth);
return (char*)&tar.alt - (char*)&tar.lat + 1;
}
+ void operator<<(TrkPt_t& tar, const D304_Trk_t& src) {
+
+ tar.lat = INT32_TO_DEG(gar_endian(int32_t, src.lat));
+ tar.lon = INT32_TO_DEG(gar_endian(int32_t, src.lon));
+ tar.time = gar_endian(uint32_t, src.time);
+ tar.alt = gar_endian(float, src.alt);
+
+ tar.distance = gar_endian(float, src.distance);
+ tar.heart_rate = src.heart_rate;
+ tar.cadence = src.cadence;
+
+ //std::cout<< "----------src.lat:"<<src.lat<< " src.lon:"<< src.lon<<std::endl;
+ // std::cout<< "lat:"<<tar.lat<< " lon:"<< tar.lon<< " time:"<<tar.time
+ // << " alt:"<<tar.alt;
+ // #ifdef FR304XDATA
+ // std::cout<<" distance:"<<tar.distance<<" heartrate:"<<int(tar.heart_rate)<<std::endl;
+ // #endif
+ // std::cout<<std::endl;
+ }
+
void operator<<(Pvt_t& tar, const D800_Pvt_Data_t& src) {
// note: some fields are mis-aligned, so we have to use gar_load_* there ...
tar.alt = gar_endian(float, src.alt);
diff --git a/src/Garmin.h b/src/Garmin.h
index d57cc76..1a8d8a7 100644
--- a/src/Garmin.h
+++ b/src/Garmin.h
@@ -1,6 +1,6 @@
+
/**********************************************************************************************
Copyright (C) 2007 Oliver Eichler oliver.eichler at gmx.de
-
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
@@ -147,6 +147,18 @@ namespace Garmin
uint8_t new_trk;
};
+ struct D304_Trk_t
+ {
+ int32_t lat;
+ int32_t lon;
+ uint32_t time;
+ float alt; // 32
+ float distance;
+ uint8_t heart_rate;
+ uint8_t cadence;
+ uint8_t sensor;
+ };
+
// same as D312, but without color=16=transparent
struct D310_Trk_Hdr_t
{
@@ -155,6 +167,11 @@ namespace Garmin
char ident[1];
};
+ struct D311_Trk_Hdr_t
+ {
+ uint16_t ident;
+ };
+
struct D312_Trk_Hdr_t
{
uint8_t dspl;
@@ -287,11 +304,13 @@ namespace Garmin
struct TrkPt_t;
extern void operator<<(Track_t& tar, const D310_Trk_Hdr_t& src);
+ extern void operator<<(Track_t& tar, const D311_Trk_Hdr_t& src);
extern void operator<<(Track_t& tar, const D312_Trk_Hdr_t& src);
extern int operator>>(const Track_t& src, D312_Trk_Hdr_t& tar);
extern void operator<<(TrkPt_t& tar, const D301_Trk_t& src);
extern void operator<<(TrkPt_t& tar, const D302_Trk_t& src);
+ extern void operator<<(TrkPt_t& tar, const D304_Trk_t& src);
extern int operator>>(const TrkPt_t& src, D302_Trk_t& tar);
struct Pvt_t;
diff --git a/src/IDevice.h b/src/IDevice.h
index 77c2024..36bf2a8 100644
--- a/src/IDevice.h
+++ b/src/IDevice.h
@@ -55,7 +55,7 @@ typedef unsigned __int64 uint64_t;
#define _MKSTR(x) _MKSTR_1(x)
#endif
-#define INTERFACE_VERSION "01.17"
+#define INTERFACE_VERSION "01.18"
namespace Garmin
{
@@ -84,7 +84,8 @@ namespace Garmin
, ete(0xFFFFFFFF)
, temp(1.0e25f)
, time(0xFFFFFFFF)
- , wpt_cat(0) {
+ , wpt_cat(0)
+ {
strncpy(state," ", 3);
strncpy(cc," ",3);
@@ -204,7 +205,12 @@ namespace Garmin
, lon(0.0)
, time(0)
, alt(1e25f)
- , dpth(1e25f) {
+ , dpth(1e25f)
+ , distance(1e25f)
+ , heart_rate(0xFF)
+ , cadence(0xFF)
+ , sensor(0xFF)
+ {
}
/// the latitude as degrees
@@ -217,6 +223,12 @@ namespace Garmin
float alt;
/// same as Garmin spec.
float dpth;
+
+ float distance;
+ uint8_t heart_rate;
+ uint8_t cadence;
+ uint8_t sensor;
+
};
/// common track structure application side
diff --git a/src/IDeviceDefault.cpp b/src/IDeviceDefault.cpp
index a14e139..31fad2b 100644
--- a/src/IDeviceDefault.cpp
+++ b/src/IDeviceDefault.cpp
@@ -162,6 +162,7 @@ void IDeviceDefault::downloadTracks(std::list<Garmin::Track_t>& tracks)
}
+
void IDeviceDefault::uploadTracks(std::list<Garmin::Track_t>& tracks)
{
lasterror = "";
@@ -354,16 +355,19 @@ void IDeviceDefault::_downloadTracks(std::list<Garmin::Track_t>& )
throw exce_t(errNotImpl,"downloadTracks(): this method is not implemented for your device.");
}
+
void IDeviceDefault::_uploadTracks(std::list<Garmin::Track_t>& )
{
throw exce_t(errNotImpl,"uploadTracks(): this method is not implemented for your device.");
}
+
void IDeviceDefault::_downloadRoutes(std::list<Garmin::Route_t>& )
{
throw exce_t(errNotImpl,"downloadRoutes(): this method is not implemented for your device.");
}
+
void IDeviceDefault::_uploadRoutes(std::list<Garmin::Route_t>& )
{
throw exce_t(errNotImpl,"uploadRoutes(): this method is not implemented for your device.");
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-grass/garmindev.git
More information about the Pkg-grass-devel
mailing list