static int roadmap_address_show (const char *city, const char *street_name, const char *street_number_image, RoadMapAddressDialog *context) { int i; int count; RoadMapGeocode *selections; char *state; const char *argv[4]; address_info ai; ai.state = NULL; ai.country = NULL; ai.city = city; ai.street = street_name; ai.house = street_number_image; state = "IL"; if (context->use_zip) { return 0; /* TBD: how to select by ZIP ? Need one more table in usdir. */ } ssd_dialog_hide_all(dec_close); count = roadmap_geocode_address (&selections, street_number_image, street_name, city, state); if (count <= 0) { roadmap_messagebox (roadmap_lang_get ("Warning"), roadmap_geocode_last_error_string()); free (selections); return 0; } argv[0] = street_number_image; argv[1] = street_name; argv[2] = city; argv[3] = state; roadmap_history_add ('A', argv); roadmap_history_save(); roadmap_address_done (selections, context, &ai); for (i = 0; i < count; ++i) { free (selections[i].name); selections[i].name = NULL; } free (selections); return 1; }
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++; } }
const char* on_get_pois_res(int NumParams,const char* pData){ int i; int iBufferSize; int longitude; int latitude; char poiName[MAX_POI_NAME]; char *argv[ahi__count]; char temp[20]; char msg[100]; int numRecords = NumParams/3; roadmap_log( ROADMAP_WARNING, "roadmap_tripserver_response- got GetPOIsRes (Num parameters= %d )",NumParams ); if (numRecords > 0) purge_old_favorites(); for (i = 0; i < numRecords; i++){ //POI name iBufferSize = sizeof(poiName); pData = ExtractNetworkString( pData, // [in] Source string poiName, // [out] Output buffer &iBufferSize, // [in,out] Buffer size / Size of extracted string ",", // [in] Array of chars to terminate the copy operation 1); // [in] Remove additional termination chars if (!pData){ roadmap_log( ROADMAP_ERROR, "Tripserver::on_get_pois_res() - Failed to read POI name"); return NULL; } //POI Lon pData = ReadIntFromString( pData, // [in] Source string ",", // [in,opt] Value termination NULL, // [in,opt] Allowed padding &longitude, // [out] Put it here 1); // [in] Remove if (!pData){ roadmap_log( ROADMAP_ERROR, "Tripserver::on_get_pois_res() - Failed to read Destination longitude. POI Name=%s",poiName ); return NULL; } //POI Lat pData = ReadIntFromString( pData, // [in] Source string ",\r\n", // [in,opt] Value termination NULL, // [in,opt] Allowed padding &latitude, // [out] Put it here TRIM_ALL_CHARS);// [in] Remove if (!pData){ roadmap_log( ROADMAP_ERROR, "Tripserver::on_get_pois_res() - Failed to read Destination latitude. POI Name=%s",poiName ); return NULL; } argv[ahi_house_number] = ""; argv[ahi_street] = ""; argv[ahi_city] = ""; argv[ahi_state] = ""; argv[ahi_name] = (char *)poiName; sprintf(temp, "%d", latitude); argv[ahi_latitude] = strdup(temp); sprintf(temp, "%d", longitude); argv[ahi_longtitude] = strdup(temp); argv[ahi_synced] = "true"; roadmap_log( ROADMAP_WARNING, "roadmap_tripserver_response- GetPOIsRes Adding favorite (name=%s, lat=%s, lon=%s )", argv[ahi_name], argv[ahi_latitude], argv[ahi_longtitude]); roadmap_history_add (ADDRESS_FAVORITE_CATEGORY, (const char **)argv); } ssd_progress_msg_dialog_hide(); if (numRecords == 0) sprintf(msg, "%s", roadmap_lang_get("No favorite destinations were found")); else if (numRecords == 1) sprintf(msg, "%s", roadmap_lang_get("1 destination was restored to your favorites")); else sprintf(msg, "%d %s", numRecords, roadmap_lang_get("destinations were restored to your favorites")); roadmap_messagebox_timeout("Favorites", msg, 5); roadmap_history_save(); return pData; }