[hal] Move JNI helpers and sim namespace to hal namespace (#2543)

This commit is contained in:
Peter Johnson
2020-06-26 17:12:55 -07:00
committed by GitHub
parent 3cbec411c7
commit 8a80f97c06
60 changed files with 158 additions and 91 deletions

View File

@@ -1,5 +1,5 @@
/*----------------------------------------------------------------------------*/
/* Copyright (c) 2019 FIRST. All Rights Reserved. */
/* Copyright (c) 2019-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,7 +13,7 @@
#include "edu_wpi_first_hal_AddressableLEDJNI.h"
#include "hal/AddressableLED.h"
using namespace frc;
using namespace hal;
using namespace wpi::java;
static_assert(sizeof(jbyte) * 4 == sizeof(HAL_AddressableLEDData));

View File

@@ -1,5 +1,5 @@
/*----------------------------------------------------------------------------*/
/* Copyright (c) 2016-2019 FIRST. All Rights Reserved. */
/* Copyright (c) 2016-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. */
@@ -14,7 +14,7 @@
#include "hal/AnalogGyro.h"
#include "hal/handles/HandlesInternal.h"
using namespace frc;
using namespace hal;
extern "C" {
/*

View File

@@ -1,5 +1,5 @@
/*----------------------------------------------------------------------------*/
/* Copyright (c) 2016-2019 FIRST. All Rights Reserved. */
/* Copyright (c) 2016-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. */
@@ -18,7 +18,7 @@
#include "hal/Ports.h"
#include "hal/handles/HandlesInternal.h"
using namespace frc;
using namespace hal;
extern "C" {

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. */
@@ -19,7 +19,7 @@
#include "hal/CANAPI.h"
#include "hal/Errors.h"
using namespace frc;
using namespace hal;
using namespace wpi::java;
extern "C" {

View File

@@ -1,5 +1,5 @@
/*----------------------------------------------------------------------------*/
/* Copyright (c) 2016-2019 FIRST. All Rights Reserved. */
/* Copyright (c) 2016-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. */
@@ -17,7 +17,7 @@
#include "edu_wpi_first_hal_can_CANJNI.h"
#include "hal/CAN.h"
using namespace frc;
using namespace hal;
using namespace wpi::java;
extern "C" {

View File

@@ -1,5 +1,5 @@
/*----------------------------------------------------------------------------*/
/* Copyright (c) 2016-2019 FIRST. All Rights Reserved. */
/* Copyright (c) 2016-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. */
@@ -11,7 +11,7 @@
#include "hal/Ports.h"
#include "hal/Solenoid.h"
using namespace frc;
using namespace hal;
extern "C" {

View File

@@ -1,5 +1,5 @@
/*----------------------------------------------------------------------------*/
/* Copyright (c) 2016-2019 FIRST. All Rights Reserved. */
/* Copyright (c) 2016-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,7 +13,7 @@
#include "edu_wpi_first_hal_ConstantsJNI.h"
#include "hal/Constants.h"
using namespace frc;
using namespace hal;
extern "C" {
/*

View File

@@ -1,5 +1,5 @@
/*----------------------------------------------------------------------------*/
/* Copyright (c) 2016-2019 FIRST. All Rights Reserved. */
/* Copyright (c) 2016-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. */
@@ -14,7 +14,7 @@
#include "hal/Counter.h"
#include "hal/Errors.h"
using namespace frc;
using namespace hal;
extern "C" {

View File

@@ -1,5 +1,5 @@
/*----------------------------------------------------------------------------*/
/* Copyright (c) 2016-2019 FIRST. All Rights Reserved. */
/* Copyright (c) 2016-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. */
@@ -16,7 +16,7 @@
#include "hal/Ports.h"
#include "hal/handles/HandlesInternal.h"
using namespace frc;
using namespace hal;
extern "C" {

View File

@@ -1,5 +1,5 @@
/*----------------------------------------------------------------------------*/
/* Copyright (c) 2016-2019 FIRST. All Rights Reserved. */
/* Copyright (c) 2016-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. */
@@ -11,7 +11,7 @@
#include "edu_wpi_first_hal_DigitalGlitchFilterJNI.h"
#include "hal/DIO.h"
using namespace frc;
using namespace hal;
extern "C" {

View File

@@ -1,5 +1,5 @@
/*----------------------------------------------------------------------------*/
/* Copyright (c) 2019 FIRST. All Rights Reserved. */
/* Copyright (c) 2019-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. */
@@ -11,7 +11,7 @@
#include "edu_wpi_first_hal_DutyCycleJNI.h"
#include "hal/DutyCycle.h"
using namespace frc;
using namespace hal;
extern "C" {
/*

View File

@@ -1,5 +1,5 @@
/*----------------------------------------------------------------------------*/
/* Copyright (c) 2016-2019 FIRST. All Rights Reserved. */
/* Copyright (c) 2016-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. */
@@ -14,7 +14,7 @@
#include "hal/Encoder.h"
#include "hal/Errors.h"
using namespace frc;
using namespace hal;
extern "C" {

View File

@@ -19,7 +19,7 @@
#include "hal/DriverStation.h"
#include "hal/Main.h"
using namespace frc;
using namespace hal;
using namespace wpi::java;
extern "C" {

View File

@@ -1,5 +1,5 @@
/*----------------------------------------------------------------------------*/
/* Copyright (c) 2016-2019 FIRST. All Rights Reserved. */
/* Copyright (c) 2016-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. */
@@ -73,7 +73,7 @@ static const JExceptionInit exceptions[] = {
&canNotInitializedExCls},
{"edu/wpi/first/hal/util/UncleanStatusException", &uncleanStatusExCls}};
namespace frc {
namespace hal {
void ThrowUncleanStatusException(JNIEnv* env, wpi::StringRef msg,
int32_t status) {
@@ -304,14 +304,14 @@ jobject CreateHALValue(JNIEnv* env, const HAL_Value& value) {
JavaVM* GetJVM() { return jvm; }
} // namespace frc
namespace sim {
jint SimOnLoad(JavaVM* vm, void* reserved);
void SimOnUnload(JavaVM* vm, void* reserved);
} // namespace sim
using namespace frc;
} // namespace hal
using namespace hal;
extern "C" {

View File

@@ -1,5 +1,5 @@
/*----------------------------------------------------------------------------*/
/* Copyright (c) 2016-2019 FIRST. All Rights Reserved. */
/* Copyright (c) 2016-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. */
@@ -16,7 +16,7 @@
struct HAL_MatchInfo;
struct HAL_Value;
namespace frc {
namespace hal {
void ReportError(JNIEnv* env, int32_t status, bool doThrow = true);
@@ -72,6 +72,6 @@ jobject CreateHALValue(JNIEnv* env, const HAL_Value& value);
JavaVM* GetJVM();
} // namespace frc
} // namespace hal
#endif // HAL_HAL_SRC_MAIN_NATIVE_CPP_JNI_HALUTIL_H_

View File

@@ -1,5 +1,5 @@
/*----------------------------------------------------------------------------*/
/* Copyright (c) 2016-2019 FIRST. All Rights Reserved. */
/* Copyright (c) 2016-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. */
@@ -15,7 +15,7 @@
#include "edu_wpi_first_hal_I2CJNI.h"
#include "hal/I2C.h"
using namespace frc;
using namespace hal;
using namespace wpi::java;
extern "C" {

View File

@@ -18,7 +18,7 @@
#include "edu_wpi_first_hal_InterruptJNI.h"
#include "hal/Interrupts.h"
using namespace frc;
using namespace hal;
// Thread where callbacks are actually performed.
//

View File

@@ -1,5 +1,5 @@
/*----------------------------------------------------------------------------*/
/* Copyright (c) 2016-2019 FIRST. All Rights Reserved. */
/* Copyright (c) 2016-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. */
@@ -16,7 +16,7 @@
#include "edu_wpi_first_hal_NotifierJNI.h"
#include "hal/Notifier.h"
using namespace frc;
using namespace hal;
extern "C" {

View File

@@ -1,5 +1,5 @@
/*----------------------------------------------------------------------------*/
/* Copyright (c) 2016-2019 FIRST. All Rights Reserved. */
/* Copyright (c) 2016-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,7 +10,7 @@
#include "hal/PDP.h"
#include "hal/Ports.h"
using namespace frc;
using namespace hal;
extern "C" {

View File

@@ -1,5 +1,5 @@
/*----------------------------------------------------------------------------*/
/* Copyright (c) 2016-2019 FIRST. All Rights Reserved. */
/* Copyright (c) 2016-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. */
@@ -16,7 +16,7 @@
#include "hal/Ports.h"
#include "hal/handles/HandlesInternal.h"
using namespace frc;
using namespace hal;
extern "C" {

View File

@@ -1,5 +1,5 @@
/*----------------------------------------------------------------------------*/
/* Copyright (c) 2016-2019 FIRST. All Rights Reserved. */
/* Copyright (c) 2016-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,7 +13,7 @@
#include "edu_wpi_first_hal_PortsJNI.h"
#include "hal/Ports.h"
using namespace frc;
using namespace hal;
extern "C" {
/*

View File

@@ -1,5 +1,5 @@
/*----------------------------------------------------------------------------*/
/* Copyright (c) 2016-2018 FIRST. All Rights Reserved. */
/* Copyright (c) 2016-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. */
@@ -11,7 +11,7 @@
#include "edu_wpi_first_hal_PowerJNI.h"
#include "hal/Power.h"
using namespace frc;
using namespace hal;
extern "C" {

View File

@@ -1,5 +1,5 @@
/*----------------------------------------------------------------------------*/
/* Copyright (c) 2016-2019 FIRST. All Rights Reserved. */
/* Copyright (c) 2016-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. */
@@ -15,7 +15,7 @@
#include "hal/Relay.h"
#include "hal/handles/HandlesInternal.h"
using namespace frc;
using namespace hal;
extern "C" {

View File

@@ -1,5 +1,5 @@
/*----------------------------------------------------------------------------*/
/* Copyright (c) 2016-2019 FIRST. All Rights Reserved. */
/* Copyright (c) 2016-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. */
@@ -15,7 +15,7 @@
#include "edu_wpi_first_hal_SPIJNI.h"
#include "hal/SPI.h"
using namespace frc;
using namespace hal;
using namespace wpi::java;
extern "C" {

View File

@@ -1,5 +1,5 @@
/*----------------------------------------------------------------------------*/
/* Copyright (c) 2016-2019 FIRST. All Rights Reserved. */
/* Copyright (c) 2016-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. */
@@ -15,7 +15,7 @@
#include "edu_wpi_first_hal_SerialPortJNI.h"
#include "hal/SerialPort.h"
using namespace frc;
using namespace hal;
using namespace wpi::java;
extern "C" {

View File

@@ -1,5 +1,5 @@
/*----------------------------------------------------------------------------*/
/* Copyright (c) 2019 FIRST. All Rights Reserved. */
/* Copyright (c) 2019-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. */
@@ -114,7 +114,7 @@ JNIEXPORT jobject JNICALL
Java_edu_wpi_first_hal_SimDeviceJNI_getSimValue
(JNIEnv* env, jclass, jint handle)
{
return frc::CreateHALValue(env, HAL_GetSimValue(handle));
return hal::CreateHALValue(env, HAL_GetSimValue(handle));
}
/*

View File

@@ -1,5 +1,5 @@
/*----------------------------------------------------------------------------*/
/* Copyright (c) 2016-2019 FIRST. All Rights Reserved. */
/* Copyright (c) 2016-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,7 +13,7 @@
#include "hal/Solenoid.h"
#include "hal/handles/HandlesInternal.h"
using namespace frc;
using namespace hal;
extern "C" {

View File

@@ -1,5 +1,5 @@
/*----------------------------------------------------------------------------*/
/* Copyright (c) 2016-2019 FIRST. All Rights Reserved. */
/* Copyright (c) 2016-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,7 +13,7 @@
#include "edu_wpi_first_hal_ThreadsJNI.h"
#include "hal/Threads.h"
using namespace frc;
using namespace hal;
extern "C" {
/*