當前位置: 首頁>>代碼示例>>Java>>正文


Java GpsSatellite.usedInFix方法代碼示例

本文整理匯總了Java中android.location.GpsSatellite.usedInFix方法的典型用法代碼示例。如果您正苦於以下問題:Java GpsSatellite.usedInFix方法的具體用法?Java GpsSatellite.usedInFix怎麽用?Java GpsSatellite.usedInFix使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在android.location.GpsSatellite的用法示例。


在下文中一共展示了GpsSatellite.usedInFix方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: convertNmeaGSA

import android.location.GpsSatellite; //導入方法依賴的package包/類
public static String convertNmeaGSA(List<GpsSatellite> satellites) {
    StringBuilder localStringBuilder = new StringBuilder();
    localStringBuilder.append("$GPGSA,,,");

    int satelliteChannelCount = 12;
    for (GpsSatellite s : satellites) {
        if ((s.getPrn() > 0) && s.usedInFix()) {
            localStringBuilder.append(String.format(Locale.getDefault(), "%02d,", s.getPrn()));
            satelliteChannelCount--;
        }
        if (satelliteChannelCount == 0) {
            break;
        }
    }
    while (satelliteChannelCount-- > 0) {
        localStringBuilder.append(",");
    }

    localStringBuilder.append(",,,4");
    localStringBuilder.append(calcNmeaCrc(localStringBuilder));
    return localStringBuilder.toString();
}
 
開發者ID:MaoJianwei,項目名稱:Android_GPS_NMEA_Server_Reader_Sender,代碼行數:23,代碼來源:MaoNmeaTools.java

示例2: onGpsStatusChanged

import android.location.GpsSatellite; //導入方法依賴的package包/類
@Override public void onGpsStatusChanged(int event) {
	gpsStatus = locationManager.getGpsStatus(gpsStatus);
	switch (event) {
		case GpsStatus.GPS_EVENT_STARTED:
		case GpsStatus.GPS_EVENT_FIRST_FIX:
		case GpsStatus.GPS_EVENT_SATELLITE_STATUS:
		case GpsStatus.GPS_EVENT_STOPPED:
		default:
	}
	int count_seen = 0;
	int count_fix = 0;
	for (GpsSatellite s: gpsStatus.getSatellites()) {
		count_seen++;
		if (s.usedInFix())
			count_fix++;
		// Log.d(TAG, "getSnr=" + s.getSnr());
	}
	// Log.d(TAG, "LocusService.onGpsStatusChanged event=" + event
		// + ", satellites=" + count_fix + "/" + count_seen + "/" + gpsStatus.getMaxSatellites()
		// + ", timeToFirstFix=" + gpsStatus.getTimeToFirstFix()
		// );
}
 
開發者ID:emdete,項目名稱:tabulae,代碼行數:23,代碼來源:LocusService.java

示例3: onLocationChanged

import android.location.GpsSatellite; //導入方法依賴的package包/類
@Override
public void onLocationChanged(Location location) {
    if (MAP_MODE == FEATURE_DRAW_LINE_GPS_MODE || MAP_MODE == FEATURE_DRAW_POLYGON_GPS_MODE
            || MAP_MODE == FEATURE_DRAW_POINT_GPS_MODE) {
        int satellitesInFix = 0;
        for (GpsSatellite sat : locationManager.getGpsStatus(null).getSatellites()) {
            if (sat.usedInFix()) {
                satellitesInFix++;
            }
        }
        if (actionMode != null) {
            int accuracy = (int) locationManager.getLastKnownLocation(LocationManager.GPS_PROVIDER).getAccuracy();
            actionMode.setTitle(accuracy + getResources().getString(R.string.gps_accuracy));
            actionMode.setSubtitle(satellitesInFix + " " + getResources().getString(R.string.sats_use_msg));
        }
    }
}
 
