Пример #1
0
  /**
   * Writes a info message to the respective loggers.
   *
   * @param tag the log tag
   * @param mess the message to send
   * @see RobotLog#i(String)
   * @see RobotStatus#log(Level, String, String)
   * @see Level#INFO
   */
  public static synchronized void i(String tag, String mess) {
    tag = checkNotNull(tag);
    mess = checkNotNull(mess);

    RobotLog.i(mess);
    getInstance().context.status().log(Level.INFO, tag, mess);
  }
Пример #2
0
  private void onConnectionDatagram(RobocolDatagram datagram) throws RobotCoreException {
    if (!datagram.getAddress().equals(this.currentPeerAddressAndPort)) {
      if (this.state == RobotState.DROPPED_CONNECTION) {
        this.reportRobotStatus(RobotState.RUNNING);
      }

      if (this.eventLoop != nullEventLoop) {
        this.currentPeerAddressAndPort = datagram.getAddress();
        RobotLog.i(
            "new remote peer discovered: " + this.currentPeerAddressAndPort.getHostAddress());

        try {
          this.socket.connect(this.currentPeerAddressAndPort);
        } catch (SocketException var4) {
          RobotLog.e("Unable to connect to peer:" + var4.toString());
        }

        PeerDiscovery peerDiscovery = new PeerDiscovery(PeerType.PEER);
        RobotLog.v("Sending peer discovery packet");
        RobocolDatagram dgPeerDiscovery = new RobocolDatagram(peerDiscovery);
        if (this.socket.getInetAddress() == null) {
          dgPeerDiscovery.setAddress(this.currentPeerAddressAndPort);
        }

        this.socket.send(dgPeerDiscovery);
      }
    }
  }
Пример #3
0
 public void handleDroppedConnection() {
   OpModeManager var1 = this.eventLoop.getOpModeManager();
   String var2 = "Lost connection while running op mode: " + var1.getActiveOpModeName();
   this.resetGamepads();
   var1.initActiveOpMode("Stop Robot");
   this.reportRobotStatus(RobotState.DROPPED_CONNECTION);
   RobotLog.i(var2);
 }
  public void logOpModes() {
    int var1 = this.a.size() + this.opModeBasedRegister.size();
    RobotLog.i("There are " + var1 + " Op Modes");
    Iterator var2 = this.a.entrySet().iterator();

    Entry var3;
    while (var2.hasNext()) {
      var3 = (Entry) var2.next();
      RobotLog.i("   Op Mode: " + var3.getKey());
    }

    var2 = this.opModeBasedRegister.entrySet().iterator();

    while (var2.hasNext()) {
      var3 = (Entry) var2.next();
      RobotLog.i("   Op Mode: " + var3.getKey());
    }
  }
  private void a() {
    RobotLog.i("Attempting to switch to op mode " + this.e);

    try {
      if (this.opModeBasedRegister.containsKey(this.e)) {
        this.d = this.opModeBasedRegister.get(this.e);
      } else {
        this.d = (OpMode) ((Class) this.a.get(this.e)).newInstance();
      }

      this.c = this.e;
    } catch (InstantiationException var2) {
      this.a(var2);
    } catch (IllegalAccessException var3) {
      this.a(var3);
    }

    this.i = false;
  }