protected void onCreate(Bundle savedInstanceState) {
   super.onCreate(savedInstanceState);
   this.f97a = this;
   setContentView(R.layout.activity_autoconfigure);
   this.f103g = new Utility(this);
   this.f98b = (Button) findViewById(R.id.configureLegacy);
   this.f99c = (Button) findViewById(R.id.configureUSB);
   try {
     this.f100d = new HardwareDeviceManager(this.f97a, null);
   } catch (RobotCoreException e) {
     this.f103g.complainToast("Failed to open the Device Manager", this.f97a);
     DbgLog.error("Failed to open deviceManager: " + e.toString());
     DbgLog.logStacktrace(e);
   }
 }
Esempio n. 2
0
  public static void logStacktrace(RobotCoreException e) {
    RobotLog.e(e.toString());
    for (StackTraceElement el : e.getStackTrace()) {
      RobotLog.e(el.toString());
    }

    if (e.isChainedException()) {
      RobotLog.e("Exception chained from:");
      if (e.getChainedException() instanceof RobotCoreException) {
        logStacktrace((RobotCoreException) e.getChainedException());
      } else {
        logStacktrace(e.getChainedException());
      }
    }
  }
    public void run() {
      while (true) {
        RobocolDatagram datagram = EventLoopManager.this.socket.recv(); // what's the timeout?
        if (EventLoopManager.this.receivingProhibited || EventLoopManager.this.socket.isClosed()) {
          return;
        }

        if (datagram == null) {
          Thread.yield();
        } else {
          if (RobotLog.hasGlobalErrorMsg()) {
            EventLoopManager.this.buildAndSendTelemetry(
                "SYSTEM_TELEMETRY", RobotLog.getGlobalErrorMsg());
          }

          try {
            switch (EventLoopManager.SyntheticClass_1.a[datagram.getMsgType().ordinal()]) {
              case 1:
                EventLoopManager.this.onGamepadDatagram(datagram);
                break;
              case 2:
                EventLoopManager.this.onHeartbeatDatagramReceived(datagram);
                break;
              case 3:
                EventLoopManager.this.onConnectionDatagram(datagram);
                break;
              case 4:
                EventLoopManager.this.onCommandDatagram(datagram);
                break;
              case 5:
                EventLoopManager.this.onEmptyDatagram();
                break;
              default:
                EventLoopManager.this.onUnknownDatagram(datagram);
            }
          } catch (RobotCoreException var3) {
            RobotLog.w("RobotCore event loop cannot process event: " + var3.toString());
          }
        }
      }
    }
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_ftc_configuration);

    RobotLog.writeLogcatToDisk(this, 1024);
    this.context = this;
    utility = new Utility(this);
    scanButton = (Button) findViewById(R.id.scanButton);
    buildInfoButtons();

    try {
      deviceManager = new ModernRoboticsDeviceManager(context, null);
      // deviceManager = new MockDeviceManager(context, null);
    } catch (RobotCoreException e) {
      utility.complainToast("Failed to open the Device Manager", context);
      DbgLog.error("Failed to open deviceManager: " + e.toString());
      DbgLog.logStacktrace(e);
    }

    preferences = PreferenceManager.getDefaultSharedPreferences(this);
  }