GPS4Palm

Source Code Documentation


DataExchange.c File Reference

#include <BuildDefines.h>
#include <PalmOS.h>
#include <SerialMgrOld.h>
#include "ResourceDefines.h"
#include "gpslib.h"
#include "Data.h"
#include "DataExchange.h"
#include "WaypointForm.h"
#include "RouteForm.h"
#include "TrackForm.h"
#include "Utils.h"
#include "Serial.h"
#include "common.h"

Include dependency graph for DataExchange.c:

Go to the source code of this file.

Defines

#define DO_NOT_ALLOW_ACCESS_TO_INTERNALS_OF_STRUCTS

Functions

GarminObjectget_next_wpt (UInt16 current, LocalFormatID format, unsigned char *size)
 Callback function to retrieve waypoint from database for transmission to host.
GarminObjectget_next_rte (UInt16 current, LocalFormatID format, unsigned char *size, Boolean *h, Boolean *eor)
 Callback function to retrieve route from database for transmission to host.
GarminObjectget_next_trk (UInt16 current, LocalFormatID format, byte *size, Boolean *eot)
 Callback function to to retrieve track from database for transmission to host.
Err store_wpt (GarminObject *wpt, UInt16 total, UInt16 current, LocalFormatID format, byte size)
 Callback function to store waypoint to database upon reception from host.
Err store_rte (GarminObject *obj, UInt16 total, UInt16 current, LocalFormatID format, byte size)
 Callback function to store route to database upon reception from host.
Err store_trk (GarminObject *trk, UInt16 total, UInt16 current, LocalFormatID format, byte size)
 Callback function called when a track is received.
UInt16 NumRtePackets (void)
 Get number of data packets for route transfer using Garmin protocol.
UInt16 NumTrkPackets (void)
 Get number of data packets for track transfer using Garmin protocol.

Variables

PrefsType gPrefs
 Preferences data structure.


Define Documentation

#define DO_NOT_ALLOW_ACCESS_TO_INTERNALS_OF_STRUCTS
 

Definition at line 60 of file DataExchange.c.


Function Documentation

GarminObject* get_next_rte UInt16  current,
LocalFormatID  format,
unsigned char *  size,
Boolean *  h,
Boolean *  eor
 

Callback function to retrieve route from database for transmission to host.

Parameters:
current current item number (header or waypoint, first=0)
format Garmin Object format ID (only G104Type and G201Type supported)
size size of structure returned by get_next_rte
h True if current packet is a Route Header, else false
eor True if current Route Waypoint is the end of the current route, else false
Note:
The function's prototype is defined by gpslib (GetNextRteCallbackProc).
Returns:
Pointer to Waypoint/Route Object structure, NULL if transfer done or wrong protocol ID.

Definition at line 208 of file DataExchange.c.

References Raw_D104_Wpt_Type::cmnt, GarminObject::d104, Raw_D104_Wpt_Type::dst, G104Type, gWaypointDB, Raw_D104_Wpt_Type::ident, D104_Wpt_Type::ident, Semicircle_Type::lat, Raw_D104_Wpt_Type::lat, Semicircle_Type::lon, Raw_D104_Wpt_Type::lon, D104_Wpt_Type::posn, UnpackWaypoint(), and route_t::wpt_rec_id.

Referenced by RouteFormHandleEvent(), TrackFormHandleEvent(), and WaypointFormHandleEvent().

GarminObject* get_next_trk UInt16  current,
LocalFormatID  format,
byte size,
Boolean *  eot
 

Callback function to to retrieve track from database for transmission to host.

Parameters:
current index of current element (first=0)
format format of element requested
size pointer to store size of element returned
eot true if the current item is the last element of current track
Returns:
pointer on element returned (Garmin format)

Definition at line 391 of file DataExchange.c.

References D310_Trk_Hdr_Type::color, GarminObject::d300, GarminObject::d310, D310_Trk_Hdr_Type::dspl, G300Type, G310Type, gTrackHdrDB, Semicircle_Type::lat, Raw_D300_Trk_Point_Type::lat, Semicircle_Type::lon, Raw_D300_Trk_Point_Type::lon, D300_Trk_Point_Type::posn, TrackDBName(), and D310_Trk_Hdr_Type::trk_ident.

Referenced by RouteFormHandleEvent(), TrackFormHandleEvent(), and WaypointFormHandleEvent().

GarminObject* get_next_wpt UInt16  current,
LocalFormatID  format,
unsigned char *  size
 

Callback function to retrieve waypoint from database for transmission to host.

Parameters:
current current waypoint count (zero-based)
format Garmin Object format ID (only G104Type supported)
size size of structure returned by get_next_wpt
Note:
The function's prototype is defined by gpslib (GetNextWptCallbackProc).
Returns:
Pointer to Waypoint Object structure, NULL if waypoint transfer done or wrong protocol ID.

Definition at line 103 of file DataExchange.c.

References Raw_D104_Wpt_Type::cmnt, GarminObject::d104, Raw_D104_Wpt_Type::dst, G104Type, gWaypointDB, Raw_D104_Wpt_Type::ident, D104_Wpt_Type::ident, Semicircle_Type::lat, Raw_D104_Wpt_Type::lat, Semicircle_Type::lon, Raw_D104_Wpt_Type::lon, D104_Wpt_Type::posn, and UnpackWaypoint().

Referenced by RouteFormHandleEvent(), TrackFormHandleEvent(), and WaypointFormHandleEvent().

UInt16 NumRtePackets void   ) 
 

