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


Java GpsSatellite類代碼示例

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


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

示例1: onGpsStatusChanged

import android.location.GpsSatellite; //導入依賴的package包/類
public void onGpsStatusChanged(int event) {

            if (event == GpsStatus.GPS_EVENT_SATELLITE_STATUS) {
                try {
                    // Check number of satellites in list to determine fix state
                    GpsStatus status = myLocationManager.getGpsStatus(null);
                    Iterable<GpsSatellite> satellites = status.getSatellites();

                    sat_count = 0;

                    Iterator<GpsSatellite> satI = satellites.iterator();
                    while (satI.hasNext()) {
                        GpsSatellite satellite = satI.next();
                        Log.d(LogUtils.generateTag(this), "Satellite: snr=" + satellite.getSnr() + ", elevation=" + satellite.getElevation());
                        sat_count++;
                    }
                } catch (Exception e) {
                    e.printStackTrace();
                    sat_count = min_gps_sat_count + 1;
                }

                Log.d(LogUtils.generateTag(this), "#### sat_count = " + sat_count);

            }
        }
 
開發者ID:richardradics,項目名稱:MVPAndroidBootstrap,代碼行數:26,代碼來源:LocationHelper.java

示例2: b

import android.location.GpsSatellite; //導入依賴的package包/類
private void b() {
    this.m = 0;
    this.l = 0;
    GpsStatus gpsStatus = b.getGpsStatus(null);
    if (gpsStatus != null) {
        int maxSatellites = gpsStatus.getMaxSatellites();
        Iterator it = gpsStatus.getSatellites().iterator();
        if (it != null) {
            while (it.hasNext() && this.l <= maxSatellites) {
                this.l++;
                if (((GpsSatellite) it.next()).usedInFix()) {
                    this.m++;
                }
            }
        }
    }
}
 
開發者ID:JackChan1999,項目名稱:letv,代碼行數:18,代碼來源:e.java

示例3: 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

示例4: onGpsStatusChanged

import android.location.GpsSatellite; //導入依賴的package包/類
public void onGpsStatusChanged(int event) { // GPS狀態變化時的回調,如衛星數
            GpsStatus status = locationManager.getGpsStatus(null); //取當前狀態
            if(event == GpsStatus.GPS_EVENT_SATELLITE_STATUS){
                int maxSatellites = status.getMaxSatellites();
                Iterator<GpsSatellite> it = status.getSatellites().iterator();
                mSatelliteList.clear();
                int count = 0;
                while (it.hasNext() && count <= maxSatellites) {
                    GpsSatellite s = it.next();
//                Log.i("gjh","~~~~~~~~~~~~~~~~~~~~~~~~~~~" );
//                Log.i("gjh","信號:" + s.getSnr());
//                Log.i("gjh","序號:" + s.getPrn());
//                Log.i("gjh","衛星仰角:" + s.getElevation());
//                Log.i("gjh","衛星方位角 :" + s.getAzimuth());
//                Log.i("gjh","^^^^^^^^^^^^^^^^^^^^^^^^^^^^" );
                    mSatelliteList.add(s);
                    count++;
                }
            }
            mAdapter.notifyDataSetChanged();
            Log.i(TAG,mSatelliteList.size()+"" );
        }
 
開發者ID:Anler2015,項目名稱:AndroidPractice,代碼行數:23,代碼來源:GpsActivity.java

示例5: satelliteToString

import android.location.GpsSatellite; //導入依賴的package包/類
private static String satelliteToString(GpsSatellite s) {
    StringBuilder sb = new StringBuilder();
    if (s != null) {
        sb.append("GpsSatellite[" +
                "usedInFix = " + s.usedInFix() + ", " +
                "hasAlmanac = " + s.hasAlmanac() + ", " +
                "hasEphemeris = " + s.hasEphemeris() + ", " +
                "prn = " + s.getPrn() + ", " +
                "snr = " + s.getSnr() + ", " +
                "elevation = " + s.getElevation() + ", " +
                "azimuth = " + s.getAzimuth() + "]");
    } else {
        sb.append("GpsSatellite[null]");
    }
    return sb.toString();
}
 
開發者ID:jinsen47,項目名稱:PokeFaker,代碼行數:17,代碼來源:HookLocationFaker.java

示例6: fetchGpsSatellites

import android.location.GpsSatellite; //導入依賴的package包/類
public static List<GpsSatellite> fetchGpsSatellites() {
    if (cacheGpsSatelliteList == null) {
        cacheGpsSatelliteList = new ArrayList<>();
        for (FakeGpsSatellite fake: staticList) {
            GpsSatellite real = ((GpsSatellite) XposedHelpers.newInstance(GpsSatellite.class, fake.mPrn));
            XposedHelpers.setBooleanField(real, "mValid", fake.mValid);
            XposedHelpers.setBooleanField(real, "mUsedInFix", fake.mUsedInFix);
            XposedHelpers.setBooleanField(real, "mHasAlmanac", fake.mHasAlmanac);
            XposedHelpers.setBooleanField(real, "mHasEphemeris", fake.mHasEphemeris);
            XposedHelpers.setFloatField(real, "mSnr", fake.mSnr);
            XposedHelpers.setFloatField(real, "mElevation", fake.mElevation);
            XposedHelpers.setFloatField(real, "mAzimuth", fake.mAzimuth);
            cacheGpsSatelliteList.add(real);
        }
    }
    return cacheGpsSatelliteList;

}
 
