Ejemplo n.º 1
0
 @Override
 protected void onResume() {
   super.onResume();
   mSerialDevice = UsbSerialProber.acquire(mUsbManager);
   Debug.d(TAG, "Resumed, mSerialDevice=" + mSerialDevice);
   if (mSerialDevice == null) {
     Debug.i(TAG, "No serial device.");
     mTextViewCmbsConnectedAns.setText(R.string.no);
     mTextViewHanConnectedDeviceAns.setText(R.string.not_available);
     mHanDeviceLinkedList.clear();
     updateHanDeviceTable();
     updateLedStatus();
   } else {
     try {
       mSerialDevice.open();
       mTextViewCmbsConnectedAns.setText(R.string.yes);
     } catch (IOException e) {
       Debug.e(TAG, "Error setting up device: " + e.getMessage());
       mTextViewCmbsConnectedAns.setText(R.string.no);
       mTextViewHanConnectedDeviceAns.setText(R.string.not_available);
       mHanDeviceLinkedList.clear();
       updateHanDeviceTable();
       updateLedStatus();
       try {
         mSerialDevice.close();
       } catch (IOException e2) {
         // Ignore.
       }
       mSerialDevice = null;
       return;
     }
     Debug.d(TAG, "Serial device: " + mSerialDevice);
   }
   onDeviceStateChange();
 }
Ejemplo n.º 2
0
  private String getVersionName() {
    String retval;

    try {
      retval = this.getPackageManager().getPackageInfo(this.getPackageName(), 0).versionName;
    } catch (NameNotFoundException e) {
      Debug.e(TAG, e.getMessage());
      retval = "Unknown";
    }
    return retval;
  }