開發者ID:MASTUSAID,項目名稱:MAST-MOBILE,代碼行數:18,代碼來源:CaptureDataMapActivity.java

示例4: updateSats

import android.location.GpsSatellite; //導入方法依賴的package包/類
public void updateSats() {
    if ((mlocManager != null) && (ContextCompat.checkSelfPermission(this, Manifest.permission.ACCESS_FINE_LOCATION) == PackageManager.PERMISSION_GRANTED))
    {
        final GpsStatus gs = mlocManager.getGpsStatus(null);
        int sats_inview = 0;    // Satellites in view;
        int sats_used = 0;      // Satellites used in fix;

        if (gs != null) {
            Iterable<GpsSatellite> sats = gs.getSatellites();
            for (GpsSatellite sat : sats) {
                sats_inview++;
                if (sat.usedInFix()) sats_used++;
                //Log.w("myApp", "[#] GPSApplication.java - updateSats: i=" + i);
            }
            _NumberOfSatellites = sats_inview;
            _NumberOfSatellitesUsedInFix = sats_used;
        } else {
            _NumberOfSatellites = NOT_AVAILABLE;
            _NumberOfSatellitesUsedInFix = NOT_AVAILABLE;
        }
    } else {
        _NumberOfSatellites = NOT_AVAILABLE;
        _NumberOfSatellitesUsedInFix = NOT_AVAILABLE;
    }
    //Log.w("myApp", "[#] GPSApplication.java - updateSats: Total=" + _NumberOfSatellites + " Used=" + _NumberOfSatellitesUsedInFix);
}
 
開發者ID:BasicAirData,項目名稱:GPSLogger,代碼行數:27,代碼來源:GPSApplication.java

示例5: onGpsStatusChanged

import android.location.GpsSatellite; //導入方法依賴的package包/類
@Override
public void onGpsStatusChanged(int event)
{
    switch (event) {
        case GpsStatus.GPS_EVENT_STARTED:
        case GpsStatus.GPS_EVENT_STOPPED:
            mHasGPSFix = false;
            break;
        case GpsStatus.GPS_EVENT_FIRST_FIX:
            mHasGPSFix = true;
            break;

        case GpsStatus.GPS_EVENT_SATELLITE_STATUS:
            mSatellitesCount = 0;

            for (GpsSatellite sat : mLocationManager.getGpsStatus(null).getSatellites()) {
                if (sat.usedInFix()) {
                    mSatellitesCount++;
                }
            }
            break;
    }
}
 
開發者ID:nextgis,項目名稱:android_maplibui,代碼行數:24,代碼來源:TrackerService.java

示例6: formatGpsGsa

import android.location.GpsSatellite; //導入方法依賴的package包/類
public static String formatGpsGsa(GpsStatus gps) {
    String fix = "1";
    String prn = "";
    int nbr_sat = 0;
    Iterator<GpsSatellite> satellites = gps.getSatellites().iterator();
    for (int i = 0; i < 12; i++) {
        if (satellites.hasNext()) {
            GpsSatellite sat = satellites.next();
            if (sat.usedInFix()) {
                prn = prn + sat.getPrn();
                nbr_sat++;
            }
        }

        prn = prn + ",";
    }

    if (nbr_sat > 3)
        fix = "3";
    else if (nbr_sat > 0)
        fix = "2";

    //TODO: calculate DOP values
    return fix + "," + prn + ",,,";
}
 
開發者ID:offensive-security,項目名稱:nethunter-app,代碼行數:26,代碼來源:NMEA.java

示例7: onGpsStatusChanged

