Android Open Source - satstat Cell Tower Lte






From Project

Back to project page satstat.

License

The source code is released under:

GNU General Public License

If you think the Android project satstat listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

package com.vonglasow.michael.satstat.data;
//from ww  w.  ja  va  2s .c o m
public class CellTowerLte extends CellTower {
  public static String ALT_ID = "pci";
  public static String FAMILY = "lte";
  
  private int ci;
  private int tac;
  private int mcc;
  private int mnc;
  private int pci;
  
  public CellTowerLte(int mcc, int mnc, int tac, int ci, int pci) {
    super();
    this.setMcc(mcc);
    this.setMnc(mnc);
    this.setTac(tac);
    this.setCi(ci);
    this.setPci(pci);
    this.generation = 4;
  }
  
  /**
   * Returns the alternate cell identity in text form.
   * <p>
   * For UMTS networks this string has the following form:
   * <p>
   * {@code lte:pci-nnn}
   * <p>
   * The first is a string which uniquely identifies the network family.
   * It is followed by a colon, the string {@code pci} to denote an alternate
   * cell identity, a dash and the physical cell identity (PCI) with no
   * leading zeroes.
   * <p> 
   * A result is only returned for cells with a valid PCI. In all other
   * cases, {@code null} is returned. 
   */
  public String getAltText() {
    return getAltText(this.pci);
  }

  /**
   * Converts a PSC to an alternate identity string, or {@code null} if the
   * PSC is invalid. 
   */
  public static String getAltText(int pci) {
    if ((pci == CellTower.UNKNOWN) || (pci == Integer.MAX_VALUE))
      return null;
    return String.format("%s:%s-%d", FAMILY, ALT_ID, pci);
  }
  
  public int getCi() {
    return this.ci;
  }
  
  public int getTac() {
    return this.tac;
  }
  
  public int getMcc() {
    return this.mcc;
  }
  
  public int getMnc() {
    return this.mnc;
  }
  
  public int getPci() {
    return this.pci;
  }

  /**
   * Returns the cell identity in text form.
   * <p>
   * For LTE networks this string has the following form:
   * <p>
   * {@code lte:mcc-mnc-tac-ci}
   * <p>
   * The first is a string which uniquely identifies the network family.
   * It is followed by a colon and a sequence of country code, network code,
   * Tracking Area Code and Cell ID, separated by dashes and with no leading
   * zeroes. 
   */
  @Override
  public String getText() {
    return getText(mcc, mnc, tac, ci);
  }
  
  /**
   * Converts a MCC/MNC/TAC/CI tuple to an identity string, or
   * {@code null} if CI is invalid.
   */
  public static String getText(int mcc, int mnc, int tac, int ci) {
    int iMcc = ((mcc == -1) || (mcc == Integer.MAX_VALUE)) ? CellTower.UNKNOWN : mcc;
    int iMnc = ((mnc == -1) || (mnc == Integer.MAX_VALUE)) ? CellTower.UNKNOWN : mnc;
    int iTac = ((tac == -1) || (tac == Integer.MAX_VALUE)) ? CellTower.UNKNOWN : tac;
    if ((ci == -1) || (ci == Integer.MAX_VALUE))
      return null;
    else
      return String.format("%s:%d-%d-%d-%d", FAMILY, iMcc, iMnc, iTac, ci);
  }
  
  /**
   * Sets signal strength dBm based on ASU.
   * <p>
   * ASU can be converted into dBm with the formula:
   * {@code dBm = -113 + 2 * asu}. The reporting range is from -113 dBm to
   * -51 dBm (0 to 31). Values outside this range will be ignored. Refer to
   * 3GPP TS 27.007 (Ver 10.3.0) Sec 8.69
   */
  // or 3GPP TS 27.007 8.5
  public void setAsu(int asu){
    if ((asu >= 0) || (asu <= 31))
      this.setDbm(-113 + 2 * asu);
  }
  
  public void setCi(int ci) {
    if (ci != Integer.MAX_VALUE)
      this.ci = ci;
    else
      this.ci = CellTower.UNKNOWN;
  }
  
  public void setTac(int tac) {
    if (tac != Integer.MAX_VALUE)
      this.tac = tac;
    else
      this.tac = CellTower.UNKNOWN;
  }
  
  public void setMcc(int mcc) {
    if (mcc != Integer.MAX_VALUE)
      this.mcc = mcc;
    else
      this.mcc = CellTower.UNKNOWN;
  }
  
  public void setMnc(int mnc) {
    if (mnc != Integer.MAX_VALUE)
      this.mnc = mnc;
    else
      this.mnc = CellTower.UNKNOWN;
  }
  
  public void setPci(int pci) {
    if ((pci != Integer.MAX_VALUE) && (pci != -1)) {
      this.pci = pci;
      this.generation = 3;
    } else
      this.pci = CellTower.UNKNOWN;
  }
}




Java Source Code List

com.vonglasow.michael.satstat.AboutActivity.java
com.vonglasow.michael.satstat.GpsEventReceiver.java
com.vonglasow.michael.satstat.MainActivity.java
com.vonglasow.michael.satstat.PasvLocListenerService.java
com.vonglasow.michael.satstat.SettingsActivity.java
com.vonglasow.michael.satstat.WifiCapabilities.java
com.vonglasow.michael.satstat.data.CellTowerCdma.java
com.vonglasow.michael.satstat.data.CellTowerGsm.java
com.vonglasow.michael.satstat.data.CellTowerListCdma.java
com.vonglasow.michael.satstat.data.CellTowerListGsm.java
com.vonglasow.michael.satstat.data.CellTowerListLte.java
com.vonglasow.michael.satstat.data.CellTowerList.java
com.vonglasow.michael.satstat.data.CellTowerLte.java
com.vonglasow.michael.satstat.data.CellTower.java
com.vonglasow.michael.satstat.mapsforge.FileLRUCache.java
com.vonglasow.michael.satstat.mapsforge.ImageFileNameFilter.java
com.vonglasow.michael.satstat.mapsforge.PersistentTileCache.java
com.vonglasow.michael.satstat.widgets.GpsSnrView.java
com.vonglasow.michael.satstat.widgets.GpsStatusView.java
com.vonglasow.michael.satstat.widgets.LocProviderPreference.java
com.vonglasow.michael.satstat.widgets.MapViewPager.java
com.vonglasow.michael.satstat.widgets.NetworkTypePreference.java
com.vonglasow.michael.satstat.widgets.SquareView.java