#include <PalmOS.h>
#include "Garmin.h"
#include "Data.h"
#include "geo.h"
#include "common.h"
#include "gpslib.h"
#include "Utils.h"
#include "ResourceDefines.h"
Include dependency graph for Data.c:
Go to the source code of this file.
Defines | |
#define | DEG2SEMI(x) ((G_long)(x * ((1UL<<31)/180.0))) |
Convert degrees (double) to semicircles (fix-point). | |
Functions | |
Int16 | CompareStringFunc (const Char *str1, const Char *str2, Int16 i, SortRecordInfoPtr s1, SortRecordInfoPtr s2, MemHandle appInfoH) |
Compare Strings. | |
Int16 | CompareWayptIdent (waypoint_t *rec1, packed_waypoint_t *rec2, Int16 i, SortRecordInfoPtr s1, SortRecordInfoPtr s2, MemHandle appInfoH) |
Compare Waypoint Identifiers. | |
Int16 | CompareRteNmbr (route_t *rec1, route_t *rec2, Int16 i, SortRecordInfoPtr s1, SortRecordInfoPtr s2, MemHandle appInfoH) |
Compare Route Numbers. | |
void | PackWaypoint (waypoint_t *waypoint, UInt16 index) |
Pack Waypoint and store it in Database. | |
void | PackRouteHdr (route_t *route, UInt16 index) |
Store Route Header in Database. | |
void | PackRouteWpt (UInt32 wpt_rec_id, UInt16 index) |
Store Route Waypoint in Database (append). | |
void | InsertRouteWpt (UInt16 rec, UInt32 wpt_rec_id, UInt16 wpt_index) |
Store Route Waypoint in Database (insert after selection). | |
void | DelRouteWpt (UInt16 rec, UInt16 wpt_index) |
Delete Route Waypoint from Database. | |
void | MoveRouteWpt (UInt16 rec, UInt16 wpt_index, Boolean up) |
Move Route Waypoint in Database. | |
void | UnpackWaypoint (waypoint_t *waypoint, const packed_waypoint_t *packed_waypoint) |
Unpack waypoint retrieved from database. | |
void | StoreTrkHdr (trk_header_t *trkhdr, UInt16 index) |
Store track header in database. | |
void | StoreTrkPoint (trk_point_t *trkpoint, UInt16 index) |
Store track point in database. | |
void | TrackDBName (Char *dbname, UInt32 trackID) |
Generate Track Point Data Base Name. | |
void | TrackIdent (Char *ident) |
Generate Track Identifier from current Time and Date. | |
void | DeleteTracks (void) |
Delete all track point databases. | |
Boolean | Position2Geodb (GPSType gps_data) |
Add Position to Memo for Import to GeoDB. | |
Boolean | UpdateActWpt (double lat, double lon, Boolean init) |
Update active (route) waypoint according to distance to current and next waypoint. | |
Boolean | TrackWriteLog (Boolean new_trk) |
Write Track Point to Track Log Data Base. | |
Boolean | TrackIntervalCheck (Boolean init, Boolean *new_trk) |
check if track log interval reached | |
Boolean | CheckApproach (double lat, double lon) |
check if active waypoint is within proximity distance | |
void | NotifyApproach (void) |
generate notification if Active Waypoint is within proximity distance | |
Err | OpenOrCreateDB (DmOpenRef *dbP, UInt32 type, UInt32 creator, UInt16 mode, UInt16 cardNo, char *name, Boolean *created) |
Open a database. | |
void | InitializeWaypoints (void) |
Creates a Waypoint Database. | |
Variables | |
DmOpenRef | gWaypointDB |
Waypoint Database Reference. | |
DmOpenRef | gRouteDB |
Route Database Reference. | |
DmOpenRef | gTrackHdrDB |
Track Header Database Reference. | |
DmOpenRef | gTrackDB = 0 |
Track Database Reference. | |
PrefsType | gPrefs |
Preferences data structure. | |
GPSType | gGPSData |
|
Convert degrees (double) to semicircles (fix-point).
Definition at line 104 of file Data.c. Referenced by InitializeWaypoints(). |
|
check if active waypoint is within proximity distance If no proximity distance is stored in the waypoint data base (i.e. the proximity distance is zero), a default value is used.
Definition at line 1205 of file Data.c. References PrefsType::act_wpt, APPROACH_DST, calcR(), D104_Wpt_Type::dst, gc_dist_sphere(), gPrefs, gWaypointDB, Semicircle_Type::lat, Semicircle_Type::lon, D104_Wpt_Type::posn, semi2deg(), UnpackWaypoint(), and ActWayptType::waypointID. Referenced by NotifyApproach(). |
|
Compare Route Numbers.
Definition at line 233 of file Data.c. References route_t::nmbr. |
|
Compare Strings. PARAMETERS: see DmComparF() in PalmOS Reference
Definition at line 180 of file Data.c. Referenced by Position2Geodb(). |
|
Compare Waypoint Identifiers.
Definition at line 201 of file Data.c. References D104_Wpt_Type::ident, and packed_waypoint_t::ident. Referenced by InitializeWaypoints(), store_rte(), and store_wpt(). |
|
Delete all track point databases.
Definition at line 779 of file Data.c. References kCreatorId, and kTrkDBType. |
|
Delete Route Waypoint from Database.
Definition at line 481 of file Data.c. References route_t::cmnt, gRouteDB, route_t::items, route_t::nmbr, and route_t::wpt_rec_id. Referenced by RouteEditFormHandleEvent(). |
|
Creates a Waypoint Database. The Database contains the capitals of all states of the European Community (as of 03/2004). The waypoints were taken from http://wayhoo.com, which in turn uses GNS (http://gnswww.nima.mil/geonames/GNS/index.jsp). Quoted from Wayhoo: Note: GNS coordinates have a low degree of precision, latitude and longitude. The Waypoint Identifiers (i.e. short names) are comprised of the ISO Country Code and the IATA (International Air Transport Association) Location ID. (see http://www.iata.org/codes/index.htm) This is just an example after all. Definition at line 1359 of file Data.c. References CompareWayptIdent(), DEG2SEMI, Die(), dspl_smbl_only, gWaypointDB, h, PackWaypoint(), and sym_lrg_cty. |
|
Store Route Waypoint in Database (insert after selection).
Definition at line 417 of file Data.c. References route_t::cmnt, gRouteDB, route_t::items, route_t::nmbr, and route_t::wpt_rec_id. Referenced by RouteEditFormHandleEvent(). |
|
Move Route Waypoint in Database.
Definition at line 545 of file Data.c. References route_t::cmnt, gRouteDB, route_t::items, route_t::nmbr, and route_t::wpt_rec_id. Referenced by RouteEditFormHandleEvent(). |
|
generate notification if Active Waypoint is within proximity distance Depending on the user settings, audible and/or visible notification is triggered. In audible only mode, just one alarm sound is played. Otherwise an alert form is opened and has to be acknowledged by the user. After achnowledgement, the notification will not be repeated for this waypoint. Definition at line 1261 of file Data.c. References PrefsType::act_wpt, PrefsType::approach_alert, PrefsType::approach_sound, ApproachForm, CheckApproach(), gGPSData, gPrefs, GPSType::lat, GPSType::lon, GPSType::valid, ActWayptType::valid, and ActWayptType::waypointID. Referenced by MainFormHandleEvent(), MapFormHandleEvent(), NavigationFormHandleEvent(), and SkyviewFormHandleEvent(). |
|
Open a database. If it doesn't exist, create it.
|
|
Store Route Header in Database.
Definition at line 320 of file Data.c. References route_t::cmnt, Die(), gRouteDB, route_t::items, route_t::nmbr, and route_t::wpt_rec_id. |
|
Store Route Waypoint in Database (append).
Definition at line 367 of file Data.c. References route_t::cmnt, Die(), gRouteDB, route_t::items, route_t::nmbr, and route_t::wpt_rec_id. Referenced by store_rte(). |
|
Pack Waypoint and store it in Database.
Definition at line 258 of file Data.c. References D104_Wpt_Type::cmnt, Die(), D104_Wpt_Type::dspl, D104_Wpt_Type::dst, gWaypointDB, D104_Wpt_Type::ident, Semicircle_Type::lat, Semicircle_Type::lon, D104_Wpt_Type::posn, D104_Wpt_Type::smbl, and StrLen. Referenced by InitializeWaypoints(), store_rte(), and store_wpt(). |
|
Add Position to Memo for Import to GeoDB.
< location_name >,< latitude >,< N|S >,< longitude >,< E|W >, < elevation >,< gmt_offset >,< E|W >,< daylight_time > Example: AA Adana,37:0.6,N,35:16.8,E,,2,E,0 + (GPS4Palm only knows the position) Definition at line 826 of file Data.c. References CompareStringFunc(), deg_to_geodb_str(), GPSType::lat, GPSType::lon, StrLen, and GPSType::valid. Referenced by MainFormHandleEvent(), MapFormHandleEvent(), NavigationFormHandleEvent(), and SkyviewFormHandleEvent(). |
|
Store track header in database.
Definition at line 614 of file Data.c. References D310_Trk_Hdr_Type::color, Die(), D310_Trk_Hdr_Type::dspl, gTrackHdrDB, and D310_Trk_Hdr_Type::trk_ident. Referenced by store_trk(), and TrackFormHandleEvent(). |
|
Store track point in database.
Definition at line 659 of file Data.c. References Die(), gTrackDB, D300_Trk_Point_Type::new_trk, D300_Trk_Point_Type::posn, and D300_Trk_Point_Type::time. Referenced by store_trk(), and TrackWriteLog(). |
|
Generate Track Point Data Base Name.
Definition at line 705 of file Data.c. References kTrkDBName, nibble2hex(), and StrLen. Referenced by get_next_trk(), NumTrkPackets(), store_trk(), TrackFormHandleEvent(), and TrackWriteLog(). |
|
Generate Track Identifier from current Time and Date.
Definition at line 725 of file Data.c. References StrCopy, StrLen, and TrackStr. Referenced by store_trk(). |
|
check if track log interval reached Checks if a new track point has to be logged depending on the selected track log mode (time or distance) and interval. A new track segment is started upon initialization or after loosing and regaining coverage.
Definition at line 1126 of file Data.c. References calcR(), gc_dist_sphere(), gGPSData, gPrefs, TrkPrefsType::ival, GPSType::lat, GPSType::lon, TrkPrefsType::mode, PrefsType::trk_log, and GPSType::valid. Referenced by MainFormHandleEvent(), MapFormHandleEvent(), NavigationFormHandleEvent(), SkyviewFormHandleEvent(), and TrackFormHandleEvent(). |
|
Write Track Point to Track Log Data Base.
Definition at line 1029 of file Data.c. References PrefsType::act_trk, deg2semi(), Die(), gGPSData, gPrefs, gTrackDB, Semicircle_Type::lat, GPSType::lat, ActTrackType::log_state, Semicircle_Type::lon, GPSType::lon, D300_Trk_Point_Type::new_trk, Palm2GarminTimeDiff, D300_Trk_Point_Type::posn, StoreTrkPoint(), D300_Trk_Point_Type::time, GPSType::time, TrackDBName(), TrackFullAlert, ActTrackType::trackID, PrefsType::trk_log, ActTrackType::valid, and TrkPrefsType::wrap. Referenced by MainFormHandleEvent(), MapFormHandleEvent(), NavigationFormHandleEvent(), and SkyviewFormHandleEvent(). |
|
Unpack waypoint retrieved from database.
Definition at line 594 of file Data.c. References D104_Wpt_Type::cmnt, packed_waypoint_t::cmnt, D104_Wpt_Type::dspl, packed_waypoint_t::dspl, D104_Wpt_Type::dst, packed_waypoint_t::dst, D104_Wpt_Type::ident, packed_waypoint_t::ident, Semicircle_Type::lat, Semicircle_Type::lon, D104_Wpt_Type::posn, packed_waypoint_t::posn, D104_Wpt_Type::smbl, packed_waypoint_t::smbl, StrCopy, and D104_Wpt_Type::unused. Referenced by ApproachFormHandleEvent(), CheckApproach(), get_next_rte(), get_next_wpt(), NavigationFormHandleEvent(), UpdateActWpt(), WaypointFormHandleEvent(), and WayptEditFormHandleEvent(). |
|
Update active (route) waypoint according to distance to current and next waypoint. The current implementation switches to the next route waypoint even if the current waypoint is just "passed by", i.e. the distance to the current waypoint is increasing while the distance to the next waypoint is decreasing. A different implementation could require the current waypoint to be "visited" with the proximity information stored in the waypoint record as the criterion.
Definition at line 911 of file Data.c. References PrefsType::act_rte, PrefsType::act_wpt, gc_dist_sphere(), gPrefs, gRouteDB, gWaypointDB, route_t::items, Semicircle_Type::lat, Semicircle_Type::lon, D104_Wpt_Type::posn, ActRouteType::routeID, semi2deg(), UnpackWaypoint(), ActWayptType::waypointID, ActRouteType::wpt_index, and route_t::wpt_rec_id. Referenced by MainFormHandleEvent(), MapFormHandleEvent(), NavigationFormHandleEvent(), RouteFormHandleEvent(), and SkyviewFormHandleEvent(). |
|
Definition at line 129 of file HandleMessage.c. |
|
Preferences data structure.
|
|
Route Database Reference.
Definition at line 108 of file Data.c. Referenced by DelRouteWpt(), InsertRouteWpt(), MoveRouteWpt(), NavigationFormHandleEvent(), NumRtePackets(), PackRouteHdr(), PackRouteWpt(), routeDrawTable(), RouteEditFormHandleEvent(), RouteFormHandleEvent(), TrackFormHandleEvent(), and UpdateActWpt(). |
|
Track Database Reference.
Definition at line 110 of file Data.c. Referenced by StoreTrkPoint(), TrackFormHandleEvent(), and TrackWriteLog(). |
|
Track Header Database Reference.
Definition at line 109 of file Data.c. Referenced by get_next_trk(), NumTrkPackets(), store_trk(), StoreTrkHdr(), trackDrawTable(), and TrackFormHandleEvent(). |
|
Waypoint Database Reference.
|