import android.location.GpsSatellite; //導入方法依賴的package包/類
@Override
public void onGpsStatusChanged(int event) {
	switch (event) {
	case android.location.GpsStatus.GPS_EVENT_STARTED:
		break;

	case android.location.GpsStatus.GPS_EVENT_SATELLITE_STATUS:
		satellites.clear();
		gpsStatus = locationManager.getGpsStatus(gpsStatus);
		for (GpsSatellite sat : gpsStatus.getSatellites()) {
			if (sat.usedInFix()) {
				satellites.add(sat);
			}
		}
		break;

	case android.location.GpsStatus.GPS_EVENT_FIRST_FIX:
		break;

	case android.location.GpsStatus.GPS_EVENT_STOPPED:
		break;
	}
}
 
開發者ID:pobzeb,項目名稱:ironman,代碼行數:24,代碼來源:GPSTracker.java

示例8: analyze

import android.location.GpsSatellite; //導入方法依賴的package包/類
private void analyze() {
    if (satellites != null) {
        return;
    }
    satellites = status.getSatellites().iterator();
    maxSatellites = status.getMaxSatellites();

    satCount = 0;
    satUsedInFixCount = 0;
    while( satellites.hasNext() ) {
        GpsSatellite satellite = satellites.next();
        satCount++;
        if (satellite.usedInFix()) {
            satUsedInFixCount++;
        }
    }
}
 
開發者ID:GitHubDroid,項目名稱:geodroid_master_update,代碼行數:18,代碼來源:GpsStatusInfo.java

示例9: onGpsStatusChanged

import android.location.GpsSatellite; //導入方法依賴的package包/類
@Override
public void onGpsStatusChanged(int event) {
	GpsStatus status = mLocationManager.getGpsStatus(null);
	int satsUsed = 0;
	Iterable<GpsSatellite> sats = status.getSatellites();
	for (GpsSatellite sat : sats) {
		if (sat.usedInFix()) {
			satsUsed++;
		}
	}
	if (satsUsed == 0) {
		if (mStatus != GPS_INACTIVE)
			mStatus = GPS_SEARCH;
		showStatusNoLocation();
	}
}
 
開發者ID:mvglasow,項目名稱:satstat,代碼行數:17,代碼來源:PasvLocListenerService.java

示例10: onGpsStatusChanged

import android.location.GpsSatellite; //導入方法依賴的package包/類
/**
   * Called when the status of the GPS changes. Updates GPS display.
   */
  public void onGpsStatusChanged (int event) {
GpsStatus status = locationManager.getGpsStatus(null);
int satsInView = 0;
int satsUsed = 0;
Iterable<GpsSatellite> sats = status.getSatellites();
for (GpsSatellite sat : sats) {
	satsInView++;
	if (sat.usedInFix()) {
		satsUsed++;
	}
}

if (gpsSectionFragment != null) {
  		gpsSectionFragment.onGpsStatusChanged(status, satsInView, satsUsed, sats);
  	}
  	
if (mapSectionFragment != null) {
	mapSectionFragment.onGpsStatusChanged(status, satsInView, satsUsed, sats);
}
  }
 
開發者ID:mvglasow,項目名稱:satstat,代碼行數:24,代碼來源:MainActivity.java

示例11: updateGPSInfo

import android.location.GpsSatellite; //導入方法依賴的package包/類
private void updateGPSInfo(GpsStatus s) {
    boolean fixed = false;
    int n = 0;
    int u = 0;
    if (s != null) {
        Iterator<GpsSatellite> iterator = s.getSatellites().iterator();
        while (iterator.hasNext()) {
            GpsSatellite g = iterator.next();
            n++;
            if (g.usedInFix()) {
                u++;
                fixed = true;
            }
        }
    }
    gpsInfo.fixed = fixed;
    gpsInfo.foundSatellites = n;
    gpsInfo.usedSatellites = u;
    Log.d(TAG, "updateGPSInfo : " + gpsInfo);
}
 
開發者ID:gabuzomeu,項目名稱:osmLib,代碼行數:21,代碼來源:OsmAndLocationProvider.java

示例12: getNumSatsInFix

