本文整理匯總了Java中android.location.GpsSatellite.getPrn方法的典型用法代碼示例。如果您正苦於以下問題:Java GpsSatellite.getPrn方法的具體用法?Java GpsSatellite.getPrn怎麽用?Java GpsSatellite.getPrn使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類android.location.GpsSatellite
的用法示例。
在下文中一共展示了GpsSatellite.getPrn方法的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的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();
}
示例2: 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();
}
示例3: 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 + ",,,";
}
示例4: 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;
}
示例5: onGpsStatusChanged
import android.location.GpsSatellite; //導入方法依賴的package包/類
public void onGpsStatusChanged(int event) {
switch (event) {
case GpsStatus.GPS_EVENT_FIRST_FIX:
Log.i(TAG, "第一次定位");
intent.putExtra("GPS_info", "第一次定位");
sendBroadcast(intent);
break;
case GpsStatus.GPS_EVENT_SATELLITE_STATUS:
// 獲取當前狀態
gs = locationManager.getGpsStatus(null);
int maxSatellites = gs.getMaxSatellites();// 獲取衛星顆數的默認最大值
Iterator<GpsSatellite> iters = gs.getSatellites().iterator();
// 創建一個迭代器保存所有衛星
int count = 0;
String info = "";
while (iters.hasNext() && count <= maxSatellites) {
GpsSatellite s = iters.next();
count++;
info += count + "\t:" + s.getPrn() + "\t信噪比:" + s.getSnr()
+ "\t方位角:" + s.getAzimuth() + "\t海拔:"
+ s.getElevation() + "\n";
}
if (count != 0)
Status = "\n搜索到:" + count + "顆衛星\n" + info;
else
Status = "\n未搜索到衛星\n";
// Log.i(TAG, "您當前的位置是:\n" + lastLocation + Status);
intent.putExtra("GPS_info", "您當前的位置是:\n" + lastLocation
+ Status);
sendBroadcast(intent);
break;
case GpsStatus.GPS_EVENT_STARTED:// 定位啟動
Log.i(TAG, "定位啟動");
intent.putExtra("GPS_info", "定位啟動");
sendBroadcast(intent);
break;
case GpsStatus.GPS_EVENT_STOPPED:// 定位結束
Log.i(TAG, "定位結束");
intent.putExtra("GPS_info", "定位結束");
sendBroadcast(intent);
break;
}
}
示例6: initializeGrid
import android.location.GpsSatellite; //導入方法依賴的package包/類
/**
* Initializes the SNR grid.
* <p>
* This method iterates through {@link #mSats} to determine which ranges of
* NMEA IDs will be drawn.
*/
protected void initializeGrid() {
// iterate through list to find out how many bars to draw
if (mSats != null)
for (GpsSatellite sat : mSats) {
int prn = sat.getPrn();
if (prn < 1) {
Log.wtf(TAG, String.format("Got satellite with invalid NMEA ID %d", prn));
} else if (prn <= 32) {
draw_1_32 = true;
} else if (prn <= 54) {
draw_33_54 = true;
} else if (prn <= 64) {
// most likely an extended SBAS range, display the lower range, too
draw_33_54 = true;
draw_55_64 = true;
} else if (prn <= 88) {
draw_65_88 = true;
} else if (prn <= 96) {
// most likely an extended GLONASS range, display the lower range, too
draw_65_88 = true;
draw_89_96 = true;
} else if (prn <= 192) {
draw_97_192 = true; // TODO: do we really want to enable this huge 96-sat block?
Log.w(TAG, String.format("Got satellite with NMEA ID %d (from the huge unassigned 97-192 range)", prn));
} else if (prn <= 195) {
draw_193_195 = true;
} else if (prn <= 200) {
// most likely an extended QZSS range, display the lower range, too
draw_193_195 = true;
draw_196_200 = true;
} else if (prn <= 235) {
draw_201_235 = true;
} else if (prn <= 300) {
draw_236_300 = true; // TODO: same as above, do we really want to enable this?
} else if (prn <= 336) {
draw_301_336 = true;
} else {
Log.w(TAG, String.format("Got satellite with NMEA ID %d, possibly unsupported system", prn));
}
}
/*
* If we didn't get any valid ranges, display at least the GPS range.
* No need to check for extended ranges here - if they get drawn, so
* will their corresponding base range.
*/
if (!(draw_1_32 || draw_33_54 || draw_65_88 || draw_97_192 || draw_193_195 || draw_201_235
|| draw_236_300 || draw_301_336))
draw_1_32 = true;
}