001/*
002 *  Software License Agreement
003 *
004 * Copyright (C) Cross The Road Electronics.  All rights
005 * reserved.
006 *
007 * Cross The Road Electronics (CTRE) licenses to you the right to
008 * use, publish, and distribute copies of CRF (Cross The Road) firmware files ( *.crf) and Software
009 * API Libraries ONLY when in use with Cross The Road Electronics hardware products.
010 *
011 * THE SOFTWARE AND DOCUMENTATION ARE PROVIDED "AS IS" WITHOUT
012 * WARRANTY OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT
013 * LIMITATION, ANY WARRANTY OF MERCHANTABILITY, FITNESS FOR A
014 * PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT SHALL
015 * CROSS THE ROAD ELECTRONICS BE LIABLE FOR ANY INCIDENTAL, SPECIAL,
016 * INDIRECT OR CONSEQUENTIAL DAMAGES, LOST PROFITS OR LOST DATA, COST OF
017 * PROCUREMENT OF SUBSTITUTE GOODS, TECHNOLOGY OR SERVICES, ANY CLAIMS
018 * BY THIRD PARTIES (INCLUDING BUT NOT LIMITED TO ANY DEFENSE
019 * THEREOF), ANY CLAIMS FOR INDEMNITY OR CONTRIBUTION, OR OTHER
020 * SIMILAR COSTS, WHETHER ASSERTED ON THE BASIS OF CONTRACT, TORT
021 * (INCLUDING NEGLIGENCE), BREACH OF WARRANTY, OR OTHERWISE
022 */
023package com.ctre.phoenix.sensors;
024import com.ctre.phoenix.CTREJNIWrapper;
025
026public class CANCoderJNI extends CTREJNIWrapper {
027
028    public static native long Create(int deviceNumber, String canbus);
029
030    public static native int Destroy(long handle);
031
032    public static native int GetLastError(long handle);
033
034    public static native String GetLastUnitString(long handle);
035
036    public static native double GetLastTimestamp(long handle);
037
038    public static native double GetBusVoltage(long handle);
039
040    public static native int GetMagnetFieldStrength(long handle);
041
042    public static native double GetPosition(long handle);
043
044    public static native int SetPosition(long handle, double pos, int timeoutMs);
045
046    public static native int SetPositionToAbsolute(long handle, int timeoutMs);
047
048    public static native int ConfigSensorDirection(long handle, int bDirection, int timeoutMs);
049
050    public static native double GetVelocity(long handle);
051
052    public static native double GetAbsolutePosition(long handle);
053
054    public static native int ConfigVelocityMeasurementPeriod(long handle, int period, int timeoutMs);
055
056    public static native int ConfigVelocityMeasurementWindow(long handle, int window, int timeoutMs);
057
058    public static native int ConfigAbsoluteSensorRange(long handle, int absoluteSensorRante, int timeoutMs);
059
060    public static native int ConfigMagnetOffset(long handle, double offsetDegrees, int timeoutMs);
061
062    public static native int ConfigSensorInitializationStrategy(long handle, int initStrategy, int timeoutMs);
063
064    public static native int ConfigFeedbackCoefficient(long handle, double sensorCoefficient, String unitString, int sensorTimeBase, int timeoutMs);
065
066    public static native int ConfigSetParameter(long handle, int param, double value, int subValue, int ordinal, int timeoutMs);
067
068    public static native double ConfigGetParameter(long handle, int param, int ordinal, int timeoutMs);
069
070    //public static native double ConfigGetParameter_6(long handle, int param, int valueToSend, int subValue, int ordinal, int timeoutMs);
071
072        public static native int ConfigSetCustomParam(long handle, int newValue, int paramIndex, int timeoutMs);
073
074        public static native int ConfigGetCustomParam(long handle, int paramIndex, int timoutMs);
075
076    public static native int ConfigFactoryDefault(long handle, int timeoutMs);
077
078        public static native int GetFaults(long handle);
079
080        public static native int GetStickyFaults(long handle);
081
082        public static native int ClearStickyFaults(long handle, int timeoutMs);
083
084        public static native int GetFirmwareVersion(long handle);
085
086        public static native boolean HasResetOccurred(long handle);
087
088        public static native int SetStatusFramePeriod(long handle, int statusFrame, int periodMs, int timeoutMs);
089
090        public static native int GetStatusFramePeriod(long handle, int frame, int timeoutMs);
091
092        public static native int ConfigGetVelocityMeasurementPeriod(long handle, int timeoutMs);
093
094        public static native int ConfigGetVelocityMeasurementWindow(long handle, int timeoutMs);
095
096        public static native int ConfigGetAbsoluteSensorRange(long handle, int timeoutMs);
097
098        public static native double ConfigGetMagnetOffset(long handle, int timeoutMs);
099
100        public static native int ConfigGetSensorDirection(long handle, int timeoutMs);
101
102        public static native int ConfigGetSensorInitializationStrategy(long handle, int timeoutMs);
103
104    public static native double ConfigGetFeedbackCoefficient(long handle, int timeoutMs);
105
106    public static native String ConfigGetFeedbackUnitString(long handle, int timeoutMs);
107
108    public static native int ConfigGetFeedbackTimeBase(long handle, int timeoutMs);
109}