public static String getConnectionSuffix() {
   String connSuffix;
   if (DeviceInfo.isSimulator()) {
     connSuffix = ";deviceside=true";
   } else if ((WLANInfo.getWLANState() == WLANInfo.WLAN_STATE_CONNECTED)
       && RadioInfo.areWAFsSupported(RadioInfo.WAF_WLAN)) {
     connSuffix = ";interface=wifi";
   } else {
     String uid = null;
     ServiceBook sb = ServiceBook.getSB();
     ServiceRecord[] records = sb.findRecordsByCid("WPTCP");
     for (int i = 0; i < records.length; i++) {
       if (records[i].isValid() && !records[i].isDisabled()) {
         if (records[i].getUid() != null && records[i].getUid().length() != 0) {
           if ((records[i].getCid().toLowerCase().indexOf("wptcp") != -1)
               && (records[i].getUid().toLowerCase().indexOf("wifi") == -1)
               && (records[i].getUid().toLowerCase().indexOf("mms") == -1)) {
             uid = records[i].getUid();
             break;
           }
         }
       }
     }
     if (uid != null) {
       // WAP2 Connection
       connSuffix = ";ConnectionUID=" + uid;
     } else {
       connSuffix = ";deviceside=true";
     }
   }
   return connSuffix;
 }
 public int getSignalStrength() {
   final int level = RadioInfo.getSignalLevel();
   if (level == RadioInfo.LEVEL_NO_COVERAGE) {
     return SIGNAL_STRENGTH_UNKNOWN;
   }
   return level;
 }
  /* (non-Javadoc)
   * @see com.wayfinder.network.NetworkInfo#getNetworkWAF()
   */
  public int getNetworkWAF() {
    if (RadioInfo.getState() == RadioInfo.STATE_ON) {
      switch (RadioInfo.getNetworkType()) {
        case RadioInfo.NETWORK_GPRS:
        case RadioInfo.NETWORK_UMTS:
          return WAF_3GPP;

        case RadioInfo.NETWORK_CDMA:
          return WAF_CDMA;

        case RadioInfo.NETWORK_IDEN:
          return WAF_iDEN;

        default:
          return WAF_UNKNOWN;
      }
    }
    return WAF_NONE;
  }
  public boolean isAvailable() {
    // #ifdef DEBUG
    debug.trace("isAvailable"); // $NON-NLS-1$
    // #endif
    boolean gprs = (RadioInfo.getNetworkService() & RadioInfo.NETWORK_SERVICE_DATA) > 0;
    boolean coverage = CoverageInfo.isCoverageSufficient(CoverageInfo.COVERAGE_DIRECT);

    // #ifdef DEBUG
    debug.trace("isAvailable direct: " + gprs + " & " + coverage); // $NON-NLS-1$ //$NON-NLS-2$
    // #endif

    return coverage & gprs;
  }
  /**
   * findDMVRecord - retrieves a DMV record for a person from a Web service
   *
   * @param _license - a string of the license number to lookup
   * @return - CPerson class with relevant user information entered
   */
  public Object findDMVRecord(String _license) {
    CPerson cp = null; // this is the return object
    String xml = null;

    // make sure that there is at least one active data service network
    if (!RadioInfo.isDataServiceOperational()) {
      lastError = new String("No Data Service Available");
      return null;
    }

    // get the request from the server
    CitationCatcher_Stub serverObj = new CitationCatcher_Stub();
    try {
      xml = serverObj.getDMVResultAsXML(_license);
    } catch (JAXRPCException e) {
      lastError = e.getMessage();
    } catch (RemoteException e) {
      lastError = e.getMessage();
    }

    // fill out a person object from the returned DMV lookup results
    if (xml != null) {
      cp = new CPerson();
      XMLStringParser parser = new XMLStringParser(xml);

      cp.setElement(CPerson.LAST, parser.getNamedElement("Lname"));
      cp.setElement(CPerson.MIDDLE, parser.getNamedElement("Mname"));
      cp.setElement(CPerson.FIRST, parser.getNamedElement("Fname"));
      cp.setElement(CPerson.ADDRESS, parser.getNamedElement("Address"));
      cp.setElement(CPerson.CITY, parser.getNamedElement("City"));
      cp.setElement(CPerson.ZIP, parser.getNamedElement("Zip"));
      cp.setElement(CPerson.DOB, parser.getNamedElement("DOB"));
      cp.setElement(CPerson.SEX, parser.getNamedElement("Sex"));
      cp.setElement(CPerson.HEIGHT, parser.getNamedElement("Height"));
      cp.setElement(CPerson.WEIGHT, parser.getNamedElement("Weight"));
      cp.setElement(CPerson.ENDORSEMENTS, parser.getNamedElement("Endorsements"));
      cp.setElement(CPerson.RESTRICTIONS, parser.getNamedElement("Restrictions"));
    }
    return cp;
  }
  /**
   * getCourtInfo - return a court date and address information from the Web Service
   *
   * @param - none
   * @return - CViolation class with relevant court information entered
   */
  public Object getCourtInfo() {
    CViolation cv =
        null; // this is the return object that has the necessary court information embedded
    String xml = null; // unused (non-court info) members are left emtpy

    // make sure that there is at least one active data service network
    if (!RadioInfo.isDataServiceOperational()) {
      lastError = new String("No Data Service Available");
      return null;
    }

    // get the request from the server
    CitationCatcher_Stub serverObj = new CitationCatcher_Stub();
    try {
      xml = serverObj.getCourtInfoAsXML();
    } catch (JAXRPCException e) {
      lastError = e.getMessage();
    } catch (RemoteException e) {
      lastError = e.getMessage();
    }

    // fill out a violation object from the returned court lookup results
    if (xml != null) {
      cv = new CViolation();
      XMLStringParser parser = new XMLStringParser(xml);

      cv.setElement(CViolation.COURT_DATE, parser.getNamedElement("COURT_DATE"));
      cv.setElement(CViolation.COURT_NAME, parser.getNamedElement("COURT_NAME"));
      cv.setElement(CViolation.COURT_ADDRESS, parser.getNamedElement("COURT_ADDRESS"));
      cv.setElement(CViolation.COURT_CITY, parser.getNamedElement("COURT_CITY"));
      cv.setElement(CViolation.COURT_STATE, parser.getNamedElement("COURT_STATE"));
      cv.setElement(CViolation.COURT_ZIP, parser.getNamedElement("COURT_ZIP"));
      cv.setElement(CViolation.COURT_PHONE, parser.getNamedElement("COURT_PHONE"));
    }
    return cv;
  }
 /**
  * There is no a specific airplane mode for BB, what is possible for the user is to disable all
  * connections.
  *
  * @return true if both mobile network and Wi-Fi are disabled
  */
 public boolean isAirplaneMode() {
   return (RadioInfo.getState() == RadioInfo.STATE_OFF)
       && (WLANInfo.getWLANState() == WLANInfo.WLAN_STATE_DISCONNECTED);
 }
 public int getRadioState() {
   if (RadioInfo.getState() == RadioInfo.STATE_ON) {
     return RADIO_STATE_ON;
   }
   return RADIO_STATE_OFF;
 }
 public int getRoamingState() {
   if ((RadioInfo.getNetworkService() & RadioInfo.NETWORK_SERVICE_ROAMING) != 0) {
     return ROAMING_STATE_ROAMING;
   }
   return ROAMING_STATE_HOME;
 }