mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-19 00:41:43 +00:00
[hal] Remove useless usage reporting return (#8625)
The value is not used anywhere and it also just returns 0 (was a value from Netcomm in pre-2027).
This commit is contained in:
@@ -217,10 +217,9 @@ public final class HAL extends JNIWrapper {
|
||||
*
|
||||
* @param resource the used resource name
|
||||
* @param data arbitrary associated data string
|
||||
* @return a handle
|
||||
*/
|
||||
public static int reportUsage(String resource, String data) {
|
||||
return UsageReportingJNI.report(resource, data);
|
||||
public static void reportUsage(String resource, String data) {
|
||||
UsageReportingJNI.report(resource, data);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -230,10 +229,9 @@ public final class HAL extends JNIWrapper {
|
||||
* @param resource the used resource name
|
||||
* @param instanceNumber an index that identifies the resource instance
|
||||
* @param data arbitrary associated data string
|
||||
* @return a handle
|
||||
*/
|
||||
public static int reportUsage(String resource, int instanceNumber, String data) {
|
||||
return reportUsage(resource + "[" + instanceNumber + "]", data);
|
||||
public static void reportUsage(String resource, int instanceNumber, String data) {
|
||||
reportUsage(resource + "[" + instanceNumber + "]", data);
|
||||
}
|
||||
|
||||
private HAL() {}
|
||||
|
||||
@@ -16,9 +16,8 @@ public class UsageReportingJNI extends JNIWrapper {
|
||||
*
|
||||
* @param resource the used resource name
|
||||
* @param data arbitrary associated data string
|
||||
* @return a handle
|
||||
*/
|
||||
public static native int report(String resource, String data);
|
||||
public static native void report(String resource, String data);
|
||||
|
||||
/** Utility class. */
|
||||
private UsageReportingJNI() {}
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
|
||||
#include <fmt/format.h>
|
||||
|
||||
int32_t HAL_ReportUsage(std::string_view resource, int instanceNumber,
|
||||
std::string_view data) {
|
||||
return HAL_ReportUsage(fmt::format("{}[{}]", resource, instanceNumber), data);
|
||||
void HAL_ReportUsage(std::string_view resource, int instanceNumber,
|
||||
std::string_view data) {
|
||||
HAL_ReportUsage(fmt::format("{}[{}]", resource, instanceNumber), data);
|
||||
}
|
||||
|
||||
@@ -18,9 +18,9 @@ extern "C" {
|
||||
/*
|
||||
* Class: org_wpilib_hardware_hal_UsageReportingJNI
|
||||
* Method: report
|
||||
* Signature: (Ljava/lang/String;Ljava/lang/String;)I
|
||||
* Signature: (Ljava/lang/String;Ljava/lang/String;)V
|
||||
*/
|
||||
JNIEXPORT jint JNICALL
|
||||
JNIEXPORT void JNICALL
|
||||
Java_org_wpilib_hardware_hal_UsageReportingJNI_report
|
||||
(JNIEnv* env, jclass, jstring resource, jstring data)
|
||||
{
|
||||
@@ -28,7 +28,7 @@ Java_org_wpilib_hardware_hal_UsageReportingJNI_report
|
||||
JStringRef dataStr{env, data};
|
||||
WPI_String resourceWpiStr = wpi::util::make_string(resourceStr);
|
||||
WPI_String dataWpiStr = wpi::util::make_string(dataStr);
|
||||
return HAL_ReportUsage(&resourceWpiStr, &dataWpiStr);
|
||||
HAL_ReportUsage(&resourceWpiStr, &dataWpiStr);
|
||||
}
|
||||
|
||||
} // extern "C"
|
||||
|
||||
@@ -24,10 +24,9 @@ extern "C" {
|
||||
* "[instanceNum]" for multiple instances of the same
|
||||
* resource
|
||||
* @param data arbitrary associated data string
|
||||
* @return a handle
|
||||
*/
|
||||
int32_t HAL_ReportUsage(const struct WPI_String* resource,
|
||||
const struct WPI_String* data);
|
||||
void HAL_ReportUsage(const struct WPI_String* resource,
|
||||
const struct WPI_String* data);
|
||||
|
||||
#ifdef __cplusplus
|
||||
} // extern "C"
|
||||
@@ -42,13 +41,11 @@ int32_t HAL_ReportUsage(const struct WPI_String* resource,
|
||||
* "[instanceNum]" for multiple instances of the same
|
||||
* resource
|
||||
* @param data arbitrary associated data string
|
||||
* @return a handle
|
||||
*/
|
||||
inline int32_t HAL_ReportUsage(std::string_view resource,
|
||||
std::string_view data) {
|
||||
inline void HAL_ReportUsage(std::string_view resource, std::string_view data) {
|
||||
WPI_String resourceStr = wpi::util::make_string(resource);
|
||||
WPI_String dataStr = wpi::util::make_string(data);
|
||||
return HAL_ReportUsage(&resourceStr, &dataStr);
|
||||
HAL_ReportUsage(&resourceStr, &dataStr);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -58,9 +55,8 @@ inline int32_t HAL_ReportUsage(std::string_view resource,
|
||||
* @param resource the used resource name
|
||||
* @param instanceNumber an index that identifies the resource instance
|
||||
* @param data arbitrary associated data string
|
||||
* @return a handle
|
||||
*/
|
||||
int32_t HAL_ReportUsage(std::string_view resource, int instanceNumber,
|
||||
std::string_view data);
|
||||
void HAL_ReportUsage(std::string_view resource, int instanceNumber,
|
||||
std::string_view data);
|
||||
|
||||
#endif
|
||||
|
||||
@@ -445,9 +445,9 @@ void HALSIM_CancelAllSimPeriodicCallbacks(void) {
|
||||
gSimPeriodicAfter.Reset();
|
||||
}
|
||||
|
||||
int32_t HAL_ReportUsage(const struct WPI_String* resource,
|
||||
const struct WPI_String* data) {
|
||||
return 0; // Do nothing for now
|
||||
void HAL_ReportUsage(const struct WPI_String* resource,
|
||||
const struct WPI_String* data) {
|
||||
// Do nothing for now
|
||||
}
|
||||
|
||||
} // extern "C"
|
||||
|
||||
@@ -2,6 +2,8 @@
|
||||
// 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 "wpi/hal/UsageReporting.h"
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
#include <fmt/format.h>
|
||||
@@ -27,8 +29,8 @@ static ::SystemServerUsageReporting* systemServerUsage;
|
||||
|
||||
extern "C" {
|
||||
|
||||
int32_t HAL_ReportUsage(const struct WPI_String* resource,
|
||||
const struct WPI_String* data) {
|
||||
void HAL_ReportUsage(const struct WPI_String* resource,
|
||||
const struct WPI_String* data) {
|
||||
auto resourceStr = wpi::util::to_string_view(resource);
|
||||
auto& publisher = systemServerUsage->publishers[resourceStr];
|
||||
if (!publisher) {
|
||||
@@ -38,8 +40,6 @@ int32_t HAL_ReportUsage(const struct WPI_String* resource,
|
||||
.Publish();
|
||||
}
|
||||
publisher.Set(wpi::util::to_string_view(data));
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
} // extern "C"
|
||||
|
||||
Reference in New Issue
Block a user