Skip to content

Commit

Permalink
Add Timing Advance to GSM.
Browse files Browse the repository at this point in the history
  • Loading branch information
zamojski committed Apr 26, 2020
1 parent 245f1cd commit b1629e2
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,10 @@ public void update(Cell cell, CellInfo cellInfo) {
CellSignalStrengthGsm signal = gsmCellInfo.getCellSignalStrength();
int asu = signal.getAsuLevel();
int dbm = signal.getDbm();
int ta = Build.VERSION.SDK_INT >= Build.VERSION_CODES.O ? signal.getTimingAdvance() : Cell.UNKNOWN_SIGNAL;
if (asu == NeighboringCellInfo.UNKNOWN_RSSI)
asu = Cell.UNKNOWN_SIGNAL;
cell.setGsmSignalInfo(asu, dbm);
cell.setGsmSignalInfo(asu, dbm, ta);
} else if (cellInfo instanceof CellInfoWcdma) {
CellInfoWcdma wcdmaCellInfo = (CellInfoWcdma) cellInfo;
CellSignalStrengthWcdma signal = wcdmaCellInfo.getCellSignalStrength();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,8 @@ public MeasurementBuilder setTdscdmaCell(int mcc, int mnc, int lac, int cid, int
return this;
}

public MeasurementBuilder setGsmSignal(int asu, int dbm) {
c.setGsmSignalInfo(asu, dbm);
public MeasurementBuilder setGsmSignal(int asu, int dbm, int ta) {
c.setGsmSignalInfo(asu, dbm, ta);
return this;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -201,10 +201,10 @@ public void setGsmCellInfo(int mcc, int mnc, int lac, int cid) {
this.networkType = NetworkGroup.Gsm;
}

public void setGsmSignalInfo(int asu, int signalStrength) {
public void setGsmSignalInfo(int asu, int signalStrength, int timingAdvance) {
this.asu = asu;
this.dbm = signalStrength;
this.ta = UNKNOWN_SIGNAL;
this.ta = timingAdvance;
}

public void setWcdmaCellInfo(int mcc, int mnc, int lac, int cid, int psc) {
Expand Down

0 comments on commit b1629e2

Please sign in to comment.