2025-02-07 12:37:23 -08:00
|
|
|
// Copyright (c) FIRST and other WPILib contributors.
|
|
|
|
|
// Open Source Software; you can modify and/or share it under the terms of
|
|
|
|
|
// the WPILib BSD license file in the root directory of this project.
|
|
|
|
|
|
|
|
|
|
#include <jni.h>
|
|
|
|
|
|
|
|
|
|
#include <cassert>
|
|
|
|
|
|
2025-11-07 19:55:43 -05:00
|
|
|
#include "org_wpilib_hardware_hal_UsageReportingJNI.h"
|
2025-11-07 19:56:21 -05:00
|
|
|
#include "wpi/hal/UsageReporting.h"
|
2025-11-07 19:57:55 -05:00
|
|
|
#include "wpi/util/jni_util.hpp"
|
|
|
|
|
#include "wpi/util/string.h"
|
2025-02-07 12:37:23 -08:00
|
|
|
|
2025-11-07 20:00:05 -05:00
|
|
|
using namespace wpi::util::java;
|
2025-02-07 12:37:23 -08:00
|
|
|
|
|
|
|
|
extern "C" {
|
|
|
|
|
|
|
|
|
|
/*
|
2025-11-07 19:55:43 -05:00
|
|
|
* Class: org_wpilib_hardware_hal_UsageReportingJNI
|
2025-02-07 12:37:23 -08:00
|
|
|
* Method: report
|
|
|
|
|
* Signature: (Ljava/lang/String;Ljava/lang/String;)I
|
|
|
|
|
*/
|
|
|
|
|
JNIEXPORT jint JNICALL
|
2025-11-07 19:55:43 -05:00
|
|
|
Java_org_wpilib_hardware_hal_UsageReportingJNI_report
|
2025-02-07 12:37:23 -08:00
|
|
|
(JNIEnv* env, jclass, jstring resource, jstring data)
|
|
|
|
|
{
|
|
|
|
|
JStringRef resourceStr{env, resource};
|
|
|
|
|
JStringRef dataStr{env, data};
|
2025-11-07 20:00:05 -05:00
|
|
|
WPI_String resourceWpiStr = wpi::util::make_string(resourceStr);
|
|
|
|
|
WPI_String dataWpiStr = wpi::util::make_string(dataStr);
|
2025-02-07 12:37:23 -08:00
|
|
|
return HAL_ReportUsage(&resourceWpiStr, &dataWpiStr);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
} // extern "C"
|