From 8a80f97c06d4c909a8a45cd278d7b32275262946 Mon Sep 17 00:00:00 2001 From: Peter Johnson Date: Fri, 26 Jun 2020 17:12:55 -0700 Subject: [PATCH] [hal] Move JNI helpers and sim namespace to hal namespace (#2543) --- hal/simjni.gradle | 2 ++ hal/src/main/native/cpp/jni/AddressableLEDJNI.cpp | 4 ++-- hal/src/main/native/cpp/jni/AnalogGyroJNI.cpp | 4 ++-- hal/src/main/native/cpp/jni/AnalogJNI.cpp | 4 ++-- hal/src/main/native/cpp/jni/CANAPIJNI.cpp | 4 ++-- hal/src/main/native/cpp/jni/CANJNI.cpp | 4 ++-- hal/src/main/native/cpp/jni/CompressorJNI.cpp | 4 ++-- hal/src/main/native/cpp/jni/ConstantsJNI.cpp | 4 ++-- hal/src/main/native/cpp/jni/CounterJNI.cpp | 4 ++-- hal/src/main/native/cpp/jni/DIOJNI.cpp | 4 ++-- hal/src/main/native/cpp/jni/DigitalGlitchFilterJNI.cpp | 4 ++-- hal/src/main/native/cpp/jni/DutyCycleJNI.cpp | 4 ++-- hal/src/main/native/cpp/jni/EncoderJNI.cpp | 4 ++-- hal/src/main/native/cpp/jni/HAL.cpp | 2 +- hal/src/main/native/cpp/jni/HALUtil.cpp | 10 +++++----- hal/src/main/native/cpp/jni/HALUtil.h | 6 +++--- hal/src/main/native/cpp/jni/I2CJNI.cpp | 4 ++-- hal/src/main/native/cpp/jni/InterruptJNI.cpp | 2 +- hal/src/main/native/cpp/jni/NotifierJNI.cpp | 4 ++-- hal/src/main/native/cpp/jni/PDPJNI.cpp | 4 ++-- hal/src/main/native/cpp/jni/PWMJNI.cpp | 4 ++-- hal/src/main/native/cpp/jni/PortsJNI.cpp | 4 ++-- hal/src/main/native/cpp/jni/PowerJNI.cpp | 4 ++-- hal/src/main/native/cpp/jni/RelayJNI.cpp | 4 ++-- hal/src/main/native/cpp/jni/SPIJNI.cpp | 4 ++-- hal/src/main/native/cpp/jni/SerialPortJNI.cpp | 4 ++-- hal/src/main/native/cpp/jni/SimDeviceJNI.cpp | 4 ++-- hal/src/main/native/cpp/jni/SolenoidJNI.cpp | 4 ++-- hal/src/main/native/cpp/jni/ThreadsJNI.cpp | 4 ++-- hal/src/main/native/sim/jni/AccelerometerDataJNI.cpp | 4 +++- hal/src/main/native/sim/jni/AddressableLEDDataJNI.cpp | 3 ++- hal/src/main/native/sim/jni/AnalogGyroDataJNI.cpp | 4 +++- hal/src/main/native/sim/jni/AnalogInDataJNI.cpp | 4 +++- hal/src/main/native/sim/jni/AnalogOutDataJNI.cpp | 4 +++- hal/src/main/native/sim/jni/AnalogTriggerDataJNI.cpp | 4 +++- hal/src/main/native/sim/jni/BufferCallbackStore.cpp | 7 +++++-- hal/src/main/native/sim/jni/BufferCallbackStore.h | 4 +++- hal/src/main/native/sim/jni/CallbackStore.cpp | 7 +++++-- hal/src/main/native/sim/jni/CallbackStore.h | 4 +++- .../main/native/sim/jni/ConstBufferCallbackStore.cpp | 7 +++++-- hal/src/main/native/sim/jni/ConstBufferCallbackStore.h | 4 +++- hal/src/main/native/sim/jni/DIODataJNI.cpp | 4 +++- hal/src/main/native/sim/jni/DigitalPWMDataJNI.cpp | 4 +++- hal/src/main/native/sim/jni/DriverStationDataJNI.cpp | 1 + hal/src/main/native/sim/jni/DutyCycleDataJNI.cpp | 4 +++- hal/src/main/native/sim/jni/EncoderDataJNI.cpp | 2 ++ hal/src/main/native/sim/jni/I2CDataJNI.cpp | 4 +++- hal/src/main/native/sim/jni/PCMDataJNI.cpp | 4 +++- hal/src/main/native/sim/jni/PDPDataJNI.cpp | 4 +++- hal/src/main/native/sim/jni/PWMDataJNI.cpp | 4 +++- hal/src/main/native/sim/jni/RelayDataJNI.cpp | 4 +++- hal/src/main/native/sim/jni/RoboRioDataJNI.cpp | 4 +++- .../main/native/sim/jni/SPIAccelerometerDataJNI.cpp | 4 +++- hal/src/main/native/sim/jni/SPIDataJNI.cpp | 4 +++- hal/src/main/native/sim/jni/SimDeviceDataJNI.cpp | 5 ++++- hal/src/main/native/sim/jni/SimDeviceDataJNI.h | 4 +++- hal/src/main/native/sim/jni/SimulatorJNI.cpp | 4 +++- hal/src/main/native/sim/jni/SimulatorJNI.h | 4 +++- .../sim/jni/SpiReadAutoReceiveBufferCallbackStore.cpp | 7 +++++-- .../sim/jni/SpiReadAutoReceiveBufferCallbackStore.h | 4 +++- 60 files changed, 158 insertions(+), 91 deletions(-) diff --git a/hal/simjni.gradle b/hal/simjni.gradle index c1aef73dc4..7cc7e5f880 100644 --- a/hal/simjni.gradle +++ b/hal/simjni.gradle @@ -67,6 +67,7 @@ task generateAthenaSimFiles() { out.println ''' static JavaVM* jvm = nullptr; +namespace hal { namespace sim { jint SimOnLoad(JavaVM* vm, void* reserved) { jvm = vm; @@ -85,6 +86,7 @@ void SimOnUnload(JavaVM * vm, void* reserved) { jvm = nullptr; } } +} static void ThrowSimException(JNIEnv* env) { diff --git a/hal/src/main/native/cpp/jni/AddressableLEDJNI.cpp b/hal/src/main/native/cpp/jni/AddressableLEDJNI.cpp index 3f76e6a88c..3d74b24f68 100644 --- a/hal/src/main/native/cpp/jni/AddressableLEDJNI.cpp +++ b/hal/src/main/native/cpp/jni/AddressableLEDJNI.cpp @@ -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)); diff --git a/hal/src/main/native/cpp/jni/AnalogGyroJNI.cpp b/hal/src/main/native/cpp/jni/AnalogGyroJNI.cpp index 35b7414435..c06e5139da 100644 --- a/hal/src/main/native/cpp/jni/AnalogGyroJNI.cpp +++ b/hal/src/main/native/cpp/jni/AnalogGyroJNI.cpp @@ -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" { /* diff --git a/hal/src/main/native/cpp/jni/AnalogJNI.cpp b/hal/src/main/native/cpp/jni/AnalogJNI.cpp index 5571d55453..8b920ac495 100644 --- a/hal/src/main/native/cpp/jni/AnalogJNI.cpp +++ b/hal/src/main/native/cpp/jni/AnalogJNI.cpp @@ -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" { diff --git a/hal/src/main/native/cpp/jni/CANAPIJNI.cpp b/hal/src/main/native/cpp/jni/CANAPIJNI.cpp index 7ac7cf66ad..bf28b54915 100644 --- a/hal/src/main/native/cpp/jni/CANAPIJNI.cpp +++ b/hal/src/main/native/cpp/jni/CANAPIJNI.cpp @@ -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" { diff --git a/hal/src/main/native/cpp/jni/CANJNI.cpp b/hal/src/main/native/cpp/jni/CANJNI.cpp index 9278c24a3b..42b484b5a7 100644 --- a/hal/src/main/native/cpp/jni/CANJNI.cpp +++ b/hal/src/main/native/cpp/jni/CANJNI.cpp @@ -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" { diff --git a/hal/src/main/native/cpp/jni/CompressorJNI.cpp b/hal/src/main/native/cpp/jni/CompressorJNI.cpp index 75a5e0a336..c214c603dc 100644 --- a/hal/src/main/native/cpp/jni/CompressorJNI.cpp +++ b/hal/src/main/native/cpp/jni/CompressorJNI.cpp @@ -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" { diff --git a/hal/src/main/native/cpp/jni/ConstantsJNI.cpp b/hal/src/main/native/cpp/jni/ConstantsJNI.cpp index fb1ae0b516..9c4aa63834 100644 --- a/hal/src/main/native/cpp/jni/ConstantsJNI.cpp +++ b/hal/src/main/native/cpp/jni/ConstantsJNI.cpp @@ -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" { /* diff --git a/hal/src/main/native/cpp/jni/CounterJNI.cpp b/hal/src/main/native/cpp/jni/CounterJNI.cpp index 41dedabb00..06cbceb9e3 100644 --- a/hal/src/main/native/cpp/jni/CounterJNI.cpp +++ b/hal/src/main/native/cpp/jni/CounterJNI.cpp @@ -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" { diff --git a/hal/src/main/native/cpp/jni/DIOJNI.cpp b/hal/src/main/native/cpp/jni/DIOJNI.cpp index 9c44b4c0b5..428dd99b06 100644 --- a/hal/src/main/native/cpp/jni/DIOJNI.cpp +++ b/hal/src/main/native/cpp/jni/DIOJNI.cpp @@ -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" { diff --git a/hal/src/main/native/cpp/jni/DigitalGlitchFilterJNI.cpp b/hal/src/main/native/cpp/jni/DigitalGlitchFilterJNI.cpp index fbbaadb77c..cfb504d938 100644 --- a/hal/src/main/native/cpp/jni/DigitalGlitchFilterJNI.cpp +++ b/hal/src/main/native/cpp/jni/DigitalGlitchFilterJNI.cpp @@ -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" { diff --git a/hal/src/main/native/cpp/jni/DutyCycleJNI.cpp b/hal/src/main/native/cpp/jni/DutyCycleJNI.cpp index 510ca009c0..b191374b57 100644 --- a/hal/src/main/native/cpp/jni/DutyCycleJNI.cpp +++ b/hal/src/main/native/cpp/jni/DutyCycleJNI.cpp @@ -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" { /* diff --git a/hal/src/main/native/cpp/jni/EncoderJNI.cpp b/hal/src/main/native/cpp/jni/EncoderJNI.cpp index e5aa7e897e..11686a6fe0 100644 --- a/hal/src/main/native/cpp/jni/EncoderJNI.cpp +++ b/hal/src/main/native/cpp/jni/EncoderJNI.cpp @@ -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" { diff --git a/hal/src/main/native/cpp/jni/HAL.cpp b/hal/src/main/native/cpp/jni/HAL.cpp index f60dce4379..421dc38b59 100644 --- a/hal/src/main/native/cpp/jni/HAL.cpp +++ b/hal/src/main/native/cpp/jni/HAL.cpp @@ -19,7 +19,7 @@ #include "hal/DriverStation.h" #include "hal/Main.h" -using namespace frc; +using namespace hal; using namespace wpi::java; extern "C" { diff --git a/hal/src/main/native/cpp/jni/HALUtil.cpp b/hal/src/main/native/cpp/jni/HALUtil.cpp index 26b791914a..2938f45ddf 100644 --- a/hal/src/main/native/cpp/jni/HALUtil.cpp +++ b/hal/src/main/native/cpp/jni/HALUtil.cpp @@ -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" { diff --git a/hal/src/main/native/cpp/jni/HALUtil.h b/hal/src/main/native/cpp/jni/HALUtil.h index c035f75ab1..0a192da14a 100644 --- a/hal/src/main/native/cpp/jni/HALUtil.h +++ b/hal/src/main/native/cpp/jni/HALUtil.h @@ -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_ diff --git a/hal/src/main/native/cpp/jni/I2CJNI.cpp b/hal/src/main/native/cpp/jni/I2CJNI.cpp index 7812bdb7e7..de27df63c3 100644 --- a/hal/src/main/native/cpp/jni/I2CJNI.cpp +++ b/hal/src/main/native/cpp/jni/I2CJNI.cpp @@ -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" { diff --git a/hal/src/main/native/cpp/jni/InterruptJNI.cpp b/hal/src/main/native/cpp/jni/InterruptJNI.cpp index f32b126d49..d18ef275d2 100644 --- a/hal/src/main/native/cpp/jni/InterruptJNI.cpp +++ b/hal/src/main/native/cpp/jni/InterruptJNI.cpp @@ -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. // diff --git a/hal/src/main/native/cpp/jni/NotifierJNI.cpp b/hal/src/main/native/cpp/jni/NotifierJNI.cpp index 874d750a82..ed0b324452 100644 --- a/hal/src/main/native/cpp/jni/NotifierJNI.cpp +++ b/hal/src/main/native/cpp/jni/NotifierJNI.cpp @@ -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" { diff --git a/hal/src/main/native/cpp/jni/PDPJNI.cpp b/hal/src/main/native/cpp/jni/PDPJNI.cpp index f649a8ddc4..bb28fdf310 100644 --- a/hal/src/main/native/cpp/jni/PDPJNI.cpp +++ b/hal/src/main/native/cpp/jni/PDPJNI.cpp @@ -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" { diff --git a/hal/src/main/native/cpp/jni/PWMJNI.cpp b/hal/src/main/native/cpp/jni/PWMJNI.cpp index 80293c448e..085cd0c199 100644 --- a/hal/src/main/native/cpp/jni/PWMJNI.cpp +++ b/hal/src/main/native/cpp/jni/PWMJNI.cpp @@ -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" { diff --git a/hal/src/main/native/cpp/jni/PortsJNI.cpp b/hal/src/main/native/cpp/jni/PortsJNI.cpp index 1adb7fb5c8..65fabd48a8 100644 --- a/hal/src/main/native/cpp/jni/PortsJNI.cpp +++ b/hal/src/main/native/cpp/jni/PortsJNI.cpp @@ -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" { /* diff --git a/hal/src/main/native/cpp/jni/PowerJNI.cpp b/hal/src/main/native/cpp/jni/PowerJNI.cpp index 9184e9e3da..6fc42b4c38 100644 --- a/hal/src/main/native/cpp/jni/PowerJNI.cpp +++ b/hal/src/main/native/cpp/jni/PowerJNI.cpp @@ -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" { diff --git a/hal/src/main/native/cpp/jni/RelayJNI.cpp b/hal/src/main/native/cpp/jni/RelayJNI.cpp index c058435f0a..ce433074bb 100644 --- a/hal/src/main/native/cpp/jni/RelayJNI.cpp +++ b/hal/src/main/native/cpp/jni/RelayJNI.cpp @@ -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" { diff --git a/hal/src/main/native/cpp/jni/SPIJNI.cpp b/hal/src/main/native/cpp/jni/SPIJNI.cpp index 7962e214e0..d7709e230d 100644 --- a/hal/src/main/native/cpp/jni/SPIJNI.cpp +++ b/hal/src/main/native/cpp/jni/SPIJNI.cpp @@ -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" { diff --git a/hal/src/main/native/cpp/jni/SerialPortJNI.cpp b/hal/src/main/native/cpp/jni/SerialPortJNI.cpp index 9fe9d92a33..13f1f99e11 100644 --- a/hal/src/main/native/cpp/jni/SerialPortJNI.cpp +++ b/hal/src/main/native/cpp/jni/SerialPortJNI.cpp @@ -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" { diff --git a/hal/src/main/native/cpp/jni/SimDeviceJNI.cpp b/hal/src/main/native/cpp/jni/SimDeviceJNI.cpp index d9652ccf2b..b69a8bb44c 100644 --- a/hal/src/main/native/cpp/jni/SimDeviceJNI.cpp +++ b/hal/src/main/native/cpp/jni/SimDeviceJNI.cpp @@ -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)); } /* diff --git a/hal/src/main/native/cpp/jni/SolenoidJNI.cpp b/hal/src/main/native/cpp/jni/SolenoidJNI.cpp index 4e6f139233..4877db38bd 100644 --- a/hal/src/main/native/cpp/jni/SolenoidJNI.cpp +++ b/hal/src/main/native/cpp/jni/SolenoidJNI.cpp @@ -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" { diff --git a/hal/src/main/native/cpp/jni/ThreadsJNI.cpp b/hal/src/main/native/cpp/jni/ThreadsJNI.cpp index d4620e2224..a26a4bf776 100644 --- a/hal/src/main/native/cpp/jni/ThreadsJNI.cpp +++ b/hal/src/main/native/cpp/jni/ThreadsJNI.cpp @@ -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" { /* diff --git a/hal/src/main/native/sim/jni/AccelerometerDataJNI.cpp b/hal/src/main/native/sim/jni/AccelerometerDataJNI.cpp index 8964a417e9..0b47a265d5 100644 --- a/hal/src/main/native/sim/jni/AccelerometerDataJNI.cpp +++ b/hal/src/main/native/sim/jni/AccelerometerDataJNI.cpp @@ -1,5 +1,5 @@ /*----------------------------------------------------------------------------*/ -/* Copyright (c) 2018 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. */ @@ -11,6 +11,8 @@ #include "edu_wpi_first_hal_sim_mockdata_AccelerometerDataJNI.h" #include "mockdata/AccelerometerData.h" +using namespace hal; + extern "C" { /* diff --git a/hal/src/main/native/sim/jni/AddressableLEDDataJNI.cpp b/hal/src/main/native/sim/jni/AddressableLEDDataJNI.cpp index 530eae2e6f..b5e8293408 100644 --- a/hal/src/main/native/sim/jni/AddressableLEDDataJNI.cpp +++ b/hal/src/main/native/sim/jni/AddressableLEDDataJNI.cpp @@ -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. */ @@ -14,6 +14,7 @@ static_assert(sizeof(jbyte) * 4 == sizeof(HAL_AddressableLEDData)); +using namespace hal; using namespace wpi::java; extern "C" { diff --git a/hal/src/main/native/sim/jni/AnalogGyroDataJNI.cpp b/hal/src/main/native/sim/jni/AnalogGyroDataJNI.cpp index 08d18de51d..9bd780acb5 100644 --- a/hal/src/main/native/sim/jni/AnalogGyroDataJNI.cpp +++ b/hal/src/main/native/sim/jni/AnalogGyroDataJNI.cpp @@ -1,5 +1,5 @@ /*----------------------------------------------------------------------------*/ -/* Copyright (c) 2018 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. */ @@ -11,6 +11,8 @@ #include "edu_wpi_first_hal_sim_mockdata_AnalogGyroDataJNI.h" #include "mockdata/AnalogGyroData.h" +using namespace hal; + extern "C" { /* diff --git a/hal/src/main/native/sim/jni/AnalogInDataJNI.cpp b/hal/src/main/native/sim/jni/AnalogInDataJNI.cpp index c6cee7b5c6..53e0fb9b60 100644 --- a/hal/src/main/native/sim/jni/AnalogInDataJNI.cpp +++ b/hal/src/main/native/sim/jni/AnalogInDataJNI.cpp @@ -1,5 +1,5 @@ /*----------------------------------------------------------------------------*/ -/* Copyright (c) 2018 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. */ @@ -11,6 +11,8 @@ #include "edu_wpi_first_hal_sim_mockdata_AnalogInDataJNI.h" #include "mockdata/AnalogInData.h" +using namespace hal; + extern "C" { /* diff --git a/hal/src/main/native/sim/jni/AnalogOutDataJNI.cpp b/hal/src/main/native/sim/jni/AnalogOutDataJNI.cpp index af9d6d6bee..b70566b12b 100644 --- a/hal/src/main/native/sim/jni/AnalogOutDataJNI.cpp +++ b/hal/src/main/native/sim/jni/AnalogOutDataJNI.cpp @@ -1,5 +1,5 @@ /*----------------------------------------------------------------------------*/ -/* Copyright (c) 2018 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. */ @@ -11,6 +11,8 @@ #include "edu_wpi_first_hal_sim_mockdata_AnalogOutDataJNI.h" #include "mockdata/AnalogOutData.h" +using namespace hal; + extern "C" { /* diff --git a/hal/src/main/native/sim/jni/AnalogTriggerDataJNI.cpp b/hal/src/main/native/sim/jni/AnalogTriggerDataJNI.cpp index 66af737341..9a5b5c171c 100644 --- a/hal/src/main/native/sim/jni/AnalogTriggerDataJNI.cpp +++ b/hal/src/main/native/sim/jni/AnalogTriggerDataJNI.cpp @@ -1,5 +1,5 @@ /*----------------------------------------------------------------------------*/ -/* Copyright (c) 2018 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. */ @@ -11,6 +11,8 @@ #include "edu_wpi_first_hal_sim_mockdata_AnalogTriggerDataJNI.h" #include "mockdata/AnalogTriggerData.h" +using namespace hal; + extern "C" { /* diff --git a/hal/src/main/native/sim/jni/BufferCallbackStore.cpp b/hal/src/main/native/sim/jni/BufferCallbackStore.cpp index 3c9941e2cd..95a60c5460 100644 --- a/hal/src/main/native/sim/jni/BufferCallbackStore.cpp +++ b/hal/src/main/native/sim/jni/BufferCallbackStore.cpp @@ -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. */ @@ -17,13 +17,15 @@ #include "hal/handles/UnlimitedHandleResource.h" #include "mockdata/NotifyListener.h" +using namespace hal; +using namespace hal::sim; using namespace wpi::java; -using namespace sim; static hal::UnlimitedHandleResource* callbackHandles; +namespace hal { namespace sim { void InitializeBufferStore() { static hal::UnlimitedHandleResource(env, obj); diff --git a/hal/src/main/native/sim/jni/BufferCallbackStore.h b/hal/src/main/native/sim/jni/BufferCallbackStore.h index 6b472ac830..9c632229f5 100644 --- a/hal/src/main/native/sim/jni/BufferCallbackStore.h +++ b/hal/src/main/native/sim/jni/BufferCallbackStore.h @@ -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. */ @@ -17,6 +17,7 @@ #include "hal/handles/UnlimitedHandleResource.h" #include "mockdata/NotifyListener.h" +namespace hal { namespace sim { class BufferCallbackStore { public: @@ -43,3 +44,4 @@ SIM_JniHandle AllocateBufferCallback(JNIEnv* env, jint index, jobject callback, void FreeBufferCallback(JNIEnv* env, SIM_JniHandle handle, jint index, FreeBufferCallbackFunc freeCallback); } // namespace sim +} // namespace hal diff --git a/hal/src/main/native/sim/jni/CallbackStore.cpp b/hal/src/main/native/sim/jni/CallbackStore.cpp index 318ab1e50c..5b31adbceb 100644 --- a/hal/src/main/native/sim/jni/CallbackStore.cpp +++ b/hal/src/main/native/sim/jni/CallbackStore.cpp @@ -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. */ @@ -17,13 +17,15 @@ #include "hal/handles/UnlimitedHandleResource.h" #include "mockdata/NotifyListener.h" +using namespace hal; +using namespace hal::sim; using namespace wpi::java; -using namespace sim; static hal::UnlimitedHandleResource* callbackHandles; +namespace hal { namespace sim { void InitializeStore() { static hal::UnlimitedHandleResource(env, obj); diff --git a/hal/src/main/native/sim/jni/CallbackStore.h b/hal/src/main/native/sim/jni/CallbackStore.h index eacf3149e3..b61be0d344 100644 --- a/hal/src/main/native/sim/jni/CallbackStore.h +++ b/hal/src/main/native/sim/jni/CallbackStore.h @@ -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. */ @@ -17,6 +17,7 @@ #include "hal/handles/UnlimitedHandleResource.h" #include "mockdata/NotifyListener.h" +namespace hal { namespace sim { class CallbackStore { public: @@ -64,3 +65,4 @@ void FreeChannelCallback(JNIEnv* env, SIM_JniHandle handle, jint index, void FreeCallbackNoIndex(JNIEnv* env, SIM_JniHandle handle, FreeCallbackNoIndexFunc freeCallback); } // namespace sim +} // namespace hal diff --git a/hal/src/main/native/sim/jni/ConstBufferCallbackStore.cpp b/hal/src/main/native/sim/jni/ConstBufferCallbackStore.cpp index d68198378f..6bfaaebaf6 100644 --- a/hal/src/main/native/sim/jni/ConstBufferCallbackStore.cpp +++ b/hal/src/main/native/sim/jni/ConstBufferCallbackStore.cpp @@ -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. */ @@ -17,13 +17,15 @@ #include "hal/handles/UnlimitedHandleResource.h" #include "mockdata/NotifyListener.h" +using namespace hal; +using namespace hal::sim; using namespace wpi::java; -using namespace sim; static hal::UnlimitedHandleResource* callbackHandles; +namespace hal { namespace sim { void InitializeConstBufferStore() { static hal::UnlimitedHandleResource(env, obj); diff --git a/hal/src/main/native/sim/jni/ConstBufferCallbackStore.h b/hal/src/main/native/sim/jni/ConstBufferCallbackStore.h index 2164a74796..92c2e8d20e 100644 --- a/hal/src/main/native/sim/jni/ConstBufferCallbackStore.h +++ b/hal/src/main/native/sim/jni/ConstBufferCallbackStore.h @@ -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. */ @@ -17,6 +17,7 @@ #include "hal/handles/UnlimitedHandleResource.h" #include "mockdata/NotifyListener.h" +namespace hal { namespace sim { class ConstBufferCallbackStore { public: @@ -44,3 +45,4 @@ SIM_JniHandle AllocateConstBufferCallback( void FreeConstBufferCallback(JNIEnv* env, SIM_JniHandle handle, jint index, FreeConstBufferCallbackFunc freeCallback); } // namespace sim +} // namespace hal diff --git a/hal/src/main/native/sim/jni/DIODataJNI.cpp b/hal/src/main/native/sim/jni/DIODataJNI.cpp index 2ad55f9b62..8f28b5dd7e 100644 --- a/hal/src/main/native/sim/jni/DIODataJNI.cpp +++ b/hal/src/main/native/sim/jni/DIODataJNI.cpp @@ -1,5 +1,5 @@ /*----------------------------------------------------------------------------*/ -/* Copyright (c) 2018 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. */ @@ -11,6 +11,8 @@ #include "edu_wpi_first_hal_sim_mockdata_DIODataJNI.h" #include "mockdata/DIOData.h" +using namespace hal; + extern "C" { /* diff --git a/hal/src/main/native/sim/jni/DigitalPWMDataJNI.cpp b/hal/src/main/native/sim/jni/DigitalPWMDataJNI.cpp index 0800917dde..2efa0ede18 100644 --- a/hal/src/main/native/sim/jni/DigitalPWMDataJNI.cpp +++ b/hal/src/main/native/sim/jni/DigitalPWMDataJNI.cpp @@ -1,5 +1,5 @@ /*----------------------------------------------------------------------------*/ -/* Copyright (c) 2018 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. */ @@ -11,6 +11,8 @@ #include "edu_wpi_first_hal_sim_mockdata_DigitalPWMDataJNI.h" #include "mockdata/DigitalPWMData.h" +using namespace hal; + extern "C" { /* diff --git a/hal/src/main/native/sim/jni/DriverStationDataJNI.cpp b/hal/src/main/native/sim/jni/DriverStationDataJNI.cpp index 6a1432dbd3..985d6b84b5 100644 --- a/hal/src/main/native/sim/jni/DriverStationDataJNI.cpp +++ b/hal/src/main/native/sim/jni/DriverStationDataJNI.cpp @@ -16,6 +16,7 @@ #include "mockdata/DriverStationData.h" #include "mockdata/MockHooks.h" +using namespace hal; using namespace wpi::java; extern "C" { diff --git a/hal/src/main/native/sim/jni/DutyCycleDataJNI.cpp b/hal/src/main/native/sim/jni/DutyCycleDataJNI.cpp index d746ce1a20..d36ed50562 100644 --- a/hal/src/main/native/sim/jni/DutyCycleDataJNI.cpp +++ b/hal/src/main/native/sim/jni/DutyCycleDataJNI.cpp @@ -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,6 +11,8 @@ #include "edu_wpi_first_hal_sim_mockdata_DutyCycleDataJNI.h" #include "mockdata/DutyCycleData.h" +using namespace hal; + extern "C" { /* diff --git a/hal/src/main/native/sim/jni/EncoderDataJNI.cpp b/hal/src/main/native/sim/jni/EncoderDataJNI.cpp index 8d6eef8d13..9cc603c4d4 100644 --- a/hal/src/main/native/sim/jni/EncoderDataJNI.cpp +++ b/hal/src/main/native/sim/jni/EncoderDataJNI.cpp @@ -11,6 +11,8 @@ #include "edu_wpi_first_hal_sim_mockdata_EncoderDataJNI.h" #include "mockdata/EncoderData.h" +using namespace hal; + extern "C" { /* diff --git a/hal/src/main/native/sim/jni/I2CDataJNI.cpp b/hal/src/main/native/sim/jni/I2CDataJNI.cpp index 14b32921ce..d6a9b02746 100644 --- a/hal/src/main/native/sim/jni/I2CDataJNI.cpp +++ b/hal/src/main/native/sim/jni/I2CDataJNI.cpp @@ -1,5 +1,5 @@ /*----------------------------------------------------------------------------*/ -/* Copyright (c) 2018 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,8 @@ #include "edu_wpi_first_hal_sim_mockdata_I2CDataJNI.h" #include "mockdata/I2CData.h" +using namespace hal; + extern "C" { /* diff --git a/hal/src/main/native/sim/jni/PCMDataJNI.cpp b/hal/src/main/native/sim/jni/PCMDataJNI.cpp index de6f738267..62d75883f5 100644 --- a/hal/src/main/native/sim/jni/PCMDataJNI.cpp +++ b/hal/src/main/native/sim/jni/PCMDataJNI.cpp @@ -1,5 +1,5 @@ /*----------------------------------------------------------------------------*/ -/* Copyright (c) 2018 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. */ @@ -11,6 +11,8 @@ #include "edu_wpi_first_hal_sim_mockdata_PCMDataJNI.h" #include "mockdata/PCMData.h" +using namespace hal; + extern "C" { /* diff --git a/hal/src/main/native/sim/jni/PDPDataJNI.cpp b/hal/src/main/native/sim/jni/PDPDataJNI.cpp index 5d39e87e57..14022100cc 100644 --- a/hal/src/main/native/sim/jni/PDPDataJNI.cpp +++ b/hal/src/main/native/sim/jni/PDPDataJNI.cpp @@ -1,5 +1,5 @@ /*----------------------------------------------------------------------------*/ -/* Copyright (c) 2018 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. */ @@ -11,6 +11,8 @@ #include "edu_wpi_first_hal_sim_mockdata_PDPDataJNI.h" #include "mockdata/PDPData.h" +using namespace hal; + extern "C" { /* diff --git a/hal/src/main/native/sim/jni/PWMDataJNI.cpp b/hal/src/main/native/sim/jni/PWMDataJNI.cpp index b8a7c41e54..075c3b8726 100644 --- a/hal/src/main/native/sim/jni/PWMDataJNI.cpp +++ b/hal/src/main/native/sim/jni/PWMDataJNI.cpp @@ -1,5 +1,5 @@ /*----------------------------------------------------------------------------*/ -/* Copyright (c) 2018 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. */ @@ -11,6 +11,8 @@ #include "edu_wpi_first_hal_sim_mockdata_PWMDataJNI.h" #include "mockdata/PWMData.h" +using namespace hal; + extern "C" { /* diff --git a/hal/src/main/native/sim/jni/RelayDataJNI.cpp b/hal/src/main/native/sim/jni/RelayDataJNI.cpp index bf8540781c..416c702cc2 100644 --- a/hal/src/main/native/sim/jni/RelayDataJNI.cpp +++ b/hal/src/main/native/sim/jni/RelayDataJNI.cpp @@ -1,5 +1,5 @@ /*----------------------------------------------------------------------------*/ -/* Copyright (c) 2018 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. */ @@ -11,6 +11,8 @@ #include "edu_wpi_first_hal_sim_mockdata_RelayDataJNI.h" #include "mockdata/RelayData.h" +using namespace hal; + extern "C" { /* diff --git a/hal/src/main/native/sim/jni/RoboRioDataJNI.cpp b/hal/src/main/native/sim/jni/RoboRioDataJNI.cpp index d69e89544a..7509fc4db9 100644 --- a/hal/src/main/native/sim/jni/RoboRioDataJNI.cpp +++ b/hal/src/main/native/sim/jni/RoboRioDataJNI.cpp @@ -1,5 +1,5 @@ /*----------------------------------------------------------------------------*/ -/* Copyright (c) 2018 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. */ @@ -11,6 +11,8 @@ #include "edu_wpi_first_hal_sim_mockdata_RoboRioDataJNI.h" #include "mockdata/RoboRioData.h" +using namespace hal; + extern "C" { /* diff --git a/hal/src/main/native/sim/jni/SPIAccelerometerDataJNI.cpp b/hal/src/main/native/sim/jni/SPIAccelerometerDataJNI.cpp index ca12f79dcf..3ba99921f2 100644 --- a/hal/src/main/native/sim/jni/SPIAccelerometerDataJNI.cpp +++ b/hal/src/main/native/sim/jni/SPIAccelerometerDataJNI.cpp @@ -1,5 +1,5 @@ /*----------------------------------------------------------------------------*/ -/* Copyright (c) 2018 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. */ @@ -11,6 +11,8 @@ #include "edu_wpi_first_hal_sim_mockdata_SPIAccelerometerDataJNI.h" #include "mockdata/SPIAccelerometerData.h" +using namespace hal; + extern "C" { /* diff --git a/hal/src/main/native/sim/jni/SPIDataJNI.cpp b/hal/src/main/native/sim/jni/SPIDataJNI.cpp index 4eb342c592..8ddbd82c93 100644 --- a/hal/src/main/native/sim/jni/SPIDataJNI.cpp +++ b/hal/src/main/native/sim/jni/SPIDataJNI.cpp @@ -1,5 +1,5 @@ /*----------------------------------------------------------------------------*/ -/* Copyright (c) 2018 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. */ @@ -14,6 +14,8 @@ #include "edu_wpi_first_hal_sim_mockdata_SPIDataJNI.h" #include "mockdata/SPIData.h" +using namespace hal; + extern "C" { /* diff --git a/hal/src/main/native/sim/jni/SimDeviceDataJNI.cpp b/hal/src/main/native/sim/jni/SimDeviceDataJNI.cpp index f6cd05e7e9..61de859107 100644 --- a/hal/src/main/native/sim/jni/SimDeviceDataJNI.cpp +++ b/hal/src/main/native/sim/jni/SimDeviceDataJNI.cpp @@ -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. */ @@ -20,6 +20,7 @@ #include "edu_wpi_first_hal_sim_mockdata_SimDeviceDataJNI.h" #include "mockdata/SimDeviceData.h" +using namespace hal; using namespace wpi::java; static JClass simDeviceInfoCls; @@ -259,6 +260,7 @@ void CallbackJNI::FreeCallback(JNIEnv* env, int32_t uid) { store->Free(env); } +namespace hal { namespace sim { bool InitializeSimDeviceDataJNI(JNIEnv* env) { @@ -295,6 +297,7 @@ void FreeSimDeviceDataJNI(JNIEnv* env) { } } // namespace sim +} // namespace hal extern "C" { diff --git a/hal/src/main/native/sim/jni/SimDeviceDataJNI.h b/hal/src/main/native/sim/jni/SimDeviceDataJNI.h index 56f6d9b322..44fc27fe98 100644 --- a/hal/src/main/native/sim/jni/SimDeviceDataJNI.h +++ b/hal/src/main/native/sim/jni/SimDeviceDataJNI.h @@ -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. */ @@ -9,7 +9,9 @@ #include +namespace hal { namespace sim { bool InitializeSimDeviceDataJNI(JNIEnv* env); void FreeSimDeviceDataJNI(JNIEnv* env); } // namespace sim +} // namespace hal diff --git a/hal/src/main/native/sim/jni/SimulatorJNI.cpp b/hal/src/main/native/sim/jni/SimulatorJNI.cpp index 9226f91850..89908f61fd 100644 --- a/hal/src/main/native/sim/jni/SimulatorJNI.cpp +++ b/hal/src/main/native/sim/jni/SimulatorJNI.cpp @@ -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. */ @@ -31,6 +31,7 @@ static jmethodID bufferCallbackCallback; static jmethodID constBufferCallbackCallback; static jmethodID spiReadAutoReceiveBufferCallbackCallback; +namespace hal { namespace sim { jint SimOnLoad(JavaVM* vm, void* reserved) { jvm = vm; @@ -104,6 +105,7 @@ jmethodID GetSpiReadAutoReceiveBufferCallback() { return spiReadAutoReceiveBufferCallbackCallback; } } // namespace sim +} // namespace hal extern "C" { /* diff --git a/hal/src/main/native/sim/jni/SimulatorJNI.h b/hal/src/main/native/sim/jni/SimulatorJNI.h index 8680396955..d6710e8b08 100644 --- a/hal/src/main/native/sim/jni/SimulatorJNI.h +++ b/hal/src/main/native/sim/jni/SimulatorJNI.h @@ -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. */ @@ -12,6 +12,7 @@ typedef HAL_Handle SIM_JniHandle; +namespace hal { namespace sim { JavaVM* GetJVM(); @@ -20,3 +21,4 @@ jmethodID GetBufferCallback(); jmethodID GetConstBufferCallback(); jmethodID GetSpiReadAutoReceiveBufferCallback(); } // namespace sim +} // namespace hal diff --git a/hal/src/main/native/sim/jni/SpiReadAutoReceiveBufferCallbackStore.cpp b/hal/src/main/native/sim/jni/SpiReadAutoReceiveBufferCallbackStore.cpp index b75bb1e9de..72538e7334 100644 --- a/hal/src/main/native/sim/jni/SpiReadAutoReceiveBufferCallbackStore.cpp +++ b/hal/src/main/native/sim/jni/SpiReadAutoReceiveBufferCallbackStore.cpp @@ -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. */ @@ -17,13 +17,15 @@ #include "hal/handles/UnlimitedHandleResource.h" #include "mockdata/NotifyListener.h" +using namespace hal; +using namespace hal::sim; using namespace wpi::java; -using namespace sim; static hal::UnlimitedHandleResource< SIM_JniHandle, SpiReadAutoReceiveBufferCallbackStore, hal::HAL_HandleEnum::SimulationJni>* callbackHandles; +namespace hal { namespace sim { void InitializeSpiBufferStore() { static hal::UnlimitedHandleResource(env, obj); diff --git a/hal/src/main/native/sim/jni/SpiReadAutoReceiveBufferCallbackStore.h b/hal/src/main/native/sim/jni/SpiReadAutoReceiveBufferCallbackStore.h index 1a03f59fe2..4a5d7381ac 100644 --- a/hal/src/main/native/sim/jni/SpiReadAutoReceiveBufferCallbackStore.h +++ b/hal/src/main/native/sim/jni/SpiReadAutoReceiveBufferCallbackStore.h @@ -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. */ @@ -18,6 +18,7 @@ #include "mockdata/NotifyListener.h" #include "mockdata/SPIData.h" +namespace hal { namespace sim { class SpiReadAutoReceiveBufferCallbackStore { public: @@ -45,3 +46,4 @@ SIM_JniHandle AllocateSpiBufferCallback( void FreeSpiBufferCallback(JNIEnv* env, SIM_JniHandle handle, jint index, FreeSpiBufferCallbackFunc freeCallback); } // namespace sim +} // namespace hal