Beispiel #1
0
void roadmap_help_about (void) {
#ifdef IPHONE_NATIVE
	roadmap_main_show_root(0);
#endif //IPHONE_NATIVE
   char about[700];

   sprintf (about, "Waze Qt port " PORT_RELEASE "\nDone by [email protected]\nhttp://code.google.com/p/waze-qt/\nBased on Waze(c) release %s\n%s\n%s",
            roadmap_start_version(),
            roadmap_lang_get("www.waze.com"),
            roadmap_lang_get("Licensed under the terms of the\nGPL v2"));
   about_dialog(about);
}
Beispiel #2
0
void roadmap_help_about (void) {
#ifdef IPHONE_NATIVE
	roadmap_main_show_root(0);
#endif //IPHONE_NATIVE   
   char about[500];

      sprintf (about, "Waze port to WP7 by Meir tsvi\nUses Cibyl, NBidi, SharpBox, ZlibWP7 libs\nRefer any support questions to\[email protected]");

/*   sprintf (about, "Release %s\n%s\n%s\n%s",
            roadmap_start_version(),
            "(c)waze inc.",
            roadmap_lang_get("www.waze.com"),
            roadmap_lang_get("Licensed under the terms of the\nGPL v2"));*/
   about_dialog(about);
}
Beispiel #3
0
///////////////////////////////////////////////////////
// Submit all debug info
static void submit (int with_confirmation)
{
   int initialized = 0;

   if (!initialized) {
      roadmap_config_declare( "preferences", &RMCfgDebugInfoServer, CFG_DEBUG_INFO_SERVER_DEFAULT, NULL );
      initialized = 1;
   }
#ifdef IPHONE
   roadmap_main_show_root(NO);
#endif

   if (with_confirmation)
      ssd_confirm_dialog ("Submit logs", "Sending logs requires large amount of data, continue?", TRUE, roadmap_confirmed_debug_info_submit , NULL);
   else
      roadmap_confirmed_debug_info_submit(dec_yes, NULL);
}
static const char* parse_search_results(roadmap_result* rc, int NumParams, const char*  pData) {
   //Expected data:
   // VenueList,<id>,<name>,<address>,<crossstreet>,<city>,<state>,<zip>,<geolat>,<geolong>,<phone>,<distance>[,<id>,.....]

   FoursquareVenue   venue;
   int i;
   char CommandName[128];
   int iBufferSize;
   double dValue;
   int count;

   iBufferSize =  128;

   if (NumParams == 0)
      return pData;

   if ((NumParams - 1) % ROADMAP_FOURSQUARE_VENUE_ENTRIES != 0) {
      (*rc) = err_parser_unexpected_data;
      return NULL;
   }

   pData       = ExtractNetworkString(
                       pData,             // [in]     Source string
                       CommandName,//   [out]   Output buffer
                       &iBufferSize,      // [in,out] Buffer size / Size of extracted string
                       ",\r\n",          //   [in]   Array of chars to terminate the copy operation
                       1);   // [in]     Remove additional termination chars

   if (strcmp(CommandName, "VenueList") != 0) {
      roadmap_log(ROADMAP_ERROR, "Foursquare - parse_search_results(): could not find command: VenueList (received: '%s')", CommandName);
      (*rc) = err_parser_unexpected_data;
      return NULL;
   }

   count = (NumParams - 1) / ROADMAP_FOURSQUARE_VENUE_ENTRIES;

   if (!(*pData) || count == 0) {
      roadmap_log(ROADMAP_DEBUG, "Foursquare - received empty venues list");
      ssd_dialog_hide_all(dec_close);
#ifdef IPHONE_NATIVE
      roadmap_main_show_root(1);
#endif //IPHONE_NATIVE
      roadmap_messagebox_timeout("Foursquare", "We can't find anything nearby.", 5);
      return pData;
   }

   for (i = 0; i < count; ++i){
      //   1.   id
      iBufferSize = ROADMAP_FOURSQUARE_ID_MAX_SIZE;
      pData       = ExtractNetworkString(
                     pData,               // [in]     Source string
                     venue.sId,           // [out,opt]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 || !(*pData))
      {
         roadmap_log( ROADMAP_ERROR, "Foursquare - parse_search_results(): Failed to read venue id=%s", venue.sId);
         (*rc) = err_parser_unexpected_data;
         return NULL;
      }

      //   2.   name
      iBufferSize = ROADMAP_FOURSQUARE_NAME_MAX_SIZE;
      pData       = ExtractNetworkString(
                     pData,               // [in]     Source string
                     venue.sName,         // [out,opt]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 || !(*pData))
      {
         roadmap_log( ROADMAP_ERROR, "Foursquare - parse_search_results(): Failed to read venue name=%s", venue.sName);
         (*rc) = err_parser_unexpected_data;
         return NULL;
      }

      //   3.   address
      iBufferSize = ROADMAP_FOURSQUARE_ADDRESS_MAX_SIZE;
      pData       = ExtractNetworkString(
                     pData,               // [in]     Source string
                     venue.sAddress,      // [out,opt]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 || !(*pData))
      {
         roadmap_log( ROADMAP_ERROR, "Foursquare - parse_search_results(): Failed to read venue address=%s", venue.sAddress);
         (*rc) = err_parser_unexpected_data;
         return NULL;
      }

      //   4.   crossstreet
      iBufferSize = ROADMAP_FOURSQUARE_CROSS_STREET_MAX_SIZE;
      pData       = ExtractNetworkString(
                     pData,               // [in]     Source string
                     venue.sCrossStreet,  // [out,opt]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 || !(*pData))
      {
         roadmap_log( ROADMAP_ERROR, "Foursquare - parse_search_results(): Failed to read venue crossname=%s", venue.sCrossStreet);
         (*rc) = err_parser_unexpected_data;
         return NULL;
      }

      //   5.   city
      iBufferSize = ROADMAP_FOURSQUARE_CITY_MAX_SIZE;
      pData       = ExtractNetworkString(
                     pData,               // [in]     Source string
                     venue.sCity,         // [out,opt]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 || !(*pData))
      {
         roadmap_log( ROADMAP_ERROR, "Foursquare - parse_search_results(): Failed to read venue city=%s", venue.sCity);
         (*rc) = err_parser_unexpected_data;
         return NULL;
      }

      //   6.   state
      iBufferSize = ROADMAP_FOURSQUARE_STATE_MAX_SIZE;
      pData       = ExtractNetworkString(
                     pData,               // [in]     Source string
                     venue.sState,        // [out,opt]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 || !(*pData))
      {
         roadmap_log( ROADMAP_ERROR, "Foursquare - parse_search_results(): Failed to read venue state=%s", venue.sState);
         (*rc) = err_parser_unexpected_data;
         return NULL;
      }

      //   7.   zip
      iBufferSize = ROADMAP_FOURSQUARE_ZIP_MAX_SIZE;
      pData       = ExtractNetworkString(
                     pData,               // [in]     Source string
                     venue.sZip,          // [out,opt]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 || !(*pData))
      {
         roadmap_log( ROADMAP_ERROR, "Foursquare - parse_search_results(): Failed to read venue zip=%s", venue.sZip);
         (*rc) = err_parser_unexpected_data;
         return NULL;
      }

      //   8.   lat
      pData = ReadDoubleFromString(
                           pData,         //   [in]      Source string
                           ",",           //   [in,opt]  Value termination
                           NULL,          //   [in,opt]  Allowed padding
                           &dValue,       //   [out]     Output value
                           1);            //   [in]      TRIM_ALL_CHARS, DO_NOT_TRIM, or 'n'

      venue.iLatitude = (int) (dValue * 1000000);
      if( !pData || !(*pData))
      {
         roadmap_log( ROADMAP_ERROR, "Foursquare - parse_search_results(): Failed to read venue lat=%d", venue.iLatitude);
         (*rc) = err_parser_unexpected_data;
         return NULL;
      }

      //   9.   lon
      pData = ReadDoubleFromString(
                           pData,         //   [in]      Source string
                           ",",           //   [in,opt]  Value termination
                           NULL,          //   [in,opt]  Allowed padding
                           &dValue,       //   [out]     Output value
                           1);            //   [in]      TRIM_ALL_CHARS, DO_NOT_TRIM, or 'n'

      venue.iLongitude = (int) (dValue * 1000000);
      if( !pData || !(*pData))
      {
         roadmap_log( ROADMAP_ERROR, "Foursquare - parse_search_results(): Failed to read venue lon=%d", venue.iLongitude);
         (*rc) = err_parser_unexpected_data;
         return NULL;
      }

      //   10.   phone
      iBufferSize = ROADMAP_FOURSQUARE_PHONE_MAX_SIZE;
      pData       = ExtractNetworkString(
                     pData,               // [in]     Source string
                     venue.sPhone,        // [out,opt]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 || !(*pData))
      {
         roadmap_log( ROADMAP_ERROR, "Foursquare - parse_search_results(): Failed to read venue phone=%s", venue.sPhone);
         (*rc) = err_parser_unexpected_data;
         return NULL;
      }

      //   11.   distance
      pData = ReadIntFromString(
                     pData,            //   [in]      Source string
                     ",\r\n",              //   [in,opt]   Value termination
                     NULL,             //   [in,opt]   Allowed padding
                     &venue.iDistance,    //   [out]      Put it here
                     1);               //   [in]      Remove additional termination CHARS

      if( !pData || (!(*pData) && i < count-1))
      {
         roadmap_log( ROADMAP_ERROR, "Foursquare - parse_search_results(): Failed to read venue distance=%d", venue.iDistance);
         (*rc) = err_parser_unexpected_data;
         return NULL;
      }


      if (gsVenuesCount < ROADMAP_FOURSQUARE_MAX_VENUE_COUNT) { //skip if more venues received
         create_description (&venue);
         gsVenuesList[gsVenuesCount++] = venue;
      }
   }

   roadmap_main_set_periodic(100,roadmap_foursquare_venues_list);

   return pData;
}