mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-19 00:41:43 +00:00
SCRIPT namespace replacements
This commit is contained in:
committed by
Peter Johnson
parent
ae6c043632
commit
9aca8e0fd6
@@ -11,7 +11,7 @@
|
||||
namespace {
|
||||
struct LastErrorStorage {
|
||||
int32_t status;
|
||||
wpi::SmallString<512> message;
|
||||
wpi::util::SmallString<512> message;
|
||||
};
|
||||
} // namespace
|
||||
|
||||
@@ -20,7 +20,7 @@ static LastErrorStorage& GetThreadLastError() {
|
||||
return lastError;
|
||||
}
|
||||
|
||||
namespace hal {
|
||||
namespace wpi::hal {
|
||||
void SetLastError(int32_t* status, std::string_view value) {
|
||||
LastErrorStorage& lastError = GetThreadLastError();
|
||||
lastError.message = value;
|
||||
@@ -40,13 +40,13 @@ void SetLastErrorIndexOutOfRange(int32_t* status, std::string_view message,
|
||||
void SetLastErrorPreviouslyAllocated(int32_t* status, std::string_view message,
|
||||
int32_t channel,
|
||||
std::string_view previousAllocation) {
|
||||
hal::SetLastError(status,
|
||||
wpi::hal::SetLastError(status,
|
||||
fmt::format("{} {} previously allocated.\n"
|
||||
"Location of the previous allocation:\n{}\n"
|
||||
"Location of the current allocation:",
|
||||
message, channel, previousAllocation));
|
||||
}
|
||||
} // namespace hal
|
||||
} // namespace wpi::hal
|
||||
|
||||
extern "C" {
|
||||
const char* HAL_GetLastError(int32_t* status) {
|
||||
|
||||
@@ -16,8 +16,8 @@ static void (*gMainFunc)(void*) = DefaultMain;
|
||||
static void (*gExitFunc)(void*) = DefaultExit;
|
||||
static bool gExited = false;
|
||||
struct MainObj {
|
||||
wpi::mutex gExitMutex;
|
||||
wpi::condition_variable gExitCv;
|
||||
wpi::util::mutex gExitMutex;
|
||||
wpi::util::condition_variable gExitCv;
|
||||
};
|
||||
|
||||
static MainObj* mainObj;
|
||||
@@ -33,12 +33,12 @@ static void DefaultExit(void*) {
|
||||
mainObj->gExitCv.notify_all();
|
||||
}
|
||||
|
||||
namespace hal::init {
|
||||
namespace wpi::hal::init {
|
||||
void InitializeMain() {
|
||||
static MainObj mO;
|
||||
mainObj = &mO;
|
||||
}
|
||||
} // namespace hal::init
|
||||
} // namespace wpi::hal::init
|
||||
|
||||
extern "C" {
|
||||
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
#include "wpi/hal/HALBase.h"
|
||||
#include "wpi/util/print.hpp"
|
||||
|
||||
namespace hal {
|
||||
namespace wpi::hal {
|
||||
const fpga_clock::time_point fpga_clock::min_time =
|
||||
fpga_clock::time_point(fpga_clock::duration(
|
||||
std::numeric_limits<fpga_clock::duration::rep>::min()));
|
||||
@@ -19,7 +19,7 @@ fpga_clock::time_point fpga_clock::now() noexcept {
|
||||
int32_t status = 0;
|
||||
uint64_t currentTime = HAL_GetFPGATime(&status);
|
||||
if (status != 0) {
|
||||
wpi::print(
|
||||
wpi::util::print(
|
||||
stderr,
|
||||
"Call to HAL_GetFPGATime failed in fpga_clock::now() with status {}. "
|
||||
"Initialization might have failed. Time will not be correct\n",
|
||||
@@ -29,4 +29,4 @@ fpga_clock::time_point fpga_clock::now() noexcept {
|
||||
}
|
||||
return time_point(std::chrono::microseconds(currentTime));
|
||||
}
|
||||
} // namespace hal
|
||||
} // namespace wpi::hal
|
||||
|
||||
@@ -9,11 +9,11 @@
|
||||
#include "wpi/util/SmallVector.hpp"
|
||||
#include "wpi/util/mutex.hpp"
|
||||
|
||||
namespace hal {
|
||||
static wpi::SmallVector<HandleBase*, 32>* globalHandles = nullptr;
|
||||
static wpi::mutex globalHandleMutex;
|
||||
namespace wpi::hal {
|
||||
static wpi::util::SmallVector<HandleBase*, 32>* globalHandles = nullptr;
|
||||
static wpi::util::mutex globalHandleMutex;
|
||||
HandleBase::HandleBase() {
|
||||
static wpi::SmallVector<HandleBase*, 32> gH;
|
||||
static wpi::util::SmallVector<HandleBase*, 32> gH;
|
||||
std::scoped_lock lock(globalHandleMutex);
|
||||
if (!globalHandles) {
|
||||
globalHandles = &gH;
|
||||
@@ -67,4 +67,4 @@ HAL_Handle createHandle(int16_t index, HAL_HandleEnum handleType,
|
||||
handle += index;
|
||||
return handle;
|
||||
}
|
||||
} // namespace hal
|
||||
} // namespace wpi::hal
|
||||
|
||||
@@ -9,8 +9,8 @@
|
||||
#include "wpi/hal/AddressableLED.h"
|
||||
#include "wpi/util/jni_util.hpp"
|
||||
|
||||
using namespace hal;
|
||||
using namespace wpi::java;
|
||||
using namespace wpi::hal;
|
||||
using namespace wpi::util::java;
|
||||
|
||||
static_assert(sizeof(jbyte) * 3 == sizeof(HAL_AddressableLEDData));
|
||||
|
||||
@@ -38,7 +38,7 @@ Java_org_wpilib_hardware_hal_AddressableLEDJNI_initialize
|
||||
(JNIEnv* env, jclass, jint channel)
|
||||
{
|
||||
int32_t status = 0;
|
||||
auto stack = wpi::java::GetJavaStackTrace(env, "edu.wpi.first");
|
||||
auto stack = wpi::util::java::GetJavaStackTrace(env, "edu.wpi.first");
|
||||
auto ret = HAL_InitializeAddressableLED(channel, stack.c_str(), &status);
|
||||
CheckStatusForceThrow(env, status);
|
||||
return ret;
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
#include "wpi/hal/handles/HandlesInternal.h"
|
||||
#include "wpi/util/jni_util.hpp"
|
||||
|
||||
using namespace hal;
|
||||
using namespace wpi::hal;
|
||||
|
||||
extern "C" {
|
||||
|
||||
@@ -27,7 +27,7 @@ Java_org_wpilib_hardware_hal_AnalogJNI_initializeAnalogInputPort
|
||||
(JNIEnv* env, jclass, jint channel)
|
||||
{
|
||||
int32_t status = 0;
|
||||
auto stack = wpi::java::GetJavaStackTrace(env, "edu.wpi.first");
|
||||
auto stack = wpi::util::java::GetJavaStackTrace(env, "edu.wpi.first");
|
||||
auto analog = HAL_InitializeAnalogInputPort(channel, stack.c_str(), &status);
|
||||
CheckStatusForceThrow(env, status);
|
||||
return (jint)analog;
|
||||
|
||||
@@ -13,8 +13,8 @@
|
||||
#include "wpi/hal/Errors.h"
|
||||
#include "wpi/util/jni_util.hpp"
|
||||
|
||||
using namespace hal;
|
||||
using namespace wpi::java;
|
||||
using namespace wpi::hal;
|
||||
using namespace wpi::util::java;
|
||||
|
||||
extern "C" {
|
||||
|
||||
|
||||
@@ -12,8 +12,8 @@
|
||||
#include "wpi/hal/Errors.h"
|
||||
#include "wpi/util/jni_util.hpp"
|
||||
|
||||
using namespace hal;
|
||||
using namespace wpi::java;
|
||||
using namespace wpi::hal;
|
||||
using namespace wpi::util::java;
|
||||
|
||||
extern "C" {
|
||||
|
||||
@@ -180,7 +180,7 @@ Java_org_wpilib_hardware_hal_can_CANJNI_readCANStreamSession
|
||||
uint32_t handle = static_cast<uint32_t>(sessionHandle);
|
||||
uint32_t messagesRead = 0;
|
||||
|
||||
wpi::SmallVector<HAL_CANStreamMessage, 16> messageBuffer;
|
||||
wpi::util::SmallVector<HAL_CANStreamMessage, 16> messageBuffer;
|
||||
messageBuffer.resize_for_overwrite(messagesToRead);
|
||||
|
||||
int32_t status = 0;
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
#include "wpi/hal/handles/HandlesInternal.h"
|
||||
#include "wpi/util/jni_util.hpp"
|
||||
|
||||
using namespace hal;
|
||||
using namespace wpi::hal;
|
||||
|
||||
extern "C" {
|
||||
|
||||
@@ -25,7 +25,7 @@ Java_org_wpilib_hardware_hal_CTREPCMJNI_initialize
|
||||
(JNIEnv* env, jclass, jint busId, jint module)
|
||||
{
|
||||
int32_t status = 0;
|
||||
auto stack = wpi::java::GetJavaStackTrace(env, "edu.wpi.first");
|
||||
auto stack = wpi::util::java::GetJavaStackTrace(env, "edu.wpi.first");
|
||||
auto handle = HAL_InitializeCTREPCM(busId, module, stack.c_str(), &status);
|
||||
CheckStatusForceThrow(env, status);
|
||||
return handle;
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
#include "org_wpilib_hardware_hal_ConstantsJNI.h"
|
||||
#include "wpi/hal/Constants.h"
|
||||
|
||||
using namespace hal;
|
||||
using namespace wpi::hal;
|
||||
|
||||
extern "C" {
|
||||
/*
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
#include "wpi/hal/Errors.h"
|
||||
#include "wpi/util/jni_util.hpp"
|
||||
|
||||
using namespace hal;
|
||||
using namespace wpi::hal;
|
||||
|
||||
extern "C" {
|
||||
|
||||
@@ -26,7 +26,7 @@ Java_org_wpilib_hardware_hal_CounterJNI_initializeCounter
|
||||
(JNIEnv* env, jclass, jint channel, jboolean risingEdge)
|
||||
{
|
||||
int32_t status = 0;
|
||||
auto stack = wpi::java::GetJavaStackTrace(env, "edu.wpi.first");
|
||||
auto stack = wpi::util::java::GetJavaStackTrace(env, "edu.wpi.first");
|
||||
auto counter =
|
||||
HAL_InitializeCounter(channel, risingEdge, stack.c_str(), &status);
|
||||
CheckStatusForceThrow(env, status);
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
#include "wpi/hal/handles/HandlesInternal.h"
|
||||
#include "wpi/util/jni_util.hpp"
|
||||
|
||||
using namespace hal;
|
||||
using namespace wpi::hal;
|
||||
|
||||
extern "C" {
|
||||
|
||||
@@ -28,7 +28,7 @@ Java_org_wpilib_hardware_hal_DIOJNI_initializeDIOPort
|
||||
(JNIEnv* env, jclass, jint channel, jboolean input)
|
||||
{
|
||||
int32_t status = 0;
|
||||
auto stack = wpi::java::GetJavaStackTrace(env, "edu.wpi.first");
|
||||
auto stack = wpi::util::java::GetJavaStackTrace(env, "edu.wpi.first");
|
||||
auto dio = HAL_InitializeDIOPort(channel, static_cast<uint8_t>(input),
|
||||
stack.c_str(), &status);
|
||||
CheckStatusForceThrow(env, status);
|
||||
|
||||
@@ -37,8 +37,8 @@ static_assert(org_wpilib_hardware_hal_DriverStationJNI_kMaxJoystickPOVs ==
|
||||
static_assert(org_wpilib_hardware_hal_DriverStationJNI_kMaxJoysticks ==
|
||||
HAL_kMaxJoysticks);
|
||||
|
||||
using namespace hal;
|
||||
using namespace wpi::java;
|
||||
using namespace wpi::hal;
|
||||
using namespace wpi::util::java;
|
||||
|
||||
extern "C" {
|
||||
|
||||
@@ -216,7 +216,7 @@ Java_org_wpilib_hardware_hal_DriverStationJNI_getJoystickName
|
||||
{
|
||||
WPI_String joystickName;
|
||||
HAL_GetJoystickName(&joystickName, port);
|
||||
jstring str = MakeJString(env, wpi::to_string_view(&joystickName));
|
||||
jstring str = MakeJString(env, wpi::util::to_string_view(&joystickName));
|
||||
WPI_FreeString(&joystickName);
|
||||
return str;
|
||||
}
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
#include "wpi/hal/DutyCycle.h"
|
||||
#include "wpi/util/jni_util.hpp"
|
||||
|
||||
using namespace hal;
|
||||
using namespace wpi::hal;
|
||||
|
||||
extern "C" {
|
||||
/*
|
||||
@@ -22,7 +22,7 @@ Java_org_wpilib_hardware_hal_DutyCycleJNI_initialize
|
||||
(JNIEnv* env, jclass, jint channel)
|
||||
{
|
||||
int32_t status = 0;
|
||||
auto stack = wpi::java::GetJavaStackTrace(env, "edu.wpi.first");
|
||||
auto stack = wpi::util::java::GetJavaStackTrace(env, "edu.wpi.first");
|
||||
auto handle = HAL_InitializeDutyCycle(channel, stack.c_str(), &status);
|
||||
CheckStatus(env, status);
|
||||
return handle;
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
#include "wpi/hal/Encoder.h"
|
||||
#include "wpi/hal/Errors.h"
|
||||
|
||||
using namespace hal;
|
||||
using namespace wpi::hal;
|
||||
|
||||
extern "C" {
|
||||
|
||||
|
||||
@@ -21,8 +21,8 @@
|
||||
#include "wpi/hal/Main.h"
|
||||
#include "wpi/util/jni_util.hpp"
|
||||
|
||||
using namespace hal;
|
||||
using namespace wpi::java;
|
||||
using namespace wpi::hal;
|
||||
using namespace wpi::util::java;
|
||||
|
||||
extern "C" {
|
||||
|
||||
|
||||
@@ -21,7 +21,7 @@
|
||||
#include "wpi/hal/HAL.h"
|
||||
#include "wpi/util/jni_util.hpp"
|
||||
|
||||
using namespace wpi::java;
|
||||
using namespace wpi::util::java;
|
||||
|
||||
#define kRioStatusOffset -63000
|
||||
#define kRioStatusSuccess 0
|
||||
@@ -78,7 +78,7 @@ static const JExceptionInit exceptions[] = {
|
||||
&uncleanStatusExCls},
|
||||
{"java/lang/NullPointerException", &nullPointerEx}};
|
||||
|
||||
namespace hal {
|
||||
namespace wpi::hal {
|
||||
|
||||
void ThrowUncleanStatusException(JNIEnv* env, std::string_view msg,
|
||||
int32_t status) {
|
||||
@@ -312,9 +312,9 @@ jint SimOnLoad(JavaVM* vm, void* reserved);
|
||||
void SimOnUnload(JavaVM* vm, void* reserved);
|
||||
} // namespace sim
|
||||
|
||||
} // namespace hal
|
||||
} // namespace wpi::hal
|
||||
|
||||
using namespace hal;
|
||||
using namespace wpi::hal;
|
||||
|
||||
extern "C" {
|
||||
|
||||
@@ -375,7 +375,7 @@ Java_org_wpilib_hardware_hal_HALUtil_getSerialNumber
|
||||
{
|
||||
WPI_String serialNum;
|
||||
HAL_GetSerialNumber(&serialNum);
|
||||
jstring ret = MakeJString(env, wpi::to_string_view(&serialNum));
|
||||
jstring ret = MakeJString(env, wpi::util::to_string_view(&serialNum));
|
||||
WPI_FreeString(&serialNum);
|
||||
return ret;
|
||||
}
|
||||
@@ -391,7 +391,7 @@ Java_org_wpilib_hardware_hal_HALUtil_getComments
|
||||
{
|
||||
WPI_String comments;
|
||||
HAL_GetComments(&comments);
|
||||
jstring ret = MakeJString(env, wpi::to_string_view(&comments));
|
||||
jstring ret = MakeJString(env, wpi::util::to_string_view(&comments));
|
||||
WPI_FreeString(&comments);
|
||||
return ret;
|
||||
}
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
struct HAL_MatchInfo;
|
||||
struct HAL_Value;
|
||||
|
||||
namespace hal {
|
||||
namespace wpi::hal {
|
||||
|
||||
void ReportError(JNIEnv* env, int32_t status, bool doThrow = true);
|
||||
|
||||
@@ -84,6 +84,6 @@ jobject CreateCANStreamMessage(JNIEnv* env);
|
||||
|
||||
JavaVM* GetJVM();
|
||||
|
||||
} // namespace hal
|
||||
} // namespace wpi::hal
|
||||
|
||||
#endif // HAL_HAL_SRC_MAIN_NATIVE_CPP_JNI_HALUTIL_H_
|
||||
|
||||
@@ -11,8 +11,8 @@
|
||||
#include "wpi/hal/I2C.h"
|
||||
#include "wpi/util/jni_util.hpp"
|
||||
|
||||
using namespace hal;
|
||||
using namespace wpi::java;
|
||||
using namespace wpi::hal;
|
||||
using namespace wpi::util::java;
|
||||
|
||||
extern "C" {
|
||||
|
||||
@@ -73,7 +73,7 @@ Java_org_wpilib_hardware_hal_I2CJNI_i2CTransactionB
|
||||
return 0;
|
||||
}
|
||||
|
||||
wpi::SmallVector<uint8_t, 128> recvBuf;
|
||||
wpi::util::SmallVector<uint8_t, 128> recvBuf;
|
||||
recvBuf.resize(receiveSize);
|
||||
jint returnValue =
|
||||
HAL_TransactionI2C(static_cast<HAL_I2CPort>(port), address,
|
||||
@@ -156,7 +156,7 @@ Java_org_wpilib_hardware_hal_I2CJNI_i2CReadB
|
||||
return 0;
|
||||
}
|
||||
|
||||
wpi::SmallVector<uint8_t, 128> recvBuf;
|
||||
wpi::util::SmallVector<uint8_t, 128> recvBuf;
|
||||
recvBuf.resize(receiveSize);
|
||||
jint returnValue = HAL_ReadI2C(static_cast<HAL_I2CPort>(port), address,
|
||||
recvBuf.data(), receiveSize);
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
#include "org_wpilib_hardware_hal_IMUJNI.h"
|
||||
#include "wpi/hal/IMU.h"
|
||||
|
||||
using namespace hal;
|
||||
using namespace wpi::hal;
|
||||
|
||||
namespace {
|
||||
void assertArraySize(JNIEnv* env, jarray array, int minimumSize,
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
#include "wpi/hal/Notifier.h"
|
||||
#include "wpi/util/jni_util.hpp"
|
||||
|
||||
using namespace hal;
|
||||
using namespace wpi::hal;
|
||||
|
||||
extern "C" {
|
||||
|
||||
@@ -59,7 +59,7 @@ Java_org_wpilib_hardware_hal_NotifierJNI_setNotifierName
|
||||
{
|
||||
int32_t status = 0;
|
||||
HAL_SetNotifierName((HAL_NotifierHandle)notifierHandle,
|
||||
wpi::java::JStringRef{env, name}.c_str(), &status);
|
||||
wpi::util::java::JStringRef{env, name}.c_str(), &status);
|
||||
CheckStatus(env, status);
|
||||
}
|
||||
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
#include "wpi/hal/handles/HandlesInternal.h"
|
||||
#include "wpi/util/jni_util.hpp"
|
||||
|
||||
using namespace hal;
|
||||
using namespace wpi::hal;
|
||||
|
||||
extern "C" {
|
||||
|
||||
@@ -28,7 +28,7 @@ Java_org_wpilib_hardware_hal_PWMJNI_initializePWMPort
|
||||
(JNIEnv* env, jclass, jint channel)
|
||||
{
|
||||
int32_t status = 0;
|
||||
auto stack = wpi::java::GetJavaStackTrace(env, "edu.wpi.first");
|
||||
auto stack = wpi::util::java::GetJavaStackTrace(env, "edu.wpi.first");
|
||||
auto pwm = HAL_InitializePWMPort(channel, stack.c_str(), &status);
|
||||
CheckStatusForceThrow(env, status);
|
||||
return (jint)pwm;
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
#include "org_wpilib_hardware_hal_PortsJNI.h"
|
||||
#include "wpi/hal/Ports.h"
|
||||
|
||||
using namespace hal;
|
||||
using namespace wpi::hal;
|
||||
|
||||
extern "C" {
|
||||
/*
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
#include "wpi/hal/PowerDistribution.h"
|
||||
#include "wpi/util/jni_util.hpp"
|
||||
|
||||
using namespace hal;
|
||||
using namespace wpi::hal;
|
||||
|
||||
static_assert(org_wpilib_hardware_hal_PowerDistributionJNI_AUTOMATIC_TYPE ==
|
||||
HAL_PowerDistributionType::HAL_PowerDistributionType_kAutomatic);
|
||||
@@ -33,7 +33,7 @@ Java_org_wpilib_hardware_hal_PowerDistributionJNI_initialize
|
||||
(JNIEnv* env, jclass, jint busId, jint module, jint type)
|
||||
{
|
||||
int32_t status = 0;
|
||||
auto stack = wpi::java::GetJavaStackTrace(env, "edu.wpi.first");
|
||||
auto stack = wpi::util::java::GetJavaStackTrace(env, "edu.wpi.first");
|
||||
auto handle = HAL_InitializePowerDistribution(
|
||||
busId, module, static_cast<HAL_PowerDistributionType>(type),
|
||||
stack.c_str(), &status);
|
||||
@@ -182,7 +182,7 @@ Java_org_wpilib_hardware_hal_PowerDistributionJNI_getAllCurrents
|
||||
{
|
||||
int32_t status = 0;
|
||||
int32_t size = HAL_GetPowerDistributionNumChannels(handle, &status);
|
||||
wpi::SmallVector<double, 24> storage;
|
||||
wpi::util::SmallVector<double, 24> storage;
|
||||
storage.resize_for_overwrite(size);
|
||||
|
||||
HAL_GetPowerDistributionAllChannelCurrents(handle, storage.data(), size,
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
#include "org_wpilib_hardware_hal_PowerJNI.h"
|
||||
#include "wpi/hal/Power.h"
|
||||
|
||||
using namespace hal;
|
||||
using namespace wpi::hal;
|
||||
|
||||
extern "C" {
|
||||
|
||||
|
||||
@@ -24,7 +24,7 @@ static_assert(
|
||||
org_wpilib_hardware_hal_REVPHJNI_COMPRESSOR_CONFIG_TYPE_HYBRID ==
|
||||
HAL_REVPHCompressorConfigType::HAL_REVPHCompressorConfigType_kHybrid);
|
||||
|
||||
using namespace hal;
|
||||
using namespace wpi::hal;
|
||||
|
||||
extern "C" {
|
||||
|
||||
@@ -38,7 +38,7 @@ Java_org_wpilib_hardware_hal_REVPHJNI_initialize
|
||||
(JNIEnv* env, jclass, jint busId, jint module)
|
||||
{
|
||||
int32_t status = 0;
|
||||
auto stack = wpi::java::GetJavaStackTrace(env, "edu.wpi.first");
|
||||
auto stack = wpi::util::java::GetJavaStackTrace(env, "edu.wpi.first");
|
||||
auto handle = HAL_InitializeREVPH(busId, module, stack.c_str(), &status);
|
||||
CheckStatusForceThrow(env, status);
|
||||
return handle;
|
||||
|
||||
@@ -11,8 +11,8 @@
|
||||
#include "wpi/hal/SerialPort.h"
|
||||
#include "wpi/util/jni_util.hpp"
|
||||
|
||||
using namespace hal;
|
||||
using namespace wpi::java;
|
||||
using namespace wpi::hal;
|
||||
using namespace wpi::util::java;
|
||||
|
||||
extern "C" {
|
||||
|
||||
@@ -239,7 +239,7 @@ JNIEXPORT jint JNICALL
|
||||
Java_org_wpilib_hardware_hal_SerialPortJNI_serialRead
|
||||
(JNIEnv* env, jclass, jint handle, jbyteArray dataReceived, jint size)
|
||||
{
|
||||
wpi::SmallVector<char, 128> recvBuf;
|
||||
wpi::util::SmallVector<char, 128> recvBuf;
|
||||
recvBuf.resize(size);
|
||||
int32_t status = 0;
|
||||
jint retVal = HAL_ReadSerial(static_cast<HAL_SerialPortHandle>(handle),
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
#include "wpi/hal/SimDevice.h"
|
||||
#include "wpi/util/jni_util.hpp"
|
||||
|
||||
using namespace wpi::java;
|
||||
using namespace wpi::util::java;
|
||||
|
||||
static HAL_Value ValueFromJava(jint type, jlong value1, jdouble value2) {
|
||||
HAL_Value value;
|
||||
@@ -114,7 +114,7 @@ Java_org_wpilib_hardware_hal_SimDeviceJNI_createSimValueEnum
|
||||
}
|
||||
arr.emplace_back(JStringRef{env, elem}.str());
|
||||
}
|
||||
wpi::SmallVector<const char*, 8> carr;
|
||||
wpi::util::SmallVector<const char*, 8> carr;
|
||||
for (auto&& val : arr) {
|
||||
carr.push_back(val.c_str());
|
||||
}
|
||||
@@ -148,7 +148,7 @@ Java_org_wpilib_hardware_hal_SimDeviceJNI_createSimValueEnumDouble
|
||||
arr.emplace_back(JStringRef{env, elem}.str());
|
||||
}
|
||||
|
||||
wpi::SmallVector<const char*, 8> carr;
|
||||
wpi::util::SmallVector<const char*, 8> carr;
|
||||
for (auto&& val : arr) {
|
||||
carr.push_back(val.c_str());
|
||||
}
|
||||
@@ -166,7 +166,7 @@ JNIEXPORT jobject JNICALL
|
||||
Java_org_wpilib_hardware_hal_SimDeviceJNI_getSimValue
|
||||
(JNIEnv* env, jclass, jint handle)
|
||||
{
|
||||
return hal::CreateHALValue(env, HAL_GetSimValue(handle));
|
||||
return wpi::hal::CreateHALValue(env, HAL_GetSimValue(handle));
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
#include "org_wpilib_hardware_hal_ThreadsJNI.h"
|
||||
#include "wpi/hal/Threads.h"
|
||||
|
||||
using namespace hal;
|
||||
using namespace wpi::hal;
|
||||
|
||||
extern "C" {
|
||||
/*
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
#include "wpi/util/jni_util.hpp"
|
||||
#include "wpi/util/string.h"
|
||||
|
||||
using namespace wpi::java;
|
||||
using namespace wpi::util::java;
|
||||
|
||||
extern "C" {
|
||||
|
||||
@@ -26,8 +26,8 @@ Java_org_wpilib_hardware_hal_UsageReportingJNI_report
|
||||
{
|
||||
JStringRef resourceStr{env, resource};
|
||||
JStringRef dataStr{env, data};
|
||||
WPI_String resourceWpiStr = wpi::make_string(resourceStr);
|
||||
WPI_String dataWpiStr = wpi::make_string(dataStr);
|
||||
WPI_String resourceWpiStr = wpi::util::make_string(resourceStr);
|
||||
WPI_String dataWpiStr = wpi::util::make_string(dataStr);
|
||||
return HAL_ReportUsage(&resourceWpiStr, &dataWpiStr);
|
||||
}
|
||||
|
||||
|
||||
@@ -13,8 +13,8 @@
|
||||
|
||||
static_assert(sizeof(jbyte) * 3 == sizeof(HAL_AddressableLEDData));
|
||||
|
||||
using namespace hal;
|
||||
using namespace wpi::java;
|
||||
using namespace wpi::hal;
|
||||
using namespace wpi::util::java;
|
||||
|
||||
extern "C" {
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
#include "org_wpilib_hardware_hal_simulation_AnalogInDataJNI.h"
|
||||
#include "wpi/hal/simulation/AnalogInData.h"
|
||||
|
||||
using namespace hal;
|
||||
using namespace wpi::hal;
|
||||
|
||||
extern "C" {
|
||||
|
||||
|
||||
@@ -14,22 +14,22 @@
|
||||
#include "wpi/hal/handles/UnlimitedHandleResource.h"
|
||||
#include "wpi/util/jni_util.hpp"
|
||||
|
||||
using namespace hal;
|
||||
using namespace hal::sim;
|
||||
using namespace wpi::java;
|
||||
using namespace wpi::hal;
|
||||
using namespace wpi::hal::sim;
|
||||
using namespace wpi::util::java;
|
||||
|
||||
static hal::UnlimitedHandleResource<SIM_JniHandle, BufferCallbackStore,
|
||||
hal::HAL_HandleEnum::SimulationJni>*
|
||||
static wpi::hal::UnlimitedHandleResource<SIM_JniHandle, BufferCallbackStore,
|
||||
wpi::hal::HAL_HandleEnum::SimulationJni>*
|
||||
callbackHandles;
|
||||
|
||||
namespace hal::sim {
|
||||
namespace wpi::hal::sim {
|
||||
void InitializeBufferStore() {
|
||||
static hal::UnlimitedHandleResource<SIM_JniHandle, BufferCallbackStore,
|
||||
hal::HAL_HandleEnum::SimulationJni>
|
||||
static wpi::hal::UnlimitedHandleResource<SIM_JniHandle, BufferCallbackStore,
|
||||
wpi::hal::HAL_HandleEnum::SimulationJni>
|
||||
cb;
|
||||
callbackHandles = &cb;
|
||||
}
|
||||
} // namespace hal::sim
|
||||
} // namespace wpi::hal::sim
|
||||
|
||||
void BufferCallbackStore::create(JNIEnv* env, jobject obj) {
|
||||
m_call = JGlobal<jobject>(env, obj);
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
#include "wpi/hal/simulation/NotifyListener.h"
|
||||
#include "wpi/util/jni_util.hpp"
|
||||
|
||||
namespace hal::sim {
|
||||
namespace wpi::hal::sim {
|
||||
class BufferCallbackStore {
|
||||
public:
|
||||
void create(JNIEnv* env, jobject obj);
|
||||
@@ -23,7 +23,7 @@ class BufferCallbackStore {
|
||||
int32_t getCallbackId() { return callbackId; }
|
||||
|
||||
private:
|
||||
wpi::java::JGlobal<jobject> m_call;
|
||||
wpi::util::java::JGlobal<jobject> m_call;
|
||||
int32_t callbackId;
|
||||
};
|
||||
|
||||
@@ -38,4 +38,4 @@ SIM_JniHandle AllocateBufferCallback(JNIEnv* env, jint index, jobject callback,
|
||||
RegisterBufferCallbackFunc createCallback);
|
||||
void FreeBufferCallback(JNIEnv* env, SIM_JniHandle handle, jint index,
|
||||
FreeBufferCallbackFunc freeCallback);
|
||||
} // namespace hal::sim
|
||||
} // namespace wpi::hal::sim
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
#include "org_wpilib_hardware_hal_simulation_CTREPCMDataJNI.h"
|
||||
#include "wpi/hal/simulation/CTREPCMData.h"
|
||||
|
||||
using namespace hal;
|
||||
using namespace wpi::hal;
|
||||
|
||||
extern "C" {
|
||||
|
||||
|
||||
@@ -15,22 +15,22 @@
|
||||
#include "wpi/hal/handles/UnlimitedHandleResource.h"
|
||||
#include "wpi/util/jni_util.hpp"
|
||||
|
||||
using namespace hal;
|
||||
using namespace hal::sim;
|
||||
using namespace wpi::java;
|
||||
using namespace wpi::hal;
|
||||
using namespace wpi::hal::sim;
|
||||
using namespace wpi::util::java;
|
||||
|
||||
static hal::UnlimitedHandleResource<SIM_JniHandle, CallbackStore,
|
||||
hal::HAL_HandleEnum::SimulationJni>*
|
||||
static wpi::hal::UnlimitedHandleResource<SIM_JniHandle, CallbackStore,
|
||||
wpi::hal::HAL_HandleEnum::SimulationJni>*
|
||||
callbackHandles;
|
||||
|
||||
namespace hal::sim {
|
||||
namespace wpi::hal::sim {
|
||||
void InitializeStore() {
|
||||
static hal::UnlimitedHandleResource<SIM_JniHandle, CallbackStore,
|
||||
hal::HAL_HandleEnum::SimulationJni>
|
||||
static wpi::hal::UnlimitedHandleResource<SIM_JniHandle, CallbackStore,
|
||||
wpi::hal::HAL_HandleEnum::SimulationJni>
|
||||
cb;
|
||||
callbackHandles = &cb;
|
||||
}
|
||||
} // namespace hal::sim
|
||||
} // namespace wpi::hal::sim
|
||||
|
||||
void CallbackStore::create(JNIEnv* env, jobject obj) {
|
||||
m_call = JGlobal<jobject>(env, obj);
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
#include "wpi/hal/simulation/NotifyListener.h"
|
||||
#include "wpi/util/jni_util.hpp"
|
||||
|
||||
namespace hal::sim {
|
||||
namespace wpi::hal::sim {
|
||||
class CallbackStore {
|
||||
public:
|
||||
void create(JNIEnv* env, jobject obj);
|
||||
@@ -23,7 +23,7 @@ class CallbackStore {
|
||||
int32_t getCallbackId() { return callbackId; }
|
||||
|
||||
private:
|
||||
wpi::java::JGlobal<jobject> m_call;
|
||||
wpi::util::java::JGlobal<jobject> m_call;
|
||||
int32_t callbackId;
|
||||
};
|
||||
|
||||
@@ -59,4 +59,4 @@ void FreeChannelCallback(JNIEnv* env, SIM_JniHandle handle, jint index,
|
||||
jint channel, FreeChannelCallbackFunc freeCallback);
|
||||
void FreeCallbackNoIndex(JNIEnv* env, SIM_JniHandle handle,
|
||||
FreeCallbackNoIndexFunc freeCallback);
|
||||
} // namespace hal::sim
|
||||
} // namespace wpi::hal::sim
|
||||
|
||||
@@ -14,22 +14,22 @@
|
||||
#include "wpi/hal/handles/UnlimitedHandleResource.h"
|
||||
#include "wpi/util/jni_util.hpp"
|
||||
|
||||
using namespace hal;
|
||||
using namespace hal::sim;
|
||||
using namespace wpi::java;
|
||||
using namespace wpi::hal;
|
||||
using namespace wpi::hal::sim;
|
||||
using namespace wpi::util::java;
|
||||
|
||||
static hal::UnlimitedHandleResource<SIM_JniHandle, ConstBufferCallbackStore,
|
||||
hal::HAL_HandleEnum::SimulationJni>*
|
||||
static wpi::hal::UnlimitedHandleResource<SIM_JniHandle, ConstBufferCallbackStore,
|
||||
wpi::hal::HAL_HandleEnum::SimulationJni>*
|
||||
callbackHandles;
|
||||
|
||||
namespace hal::sim {
|
||||
namespace wpi::hal::sim {
|
||||
void InitializeConstBufferStore() {
|
||||
static hal::UnlimitedHandleResource<SIM_JniHandle, ConstBufferCallbackStore,
|
||||
hal::HAL_HandleEnum::SimulationJni>
|
||||
static wpi::hal::UnlimitedHandleResource<SIM_JniHandle, ConstBufferCallbackStore,
|
||||
wpi::hal::HAL_HandleEnum::SimulationJni>
|
||||
cb;
|
||||
callbackHandles = &cb;
|
||||
}
|
||||
} // namespace hal::sim
|
||||
} // namespace wpi::hal::sim
|
||||
|
||||
void ConstBufferCallbackStore::create(JNIEnv* env, jobject obj) {
|
||||
m_call = JGlobal<jobject>(env, obj);
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
#include "wpi/hal/simulation/NotifyListener.h"
|
||||
#include "wpi/util/jni_util.hpp"
|
||||
|
||||
namespace hal::sim {
|
||||
namespace wpi::hal::sim {
|
||||
class ConstBufferCallbackStore {
|
||||
public:
|
||||
void create(JNIEnv* env, jobject obj);
|
||||
@@ -24,7 +24,7 @@ class ConstBufferCallbackStore {
|
||||
int32_t getCallbackId() { return callbackId; }
|
||||
|
||||
private:
|
||||
wpi::java::JGlobal<jobject> m_call;
|
||||
wpi::util::java::JGlobal<jobject> m_call;
|
||||
int32_t callbackId;
|
||||
};
|
||||
|
||||
@@ -39,4 +39,4 @@ SIM_JniHandle AllocateConstBufferCallback(
|
||||
RegisterConstBufferCallbackFunc createCallback);
|
||||
void FreeConstBufferCallback(JNIEnv* env, SIM_JniHandle handle, jint index,
|
||||
FreeConstBufferCallbackFunc freeCallback);
|
||||
} // namespace hal::sim
|
||||
} // namespace wpi::hal::sim
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
#include "org_wpilib_hardware_hal_simulation_DIODataJNI.h"
|
||||
#include "wpi/hal/simulation/DIOData.h"
|
||||
|
||||
using namespace hal;
|
||||
using namespace wpi::hal;
|
||||
|
||||
extern "C" {
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
#include "org_wpilib_hardware_hal_simulation_DigitalPWMDataJNI.h"
|
||||
#include "wpi/hal/simulation/DigitalPWMData.h"
|
||||
|
||||
using namespace hal;
|
||||
using namespace wpi::hal;
|
||||
|
||||
extern "C" {
|
||||
|
||||
|
||||
@@ -11,8 +11,8 @@
|
||||
#include "wpi/util/StringExtras.hpp"
|
||||
#include "wpi/util/jni_util.hpp"
|
||||
|
||||
using namespace hal;
|
||||
using namespace wpi::java;
|
||||
using namespace wpi::hal;
|
||||
using namespace wpi::util::java;
|
||||
|
||||
extern "C" {
|
||||
|
||||
@@ -537,9 +537,9 @@ Java_org_wpilib_hardware_hal_simulation_DriverStationDataJNI_setMatchInfo
|
||||
JStringRef gameSpecificMessageRef{env, gameSpecificMessage};
|
||||
|
||||
HAL_MatchInfo halMatchInfo;
|
||||
wpi::format_to_n_c_str(halMatchInfo.eventName, sizeof(halMatchInfo.eventName),
|
||||
wpi::util::format_to_n_c_str(halMatchInfo.eventName, sizeof(halMatchInfo.eventName),
|
||||
"{}", eventNameRef.str());
|
||||
wpi::format_to_n_c_str(
|
||||
wpi::util::format_to_n_c_str(
|
||||
reinterpret_cast<char*>(halMatchInfo.gameSpecificMessage),
|
||||
sizeof(halMatchInfo.gameSpecificMessage), "{}",
|
||||
gameSpecificMessageRef.str());
|
||||
@@ -732,7 +732,7 @@ Java_org_wpilib_hardware_hal_simulation_DriverStationDataJNI_setJoystickName
|
||||
(JNIEnv* env, jclass, jint stick, jstring name)
|
||||
{
|
||||
JStringRef nameJString{env, name};
|
||||
auto str = wpi::make_string(nameJString);
|
||||
auto str = wpi::util::make_string(nameJString);
|
||||
HALSIM_SetJoystickName(stick, &str);
|
||||
}
|
||||
|
||||
@@ -746,7 +746,7 @@ Java_org_wpilib_hardware_hal_simulation_DriverStationDataJNI_setGameSpecificMess
|
||||
(JNIEnv* env, jclass, jstring message)
|
||||
{
|
||||
JStringRef messageJString{env, message};
|
||||
auto str = wpi::make_string(messageJString);
|
||||
auto str = wpi::util::make_string(messageJString);
|
||||
HALSIM_SetGameSpecificMessage(&str);
|
||||
}
|
||||
|
||||
@@ -760,7 +760,7 @@ Java_org_wpilib_hardware_hal_simulation_DriverStationDataJNI_setEventName
|
||||
(JNIEnv* env, jclass, jstring name)
|
||||
{
|
||||
JStringRef nameJString{env, name};
|
||||
auto str = wpi::make_string(nameJString);
|
||||
auto str = wpi::util::make_string(nameJString);
|
||||
HALSIM_SetEventName(&str);
|
||||
}
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
#include "org_wpilib_hardware_hal_simulation_DutyCycleDataJNI.h"
|
||||
#include "wpi/hal/simulation/DutyCycleData.h"
|
||||
|
||||
using namespace hal;
|
||||
using namespace wpi::hal;
|
||||
|
||||
extern "C" {
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
#include "org_wpilib_hardware_hal_simulation_EncoderDataJNI.h"
|
||||
#include "wpi/hal/simulation/EncoderData.h"
|
||||
|
||||
using namespace hal;
|
||||
using namespace wpi::hal;
|
||||
|
||||
extern "C" {
|
||||
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
#include "org_wpilib_hardware_hal_simulation_I2CDataJNI.h"
|
||||
#include "wpi/hal/simulation/I2CData.h"
|
||||
|
||||
using namespace hal;
|
||||
using namespace wpi::hal;
|
||||
|
||||
extern "C" {
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
#include "org_wpilib_hardware_hal_simulation_PWMDataJNI.h"
|
||||
#include "wpi/hal/simulation/PWMData.h"
|
||||
|
||||
using namespace hal;
|
||||
using namespace wpi::hal;
|
||||
|
||||
extern "C" {
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
#include "org_wpilib_hardware_hal_simulation_PowerDistributionDataJNI.h"
|
||||
#include "wpi/hal/simulation/PowerDistributionData.h"
|
||||
|
||||
using namespace hal;
|
||||
using namespace wpi::hal;
|
||||
|
||||
extern "C" {
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
#include "org_wpilib_hardware_hal_simulation_REVPHDataJNI.h"
|
||||
#include "wpi/hal/simulation/REVPHData.h"
|
||||
|
||||
using namespace hal;
|
||||
using namespace wpi::hal;
|
||||
|
||||
extern "C" {
|
||||
|
||||
|
||||
@@ -9,8 +9,8 @@
|
||||
#include "wpi/hal/simulation/RoboRioData.h"
|
||||
#include "wpi/util/jni_util.hpp"
|
||||
|
||||
using namespace hal;
|
||||
using namespace wpi::java;
|
||||
using namespace wpi::hal;
|
||||
using namespace wpi::util::java;
|
||||
|
||||
extern "C" {
|
||||
|
||||
@@ -430,7 +430,7 @@ Java_org_wpilib_hardware_hal_simulation_RoboRioDataJNI_getSerialNumber
|
||||
{
|
||||
WPI_String str;
|
||||
HALSIM_GetRoboRioSerialNumber(&str);
|
||||
auto jstr = MakeJString(env, wpi::to_string_view(&str));
|
||||
auto jstr = MakeJString(env, wpi::util::to_string_view(&str));
|
||||
WPI_FreeString(&str);
|
||||
return jstr;
|
||||
}
|
||||
@@ -445,7 +445,7 @@ Java_org_wpilib_hardware_hal_simulation_RoboRioDataJNI_setSerialNumber
|
||||
(JNIEnv* env, jclass, jstring serialNumber)
|
||||
{
|
||||
JStringRef serialNumberJString{env, serialNumber};
|
||||
auto str = wpi::make_string(serialNumberJString);
|
||||
auto str = wpi::util::make_string(serialNumberJString);
|
||||
HALSIM_SetRoboRioSerialNumber(&str);
|
||||
}
|
||||
|
||||
@@ -460,7 +460,7 @@ Java_org_wpilib_hardware_hal_simulation_RoboRioDataJNI_getComments
|
||||
{
|
||||
WPI_String str;
|
||||
HALSIM_GetRoboRioComments(&str);
|
||||
auto jstr = MakeJString(env, wpi::to_string_view(&str));
|
||||
auto jstr = MakeJString(env, wpi::util::to_string_view(&str));
|
||||
WPI_FreeString(&str);
|
||||
return jstr;
|
||||
}
|
||||
@@ -475,7 +475,7 @@ Java_org_wpilib_hardware_hal_simulation_RoboRioDataJNI_setComments
|
||||
(JNIEnv* env, jclass, jstring comments)
|
||||
{
|
||||
JStringRef commentsJString{env, comments};
|
||||
auto str = wpi::make_string(commentsJString);
|
||||
auto str = wpi::util::make_string(commentsJString);
|
||||
HALSIM_SetRoboRioComments(&str);
|
||||
}
|
||||
|
||||
|
||||
@@ -18,8 +18,8 @@
|
||||
#include "wpi/hal/simulation/SimDeviceData.h"
|
||||
#include "wpi/util/jni_util.hpp"
|
||||
|
||||
using namespace hal;
|
||||
using namespace wpi::java;
|
||||
using namespace wpi::hal;
|
||||
using namespace wpi::util::java;
|
||||
|
||||
static JClass simDeviceInfoCls;
|
||||
static JClass simValueInfoCls;
|
||||
@@ -105,7 +105,7 @@ class DeviceCallbackStore {
|
||||
int32_t getCallbackId() { return callbackId; }
|
||||
|
||||
private:
|
||||
wpi::java::JGlobal<jobject> m_call;
|
||||
wpi::util::java::JGlobal<jobject> m_call;
|
||||
int32_t callbackId;
|
||||
};
|
||||
|
||||
@@ -119,7 +119,7 @@ class ValueCallbackStore {
|
||||
int32_t getCallbackId() { return m_callbackId; }
|
||||
|
||||
private:
|
||||
wpi::java::JGlobal<jobject> m_call;
|
||||
wpi::util::java::JGlobal<jobject> m_call;
|
||||
int32_t m_callbackId;
|
||||
};
|
||||
|
||||
@@ -193,8 +193,8 @@ void ValueCallbackStore::performCallback(const char* name,
|
||||
}
|
||||
}
|
||||
|
||||
static hal::UnlimitedHandleResource<SIM_JniHandle, DeviceCallbackStore,
|
||||
hal::HAL_HandleEnum::SimulationJni>*
|
||||
static wpi::hal::UnlimitedHandleResource<SIM_JniHandle, DeviceCallbackStore,
|
||||
wpi::hal::HAL_HandleEnum::SimulationJni>*
|
||||
deviceCallbackHandles;
|
||||
|
||||
namespace {
|
||||
@@ -250,8 +250,8 @@ static void FreeDeviceCallback(JNIEnv* env, SIM_JniHandle handle,
|
||||
callback->free(env);
|
||||
}
|
||||
|
||||
static hal::UnlimitedHandleResource<SIM_JniHandle, ValueCallbackStore,
|
||||
hal::HAL_HandleEnum::SimulationJni>*
|
||||
static wpi::hal::UnlimitedHandleResource<SIM_JniHandle, ValueCallbackStore,
|
||||
wpi::hal::HAL_HandleEnum::SimulationJni>*
|
||||
valueCallbackHandles;
|
||||
|
||||
namespace {
|
||||
@@ -307,7 +307,7 @@ static void FreeValueCallback(JNIEnv* env, SIM_JniHandle handle,
|
||||
callback->free(env);
|
||||
}
|
||||
|
||||
namespace hal::sim {
|
||||
namespace wpi::hal::sim {
|
||||
|
||||
bool InitializeSimDeviceDataJNI(JNIEnv* env) {
|
||||
simDeviceInfoCls = JClass(
|
||||
@@ -346,13 +346,13 @@ bool InitializeSimDeviceDataJNI(JNIEnv* env) {
|
||||
return false;
|
||||
}
|
||||
|
||||
static hal::UnlimitedHandleResource<SIM_JniHandle, DeviceCallbackStore,
|
||||
hal::HAL_HandleEnum::SimulationJni>
|
||||
static wpi::hal::UnlimitedHandleResource<SIM_JniHandle, DeviceCallbackStore,
|
||||
wpi::hal::HAL_HandleEnum::SimulationJni>
|
||||
cbDevice;
|
||||
deviceCallbackHandles = &cbDevice;
|
||||
|
||||
static hal::UnlimitedHandleResource<SIM_JniHandle, ValueCallbackStore,
|
||||
hal::HAL_HandleEnum::SimulationJni>
|
||||
static wpi::hal::UnlimitedHandleResource<SIM_JniHandle, ValueCallbackStore,
|
||||
wpi::hal::HAL_HandleEnum::SimulationJni>
|
||||
cbValue;
|
||||
valueCallbackHandles = &cbValue;
|
||||
|
||||
@@ -366,7 +366,7 @@ void FreeSimDeviceDataJNI(JNIEnv* env) {
|
||||
simValueCallbackCls.free(env);
|
||||
}
|
||||
|
||||
} // namespace hal::sim
|
||||
} // namespace wpi::hal::sim
|
||||
|
||||
extern "C" {
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
|
||||
#include <jni.h>
|
||||
|
||||
namespace hal::sim {
|
||||
namespace wpi::hal::sim {
|
||||
bool InitializeSimDeviceDataJNI(JNIEnv* env);
|
||||
void FreeSimDeviceDataJNI(JNIEnv* env);
|
||||
} // namespace hal::sim
|
||||
} // namespace wpi::hal::sim
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
#include "wpi/hal/simulation/MockHooks.h"
|
||||
#include "wpi/util/jni_util.hpp"
|
||||
|
||||
using namespace wpi::java;
|
||||
using namespace wpi::util::java;
|
||||
|
||||
static JavaVM* jvm = nullptr;
|
||||
static JClass notifyCallbackCls;
|
||||
@@ -24,7 +24,7 @@ static jmethodID notifyCallbackCallback;
|
||||
static jmethodID bufferCallbackCallback;
|
||||
static jmethodID constBufferCallbackCallback;
|
||||
|
||||
namespace hal::sim {
|
||||
namespace wpi::hal::sim {
|
||||
jint SimOnLoad(JavaVM* vm, void* reserved) {
|
||||
jvm = vm;
|
||||
|
||||
@@ -108,7 +108,7 @@ jmethodID GetConstBufferCallback() {
|
||||
return constBufferCallbackCallback;
|
||||
}
|
||||
|
||||
} // namespace hal::sim
|
||||
} // namespace wpi::hal::sim
|
||||
|
||||
extern "C" {
|
||||
/*
|
||||
@@ -240,6 +240,6 @@ JNIEXPORT void JNICALL
|
||||
Java_org_wpilib_hardware_hal_simulation_SimulatorJNI_resetHandles
|
||||
(JNIEnv*, jclass)
|
||||
{
|
||||
hal::HandleBase::ResetGlobalHandles();
|
||||
wpi::hal::HandleBase::ResetGlobalHandles();
|
||||
}
|
||||
} // extern "C"
|
||||
|
||||
@@ -9,10 +9,10 @@
|
||||
|
||||
using SIM_JniHandle = HAL_Handle; // NOLINT
|
||||
|
||||
namespace hal::sim {
|
||||
namespace wpi::hal::sim {
|
||||
JavaVM* GetJVM();
|
||||
|
||||
jmethodID GetNotifyCallback();
|
||||
jmethodID GetBufferCallback();
|
||||
jmethodID GetConstBufferCallback();
|
||||
} // namespace hal::sim
|
||||
} // namespace wpi::hal::sim
|
||||
|
||||
@@ -60,9 +60,9 @@ constexpr mrc::ControlFlags ToControlWord(uint32_t Word) {
|
||||
|
||||
} // namespace
|
||||
|
||||
std::optional<mrc::ControlData> wpi::Protobuf<mrc::ControlData>::Unpack(
|
||||
std::optional<mrc::ControlData> wpi::util::Protobuf<mrc::ControlData>::Unpack(
|
||||
InputStream& Stream) {
|
||||
wpi::UnpackCallback<mrc::Joystick, MRC_MAX_NUM_JOYSTICKS> JoystickCb;
|
||||
wpi::util::UnpackCallback<mrc::Joystick, MRC_MAX_NUM_JOYSTICKS> JoystickCb;
|
||||
|
||||
mrc_proto_ProtobufControlData Msg{
|
||||
.ControlWord = 0,
|
||||
@@ -91,10 +91,10 @@ std::optional<mrc::ControlData> wpi::Protobuf<mrc::ControlData>::Unpack(
|
||||
return ControlData;
|
||||
}
|
||||
|
||||
bool wpi::Protobuf<mrc::ControlData>::Pack(OutputStream& Stream,
|
||||
bool wpi::util::Protobuf<mrc::ControlData>::Pack(OutputStream& Stream,
|
||||
const mrc::ControlData& Value) {
|
||||
std::span<const mrc::Joystick> Sticks = Value.Joysticks();
|
||||
wpi::PackCallback Joysticks{Sticks};
|
||||
wpi::util::PackCallback Joysticks{Sticks};
|
||||
|
||||
mrc_proto_ProtobufControlData Msg{
|
||||
.ControlWord = FromControlWord(Value.ControlWord),
|
||||
@@ -106,9 +106,9 @@ bool wpi::Protobuf<mrc::ControlData>::Pack(OutputStream& Stream,
|
||||
return Stream.Encode(Msg);
|
||||
}
|
||||
|
||||
std::optional<mrc::Joystick> wpi::Protobuf<mrc::Joystick>::Unpack(
|
||||
std::optional<mrc::Joystick> wpi::util::Protobuf<mrc::Joystick>::Unpack(
|
||||
InputStream& Stream) {
|
||||
wpi::UnpackCallback<int16_t, MRC_MAX_NUM_AXES> AxesCb;
|
||||
wpi::util::UnpackCallback<int16_t, MRC_MAX_NUM_AXES> AxesCb;
|
||||
|
||||
mrc_proto_ProtobufJoystickData Msg{
|
||||
.AvailableButtons = 0,
|
||||
@@ -148,9 +148,9 @@ std::optional<mrc::Joystick> wpi::Protobuf<mrc::Joystick>::Unpack(
|
||||
return Joystick;
|
||||
}
|
||||
|
||||
bool wpi::Protobuf<mrc::Joystick>::Pack(OutputStream& Stream,
|
||||
bool wpi::util::Protobuf<mrc::Joystick>::Pack(OutputStream& Stream,
|
||||
const mrc::Joystick& Value) {
|
||||
wpi::PackCallback AxesCb{Value.Axes.Axes()};
|
||||
wpi::util::PackCallback AxesCb{Value.Axes.Axes()};
|
||||
|
||||
uint32_t PovsStore = 0;
|
||||
for (int i = static_cast<int>(Value.Povs.GetCount()) - 1; i >= 0; i--) {
|
||||
|
||||
@@ -8,11 +8,11 @@
|
||||
#include "wpi/hal/proto/ErrorInfo.h"
|
||||
#include "wpi/util/protobuf/ProtobufCallbacks.hpp"
|
||||
|
||||
std::optional<mrc::ErrorInfo> wpi::Protobuf<mrc::ErrorInfo>::Unpack(
|
||||
std::optional<mrc::ErrorInfo> wpi::util::Protobuf<mrc::ErrorInfo>::Unpack(
|
||||
InputStream& Stream) {
|
||||
wpi::UnpackCallback<std::string> DetailsCb;
|
||||
wpi::UnpackCallback<std::string> LocationCb;
|
||||
wpi::UnpackCallback<std::string> CallStackCb;
|
||||
wpi::util::UnpackCallback<std::string> DetailsCb;
|
||||
wpi::util::UnpackCallback<std::string> LocationCb;
|
||||
wpi::util::UnpackCallback<std::string> CallStackCb;
|
||||
|
||||
mrc_proto_ProtobufErrorInfo Msg{
|
||||
.IsError = false,
|
||||
@@ -49,14 +49,14 @@ std::optional<mrc::ErrorInfo> wpi::Protobuf<mrc::ErrorInfo>::Unpack(
|
||||
return ToRet;
|
||||
}
|
||||
|
||||
bool wpi::Protobuf<mrc::ErrorInfo>::Pack(OutputStream& Stream,
|
||||
bool wpi::util::Protobuf<mrc::ErrorInfo>::Pack(OutputStream& Stream,
|
||||
const mrc::ErrorInfo& Value) {
|
||||
std::string_view DetailsView = Value.GetDetails();
|
||||
std::string_view LocationView = Value.GetLocation();
|
||||
std::string_view CallStackView = Value.GetCallStack();
|
||||
wpi::PackCallback DetailsCb{&DetailsView};
|
||||
wpi::PackCallback LocationCb{&LocationView};
|
||||
wpi::PackCallback CallStackCb{&CallStackView};
|
||||
wpi::util::PackCallback DetailsCb{&DetailsView};
|
||||
wpi::util::PackCallback LocationCb{&LocationView};
|
||||
wpi::util::PackCallback CallStackCb{&CallStackView};
|
||||
|
||||
mrc_proto_ProtobufErrorInfo Msg{
|
||||
.IsError = Value.IsError,
|
||||
|
||||
@@ -9,9 +9,9 @@
|
||||
#include "wpi/util/protobuf/ProtobufCallbacks.hpp"
|
||||
|
||||
std::optional<mrc::JoystickDescriptor>
|
||||
wpi::Protobuf<mrc::JoystickDescriptor>::Unpack(InputStream& Stream) {
|
||||
wpi::UnpackCallback<std::string> JoystickNameCb;
|
||||
wpi::UnpackCallback<uint8_t, MRC_MAX_NUM_AXES> AxisTypesCb;
|
||||
wpi::util::Protobuf<mrc::JoystickDescriptor>::Unpack(InputStream& Stream) {
|
||||
wpi::util::UnpackCallback<std::string> JoystickNameCb;
|
||||
wpi::util::UnpackCallback<uint8_t, MRC_MAX_NUM_AXES> AxisTypesCb;
|
||||
|
||||
mrc_proto_ProtobufJoystickDescriptor Msg;
|
||||
Msg.JoystickName = JoystickNameCb.Callback();
|
||||
@@ -47,13 +47,13 @@ wpi::Protobuf<mrc::JoystickDescriptor>::Unpack(InputStream& Stream) {
|
||||
return OutputData;
|
||||
}
|
||||
|
||||
bool wpi::Protobuf<mrc::JoystickDescriptor>::Pack(
|
||||
bool wpi::util::Protobuf<mrc::JoystickDescriptor>::Pack(
|
||||
OutputStream& Stream, const mrc::JoystickDescriptor& Value) {
|
||||
std::string_view JoystickName = Value.GetName();
|
||||
wpi::PackCallback JoystickNameCb{&JoystickName};
|
||||
wpi::util::PackCallback JoystickNameCb{&JoystickName};
|
||||
|
||||
std::span<const uint8_t> AxisTypes = Value.AxesTypes();
|
||||
wpi::PackCallback AxisTypesCb{AxisTypes};
|
||||
wpi::util::PackCallback AxisTypesCb{AxisTypes};
|
||||
|
||||
mrc_proto_ProtobufJoystickDescriptor Msg{
|
||||
.JoystickName = JoystickNameCb.Callback(),
|
||||
|
||||
@@ -6,8 +6,8 @@
|
||||
#include "wpi/util/protobuf/ProtobufCallbacks.hpp"
|
||||
|
||||
std::optional<mrc::JoystickRumbleData>
|
||||
wpi::Protobuf<mrc::JoystickRumbleData>::Unpack(InputStream& Stream) {
|
||||
wpi::UnpackCallback<uint16_t, MRC_MAX_NUM_RUMBLE> RumbleCb;
|
||||
wpi::util::Protobuf<mrc::JoystickRumbleData>::Unpack(InputStream& Stream) {
|
||||
wpi::util::UnpackCallback<uint16_t, MRC_MAX_NUM_RUMBLE> RumbleCb;
|
||||
|
||||
mrc_proto_ProtobufJoystickRumbleData Msg{
|
||||
.Value = RumbleCb.Callback(),
|
||||
@@ -29,9 +29,9 @@ wpi::Protobuf<mrc::JoystickRumbleData>::Unpack(InputStream& Stream) {
|
||||
return Rumble;
|
||||
}
|
||||
|
||||
bool wpi::Protobuf<mrc::JoystickRumbleData>::Pack(
|
||||
bool wpi::util::Protobuf<mrc::JoystickRumbleData>::Pack(
|
||||
OutputStream& Stream, const mrc::JoystickRumbleData& Value) {
|
||||
wpi::PackCallback RumbleCb{Value.Rumbles()};
|
||||
wpi::util::PackCallback RumbleCb{Value.Rumbles()};
|
||||
|
||||
mrc_proto_ProtobufJoystickRumbleData Msg{
|
||||
.Value = RumbleCb.Callback(),
|
||||
|
||||
@@ -8,9 +8,9 @@
|
||||
#include "wpi/hal/proto/MatchInfo.h"
|
||||
#include "wpi/util/protobuf/ProtobufCallbacks.hpp"
|
||||
|
||||
std::optional<mrc::MatchInfo> wpi::Protobuf<mrc::MatchInfo>::Unpack(
|
||||
std::optional<mrc::MatchInfo> wpi::util::Protobuf<mrc::MatchInfo>::Unpack(
|
||||
InputStream& Stream) {
|
||||
wpi::UnpackCallback<std::string> NameCb;
|
||||
wpi::util::UnpackCallback<std::string> NameCb;
|
||||
|
||||
mrc_proto_ProtobufMatchInfo Msg;
|
||||
Msg.EventName = NameCb.Callback();
|
||||
@@ -35,10 +35,10 @@ std::optional<mrc::MatchInfo> wpi::Protobuf<mrc::MatchInfo>::Unpack(
|
||||
return OutputData;
|
||||
}
|
||||
|
||||
bool wpi::Protobuf<mrc::MatchInfo>::Pack(OutputStream& Stream,
|
||||
bool wpi::util::Protobuf<mrc::MatchInfo>::Pack(OutputStream& Stream,
|
||||
const mrc::MatchInfo& Value) {
|
||||
std::string_view EventNameStr = Value.GetEventName();
|
||||
wpi::PackCallback EventName{&EventNameStr};
|
||||
wpi::util::PackCallback EventName{&EventNameStr};
|
||||
|
||||
mrc_proto_ProtobufMatchInfo Msg{
|
||||
.EventName = EventName.Callback(),
|
||||
|
||||
@@ -9,9 +9,9 @@
|
||||
#include "wpi/hal/proto/OpMode.h"
|
||||
#include "wpi/util/protobuf/ProtobufCallbacks.hpp"
|
||||
|
||||
std::optional<mrc::OpMode> wpi::Protobuf<mrc::OpMode>::Unpack(
|
||||
std::optional<mrc::OpMode> wpi::util::Protobuf<mrc::OpMode>::Unpack(
|
||||
InputStream& Stream) {
|
||||
wpi::UnpackCallback<std::string> NameCb;
|
||||
wpi::util::UnpackCallback<std::string> NameCb;
|
||||
|
||||
mrc_proto_ProtobufOpMode Msg;
|
||||
Msg.Name = NameCb.Callback();
|
||||
@@ -34,10 +34,10 @@ std::optional<mrc::OpMode> wpi::Protobuf<mrc::OpMode>::Unpack(
|
||||
return OutputData;
|
||||
}
|
||||
|
||||
bool wpi::Protobuf<mrc::OpMode>::Pack(OutputStream& Stream,
|
||||
bool wpi::util::Protobuf<mrc::OpMode>::Pack(OutputStream& Stream,
|
||||
const mrc::OpMode& Value) {
|
||||
std::string_view EventNameStr = Value.GetName();
|
||||
wpi::PackCallback EventName{&EventNameStr};
|
||||
wpi::util::PackCallback EventName{&EventNameStr};
|
||||
|
||||
mrc_proto_ProtobufOpMode Msg{
|
||||
.Hash = Value.Hash.ToValue(),
|
||||
@@ -48,8 +48,8 @@ bool wpi::Protobuf<mrc::OpMode>::Pack(OutputStream& Stream,
|
||||
}
|
||||
|
||||
std::optional<std::vector<mrc::OpMode>>
|
||||
wpi::Protobuf<std::vector<mrc::OpMode>>::Unpack(InputStream& Stream) {
|
||||
wpi::StdVectorUnpackCallback<mrc::OpMode> ModesCb;
|
||||
wpi::util::Protobuf<std::vector<mrc::OpMode>>::Unpack(InputStream& Stream) {
|
||||
wpi::util::StdVectorUnpackCallback<mrc::OpMode> ModesCb;
|
||||
ModesCb.SetLimits(DecodeLimits::Add);
|
||||
|
||||
mrc_proto_ProtobufAvailableOpModes Msg;
|
||||
@@ -62,10 +62,10 @@ wpi::Protobuf<std::vector<mrc::OpMode>>::Unpack(InputStream& Stream) {
|
||||
return ModesCb.Vec();
|
||||
}
|
||||
|
||||
bool wpi::Protobuf<std::vector<mrc::OpMode>>::Pack(
|
||||
bool wpi::util::Protobuf<std::vector<mrc::OpMode>>::Pack(
|
||||
OutputStream& Stream, const std::vector<mrc::OpMode>& Value) {
|
||||
std::span<const mrc::OpMode> ModesSpan = Value;
|
||||
wpi::PackCallback Modes{ModesSpan};
|
||||
wpi::util::PackCallback Modes{ModesSpan};
|
||||
|
||||
mrc_proto_ProtobufAvailableOpModes Msg{
|
||||
.Modes = Modes.Callback(),
|
||||
|
||||
Reference in New Issue
Block a user