開發者ID:jinsen47,項目名稱:PokeFaker,代碼行數:19,代碼來源:HookLocationFaker.java

示例7: updateGpsStatus

import android.location.GpsSatellite; //導入依賴的package包/類
private String updateGpsStatus(int event, GpsStatus status) {  
    StringBuilder sb2 = new StringBuilder("");  
    if (status == null) {  
    	uHandler.sendEmptyMessage(1);
        sb2.append(getResources().getString(R.string.label_gps_satellitenumber) +0);  
    } else if (event == GpsStatus.GPS_EVENT_SATELLITE_STATUS) {  
        int maxSatellites = status.getMaxSatellites();  
        Iterator<GpsSatellite> it = status.getSatellites().iterator();  
        numSatelliteList.clear();  
        int count = 0;  
        while (it.hasNext() && count <= maxSatellites) {  
            GpsSatellite s = it.next();  
            numSatelliteList.add(s);  
            count++;  
        }  
        sb2.append(getResources().getString(R.string.label_gps_satellitenumber) + numSatelliteList.size());  
        uHandler.sendEmptyMessage(1);
    }  
      
    return sb2.toString();  
}
 
開發者ID:li-yu,項目名稱:iTester,代碼行數:22,代碼來源:GPSActivity.java

示例8: onGpsStatusChanged

import android.location.GpsSatellite; //導入依賴的package包/類
public void onGpsStatusChanged(int event) {

        switch(event)
        {
            case GpsStatus.GPS_EVENT_SATELLITE_STATUS:
                m_locationManager.getGpsStatus(m_status);
                Iterable<GpsSatellite> iSatellite=m_status.getSatellites();
                Iterator<GpsSatellite> iterator=iSatellite.iterator();
                ArrayList<QtSatInfo> satInfo=new ArrayList<QtSatInfo>();
                int index=0;
                while(iterator.hasNext())
                {
                    GpsSatellite gpsSat=iterator.next();

                    satInfo.add(new QtSatInfo(gpsSat.getPrn(),gpsSat.getSnr(),
                            gpsSat.getElevation(), gpsSat.getAzimuth()));
                    index++;
                }

                if(0!=index)
                    gpsSatelliteDataUpdated(satInfo.toArray());
                break;
        }

    }
 
開發者ID:harmattan,項目名稱:uds,代碼行數:26,代碼來源:QtLocation.java

示例9: 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

示例10: b

import android.location.GpsSatellite; //導入依賴的package包/類
private void b()
{
    m = 0;
    l = 0;
    GpsStatus gpsstatus = b.getGpsStatus(null);
    if (gpsstatus != null)
    {
        int i1 = gpsstatus.getMaxSatellites();
        Iterator iterator = gpsstatus.getSatellites().iterator();
        if (iterator != null)
        {
            while (iterator.hasNext() && l <= i1) 
            {
                l = 1 + l;
                if (((GpsSatellite)iterator.next()).usedInFix())
                {
                    m = 1 + m;
                }
            }
        }
    }
}
 
開發者ID:vishnudevk,項目名稱:MiBandDecompiled,代碼行數:23,代碼來源:e.java

示例11: 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

示例12: 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

示例13: 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

示例14: updateStatus

import android.location.GpsSatellite; //導入依賴的package包/類
private void updateStatus(GpsStatus status) {
    setStarted(true);	        
    Iterator<GpsSatellite> satellites = status.getSatellites().iterator();
    if (mPrns == null) {
        int length = status.getMaxSatellites();
        mPrns = new int[length];
        mSnrs = new float[length];
        mSvElevations = new float[length];
        mSvAzimuths = new float[length];
    }
    mSvCount = 0;	       
    while (satellites.hasNext()) {
        GpsSatellite satellite = satellites.next();
        int prn = satellite.getPrn();
        mPrns[mSvCount] = prn;
        mSnrs[mSvCount] = satellite.getSnr();
        mSvElevations[mSvCount] = satellite.getElevation();
        mSvAzimuths[mSvCount] = satellite.getAzimuth();	            
        mSvCount++;
    }
    mAdapter.notifyDataSetChanged();
}
 
開發者ID:takyonxxx,項目名稱:Flight-Computer-Android-Flightradar24,代碼行數:23,代碼來源:GpsSkyActivity.java

示例15: setSats

import android.location.GpsSatellite; //導入依賴的package包/類
public void setSats(GpsStatus status) {
    Iterator<GpsSatellite> satellites = status.getSatellites().iterator();

    if (mSnrs == null) {
        int length = status.getMaxSatellites();
        mSnrs = new float[length];
        mElevs = new float[length];
        mAzims = new float[length];
    }

    mSvCount = 0;
    while (satellites.hasNext()) {
        GpsSatellite satellite = satellites.next();
        mSnrs[mSvCount] = satellite.getSnr();
        mElevs[mSvCount] = satellite.getElevation();
        mAzims[mSvCount] = satellite.getAzimuth();
        mSvCount++;
    }

    mStarted = true;
    invalidate();
}
 
開發者ID:takyonxxx,項目名稱:Flight-Computer-Android-Flightradar24,代碼行數:23,代碼來源:GpsSkyView.java


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