/[zanavi_public1]/navit/navit/android/src/com/zoffcc/applications/zanavi/NavitVehicle.java
ZANavi

Diff of /navit/navit/android/src/com/zoffcc/applications/zanavi/NavitVehicle.java

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

Revision 35 Revision 36
81 public static long last_f_fix = 0; 81 public static long last_f_fix = 0;
82 public Bundle gps_extras = null; 82 public Bundle gps_extras = null;
83 public static GpsStatus gps_status = null; 83 public static GpsStatus gps_status = null;
84 public static Boolean update_location_in_progress = false; 84 public static Boolean update_location_in_progress = false;
85 85
86 static long last_gps_status_update = 0L;
87
86 public static Location last_location = null; 88 public static Location last_location = null;
87 89
88 public static native void VehicleCallback(double lat, double lon, float speed, float direction, double height, float radius, long gpstime); 90 public static native void VehicleCallback(double lat, double lon, float speed, float direction, double height, float radius, long gpstime);
89 91
90 public static void VehicleCallback2(Location location) 92 public static void VehicleCallback2(Location location)
387 { 389 {
388 public void onGpsStatusChanged(int event) 390 public void onGpsStatusChanged(int event)
389 { 391 {
390 if (event == GpsStatus.GPS_EVENT_SATELLITE_STATUS) 392 if (event == GpsStatus.GPS_EVENT_SATELLITE_STATUS)
391 { 393 {
394 if (last_gps_status_update + 2200 < System.currentTimeMillis())
395 {
396 last_gps_status_update = System.currentTimeMillis();
397
392 // get new gpsstatus -------- 398 // get new gpsstatus --------
393 399
394 sats1_old = Navit.sats; 400 sats1_old = Navit.sats;
395 satsInFix1_old = Navit.satsInFix; 401 satsInFix1_old = Navit.satsInFix;
396 402
397 GpsStatus stat = locationManager.getGpsStatus(null); 403 GpsStatus stat = locationManager.getGpsStatus(null);
398 404
399 Navit.sats = 0; 405 Navit.sats = 0;
400 Navit.satsInFix = 0; 406 Navit.satsInFix = 0;
401 407
402 try 408 try
403 { 409 {
404 Iterator<GpsSatellite> localIterator = stat.getSatellites().iterator(); 410 Iterator<GpsSatellite> localIterator = stat.getSatellites().iterator();
405 while (localIterator.hasNext()) 411 while (localIterator.hasNext())
406 {
407 GpsSatellite localGpsSatellite = (GpsSatellite) localIterator.next();
408 Navit.sats++;
409 if (localGpsSatellite.usedInFix())
410 { 412 {
413 GpsSatellite localGpsSatellite = (GpsSatellite) localIterator.next();
414 Navit.sats++;
415 if (localGpsSatellite.usedInFix())
416 {
411 Navit.satsInFix++; 417 Navit.satsInFix++;
418 }
412 } 419 }
413 }
414 420
415 System.out.println("checking sat status update"); 421 // System.out.println("checking sat status update");
416 422
417 if ((sats1_old != Navit.sats) || (satsInFix1_old != Navit.satsInFix)) 423 if ((sats1_old != Navit.sats) || (satsInFix1_old != Navit.satsInFix))
418 {
419 System.out.println("sat status update -> changed");
420 if (Navit.PREF_show_sat_status)
421 { 424 {
425 //System.out.println("sat status update -> changed");
426 if (Navit.PREF_show_sat_status)
427 {
422 // redraw NavitOSDJava 428 // redraw NavitOSDJava
423 Message msg = NavitOSDJava.progress_handler_.obtainMessage(); 429 Message msg = NavitOSDJava.progress_handler_.obtainMessage();
424 Bundle b = new Bundle(); 430 Bundle b = new Bundle();
425 msg.what = 1; 431 msg.what = 1;
426 msg.setData(b); 432 msg.setData(b);
427 NavitOSDJava.progress_handler_.sendMessage(msg); 433 NavitOSDJava.progress_handler_.sendMessage(msg);
434 }
428 } 435 }
429 } 436 }
430 }
431 catch (Exception e) 437 catch (Exception e)
432 { 438 {
433 e.printStackTrace(); 439 e.printStackTrace();
434 } 440 }
441 }
442
435 // Navit.set_debug_messages3_wrapper("sat: " + Navit.satsInFix + "/" + Navit.sats); 443 // Navit.set_debug_messages3_wrapper("sat: " + Navit.satsInFix + "/" + Navit.sats);
436 // System.out.println("Statellites: " + Navit.satsInFix + "/" + Navit.sats); 444 // System.out.println("Statellites: " + Navit.satsInFix + "/" + Navit.sats);
437 // get new gpsstatus -------- 445 // get new gpsstatus --------
438 } 446 }
439 } 447 }
460 else 468 else
461 { 469 {
462 //Log.e("NavitVehicle", "call VehicleCallback 004"); 470 //Log.e("NavitVehicle", "call VehicleCallback 004");
463 VehicleCallback2(mock_location); 471 VehicleCallback2(mock_location);
464 } 472 }
473 }
474 }
475 catch (Exception e)
476 {
477 e.printStackTrace();
478 }
479 }
480
481 public static void set_mock_location__fast_no_speed(Location mock_location)
482 {
483 try
484 {
485 //locationManager_s.setTestProviderLocation("ZANavi_mock", mock_location);
486 // mock_location;
487 // System.out.println("llllllll" + mock_location.getLatitude() + " " + mock_location.getLongitude());
488 if (mock_location != null)
489 {
490 //Log.e("NavitVehicle", "call VehicleCallback 004");
491 VehicleCallback2(mock_location);
465 } 492 }
466 } 493 }
467 catch (Exception e) 494 catch (Exception e)
468 { 495 {
469 e.printStackTrace(); 496 e.printStackTrace();

Legend:
Removed from v.35  
changed lines
  Added in v.36

   
Visit the ZANavi Wiki