示例#1
0
void RealtimeAltRoutes_OnRouteResults (NavigateRouteRC rc, int num_res, const NavigateRouteResult *res){
   int i;
   
   CalculatingAltRoutes = FALSE;
   
   if (num_res > MAX_ROUTES)
      num_res = MAX_ROUTES;


   if (rc != route_succeeded){
      roadmap_main_remove_periodic(route_request_timeout);
      ssd_progress_msg_dialog_hide ();
      roadmap_log(ROADMAP_ERROR,"RealtimeAltRoutes_OnRouteResults failed rc=%d", rc );
      return;
   }

   roadmap_log (ROADMAP_DEBUG,"RealtimeAltRoutes_OnRouteResults %d", num_res);
   altRoutesTrips.altRoutTrip[0].iNumRoutes = num_res;
   for (i = 0; i < num_res ; i++){
      altRoutesTrips.altRoutTrip[0].pRouteResults[i] = *(res+i);//todo check
   }

   altRoutesTrips.altRoutTrip[0].iTripLenght = altRoutesTrips.altRoutTrip[0].pRouteResults[0].total_time;
   altRoutesTrips.altRoutTrip[0].iTripDistance = altRoutesTrips.altRoutTrip[0].pRouteResults[0].total_length;
   roadmap_alternative_routes_routes_dialog(gShowListFirst);

   roadmap_screen_refresh();
}
示例#2
0
void RealtimeBonus_Animate_Pacman (void) {
   static char pacman_name[50];
   static int index = 1;
   static int repeat = 0;

#ifndef J2ME
   if ( (index == 5) && (repeat == 8)) {
      roadmap_main_remove_periodic (RealtimeBonus_Animate_Pacman);
      editor_screen_set_override_car (NULL);
      index = 1;
      repeat = 0;
   }
   else if (index == 5) {
      index = 2;
      repeat++;
      sprintf (pacman_name, "pacman%d", index);
      editor_screen_set_override_car (pacman_name);
   }
   else {
      index++;
      sprintf (pacman_name, "pacman%d", index);
      editor_screen_set_override_car (pacman_name);
   }

   if (index == 2)
      roadmap_main_set_periodic (300, RealtimeBonus_Animate_Pacman);
#endif
}
static void kill_messagebox_timer (void) {

   if (MessageBoxCallback) {
      roadmap_main_remove_periodic (MessageBoxCallback);
      MessageBoxCallback = NULL;
   }
}
示例#4
0
/* Instead of calling the drag motion event with every mouse move,
 * we use this timer as a flow control. It may take time for the
 * application to finish the task of drawing the screen and we don't
 * want to lag.
 */