import android.location.GpsSatellite; //導入方法依賴的package包/類
private int getNumSatsInFix(LocationManager locationManager) {
    if (ContextCompat.checkSelfPermission(this,Manifest.permission.ACCESS_FINE_LOCATION)!= PackageManager.PERMISSION_GRANTED) {
        CustomLog.e(TAG,"Logic error. no permissions to get number of satellites in fix. Cannot continue");
        return Constants.INVALID_NUMBER_OF_SATS;
    }
    int numSats=0;
    int numSatsInFix=0;
    for (GpsSatellite sat : locationManager.getGpsStatus(null).getSatellites()) {
        if(sat.usedInFix()) {
            numSatsInFix++;
        }
        numSats++;
    }
    return numSatsInFix;
}
 
開發者ID:intari,項目名稱:AndroidToolbox,代碼行數:16,代碼來源:GNSSLocationService.java

示例13: calSatelliteUseInFix

import android.location.GpsSatellite; //導入方法依賴的package包/類
public static int calSatelliteUseInFix(List<GpsSatellite> satellites) {
    int count = 0;
    for (GpsSatellite s : satellites) {
        if ((s.getPrn() > 0) && s.usedInFix())
            count++;
    }
    return count;
}
 
開發者ID:MaoJianwei,項目名稱:Android_GPS_NMEA_Server_Reader_Sender,代碼行數:9,代碼來源:MaoNmeaTools.java

示例14: onGpsStatusChanged

import android.location.GpsSatellite; //導入方法依賴的package包/類
@Override
public void onGpsStatusChanged(int arg0) {
    switch (arg0) {
    case GpsStatus.GPS_EVENT_SATELLITE_STATUS:
        GpsStatus gpsStatus = mLocationManager.getGpsStatus(null);
        int usedinfix = 0;

        if (gpsStatus != null) {
            Iterator<GpsSatellite> satellites = gpsStatus
                    .getSatellites().iterator();

            if (satellites != null) {
                while (satellites.hasNext()) {
                    GpsSatellite satellite = satellites.next();

                    if (satellite.usedInFix()) {
                        usedinfix++;
                    }
                }
            }
        }
        mUsedInFix = usedinfix;
        if (mUsedInFix < 3) {
            updateGpsSpeed(-1);
        }
        break;

    case GpsStatus.GPS_EVENT_STARTED:
        break;
    case GpsStatus.GPS_EVENT_STOPPED:
        break;
    }
}
 
開發者ID:rockcarry,項目名稱:CameraDVR,代碼行數:34,代碼來源:LocationMonitor.java

示例15: onGpsStatusChanged

import android.location.GpsSatellite; //導入方法依賴的package包/類
@Override
public void onGpsStatusChanged(int event) {
    if (event == GpsStatus.GPS_EVENT_SATELLITE_STATUS) {
        // Count fixed/visible satellites
        int fixed = 0;
        int visible = 0;
        LocationManager lm = (LocationManager) getSystemService(LOCATION_SERVICE);
        for (GpsSatellite sat : lm.getGpsStatus(null).getSatellites()) {
            visible++;
            if (sat.usedInFix())
                fixed++;
        }

        // Persist fixed/visible satellites
        Log.i(TAG, "Satellites fixed/visible=" + fixed + "/" + visible);
        SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(GpsStatusService.this);
        SharedPreferences.Editor editor = prefs.edit();
        editor.putInt(SettingsFragment.PREF_SATS_FIXED, fixed);
        editor.putInt(SettingsFragment.PREF_SATS_VISIBLE, visible);
        editor.apply();

        // Send state changed intent
        Intent intent = new Intent(GpsStatusService.this, BackgroundService.class);
        intent.setAction(BackgroundService.ACTION_STATE_CHANGED);
        startService(intent);
    }
}
 
開發者ID:M66B,項目名稱:BackPackTrackII,代碼行數:28,代碼來源:GpsStatusService.java


注:本文中的android.location.GpsSatellite.usedInFix方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。