[sim] Provide method to set the runtime type (#2539)

This is needed for extensions that effectively access real hardware and
want to disable the "simulation" parts of user code.
This commit is contained in:
Peter Johnson
2020-06-26 20:46:13 -07:00
committed by GitHub
parent 71c187a1ed
commit 629e8b41f2
6 changed files with 28 additions and 3 deletions

View File

@@ -1,5 +1,5 @@
/*----------------------------------------------------------------------------*/
/* Copyright (c) 2018-2019 FIRST. All Rights Reserved. */
/* Copyright (c) 2018-2020 FIRST. All Rights Reserved. */
/* Open Source Software - may be modified and shared by FRC teams. The code */
/* must be accompanied by the FIRST BSD license file in the root directory of */
/* the project. */
@@ -13,6 +13,10 @@ public final class SimHooks {
private SimHooks() {
}
public static void setHALRuntimeType(int type) {
SimulatorJNI.setRuntimeType(type);
}
public static void waitForProgramStart() {
SimulatorJNI.waitForProgramStart();
}

View File

@@ -1,5 +1,5 @@
/*----------------------------------------------------------------------------*/
/* Copyright (c) 2018-2019 FIRST. All Rights Reserved. */
/* Copyright (c) 2018-2020 FIRST. All Rights Reserved. */
/* Open Source Software - may be modified and shared by FRC teams. The code */
/* must be accompanied by the FIRST BSD license file in the root directory of */
/* the project. */
@@ -10,6 +10,7 @@ package edu.wpi.first.hal.sim.mockdata;
import edu.wpi.first.hal.JNIWrapper;
public class SimulatorJNI extends JNIWrapper {
public static native void setRuntimeType(int type);
public static native void waitForProgramStart();
public static native void setProgramStarted();
public static native void restartTiming();