static void drag_flow_control(void) {

   roadmap_main_remove_periodic(drag_flow_control);

   exec_callbacks (DRAG_MOTION, &last_pointer_point);
   is_drag_flow_control_on = 0;
}
示例#5
0
static void double_click_flow_control (void) {

   is_testing_double_click = 0;
   roadmap_main_remove_periodic(double_click_flow_control);
   exec_callbacks (SHORT_CLICK, &last_pointer_point);
   exec_callbacks (RELEASED, &last_pointer_point);
}
示例#6
0
static void kill_timer (void) {

   if (AlerterTimerCallback) {
      roadmap_main_remove_periodic (AlerterTimerCallback);
      AlerterTimerCallback = NULL;
   }
}
示例#7
0
int ssd_dialog_drag_start (RoadMapGuiPoint *point) {
   SsdDialog dialog = RoadMapDialogCurrent;
   if (dialog == NULL){
      return 0;
   }

   if (dialog->container->flags & SSD_DIALOG_FLOAT){
      if (LastPointerPoint.x == -1)
         return 0;
      else
         return 1;
   }

   if (dialog->scroll_container && dialog->scroll_container->drag_start)
         return (*dialog->scroll_container->drag_start)(dialog->container, point);
   else{
      dialog->drag_start_point.x = point->x;
      dialog->drag_start_point.y = point->y;
      dialog->drag_last_motion.x = point->x;
      dialog->drag_last_motion.y = point->y;
      dialog->scroll_counter = 0;
      dialog->drag_start_time_ms = roadmap_time_get_millis();
      if (dialog->time_active){
         roadmap_main_remove_periodic (keep_dragging);
         dialog->time_active = FALSE;
      }
   }
   return 1;
}
示例#8
0
static void roadmap_pointer_button_released (RoadMapGuiPoint *point) {


    if (is_drag_flow_control_on) {
       roadmap_main_remove_periodic(drag_flow_control);
       is_drag_flow_control_on = 0;
    }

    if ( !is_button_down )
       return;

    roadmap_main_remove_periodic( long_click_flow_control );

    is_button_down = 0;
    cancel_dragging = 0;

   /*
    * Clicks are at higher priority
    */
    if ( is_short_click( point ) ) {
       if ( is_testing_double_click ) {
         roadmap_main_remove_periodic(double_click_flow_control);
         is_testing_double_click = 0;
         exec_callbacks ( DOUBLE_CLICK, &last_pointer_point );
       }
       else if ( is_double_click_enabled ) {
          is_dragging = 0;
          is_double_click_enabled = 0;
          is_testing_double_click = 1;
          roadmap_main_set_periodic(DOUBLE_CLICK_TIMEOUT, double_click_flow_control);
          /*
           * Don't call events' handlers at this stage
           */
          return;
       }
       else {
          exec_callbacks (SHORT_CLICK, point);
       }
    }
    else if ( is_dragging ) {
          exec_callbacks (DRAG_END, point);
    }

   is_dragging = 0;
   exec_callbacks (RELEASED, point);
}
示例#9
0
static void RealtimeAltRoutes_OnRouteRC (NavigateRouteRC rc, int protocol_rc, const char *description) {
   CalculatingAltRoutes = FALSE;
   
   // TODO put error handling
	if (rc == route_succeeded) {
      roadmap_main_remove_periodic(route_request_timeout);
		ssd_progress_msg_dialog_hide ();
	}
}
示例#10
0
static void long_click_flow_control(void)
{
   roadmap_main_remove_periodic(long_click_flow_control);
   is_long_click_expired = 1;
   /*
    * If it was drag and stopped after that or drag was in radius
    */
   if ( is_click( &last_pointer_point ) || !is_dragging )
   {
      exec_callbacks (LONG_CLICK, &last_pointer_point);
   }
}
示例#11
0
void roadmap_foursquare_venues_list (void) {
   static   const char* results[ROADMAP_FOURSQUARE_MAX_VENUE_COUNT];
   static   void*       indexes[ROADMAP_FOURSQUARE_MAX_VENUE_COUNT];
   static   const char* icons[ROADMAP_FOURSQUARE_MAX_VENUE_COUNT];
   int i;

   roadmap_main_remove_periodic(roadmap_foursquare_venues_list);


   for (i = 0; i < gsVenuesCount; i++) {
      results[i] = gsVenuesList[i].sDescription;
#ifdef IPHONE_NATIVE
      indexes[i] = (void*)(i+10);
#else
      indexes[i] = (void*)i;
#endif
      icons[i] = "foursquare_checkin";
   }

#ifdef IPHONE_NATIVE
   roadmap_list_menu_generic(roadmap_lang_get(FOURSQUARE_TITLE),
                             gsVenuesCount,
                             results,
                             (const void **)indexes,
                             icons,
                             NULL,
                             NULL,
                             on_venue_item_selected,
                             NULL,
                             NULL,
                             NULL,
                             60,
                             0,
                             NULL);
#else
   ssd_generic_icon_list_dialog_show(roadmap_lang_get(FOURSQUARE_VENUES_TITLE),
                                       gsVenuesCount,
                                       results,
                                       (const void **)indexes,
                                       icons,
                                       0,
                                       on_venue_item_selected,
                                       NULL,
                                       NULL,
                                       NULL,
                                       NULL,
                                       60,
                                       0,
                                       FALSE);

#endif //IPHONE_NATIVE
}
示例#12
0
static void button_callback (void) {

	struct ssd_button_data *data = (struct ssd_button_data *) delayed_widget->data;

   roadmap_main_remove_periodic (button_callback);
	delayed_widget->in_focus = FALSE;
   if (delayed_widget->callback) {
      (*delayed_widget->callback) (delayed_widget, SSD_BUTTON_SHORT_CLICK);
	   }

		data->state = BUTTON_STATE_NORMAL;
	roadmap_screen_redraw ();
}
static int roadmap_screen_obj_released (RoadMapGuiPoint *point) {
   RoadMapScreenObj object = RoadMapScreenObjSelected;

   if (!RoadMapScreenObjSelected) {
      return 0;
   }

   if (object->flags & OBJ_FLAG_REPEAT) {
      roadmap_main_remove_periodic (roadmap_screen_obj_repeat);
      RoadMapScreenObjSelected = 0;
   }

   return 1;
}
示例#14
0
const char* roadmap_foursquare_response(int status, roadmap_result* rc, int NumParams, const char*  pData){

   roadmap_main_remove_periodic(request_time_out);
   ssd_progress_msg_dialog_hide();

   if (status != 200){
      switch (gsRequestType) {
         case ROADMAP_FOURSQUARE_LOGIN:
            roadmap_log( ROADMAP_ERROR, "roadmap_foursquare_response (login) - Command failed (status= %d)", status );
            roadmap_foursquare_login_failed(status);
            break;
         case ROADMAP_FOURSQUARE_SEARCH:
            roadmap_log( ROADMAP_ERROR, "roadmap_foursquare_response (search) - Command failed (status= %d)", status );
            roadmap_messagebox ("Oops", "Could not connect with Foursquare. Try again later.");
            break;
         case ROADMAP_FOURSQUARE_CHECKIN:
            roadmap_log( ROADMAP_ERROR, "roadmap_foursquare_response (checkin) - Command failed (status= %d)", status );
            roadmap_messagebox ("Oops", "Could not connect with Foursquare. Try again later.");
           break;
         default:
            roadmap_log( ROADMAP_ERROR, "roadmap_foursquare_response (unknown) - Command failed (status= %d)", status );
      }
      gsRequestType = ROADMAP_FOURSQUARE_NONE;
      return pData;
   }

   switch (gsRequestType) {
      case ROADMAP_FOURSQUARE_LOGIN:
         roadmap_log( ROADMAP_DEBUG, "roadmap_foursquare_response (login) - successful");
         roadmap_foursquare_set_logged_in(TRUE);
         gsRequestType = ROADMAP_FOURSQUARE_NONE;
         if (gsCheckInOnLogin)
            roadmap_foursquare_checkin();
         break;
      case ROADMAP_FOURSQUARE_SEARCH:
         roadmap_log( ROADMAP_DEBUG, "roadmap_foursquare_response (search) - successful");
         gsRequestType = ROADMAP_FOURSQUARE_NONE;
         return parse_search_results(rc, NumParams, pData);
         break;
      case ROADMAP_FOURSQUARE_CHECKIN:
         roadmap_log( ROADMAP_DEBUG, "roadmap_foursquare_response (checkin) - successful");
         gsRequestType = ROADMAP_FOURSQUARE_NONE;
         return parse_checkin_results(rc, NumParams, pData);
        break;
      default:
         roadmap_log( ROADMAP_DEBUG, "roadmap_foursquare_response (unknown) - - successful");
   }

   return pData;
}
示例#15
0
static void periodic_callack (void) {

   if( RoadMapNetMonEnabled == FALSE || (
#ifndef   _WIN32
      (CurrentState == NET_MON_IDLE) &&
#endif   // _WIN32
         ((time(NULL) - LastActivityTime) > ACTIVITY_TIMEOUT_SEC)) ) {

      roadmap_message_unset('!');
      LastActivityTime = 0;
      roadmap_main_remove_periodic(periodic_callack);
      roadmap_screen_redraw();
   }
}
示例#16
0
static void route_request_timeout(void)
{
	roadmap_main_remove_periodic( route_request_timeout );
	ssd_progress_msg_dialog_hide();
	if (CalculatingAltRoutes)
	{
	   char msg[128];
	   snprintf(msg, sizeof(msg), "%s.\n%s", roadmap_lang_get("Routing service timed out"), roadmap_lang_get("Please try again later"));
		roadmap_messagebox_timeout("Oops",msg ,5);
		roadmap_analytics_log_event (ANALYTICS_EVENT_ROUTE_ERROR, ANALYTICS_EVENT_INFO_ERROR, "TimeOut");
		navigate_route_cancel_request();
		CalculatingAltRoutes = FALSE;
	}
}
示例#17
0
static void SpeedCheck_Timer(void){
   RoadMapGpsPosition pos;
   BOOL gps_active;


   gps_active = roadmap_gps_have_reception();
   if (!gps_active)
         return;

   roadmap_navigate_get_current(&pos, NULL, NULL);
   if (pos.speed < 2){
      roadmap_main_remove_periodic(SpeedCheck_Timer);
      display_ticker();
   }
}
示例#18
0
void roadmap_foursquare_checkedin_dialog(void) {
   char text[256];

   roadmap_main_remove_periodic(roadmap_foursquare_checkedin_dialog);

   if (!ssd_dialog_activate(FOURSQUARE_CHECKEDIN_DIALOG_NAME, NULL)) {
      create_checkedin_dialog();
      ssd_dialog_activate(FOURSQUARE_CHECKEDIN_DIALOG_NAME, NULL);
   }

   ssd_dialog_set_value("Checkin message lablel", gsCheckInInfo.sCheckinMessage);
   ssd_dialog_set_value("Checkin address", gsCheckInInfo.sAddress);
   snprintf(text, sizeof(text), "%s %s", roadmap_lang_get("Points:"), gsCheckInInfo.sScorePoints);
   ssd_dialog_set_value("Checkin points", text);

   roadmap_screen_redraw();
}
示例#19
0
void roadmap_ticker_show(void){
   char text[256];
   gTickerHide = FALSE;

   if (! roadmap_message_format (text, sizeof(text), "%*|%X")) {
      roadmap_message_set('*', "%d", 0);
      roadmap_ticker_set_last_event(default_event);
   }

   if (gTickerSupressHide)
      roadmap_main_remove_periodic (roadmap_ticker_supress_hide);

   roadmap_main_set_periodic (15000, roadmap_ticker_supress_hide);

   gTickerSupressHide = TRUE;
   if (!roadmap_screen_refresh())
     roadmap_screen_redraw();
}
示例#20
0
void roadmap_foursquare_login (const char *user_name, const char *password) {
   BOOL success;

   gsRequestType = ROADMAP_FOURSQUARE_LOGIN;
#ifdef IPHONE
   delayed_show_progress();
#else
   roadmap_main_set_periodic(100, delayed_show_progress);
#endif //IPHONE
   roadmap_main_set_periodic(FOURSQUARE_REQUEST_TIMEOUT, request_time_out);

   success = Realtime_FoursquareConnect(user_name, password,
         roadmap_foursquare_is_tweet_login_enabled() && roadmap_twitter_logged_in());
   if (!success) {
      roadmap_main_remove_periodic(request_time_out);
      ssd_progress_msg_dialog_hide();
      gsRequestType = ROADMAP_FOURSQUARE_NONE;
      roadmap_main_set_periodic (100, foursquare_network_error);
   }
}
示例#21
0
void roadmap_geo_config_transaction_failed(void){
   ssd_progress_msg_dialog_hide();
#ifdef J2ME   
   roadmap_messagebox_cb ("Oops",
            "Network connection is not available. Please check your device's network settings.",roadmap_geo_config_failed_cb);
#else
   roadmap_messagebox ("Oops",
            "Network connection is not available. Please check your device's network settings.");
#endif            
   clean_up();

   //Remove timer
   roadmap_main_remove_periodic (GeoConfigTimer);

   roadmap_screen_refresh();
   // on error, exit, don't continue.
   if (GeoConfigContext.callback)
      (*GeoConfigContext.callback)();

}
示例#22
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" );

}
示例#23
0
void roadmap_foursquare_request_failed (roadmap_result status) {
   roadmap_main_remove_periodic(request_time_out);
   ssd_progress_msg_dialog_hide();

   switch (gsRequestType) {
      case ROADMAP_FOURSQUARE_LOGIN:
         roadmap_log( ROADMAP_ERROR, "roadmap_foursquare_response (login) - network failed (status= %d)", status );
         roadmap_foursquare_login_failed(status);
         break;
      case ROADMAP_FOURSQUARE_SEARCH:
         roadmap_log( ROADMAP_ERROR, "roadmap_foursquare_response (search) - network failed failed (status= %d)", status );
         roadmap_messagebox ("Oops", "Could not connect with Foursquare. Try again later.");
         break;
      case ROADMAP_FOURSQUARE_CHECKIN:
         roadmap_log( ROADMAP_ERROR, "roadmap_foursquare_response (checkin) - network failed (status= %d)", status );
         roadmap_messagebox ("Oops", "Could not connect with Foursquare. Try again later.");
        break;
      default:
         roadmap_log( ROADMAP_ERROR, "roadmap_foursquare_response (unknown) - network failed (status= %d)", status );
   }
   gsRequestType = ROADMAP_FOURSQUARE_NONE;
}
示例#24
0
void GeoConfigTimer (void) {
   roadmap_log (ROADMAP_ERROR,"GeoServerConfig Timeout!! received %d out of %d", GeoConfigContext.num_received+1, GeoConfigContext.num_results );
   ssd_progress_msg_dialog_hide();


   roadmap_log(ROADMAP_ERROR,"Geo config timed out : exiting");
   roadmap_messagebox_cb ("Oops",
              "Could not establish network connection. Please check your device's network settings.", roadmap_geo_config_failed_cb);


   clean_up();

   roadmap_screen_refresh();

   //Remove timer
   roadmap_main_remove_periodic (GeoConfigTimer);

   /* - if geo config failed - Exit.
   if (GeoConfigContext.callback)
      (*GeoConfigContext.callback)();
      */

}
示例#25
0
static void keep_dragging (void) {
   SsdDialog dialog = RoadMapDialogCurrent;
   RoadMapGuiPoint point;
   int diff;

   if (dialog == NULL)
      return;

   dialog->scroll_counter++;
   point.x = dialog->drag_start_point.x;
   diff = dialog->drag_end_motion.y - dialog->drag_start_point.y;
   if (diff > 0)
        point.y= dialog->drag_last_motion.y + dialog->scroll_counter *   (dialog->drag_speed/3);
   else
        point.y = dialog->drag_last_motion.y - dialog->scroll_counter  * (dialog->drag_speed/3);

   if (dialog->scroll_counter < SCROLL_AFTER_END_COUNTER)
      ssd_dialog_drag_motion(&point);
   else{
      dialog->time_active = FALSE;
      ssd_dialog_drag_end(&point);
      roadmap_main_remove_periodic (keep_dragging);
   }
}
示例#26
0
static void foursquare_network_error(void){
   roadmap_main_remove_periodic (foursquare_network_error);
   roadmap_messagebox("Oops", roadmap_lang_get("There is no network connection. Updating your Foursquare account details failed."));
   roadmap_foursquare_set_logged_in (FALSE);
   //roadmap_foursquare_login_dialog();
}
示例#27
0
static void foursquare_pw_empty(void){
   roadmap_main_remove_periodic (foursquare_pw_empty);
   roadmap_messagebox("Error", "Foursquare password is empty. You are not logged in");
}
示例#28
0
static void foursquare_un_empty(void){
   roadmap_main_remove_periodic (foursquare_un_empty);
   roadmap_messagebox("Error", "Foursquare user name is empty. You are not logged in");
}
示例#29
0
static void delayed_show_progress (void){
   roadmap_main_remove_periodic(delayed_show_progress);
   ssd_progress_msg_dialog_show( roadmap_lang_get( "Connecting Foursquare . . ." ) );
}
示例#30
0
static void request_time_out (void){
   roadmap_main_remove_periodic(request_time_out);
   ssd_progress_msg_dialog_hide();
   roadmap_messagebox("Oops", "Could not connect with Foursquare. Try again later.");
}