Diff of /trunk/src/gps.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 242 by harbaum, Wed Dec 9 19:45:36 2009 UTC revision 243 by harbaum, Mon Dec 14 20:07:54 2009 UTC
# Line 443  void gps_init(appdata_t *appdata) { Line 443  void gps_init(appdata_t *appdata) {
443      g_thread_create(gps_thread, appdata, FALSE, NULL);      g_thread_create(gps_thread, appdata, FALSE, NULL);
444  }  }
445    
446    void gps_change_state(appdata_t *appdata) {
447    }
448    
449  void gps_release(appdata_t *appdata) {  void gps_release(appdata_t *appdata) {
450    gps_unregister_all(appdata);    gps_unregister_all(appdata);
451  #ifdef USE_MAEMO  #ifdef USE_MAEMO
# Line 517  void gps_init(appdata_t *appdata) { Line 520  void gps_init(appdata_t *appdata) {
520    if(gps_state->control    if(gps_state->control
521  #if MAEMO_VERSION_MAJOR < 5  #if MAEMO_VERSION_MAJOR < 5
522       && gps_state->control->can_control       && gps_state->control->can_control
523         && appdata->use_gps
524  #endif  #endif
525       ) {       ) {
526    
527      printf("gps: Having control over GPSD and GPS is to be enabled, starting it\n");      printf("gps: Having control over GPSD and GPS is to be enabled, starting it\n");
528      location_gpsd_control_start(gps_state->control);      location_gpsd_control_start(gps_state->control);
529        gps_state->in_use = TRUE;
530      } else
531        gps_state->in_use = FALSE;
532    }
533    
534    void gps_change_state(appdata_t *appdata) {
535      gps_state_t *gps_state = appdata->gps_state;
536    
537      /* only do something if gps actually changes state */
538      if(( appdata->use_gps &&  gps_state->in_use) ||
539         (!appdata->use_gps && !gps_state->in_use))
540        return;
541    
542      if(gps_state->control
543    #if MAEMO_VERSION_MAJOR < 5
544         && gps_state->control->can_control
545    #endif
546         ) {
547        printf("gps: Having control over GPSD and GPS. ");
548    
549        if(appdata->use_gps) {
550          printf("Starting it!\n");
551          location_gpsd_control_start(gps_state->control);
552          gps_state->in_use = TRUE;
553        } else {
554          printf("Stopping it!\n");
555          location_gpsd_control_stop(gps_state->control);
556          gps_state->in_use = FALSE;
557        }
558    }    }
559  }  }
560    

Legend:
Removed from v.242  
changed lines
  Added in v.243