Get number of data packets for route transfer using Garmin protocol.

Returns:
Number of data packets (Route Headers + Route Waypoints)

Definition at line 1022 of file DataExchange.c.

References gRouteDB, and route_t::items.

Referenced by RouteFormHandleEvent(), TrackFormHandleEvent(), and WaypointFormHandleEvent().

UInt16 NumTrkPackets void   ) 
 

Get number of data packets for track transfer using Garmin protocol.

Returns:
Number of data packets (Track Headers + Track Waypoints)

Definition at line 1071 of file DataExchange.c.

References gTrackHdrDB, and TrackDBName().

Referenced by RouteFormHandleEvent(), TrackFormHandleEvent(), and WaypointFormHandleEvent().

Err store_rte GarminObject obj,
UInt16  total,
UInt16  current,
LocalFormatID  format,
byte  size
 

Callback function to store route to database upon reception from host.

Parameters:
obj ptr to GarminObject
total total count of items sent as indicated by gps
current current item number (first=1)
format Garmin Object format ID (only G104Type and G201Type supported)
size size of structure pointed to by rte
Note:
The function's prototype is defined by gpslib (StoreRteCallbackProc).
Returns:
0 - success, 1 - failure

Definition at line 685 of file DataExchange.c.

References D104_Wpt_Type::cmnt, Raw_D104_Wpt_Type::cmnt, CompareWayptIdent(), GarminObject::d104, Die(), D104_Wpt_Type::dspl, Raw_D104_Wpt_Type::dspl, D104_Wpt_Type::dst, packed_waypoint_t::dst, G104Type, gWaypointDB, h, D104_Wpt_Type::ident, Raw_D104_Wpt_Type::ident, packed_waypoint_t::ident, Semicircle_Type::lat, Raw_D104_Wpt_Type::lat, Semicircle_Type::lon, Raw_D104_Wpt_Type::lon, PackRouteWpt(), PackWaypoint(), D104_Wpt_Type::posn, routeDrawTable(), RouteForm, D104_Wpt_Type::smbl, Raw_D104_Wpt_Type::smbl, WaypointForm, and wayptDrawTable().

Referenced by RouteFormHandleEvent(), TrackFormHandleEvent(), and WaypointFormHandleEvent().

Err store_trk GarminObject trk,
UInt16  total,
UInt16  current,
LocalFormatID  format,
byte  size
 

Callback function called when a track is received.

Parameters:
trk pointer on a raw track point or track header received from gps
total total count of items sent as indicated by gps
current current item number (first=1)
format format of the object received
size size of object
Returns:
error code (0 if no error)

Definition at line 858 of file DataExchange.c.

References D310_Trk_Hdr_Type::color, GarminObject::d300, GarminObject::d310, Default_Color, Die(), D310_Trk_Hdr_Type::dspl, G300Type, G310Type, GetObjectFromActiveForm(), gpslibErrBusy, gpslibErrParamErr, gTrackHdrDB, kCreatorId, kTrkDBType, Semicircle_Type::lat, Raw_D300_Trk_Point_Type::lat, Semicircle_Type::lon, Raw_D300_Trk_Point_Type::lon, D300_Trk_Point_Type::new_trk, Raw_D300_Trk_Point_Type::new_trk, D300_Trk_Point_Type::posn, StoreTrkHdr(), StoreTrkPoint(), D300_Trk_Point_Type::time, TrackCreateAlert, TrackDBName(), trackDrawTable(), TrackForm, TrackIdent(), TrackTable, and D310_Trk_Hdr_Type::trk_ident.

Referenced by RouteFormHandleEvent(), TrackFormHandleEvent(), and WaypointFormHandleEvent().

Err store_wpt GarminObject wpt,
UInt16  total,
UInt16  current,
LocalFormatID  format,
byte  size
 

Callback function to store waypoint to database upon reception from host.

If a waypoint with the same waypoint ID already exists, it is modified if required.

Parameters:
wpt ptr to GarminObject
total total number of packets
current packet number (one-based), for the D104 protocol, this can also be used as the number of the current waypoint
format Garmin Object format ID (only G104Type supported)
size size of structure pointed to by wpt
Note:
The function's prototype is defined by gpslib (StoreWptCallbackProc).
Returns:
0 - success, 1 - failure

Definition at line 569 of file DataExchange.c.

References D104_Wpt_Type::cmnt, Raw_D104_Wpt_Type::cmnt, CompareWayptIdent(), GarminObject::d104, Die(), D104_Wpt_Type::dspl, Raw_D104_Wpt_Type::dspl, D104_Wpt_Type::dst, packed_waypoint_t::dst, G104Type, gWaypointDB, h, D104_Wpt_Type::ident, Raw_D104_Wpt_Type::ident, packed_waypoint_t::ident, Semicircle_Type::lat, Raw_D104_Wpt_Type::lat, Semicircle_Type::lon, Raw_D104_Wpt_Type::lon, PackWaypoint(), D104_Wpt_Type::posn, routeDrawTable(), RouteForm, D104_Wpt_Type::smbl, Raw_D104_Wpt_Type::smbl, WaypointForm, and wayptDrawTable().

Referenced by RouteFormHandleEvent(), TrackFormHandleEvent(), and WaypointFormHandleEvent().


Variable Documentation

PrefsType gPrefs
 

Preferences data structure.

Definition at line 279 of file GPS.c.


Created: Mon, 08 Oct 2007 22:33:16 +0200
Copyright ©2004 M. Prinke