import android.location.GpsSatellite; //导入方法依赖的package包/类
/**
* Initializes the SNR grid.
*
* 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;
}