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.phoenixpro.jni.CtreJniWrapper; 010import com.ctre.phoenixpro.unmanaged.jni.UnmanagedJNI; 011 012/** 013 * Handles enabling when used in a non-FRC manner 014 */ 015public class Unmanaged extends CtreJniWrapper { 016 /** 017 * Feed the robot enable. 018 * This function does nothing on a roborio during FRC use. 019 * <p> 020 * If running an application in simulation, creating a WPI_* 021 * object automatically enables actuators. 022 * Otherwise, call this to enable actuators. 023 * 024 * @param timeoutMs Timeout before disabling 025 */ 026 public static void feedEnable(int timeoutMs) { 027 UnmanagedJNI.JNI_FeedEnable(timeoutMs); 028 } 029 030 /** 031 * @return true if non-FRC enabled 032 */ 033 public static boolean getEnableState() { 034 return UnmanagedJNI.JNI_GetEnableState(); 035 } 036 037 /** 038 * @return Phoenix version 039 */ 040 public static int getPhoenixVersion() { 041 return UnmanagedJNI.JNI_GetPhoenixVersion(); 042 } 043 044 /** 045 * Calling this function will load and start 046 * the Phoenix background tasks. 047 * 048 * This can be useful if you need the 049 * Enable/Disable functionality for CAN devices 050 * but aren't using any of the CAN device classes. 051 * 052 * This function does NOT need to be called if 053 * you are using any of the Phoenix CAN device classes. 054 */ 055 public static void loadPhoenix() { 056 UnmanagedJNI.JNI_LoadPhoenix(); 057 } 058 059 /** 060 * Sets the duration of the delay before starting 061 * the Phoenix diagnostics server. 062 * 063 * @param startTimeSeconds Magnitude of the delay (in seconds) before 064 * starting the server. 065 * A value of 0 will start the server immediately. 066 * A negative value will signal the server 067 * to shutdown or never start. 068 */ 069 public static void setPhoenixDiagnosticsStartTime(double startTimeSeconds) { 070 UnmanagedJNI.JNI_SetPhoenixDiagnosticsStartTime(startTimeSeconds); 071 } 072}