Search in sources :

Example 1 with OpModeManagerImpl

use of org.firstinspires.ftc.robotcore.internal.opmode.OpModeManagerImpl in project robotcode by OutoftheBoxFTC.

the class EventLoopManager method peerDisconnected.

@Override
public void peerDisconnected() {
    if (callback != null) {
        callback.onPeerDisconnected();
    }
    if (this.isPeerConnected) {
        // If we lose contact with the DS, then we auto-stop the robot
        OpModeManagerImpl opModeManager = eventLoop.getOpModeManager();
        // opModeManager will be null if not running FtcEventLoop right now
        if (opModeManager != null) {
            String msg = "Lost connection while running op mode: " + opModeManager.getActiveOpModeName();
            opModeManager.initActiveOpMode(OpModeManager.DEFAULT_OP_MODE_NAME);
            RobotLog.i(msg);
        } else {
            RobotLog.i("Lost connection while main event loop not active");
        }
        this.isPeerConnected = false;
    }
    remoteAddr = null;
    lastHeartbeatReceived = new ElapsedTime(0);
}
Also used : ElapsedTime(com.qualcomm.robotcore.util.ElapsedTime) OpModeManagerImpl(org.firstinspires.ftc.robotcore.internal.opmode.OpModeManagerImpl)

Aggregations

ElapsedTime (com.qualcomm.robotcore.util.ElapsedTime)1 OpModeManagerImpl (org.firstinspires.ftc.robotcore.internal.opmode.OpModeManagerImpl)1