From 80b1ce887f97fb43595d3ce48764d6cffab691bf Mon Sep 17 00:00:00 2001 From: DeltaDizzy Date: Sun, 26 Jan 2025 15:06:20 -0500 Subject: [PATCH] move filelogger from wpiutil to datalog (java) --- .../edu/wpi/first/datalog/DataLogJNI.java | 23 ++++++++++++++++--- .../main/java/NetworkTableInstance.java.jinja | 2 +- .../networktables/NetworkTableInstance.java | 2 +- .../java/edu/wpi/first/util/WPIUtilJNI.java | 18 --------------- 4 files changed, 22 insertions(+), 23 deletions(-) diff --git a/libdatalog/src/main/java/edu/wpi/first/datalog/DataLogJNI.java b/libdatalog/src/main/java/edu/wpi/first/datalog/DataLogJNI.java index c1500f8826d..dee8f3c4c8d 100644 --- a/libdatalog/src/main/java/edu/wpi/first/datalog/DataLogJNI.java +++ b/libdatalog/src/main/java/edu/wpi/first/datalog/DataLogJNI.java @@ -4,13 +4,12 @@ package edu.wpi.first.datalog; +import edu.wpi.first.util.RuntimeLoader; +import edu.wpi.first.util.WPIUtilJNI; import java.io.IOException; import java.nio.ByteBuffer; import java.util.concurrent.atomic.AtomicBoolean; -import edu.wpi.first.util.RuntimeLoader; -import edu.wpi.first.util.WPIUtilJNI; - /** * DataLog wpiutil JNI Functions. * @@ -354,6 +353,24 @@ private static native void appendRawBuffer( */ static native void appendStringArray(long impl, int entry, String[] value, long timestamp); + /** + * Create a native FileLogger. When the specified file is modified, appended data will be appended + * to the specified data log. + * + * @param file path to the file + * @param log data log implementation handle + * @param key log key to append data to + * @return The FileLogger handle. + */ + public static native long createFileLogger(String file, long log, String key); + + /** + * Free a native FileLogger. This causes the FileLogger to stop appending data to the log. + * + * @param fileTail The FileLogger handle. + */ + public static native void freeFileLogger(long fileTail); + /** Utility class. */ private DataLogJNI() {} } diff --git a/ntcore/src/generate/main/java/NetworkTableInstance.java.jinja b/ntcore/src/generate/main/java/NetworkTableInstance.java.jinja index ccffb082ec1..ff66ae778a5 100644 --- a/ntcore/src/generate/main/java/NetworkTableInstance.java.jinja +++ b/ntcore/src/generate/main/java/NetworkTableInstance.java.jinja @@ -6,8 +6,8 @@ package edu.wpi.first.networktables; -import edu.wpi.first.util.WPIUtilJNI; import edu.wpi.first.datalog.DataLog; +import edu.wpi.first.util.WPIUtilJNI; import edu.wpi.first.util.concurrent.Event; import edu.wpi.first.util.protobuf.Protobuf; import edu.wpi.first.util.struct.Struct; diff --git a/ntcore/src/generated/main/java/edu/wpi/first/networktables/NetworkTableInstance.java b/ntcore/src/generated/main/java/edu/wpi/first/networktables/NetworkTableInstance.java index 09f05203b19..6aa287fa7ab 100644 --- a/ntcore/src/generated/main/java/edu/wpi/first/networktables/NetworkTableInstance.java +++ b/ntcore/src/generated/main/java/edu/wpi/first/networktables/NetworkTableInstance.java @@ -6,8 +6,8 @@ package edu.wpi.first.networktables; -import edu.wpi.first.util.WPIUtilJNI; import edu.wpi.first.datalog.DataLog; +import edu.wpi.first.util.WPIUtilJNI; import edu.wpi.first.util.concurrent.Event; import edu.wpi.first.util.protobuf.Protobuf; import edu.wpi.first.util.struct.Struct; diff --git a/wpiutil/src/main/java/edu/wpi/first/util/WPIUtilJNI.java b/wpiutil/src/main/java/edu/wpi/first/util/WPIUtilJNI.java index c69895231ed..09978006850 100644 --- a/wpiutil/src/main/java/edu/wpi/first/util/WPIUtilJNI.java +++ b/wpiutil/src/main/java/edu/wpi/first/util/WPIUtilJNI.java @@ -220,24 +220,6 @@ public static native boolean waitForObjectTimeout(int handle, double timeout) public static native int[] waitForObjectsTimeout(int[] handles, double timeout) throws InterruptedException; - /** - * Create a native FileLogger. When the specified file is modified, appended data will be appended - * to the specified data log. - * - * @param file path to the file - * @param log data log implementation handle - * @param key log key to append data to - * @return The FileLogger handle. - */ - public static native long createFileLogger(String file, long log, String key); - - /** - * Free a native FileLogger. This causes the FileLogger to stop appending data to the log. - * - * @param fileTail The FileLogger handle. - */ - public static native void freeFileLogger(long fileTail); - /** Utility class. */ protected WPIUtilJNI() {} }