Beispiel #1
0
static void purge_old_favorites(void){
   void *cursor;

   roadmap_log( ROADMAP_WARNING, "Tripserver::purge_old_favorites");
   cursor = roadmap_history_latest (ADDRESS_FAVORITE_CATEGORY);
   if( !cursor)
         return;

   while (cursor){
      roadmap_history_delete_entry(cursor);
      cursor = roadmap_history_latest (ADDRESS_FAVORITE_CATEGORY);
   }

}
void roadmap_address_history (void) {

#define MAX_HISTORY_ENTRIES 100
   static char *labels[MAX_HISTORY_ENTRIES];
   static void *values[MAX_HISTORY_ENTRIES];
   static int count = -1;
   void *history;
   static RoadMapAddressDialog context = {"Location", 0, 0, NULL, NULL,
                                           NULL, NULL, 0};

   if (count == -1) {
      roadmap_history_declare ('A', 7);
      labels[0] = (char *)roadmap_lang_get ("Other city");
   }

   history = roadmap_history_latest ('A');

   count = 1;

   while (history && (count < MAX_HISTORY_ENTRIES)) {
      void *prev = history;
      int i;
      BOOL exist;
      char *argv[4];
      roadmap_history_get ('A', history, argv);

	  exist = FALSE;

      for (i=0; i< count; i++){
      	if (!strcmp(labels[i], argv[2])){
      		exist = TRUE;
      	}
      }

      if (!exist){
      	  if (labels[count]) free (labels[count]);
	      labels[count] = strdup(argv[2]);
    	  values[count] = strdup(argv[2]);

      	  count++;
      }
      history = roadmap_history_before ('A', history);
      if (history == prev) break;
   }


   ssd_generic_list_dialog_show (roadmap_lang_get ("Address search"),
                  count,
                  (const char **)labels,
                  (const void **)values,
                  history_callback,
                  history_delete_callback,
                  &context, SSD_GEN_LIST_ENTRY_HEIGHT );
}
Beispiel #3
0
void roadmap_reminder_init(void){
   void *history;
   void *prev;
   int count = 0;

   roadmap_config_declare_enumeration ("preferences", &RoadMapConfigFeatureEnabled, NULL, "no",
                                       "yes", NULL);

   ReminderTable.iCount = 0;

   roadmap_history_declare (REMINDER_CATEGORY, reminder_hi__count);

   if (!roadmap_reminder_feature_enabled())
      return;

   history = roadmap_history_latest (REMINDER_CATEGORY);

   while (history && (count < MAX_REMINDER_ENTRIES)) {
      char *argv[reminder_hi__count];
      roadmap_history_get (REMINDER_CATEGORY, history, argv);
      prev = history;
      if (!strcmp(argv[reminder_hi_add_reminder], "1")){
         ReminderTable.reminder[count].position.latitude = atoi(argv[reminder_hi_latitude]);
         ReminderTable.reminder[count].position.longitude = atoi(argv[reminder_hi_longtitude]);
         ReminderTable.reminder[count].distance= atoi(argv[reminder_hi_distance]);
         ReminderTable.reminder[count].history = history;
         ReminderTable.reminder[count].displayed = FALSE;
         ReminderTable.reminder[count].in_use = TRUE;
         ReminderTable.reminder[count].repeat = atoi(argv[reminder_hi_repeat]);
         snprintf (ReminderTable.reminder[count].title, MAX_REMINDER_TITLE, "%s", argv[reminder_hi_title]);
         snprintf (ReminderTable.reminder[count].description, MAX_REMINDER_DESC, "%s", argv[reminder_hi_description]);

         remider_add_pin(count, &ReminderTable.reminder[count].position);

         count++;
      }

      history = roadmap_history_before (REMINDER_CATEGORY, history);
      if (history == prev) break;
   }

   ReminderTable.iCount = count;
   if(count > 0)
      register_gps_listener();
}
Beispiel #4
0
static void roadmap_trip_server_after_login_delayed (void) {

   void *cursor;
   void *prev;
   char *argv[ahi__count];
   static count = 0;

   roadmap_main_remove_periodic(roadmap_trip_server_after_login_delayed);
   roadmap_log( ROADMAP_DEBUG, "roadmap_trip_server_after_login" );
   cursor = roadmap_history_latest (ADDRESS_FAVORITE_CATEGORY);
   if( !cursor){
      return;
   }

   while (cursor){
      roadmap_history_get (ADDRESS_FAVORITE_CATEGORY, cursor, argv);
      prev = cursor;
      if (strcmp(argv[ahi_synced], "true")){
         RoadMapPosition coordinates;
         count++;
         if (count > 3) //limit syncing to 3
            return;

         roadmap_log( ROADMAP_DEBUG, "roadmap_trip_server_after_login_delayed - Syncing favorite (%s) with server",argv[ahi_name] );
         coordinates.latitude = atoi(argv[ahi_latitude]);
         coordinates.longitude = atoi(argv[ahi_longtitude]);
         create_poi(argv[ahi_name], &coordinates, TRUE, cursor);

      }
      else{
         roadmap_log( ROADMAP_DEBUG, "roadmap_trip_server_after_login_delayed - Favorite (%s) already synced with server",argv[ahi_name] );
      }

      cursor = roadmap_history_before (ADDRESS_FAVORITE_CATEGORY, cursor);
      if (cursor == prev) break;
   }

   roadmap_log( ROADMAP_DEBUG, "roadmap_trip_server_after_login_delayed end" );

}
Beispiel #5
0
void roadmap_reminder_add_entry(const char **argv, BOOL add_reminder) {
   roadmap_history_add (REMINDER_CATEGORY, (const char **)argv);

   if (add_reminder){
      ReminderTable.reminder[ReminderTable.iCount].position.latitude = atoi(argv[reminder_hi_latitude]);
      ReminderTable.reminder[ReminderTable.iCount].position.longitude = atoi(argv[reminder_hi_longtitude]);
      ReminderTable.reminder[ReminderTable.iCount].distance= atoi(argv[reminder_hi_distance]);
      ReminderTable.reminder[ReminderTable.iCount].history = roadmap_history_latest(REMINDER_CATEGORY);
      ReminderTable.reminder[ReminderTable.iCount].displayed = FALSE;
      ReminderTable.reminder[ReminderTable.iCount].in_use = TRUE;
      ReminderTable.reminder[ReminderTable.iCount].repeat = atoi(argv[reminder_hi_repeat]);;
      snprintf (ReminderTable.reminder[ReminderTable.iCount].title, MAX_REMINDER_TITLE, "%s", argv[reminder_hi_title]);
      snprintf (ReminderTable.reminder[ReminderTable.iCount].description, MAX_REMINDER_DESC, "%s", argv[reminder_hi_description]);

      remider_add_pin(ReminderTable.iCount ,&ReminderTable.reminder[ReminderTable.iCount].position);

      if(ReminderTable.iCount == 0)
         register_gps_listener();

      ReminderTable.iCount++;
   }
}
Beispiel #6
0
BOOL roadmap_trip_server_create_poi  (const char* name, RoadMapPosition* coordinates, BOOL overide){
   void * cursor = roadmap_history_latest(ADDRESS_FAVORITE_CATEGORY);
   return create_poi(name, coordinates, overide, cursor);
}