001/*
002 * Copyright (C) Cross The Road Electronics.  All rights reserved.
003 * License information can be found in CTRE_LICENSE.txt
004 * For support and suggestions contact support@ctr-electronics.com or file
005 * an issue tracker at https://github.com/CrossTheRoadElec/Phoenix-Releases
006 */
007package com.ctre.phoenixpro.unmanaged;
008
009import com.ctre.phoenix6.jni.CtreJniWrapper;
010import com.ctre.phoenix6.unmanaged.jni.UnmanagedJNI;
011
012/**
013 * Handles enabling when used in a non-FRC manner
014 *
015 * @deprecated Classes in the phoenixpro package will be removed in 2024.
016 *             Users should instead use classes from the phoenix6 package.
017 */
018@Deprecated(forRemoval = true)
019public class Unmanaged extends CtreJniWrapper {
020    /**
021     * Feed the robot enable.
022     * This function does nothing on a roborio during FRC use.
023     * <p>
024     * If running an application in simulation, creating a WPI_*
025     * object automatically enables actuators.
026     * Otherwise, call this to enable actuators.
027     *
028     * @param timeoutMs Timeout before disabling
029     */
030    public static void feedEnable(int timeoutMs) {
031        UnmanagedJNI.JNI_FeedEnable(timeoutMs);
032    }
033
034    /**
035     * @return true if non-FRC enabled
036     */
037    public static boolean getEnableState() {
038        return UnmanagedJNI.JNI_GetEnableState();
039    }
040
041    /**
042     * @return Phoenix version
043     */
044    public static int getPhoenixVersion() {
045        return UnmanagedJNI.JNI_GetPhoenixVersion();
046    }
047
048    /**
049     * Calling this function will load and start
050     * the Phoenix background tasks.
051     *
052     * This can be useful if you need the
053     * Enable/Disable functionality for CAN devices
054     * but aren't using any of the CAN device classes.
055     *
056     * This function does NOT need to be called if
057     * you are using any of the Phoenix CAN device classes.
058     */
059    public static void loadPhoenix() {
060        UnmanagedJNI.JNI_LoadPhoenix();
061    }
062
063    /**
064     * Sets the duration of the delay before starting
065     * the Phoenix diagnostics server.
066     *
067     * @param startTimeSeconds Magnitude of the delay (in seconds) before
068     *                         starting the server.
069     *                         A value of 0 will start the server immediately.
070     *                         A negative value will signal the server
071     *                         to shutdown or never start.
072     */
073    public static void setPhoenixDiagnosticsStartTime(double startTimeSeconds) {
074        UnmanagedJNI.JNI_SetPhoenixDiagnosticsStartTime(startTimeSeconds);
075    }
076}