예제 #1
0
static void
editor_gps_update (time_t gps_time,
                   const RoadMapGpsPrecision *dilution,
                   const RoadMapGpsPosition *gps_position) {

   if (editor_is_enabled()) {
      track_rec_locate(gps_time, dilution, gps_position);
   }
}
예제 #2
0
int export_sync (void) {

    int i;
    int res;
    char *messages[MAX_MSGS];
    int num_msgs = 0;
    int fips;

    if (!editor_is_enabled ()) {
        return 0;
    }

    res = roadmap_file_free_space (roadmap_path_user());

#if !defined(__SYMBIAN32__) || defined(QTMOBILITY)
    if ((res >= 0) && (res < MIN_FREE_SPACE)) {
        roadmap_messagebox ("Error",
                            "Please free at least 5MB of space before synchronizing.");
        return -1;
    }
#endif

    roadmap_download_progress (0);

    snprintf (SyncProgressLabel, sizeof(SyncProgressLabel), "%s",
              roadmap_lang_get ("Preparing export data..."));

    roadmap_warning_register (download_warning_fn, "edtsync");

    roadmap_main_flush ();
    roadmap_download_progress (0);

    snprintf (SyncProgressLabel, sizeof(SyncProgressLabel), "%s",
              roadmap_lang_get ("Uploading data..."));

    roadmap_main_flush ();

    Realtime_OfflineClose ();
#ifndef J2ME
    res = sync_do_upload ();
#endif
    Realtime_OfflineOpen (editor_sync_get_export_path (),
                          editor_sync_get_export_name ());


    fips = roadmap_locator_active ();

    if (fips < 0) {
        fips = 77001;
    }

#if 0
    if (roadmap_locator_activate (fips) == ROADMAP_US_OK) {
        now_t = time (NULL);
        map_time_t = atoi(roadmap_metadata_get_attribute ("Version", "UnixTime"));

        if ((map_time_t + 3600*24) > now_t) {
            /* Map is less than 24 hours old.
             * A new version may still be available.
             */

            now_tm = *gmtime(&now_t);
            map_time_tm = *gmtime(&map_time_t);

            if (now_tm.tm_mday == map_time_tm.tm_mday) {

                goto end_sync;
            } else {
                /* new day - only download if new maps were already generated. */
                if (now_tm.tm_hour < 2) goto end_sync;
            }
        }
    }
#endif //0

    SyncProgressItems = 1;
    SyncProgressCurrentItem = 0;
    roadmap_download_progress (0);

    snprintf (SyncProgressLabel, sizeof(SyncProgressLabel), "%s",
              roadmap_lang_get ("Downloading new maps..."));

    roadmap_label_clear (-1);
    navigate_graph_clear (-1);

    roadmap_main_flush ();
#ifndef J2ME
    res = editor_download_update_map (&SyncDownloadCallbackFunctions);

    if (res == -1) {
        roadmap_messagebox ("Download Error", roadmap_lang_get("Error downloading map update"));
    }
#endif

    for (i=0; i<num_msgs; i++) {
        roadmap_messagebox ("Info", messages[i]);
        free (messages[i]);
    }

    roadmap_warning_unregister (download_warning_fn);

    return 0;
}