From b62b6061100f9dd71ea6df986f9860625bce7d87 Mon Sep 17 00:00:00 2001 From: charris Date: Mon, 6 Jan 2014 09:27:51 -0500 Subject: [PATCH] JNI implementation for Java Normal vs --- .../NetworkCommunication/AICalibration.h | 19 + .../NetworkCommunication/CANInterfacePlugin.h | 61 ++ .../include/NetworkCommunication/FRCComm.h | 193 +++++ .../NetworkCommunication/JaguarCANDriver.h | 37 + .../include/NetworkCommunication/LoadOut.h | 52 ++ .../NetworkCommunication/UsageReporting.h | 139 ++++ .../NetworkCommunication/CANInterfacePlugin.h | 61 ++ .../native/NetworkCommunication/FRCComm.h | 193 +++++ .../NetworkCommunication/JaguarCANDriver.h | 37 + .../NetworkCommunication/UsageReporting.h | 139 ++++ hal/Athena/src/main/native/i2c-lib.h | 10 + hal/Athena/src/main/native/spi-lib.h | 13 + hal/include/src/main/include/log.h | 106 +++ pom.xml | 4 +- wpilibc/pom.xml | 3 - wpilibc/src/main/native/ADXL345_I2C.cpp | 4 +- wpilibj/pom.xml | 142 +--- .../edu/wpi/first/wpilibj/can/CANLibrary.java | 477 ------------ .../FRC_NetworkCommunicationsLibrary.java | 489 ------------ wpilibj/wpilibJava/pom.xml | 128 ++++ .../edu/wpi/first/wpilibj/ADXL345_I2C.java | 0 .../edu/wpi/first/wpilibj/Accelerometer.java | 0 .../wpi/first/wpilibj/AccumulatorResult.java | 0 .../edu/wpi/first/wpilibj/AnalogChannel.java | 0 .../edu/wpi/first/wpilibj/AnalogModule.java | 0 .../edu/wpi/first/wpilibj/AnalogTrigger.java | 0 .../first/wpilibj/AnalogTriggerOutput.java | 0 .../java/edu/wpi/first/wpilibj/CANJaguar.java | 0 .../edu/wpi/first/wpilibj/Compressor.java | 0 .../edu/wpi/first/wpilibj/Controller.java | 0 .../java/edu/wpi/first/wpilibj/Counter.java | 0 .../edu/wpi/first/wpilibj/CounterBase.java | 0 .../java/edu/wpi/first/wpilibj/Dashboard.java | 0 .../edu/wpi/first/wpilibj/DigitalInput.java | 0 .../edu/wpi/first/wpilibj/DigitalModule.java | 0 .../edu/wpi/first/wpilibj/DigitalOutput.java | 0 .../edu/wpi/first/wpilibj/DigitalSource.java | 0 .../edu/wpi/first/wpilibj/DoubleSolenoid.java | 0 .../edu/wpi/first/wpilibj/DriverStation.java | 0 .../wpilibj/DriverStationEnhancedIO.java | 0 .../wpi/first/wpilibj/DriverStationLCD.java | 0 .../java/edu/wpi/first/wpilibj/Encoder.java | 0 .../java/edu/wpi/first/wpilibj/GearTooth.java | 0 .../edu/wpi/first/wpilibj/GenericHID.java | 0 .../main/java/edu/wpi/first/wpilibj/Gyro.java | 0 .../first/wpilibj/HiTechnicColorSensor.java | 0 .../wpi/first/wpilibj/HiTechnicCompass.java | 0 .../main/java/edu/wpi/first/wpilibj/I2C.java | 0 .../edu/wpi/first/wpilibj/IDashboard.java | 0 .../wpilibj/InterruptableSensorBase.java | 0 .../edu/wpi/first/wpilibj/IterativeRobot.java | 0 .../java/edu/wpi/first/wpilibj/Jaguar.java | 0 .../java/edu/wpi/first/wpilibj/Joystick.java | 0 .../java/edu/wpi/first/wpilibj/Kinect.java | 0 .../edu/wpi/first/wpilibj/KinectStick.java | 0 .../java/edu/wpi/first/wpilibj/Module.java | 0 .../edu/wpi/first/wpilibj/MotorSafety.java | 0 .../wpi/first/wpilibj/MotorSafetyHelper.java | 0 .../edu/wpi/first/wpilibj/NamedSendable.java | 0 .../edu/wpi/first/wpilibj/PIDController.java | 0 .../java/edu/wpi/first/wpilibj/PIDOutput.java | 0 .../java/edu/wpi/first/wpilibj/PIDSource.java | 0 .../main/java/edu/wpi/first/wpilibj/PWM.java | 0 .../edu/wpi/first/wpilibj/Preferences.java | 0 .../java/edu/wpi/first/wpilibj/Relay.java | 0 .../java/edu/wpi/first/wpilibj/Resource.java | 0 .../java/edu/wpi/first/wpilibj/RobotBase.java | 0 .../edu/wpi/first/wpilibj/RobotDrive.java | 0 .../java/edu/wpi/first/wpilibj/SafePWM.java | 0 .../java/edu/wpi/first/wpilibj/Sendable.java | 0 .../edu/wpi/first/wpilibj/SensorBase.java | 0 .../edu/wpi/first/wpilibj/SerialPort.java | 0 .../java/edu/wpi/first/wpilibj/Servo.java | 0 .../edu/wpi/first/wpilibj/SimpleRobot.java | 0 .../java/edu/wpi/first/wpilibj/Skeleton.java | 0 .../java/edu/wpi/first/wpilibj/Solenoid.java | 0 .../edu/wpi/first/wpilibj/SolenoidBase.java | 0 .../wpi/first/wpilibj/SpeedController.java | 0 .../java/edu/wpi/first/wpilibj/Talon.java | 0 .../java/edu/wpi/first/wpilibj/Timer.java | 0 .../edu/wpi/first/wpilibj/Ultrasonic.java | 0 .../java/edu/wpi/first/wpilibj/Utility.java | 0 .../java/edu/wpi/first/wpilibj/Victor.java | 0 .../java/edu/wpi/first/wpilibj/Watchdog.java | 206 +++++ .../first/wpilibj/buttons/AnalogIOButton.java | 0 .../edu/wpi/first/wpilibj/buttons/Button.java | 0 .../wpilibj/buttons/DigitalIOButton.java | 0 .../first/wpilibj/buttons/InternalButton.java | 0 .../first/wpilibj/buttons/JoystickButton.java | 0 .../first/wpilibj/buttons/NetworkButton.java | 0 .../wpi/first/wpilibj/buttons/Trigger.java | 0 .../wpi/first/wpilibj/camera/AxisCamera.java | 0 .../wpilibj/camera/AxisCameraException.java | 0 .../edu/wpi/first/wpilibj/camera/package.html | 0 .../wpilibj/can/CANExceptionFactory.java | 0 .../can/CANInvalidBufferException.java | 0 .../edu/wpi/first/wpilibj/can/CANJNI.java | 458 ++++++++++++ .../can/CANJaguarVersionException.java | 0 .../can/CANMessageNotAllowedException.java | 0 .../can/CANNotInitializedException.java | 0 .../wpilibj/can/CANTimeoutException.java | 3 + .../wpi/first/wpilibj/command/Command.java | 0 .../first/wpilibj/command/CommandGroup.java | 0 .../command/IllegalUseOfCommandException.java | 0 .../wpilibj/command/LinkedListElement.java | 0 .../wpi/first/wpilibj/command/PIDCommand.java | 0 .../first/wpilibj/command/PIDSubsystem.java | 0 .../first/wpilibj/command/PrintCommand.java | 0 .../wpi/first/wpilibj/command/Scheduler.java | 0 .../edu/wpi/first/wpilibj/command/Set.java | 0 .../first/wpilibj/command/StartCommand.java | 0 .../wpi/first/wpilibj/command/Subsystem.java | 0 .../first/wpilibj/command/WaitCommand.java | 0 .../wpilibj/command/WaitForChildren.java | 0 .../wpilibj/command/WaitUntilCommand.java | 0 .../communication/FRCCommonControlData.java | 0 .../communication/FRCCommonControlMasks.java | 0 .../FRCNetworkCommunicationsLibrary.java | 545 ++++++++++++++ .../wpilibj/communication/NIRioStatus.java | 0 .../wpilibj/communication/UsageReporting.java | 0 .../edu/wpi/first/wpilibj/hal/AnalogJNI.java | 58 ++ .../edu/wpi/first/wpilibj/hal/CounterJNI.java | 32 + .../edu/wpi/first/wpilibj/hal/DIOJNI.java | 22 + .../edu/wpi/first/wpilibj/hal/EncoderJNI.java | 20 + .../edu/wpi/first/wpilibj/hal/HALLibrary.java | 0 .../edu/wpi/first/wpilibj/hal/HALUtil.java | 0 .../edu/wpi/first/wpilibj/hal/I2CJNI.java | 9 + .../wpi/first/wpilibj/hal/InterruptJNI.java | 19 + .../edu/wpi/first/wpilibj/hal/JNIWrapper.java | 62 ++ .../edu/wpi/first/wpilibj/hal/PWMJNI.java | 23 + .../edu/wpi/first/wpilibj/hal/RelayJNI.java | 11 + .../edu/wpi/first/wpilibj/hal/SPIJNI.java | 32 + .../wpi/first/wpilibj/hal/WatchdogJNI.java | 19 + .../wpi/first/wpilibj/image/BinaryImage.java | 0 .../wpi/first/wpilibj/image/ColorImage.java | 0 .../wpilibj/image/CriteriaCollection.java | 0 .../wpi/first/wpilibj/image/CurveOptions.java | 0 .../wpilibj/image/EllipseDescriptor.java | 0 .../wpi/first/wpilibj/image/EllipseMatch.java | 0 .../edu/wpi/first/wpilibj/image/HSLImage.java | 0 .../edu/wpi/first/wpilibj/image/Image.java | 0 .../first/wpilibj/image/LinearAverages.java | 0 .../wpi/first/wpilibj/image/MonoImage.java | 0 .../edu/wpi/first/wpilibj/image/NIVision.java | 0 .../wpilibj/image/NIVisionException.java | 0 .../wpilibj/image/ParticleAnalysisReport.java | 0 .../edu/wpi/first/wpilibj/image/RGBImage.java | 0 .../first/wpilibj/image/RegionOfInterest.java | 0 .../wpilibj/image/ShapeDetectionOptions.java | 0 .../edu/wpi/first/wpilibj/image/package.html | 0 .../first/wpilibj/livewindow/LiveWindow.java | 0 .../livewindow/LiveWindowSendable.java | 0 .../java/edu/wpi/first/wpilibj/package.html | 0 .../wpi/first/wpilibj/parsing/IDevice.java | 0 .../wpilibj/parsing/IDeviceController.java | 0 .../first/wpilibj/parsing/IInputOutput.java | 0 .../wpi/first/wpilibj/parsing/IMechanism.java | 0 .../wpi/first/wpilibj/parsing/ISensor.java | 0 .../wpi/first/wpilibj/parsing/IUtility.java | 0 .../smartdashboard/SendableChooser.java | 0 .../smartdashboard/SmartDashboard.java | 0 .../wpilibj/util/AllocationException.java | 0 .../first/wpilibj/util/BoundaryException.java | 0 .../util/CheckedAllocationException.java | 0 .../wpi/first/wpilibj/util/SortedVector.java | 0 .../wpilibj/util/UncleanStatusException.java | 0 .../java/edu/wpi/first/wpilibj/visa/Visa.java | 0 .../wpi/first/wpilibj/visa/VisaException.java | 0 .../edu/wpi/first/wpilibj/visa/package.html | 0 wpilibj/wpilibJavaFinal/pom.xml | 121 +++ wpilibj/wpilibJavaJNI/pom.xml | 112 +++ .../src/main/native/AnalogJNI.cpp | 484 ++++++++++++ .../wpilibJavaJNI/src/main/native/CANJNI.cpp | 99 +++ .../src/main/native/CounterJNI.cpp | 471 ++++++++++++ .../wpilibJavaJNI/src/main/native/DIOJNI.cpp | 212 ++++++ .../src/main/native/EncoderJNI.cpp | 259 +++++++ .../FRCNetworkCommunicationsLibrary.cpp | 706 ++++++++++++++++++ .../wpilibJavaJNI/src/main/native/HALUtil.cpp | 130 ++++ .../wpilibJavaJNI/src/main/native/I2CJNI.cpp | 35 + .../src/main/native/InterruptJNI.cpp | 113 +++ .../src/main/native/JNIWrapper.cpp | 25 + .../wpilibJavaJNI/src/main/native/PWMJNI.cpp | 244 ++++++ .../src/main/native/RelayJNI.cpp | 88 +++ .../wpilibJavaJNI/src/main/native/SPIJNI.cpp | 289 +++++++ .../src/main/native/WatchdogJNI.cpp | 208 ++++++ 185 files changed, 6316 insertions(+), 1106 deletions(-) create mode 100644 hal/Athena/src/main/include/NetworkCommunication/AICalibration.h create mode 100644 hal/Athena/src/main/include/NetworkCommunication/CANInterfacePlugin.h create mode 100644 hal/Athena/src/main/include/NetworkCommunication/FRCComm.h create mode 100644 hal/Athena/src/main/include/NetworkCommunication/JaguarCANDriver.h create mode 100644 hal/Athena/src/main/include/NetworkCommunication/LoadOut.h create mode 100644 hal/Athena/src/main/include/NetworkCommunication/UsageReporting.h create mode 100644 hal/Athena/src/main/native/NetworkCommunication/CANInterfacePlugin.h create mode 100644 hal/Athena/src/main/native/NetworkCommunication/FRCComm.h create mode 100644 hal/Athena/src/main/native/NetworkCommunication/JaguarCANDriver.h create mode 100644 hal/Athena/src/main/native/NetworkCommunication/UsageReporting.h create mode 100644 hal/Athena/src/main/native/i2c-lib.h create mode 100644 hal/Athena/src/main/native/spi-lib.h create mode 100644 hal/include/src/main/include/log.h delete mode 100644 wpilibj/src/main/java/edu/wpi/first/wpilibj/can/CANLibrary.java delete mode 100644 wpilibj/src/main/java/edu/wpi/first/wpilibj/communication/FRC_NetworkCommunicationsLibrary.java create mode 100644 wpilibj/wpilibJava/pom.xml rename wpilibj/{ => wpilibJava}/src/main/java/edu/wpi/first/wpilibj/ADXL345_I2C.java (100%) rename wpilibj/{ => wpilibJava}/src/main/java/edu/wpi/first/wpilibj/Accelerometer.java (100%) rename wpilibj/{ => wpilibJava}/src/main/java/edu/wpi/first/wpilibj/AccumulatorResult.java (100%) rename wpilibj/{ => wpilibJava}/src/main/java/edu/wpi/first/wpilibj/AnalogChannel.java (100%) rename wpilibj/{ => wpilibJava}/src/main/java/edu/wpi/first/wpilibj/AnalogModule.java (100%) rename wpilibj/{ => wpilibJava}/src/main/java/edu/wpi/first/wpilibj/AnalogTrigger.java (100%) rename wpilibj/{ => wpilibJava}/src/main/java/edu/wpi/first/wpilibj/AnalogTriggerOutput.java (100%) rename wpilibj/{ => wpilibJava}/src/main/java/edu/wpi/first/wpilibj/CANJaguar.java (100%) rename wpilibj/{ => wpilibJava}/src/main/java/edu/wpi/first/wpilibj/Compressor.java (100%) rename wpilibj/{ => wpilibJava}/src/main/java/edu/wpi/first/wpilibj/Controller.java (100%) rename wpilibj/{ => wpilibJava}/src/main/java/edu/wpi/first/wpilibj/Counter.java (100%) rename wpilibj/{ => wpilibJava}/src/main/java/edu/wpi/first/wpilibj/CounterBase.java (100%) rename wpilibj/{ => wpilibJava}/src/main/java/edu/wpi/first/wpilibj/Dashboard.java (100%) rename wpilibj/{ => wpilibJava}/src/main/java/edu/wpi/first/wpilibj/DigitalInput.java (100%) rename wpilibj/{ => wpilibJava}/src/main/java/edu/wpi/first/wpilibj/DigitalModule.java (100%) rename wpilibj/{ => wpilibJava}/src/main/java/edu/wpi/first/wpilibj/DigitalOutput.java (100%) rename wpilibj/{ => wpilibJava}/src/main/java/edu/wpi/first/wpilibj/DigitalSource.java (100%) rename wpilibj/{ => wpilibJava}/src/main/java/edu/wpi/first/wpilibj/DoubleSolenoid.java (100%) rename wpilibj/{ => wpilibJava}/src/main/java/edu/wpi/first/wpilibj/DriverStation.java (100%) rename wpilibj/{ => wpilibJava}/src/main/java/edu/wpi/first/wpilibj/DriverStationEnhancedIO.java (100%) rename wpilibj/{ => wpilibJava}/src/main/java/edu/wpi/first/wpilibj/DriverStationLCD.java (100%) rename wpilibj/{ => wpilibJava}/src/main/java/edu/wpi/first/wpilibj/Encoder.java (100%) rename wpilibj/{ => wpilibJava}/src/main/java/edu/wpi/first/wpilibj/GearTooth.java (100%) rename wpilibj/{ => wpilibJava}/src/main/java/edu/wpi/first/wpilibj/GenericHID.java (100%) rename wpilibj/{ => wpilibJava}/src/main/java/edu/wpi/first/wpilibj/Gyro.java (100%) rename wpilibj/{ => wpilibJava}/src/main/java/edu/wpi/first/wpilibj/HiTechnicColorSensor.java (100%) rename wpilibj/{ => wpilibJava}/src/main/java/edu/wpi/first/wpilibj/HiTechnicCompass.java (100%) rename wpilibj/{ => wpilibJava}/src/main/java/edu/wpi/first/wpilibj/I2C.java (100%) rename wpilibj/{ => wpilibJava}/src/main/java/edu/wpi/first/wpilibj/IDashboard.java (100%) rename wpilibj/{ => wpilibJava}/src/main/java/edu/wpi/first/wpilibj/InterruptableSensorBase.java (100%) rename wpilibj/{ => wpilibJava}/src/main/java/edu/wpi/first/wpilibj/IterativeRobot.java (100%) rename wpilibj/{ => wpilibJava}/src/main/java/edu/wpi/first/wpilibj/Jaguar.java (100%) rename wpilibj/{ => wpilibJava}/src/main/java/edu/wpi/first/wpilibj/Joystick.java (100%) rename wpilibj/{ => wpilibJava}/src/main/java/edu/wpi/first/wpilibj/Kinect.java (100%) rename wpilibj/{ => wpilibJava}/src/main/java/edu/wpi/first/wpilibj/KinectStick.java (100%) rename wpilibj/{ => wpilibJava}/src/main/java/edu/wpi/first/wpilibj/Module.java (100%) rename wpilibj/{ => wpilibJava}/src/main/java/edu/wpi/first/wpilibj/MotorSafety.java (100%) rename wpilibj/{ => wpilibJava}/src/main/java/edu/wpi/first/wpilibj/MotorSafetyHelper.java (100%) rename wpilibj/{ => wpilibJava}/src/main/java/edu/wpi/first/wpilibj/NamedSendable.java (100%) rename wpilibj/{ => wpilibJava}/src/main/java/edu/wpi/first/wpilibj/PIDController.java (100%) rename wpilibj/{ => wpilibJava}/src/main/java/edu/wpi/first/wpilibj/PIDOutput.java (100%) rename wpilibj/{ => wpilibJava}/src/main/java/edu/wpi/first/wpilibj/PIDSource.java (100%) rename wpilibj/{ => wpilibJava}/src/main/java/edu/wpi/first/wpilibj/PWM.java (100%) rename wpilibj/{ => wpilibJava}/src/main/java/edu/wpi/first/wpilibj/Preferences.java (100%) rename wpilibj/{ => wpilibJava}/src/main/java/edu/wpi/first/wpilibj/Relay.java (100%) rename wpilibj/{ => wpilibJava}/src/main/java/edu/wpi/first/wpilibj/Resource.java (100%) rename wpilibj/{ => wpilibJava}/src/main/java/edu/wpi/first/wpilibj/RobotBase.java (100%) rename wpilibj/{ => wpilibJava}/src/main/java/edu/wpi/first/wpilibj/RobotDrive.java (100%) rename wpilibj/{ => wpilibJava}/src/main/java/edu/wpi/first/wpilibj/SafePWM.java (100%) rename wpilibj/{ => wpilibJava}/src/main/java/edu/wpi/first/wpilibj/Sendable.java (100%) rename wpilibj/{ => wpilibJava}/src/main/java/edu/wpi/first/wpilibj/SensorBase.java (100%) rename wpilibj/{ => wpilibJava}/src/main/java/edu/wpi/first/wpilibj/SerialPort.java (100%) rename wpilibj/{ => wpilibJava}/src/main/java/edu/wpi/first/wpilibj/Servo.java (100%) rename wpilibj/{ => wpilibJava}/src/main/java/edu/wpi/first/wpilibj/SimpleRobot.java (100%) rename wpilibj/{ => wpilibJava}/src/main/java/edu/wpi/first/wpilibj/Skeleton.java (100%) rename wpilibj/{ => wpilibJava}/src/main/java/edu/wpi/first/wpilibj/Solenoid.java (100%) rename wpilibj/{ => wpilibJava}/src/main/java/edu/wpi/first/wpilibj/SolenoidBase.java (100%) rename wpilibj/{ => wpilibJava}/src/main/java/edu/wpi/first/wpilibj/SpeedController.java (100%) rename wpilibj/{ => wpilibJava}/src/main/java/edu/wpi/first/wpilibj/Talon.java (100%) rename wpilibj/{ => wpilibJava}/src/main/java/edu/wpi/first/wpilibj/Timer.java (100%) rename wpilibj/{ => wpilibJava}/src/main/java/edu/wpi/first/wpilibj/Ultrasonic.java (100%) rename wpilibj/{ => wpilibJava}/src/main/java/edu/wpi/first/wpilibj/Utility.java (100%) rename wpilibj/{ => wpilibJava}/src/main/java/edu/wpi/first/wpilibj/Victor.java (100%) create mode 100644 wpilibj/wpilibJava/src/main/java/edu/wpi/first/wpilibj/Watchdog.java rename wpilibj/{ => wpilibJava}/src/main/java/edu/wpi/first/wpilibj/buttons/AnalogIOButton.java (100%) rename wpilibj/{ => wpilibJava}/src/main/java/edu/wpi/first/wpilibj/buttons/Button.java (100%) rename wpilibj/{ => wpilibJava}/src/main/java/edu/wpi/first/wpilibj/buttons/DigitalIOButton.java (100%) rename wpilibj/{ => wpilibJava}/src/main/java/edu/wpi/first/wpilibj/buttons/InternalButton.java (100%) rename wpilibj/{ => wpilibJava}/src/main/java/edu/wpi/first/wpilibj/buttons/JoystickButton.java (100%) rename wpilibj/{ => wpilibJava}/src/main/java/edu/wpi/first/wpilibj/buttons/NetworkButton.java (100%) rename wpilibj/{ => wpilibJava}/src/main/java/edu/wpi/first/wpilibj/buttons/Trigger.java (100%) rename wpilibj/{ => wpilibJava}/src/main/java/edu/wpi/first/wpilibj/camera/AxisCamera.java (100%) rename wpilibj/{ => wpilibJava}/src/main/java/edu/wpi/first/wpilibj/camera/AxisCameraException.java (100%) rename wpilibj/{ => wpilibJava}/src/main/java/edu/wpi/first/wpilibj/camera/package.html (100%) rename wpilibj/{ => wpilibJava}/src/main/java/edu/wpi/first/wpilibj/can/CANExceptionFactory.java (100%) rename wpilibj/{ => wpilibJava}/src/main/java/edu/wpi/first/wpilibj/can/CANInvalidBufferException.java (100%) create mode 100644 wpilibj/wpilibJava/src/main/java/edu/wpi/first/wpilibj/can/CANJNI.java rename wpilibj/{ => wpilibJava}/src/main/java/edu/wpi/first/wpilibj/can/CANJaguarVersionException.java (100%) rename wpilibj/{ => wpilibJava}/src/main/java/edu/wpi/first/wpilibj/can/CANMessageNotAllowedException.java (100%) rename wpilibj/{ => wpilibJava}/src/main/java/edu/wpi/first/wpilibj/can/CANNotInitializedException.java (100%) rename wpilibj/{ => wpilibJava}/src/main/java/edu/wpi/first/wpilibj/can/CANTimeoutException.java (90%) rename wpilibj/{ => wpilibJava}/src/main/java/edu/wpi/first/wpilibj/command/Command.java (100%) rename wpilibj/{ => wpilibJava}/src/main/java/edu/wpi/first/wpilibj/command/CommandGroup.java (100%) rename wpilibj/{ => wpilibJava}/src/main/java/edu/wpi/first/wpilibj/command/IllegalUseOfCommandException.java (100%) rename wpilibj/{ => wpilibJava}/src/main/java/edu/wpi/first/wpilibj/command/LinkedListElement.java (100%) rename wpilibj/{ => wpilibJava}/src/main/java/edu/wpi/first/wpilibj/command/PIDCommand.java (100%) rename wpilibj/{ => wpilibJava}/src/main/java/edu/wpi/first/wpilibj/command/PIDSubsystem.java (100%) rename wpilibj/{ => wpilibJava}/src/main/java/edu/wpi/first/wpilibj/command/PrintCommand.java (100%) rename wpilibj/{ => wpilibJava}/src/main/java/edu/wpi/first/wpilibj/command/Scheduler.java (100%) rename wpilibj/{ => wpilibJava}/src/main/java/edu/wpi/first/wpilibj/command/Set.java (100%) rename wpilibj/{ => wpilibJava}/src/main/java/edu/wpi/first/wpilibj/command/StartCommand.java (100%) rename wpilibj/{ => wpilibJava}/src/main/java/edu/wpi/first/wpilibj/command/Subsystem.java (100%) rename wpilibj/{ => wpilibJava}/src/main/java/edu/wpi/first/wpilibj/command/WaitCommand.java (100%) rename wpilibj/{ => wpilibJava}/src/main/java/edu/wpi/first/wpilibj/command/WaitForChildren.java (100%) rename wpilibj/{ => wpilibJava}/src/main/java/edu/wpi/first/wpilibj/command/WaitUntilCommand.java (100%) rename wpilibj/{ => wpilibJava}/src/main/java/edu/wpi/first/wpilibj/communication/FRCCommonControlData.java (100%) rename wpilibj/{ => wpilibJava}/src/main/java/edu/wpi/first/wpilibj/communication/FRCCommonControlMasks.java (100%) create mode 100644 wpilibj/wpilibJava/src/main/java/edu/wpi/first/wpilibj/communication/FRCNetworkCommunicationsLibrary.java rename wpilibj/{ => wpilibJava}/src/main/java/edu/wpi/first/wpilibj/communication/NIRioStatus.java (100%) rename wpilibj/{ => wpilibJava}/src/main/java/edu/wpi/first/wpilibj/communication/UsageReporting.java (100%) create mode 100644 wpilibj/wpilibJava/src/main/java/edu/wpi/first/wpilibj/hal/AnalogJNI.java create mode 100644 wpilibj/wpilibJava/src/main/java/edu/wpi/first/wpilibj/hal/CounterJNI.java create mode 100644 wpilibj/wpilibJava/src/main/java/edu/wpi/first/wpilibj/hal/DIOJNI.java create mode 100644 wpilibj/wpilibJava/src/main/java/edu/wpi/first/wpilibj/hal/EncoderJNI.java rename wpilibj/{ => wpilibJava}/src/main/java/edu/wpi/first/wpilibj/hal/HALLibrary.java (100%) rename wpilibj/{ => wpilibJava}/src/main/java/edu/wpi/first/wpilibj/hal/HALUtil.java (100%) create mode 100644 wpilibj/wpilibJava/src/main/java/edu/wpi/first/wpilibj/hal/I2CJNI.java create mode 100644 wpilibj/wpilibJava/src/main/java/edu/wpi/first/wpilibj/hal/InterruptJNI.java create mode 100644 wpilibj/wpilibJava/src/main/java/edu/wpi/first/wpilibj/hal/JNIWrapper.java create mode 100644 wpilibj/wpilibJava/src/main/java/edu/wpi/first/wpilibj/hal/PWMJNI.java create mode 100644 wpilibj/wpilibJava/src/main/java/edu/wpi/first/wpilibj/hal/RelayJNI.java create mode 100644 wpilibj/wpilibJava/src/main/java/edu/wpi/first/wpilibj/hal/SPIJNI.java create mode 100644 wpilibj/wpilibJava/src/main/java/edu/wpi/first/wpilibj/hal/WatchdogJNI.java rename wpilibj/{ => wpilibJava}/src/main/java/edu/wpi/first/wpilibj/image/BinaryImage.java (100%) rename wpilibj/{ => wpilibJava}/src/main/java/edu/wpi/first/wpilibj/image/ColorImage.java (100%) rename wpilibj/{ => wpilibJava}/src/main/java/edu/wpi/first/wpilibj/image/CriteriaCollection.java (100%) rename wpilibj/{ => wpilibJava}/src/main/java/edu/wpi/first/wpilibj/image/CurveOptions.java (100%) rename wpilibj/{ => wpilibJava}/src/main/java/edu/wpi/first/wpilibj/image/EllipseDescriptor.java (100%) rename wpilibj/{ => wpilibJava}/src/main/java/edu/wpi/first/wpilibj/image/EllipseMatch.java (100%) rename wpilibj/{ => wpilibJava}/src/main/java/edu/wpi/first/wpilibj/image/HSLImage.java (100%) rename wpilibj/{ => wpilibJava}/src/main/java/edu/wpi/first/wpilibj/image/Image.java (100%) rename wpilibj/{ => wpilibJava}/src/main/java/edu/wpi/first/wpilibj/image/LinearAverages.java (100%) rename wpilibj/{ => wpilibJava}/src/main/java/edu/wpi/first/wpilibj/image/MonoImage.java (100%) rename wpilibj/{ => wpilibJava}/src/main/java/edu/wpi/first/wpilibj/image/NIVision.java (100%) rename wpilibj/{ => wpilibJava}/src/main/java/edu/wpi/first/wpilibj/image/NIVisionException.java (100%) rename wpilibj/{ => wpilibJava}/src/main/java/edu/wpi/first/wpilibj/image/ParticleAnalysisReport.java (100%) rename wpilibj/{ => wpilibJava}/src/main/java/edu/wpi/first/wpilibj/image/RGBImage.java (100%) rename wpilibj/{ => wpilibJava}/src/main/java/edu/wpi/first/wpilibj/image/RegionOfInterest.java (100%) rename wpilibj/{ => wpilibJava}/src/main/java/edu/wpi/first/wpilibj/image/ShapeDetectionOptions.java (100%) rename wpilibj/{ => wpilibJava}/src/main/java/edu/wpi/first/wpilibj/image/package.html (100%) rename wpilibj/{ => wpilibJava}/src/main/java/edu/wpi/first/wpilibj/livewindow/LiveWindow.java (100%) rename wpilibj/{ => wpilibJava}/src/main/java/edu/wpi/first/wpilibj/livewindow/LiveWindowSendable.java (100%) rename wpilibj/{ => wpilibJava}/src/main/java/edu/wpi/first/wpilibj/package.html (100%) rename wpilibj/{ => wpilibJava}/src/main/java/edu/wpi/first/wpilibj/parsing/IDevice.java (100%) rename wpilibj/{ => wpilibJava}/src/main/java/edu/wpi/first/wpilibj/parsing/IDeviceController.java (100%) rename wpilibj/{ => wpilibJava}/src/main/java/edu/wpi/first/wpilibj/parsing/IInputOutput.java (100%) rename wpilibj/{ => wpilibJava}/src/main/java/edu/wpi/first/wpilibj/parsing/IMechanism.java (100%) rename wpilibj/{ => wpilibJava}/src/main/java/edu/wpi/first/wpilibj/parsing/ISensor.java (100%) rename wpilibj/{ => wpilibJava}/src/main/java/edu/wpi/first/wpilibj/parsing/IUtility.java (100%) rename wpilibj/{ => wpilibJava}/src/main/java/edu/wpi/first/wpilibj/smartdashboard/SendableChooser.java (100%) rename wpilibj/{ => wpilibJava}/src/main/java/edu/wpi/first/wpilibj/smartdashboard/SmartDashboard.java (100%) rename wpilibj/{ => wpilibJava}/src/main/java/edu/wpi/first/wpilibj/util/AllocationException.java (100%) rename wpilibj/{ => wpilibJava}/src/main/java/edu/wpi/first/wpilibj/util/BoundaryException.java (100%) rename wpilibj/{ => wpilibJava}/src/main/java/edu/wpi/first/wpilibj/util/CheckedAllocationException.java (100%) rename wpilibj/{ => wpilibJava}/src/main/java/edu/wpi/first/wpilibj/util/SortedVector.java (100%) rename wpilibj/{ => wpilibJava}/src/main/java/edu/wpi/first/wpilibj/util/UncleanStatusException.java (100%) rename wpilibj/{ => wpilibJava}/src/main/java/edu/wpi/first/wpilibj/visa/Visa.java (100%) rename wpilibj/{ => wpilibJava}/src/main/java/edu/wpi/first/wpilibj/visa/VisaException.java (100%) rename wpilibj/{ => wpilibJava}/src/main/java/edu/wpi/first/wpilibj/visa/package.html (100%) create mode 100644 wpilibj/wpilibJavaFinal/pom.xml create mode 100644 wpilibj/wpilibJavaJNI/pom.xml create mode 100644 wpilibj/wpilibJavaJNI/src/main/native/AnalogJNI.cpp create mode 100644 wpilibj/wpilibJavaJNI/src/main/native/CANJNI.cpp create mode 100644 wpilibj/wpilibJavaJNI/src/main/native/CounterJNI.cpp create mode 100644 wpilibj/wpilibJavaJNI/src/main/native/DIOJNI.cpp create mode 100644 wpilibj/wpilibJavaJNI/src/main/native/EncoderJNI.cpp create mode 100644 wpilibj/wpilibJavaJNI/src/main/native/FRCNetworkCommunicationsLibrary.cpp create mode 100644 wpilibj/wpilibJavaJNI/src/main/native/HALUtil.cpp create mode 100644 wpilibj/wpilibJavaJNI/src/main/native/I2CJNI.cpp create mode 100644 wpilibj/wpilibJavaJNI/src/main/native/InterruptJNI.cpp create mode 100644 wpilibj/wpilibJavaJNI/src/main/native/JNIWrapper.cpp create mode 100644 wpilibj/wpilibJavaJNI/src/main/native/PWMJNI.cpp create mode 100644 wpilibj/wpilibJavaJNI/src/main/native/RelayJNI.cpp create mode 100644 wpilibj/wpilibJavaJNI/src/main/native/SPIJNI.cpp create mode 100644 wpilibj/wpilibJavaJNI/src/main/native/WatchdogJNI.cpp diff --git a/hal/Athena/src/main/include/NetworkCommunication/AICalibration.h b/hal/Athena/src/main/include/NetworkCommunication/AICalibration.h new file mode 100644 index 0000000000..39755bda89 --- /dev/null +++ b/hal/Athena/src/main/include/NetworkCommunication/AICalibration.h @@ -0,0 +1,19 @@ + +#ifndef __AICalibration_h__ +#define __AICalibration_h__ + +#include + +#ifdef __cplusplus +extern "C" +{ +#endif + + uint32_t FRC_NetworkCommunication_nAICalibration_getLSBWeight(const uint32_t aiSystemIndex, const uint32_t channel, int32_t *status); + int32_t FRC_NetworkCommunication_nAICalibration_getOffset(const uint32_t aiSystemIndex, const uint32_t channel, int32_t *status); + +#ifdef __cplusplus +} +#endif + +#endif // __AICalibration_h__ diff --git a/hal/Athena/src/main/include/NetworkCommunication/CANInterfacePlugin.h b/hal/Athena/src/main/include/NetworkCommunication/CANInterfacePlugin.h new file mode 100644 index 0000000000..a637eb1d9b --- /dev/null +++ b/hal/Athena/src/main/include/NetworkCommunication/CANInterfacePlugin.h @@ -0,0 +1,61 @@ +// CANInterfacePlugin.h +// +// Defines the API for building a CAN Interface Plugin to support +// PWM-cable-free CAN motor control on FRC robots. This allows you +// to connect any CAN interface to the secure Jaguar CAN driver. +// + +#ifndef __CANInterfacePlugin_h__ +#define __CANInterfacePlugin_h__ + +#include + +#define CAN_IS_FRAME_REMOTE 0x80000000 +#define CAN_MESSAGE_ID_MASK 0x1FFFFFFF + +class CANInterfacePlugin +{ +public: + CANInterfacePlugin() {} + virtual ~CANInterfacePlugin() {} + + /** + * This entry-point of the CANInterfacePlugin is passed a message that the driver needs to send to + * a device on the CAN bus. + * + * This function may be called from multiple contexts and must therefore be reentrant. + * + * @param messageID The 29-bit CAN message ID in the lsbs. The msb can indicate a remote frame. + * @param data A pointer to a buffer containing between 0 and 8 bytes to send with the message. May be NULL if dataSize is 0. + * @param dataSize The number of bytes to send with the message. + * @return Return any error code. On success return 0. + */ + virtual int32_t sendMessage(uint32_t messageID, const uint8_t *data, uint8_t dataSize) = 0; + + /** + * This entry-point of the CANInterfacePlugin is passed buffers which should be populated with + * any received messages from devices on the CAN bus. + * + * This function is always called by a single task in the Jaguar driver, so it need not be reentrant. + * + * This function is expected to block for some period of time waiting for a message from the CAN bus. + * It may timeout periodically (returning non-zero to indicate no message was populated) to allow for + * shutdown and unloading of the plugin. + * + * @param messageID A reference to be populated with a received 29-bit CAN message ID in the lsbs. + * @param data A pointer to a buffer of 8 bytes to be populated with data received with the message. + * @param dataSize A reference to be populated with the size of the data received (0 - 8 bytes). + * @return This should return 0 if a message was populated, non-0 if no message was not populated. + */ + virtual int32_t receiveMessage(uint32_t &messageID, uint8_t *data, uint8_t &dataSize) = 0; +}; + +/** + * This function allows you to register a CANInterfacePlugin to provide access a CAN bus. + * + * @param interface A pointer to an object that inherits from CANInterfacePlugin and implements + * the pure virtual interface. If NULL, unregister the current plugin. + */ +void FRC_NetworkCommunication_JaguarCANDriver_registerInterface(CANInterfacePlugin* interface); + +#endif // __CANInterfacePlugin_h__ diff --git a/hal/Athena/src/main/include/NetworkCommunication/FRCComm.h b/hal/Athena/src/main/include/NetworkCommunication/FRCComm.h new file mode 100644 index 0000000000..e971fac1a5 --- /dev/null +++ b/hal/Athena/src/main/include/NetworkCommunication/FRCComm.h @@ -0,0 +1,193 @@ +/************************************************************* + * NOTICE + * + * These are the only externally exposed functions to the + * NetworkCommunication library + * + * This is an implementation of FRC Spec for Comm Protocol + * Revision 4.5, June 30, 2008 + * + * Copyright (c) National Instruments 2008. All Rights Reserved. + * + *************************************************************/ + +#ifndef __FRC_COMM_H__ +#define __FRC_COMM_H__ + +#ifdef SIMULATION +#include +#define EXPORT_FUNC __declspec(dllexport) __cdecl +#else +#if defined(__vxworks) +#include +#define EXPORT_FUNC +#else +#include +#include +#define EXPORT_FUNC +#endif +#endif + +// Commandeer some bytes at the end for advanced I/O feedback. +#define IO_CONFIG_DATA_SIZE 32 +#define SYS_STATUS_DATA_SIZE 44 +#define USER_STATUS_DATA_SIZE (984 - IO_CONFIG_DATA_SIZE - SYS_STATUS_DATA_SIZE) +#define USER_DS_LCD_DATA_SIZE 128 + +struct FRCCommonControlData{ + uint16_t packetIndex; + union { + uint8_t control; +#ifndef __vxworks + struct { + uint8_t checkVersions :1; + uint8_t test :1; + uint8_t resync : 1; + uint8_t fmsAttached:1; + uint8_t autonomous : 1; + uint8_t enabled : 1; + uint8_t notEStop : 1; + uint8_t reset : 1; + }; +#else + struct { + uint8_t reset : 1; + uint8_t notEStop : 1; + uint8_t enabled : 1; + uint8_t autonomous : 1; + uint8_t fmsAttached:1; + uint8_t resync : 1; + uint8_t test :1; + uint8_t checkVersions :1; + }; +#endif + }; + uint8_t dsDigitalIn; + uint16_t teamID; + + char dsID_Alliance; + char dsID_Position; + + union { + int8_t stick0Axes[6]; + struct { + int8_t stick0Axis1; + int8_t stick0Axis2; + int8_t stick0Axis3; + int8_t stick0Axis4; + int8_t stick0Axis5; + int8_t stick0Axis6; + }; + }; + uint16_t stick0Buttons; // Left-most 4 bits are unused + + union { + int8_t stick1Axes[6]; + struct { + int8_t stick1Axis1; + int8_t stick1Axis2; + int8_t stick1Axis3; + int8_t stick1Axis4; + int8_t stick1Axis5; + int8_t stick1Axis6; + }; + }; + uint16_t stick1Buttons; // Left-most 4 bits are unused + + union { + int8_t stick2Axes[6]; + struct { + int8_t stick2Axis1; + int8_t stick2Axis2; + int8_t stick2Axis3; + int8_t stick2Axis4; + int8_t stick2Axis5; + int8_t stick2Axis6; + }; + }; + uint16_t stick2Buttons; // Left-most 4 bits are unused + + union { + int8_t stick3Axes[6]; + struct { + int8_t stick3Axis1; + int8_t stick3Axis2; + int8_t stick3Axis3; + int8_t stick3Axis4; + int8_t stick3Axis5; + int8_t stick3Axis6; + }; + }; + uint16_t stick3Buttons; // Left-most 4 bits are unused + + //Analog inputs are 10 bit right-justified + uint16_t analog1; + uint16_t analog2; + uint16_t analog3; + uint16_t analog4; + + uint64_t cRIOChecksum; + uint32_t FPGAChecksum0; + uint32_t FPGAChecksum1; + uint32_t FPGAChecksum2; + uint32_t FPGAChecksum3; + + char versionData[8]; +}; + +#define kFRC_NetworkCommunication_DynamicType_DSEnhancedIO_Input 17 +#define kFRC_NetworkCommunication_DynamicType_DSEnhancedIO_Output 18 +#define kFRC_NetworkCommunication_DynamicType_Kinect_Header 19 +#define kFRC_NetworkCommunication_DynamicType_Kinect_Extra1 20 +#define kFRC_NetworkCommunication_DynamicType_Kinect_Vertices1 21 +#define kFRC_NetworkCommunication_DynamicType_Kinect_Extra2 22 +#define kFRC_NetworkCommunication_DynamicType_Kinect_Vertices2 23 +#define kFRC_NetworkCommunication_DynamicType_Kinect_Joystick 24 +#define kFRC_NetworkCommunication_DynamicType_Kinect_Custom 25 + +extern "C" { +#ifndef SIMULATION + void EXPORT_FUNC getFPGAHardwareVersion(uint16_t *fpgaVersion, uint32_t *fpgaRevision); +#endif + int EXPORT_FUNC getCommonControlData(FRCCommonControlData *data, int wait_ms); + int EXPORT_FUNC getRecentCommonControlData(FRCCommonControlData *commonData, int wait_ms); + int EXPORT_FUNC getRecentStatusData(uint8_t *batteryInt, uint8_t *batteryDec, uint8_t *dsDigitalOut, int wait_ms); + int EXPORT_FUNC getDynamicControlData(uint8_t type, char *dynamicData, int32_t maxLength, int wait_ms); + int EXPORT_FUNC setStatusData(float battery, uint8_t dsDigitalOut, uint8_t updateNumber, + const char *userDataHigh, int userDataHighLength, + const char *userDataLow, int userDataLowLength, int wait_ms); + int EXPORT_FUNC setStatusDataFloatAsInt(int battery, uint8_t dsDigitalOut, uint8_t updateNumber, + const char *userDataHigh, int userDataHighLength, + const char *userDataLow, int userDataLowLength, int wait_ms); + int EXPORT_FUNC setErrorData(const char *errors, int errorsLength, int wait_ms); + int EXPORT_FUNC setUserDsLcdData(const char *userDsLcdData, int userDsLcdDataLength, int wait_ms); + int EXPORT_FUNC overrideIOConfig(const char *ioConfig, int wait_ms); + +#ifdef SIMULATION + void EXPORT_FUNC setNewDataSem(HANDLE); +#else +# if defined (__vxworks) + void EXPORT_FUNC setNewDataSem(SEM_ID); + void EXPORT_FUNC setResyncSem(SEM_ID); +# else + void EXPORT_FUNC setNewDataSem(pthread_mutex_t *); + void EXPORT_FUNC setResyncSem(pthread_mutex_t *); +# endif + void EXPORT_FUNC signalResyncActionDone(void); +#endif + + // this uint32_t is really a LVRefNum + void EXPORT_FUNC setNewDataOccurRef(uint32_t refnum); +#ifndef SIMULATION + void EXPORT_FUNC setResyncOccurRef(uint32_t refnum); +#endif + + void EXPORT_FUNC FRC_NetworkCommunication_getVersionString(char *version); + void EXPORT_FUNC FRC_NetworkCommunication_observeUserProgramStarting(void); + void EXPORT_FUNC FRC_NetworkCommunication_observeUserProgramDisabled(void); + void EXPORT_FUNC FRC_NetworkCommunication_observeUserProgramAutonomous(void); + void EXPORT_FUNC FRC_NetworkCommunication_observeUserProgramTeleop(void); + void EXPORT_FUNC FRC_NetworkCommunication_observeUserProgramTest(void); +}; + +#endif diff --git a/hal/Athena/src/main/include/NetworkCommunication/JaguarCANDriver.h b/hal/Athena/src/main/include/NetworkCommunication/JaguarCANDriver.h new file mode 100644 index 0000000000..b466f6d1b6 --- /dev/null +++ b/hal/Athena/src/main/include/NetworkCommunication/JaguarCANDriver.h @@ -0,0 +1,37 @@ +// JaguarCANDriver.h +// +// Defines the API for building a CAN Interface Plugin to support +// PWM-cable-free CAN motor control on FRC robots. This allows you +// to connect any CAN interface to the secure Jaguar CAN driver. +// + +#ifndef __JaguarCANDriver_h__ +#define __JaguarCANDriver_h__ + +#if defined(__vxworks) +#include +#else +#include +#include +#endif + +#ifdef __cplusplus +extern "C" +{ +#endif + + void FRC_NetworkCommunication_JaguarCANDriver_sendMessage(uint32_t messageID, const uint8_t *data, uint8_t dataSize, int32_t *status); + void FRC_NetworkCommunication_JaguarCANDriver_receiveMessage(uint32_t *messageID, uint8_t *data, uint8_t *dataSize, uint32_t timeoutMs, int32_t *status); + int32_t FRC_NetworkCommunication_JaguarCANDriver_receiveMessageStart(uint32_t messageID, uint32_t occurRefNum, uint32_t timeoutMs, int32_t *status); +#if defined (__vxworks) + int32_t FRC_NetworkCommunication_JaguarCANDriver_receiveMessageStart_sem(uint32_t messageID, uint32_t semaphoreID, uint32_t timeoutMs, int32_t *status); +#else + int32_t FRC_NetworkCommunication_JaguarCANDriver_receiveMessageStart_mutex(uint32_t messageID, pthread_mutex_t *mutex, uint32_t timeoutMs, int32_t *status); +#endif + void FRC_NetworkCommunication_JaguarCANDriver_receiveMessageComplete(uint32_t *messageID, uint8_t *data, uint8_t *dataSize, int32_t *status); + +#ifdef __cplusplus +} +#endif + +#endif // __JaguarCANDriver_h__ diff --git a/hal/Athena/src/main/include/NetworkCommunication/LoadOut.h b/hal/Athena/src/main/include/NetworkCommunication/LoadOut.h new file mode 100644 index 0000000000..0304b30665 --- /dev/null +++ b/hal/Athena/src/main/include/NetworkCommunication/LoadOut.h @@ -0,0 +1,52 @@ + +#ifndef __LoadOut_h__ +#define __LoadOut_h__ + +#ifdef SIMULATION +#include +#define EXPORT_FUNC __declspec(dllexport) __cdecl +#elif defined (__vxworks) +#include +#define EXPORT_FUNC +#else +#include +#define EXPORT_FUNC +#endif + +#define kMaxModuleNumber 2 +namespace nLoadOut +{ + typedef enum { + kModuleType_Unknown = 0x00, + kModuleType_Analog = 0x01, + kModuleType_Digital = 0x02, + kModuleType_Solenoid = 0x03, + } tModuleType; + bool EXPORT_FUNC getModulePresence(tModuleType moduleType, uint8_t moduleNumber); + typedef enum { + kTargetClass_Unknown = 0x00, + kTargetClass_FRC1 = 0x10, + kTargetClass_FRC2 = 0x20, + kTargetClass_FRC3 = 0x30, + kTargetClass_RoboRIO = 0x40, + kTargetClass_FRC2_Analog = kTargetClass_FRC2 | kModuleType_Analog, + kTargetClass_FRC2_Digital = kTargetClass_FRC2 | kModuleType_Digital, + kTargetClass_FRC2_Solenoid = kTargetClass_FRC2 | kModuleType_Solenoid, + kTargetClass_FamilyMask = 0xF0, + kTargetClass_ModuleMask = 0x0F, + } tTargetClass; + tTargetClass EXPORT_FUNC getTargetClass(); +} + +#ifdef __cplusplus +extern "C" { +#endif + + uint32_t EXPORT_FUNC FRC_NetworkCommunication_nLoadOut_getModulePresence(uint32_t moduleType, uint8_t moduleNumber); + uint32_t EXPORT_FUNC FRC_NetworkCommunication_nLoadOut_getTargetClass(); + +#ifdef __cplusplus +} +#endif + +#endif // __LoadOut_h__ diff --git a/hal/Athena/src/main/include/NetworkCommunication/UsageReporting.h b/hal/Athena/src/main/include/NetworkCommunication/UsageReporting.h new file mode 100644 index 0000000000..2c7499ea61 --- /dev/null +++ b/hal/Athena/src/main/include/NetworkCommunication/UsageReporting.h @@ -0,0 +1,139 @@ + +#ifndef __UsageReporting_h__ +#define __UsageReporting_h__ + +#ifdef SIMULATION +#include +#define EXPORT_FUNC __declspec(dllexport) __cdecl +#elif defined (__vxworks) +#include +#define EXPORT_FUNC +#else +#include +#include +#define EXPORT_FUNC +#endif + +#define kUsageReporting_version 1 + +namespace nUsageReporting +{ + typedef enum + { + kResourceType_Controller, + kResourceType_Module, + kResourceType_Language, + kResourceType_CANPlugin, + kResourceType_Accelerometer, + kResourceType_ADXL345, + kResourceType_AnalogChannel, + kResourceType_AnalogTrigger, + kResourceType_AnalogTriggerOutput, + kResourceType_CANJaguar, + kResourceType_Compressor, + kResourceType_Counter, + kResourceType_Dashboard, + kResourceType_DigitalInput, + kResourceType_DigitalOutput, + kResourceType_DriverStationCIO, + kResourceType_DriverStationEIO, + kResourceType_DriverStationLCD, + kResourceType_Encoder, + kResourceType_GearTooth, + kResourceType_Gyro, + kResourceType_I2C, + kResourceType_Framework, + kResourceType_Jaguar, + kResourceType_Joystick, + kResourceType_Kinect, + kResourceType_KinectStick, + kResourceType_PIDController, + kResourceType_Preferences, + kResourceType_PWM, + kResourceType_Relay, + kResourceType_RobotDrive, + kResourceType_SerialPort, + kResourceType_Servo, + kResourceType_Solenoid, + kResourceType_SPI, + kResourceType_Task, + kResourceType_Ultrasonic, + kResourceType_Victor, + kResourceType_Button, + kResourceType_Command, + kResourceType_AxisCamera, + kResourceType_PCVideoServer, + kResourceType_SmartDashboard, + kResourceType_Talon, + kResourceType_HiTechnicColorSensor, + kResourceType_HiTechnicAccel, + kResourceType_HiTechnicCompass, + kResourceType_SRF08, + } tResourceType; + + typedef enum + { + kLanguage_LabVIEW = 1, + kLanguage_CPlusPlus = 2, + kLanguage_Java = 3, + kLanguage_Python = 4, + + kCANPlugin_BlackJagBridge = 1, + kCANPlugin_2CAN = 2, + + kFramework_Iterative = 1, + kFramework_Simple = 2, + + kRobotDrive_ArcadeStandard = 1, + kRobotDrive_ArcadeButtonSpin = 2, + kRobotDrive_ArcadeRatioCurve = 3, + kRobotDrive_Tank = 4, + kRobotDrive_MecanumPolar = 5, + kRobotDrive_MecanumCartesian = 6, + + kDriverStationCIO_Analog = 1, + kDriverStationCIO_DigitalIn = 2, + kDriverStationCIO_DigitalOut = 3, + + kDriverStationEIO_Acceleration = 1, + kDriverStationEIO_AnalogIn = 2, + kDriverStationEIO_AnalogOut = 3, + kDriverStationEIO_Button = 4, + kDriverStationEIO_LED = 5, + kDriverStationEIO_DigitalIn = 6, + kDriverStationEIO_DigitalOut = 7, + kDriverStationEIO_FixedDigitalOut = 8, + kDriverStationEIO_PWM = 9, + kDriverStationEIO_Encoder = 10, + kDriverStationEIO_TouchSlider = 11, + + kADXL345_SPI = 1, + kADXL345_I2C = 2, + + kCommand_Scheduler = 1, + + kSmartDashboard_Instance = 1, + } tInstances; + + /** + * Report the usage of a resource of interest. + * + * @param resource one of the values in the tResourceType above (max value 51). + * @param instanceNumber an index that identifies the resource instance. + * @param context an optional additional context number for some cases (such as module number). Set to 0 to omit. + * @param feature a string to be included describing features in use on a specific resource. Setting the same resource more than once allows you to change the feature string. + */ + uint32_t EXPORT_FUNC report(tResourceType resource, uint8_t instanceNumber, uint8_t context = 0, const char *feature = NULL); +} + +#ifdef __cplusplus +extern "C" { +#endif + + uint32_t EXPORT_FUNC FRC_NetworkCommunication_nUsageReporting_report(uint8_t resource, uint8_t instanceNumber, uint8_t context, const char *feature); + +#ifdef __cplusplus +} +#endif + +#endif // __UsageReporting_h__ diff --git a/hal/Athena/src/main/native/NetworkCommunication/CANInterfacePlugin.h b/hal/Athena/src/main/native/NetworkCommunication/CANInterfacePlugin.h new file mode 100644 index 0000000000..a637eb1d9b --- /dev/null +++ b/hal/Athena/src/main/native/NetworkCommunication/CANInterfacePlugin.h @@ -0,0 +1,61 @@ +// CANInterfacePlugin.h +// +// Defines the API for building a CAN Interface Plugin to support +// PWM-cable-free CAN motor control on FRC robots. This allows you +// to connect any CAN interface to the secure Jaguar CAN driver. +// + +#ifndef __CANInterfacePlugin_h__ +#define __CANInterfacePlugin_h__ + +#include + +#define CAN_IS_FRAME_REMOTE 0x80000000 +#define CAN_MESSAGE_ID_MASK 0x1FFFFFFF + +class CANInterfacePlugin +{ +public: + CANInterfacePlugin() {} + virtual ~CANInterfacePlugin() {} + + /** + * This entry-point of the CANInterfacePlugin is passed a message that the driver needs to send to + * a device on the CAN bus. + * + * This function may be called from multiple contexts and must therefore be reentrant. + * + * @param messageID The 29-bit CAN message ID in the lsbs. The msb can indicate a remote frame. + * @param data A pointer to a buffer containing between 0 and 8 bytes to send with the message. May be NULL if dataSize is 0. + * @param dataSize The number of bytes to send with the message. + * @return Return any error code. On success return 0. + */ + virtual int32_t sendMessage(uint32_t messageID, const uint8_t *data, uint8_t dataSize) = 0; + + /** + * This entry-point of the CANInterfacePlugin is passed buffers which should be populated with + * any received messages from devices on the CAN bus. + * + * This function is always called by a single task in the Jaguar driver, so it need not be reentrant. + * + * This function is expected to block for some period of time waiting for a message from the CAN bus. + * It may timeout periodically (returning non-zero to indicate no message was populated) to allow for + * shutdown and unloading of the plugin. + * + * @param messageID A reference to be populated with a received 29-bit CAN message ID in the lsbs. + * @param data A pointer to a buffer of 8 bytes to be populated with data received with the message. + * @param dataSize A reference to be populated with the size of the data received (0 - 8 bytes). + * @return This should return 0 if a message was populated, non-0 if no message was not populated. + */ + virtual int32_t receiveMessage(uint32_t &messageID, uint8_t *data, uint8_t &dataSize) = 0; +}; + +/** + * This function allows you to register a CANInterfacePlugin to provide access a CAN bus. + * + * @param interface A pointer to an object that inherits from CANInterfacePlugin and implements + * the pure virtual interface. If NULL, unregister the current plugin. + */ +void FRC_NetworkCommunication_JaguarCANDriver_registerInterface(CANInterfacePlugin* interface); + +#endif // __CANInterfacePlugin_h__ diff --git a/hal/Athena/src/main/native/NetworkCommunication/FRCComm.h b/hal/Athena/src/main/native/NetworkCommunication/FRCComm.h new file mode 100644 index 0000000000..e971fac1a5 --- /dev/null +++ b/hal/Athena/src/main/native/NetworkCommunication/FRCComm.h @@ -0,0 +1,193 @@ +/************************************************************* + * NOTICE + * + * These are the only externally exposed functions to the + * NetworkCommunication library + * + * This is an implementation of FRC Spec for Comm Protocol + * Revision 4.5, June 30, 2008 + * + * Copyright (c) National Instruments 2008. All Rights Reserved. + * + *************************************************************/ + +#ifndef __FRC_COMM_H__ +#define __FRC_COMM_H__ + +#ifdef SIMULATION +#include +#define EXPORT_FUNC __declspec(dllexport) __cdecl +#else +#if defined(__vxworks) +#include +#define EXPORT_FUNC +#else +#include +#include +#define EXPORT_FUNC +#endif +#endif + +// Commandeer some bytes at the end for advanced I/O feedback. +#define IO_CONFIG_DATA_SIZE 32 +#define SYS_STATUS_DATA_SIZE 44 +#define USER_STATUS_DATA_SIZE (984 - IO_CONFIG_DATA_SIZE - SYS_STATUS_DATA_SIZE) +#define USER_DS_LCD_DATA_SIZE 128 + +struct FRCCommonControlData{ + uint16_t packetIndex; + union { + uint8_t control; +#ifndef __vxworks + struct { + uint8_t checkVersions :1; + uint8_t test :1; + uint8_t resync : 1; + uint8_t fmsAttached:1; + uint8_t autonomous : 1; + uint8_t enabled : 1; + uint8_t notEStop : 1; + uint8_t reset : 1; + }; +#else + struct { + uint8_t reset : 1; + uint8_t notEStop : 1; + uint8_t enabled : 1; + uint8_t autonomous : 1; + uint8_t fmsAttached:1; + uint8_t resync : 1; + uint8_t test :1; + uint8_t checkVersions :1; + }; +#endif + }; + uint8_t dsDigitalIn; + uint16_t teamID; + + char dsID_Alliance; + char dsID_Position; + + union { + int8_t stick0Axes[6]; + struct { + int8_t stick0Axis1; + int8_t stick0Axis2; + int8_t stick0Axis3; + int8_t stick0Axis4; + int8_t stick0Axis5; + int8_t stick0Axis6; + }; + }; + uint16_t stick0Buttons; // Left-most 4 bits are unused + + union { + int8_t stick1Axes[6]; + struct { + int8_t stick1Axis1; + int8_t stick1Axis2; + int8_t stick1Axis3; + int8_t stick1Axis4; + int8_t stick1Axis5; + int8_t stick1Axis6; + }; + }; + uint16_t stick1Buttons; // Left-most 4 bits are unused + + union { + int8_t stick2Axes[6]; + struct { + int8_t stick2Axis1; + int8_t stick2Axis2; + int8_t stick2Axis3; + int8_t stick2Axis4; + int8_t stick2Axis5; + int8_t stick2Axis6; + }; + }; + uint16_t stick2Buttons; // Left-most 4 bits are unused + + union { + int8_t stick3Axes[6]; + struct { + int8_t stick3Axis1; + int8_t stick3Axis2; + int8_t stick3Axis3; + int8_t stick3Axis4; + int8_t stick3Axis5; + int8_t stick3Axis6; + }; + }; + uint16_t stick3Buttons; // Left-most 4 bits are unused + + //Analog inputs are 10 bit right-justified + uint16_t analog1; + uint16_t analog2; + uint16_t analog3; + uint16_t analog4; + + uint64_t cRIOChecksum; + uint32_t FPGAChecksum0; + uint32_t FPGAChecksum1; + uint32_t FPGAChecksum2; + uint32_t FPGAChecksum3; + + char versionData[8]; +}; + +#define kFRC_NetworkCommunication_DynamicType_DSEnhancedIO_Input 17 +#define kFRC_NetworkCommunication_DynamicType_DSEnhancedIO_Output 18 +#define kFRC_NetworkCommunication_DynamicType_Kinect_Header 19 +#define kFRC_NetworkCommunication_DynamicType_Kinect_Extra1 20 +#define kFRC_NetworkCommunication_DynamicType_Kinect_Vertices1 21 +#define kFRC_NetworkCommunication_DynamicType_Kinect_Extra2 22 +#define kFRC_NetworkCommunication_DynamicType_Kinect_Vertices2 23 +#define kFRC_NetworkCommunication_DynamicType_Kinect_Joystick 24 +#define kFRC_NetworkCommunication_DynamicType_Kinect_Custom 25 + +extern "C" { +#ifndef SIMULATION + void EXPORT_FUNC getFPGAHardwareVersion(uint16_t *fpgaVersion, uint32_t *fpgaRevision); +#endif + int EXPORT_FUNC getCommonControlData(FRCCommonControlData *data, int wait_ms); + int EXPORT_FUNC getRecentCommonControlData(FRCCommonControlData *commonData, int wait_ms); + int EXPORT_FUNC getRecentStatusData(uint8_t *batteryInt, uint8_t *batteryDec, uint8_t *dsDigitalOut, int wait_ms); + int EXPORT_FUNC getDynamicControlData(uint8_t type, char *dynamicData, int32_t maxLength, int wait_ms); + int EXPORT_FUNC setStatusData(float battery, uint8_t dsDigitalOut, uint8_t updateNumber, + const char *userDataHigh, int userDataHighLength, + const char *userDataLow, int userDataLowLength, int wait_ms); + int EXPORT_FUNC setStatusDataFloatAsInt(int battery, uint8_t dsDigitalOut, uint8_t updateNumber, + const char *userDataHigh, int userDataHighLength, + const char *userDataLow, int userDataLowLength, int wait_ms); + int EXPORT_FUNC setErrorData(const char *errors, int errorsLength, int wait_ms); + int EXPORT_FUNC setUserDsLcdData(const char *userDsLcdData, int userDsLcdDataLength, int wait_ms); + int EXPORT_FUNC overrideIOConfig(const char *ioConfig, int wait_ms); + +#ifdef SIMULATION + void EXPORT_FUNC setNewDataSem(HANDLE); +#else +# if defined (__vxworks) + void EXPORT_FUNC setNewDataSem(SEM_ID); + void EXPORT_FUNC setResyncSem(SEM_ID); +# else + void EXPORT_FUNC setNewDataSem(pthread_mutex_t *); + void EXPORT_FUNC setResyncSem(pthread_mutex_t *); +# endif + void EXPORT_FUNC signalResyncActionDone(void); +#endif + + // this uint32_t is really a LVRefNum + void EXPORT_FUNC setNewDataOccurRef(uint32_t refnum); +#ifndef SIMULATION + void EXPORT_FUNC setResyncOccurRef(uint32_t refnum); +#endif + + void EXPORT_FUNC FRC_NetworkCommunication_getVersionString(char *version); + void EXPORT_FUNC FRC_NetworkCommunication_observeUserProgramStarting(void); + void EXPORT_FUNC FRC_NetworkCommunication_observeUserProgramDisabled(void); + void EXPORT_FUNC FRC_NetworkCommunication_observeUserProgramAutonomous(void); + void EXPORT_FUNC FRC_NetworkCommunication_observeUserProgramTeleop(void); + void EXPORT_FUNC FRC_NetworkCommunication_observeUserProgramTest(void); +}; + +#endif diff --git a/hal/Athena/src/main/native/NetworkCommunication/JaguarCANDriver.h b/hal/Athena/src/main/native/NetworkCommunication/JaguarCANDriver.h new file mode 100644 index 0000000000..b466f6d1b6 --- /dev/null +++ b/hal/Athena/src/main/native/NetworkCommunication/JaguarCANDriver.h @@ -0,0 +1,37 @@ +// JaguarCANDriver.h +// +// Defines the API for building a CAN Interface Plugin to support +// PWM-cable-free CAN motor control on FRC robots. This allows you +// to connect any CAN interface to the secure Jaguar CAN driver. +// + +#ifndef __JaguarCANDriver_h__ +#define __JaguarCANDriver_h__ + +#if defined(__vxworks) +#include +#else +#include +#include +#endif + +#ifdef __cplusplus +extern "C" +{ +#endif + + void FRC_NetworkCommunication_JaguarCANDriver_sendMessage(uint32_t messageID, const uint8_t *data, uint8_t dataSize, int32_t *status); + void FRC_NetworkCommunication_JaguarCANDriver_receiveMessage(uint32_t *messageID, uint8_t *data, uint8_t *dataSize, uint32_t timeoutMs, int32_t *status); + int32_t FRC_NetworkCommunication_JaguarCANDriver_receiveMessageStart(uint32_t messageID, uint32_t occurRefNum, uint32_t timeoutMs, int32_t *status); +#if defined (__vxworks) + int32_t FRC_NetworkCommunication_JaguarCANDriver_receiveMessageStart_sem(uint32_t messageID, uint32_t semaphoreID, uint32_t timeoutMs, int32_t *status); +#else + int32_t FRC_NetworkCommunication_JaguarCANDriver_receiveMessageStart_mutex(uint32_t messageID, pthread_mutex_t *mutex, uint32_t timeoutMs, int32_t *status); +#endif + void FRC_NetworkCommunication_JaguarCANDriver_receiveMessageComplete(uint32_t *messageID, uint8_t *data, uint8_t *dataSize, int32_t *status); + +#ifdef __cplusplus +} +#endif + +#endif // __JaguarCANDriver_h__ diff --git a/hal/Athena/src/main/native/NetworkCommunication/UsageReporting.h b/hal/Athena/src/main/native/NetworkCommunication/UsageReporting.h new file mode 100644 index 0000000000..2c7499ea61 --- /dev/null +++ b/hal/Athena/src/main/native/NetworkCommunication/UsageReporting.h @@ -0,0 +1,139 @@ + +#ifndef __UsageReporting_h__ +#define __UsageReporting_h__ + +#ifdef SIMULATION +#include +#define EXPORT_FUNC __declspec(dllexport) __cdecl +#elif defined (__vxworks) +#include +#define EXPORT_FUNC +#else +#include +#include +#define EXPORT_FUNC +#endif + +#define kUsageReporting_version 1 + +namespace nUsageReporting +{ + typedef enum + { + kResourceType_Controller, + kResourceType_Module, + kResourceType_Language, + kResourceType_CANPlugin, + kResourceType_Accelerometer, + kResourceType_ADXL345, + kResourceType_AnalogChannel, + kResourceType_AnalogTrigger, + kResourceType_AnalogTriggerOutput, + kResourceType_CANJaguar, + kResourceType_Compressor, + kResourceType_Counter, + kResourceType_Dashboard, + kResourceType_DigitalInput, + kResourceType_DigitalOutput, + kResourceType_DriverStationCIO, + kResourceType_DriverStationEIO, + kResourceType_DriverStationLCD, + kResourceType_Encoder, + kResourceType_GearTooth, + kResourceType_Gyro, + kResourceType_I2C, + kResourceType_Framework, + kResourceType_Jaguar, + kResourceType_Joystick, + kResourceType_Kinect, + kResourceType_KinectStick, + kResourceType_PIDController, + kResourceType_Preferences, + kResourceType_PWM, + kResourceType_Relay, + kResourceType_RobotDrive, + kResourceType_SerialPort, + kResourceType_Servo, + kResourceType_Solenoid, + kResourceType_SPI, + kResourceType_Task, + kResourceType_Ultrasonic, + kResourceType_Victor, + kResourceType_Button, + kResourceType_Command, + kResourceType_AxisCamera, + kResourceType_PCVideoServer, + kResourceType_SmartDashboard, + kResourceType_Talon, + kResourceType_HiTechnicColorSensor, + kResourceType_HiTechnicAccel, + kResourceType_HiTechnicCompass, + kResourceType_SRF08, + } tResourceType; + + typedef enum + { + kLanguage_LabVIEW = 1, + kLanguage_CPlusPlus = 2, + kLanguage_Java = 3, + kLanguage_Python = 4, + + kCANPlugin_BlackJagBridge = 1, + kCANPlugin_2CAN = 2, + + kFramework_Iterative = 1, + kFramework_Simple = 2, + + kRobotDrive_ArcadeStandard = 1, + kRobotDrive_ArcadeButtonSpin = 2, + kRobotDrive_ArcadeRatioCurve = 3, + kRobotDrive_Tank = 4, + kRobotDrive_MecanumPolar = 5, + kRobotDrive_MecanumCartesian = 6, + + kDriverStationCIO_Analog = 1, + kDriverStationCIO_DigitalIn = 2, + kDriverStationCIO_DigitalOut = 3, + + kDriverStationEIO_Acceleration = 1, + kDriverStationEIO_AnalogIn = 2, + kDriverStationEIO_AnalogOut = 3, + kDriverStationEIO_Button = 4, + kDriverStationEIO_LED = 5, + kDriverStationEIO_DigitalIn = 6, + kDriverStationEIO_DigitalOut = 7, + kDriverStationEIO_FixedDigitalOut = 8, + kDriverStationEIO_PWM = 9, + kDriverStationEIO_Encoder = 10, + kDriverStationEIO_TouchSlider = 11, + + kADXL345_SPI = 1, + kADXL345_I2C = 2, + + kCommand_Scheduler = 1, + + kSmartDashboard_Instance = 1, + } tInstances; + + /** + * Report the usage of a resource of interest. + * + * @param resource one of the values in the tResourceType above (max value 51). + * @param instanceNumber an index that identifies the resource instance. + * @param context an optional additional context number for some cases (such as module number). Set to 0 to omit. + * @param feature a string to be included describing features in use on a specific resource. Setting the same resource more than once allows you to change the feature string. + */ + uint32_t EXPORT_FUNC report(tResourceType resource, uint8_t instanceNumber, uint8_t context = 0, const char *feature = NULL); +} + +#ifdef __cplusplus +extern "C" { +#endif + + uint32_t EXPORT_FUNC FRC_NetworkCommunication_nUsageReporting_report(uint8_t resource, uint8_t instanceNumber, uint8_t context, const char *feature); + +#ifdef __cplusplus +} +#endif + +#endif // __UsageReporting_h__ diff --git a/hal/Athena/src/main/native/i2c-lib.h b/hal/Athena/src/main/native/i2c-lib.h new file mode 100644 index 0000000000..9d095ec219 --- /dev/null +++ b/hal/Athena/src/main/native/i2c-lib.h @@ -0,0 +1,10 @@ +#ifndef __I2C_LIB_H__ +#define __I2C_LIB_H__ + +int i2clib_open(const char *device); +void i2clib_close(int handle); +int i2clib_read(int handle, uint8_t dev_addr, char *recv_buf, int32_t recv_size); +int i2clib_write(int handle, uint8_t dev_addr, const char *send_buf, int32_t send_size); +int i2clib_writeread(int handle, uint8_t dev_addr, const char *send_buf, int32_t send_size, char *recv_buf, int32_t recv_size); + +#endif /* __I2C_LIB_H__ */ \ No newline at end of file diff --git a/hal/Athena/src/main/native/spi-lib.h b/hal/Athena/src/main/native/spi-lib.h new file mode 100644 index 0000000000..4b4389510e --- /dev/null +++ b/hal/Athena/src/main/native/spi-lib.h @@ -0,0 +1,13 @@ +#ifndef __SPI_LIB_H__ +#define __SPI_LIB_H__ + +int spilib_open(const char *device); +void spilib_close(int handle); +int spilib_setspeed(int handle, uint32_t speed); +int spilib_setbitsperword(int handle, uint8_t bpw); +int spilib_setopts(int handle, int msb_first, int sample_on_trailing, int clk_idle_high); +int spilib_read(int handle, char *recv_buf, int32_t size); +int spilib_write(int handle, const char *send_buf, int32_t size); +int spilib_writeread(int handle, const char *send_buf, char *recv_buf, int32_t size); + +#endif /* __SPI_LIB_H__ */ \ No newline at end of file diff --git a/hal/include/src/main/include/log.h b/hal/include/src/main/include/log.h new file mode 100644 index 0000000000..f9253c34be --- /dev/null +++ b/hal/include/src/main/include/log.h @@ -0,0 +1,106 @@ +#ifndef __LOG_H__ +#define __LOG_H__ + +#include +#include +#include +#include +#include + +inline std::string NowTime(); + +enum TLogLevel {logNONE, logERROR, logWARNING, logINFO, logDEBUG, logDEBUG1, logDEBUG2, logDEBUG3, logDEBUG4}; + +class Log +{ +public: + Log(); + virtual ~Log(); + std::ostringstream& Get(TLogLevel level = logINFO); +public: + static TLogLevel& ReportingLevel(); + static std::string ToString(TLogLevel level); + static TLogLevel FromString(const std::string& level); +protected: + std::ostringstream os; +private: + Log(const Log&); + Log& operator =(const Log&); +}; + +inline Log::Log() +{ +} + +inline std::ostringstream& Log::Get(TLogLevel level) +{ + os << "- " << NowTime(); + os << " " << ToString(level) << ": "; + os << std::string(level > logDEBUG ? level - logDEBUG : 0, '\t'); + return os; +} + +inline Log::~Log() +{ + os << std::endl; + fprintf(stderr, "%s", os.str().c_str()); + fflush(stderr); +} + +inline TLogLevel& Log::ReportingLevel() +{ + static TLogLevel reportingLevel = logDEBUG4; + return reportingLevel; +} + +inline std::string Log::ToString(TLogLevel level) +{ + static const char* const buffer[] = {"NONE", "ERROR", "WARNING", "INFO", "DEBUG", "DEBUG1", "DEBUG2", "DEBUG3", "DEBUG4"}; + return buffer[level]; +} + +inline TLogLevel Log::FromString(const std::string& level) +{ + if (level == "DEBUG4") + return logDEBUG4; + if (level == "DEBUG3") + return logDEBUG3; + if (level == "DEBUG2") + return logDEBUG2; + if (level == "DEBUG1") + return logDEBUG1; + if (level == "DEBUG") + return logDEBUG; + if (level == "INFO") + return logINFO; + if (level == "WARNING") + return logWARNING; + if (level == "ERROR") + return logERROR; + if (level == "NONE") + return logNONE; + Log().Get(logWARNING) << "Unknown logging level '" << level << "'. Using INFO level as default."; + return logINFO; +} + +typedef Log FILELog; + +#define FILE_LOG(level) \ + if (level > FILELog::ReportingLevel()) ; \ + else Log().Get(level) + +inline std::string NowTime() +{ + char buffer[11]; + time_t t; + time(&t); + tm * r = gmtime(&t); + strftime(buffer, sizeof(buffer), "%H:%M:%S", r); + struct timeval tv; + gettimeofday(&tv, 0); + char result[100] = {0}; + sprintf(result, "%s.%03ld", buffer, (long)tv.tv_usec / 1000); + return result; +} + +#endif //__LOG_H__ diff --git a/pom.xml b/pom.xml index 0e0e086fe3..a25b4a22fb 100644 --- a/pom.xml +++ b/pom.xml @@ -1,4 +1,6 @@ - + + 4.0.0 edu.wpi.first.wpilib aggregator-pom diff --git a/wpilibc/pom.xml b/wpilibc/pom.xml index 99962c62b2..3feffc3fc8 100644 --- a/wpilibc/pom.xml +++ b/wpilibc/pom.xml @@ -7,9 +7,6 @@ pom 0.1.0-SNAPSHOT - - C:/Users/wpilibj-buildmaster/maven-repository - jenkins diff --git a/wpilibc/src/main/native/ADXL345_I2C.cpp b/wpilibc/src/main/native/ADXL345_I2C.cpp index aafd5024f3..f0ddb10db2 100644 --- a/wpilibc/src/main/native/ADXL345_I2C.cpp +++ b/wpilibc/src/main/native/ADXL345_I2C.cpp @@ -6,7 +6,7 @@ #include "ADXL345_I2C.h" #include "DigitalModule.h" -#include "NetworkCommunication/UsageReporting.h" +//#include "NetworkCommunication/UsageReporting.h" #include "I2C.h" const uint8_t ADXL345_I2C::kAddress; @@ -34,7 +34,7 @@ ADXL345_I2C::ADXL345_I2C(uint8_t moduleNumber, ADXL345_I2C::DataFormat_Range ran // Specify the data format to read m_i2c->Write(kDataFormatRegister, kDataFormat_FullRes | (uint8_t)range); - nUsageReporting::report(nUsageReporting::kResourceType_ADXL345, nUsageReporting::kADXL345_I2C, moduleNumber - 1); + HALReport(HALUsageReporting::kResourceType_ADXL345, HALUsageReporting::kADXL345_I2C, moduleNumber - 1); } } diff --git a/wpilibj/pom.xml b/wpilibj/pom.xml index ab9cae95f2..41604c9f73 100644 --- a/wpilibj/pom.xml +++ b/wpilibj/pom.xml @@ -2,141 +2,15 @@ 4.0.0 - edu.wpi.first.wpilib - WPILibJ - jar + edu.wpi.first.wpilibj + wpilibj + pom 0.1.0-SNAPSHOT - - edu.wpi.first.wpilib.templates.athena - library-jar - 0.1.0-SNAPSHOT - - - - - sonatype - Sonatype OSS Snapshots Repository - http://oss.sonatype.org/content/groups/public - - - - nativelibs4java-repo - http://nativelibs4java.sourceforge.net/maven - - - - WPILib Repository - http://frcbuilder.wpi.edu:8348/ - - - - - - - org.apache.maven.plugins - maven-compiler-plugin - 3.1 - - 1.7 - 1.7 - - edu/wpi/first/wpilibj/image/ - edu/wpi/first/wpilibj/camera/ - edu/wpi/first/wpilibj/visa/ - edu/wpi/first/wpilibj/SerialPort.java - edu/wpi/first/wpilibj/Kinect.java - edu/wpi/first/wpilibj/KinectStick.java - edu/wpi/first/wpilibj/DriverStationEnhancedIO.java - edu/wpi/first/wpilibj/buttons/DigitalIOButton.java - edu/wpi/first/wpilibj/buttons/AnalogIOButton.java - - - - - org.apache.maven.plugins - maven-dependency-plugin - 2.8 - - - fetch-sunspotfrcsdk-dependencies - compile - - copy - - - - - edu.wpi.first.wpilib.hal - libHALAthenaJava - 0.1.0-SNAPSHOT - so - libHALAthenaJava.so - ${project.build.directory}/classes/linux-arm - - - false - true - - - - - - org.apache.maven.plugins - maven-source-plugin - - - org.apache.maven.plugins - maven-javadoc-plugin - - - edu/wpi/first/wpilibj/image/ - edu/wpi/first/wpilibj/camera/ - edu/wpi/first/wpilibj/visa/ - edu/wpi/first/wpilibj/SerialPort.java - edu/wpi/first/wpilibj/Kinect.java - edu/wpi/first/wpilibj/KinectStick.java - edu/wpi/first/wpilibj/DriverStationEnhancedIO.java - edu/wpi/first/wpilibj/buttons/DigitalIOButton.java - edu/wpi/first/wpilibj/buttons/AnalogIOButton.java - - - - - + + wpilibJava + wpilibJavaJNI + wpilibJavaFinal + - - - net.java.dev.jna - jna - 4.0.0 - - - com.nativelibs4java - jnaerator-runtime - 0.12-SNAPSHOT - compile - - - - edu.wpi.first.wpilib.networktables.java - NetworkTables - 0.1.0-SNAPSHOT - - - - - edu.wpi.first.wpilib.hal - libHALAthenaJava - 0.1.0-SNAPSHOT - so - - diff --git a/wpilibj/src/main/java/edu/wpi/first/wpilibj/can/CANLibrary.java b/wpilibj/src/main/java/edu/wpi/first/wpilibj/can/CANLibrary.java deleted file mode 100644 index fb87d4f010..0000000000 --- a/wpilibj/src/main/java/edu/wpi/first/wpilibj/can/CANLibrary.java +++ /dev/null @@ -1,477 +0,0 @@ -package edu.wpi.first.wpilibj.can; -import com.ochafik.lang.jnaerator.runtime.LibraryExtractor; -import com.ochafik.lang.jnaerator.runtime.MangledFunctionMapper; -import com.sun.jna.Library; -import com.sun.jna.Native; -import com.sun.jna.NativeLibrary; -import com.sun.jna.Pointer; -import com.sun.jna.ptr.IntByReference; -import java.nio.ByteBuffer; -import java.nio.IntBuffer; -/** - * JNA Wrapper for library CAN
- * This file was autogenerated by JNAerator,
- * a tool written by Olivier Chafik that uses a few opensource projects..
- * For help, please visit NativeLibs4Java , Rococoa, or JNA. - */ -public class CANLibrary implements Library { - public static final String JNA_LIBRARY_NAME = LibraryExtractor.getLibraryPath("FRC_NetworkCommunication", true, CANLibrary.class); - public static final NativeLibrary JNA_NATIVE_LIB = NativeLibrary.getInstance(CANLibrary.JNA_LIBRARY_NAME, MangledFunctionMapper.DEFAULT_OPTIONS); - static { - Native.register(CANLibrary.JNA_LIBRARY_NAME); - } - /** native declaration : /home/alex/Projects/WPILib-Development/WPILibC/WPILib/src/main/include/CAN/can_proto.h */ - public static final int LM_STATUS_LIMIT_REV = 0x02; - /** native declaration : /home/alex/Projects/WPILib-Development/WPILibC/WPILib/src/main/include/CAN/can_proto.h */ - public static final int LM_API_CFG_MAX_VOUT = ((0x00020000 | 0x02000000 | 0x00001c00) | (7 << 6)); - /** native declaration : /home/alex/Projects/WPILib-Development/WPILibC/WPILib/src/main/include/CAN/can_proto.h */ - public static final int LM_PSTAT_CANERR_B0 = 30; - /** native declaration : /home/alex/Projects/WPILib-Development/WPILibC/WPILib/src/main/include/CAN/can_proto.h */ - public static final int LM_API_SPD_DIS = ((0x00020000 | 0x02000000 | 0x00000400) | (1 << 6)); - /** native declaration : /home/alex/Projects/WPILib-Development/WPILibC/WPILib/src/main/include/CAN/can_proto.h */ - public static final int CAN_MSGID_DTYPE_ACCEL = 0x05000000; - /** native declaration : /home/alex/Projects/WPILib-Development/WPILibC/WPILib/src/main/include/CAN/can_proto.h */ - public static final int LM_API_STATUS_FAULT = ((0x00020000 | 0x02000000 | 0x00001400) | (7 << 6)); - /** native declaration : /home/alex/Projects/WPILib-Development/WPILibC/WPILib/src/main/include/CAN/can_proto.h */ - public static final int CAN_MSGID_API_FIRMVER = 0x00000200; - /** native declaration : /home/alex/Projects/WPILib-Development/WPILibC/WPILib/src/main/include/CAN/can_proto.h */ - public static final int LM_API_ICTRL_EN = ((0x00020000 | 0x02000000 | 0x00001000) | (0 << 6)); - /** native declaration : /home/alex/Projects/WPILib-Development/WPILibC/WPILib/src/main/include/CAN/can_proto.h */ - public static final int CAN_MSGID_API_ENUMERATE = 0x00000240; - /** native declaration : /home/alex/Projects/WPILib-Development/WPILibC/WPILib/src/main/include/CAN/can_proto.h */ - public static final int LM_API_SPD_EN = ((0x00020000 | 0x02000000 | 0x00000400) | (0 << 6)); - /** native declaration : /home/alex/Projects/WPILib-Development/WPILibC/WPILib/src/main/include/CAN/can_proto.h */ - public static final int LM_API_CFG_LIMIT_REV = ((0x00020000 | 0x02000000 | 0x00001c00) | (6 << 6)); - /** native declaration : /home/alex/Projects/WPILib-Development/WPILibC/WPILib/src/main/include/CAN/can_proto.h */ - public static final int LM_PSTAT_POS_B2 = 11; - /** native declaration : /home/alex/Projects/WPILib-Development/WPILibC/WPILib/src/main/include/CAN/can_proto.h */ - public static final int LM_PSTAT_POS_B3 = 12; - /** native declaration : /home/alex/Projects/WPILib-Development/WPILibC/WPILib/src/main/include/CAN/can_proto.h */ - public static final int LM_API_VCOMP_EN = ((0x00020000 | 0x02000000 | 0x00000800) | (0 << 6)); - /** native declaration : /home/alex/Projects/WPILib-Development/WPILibC/WPILib/src/main/include/CAN/can_proto.h */ - public static final int LM_PSTAT_POS_B0 = 9; - /** native declaration : /home/alex/Projects/WPILib-Development/WPILibC/WPILib/src/main/include/CAN/can_proto.h */ - public static final int LM_PSTAT_POS_B1 = 10; - /** native declaration : /home/alex/Projects/WPILib-Development/WPILibC/WPILib/src/main/include/CAN/can_proto.h */ - public static final int LM_API_HWVER = ((0x00020000 | 0x1f000000) | (5 << 6)); - /** native declaration : /home/alex/Projects/WPILib-Development/WPILibC/WPILib/src/main/include/CAN/can_proto.h */ - public static final int LM_STATUS_FAULT_ILIMIT = 0x01; - /** native declaration : /home/alex/Projects/WPILib-Development/WPILibC/WPILib/src/main/include/CAN/can_proto.h */ - public static final int LM_API_ICTRL_DC = ((0x00020000 | 0x02000000 | 0x00001000) | (5 << 6)); - /** native declaration : /home/alex/Projects/WPILib-Development/WPILibC/WPILib/src/main/include/CAN/can_proto.h */ - public static final int LM_API_VOLT = (0x00020000 | 0x02000000 | 0x00000000); - /** native declaration : /home/alex/Projects/WPILib-Development/WPILibC/WPILib/src/main/include/CAN/can_proto.h */ - public static final int CAN_API_MC_VCOMP = 0x00000800; - /** native declaration : /home/alex/Projects/WPILib-Development/WPILibC/WPILib/src/main/include/CAN/can_proto.h */ - public static final int LM_PSTAT_END = 0; - /** native declaration : /home/alex/Projects/WPILib-Development/WPILibC/WPILib/src/main/include/CAN/can_proto.h */ - public static final int LM_API_CFG_LIMIT_FWD = ((0x00020000 | 0x02000000 | 0x00001c00) | (5 << 6)); - /** native declaration : /home/alex/Projects/WPILib-Development/WPILibC/WPILib/src/main/include/CAN/can_proto.h */ - public static final int CAN_MSGID_DTYPE_M = 0x1f000000; - /** native declaration : /home/alex/Projects/WPILib-Development/WPILibC/WPILib/src/main/include/CAN/can_proto.h */ - public static final int CAN_API_MC_ICTRL = 0x00001000; - /** native declaration : /home/alex/Projects/WPILib-Development/WPILibC/WPILib/src/main/include/CAN/can_proto.h */ - public static final int CAN_API_MC_CFG = 0x00001c00; - /** native declaration : /home/alex/Projects/WPILib-Development/WPILibC/WPILib/src/main/include/CAN/can_proto.h */ - public static final int CAN_MSGID_MFR_DEKA = 0x00030000; - /** native declaration : /home/alex/Projects/WPILib-Development/WPILibC/WPILib/src/main/include/CAN/can_proto.h */ - public static final int CAN_MSGID_API_SYSRST = 0x00000040; - /** native declaration : /home/alex/Projects/WPILib-Development/WPILibC/WPILib/src/main/include/CAN/can_proto.h */ - public static final int LM_REF_QUAD_ENCODER = 0x03; - /** native declaration : /home/alex/Projects/WPILib-Development/WPILibC/WPILib/src/main/include/CAN/can_proto.h */ - public static final int LM_API_SYNC_PEND_NOW = 0; - /** native declaration : /home/alex/Projects/WPILib-Development/WPILibC/WPILib/src/main/include/CAN/can_proto.h */ - public static final int LM_STATUS_CMODE_CURRENT = 0x01; - /** native declaration : /home/alex/Projects/WPILib-Development/WPILibC/WPILib/src/main/include/CAN/can_proto.h */ - public static final int LM_API_STATUS_TEMP = ((0x00020000 | 0x02000000 | 0x00001400) | (3 << 6)); - /** native declaration : /home/alex/Projects/WPILib-Development/WPILibC/WPILib/src/main/include/CAN/can_proto.h */ - public static final int LM_API_SPD_DC = ((0x00020000 | 0x02000000 | 0x00000400) | (5 << 6)); - /** native declaration : /home/alex/Projects/WPILib-Development/WPILibC/WPILib/src/main/include/CAN/can_proto.h */ - public static final int CAN_API_MC_POS = 0x00000c00; - /** native declaration : /home/alex/Projects/WPILib-Development/WPILibC/WPILib/src/main/include/CAN/can_proto.h */ - public static final int LM_STATUS_LIMIT_SFWD = 0x04; - /** native declaration : /home/alex/Projects/WPILib-Development/WPILibC/WPILib/src/main/include/CAN/can_proto.h */ - public static final int LM_API_ICTRL_DIS = ((0x00020000 | 0x02000000 | 0x00001000) | (1 << 6)); - /** native declaration : /home/alex/Projects/WPILib-Development/WPILibC/WPILib/src/main/include/CAN/can_proto.h */ - public static final int LM_API_VOLT_SET = ((0x00020000 | 0x02000000 | 0x00000000) | (2 << 6)); - /** native declaration : /home/alex/Projects/WPILib-Development/WPILibC/WPILib/src/main/include/CAN/can_proto.h */ - public static final int CAN_MSGID_API_HEARTBEAT = 0x00000140; - /** native declaration : /home/alex/Projects/WPILib-Development/WPILibC/WPILib/src/main/include/CAN/can_proto.h */ - public static final int LM_FAULT_CURRENT = 0x01; - /** native declaration : /home/alex/Projects/WPILib-Development/WPILibC/WPILib/src/main/include/CAN/can_proto.h */ - public static final int CAN_MSGID_DTYPE_GYRO = 0x04000000; - /** native declaration : /home/alex/Projects/WPILib-Development/WPILibC/WPILib/src/main/include/CAN/can_proto.h */ - public static final int LM_STATUS_FAULT_TLIMIT = 0x02; - /** native declaration : /home/alex/Projects/WPILib-Development/WPILibC/WPILib/src/main/include/CAN/can_proto.h */ - public static final int CAN_MSGID_MFR_S = 16; - /** native declaration : /home/alex/Projects/WPILib-Development/WPILibC/WPILib/src/main/include/CAN/can_proto.h */ - public static final int LM_API_SPD_T_SET_NO_ACK = ((0x00020000 | 0x02000000 | 0x00000400) | (10 << 6)); - /** native declaration : /home/alex/Projects/WPILib-Development/WPILibC/WPILib/src/main/include/CAN/can_proto.h */ - public static final int CAN_MSGID_MFR_M = 0x00ff0000; - /** native declaration : /home/alex/Projects/WPILib-Development/WPILibC/WPILib/src/main/include/CAN/can_proto.h */ - public static final int LM_STATUS_CMODE_POS = 0x03; - /** native declaration : /home/alex/Projects/WPILib-Development/WPILibC/WPILib/src/main/include/CAN/can_proto.h */ - public static final int LM_REF_POT = 0x01; - /** native declaration : /home/alex/Projects/WPILib-Development/WPILibC/WPILib/src/main/include/CAN/can_proto.h */ - public static final int LM_HWVER_UNKNOWN = 0x00; - /** native declaration : /home/alex/Projects/WPILib-Development/WPILibC/WPILib/src/main/include/CAN/can_proto.h */ - public static final int LM_API_CFG_BRAKE_COAST = ((0x00020000 | 0x02000000 | 0x00001c00) | (3 << 6)); - /** native declaration : /home/alex/Projects/WPILib-Development/WPILibC/WPILib/src/main/include/CAN/can_proto.h */ - public static final int LM_HWVER_JAG_1_0 = 0x01; - /** native declaration : /home/alex/Projects/WPILib-Development/WPILibC/WPILib/src/main/include/CAN/can_proto.h */ - public static final int CAN_MSGID_DEVNO_BCAST = 0x00000000; - /** native declaration : /home/alex/Projects/WPILib-Development/WPILibC/WPILib/src/main/include/CAN/can_proto.h */ - public static final int LM_API_VOLT_T_SET = ((0x00020000 | 0x02000000 | 0x00000000) | (5 << 6)); - /** native declaration : /home/alex/Projects/WPILib-Development/WPILibC/WPILib/src/main/include/CAN/can_proto.h */ - public static final int LM_STATUS_LIMIT_STKY_SREV = 0x80; - /** native declaration : /home/alex/Projects/WPILib-Development/WPILibC/WPILib/src/main/include/CAN/can_proto.h */ - public static final int LM_API_ICTRL_IC = ((0x00020000 | 0x02000000 | 0x00001000) | (4 << 6)); - /** native declaration : /home/alex/Projects/WPILib-Development/WPILibC/WPILib/src/main/include/CAN/can_proto.h */ - public static final int LM_API_ICTRL_T_SET_NO_ACK = ((0x00020000 | 0x02000000 | 0x00001000) | (9 << 6)); - /** native declaration : /home/alex/Projects/WPILib-Development/WPILibC/WPILib/src/main/include/CAN/can_proto.h */ - public static final int LM_FAULT_COMM = 0x10; - /** native declaration : /home/alex/Projects/WPILib-Development/WPILibC/WPILib/src/main/include/CAN/can_proto.h */ - public static final int LM_PSTAT_SPD_B2 = 15; - /** native declaration : /home/alex/Projects/WPILib-Development/WPILibC/WPILib/src/main/include/CAN/can_proto.h */ - public static final int LM_PSTAT_SPD_B1 = 14; - /** native declaration : /home/alex/Projects/WPILib-Development/WPILibC/WPILib/src/main/include/CAN/can_proto.h */ - public static final int LM_PSTAT_STKY_FLT_CLR = 21; - /** native declaration : /home/alex/Projects/WPILib-Development/WPILibC/WPILib/src/main/include/CAN/can_proto.h */ - public static final int LM_PSTAT_SPD_B3 = 16; - /** native declaration : /home/alex/Projects/WPILib-Development/WPILibC/WPILib/src/main/include/CAN/can_proto.h */ - public static final int LM_API_SPD_SET_NO_ACK = ((0x00020000 | 0x02000000 | 0x00000400) | (11 << 6)); - /** native declaration : /home/alex/Projects/WPILib-Development/WPILibC/WPILib/src/main/include/CAN/can_proto.h */ - public static final int CAN_STATUS_MFG_S = 16; - /** native declaration : /home/alex/Projects/WPILib-Development/WPILibC/WPILib/src/main/include/CAN/can_proto.h */ - public static final int LM_API_STATUS_LIMIT = ((0x00020000 | 0x02000000 | 0x00001400) | (6 << 6)); - /** native declaration : /home/alex/Projects/WPILib-Development/WPILibC/WPILib/src/main/include/CAN/can_proto.h */ - public static final int LM_API_VOLT_EN = ((0x00020000 | 0x02000000 | 0x00000000) | (0 << 6)); - /** native declaration : /home/alex/Projects/WPILib-Development/WPILibC/WPILib/src/main/include/CAN/can_proto.h */ - public static final int LM_API_VOLT_RAMP_DIS = 0; - /** native declaration : /home/alex/Projects/WPILib-Development/WPILibC/WPILib/src/main/include/CAN/can_proto.h */ - public static final int LM_PSTAT_TEMP_B0 = 7; - /** native declaration : /home/alex/Projects/WPILib-Development/WPILibC/WPILib/src/main/include/CAN/can_proto.h */ - public static final int LM_PSTAT_TEMP_B1 = 8; - /** native declaration : /home/alex/Projects/WPILib-Development/WPILibC/WPILib/src/main/include/CAN/can_proto.h */ - public static final int LM_API_POS_IC = ((0x00020000 | 0x02000000 | 0x00000c00) | (4 << 6)); - /** native declaration : /home/alex/Projects/WPILib-Development/WPILibC/WPILib/src/main/include/CAN/can_proto.h */ - public static final int CAN_MSGID_DTYPE_MOTOR = 0x02000000; - /** native declaration : /home/alex/Projects/WPILib-Development/WPILibC/WPILib/src/main/include/CAN/can_proto.h */ - public static final int LM_API_SPD_T_EN = ((0x00020000 | 0x02000000 | 0x00000400) | (7 << 6)); - /** native declaration : /home/alex/Projects/WPILib-Development/WPILibC/WPILib/src/main/include/CAN/can_proto.h */ - public static final int CAN_MSGID_DEVNO_M = 0x0000003f; - /** native declaration : /home/alex/Projects/WPILib-Development/WPILibC/WPILib/src/main/include/CAN/can_proto.h */ - public static final int LM_PSTAT_VOLTBUS_B1 = 4; - /** native declaration : /home/alex/Projects/WPILib-Development/WPILibC/WPILib/src/main/include/CAN/can_proto.h */ - public static final int LM_API_UPD_PING = ((0x00020000 | 0x1f000000) | (0 << 6)); - /** native declaration : /home/alex/Projects/WPILib-Development/WPILibC/WPILib/src/main/include/CAN/can_proto.h */ - public static final int LM_API_POS_T_SET_NO_ACK = ((0x00020000 | 0x02000000 | 0x00000c00) | (10 << 6)); - /** native declaration : /home/alex/Projects/WPILib-Development/WPILibC/WPILib/src/main/include/CAN/can_proto.h */ - public static final int CAN_MSGID_DEVNO_S = 0; - /** native declaration : /home/alex/Projects/WPILib-Development/WPILibC/WPILib/src/main/include/CAN/can_proto.h */ - public static final int LM_API_TRUST_HEARTBEAT = ((0x00020000 | 0x1f000000) | (13 << 6)); - /** native declaration : /home/alex/Projects/WPILib-Development/WPILibC/WPILib/src/main/include/CAN/can_proto.h */ - public static final int LM_PSTAT_VOLTBUS_B0 = 3; - /** native declaration : /home/alex/Projects/WPILib-Development/WPILibC/WPILib/src/main/include/CAN/can_proto.h */ - public static final int LM_PSTAT_SPD_B0 = 13; - /** native declaration : /home/alex/Projects/WPILib-Development/WPILibC/WPILib/src/main/include/CAN/can_proto.h */ - public static final int LM_API_CFG = (0x00020000 | 0x02000000 | 0x00001c00); - /** native declaration : /home/alex/Projects/WPILib-Development/WPILibC/WPILib/src/main/include/CAN/can_proto.h */ - public static final int LM_PSTAT_FLT_COUNT_COMM = 28; - /** native declaration : /home/alex/Projects/WPILib-Development/WPILibC/WPILib/src/main/include/CAN/can_proto.h */ - public static final int CAN_MSGID_API_SYSHALT = 0x00000000; - /** native declaration : /home/alex/Projects/WPILib-Development/WPILibC/WPILib/src/main/include/CAN/can_proto.h */ - public static final int LM_API_UPD_DOWNLOAD = ((0x00020000 | 0x1f000000) | (1 << 6)); - /** native declaration : /home/alex/Projects/WPILib-Development/WPILibC/WPILib/src/main/include/CAN/can_proto.h */ - public static final int LM_API_STATUS_CMODE = ((0x00020000 | 0x02000000 | 0x00001400) | (9 << 6)); - /** native declaration : /home/alex/Projects/WPILib-Development/WPILibC/WPILib/src/main/include/CAN/can_proto.h */ - public static final int LM_API_VCOMP_IN_RAMP = ((0x00020000 | 0x02000000 | 0x00000800) | (3 << 6)); - /** native declaration : /home/alex/Projects/WPILib-Development/WPILibC/WPILib/src/main/include/CAN/can_proto.h */ - public static final int LM_STATUS_FAULT_VLIMIT = 0x04; - /** native declaration : /home/alex/Projects/WPILib-Development/WPILibC/WPILib/src/main/include/CAN/can_proto.h */ - public static final int LM_STATUS_LIMIT_SREV = 0x08; - /** native declaration : /home/alex/Projects/WPILib-Development/WPILibC/WPILib/src/main/include/CAN/can_proto.h */ - public static final int CAN_MSGID_DTYPE_S = 24; - /** native declaration : /home/alex/Projects/WPILib-Development/WPILibC/WPILib/src/main/include/CAN/can_proto.h */ - public static final int LM_PSTAT_FLT_COUNT_VOLTBUS = 26; - /** native declaration : /home/alex/Projects/WPILib-Development/WPILibC/WPILib/src/main/include/CAN/can_proto.h */ - public static final int CAN_API_MC_STATUS = 0x00001400; - /** native declaration : /home/alex/Projects/WPILib-Development/WPILibC/WPILib/src/main/include/CAN/can_proto.h */ - public static final int LM_API_VOLT_T_EN = ((0x00020000 | 0x02000000 | 0x00000000) | (4 << 6)); - /** native declaration : /home/alex/Projects/WPILib-Development/WPILibC/WPILib/src/main/include/CAN/can_proto.h */ - public static final int LM_API_STATUS_VOLTBUS = ((0x00020000 | 0x02000000 | 0x00001400) | (1 << 6)); - /** native declaration : /home/alex/Projects/WPILib-Development/WPILibC/WPILib/src/main/include/CAN/can_proto.h */ - public static final int LM_API_UPD = (0x00020000 | 0x1f000000); - /** native declaration : /home/alex/Projects/WPILib-Development/WPILibC/WPILib/src/main/include/CAN/can_proto.h */ - public static final int LM_API_UPD_REQUEST = ((0x00020000 | 0x1f000000) | (6 << 6)); - /** native declaration : /home/alex/Projects/WPILib-Development/WPILibC/WPILib/src/main/include/CAN/can_proto.h */ - public static final int CAN_API_MC_VOLTAGE = 0x00000000; - /** native declaration : /home/alex/Projects/WPILib-Development/WPILibC/WPILib/src/main/include/CAN/can_proto.h */ - public static final int LM_API_PSTAT_PER_EN_S3 = ((0x00020000 | 0x02000000 | 0x00001800) | (3 << 6)); - /** native declaration : /home/alex/Projects/WPILib-Development/WPILibC/WPILib/src/main/include/CAN/can_proto.h */ - public static final int LM_API_PSTAT_PER_EN_S2 = ((0x00020000 | 0x02000000 | 0x00001800) | (2 << 6)); - /** native declaration : /home/alex/Projects/WPILib-Development/WPILibC/WPILib/src/main/include/CAN/can_proto.h */ - public static final int CAN_API_MC_PSTAT = 0x00001800; - /** native declaration : /home/alex/Projects/WPILib-Development/WPILibC/WPILib/src/main/include/CAN/can_proto.h */ - public static final int LM_PSTAT_CANERR_B1 = 31; - /** native declaration : /home/alex/Projects/WPILib-Development/WPILibC/WPILib/src/main/include/CAN/can_proto.h */ - public static final int LM_API_PSTAT_PER_EN_S1 = ((0x00020000 | 0x02000000 | 0x00001800) | (1 << 6)); - /** native declaration : /home/alex/Projects/WPILib-Development/WPILibC/WPILib/src/main/include/CAN/can_proto.h */ - public static final int LM_REF_ENCODER = 0x00; - /** native declaration : /home/alex/Projects/WPILib-Development/WPILibC/WPILib/src/main/include/CAN/can_proto.h */ - public static final int LM_API_PSTAT_PER_EN_S0 = ((0x00020000 | 0x02000000 | 0x00001800) | (0 << 6)); - /** native declaration : /home/alex/Projects/WPILib-Development/WPILibC/WPILib/src/main/include/CAN/can_proto.h */ - public static final int LM_API_STATUS_CURRENT = ((0x00020000 | 0x02000000 | 0x00001400) | (2 << 6)); - /** native declaration : /home/alex/Projects/WPILib-Development/WPILibC/WPILib/src/main/include/CAN/can_proto.h */ - public static final int LM_API_POS_SET = ((0x00020000 | 0x02000000 | 0x00000c00) | (2 << 6)); - /** native declaration : /home/alex/Projects/WPILib-Development/WPILibC/WPILib/src/main/include/CAN/can_proto.h */ - public static final int LM_STATUS_LIMIT_STKY_FWD = 0x10; - /** native declaration : /home/alex/Projects/WPILib-Development/WPILibC/WPILib/src/main/include/CAN/can_proto.h */ - public static final int LM_API_ICTRL = (0x00020000 | 0x02000000 | 0x00001000); - /** native declaration : /home/alex/Projects/WPILib-Development/WPILibC/WPILib/src/main/include/CAN/can_proto.h */ - public static final int LM_HWVER_JAG_2_0 = 0x02; - /** native declaration : /home/alex/Projects/WPILib-Development/WPILibC/WPILib/src/main/include/CAN/can_proto.h */ - public static final int CAN_STATUS_MFG_M = 0x00ff0000; - /** native declaration : /home/alex/Projects/WPILib-Development/WPILibC/WPILib/src/main/include/CAN/can_proto.h */ - public static final int LM_PSTAT_LIMIT_CLR = 18; - /** native declaration : /home/alex/Projects/WPILib-Development/WPILibC/WPILib/src/main/include/CAN/can_proto.h */ - public static final int LM_API_CFG_POT_TURNS = ((0x00020000 | 0x02000000 | 0x00001c00) | (2 << 6)); - /** native declaration : /home/alex/Projects/WPILib-Development/WPILibC/WPILib/src/main/include/CAN/can_proto.h */ - public static final int LM_API_POS_REF = ((0x00020000 | 0x02000000 | 0x00000c00) | (6 << 6)); - /** native declaration : /home/alex/Projects/WPILib-Development/WPILibC/WPILib/src/main/include/CAN/can_proto.h */ - public static final int LM_API_SPD_PC = ((0x00020000 | 0x02000000 | 0x00000400) | (3 << 6)); - /** native declaration : /home/alex/Projects/WPILib-Development/WPILibC/WPILib/src/main/include/CAN/can_proto.h */ - public static final int LM_API_STATUS_VOUT = ((0x00020000 | 0x02000000 | 0x00001400) | (10 << 6)); - /** native declaration : /home/alex/Projects/WPILib-Development/WPILibC/WPILib/src/main/include/CAN/can_proto.h */ - public static final int CAN_MSGID_API_SYSRESUME = 0x00000280; - /** native declaration : /home/alex/Projects/WPILib-Development/WPILibC/WPILib/src/main/include/CAN/can_proto.h */ - public static final int LM_API_UNTRUST_EN = ((0x00020000 | 0x1f000000) | (11 << 6)); - /** native declaration : /home/alex/Projects/WPILib-Development/WPILibC/WPILib/src/main/include/CAN/can_proto.h */ - public static final int LM_PSTAT_CANSTS = 29; - /** native declaration : /home/alex/Projects/WPILib-Development/WPILibC/WPILib/src/main/include/CAN/can_proto.h */ - public static final int LM_API_POS_DC = ((0x00020000 | 0x02000000 | 0x00000c00) | (5 << 6)); - /** native declaration : /home/alex/Projects/WPILib-Development/WPILibC/WPILib/src/main/include/CAN/can_proto.h */ - public static final int LM_API_STATUS_POS = ((0x00020000 | 0x02000000 | 0x00001400) | (4 << 6)); - /** native declaration : /home/alex/Projects/WPILib-Development/WPILibC/WPILib/src/main/include/CAN/can_proto.h */ - public static final int LM_API_SPD_SET = ((0x00020000 | 0x02000000 | 0x00000400) | (2 << 6)); - /** native declaration : /home/alex/Projects/WPILib-Development/WPILibC/WPILib/src/main/include/CAN/can_proto.h */ - public static final int CAN_MSGID_FULL_M = 0x1fffffff; - /** native declaration : /home/alex/Projects/WPILib-Development/WPILibC/WPILib/src/main/include/CAN/can_proto.h */ - public static final int LM_API_STATUS_SPD = ((0x00020000 | 0x02000000 | 0x00001400) | (5 << 6)); - /** native declaration : /home/alex/Projects/WPILib-Development/WPILibC/WPILib/src/main/include/CAN/can_proto.h */ - public static final int LM_PSTAT_STKY_FLT_NCLR = 20; - /** native declaration : /home/alex/Projects/WPILib-Development/WPILibC/WPILib/src/main/include/CAN/can_proto.h */ - public static final int LM_API_STATUS = (0x00020000 | 0x02000000 | 0x00001400); - /** native declaration : /home/alex/Projects/WPILib-Development/WPILibC/WPILib/src/main/include/CAN/can_proto.h */ - public static final int LM_API_TRUST_EN = ((0x00020000 | 0x1f000000) | (12 << 6)); - /** native declaration : /home/alex/Projects/WPILib-Development/WPILibC/WPILib/src/main/include/CAN/can_proto.h */ - public static final int LM_API_ICTRL_T_SET = ((0x00020000 | 0x02000000 | 0x00001000) | (7 << 6)); - /** native declaration : /home/alex/Projects/WPILib-Development/WPILibC/WPILib/src/main/include/CAN/can_proto.h */ - public static final int CAN_STATUS_CODE_M = 0x0000ffff; - /** native declaration : /home/alex/Projects/WPILib-Development/WPILibC/WPILib/src/main/include/CAN/can_proto.h */ - public static final int CAN_STATUS_CODE_S = 0; - /** native declaration : /home/alex/Projects/WPILib-Development/WPILibC/WPILib/src/main/include/CAN/can_proto.h */ - public static final int LM_API_POS_T_EN = ((0x00020000 | 0x02000000 | 0x00000c00) | (7 << 6)); - /** native declaration : /home/alex/Projects/WPILib-Development/WPILibC/WPILib/src/main/include/CAN/can_proto.h */ - public static final int LM_API_PSTAT = (0x00020000 | 0x02000000 | 0x00001800); - /** native declaration : /home/alex/Projects/WPILib-Development/WPILibC/WPILib/src/main/include/CAN/can_proto.h */ - public static final int LM_PSTAT_FAULT = 19; - /** native declaration : /home/alex/Projects/WPILib-Development/WPILibC/WPILib/src/main/include/CAN/can_proto.h */ - public static final int LM_PSTAT_FLT_COUNT_GATE = 27; - /** native declaration : /home/alex/Projects/WPILib-Development/WPILibC/WPILib/src/main/include/CAN/can_proto.h */ - public static final int LM_API_ICTRL_T_EN = ((0x00020000 | 0x02000000 | 0x00001000) | (6 << 6)); - /** native declaration : /home/alex/Projects/WPILib-Development/WPILibC/WPILib/src/main/include/CAN/can_proto.h */ - public static final int CAN_MSGID_API_DEVQUERY = 0x000000c0; - /** native declaration : /home/alex/Projects/WPILib-Development/WPILibC/WPILib/src/main/include/CAN/can_proto.h */ - public static final int CAN_MSGID_DTYPE_USONIC = 0x06000000; - /** native declaration : /home/alex/Projects/WPILib-Development/WPILibC/WPILib/src/main/include/CAN/can_proto.h */ - public static final int LM_STATUS_CMODE_VCOMP = 0x04; - /** native declaration : /home/alex/Projects/WPILib-Development/WPILibC/WPILib/src/main/include/CAN/can_proto.h */ - public static final int LM_API_SPD_T_SET = ((0x00020000 | 0x02000000 | 0x00000400) | (8 << 6)); - /** native declaration : /home/alex/Projects/WPILib-Development/WPILibC/WPILib/src/main/include/CAN/can_proto.h */ - public static final int LM_API_POS_EN = ((0x00020000 | 0x02000000 | 0x00000c00) | (0 << 6)); - /** native declaration : /home/alex/Projects/WPILib-Development/WPILibC/WPILib/src/main/include/CAN/can_proto.h */ - public static final int LM_API_VOLT_DIS = ((0x00020000 | 0x02000000 | 0x00000000) | (1 << 6)); - /** native declaration : /home/alex/Projects/WPILib-Development/WPILibC/WPILib/src/main/include/CAN/can_proto.h */ - public static final int LM_STATUS_LIMIT_FWD = 0x01; - /** native declaration : /home/alex/Projects/WPILib-Development/WPILibC/WPILib/src/main/include/CAN/can_proto.h */ - public static final int LM_API_VCOMP_DIS = ((0x00020000 | 0x02000000 | 0x00000800) | (1 << 6)); - /** native declaration : /home/alex/Projects/WPILib-Development/WPILibC/WPILib/src/main/include/CAN/can_proto.h */ - public static final int LM_REF_INV_ENCODER = 0x02; - /** native declaration : /home/alex/Projects/WPILib-Development/WPILibC/WPILib/src/main/include/CAN/can_proto.h */ - public static final int LM_API_CFG_NUM_BRUSHES = ((0x00020000 | 0x02000000 | 0x00001c00) | (0 << 6)); - /** native declaration : /home/alex/Projects/WPILib-Development/WPILibC/WPILib/src/main/include/CAN/can_proto.h */ - public static final int CAN_MSGID_DTYPE_RELAY = 0x03000000; - /** native declaration : /home/alex/Projects/WPILib-Development/WPILibC/WPILib/src/main/include/CAN/can_proto.h */ - public static final int CAN_MSGID_API_DEVASSIGN = 0x00000080; - /** native declaration : /home/alex/Projects/WPILib-Development/WPILibC/WPILib/src/main/include/CAN/can_proto.h */ - public static final int LM_API_VOLT_T_SET_NO_ACK = ((0x00020000 | 0x02000000 | 0x00000000) | (7 << 6)); - /** native declaration : /home/alex/Projects/WPILib-Development/WPILibC/WPILib/src/main/include/CAN/can_proto.h */ - public static final int CAN_API_MC_SPD = 0x00000400; - /** native declaration : /home/alex/Projects/WPILib-Development/WPILibC/WPILib/src/main/include/CAN/can_proto.h */ - public static final int LM_API_CFG_ENC_LINES = ((0x00020000 | 0x02000000 | 0x00001c00) | (1 << 6)); - /** native declaration : /home/alex/Projects/WPILib-Development/WPILibC/WPILib/src/main/include/CAN/can_proto.h */ - public static final int LM_REF_NONE = 0xff; - /** native declaration : /home/alex/Projects/WPILib-Development/WPILibC/WPILib/src/main/include/CAN/can_proto.h */ - public static final int LM_FAULT_VBUS = 0x04; - /** native declaration : /home/alex/Projects/WPILib-Development/WPILibC/WPILib/src/main/include/CAN/can_proto.h */ - public static final int LM_API_VOLT_SET_RAMP = ((0x00020000 | 0x02000000 | 0x00000000) | (3 << 6)); - /** native declaration : /home/alex/Projects/WPILib-Development/WPILibC/WPILib/src/main/include/CAN/can_proto.h */ - public static final int LM_API_SPD_REF = ((0x00020000 | 0x02000000 | 0x00000400) | (6 << 6)); - /** native declaration : /home/alex/Projects/WPILib-Development/WPILibC/WPILib/src/main/include/CAN/can_proto.h */ - public static final int LM_API_STATUS_POWER = ((0x00020000 | 0x02000000 | 0x00001400) | (8 << 6)); - /** native declaration : /home/alex/Projects/WPILib-Development/WPILibC/WPILib/src/main/include/CAN/can_proto.h */ - public static final int LM_PSTAT_VOLTOUT_B1 = 2; - /** native declaration : /home/alex/Projects/WPILib-Development/WPILibC/WPILib/src/main/include/CAN/can_proto.h */ - public static final int LM_API_VCOMP_SET_NO_ACK = ((0x00020000 | 0x02000000 | 0x00000800) | (9 << 6)); - /** native declaration : /home/alex/Projects/WPILib-Development/WPILibC/WPILib/src/main/include/CAN/can_proto.h */ - public static final int LM_PSTAT_VOLTOUT_B0 = 1; - /** native declaration : /home/alex/Projects/WPILib-Development/WPILibC/WPILib/src/main/include/CAN/can_proto.h */ - public static final int LM_API_CFG_LIMIT_MODE = ((0x00020000 | 0x02000000 | 0x00001c00) | (4 << 6)); - /** native declaration : /home/alex/Projects/WPILib-Development/WPILibC/WPILib/src/main/include/CAN/can_proto.h */ - public static final int LM_PSTAT_VOUT_B1 = 23; - /** native declaration : /home/alex/Projects/WPILib-Development/WPILibC/WPILib/src/main/include/CAN/can_proto.h */ - public static final int LM_API_UPD_SEND_DATA = ((0x00020000 | 0x1f000000) | (2 << 6)); - /** native declaration : /home/alex/Projects/WPILib-Development/WPILibC/WPILib/src/main/include/CAN/can_proto.h */ - public static final int LM_PSTAT_FLT_COUNT_CURRENT = 24; - /** native declaration : /home/alex/Projects/WPILib-Development/WPILibC/WPILib/src/main/include/CAN/can_proto.h */ - public static final int LM_PSTAT_VOUT_B0 = 22; - /** native declaration : /home/alex/Projects/WPILib-Development/WPILibC/WPILib/src/main/include/CAN/can_proto.h */ - public static final int LM_API_PSTAT_CFG_S0 = ((0x00020000 | 0x02000000 | 0x00001800) | (4 << 6)); - /** native declaration : /home/alex/Projects/WPILib-Development/WPILibC/WPILib/src/main/include/CAN/can_proto.h */ - public static final int LM_PSTAT_LIMIT_NCLR = 17; - /** native declaration : /home/alex/Projects/WPILib-Development/WPILibC/WPILib/src/main/include/CAN/can_proto.h */ - public static final int LM_API_PSTAT_CFG_S1 = ((0x00020000 | 0x02000000 | 0x00001800) | (5 << 6)); - /** native declaration : /home/alex/Projects/WPILib-Development/WPILibC/WPILib/src/main/include/CAN/can_proto.h */ - public static final int LM_API_PSTAT_CFG_S2 = ((0x00020000 | 0x02000000 | 0x00001800) | (6 << 6)); - /** native declaration : /home/alex/Projects/WPILib-Development/WPILibC/WPILib/src/main/include/CAN/can_proto.h */ - public static final int LM_API_PSTAT_CFG_S3 = ((0x00020000 | 0x02000000 | 0x00001800) | (7 << 6)); - /** native declaration : /home/alex/Projects/WPILib-Development/WPILibC/WPILib/src/main/include/CAN/can_proto.h */ - public static final int LM_API_VCOMP_SET = ((0x00020000 | 0x02000000 | 0x00000800) | (2 << 6)); - /** native declaration : /home/alex/Projects/WPILib-Development/WPILibC/WPILib/src/main/include/CAN/can_proto.h */ - public static final int CAN_MSGID_API_UPDATE = 0x000001c0; - /** native declaration : /home/alex/Projects/WPILib-Development/WPILibC/WPILib/src/main/include/CAN/can_proto.h */ - public static final int LM_API_CFG_FAULT_TIME = ((0x00020000 | 0x02000000 | 0x00001c00) | (8 << 6)); - /** native declaration : /home/alex/Projects/WPILib-Development/WPILibC/WPILib/src/main/include/CAN/can_proto.h */ - public static final int LM_API_STATUS_VOLTOUT = ((0x00020000 | 0x02000000 | 0x00001400) | (0 << 6)); - /** native declaration : /home/alex/Projects/WPILib-Development/WPILibC/WPILib/src/main/include/CAN/can_proto.h */ - public static final int LM_API_ICTRL_SET = ((0x00020000 | 0x02000000 | 0x00001000) | (2 << 6)); - /** native declaration : /home/alex/Projects/WPILib-Development/WPILibC/WPILib/src/main/include/CAN/can_proto.h */ - public static final int CAN_MSGID_API_M = 0x0000ffc0; - /** native declaration : /home/alex/Projects/WPILib-Development/WPILibC/WPILib/src/main/include/CAN/can_proto.h */ - public static final int LM_STATUS_CMODE_SPEED = 0x02; - /** native declaration : /home/alex/Projects/WPILib-Development/WPILibC/WPILib/src/main/include/CAN/can_proto.h */ - public static final int CAN_MSGID_API_CLASS_M = 0x0000fc00; - /** native declaration : /home/alex/Projects/WPILib-Development/WPILibC/WPILib/src/main/include/CAN/can_proto.h */ - public static final int LM_API_PSTAT_DATA_S3 = ((0x00020000 | 0x02000000 | 0x00001800) | (11 << 6)); - /** native declaration : /home/alex/Projects/WPILib-Development/WPILibC/WPILib/src/main/include/CAN/can_proto.h */ - public static final int CAN_MSGID_API_S = 6; - /** native declaration : /home/alex/Projects/WPILib-Development/WPILibC/WPILib/src/main/include/CAN/can_proto.h */ - public static final int LM_API_STATUS_FLT_COUNT = ((0x00020000 | 0x02000000 | 0x00001400) | (12 << 6)); - /** native declaration : /home/alex/Projects/WPILib-Development/WPILibC/WPILib/src/main/include/CAN/can_proto.h */ - public static final int LM_API_PSTAT_DATA_S2 = ((0x00020000 | 0x02000000 | 0x00001800) | (10 << 6)); - /** native declaration : /home/alex/Projects/WPILib-Development/WPILibC/WPILib/src/main/include/CAN/can_proto.h */ - public static final int LM_API_PSTAT_DATA_S1 = ((0x00020000 | 0x02000000 | 0x00001800) | (9 << 6)); - /** native declaration : /home/alex/Projects/WPILib-Development/WPILibC/WPILib/src/main/include/CAN/can_proto.h */ - public static final int LM_API_PSTAT_DATA_S0 = ((0x00020000 | 0x02000000 | 0x00001800) | (8 << 6)); - /** native declaration : /home/alex/Projects/WPILib-Development/WPILibC/WPILib/src/main/include/CAN/can_proto.h */ - public static final int LM_API_ICTRL_PC = ((0x00020000 | 0x02000000 | 0x00001000) | (3 << 6)); - /** native declaration : /home/alex/Projects/WPILib-Development/WPILibC/WPILib/src/main/include/CAN/can_proto.h */ - public static final int LM_API_POS_PC = ((0x00020000 | 0x02000000 | 0x00000c00) | (3 << 6)); - /** native declaration : /home/alex/Projects/WPILib-Development/WPILibC/WPILib/src/main/include/CAN/can_proto.h */ - public static final int CAN_MSGID_MFR_LM = 0x00020000; - /** native declaration : /home/alex/Projects/WPILib-Development/WPILibC/WPILib/src/main/include/CAN/can_proto.h */ - public static final int LM_API_POS_DIS = ((0x00020000 | 0x02000000 | 0x00000c00) | (1 << 6)); - /** native declaration : /home/alex/Projects/WPILib-Development/WPILibC/WPILib/src/main/include/CAN/can_proto.h */ - public static final int CAN_MSGID_DTYPE_BCAST = 0x00000000; - /** native declaration : /home/alex/Projects/WPILib-Development/WPILibC/WPILib/src/main/include/CAN/can_proto.h */ - public static final int LM_STATUS_CMODE_VOLT = 0x00; - /** native declaration : /home/alex/Projects/WPILib-Development/WPILibC/WPILib/src/main/include/CAN/can_proto.h */ - public static final int CAN_STATUS_DTYPE_S = 24; - /** native declaration : /home/alex/Projects/WPILib-Development/WPILibC/WPILib/src/main/include/CAN/can_proto.h */ - public static final int LM_API_POS_SET_NO_ACK = ((0x00020000 | 0x02000000 | 0x00000c00) | (11 << 6)); - /** native declaration : /home/alex/Projects/WPILib-Development/WPILibC/WPILib/src/main/include/CAN/can_proto.h */ - public static final int CAN_STATUS_DTYPE_M = 0x1f000000; - /** native declaration : /home/alex/Projects/WPILib-Development/WPILibC/WPILib/src/main/include/CAN/can_proto.h */ - public static final int LM_FAULT_GATE_DRIVE = 0x08; - /** native declaration : /home/alex/Projects/WPILib-Development/WPILibC/WPILib/src/main/include/CAN/can_proto.h */ - public static final int LM_STATUS_LIMIT_STKY_REV = 0x20; - /** native declaration : /home/alex/Projects/WPILib-Development/WPILibC/WPILib/src/main/include/CAN/can_proto.h */ - public static final int CAN_MSGID_DTYPE_ROBOT = 0x01000000; - /** native declaration : /home/alex/Projects/WPILib-Development/WPILibC/WPILib/src/main/include/CAN/can_proto.h */ - public static final int LM_API_VCOMP = (0x00020000 | 0x02000000 | 0x00000800); - /** native declaration : /home/alex/Projects/WPILib-Development/WPILibC/WPILib/src/main/include/CAN/can_proto.h */ - public static final int CAN_API_MC_ACK = 0x00002000; - /** native declaration : /home/alex/Projects/WPILib-Development/WPILibC/WPILib/src/main/include/CAN/can_proto.h */ - public static final int LM_API_UPD_ACK = ((0x00020000 | 0x1f000000) | (4 << 6)); - /** native declaration : /home/alex/Projects/WPILib-Development/WPILibC/WPILib/src/main/include/CAN/can_proto.h */ - public static final int LM_API_VCOMP_COMP_RAMP = ((0x00020000 | 0x02000000 | 0x00000800) | (4 << 6)); - /** native declaration : /home/alex/Projects/WPILib-Development/WPILibC/WPILib/src/main/include/CAN/can_proto.h */ - public static final int LM_API_VCOMP_T_SET_NO_ACK = ((0x00020000 | 0x02000000 | 0x00000800) | (8 << 6)); - /** native declaration : /home/alex/Projects/WPILib-Development/WPILibC/WPILib/src/main/include/CAN/can_proto.h */ - public static final int LM_API_POS = (0x00020000 | 0x02000000 | 0x00000c00); - /** native declaration : /home/alex/Projects/WPILib-Development/WPILibC/WPILib/src/main/include/CAN/can_proto.h */ - public static final int CAN_MSGID_API_SYNC = 0x00000180; - /** native declaration : /home/alex/Projects/WPILib-Development/WPILibC/WPILib/src/main/include/CAN/can_proto.h */ - public static final int LM_API_ICTRL_SET_NO_ACK = ((0x00020000 | 0x02000000 | 0x00001000) | (10 << 6)); - /** native declaration : /home/alex/Projects/WPILib-Development/WPILibC/WPILib/src/main/include/CAN/can_proto.h */ - public static final int LM_PSTAT_CURRENT_B1 = 6; - /** native declaration : /home/alex/Projects/WPILib-Development/WPILibC/WPILib/src/main/include/CAN/can_proto.h */ - public static final int LM_API_SPD = (0x00020000 | 0x02000000 | 0x00000400); - /** native declaration : /home/alex/Projects/WPILib-Development/WPILibC/WPILib/src/main/include/CAN/can_proto.h */ - public static final int LM_PSTAT_CURRENT_B0 = 5; - /** native declaration : /home/alex/Projects/WPILib-Development/WPILibC/WPILib/src/main/include/CAN/can_proto.h */ - public static final int CAN_MSGID_DTYPE_UPDATE = 0x1f000000; - /** native declaration : /home/alex/Projects/WPILib-Development/WPILibC/WPILib/src/main/include/CAN/can_proto.h */ - public static final int LM_API_SPD_IC = ((0x00020000 | 0x02000000 | 0x00000400) | (4 << 6)); - /** native declaration : /home/alex/Projects/WPILib-Development/WPILibC/WPILib/src/main/include/CAN/can_proto.h */ - public static final int LM_API_ACK = (0x00020000 | 0x02000000 | 0x00002000); - /** native declaration : /home/alex/Projects/WPILib-Development/WPILibC/WPILib/src/main/include/CAN/can_proto.h */ - public static final int LM_API_VCOMP_T_SET = ((0x00020000 | 0x02000000 | 0x00000800) | (6 << 6)); - /** native declaration : /home/alex/Projects/WPILib-Development/WPILibC/WPILib/src/main/include/CAN/can_proto.h */ - public static final int LM_FAULT_TEMP = 0x02; - /** native declaration : /home/alex/Projects/WPILib-Development/WPILibC/WPILib/src/main/include/CAN/can_proto.h */ - public static final int LM_PSTAT_FLT_COUNT_TEMP = 25; - /** native declaration : /home/alex/Projects/WPILib-Development/WPILibC/WPILib/src/main/include/CAN/can_proto.h */ - public static final int LM_API_VOLT_SET_NO_ACK = ((0x00020000 | 0x02000000 | 0x00000000) | (8 << 6)); - /** native declaration : /home/alex/Projects/WPILib-Development/WPILibC/WPILib/src/main/include/CAN/can_proto.h */ - public static final int CAN_MSGID_DTYPE_GEART = 0x07000000; - /** native declaration : /home/alex/Projects/WPILib-Development/WPILibC/WPILib/src/main/include/CAN/can_proto.h */ - public static final int CAN_MSGID_MFR_NI = 0x00010000; - /** native declaration : /home/alex/Projects/WPILib-Development/WPILibC/WPILib/src/main/include/CAN/can_proto.h */ - public static final int LM_API_POS_T_SET = ((0x00020000 | 0x02000000 | 0x00000c00) | (8 << 6)); - /** native declaration : /home/alex/Projects/WPILib-Development/WPILibC/WPILib/src/main/include/CAN/can_proto.h */ - public static final int LM_API_STATUS_STKY_FLT = ((0x00020000 | 0x02000000 | 0x00001400) | (11 << 6)); - /** native declaration : /home/alex/Projects/WPILib-Development/WPILibC/WPILib/src/main/include/CAN/can_proto.h */ - public static final int LM_API_UPD_RESET = ((0x00020000 | 0x1f000000) | (3 << 6)); - /** native declaration : /home/alex/Projects/WPILib-Development/WPILibC/WPILib/src/main/include/CAN/can_proto.h */ - public static final int CAN_MSGID_API_ID_M = 0x000003c0; - /** native declaration : /home/alex/Projects/WPILib-Development/WPILibC/WPILib/src/main/include/CAN/can_proto.h */ - public static final int LM_API_VCOMP_T_EN = ((0x00020000 | 0x02000000 | 0x00000800) | (5 << 6)); - /** native declaration : /home/alex/Projects/WPILib-Development/WPILibC/WPILib/src/main/include/CAN/can_proto.h */ - public static final int LM_STATUS_LIMIT_STKY_SFWD = 0x40; - /** - * Original signature : void FRC_NetworkCommunication_JaguarCANDriver_sendMessage(uint32_t, const uint8_t*, uint8_t, int32_t*)
- * native declaration : /home/alex/Projects/WPILib-Development/WPILibC/WPILib/src/main/include/CAN/JaguarCANDriver.h:7
- * @deprecated use the safer methods {@link #FRC_NetworkCommunication_JaguarCANDriver_sendMessage(int, byte[], byte, java.nio.IntBuffer)} and {@link #FRC_NetworkCommunication_JaguarCANDriver_sendMessage(int, com.sun.jna.Pointer, byte, com.sun.jna.ptr.IntByReference)} instead - */ - @Deprecated - public static native void FRC_NetworkCommunication_JaguarCANDriver_sendMessage(int messageID, Pointer data, byte dataSize, IntByReference status); - /** - * Original signature : void FRC_NetworkCommunication_JaguarCANDriver_sendMessage(uint32_t, const uint8_t*, uint8_t, int32_t*)
- * native declaration : /home/alex/Projects/WPILib-Development/WPILibC/WPILib/src/main/include/CAN/JaguarCANDriver.h:7 - */ - public static native void FRC_NetworkCommunication_JaguarCANDriver_sendMessage(int messageID, byte data[], byte dataSize, IntBuffer status); - /** - * Original signature : void FRC_NetworkCommunication_JaguarCANDriver_receiveMessage(uint32_t*, uint8_t*, uint8_t*, uint32_t, int32_t*)
- * native declaration : /home/alex/Projects/WPILib-Development/WPILibC/WPILib/src/main/include/CAN/JaguarCANDriver.h:8
- * @deprecated use the safer methods {@link #FRC_NetworkCommunication_JaguarCANDriver_receiveMessage(java.nio.IntBuffer, java.nio.ByteBuffer, java.nio.ByteBuffer, int, java.nio.IntBuffer)} and {@link #FRC_NetworkCommunication_JaguarCANDriver_receiveMessage(com.sun.jna.ptr.IntByReference, com.sun.jna.Pointer, com.sun.jna.Pointer, int, com.sun.jna.ptr.IntByReference)} instead - */ - @Deprecated - public static native void FRC_NetworkCommunication_JaguarCANDriver_receiveMessage(IntByReference messageID, Pointer data, Pointer dataSize, int timeoutMs, IntByReference status); - /** - * Original signature : void FRC_NetworkCommunication_JaguarCANDriver_receiveMessage(uint32_t*, uint8_t*, uint8_t*, uint32_t, int32_t*)
- * native declaration : /home/alex/Projects/WPILib-Development/WPILibC/WPILib/src/main/include/CAN/JaguarCANDriver.h:8 - */ - public static native void FRC_NetworkCommunication_JaguarCANDriver_receiveMessage(IntBuffer messageID, ByteBuffer data, ByteBuffer dataSize, int timeoutMs, IntBuffer status); -} diff --git a/wpilibj/src/main/java/edu/wpi/first/wpilibj/communication/FRC_NetworkCommunicationsLibrary.java b/wpilibj/src/main/java/edu/wpi/first/wpilibj/communication/FRC_NetworkCommunicationsLibrary.java deleted file mode 100644 index ade44cee43..0000000000 --- a/wpilibj/src/main/java/edu/wpi/first/wpilibj/communication/FRC_NetworkCommunicationsLibrary.java +++ /dev/null @@ -1,489 +0,0 @@ -package edu.wpi.first.wpilibj.communication; -import com.ochafik.lang.jnaerator.runtime.LibraryExtractor; -import com.ochafik.lang.jnaerator.runtime.MangledFunctionMapper; -import com.sun.jna.Library; -import com.sun.jna.Native; -import com.sun.jna.NativeLibrary; -import com.sun.jna.Pointer; -import com.sun.jna.PointerType; -import com.sun.jna.ptr.IntByReference; -import com.sun.jna.ptr.ShortByReference; -import java.nio.ByteBuffer; -import java.nio.IntBuffer; -import java.nio.ShortBuffer; -/** - * JNA Wrapper for library FRC_NetworkCommunications
- * This file was autogenerated by JNAerator,
- * a tool written by Olivier Chafik that uses a few opensource projects..
- * For help, please visit NativeLibs4Java , Rococoa, or JNA. - */ -public class FRC_NetworkCommunicationsLibrary implements Library { - public static final String JNA_LIBRARY_NAME = LibraryExtractor.getLibraryPath("FRC_NetworkCommunication", true, FRC_NetworkCommunicationsLibrary.class); - public static final NativeLibrary JNA_NATIVE_LIB = NativeLibrary.getInstance(FRC_NetworkCommunicationsLibrary.JNA_LIBRARY_NAME, MangledFunctionMapper.DEFAULT_OPTIONS); - static { - Native.register(FRC_NetworkCommunicationsLibrary.JNA_LIBRARY_NAME); - } - /** - * native declaration : /home/alex/Projects/WPILib-Development/WPILibC/WPILib/src/main/include/NetworkCommunication/LoadOut.h
- * enum values - */ - public static interface tModuleType { - /** native declaration : /home/alex/Projects/WPILib-Development/WPILibC/WPILib/src/main/include/NetworkCommunication/LoadOut.h:8 */ - public static final int kModuleType_Unknown = 0x00; - /** native declaration : /home/alex/Projects/WPILib-Development/WPILibC/WPILib/src/main/include/NetworkCommunication/LoadOut.h:9 */ - public static final int kModuleType_Analog = 0x01; - /** native declaration : /home/alex/Projects/WPILib-Development/WPILibC/WPILib/src/main/include/NetworkCommunication/LoadOut.h:10 */ - public static final int kModuleType_Digital = 0x02; - /** native declaration : /home/alex/Projects/WPILib-Development/WPILibC/WPILib/src/main/include/NetworkCommunication/LoadOut.h:11 */ - public static final int kModuleType_Solenoid = 0x03; - }; - /** - * native declaration : /home/alex/Projects/WPILib-Development/WPILibC/WPILib/src/main/include/NetworkCommunication/LoadOut.h
- * enum values - */ - public static interface tTargetClass { - /** native declaration : /home/alex/Projects/WPILib-Development/WPILibC/WPILib/src/main/include/NetworkCommunication/LoadOut.h:15 */ - public static final int kTargetClass_Unknown = 0x00; - /** native declaration : /home/alex/Projects/WPILib-Development/WPILibC/WPILib/src/main/include/NetworkCommunication/LoadOut.h:16 */ - public static final int kTargetClass_FRC1 = 0x10; - /** native declaration : /home/alex/Projects/WPILib-Development/WPILibC/WPILib/src/main/include/NetworkCommunication/LoadOut.h:17 */ - public static final int kTargetClass_FRC2 = 0x20; - /** native declaration : /home/alex/Projects/WPILib-Development/WPILibC/WPILib/src/main/include/NetworkCommunication/LoadOut.h:18 */ - public static final int kTargetClass_FRC2_Analog = (int)FRC_NetworkCommunicationsLibrary.tTargetClass.kTargetClass_FRC2 | (int)FRC_NetworkCommunicationsLibrary.tModuleType.kModuleType_Analog; - /** native declaration : /home/alex/Projects/WPILib-Development/WPILibC/WPILib/src/main/include/NetworkCommunication/LoadOut.h:19 */ - public static final int kTargetClass_FRC2_Digital = (int)FRC_NetworkCommunicationsLibrary.tTargetClass.kTargetClass_FRC2 | (int)FRC_NetworkCommunicationsLibrary.tModuleType.kModuleType_Digital; - /** native declaration : /home/alex/Projects/WPILib-Development/WPILibC/WPILib/src/main/include/NetworkCommunication/LoadOut.h:20 */ - public static final int kTargetClass_FRC2_Solenoid = (int)FRC_NetworkCommunicationsLibrary.tTargetClass.kTargetClass_FRC2 | (int)FRC_NetworkCommunicationsLibrary.tModuleType.kModuleType_Solenoid; - /** native declaration : /home/alex/Projects/WPILib-Development/WPILibC/WPILib/src/main/include/NetworkCommunication/LoadOut.h:21 */ - public static final int kTargetClass_FamilyMask = 0xF0; - /** native declaration : /home/alex/Projects/WPILib-Development/WPILibC/WPILib/src/main/include/NetworkCommunication/LoadOut.h:22 */ - public static final int kTargetClass_ModuleMask = 0x0F; - }; - /** - * native declaration : /home/alex/Projects/WPILib-Development/WPILibC/WPILib/src/main/include/NetworkCommunication/UsageReporting.h
- * enum values - */ - public static interface tResourceType { - /** native declaration : /home/alex/Projects/WPILib-Development/WPILibC/WPILib/src/main/include/NetworkCommunication/UsageReporting.h:8 */ - public static final int kResourceType_Controller = 0; - /** native declaration : /home/alex/Projects/WPILib-Development/WPILibC/WPILib/src/main/include/NetworkCommunication/UsageReporting.h:9 */ - public static final int kResourceType_Module = 1; - /** native declaration : /home/alex/Projects/WPILib-Development/WPILibC/WPILib/src/main/include/NetworkCommunication/UsageReporting.h:10 */ - public static final int kResourceType_Language = 2; - /** native declaration : /home/alex/Projects/WPILib-Development/WPILibC/WPILib/src/main/include/NetworkCommunication/UsageReporting.h:11 */ - public static final int kResourceType_CANPlugin = 3; - /** native declaration : /home/alex/Projects/WPILib-Development/WPILibC/WPILib/src/main/include/NetworkCommunication/UsageReporting.h:12 */ - public static final int kResourceType_Accelerometer = 4; - /** native declaration : /home/alex/Projects/WPILib-Development/WPILibC/WPILib/src/main/include/NetworkCommunication/UsageReporting.h:13 */ - public static final int kResourceType_ADXL345 = 5; - /** native declaration : /home/alex/Projects/WPILib-Development/WPILibC/WPILib/src/main/include/NetworkCommunication/UsageReporting.h:14 */ - public static final int kResourceType_AnalogChannel = 6; - /** native declaration : /home/alex/Projects/WPILib-Development/WPILibC/WPILib/src/main/include/NetworkCommunication/UsageReporting.h:15 */ - public static final int kResourceType_AnalogTrigger = 7; - /** native declaration : /home/alex/Projects/WPILib-Development/WPILibC/WPILib/src/main/include/NetworkCommunication/UsageReporting.h:16 */ - public static final int kResourceType_AnalogTriggerOutput = 8; - /** native declaration : /home/alex/Projects/WPILib-Development/WPILibC/WPILib/src/main/include/NetworkCommunication/UsageReporting.h:17 */ - public static final int kResourceType_CANJaguar = 9; - /** native declaration : /home/alex/Projects/WPILib-Development/WPILibC/WPILib/src/main/include/NetworkCommunication/UsageReporting.h:18 */ - public static final int kResourceType_Compressor = 10; - /** native declaration : /home/alex/Projects/WPILib-Development/WPILibC/WPILib/src/main/include/NetworkCommunication/UsageReporting.h:19 */ - public static final int kResourceType_Counter = 11; - /** native declaration : /home/alex/Projects/WPILib-Development/WPILibC/WPILib/src/main/include/NetworkCommunication/UsageReporting.h:20 */ - public static final int kResourceType_Dashboard = 12; - /** native declaration : /home/alex/Projects/WPILib-Development/WPILibC/WPILib/src/main/include/NetworkCommunication/UsageReporting.h:21 */ - public static final int kResourceType_DigitalInput = 13; - /** native declaration : /home/alex/Projects/WPILib-Development/WPILibC/WPILib/src/main/include/NetworkCommunication/UsageReporting.h:22 */ - public static final int kResourceType_DigitalOutput = 14; - /** native declaration : /home/alex/Projects/WPILib-Development/WPILibC/WPILib/src/main/include/NetworkCommunication/UsageReporting.h:23 */ - public static final int kResourceType_DriverStationCIO = 15; - /** native declaration : /home/alex/Projects/WPILib-Development/WPILibC/WPILib/src/main/include/NetworkCommunication/UsageReporting.h:24 */ - public static final int kResourceType_DriverStationEIO = 16; - /** native declaration : /home/alex/Projects/WPILib-Development/WPILibC/WPILib/src/main/include/NetworkCommunication/UsageReporting.h:25 */ - public static final int kResourceType_DriverStationLCD = 17; - /** native declaration : /home/alex/Projects/WPILib-Development/WPILibC/WPILib/src/main/include/NetworkCommunication/UsageReporting.h:26 */ - public static final int kResourceType_Encoder = 18; - /** native declaration : /home/alex/Projects/WPILib-Development/WPILibC/WPILib/src/main/include/NetworkCommunication/UsageReporting.h:27 */ - public static final int kResourceType_GearTooth = 19; - /** native declaration : /home/alex/Projects/WPILib-Development/WPILibC/WPILib/src/main/include/NetworkCommunication/UsageReporting.h:28 */ - public static final int kResourceType_Gyro = 20; - /** native declaration : /home/alex/Projects/WPILib-Development/WPILibC/WPILib/src/main/include/NetworkCommunication/UsageReporting.h:29 */ - public static final int kResourceType_I2C = 21; - /** native declaration : /home/alex/Projects/WPILib-Development/WPILibC/WPILib/src/main/include/NetworkCommunication/UsageReporting.h:30 */ - public static final int kResourceType_Framework = 22; - /** native declaration : /home/alex/Projects/WPILib-Development/WPILibC/WPILib/src/main/include/NetworkCommunication/UsageReporting.h:31 */ - public static final int kResourceType_Jaguar = 23; - /** native declaration : /home/alex/Projects/WPILib-Development/WPILibC/WPILib/src/main/include/NetworkCommunication/UsageReporting.h:32 */ - public static final int kResourceType_Joystick = 24; - /** native declaration : /home/alex/Projects/WPILib-Development/WPILibC/WPILib/src/main/include/NetworkCommunication/UsageReporting.h:33 */ - public static final int kResourceType_Kinect = 25; - /** native declaration : /home/alex/Projects/WPILib-Development/WPILibC/WPILib/src/main/include/NetworkCommunication/UsageReporting.h:34 */ - public static final int kResourceType_KinectStick = 26; - /** native declaration : /home/alex/Projects/WPILib-Development/WPILibC/WPILib/src/main/include/NetworkCommunication/UsageReporting.h:35 */ - public static final int kResourceType_PIDController = 27; - /** native declaration : /home/alex/Projects/WPILib-Development/WPILibC/WPILib/src/main/include/NetworkCommunication/UsageReporting.h:36 */ - public static final int kResourceType_Preferences = 28; - /** native declaration : /home/alex/Projects/WPILib-Development/WPILibC/WPILib/src/main/include/NetworkCommunication/UsageReporting.h:37 */ - public static final int kResourceType_PWM = 29; - /** native declaration : /home/alex/Projects/WPILib-Development/WPILibC/WPILib/src/main/include/NetworkCommunication/UsageReporting.h:38 */ - public static final int kResourceType_Relay = 30; - /** native declaration : /home/alex/Projects/WPILib-Development/WPILibC/WPILib/src/main/include/NetworkCommunication/UsageReporting.h:39 */ - public static final int kResourceType_RobotDrive = 31; - /** native declaration : /home/alex/Projects/WPILib-Development/WPILibC/WPILib/src/main/include/NetworkCommunication/UsageReporting.h:40 */ - public static final int kResourceType_SerialPort = 32; - /** native declaration : /home/alex/Projects/WPILib-Development/WPILibC/WPILib/src/main/include/NetworkCommunication/UsageReporting.h:41 */ - public static final int kResourceType_Servo = 33; - /** native declaration : /home/alex/Projects/WPILib-Development/WPILibC/WPILib/src/main/include/NetworkCommunication/UsageReporting.h:42 */ - public static final int kResourceType_Solenoid = 34; - /** native declaration : /home/alex/Projects/WPILib-Development/WPILibC/WPILib/src/main/include/NetworkCommunication/UsageReporting.h:43 */ - public static final int kResourceType_SPI = 35; - /** native declaration : /home/alex/Projects/WPILib-Development/WPILibC/WPILib/src/main/include/NetworkCommunication/UsageReporting.h:44 */ - public static final int kResourceType_Task = 36; - /** native declaration : /home/alex/Projects/WPILib-Development/WPILibC/WPILib/src/main/include/NetworkCommunication/UsageReporting.h:45 */ - public static final int kResourceType_Ultrasonic = 37; - /** native declaration : /home/alex/Projects/WPILib-Development/WPILibC/WPILib/src/main/include/NetworkCommunication/UsageReporting.h:46 */ - public static final int kResourceType_Victor = 38; - /** native declaration : /home/alex/Projects/WPILib-Development/WPILibC/WPILib/src/main/include/NetworkCommunication/UsageReporting.h:47 */ - public static final int kResourceType_Button = 39; - /** native declaration : /home/alex/Projects/WPILib-Development/WPILibC/WPILib/src/main/include/NetworkCommunication/UsageReporting.h:48 */ - public static final int kResourceType_Command = 40; - /** native declaration : /home/alex/Projects/WPILib-Development/WPILibC/WPILib/src/main/include/NetworkCommunication/UsageReporting.h:49 */ - public static final int kResourceType_AxisCamera = 41; - /** native declaration : /home/alex/Projects/WPILib-Development/WPILibC/WPILib/src/main/include/NetworkCommunication/UsageReporting.h:50 */ - public static final int kResourceType_PCVideoServer = 42; - /** native declaration : /home/alex/Projects/WPILib-Development/WPILibC/WPILib/src/main/include/NetworkCommunication/UsageReporting.h:51 */ - public static final int kResourceType_SmartDashboard = 43; - /** native declaration : /home/alex/Projects/WPILib-Development/WPILibC/WPILib/src/main/include/NetworkCommunication/UsageReporting.h:52 */ - public static final int kResourceType_Talon = 44; - /** native declaration : /home/alex/Projects/WPILib-Development/WPILibC/WPILib/src/main/include/NetworkCommunication/UsageReporting.h:53 */ - public static final int kResourceType_HiTechnicColorSensor = 45; - /** native declaration : /home/alex/Projects/WPILib-Development/WPILibC/WPILib/src/main/include/NetworkCommunication/UsageReporting.h:54 */ - public static final int kResourceType_HiTechnicAccel = 46; - /** native declaration : /home/alex/Projects/WPILib-Development/WPILibC/WPILib/src/main/include/NetworkCommunication/UsageReporting.h:55 */ - public static final int kResourceType_HiTechnicCompass = 47; - /** native declaration : /home/alex/Projects/WPILib-Development/WPILibC/WPILib/src/main/include/NetworkCommunication/UsageReporting.h:56 */ - public static final int kResourceType_SRF08 = 48; - }; - /** - * native declaration : /home/alex/Projects/WPILib-Development/WPILibC/WPILib/src/main/include/NetworkCommunication/UsageReporting.h
- * enum values - */ - public static interface tInstances { - /** native declaration : /home/alex/Projects/WPILib-Development/WPILibC/WPILib/src/main/include/NetworkCommunication/UsageReporting.h:60 */ - public static final int kLanguage_LabVIEW = 1; - /** native declaration : /home/alex/Projects/WPILib-Development/WPILibC/WPILib/src/main/include/NetworkCommunication/UsageReporting.h:61 */ - public static final int kLanguage_CPlusPlus = 2; - /** native declaration : /home/alex/Projects/WPILib-Development/WPILibC/WPILib/src/main/include/NetworkCommunication/UsageReporting.h:62 */ - public static final int kLanguage_Java = 3; - /** native declaration : /home/alex/Projects/WPILib-Development/WPILibC/WPILib/src/main/include/NetworkCommunication/UsageReporting.h:63 */ - public static final int kLanguage_Python = 4; - /** native declaration : /home/alex/Projects/WPILib-Development/WPILibC/WPILib/src/main/include/NetworkCommunication/UsageReporting.h:65 */ - public static final int kCANPlugin_BlackJagBridge = 1; - /** native declaration : /home/alex/Projects/WPILib-Development/WPILibC/WPILib/src/main/include/NetworkCommunication/UsageReporting.h:66 */ - public static final int kCANPlugin_2CAN = 2; - /** native declaration : /home/alex/Projects/WPILib-Development/WPILibC/WPILib/src/main/include/NetworkCommunication/UsageReporting.h:68 */ - public static final int kFramework_Iterative = 1; - /** native declaration : /home/alex/Projects/WPILib-Development/WPILibC/WPILib/src/main/include/NetworkCommunication/UsageReporting.h:69 */ - public static final int kFramework_Simple = 2; - /** native declaration : /home/alex/Projects/WPILib-Development/WPILibC/WPILib/src/main/include/NetworkCommunication/UsageReporting.h:71 */ - public static final int kRobotDrive_ArcadeStandard = 1; - /** native declaration : /home/alex/Projects/WPILib-Development/WPILibC/WPILib/src/main/include/NetworkCommunication/UsageReporting.h:72 */ - public static final int kRobotDrive_ArcadeButtonSpin = 2; - /** native declaration : /home/alex/Projects/WPILib-Development/WPILibC/WPILib/src/main/include/NetworkCommunication/UsageReporting.h:73 */ - public static final int kRobotDrive_ArcadeRatioCurve = 3; - /** native declaration : /home/alex/Projects/WPILib-Development/WPILibC/WPILib/src/main/include/NetworkCommunication/UsageReporting.h:74 */ - public static final int kRobotDrive_Tank = 4; - /** native declaration : /home/alex/Projects/WPILib-Development/WPILibC/WPILib/src/main/include/NetworkCommunication/UsageReporting.h:75 */ - public static final int kRobotDrive_MecanumPolar = 5; - /** native declaration : /home/alex/Projects/WPILib-Development/WPILibC/WPILib/src/main/include/NetworkCommunication/UsageReporting.h:76 */ - public static final int kRobotDrive_MecanumCartesian = 6; - /** native declaration : /home/alex/Projects/WPILib-Development/WPILibC/WPILib/src/main/include/NetworkCommunication/UsageReporting.h:78 */ - public static final int kDriverStationCIO_Analog = 1; - /** native declaration : /home/alex/Projects/WPILib-Development/WPILibC/WPILib/src/main/include/NetworkCommunication/UsageReporting.h:79 */ - public static final int kDriverStationCIO_DigitalIn = 2; - /** native declaration : /home/alex/Projects/WPILib-Development/WPILibC/WPILib/src/main/include/NetworkCommunication/UsageReporting.h:80 */ - public static final int kDriverStationCIO_DigitalOut = 3; - /** native declaration : /home/alex/Projects/WPILib-Development/WPILibC/WPILib/src/main/include/NetworkCommunication/UsageReporting.h:82 */ - public static final int kDriverStationEIO_Acceleration = 1; - /** native declaration : /home/alex/Projects/WPILib-Development/WPILibC/WPILib/src/main/include/NetworkCommunication/UsageReporting.h:83 */ - public static final int kDriverStationEIO_AnalogIn = 2; - /** native declaration : /home/alex/Projects/WPILib-Development/WPILibC/WPILib/src/main/include/NetworkCommunication/UsageReporting.h:84 */ - public static final int kDriverStationEIO_AnalogOut = 3; - /** native declaration : /home/alex/Projects/WPILib-Development/WPILibC/WPILib/src/main/include/NetworkCommunication/UsageReporting.h:85 */ - public static final int kDriverStationEIO_Button = 4; - /** native declaration : /home/alex/Projects/WPILib-Development/WPILibC/WPILib/src/main/include/NetworkCommunication/UsageReporting.h:86 */ - public static final int kDriverStationEIO_LED = 5; - /** native declaration : /home/alex/Projects/WPILib-Development/WPILibC/WPILib/src/main/include/NetworkCommunication/UsageReporting.h:87 */ - public static final int kDriverStationEIO_DigitalIn = 6; - /** native declaration : /home/alex/Projects/WPILib-Development/WPILibC/WPILib/src/main/include/NetworkCommunication/UsageReporting.h:88 */ - public static final int kDriverStationEIO_DigitalOut = 7; - /** native declaration : /home/alex/Projects/WPILib-Development/WPILibC/WPILib/src/main/include/NetworkCommunication/UsageReporting.h:89 */ - public static final int kDriverStationEIO_FixedDigitalOut = 8; - /** native declaration : /home/alex/Projects/WPILib-Development/WPILibC/WPILib/src/main/include/NetworkCommunication/UsageReporting.h:90 */ - public static final int kDriverStationEIO_PWM = 9; - /** native declaration : /home/alex/Projects/WPILib-Development/WPILibC/WPILib/src/main/include/NetworkCommunication/UsageReporting.h:91 */ - public static final int kDriverStationEIO_Encoder = 10; - /** native declaration : /home/alex/Projects/WPILib-Development/WPILibC/WPILib/src/main/include/NetworkCommunication/UsageReporting.h:92 */ - public static final int kDriverStationEIO_TouchSlider = 11; - /** native declaration : /home/alex/Projects/WPILib-Development/WPILibC/WPILib/src/main/include/NetworkCommunication/UsageReporting.h:94 */ - public static final int kADXL345_SPI = 1; - /** native declaration : /home/alex/Projects/WPILib-Development/WPILibC/WPILib/src/main/include/NetworkCommunication/UsageReporting.h:95 */ - public static final int kADXL345_I2C = 2; - /** native declaration : /home/alex/Projects/WPILib-Development/WPILibC/WPILib/src/main/include/NetworkCommunication/UsageReporting.h:97 */ - public static final int kCommand_Scheduler = 1; - /** native declaration : /home/alex/Projects/WPILib-Development/WPILibC/WPILib/src/main/include/NetworkCommunication/UsageReporting.h:99 */ - public static final int kSmartDashboard_Instance = 1; - }; - /** native declaration : /home/alex/Projects/WPILib-Development/WPILibC/WPILib/src/main/include/NetworkCommunication/FRCComm.h */ - public static final int USER_DS_LCD_DATA_SIZE = 128; - /** native declaration : /home/alex/Projects/WPILib-Development/WPILibC/WPILib/src/main/include/NetworkCommunication/FRCComm.h */ - public static final int kFRC_NetworkCommunication_DynamicType_Kinect_Custom = 25; - /** native declaration : /home/alex/Projects/WPILib-Development/WPILibC/WPILib/src/main/include/NetworkCommunication/FRCComm.h */ - public static final int kFRC_NetworkCommunication_DynamicType_Kinect_Header = 19; - /** native declaration : /home/alex/Projects/WPILib-Development/WPILibC/WPILib/src/main/include/NetworkCommunication/FRCComm.h */ - public static final int IO_CONFIG_DATA_SIZE = 32; - /** native declaration : /home/alex/Projects/WPILib-Development/WPILibC/WPILib/src/main/include/NetworkCommunication/LoadOut.h */ - public static final int kMaxModuleNumber = 2; - /** native declaration : /home/alex/Projects/WPILib-Development/WPILibC/WPILib/src/main/include/NetworkCommunication/FRCComm.h */ - public static final int kFRC_NetworkCommunication_DynamicType_DSEnhancedIO_Output = 18; - /** native declaration : /home/alex/Projects/WPILib-Development/WPILibC/WPILib/src/main/include/NetworkCommunication/FRCComm.h */ - public static final int SYS_STATUS_DATA_SIZE = 44; - /** native declaration : /home/alex/Projects/WPILib-Development/WPILibC/WPILib/src/main/include/NetworkCommunication/FRCComm.h */ - public static final int kFRC_NetworkCommunication_DynamicType_Kinect_Extra2 = 22; - /** native declaration : /home/alex/Projects/WPILib-Development/WPILibC/WPILib/src/main/include/NetworkCommunication/FRCComm.h */ - public static final int kFRC_NetworkCommunication_DynamicType_Kinect_Extra1 = 20; - /** native declaration : /home/alex/Projects/WPILib-Development/WPILibC/WPILib/src/main/include/NetworkCommunication/FRCComm.h */ - public static final int kFRC_NetworkCommunication_DynamicType_DSEnhancedIO_Input = 17; - /** native declaration : /home/alex/Projects/WPILib-Development/WPILibC/WPILib/src/main/include/NetworkCommunication/FRCComm.h */ - public static final int USER_STATUS_DATA_SIZE = (984 - 32 - 44); - /** native declaration : /home/alex/Projects/WPILib-Development/WPILibC/WPILib/src/main/include/NetworkCommunication/FRCComm.h */ - public static final int kFRC_NetworkCommunication_DynamicType_Kinect_Joystick = 24; - /** native declaration : /home/alex/Projects/WPILib-Development/WPILibC/WPILib/src/main/include/NetworkCommunication/UsageReporting.h */ - public static final int kUsageReporting_version = 1; - /** native declaration : /home/alex/Projects/WPILib-Development/WPILibC/WPILib/src/main/include/NetworkCommunication/FRCComm.h */ - public static final int kFRC_NetworkCommunication_DynamicType_Kinect_Vertices1 = 21; - /** native declaration : /home/alex/Projects/WPILib-Development/WPILibC/WPILib/src/main/include/NetworkCommunication/FRCComm.h */ - public static final int kFRC_NetworkCommunication_DynamicType_Kinect_Vertices2 = 23; - /** - * Original signature : uint32_t FRC_NetworkCommunication_nAICalibration_getLSBWeight(const uint32_t, const uint32_t, int32_t*)
- * native declaration : /home/alex/Projects/WPILib-Development/WPILibC/WPILib/src/main/include/NetworkCommunication/AICalibration.h:7
- * @deprecated use the safer methods {@link #FRC_NetworkCommunication_nAICalibration_getLSBWeight(int, int, java.nio.IntBuffer)} and {@link #FRC_NetworkCommunication_nAICalibration_getLSBWeight(int, int, com.sun.jna.ptr.IntByReference)} instead - */ - @Deprecated - public static native int FRC_NetworkCommunication_nAICalibration_getLSBWeight(int aiSystemIndex, int channel, IntByReference status); - /** - * Original signature : uint32_t FRC_NetworkCommunication_nAICalibration_getLSBWeight(const uint32_t, const uint32_t, int32_t*)
- * native declaration : /home/alex/Projects/WPILib-Development/WPILibC/WPILib/src/main/include/NetworkCommunication/AICalibration.h:7 - */ - public static native int FRC_NetworkCommunication_nAICalibration_getLSBWeight(int aiSystemIndex, int channel, IntBuffer status); - /** - * Original signature : int32_t FRC_NetworkCommunication_nAICalibration_getOffset(const uint32_t, const uint32_t, int32_t*)
- * native declaration : /home/alex/Projects/WPILib-Development/WPILibC/WPILib/src/main/include/NetworkCommunication/AICalibration.h:8
- * @deprecated use the safer methods {@link #FRC_NetworkCommunication_nAICalibration_getOffset(int, int, java.nio.IntBuffer)} and {@link #FRC_NetworkCommunication_nAICalibration_getOffset(int, int, com.sun.jna.ptr.IntByReference)} instead - */ - @Deprecated - public static native int FRC_NetworkCommunication_nAICalibration_getOffset(int aiSystemIndex, int channel, IntByReference status); - /** - * Original signature : int32_t FRC_NetworkCommunication_nAICalibration_getOffset(const uint32_t, const uint32_t, int32_t*)
- * native declaration : /home/alex/Projects/WPILib-Development/WPILibC/WPILib/src/main/include/NetworkCommunication/AICalibration.h:8 - */ - public static native int FRC_NetworkCommunication_nAICalibration_getOffset(int aiSystemIndex, int channel, IntBuffer status); - /** - * Original signature : uint32_t FRC_NetworkCommunication_nLoadOut_getModulePresence(uint32_t, uint8_t)
- * native declaration : /home/alex/Projects/WPILib-Development/WPILibC/WPILib/src/main/include/NetworkCommunication/LoadOut.h:31 - */ - public static native int FRC_NetworkCommunication_nLoadOut_getModulePresence(int moduleType, byte moduleNumber); - /** - * Original signature : uint32_t FRC_NetworkCommunication_nLoadOut_getTargetClass()
- * native declaration : /home/alex/Projects/WPILib-Development/WPILibC/WPILib/src/main/include/NetworkCommunication/LoadOut.h:32 - */ - public static native int FRC_NetworkCommunication_nLoadOut_getTargetClass(); - /** - * Original signature : uint32_t FRC_NetworkCommunication_nUsageReporting_report(uint8_t, uint8_t, uint8_t, const char*)
- * native declaration : /home/alex/Projects/WPILib-Development/WPILibC/WPILib/src/main/include/NetworkCommunication/UsageReporting.h:117
- * @deprecated use the safer methods {@link #FRC_NetworkCommunication_nUsageReporting_report(byte, byte, byte, java.lang.String)} and {@link #FRC_NetworkCommunication_nUsageReporting_report(byte, byte, byte, com.sun.jna.Pointer)} instead - */ - @Deprecated - public static native int FRC_NetworkCommunication_nUsageReporting_report(byte resource, byte instanceNumber, byte context, Pointer feature); - /** - * Original signature : uint32_t FRC_NetworkCommunication_nUsageReporting_report(uint8_t, uint8_t, uint8_t, const char*)
- * native declaration : /home/alex/Projects/WPILib-Development/WPILibC/WPILib/src/main/include/NetworkCommunication/UsageReporting.h:117 - */ - public static native int FRC_NetworkCommunication_nUsageReporting_report(byte resource, byte instanceNumber, byte context, String feature); - /** - * Original signature : void getFPGAHardwareVersion(uint16_t*, uint32_t*)
- * native declaration : /home/alex/Projects/WPILib-Development/WPILibC/WPILib/src/main/include/NetworkCommunication/FRCComm.h:142
- * @deprecated use the safer methods {@link #getFPGAHardwareVersion(java.nio.ShortBuffer, java.nio.IntBuffer)} and {@link #getFPGAHardwareVersion(com.sun.jna.ptr.ShortByReference, com.sun.jna.ptr.IntByReference)} instead - */ - @Deprecated - public static native void getFPGAHardwareVersion(ShortByReference fpgaVersion, IntByReference fpgaRevision); - /** - * Original signature : void getFPGAHardwareVersion(uint16_t*, uint32_t*)
- * native declaration : /home/alex/Projects/WPILib-Development/WPILibC/WPILib/src/main/include/NetworkCommunication/FRCComm.h:142 - */ - public static native void getFPGAHardwareVersion(ShortBuffer fpgaVersion, IntBuffer fpgaRevision); - /** - * Original signature : int getCommonControlData(FRCCommonControlData*, int)
- * native declaration : /home/alex/Projects/WPILib-Development/WPILibC/WPILib/src/main/include/NetworkCommunication/FRCComm.h:144 - */ - public static native int getCommonControlData(FRCCommonControlData data, int wait_ms); - /** - * Original signature : int getRecentCommonControlData(FRCCommonControlData*, int)
- * native declaration : /home/alex/Projects/WPILib-Development/WPILibC/WPILib/src/main/include/NetworkCommunication/FRCComm.h:145 - */ - public static native int getRecentCommonControlData(FRCCommonControlData commonData, int wait_ms); - /** - * Original signature : int getRecentStatusData(uint8_t*, uint8_t*, uint8_t*, int)
- * native declaration : /home/alex/Projects/WPILib-Development/WPILibC/WPILib/src/main/include/NetworkCommunication/FRCComm.h:146
- * @deprecated use the safer methods {@link #getRecentStatusData(java.nio.ByteBuffer, java.nio.ByteBuffer, java.nio.ByteBuffer, int)} and {@link #getRecentStatusData(com.sun.jna.Pointer, com.sun.jna.Pointer, com.sun.jna.Pointer, int)} instead - */ - @Deprecated - public static native int getRecentStatusData(Pointer batteryInt, Pointer batteryDec, Pointer dsDigitalOut, int wait_ms); - /** - * Original signature : int getRecentStatusData(uint8_t*, uint8_t*, uint8_t*, int)
- * native declaration : /home/alex/Projects/WPILib-Development/WPILibC/WPILib/src/main/include/NetworkCommunication/FRCComm.h:146 - */ - public static native int getRecentStatusData(ByteBuffer batteryInt, ByteBuffer batteryDec, ByteBuffer dsDigitalOut, int wait_ms); - /** - * Original signature : int getDynamicControlData(uint8_t, char*, int32_t, int)
- * native declaration : /home/alex/Projects/WPILib-Development/WPILibC/WPILib/src/main/include/NetworkCommunication/FRCComm.h:147
- * @deprecated use the safer methods {@link #getDynamicControlData(byte, java.nio.ByteBuffer, int, int)} and {@link #getDynamicControlData(byte, com.sun.jna.Pointer, int, int)} instead - */ - @Deprecated - public static native int getDynamicControlData(byte type, Pointer dynamicData, int maxLength, int wait_ms); - /** - * Original signature : int getDynamicControlData(uint8_t, char*, int32_t, int)
- * native declaration : /home/alex/Projects/WPILib-Development/WPILibC/WPILib/src/main/include/NetworkCommunication/FRCComm.h:147 - */ - public static native int getDynamicControlData(byte type, ByteBuffer dynamicData, int maxLength, int wait_ms); - /** - * Original signature : int setStatusData(float, uint8_t, uint8_t, const char*, int, const char*, int, int)
- * native declaration : /home/alex/Projects/WPILib-Development/WPILibC/WPILib/src/main/include/NetworkCommunication/FRCComm.h:148
- * @deprecated use the safer methods {@link #setStatusData(float, byte, byte, java.lang.String, int, java.lang.String, int, int)} and {@link #setStatusData(float, byte, byte, com.sun.jna.Pointer, int, com.sun.jna.Pointer, int, int)} instead - */ - @Deprecated - public static native int setStatusData(float battery, byte dsDigitalOut, byte updateNumber, Pointer userDataHigh, int userDataHighLength, Pointer userDataLow, int userDataLowLength, int wait_ms); - /** - * Original signature : int setStatusData(float, uint8_t, uint8_t, const char*, int, const char*, int, int)
- * native declaration : /home/alex/Projects/WPILib-Development/WPILibC/WPILib/src/main/include/NetworkCommunication/FRCComm.h:148 - */ - public static native int setStatusData(float battery, byte dsDigitalOut, byte updateNumber, String userDataHigh, int userDataHighLength, String userDataLow, int userDataLowLength, int wait_ms); - /** - * Original signature : int setStatusDataFloatAsInt(int, uint8_t, uint8_t, const char*, int, const char*, int, int)
- * native declaration : /home/alex/Projects/WPILib-Development/WPILibC/WPILib/src/main/include/NetworkCommunication/FRCComm.h:151
- * @deprecated use the safer methods {@link #setStatusDataFloatAsInt(int, byte, byte, java.lang.String, int, java.lang.String, int, int)} and {@link #setStatusDataFloatAsInt(int, byte, byte, com.sun.jna.Pointer, int, com.sun.jna.Pointer, int, int)} instead - */ - @Deprecated - public static native int setStatusDataFloatAsInt(int battery, byte dsDigitalOut, byte updateNumber, Pointer userDataHigh, int userDataHighLength, Pointer userDataLow, int userDataLowLength, int wait_ms); - /** - * Original signature : int setStatusDataFloatAsInt(int, uint8_t, uint8_t, const char*, int, const char*, int, int)
- * native declaration : /home/alex/Projects/WPILib-Development/WPILibC/WPILib/src/main/include/NetworkCommunication/FRCComm.h:151 - */ - public static native int setStatusDataFloatAsInt(int battery, byte dsDigitalOut, byte updateNumber, String userDataHigh, int userDataHighLength, String userDataLow, int userDataLowLength, int wait_ms); - /** - * Original signature : int setErrorData(const char*, int, int)
- * native declaration : /home/alex/Projects/WPILib-Development/WPILibC/WPILib/src/main/include/NetworkCommunication/FRCComm.h:154
- * @deprecated use the safer methods {@link #setErrorData(java.lang.String, int, int)} and {@link #setErrorData(com.sun.jna.Pointer, int, int)} instead - */ - @Deprecated - public static native int setErrorData(Pointer errors, int errorsLength, int wait_ms); - /** - * Original signature : int setErrorData(const char*, int, int)
- * native declaration : /home/alex/Projects/WPILib-Development/WPILibC/WPILib/src/main/include/NetworkCommunication/FRCComm.h:154 - */ - public static native int setErrorData(String errors, int errorsLength, int wait_ms); - /** - * Original signature : int setUserDsLcdData(const char*, int, int)
- * native declaration : /home/alex/Projects/WPILib-Development/WPILibC/WPILib/src/main/include/NetworkCommunication/FRCComm.h:155
- * @deprecated use the safer methods {@link #setUserDsLcdData(java.lang.String, int, int)} and {@link #setUserDsLcdData(com.sun.jna.Pointer, int, int)} instead - */ - @Deprecated - public static native int setUserDsLcdData(Pointer userDsLcdData, int userDsLcdDataLength, int wait_ms); - /** - * Original signature : int setUserDsLcdData(const char*, int, int)
- * native declaration : /home/alex/Projects/WPILib-Development/WPILibC/WPILib/src/main/include/NetworkCommunication/FRCComm.h:155 - */ - public static native int setUserDsLcdData(String userDsLcdData, int userDsLcdDataLength, int wait_ms); - /** - * Original signature : int overrideIOConfig(const char*, int)
- * native declaration : /home/alex/Projects/WPILib-Development/WPILibC/WPILib/src/main/include/NetworkCommunication/FRCComm.h:156
- * @deprecated use the safer methods {@link #overrideIOConfig(java.lang.String, int)} and {@link #overrideIOConfig(com.sun.jna.Pointer, int)} instead - */ - @Deprecated - public static native int overrideIOConfig(Pointer ioConfig, int wait_ms); - /** - * Original signature : int overrideIOConfig(const char*, int)
- * native declaration : /home/alex/Projects/WPILib-Development/WPILibC/WPILib/src/main/include/NetworkCommunication/FRCComm.h:156 - */ - public static native int overrideIOConfig(String ioConfig, int wait_ms); - /** - * Original signature : void setNewDataSem(pthread_mutex_t*)
- * native declaration : /home/alex/Projects/WPILib-Development/WPILibC/WPILib/src/main/include/NetworkCommunication/FRCComm.h:165 - */ - public static native void setNewDataSem(Pointer pthread_mutex_tPtr1); - /** - * Original signature : void setResyncSem(pthread_mutex_t*)
- * native declaration : /home/alex/Projects/WPILib-Development/WPILibC/WPILib/src/main/include/NetworkCommunication/FRCComm.h:166 - */ - public static native void setResyncSem(Pointer pthread_mutex_tPtr1); - /** - * Original signature : void signalResyncActionDone()
- * native declaration : /home/alex/Projects/WPILib-Development/WPILibC/WPILib/src/main/include/NetworkCommunication/FRCComm.h:168 - */ - public static native void signalResyncActionDone(); - /** - * this uint32_t is really a LVRefNum
- * Original signature : void setNewDataOccurRef(uint32_t)
- * native declaration : /home/alex/Projects/WPILib-Development/WPILibC/WPILib/src/main/include/NetworkCommunication/FRCComm.h:172 - */ - public static native void setNewDataOccurRef(int refnum); - /** - * Original signature : void setResyncOccurRef(uint32_t)
- * native declaration : /home/alex/Projects/WPILib-Development/WPILibC/WPILib/src/main/include/NetworkCommunication/FRCComm.h:174 - */ - public static native void setResyncOccurRef(int refnum); - /** - * Original signature : void FRC_NetworkCommunication_getVersionString(char*)
- * native declaration : /home/alex/Projects/WPILib-Development/WPILibC/WPILib/src/main/include/NetworkCommunication/FRCComm.h:177
- * @deprecated use the safer methods {@link #FRC_NetworkCommunication_getVersionString(java.nio.ByteBuffer)} and {@link #FRC_NetworkCommunication_getVersionString(com.sun.jna.Pointer)} instead - */ - @Deprecated - public static native void FRC_NetworkCommunication_getVersionString(Pointer version); - /** - * Original signature : void FRC_NetworkCommunication_getVersionString(char*)
- * native declaration : /home/alex/Projects/WPILib-Development/WPILibC/WPILib/src/main/include/NetworkCommunication/FRCComm.h:177 - */ - public static native void FRC_NetworkCommunication_getVersionString(ByteBuffer version); - /** - * Original signature : void FRC_NetworkCommunication_observeUserProgramStarting()
- * native declaration : /home/alex/Projects/WPILib-Development/WPILibC/WPILib/src/main/include/NetworkCommunication/FRCComm.h:178 - */ - public static native void FRC_NetworkCommunication_observeUserProgramStarting(); - /** - * Original signature : void FRC_NetworkCommunication_observeUserProgramDisabled()
- * native declaration : /home/alex/Projects/WPILib-Development/WPILibC/WPILib/src/main/include/NetworkCommunication/FRCComm.h:179 - */ - public static native void FRC_NetworkCommunication_observeUserProgramDisabled(); - /** - * Original signature : void FRC_NetworkCommunication_observeUserProgramAutonomous()
- * native declaration : /home/alex/Projects/WPILib-Development/WPILibC/WPILib/src/main/include/NetworkCommunication/FRCComm.h:180 - */ - public static native void FRC_NetworkCommunication_observeUserProgramAutonomous(); - /** - * Original signature : void FRC_NetworkCommunication_observeUserProgramTeleop()
- * native declaration : /home/alex/Projects/WPILib-Development/WPILibC/WPILib/src/main/include/NetworkCommunication/FRCComm.h:181 - */ - public static native void FRC_NetworkCommunication_observeUserProgramTeleop(); - /** - * Original signature : void FRC_NetworkCommunication_observeUserProgramTest()
- * native declaration : /home/alex/Projects/WPILib-Development/WPILibC/WPILib/src/main/include/NetworkCommunication/FRCComm.h:182 - */ - public static native void FRC_NetworkCommunication_observeUserProgramTest(); - public static class STATUS extends PointerType { - public STATUS(Pointer address) { - super(address); - } - public STATUS() { - super(); - } - }; -} diff --git a/wpilibj/wpilibJava/pom.xml b/wpilibj/wpilibJava/pom.xml new file mode 100644 index 0000000000..7eeaf4a93a --- /dev/null +++ b/wpilibj/wpilibJava/pom.xml @@ -0,0 +1,128 @@ + + + 4.0.0 + edu.wpi.first.wpilibj + wpilibJava + jar + 0.1.0-SNAPSHOT + + + edu.wpi.first.wpilib.templates.athena + library-jar + 0.1.0-SNAPSHOT + ../../maven-utilities/athena/library-jar + + + + + + + + + + + + + + + + edu.wpi.first.wpilib.networktables.java + NetworkTables + 0.1.0-SNAPSHOT + + + + + + + org.apache.maven.plugins + maven-compiler-plugin + 3.1 + + 1.7 + 1.7 + + edu/wpi/first/wpilibj/image/ + edu/wpi/first/wpilibj/camera/ + edu/wpi/first/wpilibj/visa/ + edu/wpi/first/wpilibj/SerialPort.java + edu/wpi/first/wpilibj/Kinect.java + edu/wpi/first/wpilibj/KinectStick.java + edu/wpi/first/wpilibj/DriverStationEnhancedIO.java + edu/wpi/first/wpilibj/buttons/DigitalIOButton.java + edu/wpi/first/wpilibj/buttons/AnalogIOButton.java + + + + + + org.apache.maven.plugins + maven-source-plugin + + + org.apache.maven.plugins + maven-javadoc-plugin + + + edu/wpi/first/wpilibj/image/ + edu/wpi/first/wpilibj/camera/ + edu/wpi/first/wpilibj/visa/ + edu/wpi/first/wpilibj/SerialPort.java + edu/wpi/first/wpilibj/Kinect.java + edu/wpi/first/wpilibj/KinectStick.java + edu/wpi/first/wpilibj/DriverStationEnhancedIO.java + edu/wpi/first/wpilibj/buttons/DigitalIOButton.java + edu/wpi/first/wpilibj/buttons/AnalogIOButton.java + + + + + + diff --git a/wpilibj/src/main/java/edu/wpi/first/wpilibj/ADXL345_I2C.java b/wpilibj/wpilibJava/src/main/java/edu/wpi/first/wpilibj/ADXL345_I2C.java similarity index 100% rename from wpilibj/src/main/java/edu/wpi/first/wpilibj/ADXL345_I2C.java rename to wpilibj/wpilibJava/src/main/java/edu/wpi/first/wpilibj/ADXL345_I2C.java diff --git a/wpilibj/src/main/java/edu/wpi/first/wpilibj/Accelerometer.java b/wpilibj/wpilibJava/src/main/java/edu/wpi/first/wpilibj/Accelerometer.java similarity index 100% rename from wpilibj/src/main/java/edu/wpi/first/wpilibj/Accelerometer.java rename to wpilibj/wpilibJava/src/main/java/edu/wpi/first/wpilibj/Accelerometer.java diff --git a/wpilibj/src/main/java/edu/wpi/first/wpilibj/AccumulatorResult.java b/wpilibj/wpilibJava/src/main/java/edu/wpi/first/wpilibj/AccumulatorResult.java similarity index 100% rename from wpilibj/src/main/java/edu/wpi/first/wpilibj/AccumulatorResult.java rename to wpilibj/wpilibJava/src/main/java/edu/wpi/first/wpilibj/AccumulatorResult.java diff --git a/wpilibj/src/main/java/edu/wpi/first/wpilibj/AnalogChannel.java b/wpilibj/wpilibJava/src/main/java/edu/wpi/first/wpilibj/AnalogChannel.java similarity index 100% rename from wpilibj/src/main/java/edu/wpi/first/wpilibj/AnalogChannel.java rename to wpilibj/wpilibJava/src/main/java/edu/wpi/first/wpilibj/AnalogChannel.java diff --git a/wpilibj/src/main/java/edu/wpi/first/wpilibj/AnalogModule.java b/wpilibj/wpilibJava/src/main/java/edu/wpi/first/wpilibj/AnalogModule.java similarity index 100% rename from wpilibj/src/main/java/edu/wpi/first/wpilibj/AnalogModule.java rename to wpilibj/wpilibJava/src/main/java/edu/wpi/first/wpilibj/AnalogModule.java diff --git a/wpilibj/src/main/java/edu/wpi/first/wpilibj/AnalogTrigger.java b/wpilibj/wpilibJava/src/main/java/edu/wpi/first/wpilibj/AnalogTrigger.java similarity index 100% rename from wpilibj/src/main/java/edu/wpi/first/wpilibj/AnalogTrigger.java rename to wpilibj/wpilibJava/src/main/java/edu/wpi/first/wpilibj/AnalogTrigger.java diff --git a/wpilibj/src/main/java/edu/wpi/first/wpilibj/AnalogTriggerOutput.java b/wpilibj/wpilibJava/src/main/java/edu/wpi/first/wpilibj/AnalogTriggerOutput.java similarity index 100% rename from wpilibj/src/main/java/edu/wpi/first/wpilibj/AnalogTriggerOutput.java rename to wpilibj/wpilibJava/src/main/java/edu/wpi/first/wpilibj/AnalogTriggerOutput.java diff --git a/wpilibj/src/main/java/edu/wpi/first/wpilibj/CANJaguar.java b/wpilibj/wpilibJava/src/main/java/edu/wpi/first/wpilibj/CANJaguar.java similarity index 100% rename from wpilibj/src/main/java/edu/wpi/first/wpilibj/CANJaguar.java rename to wpilibj/wpilibJava/src/main/java/edu/wpi/first/wpilibj/CANJaguar.java diff --git a/wpilibj/src/main/java/edu/wpi/first/wpilibj/Compressor.java b/wpilibj/wpilibJava/src/main/java/edu/wpi/first/wpilibj/Compressor.java similarity index 100% rename from wpilibj/src/main/java/edu/wpi/first/wpilibj/Compressor.java rename to wpilibj/wpilibJava/src/main/java/edu/wpi/first/wpilibj/Compressor.java diff --git a/wpilibj/src/main/java/edu/wpi/first/wpilibj/Controller.java b/wpilibj/wpilibJava/src/main/java/edu/wpi/first/wpilibj/Controller.java similarity index 100% rename from wpilibj/src/main/java/edu/wpi/first/wpilibj/Controller.java rename to wpilibj/wpilibJava/src/main/java/edu/wpi/first/wpilibj/Controller.java diff --git a/wpilibj/src/main/java/edu/wpi/first/wpilibj/Counter.java b/wpilibj/wpilibJava/src/main/java/edu/wpi/first/wpilibj/Counter.java similarity index 100% rename from wpilibj/src/main/java/edu/wpi/first/wpilibj/Counter.java rename to wpilibj/wpilibJava/src/main/java/edu/wpi/first/wpilibj/Counter.java diff --git a/wpilibj/src/main/java/edu/wpi/first/wpilibj/CounterBase.java b/wpilibj/wpilibJava/src/main/java/edu/wpi/first/wpilibj/CounterBase.java similarity index 100% rename from wpilibj/src/main/java/edu/wpi/first/wpilibj/CounterBase.java rename to wpilibj/wpilibJava/src/main/java/edu/wpi/first/wpilibj/CounterBase.java diff --git a/wpilibj/src/main/java/edu/wpi/first/wpilibj/Dashboard.java b/wpilibj/wpilibJava/src/main/java/edu/wpi/first/wpilibj/Dashboard.java similarity index 100% rename from wpilibj/src/main/java/edu/wpi/first/wpilibj/Dashboard.java rename to wpilibj/wpilibJava/src/main/java/edu/wpi/first/wpilibj/Dashboard.java diff --git a/wpilibj/src/main/java/edu/wpi/first/wpilibj/DigitalInput.java b/wpilibj/wpilibJava/src/main/java/edu/wpi/first/wpilibj/DigitalInput.java similarity index 100% rename from wpilibj/src/main/java/edu/wpi/first/wpilibj/DigitalInput.java rename to wpilibj/wpilibJava/src/main/java/edu/wpi/first/wpilibj/DigitalInput.java diff --git a/wpilibj/src/main/java/edu/wpi/first/wpilibj/DigitalModule.java b/wpilibj/wpilibJava/src/main/java/edu/wpi/first/wpilibj/DigitalModule.java similarity index 100% rename from wpilibj/src/main/java/edu/wpi/first/wpilibj/DigitalModule.java rename to wpilibj/wpilibJava/src/main/java/edu/wpi/first/wpilibj/DigitalModule.java diff --git a/wpilibj/src/main/java/edu/wpi/first/wpilibj/DigitalOutput.java b/wpilibj/wpilibJava/src/main/java/edu/wpi/first/wpilibj/DigitalOutput.java similarity index 100% rename from wpilibj/src/main/java/edu/wpi/first/wpilibj/DigitalOutput.java rename to wpilibj/wpilibJava/src/main/java/edu/wpi/first/wpilibj/DigitalOutput.java diff --git a/wpilibj/src/main/java/edu/wpi/first/wpilibj/DigitalSource.java b/wpilibj/wpilibJava/src/main/java/edu/wpi/first/wpilibj/DigitalSource.java similarity index 100% rename from wpilibj/src/main/java/edu/wpi/first/wpilibj/DigitalSource.java rename to wpilibj/wpilibJava/src/main/java/edu/wpi/first/wpilibj/DigitalSource.java diff --git a/wpilibj/src/main/java/edu/wpi/first/wpilibj/DoubleSolenoid.java b/wpilibj/wpilibJava/src/main/java/edu/wpi/first/wpilibj/DoubleSolenoid.java similarity index 100% rename from wpilibj/src/main/java/edu/wpi/first/wpilibj/DoubleSolenoid.java rename to wpilibj/wpilibJava/src/main/java/edu/wpi/first/wpilibj/DoubleSolenoid.java diff --git a/wpilibj/src/main/java/edu/wpi/first/wpilibj/DriverStation.java b/wpilibj/wpilibJava/src/main/java/edu/wpi/first/wpilibj/DriverStation.java similarity index 100% rename from wpilibj/src/main/java/edu/wpi/first/wpilibj/DriverStation.java rename to wpilibj/wpilibJava/src/main/java/edu/wpi/first/wpilibj/DriverStation.java diff --git a/wpilibj/src/main/java/edu/wpi/first/wpilibj/DriverStationEnhancedIO.java b/wpilibj/wpilibJava/src/main/java/edu/wpi/first/wpilibj/DriverStationEnhancedIO.java similarity index 100% rename from wpilibj/src/main/java/edu/wpi/first/wpilibj/DriverStationEnhancedIO.java rename to wpilibj/wpilibJava/src/main/java/edu/wpi/first/wpilibj/DriverStationEnhancedIO.java diff --git a/wpilibj/src/main/java/edu/wpi/first/wpilibj/DriverStationLCD.java b/wpilibj/wpilibJava/src/main/java/edu/wpi/first/wpilibj/DriverStationLCD.java similarity index 100% rename from wpilibj/src/main/java/edu/wpi/first/wpilibj/DriverStationLCD.java rename to wpilibj/wpilibJava/src/main/java/edu/wpi/first/wpilibj/DriverStationLCD.java diff --git a/wpilibj/src/main/java/edu/wpi/first/wpilibj/Encoder.java b/wpilibj/wpilibJava/src/main/java/edu/wpi/first/wpilibj/Encoder.java similarity index 100% rename from wpilibj/src/main/java/edu/wpi/first/wpilibj/Encoder.java rename to wpilibj/wpilibJava/src/main/java/edu/wpi/first/wpilibj/Encoder.java diff --git a/wpilibj/src/main/java/edu/wpi/first/wpilibj/GearTooth.java b/wpilibj/wpilibJava/src/main/java/edu/wpi/first/wpilibj/GearTooth.java similarity index 100% rename from wpilibj/src/main/java/edu/wpi/first/wpilibj/GearTooth.java rename to wpilibj/wpilibJava/src/main/java/edu/wpi/first/wpilibj/GearTooth.java diff --git a/wpilibj/src/main/java/edu/wpi/first/wpilibj/GenericHID.java b/wpilibj/wpilibJava/src/main/java/edu/wpi/first/wpilibj/GenericHID.java similarity index 100% rename from wpilibj/src/main/java/edu/wpi/first/wpilibj/GenericHID.java rename to wpilibj/wpilibJava/src/main/java/edu/wpi/first/wpilibj/GenericHID.java diff --git a/wpilibj/src/main/java/edu/wpi/first/wpilibj/Gyro.java b/wpilibj/wpilibJava/src/main/java/edu/wpi/first/wpilibj/Gyro.java similarity index 100% rename from wpilibj/src/main/java/edu/wpi/first/wpilibj/Gyro.java rename to wpilibj/wpilibJava/src/main/java/edu/wpi/first/wpilibj/Gyro.java diff --git a/wpilibj/src/main/java/edu/wpi/first/wpilibj/HiTechnicColorSensor.java b/wpilibj/wpilibJava/src/main/java/edu/wpi/first/wpilibj/HiTechnicColorSensor.java similarity index 100% rename from wpilibj/src/main/java/edu/wpi/first/wpilibj/HiTechnicColorSensor.java rename to wpilibj/wpilibJava/src/main/java/edu/wpi/first/wpilibj/HiTechnicColorSensor.java diff --git a/wpilibj/src/main/java/edu/wpi/first/wpilibj/HiTechnicCompass.java b/wpilibj/wpilibJava/src/main/java/edu/wpi/first/wpilibj/HiTechnicCompass.java similarity index 100% rename from wpilibj/src/main/java/edu/wpi/first/wpilibj/HiTechnicCompass.java rename to wpilibj/wpilibJava/src/main/java/edu/wpi/first/wpilibj/HiTechnicCompass.java diff --git a/wpilibj/src/main/java/edu/wpi/first/wpilibj/I2C.java b/wpilibj/wpilibJava/src/main/java/edu/wpi/first/wpilibj/I2C.java similarity index 100% rename from wpilibj/src/main/java/edu/wpi/first/wpilibj/I2C.java rename to wpilibj/wpilibJava/src/main/java/edu/wpi/first/wpilibj/I2C.java diff --git a/wpilibj/src/main/java/edu/wpi/first/wpilibj/IDashboard.java b/wpilibj/wpilibJava/src/main/java/edu/wpi/first/wpilibj/IDashboard.java similarity index 100% rename from wpilibj/src/main/java/edu/wpi/first/wpilibj/IDashboard.java rename to wpilibj/wpilibJava/src/main/java/edu/wpi/first/wpilibj/IDashboard.java diff --git a/wpilibj/src/main/java/edu/wpi/first/wpilibj/InterruptableSensorBase.java b/wpilibj/wpilibJava/src/main/java/edu/wpi/first/wpilibj/InterruptableSensorBase.java similarity index 100% rename from wpilibj/src/main/java/edu/wpi/first/wpilibj/InterruptableSensorBase.java rename to wpilibj/wpilibJava/src/main/java/edu/wpi/first/wpilibj/InterruptableSensorBase.java diff --git a/wpilibj/src/main/java/edu/wpi/first/wpilibj/IterativeRobot.java b/wpilibj/wpilibJava/src/main/java/edu/wpi/first/wpilibj/IterativeRobot.java similarity index 100% rename from wpilibj/src/main/java/edu/wpi/first/wpilibj/IterativeRobot.java rename to wpilibj/wpilibJava/src/main/java/edu/wpi/first/wpilibj/IterativeRobot.java diff --git a/wpilibj/src/main/java/edu/wpi/first/wpilibj/Jaguar.java b/wpilibj/wpilibJava/src/main/java/edu/wpi/first/wpilibj/Jaguar.java similarity index 100% rename from wpilibj/src/main/java/edu/wpi/first/wpilibj/Jaguar.java rename to wpilibj/wpilibJava/src/main/java/edu/wpi/first/wpilibj/Jaguar.java diff --git a/wpilibj/src/main/java/edu/wpi/first/wpilibj/Joystick.java b/wpilibj/wpilibJava/src/main/java/edu/wpi/first/wpilibj/Joystick.java similarity index 100% rename from wpilibj/src/main/java/edu/wpi/first/wpilibj/Joystick.java rename to wpilibj/wpilibJava/src/main/java/edu/wpi/first/wpilibj/Joystick.java diff --git a/wpilibj/src/main/java/edu/wpi/first/wpilibj/Kinect.java b/wpilibj/wpilibJava/src/main/java/edu/wpi/first/wpilibj/Kinect.java similarity index 100% rename from wpilibj/src/main/java/edu/wpi/first/wpilibj/Kinect.java rename to wpilibj/wpilibJava/src/main/java/edu/wpi/first/wpilibj/Kinect.java diff --git a/wpilibj/src/main/java/edu/wpi/first/wpilibj/KinectStick.java b/wpilibj/wpilibJava/src/main/java/edu/wpi/first/wpilibj/KinectStick.java similarity index 100% rename from wpilibj/src/main/java/edu/wpi/first/wpilibj/KinectStick.java rename to wpilibj/wpilibJava/src/main/java/edu/wpi/first/wpilibj/KinectStick.java diff --git a/wpilibj/src/main/java/edu/wpi/first/wpilibj/Module.java b/wpilibj/wpilibJava/src/main/java/edu/wpi/first/wpilibj/Module.java similarity index 100% rename from wpilibj/src/main/java/edu/wpi/first/wpilibj/Module.java rename to wpilibj/wpilibJava/src/main/java/edu/wpi/first/wpilibj/Module.java diff --git a/wpilibj/src/main/java/edu/wpi/first/wpilibj/MotorSafety.java b/wpilibj/wpilibJava/src/main/java/edu/wpi/first/wpilibj/MotorSafety.java similarity index 100% rename from wpilibj/src/main/java/edu/wpi/first/wpilibj/MotorSafety.java rename to wpilibj/wpilibJava/src/main/java/edu/wpi/first/wpilibj/MotorSafety.java diff --git a/wpilibj/src/main/java/edu/wpi/first/wpilibj/MotorSafetyHelper.java b/wpilibj/wpilibJava/src/main/java/edu/wpi/first/wpilibj/MotorSafetyHelper.java similarity index 100% rename from wpilibj/src/main/java/edu/wpi/first/wpilibj/MotorSafetyHelper.java rename to wpilibj/wpilibJava/src/main/java/edu/wpi/first/wpilibj/MotorSafetyHelper.java diff --git a/wpilibj/src/main/java/edu/wpi/first/wpilibj/NamedSendable.java b/wpilibj/wpilibJava/src/main/java/edu/wpi/first/wpilibj/NamedSendable.java similarity index 100% rename from wpilibj/src/main/java/edu/wpi/first/wpilibj/NamedSendable.java rename to wpilibj/wpilibJava/src/main/java/edu/wpi/first/wpilibj/NamedSendable.java diff --git a/wpilibj/src/main/java/edu/wpi/first/wpilibj/PIDController.java b/wpilibj/wpilibJava/src/main/java/edu/wpi/first/wpilibj/PIDController.java similarity index 100% rename from wpilibj/src/main/java/edu/wpi/first/wpilibj/PIDController.java rename to wpilibj/wpilibJava/src/main/java/edu/wpi/first/wpilibj/PIDController.java diff --git a/wpilibj/src/main/java/edu/wpi/first/wpilibj/PIDOutput.java b/wpilibj/wpilibJava/src/main/java/edu/wpi/first/wpilibj/PIDOutput.java similarity index 100% rename from wpilibj/src/main/java/edu/wpi/first/wpilibj/PIDOutput.java rename to wpilibj/wpilibJava/src/main/java/edu/wpi/first/wpilibj/PIDOutput.java diff --git a/wpilibj/src/main/java/edu/wpi/first/wpilibj/PIDSource.java b/wpilibj/wpilibJava/src/main/java/edu/wpi/first/wpilibj/PIDSource.java similarity index 100% rename from wpilibj/src/main/java/edu/wpi/first/wpilibj/PIDSource.java rename to wpilibj/wpilibJava/src/main/java/edu/wpi/first/wpilibj/PIDSource.java diff --git a/wpilibj/src/main/java/edu/wpi/first/wpilibj/PWM.java b/wpilibj/wpilibJava/src/main/java/edu/wpi/first/wpilibj/PWM.java similarity index 100% rename from wpilibj/src/main/java/edu/wpi/first/wpilibj/PWM.java rename to wpilibj/wpilibJava/src/main/java/edu/wpi/first/wpilibj/PWM.java diff --git a/wpilibj/src/main/java/edu/wpi/first/wpilibj/Preferences.java b/wpilibj/wpilibJava/src/main/java/edu/wpi/first/wpilibj/Preferences.java similarity index 100% rename from wpilibj/src/main/java/edu/wpi/first/wpilibj/Preferences.java rename to wpilibj/wpilibJava/src/main/java/edu/wpi/first/wpilibj/Preferences.java diff --git a/wpilibj/src/main/java/edu/wpi/first/wpilibj/Relay.java b/wpilibj/wpilibJava/src/main/java/edu/wpi/first/wpilibj/Relay.java similarity index 100% rename from wpilibj/src/main/java/edu/wpi/first/wpilibj/Relay.java rename to wpilibj/wpilibJava/src/main/java/edu/wpi/first/wpilibj/Relay.java diff --git a/wpilibj/src/main/java/edu/wpi/first/wpilibj/Resource.java b/wpilibj/wpilibJava/src/main/java/edu/wpi/first/wpilibj/Resource.java similarity index 100% rename from wpilibj/src/main/java/edu/wpi/first/wpilibj/Resource.java rename to wpilibj/wpilibJava/src/main/java/edu/wpi/first/wpilibj/Resource.java diff --git a/wpilibj/src/main/java/edu/wpi/first/wpilibj/RobotBase.java b/wpilibj/wpilibJava/src/main/java/edu/wpi/first/wpilibj/RobotBase.java similarity index 100% rename from wpilibj/src/main/java/edu/wpi/first/wpilibj/RobotBase.java rename to wpilibj/wpilibJava/src/main/java/edu/wpi/first/wpilibj/RobotBase.java diff --git a/wpilibj/src/main/java/edu/wpi/first/wpilibj/RobotDrive.java b/wpilibj/wpilibJava/src/main/java/edu/wpi/first/wpilibj/RobotDrive.java similarity index 100% rename from wpilibj/src/main/java/edu/wpi/first/wpilibj/RobotDrive.java rename to wpilibj/wpilibJava/src/main/java/edu/wpi/first/wpilibj/RobotDrive.java diff --git a/wpilibj/src/main/java/edu/wpi/first/wpilibj/SafePWM.java b/wpilibj/wpilibJava/src/main/java/edu/wpi/first/wpilibj/SafePWM.java similarity index 100% rename from wpilibj/src/main/java/edu/wpi/first/wpilibj/SafePWM.java rename to wpilibj/wpilibJava/src/main/java/edu/wpi/first/wpilibj/SafePWM.java diff --git a/wpilibj/src/main/java/edu/wpi/first/wpilibj/Sendable.java b/wpilibj/wpilibJava/src/main/java/edu/wpi/first/wpilibj/Sendable.java similarity index 100% rename from wpilibj/src/main/java/edu/wpi/first/wpilibj/Sendable.java rename to wpilibj/wpilibJava/src/main/java/edu/wpi/first/wpilibj/Sendable.java diff --git a/wpilibj/src/main/java/edu/wpi/first/wpilibj/SensorBase.java b/wpilibj/wpilibJava/src/main/java/edu/wpi/first/wpilibj/SensorBase.java similarity index 100% rename from wpilibj/src/main/java/edu/wpi/first/wpilibj/SensorBase.java rename to wpilibj/wpilibJava/src/main/java/edu/wpi/first/wpilibj/SensorBase.java diff --git a/wpilibj/src/main/java/edu/wpi/first/wpilibj/SerialPort.java b/wpilibj/wpilibJava/src/main/java/edu/wpi/first/wpilibj/SerialPort.java similarity index 100% rename from wpilibj/src/main/java/edu/wpi/first/wpilibj/SerialPort.java rename to wpilibj/wpilibJava/src/main/java/edu/wpi/first/wpilibj/SerialPort.java diff --git a/wpilibj/src/main/java/edu/wpi/first/wpilibj/Servo.java b/wpilibj/wpilibJava/src/main/java/edu/wpi/first/wpilibj/Servo.java similarity index 100% rename from wpilibj/src/main/java/edu/wpi/first/wpilibj/Servo.java rename to wpilibj/wpilibJava/src/main/java/edu/wpi/first/wpilibj/Servo.java diff --git a/wpilibj/src/main/java/edu/wpi/first/wpilibj/SimpleRobot.java b/wpilibj/wpilibJava/src/main/java/edu/wpi/first/wpilibj/SimpleRobot.java similarity index 100% rename from wpilibj/src/main/java/edu/wpi/first/wpilibj/SimpleRobot.java rename to wpilibj/wpilibJava/src/main/java/edu/wpi/first/wpilibj/SimpleRobot.java diff --git a/wpilibj/src/main/java/edu/wpi/first/wpilibj/Skeleton.java b/wpilibj/wpilibJava/src/main/java/edu/wpi/first/wpilibj/Skeleton.java similarity index 100% rename from wpilibj/src/main/java/edu/wpi/first/wpilibj/Skeleton.java rename to wpilibj/wpilibJava/src/main/java/edu/wpi/first/wpilibj/Skeleton.java diff --git a/wpilibj/src/main/java/edu/wpi/first/wpilibj/Solenoid.java b/wpilibj/wpilibJava/src/main/java/edu/wpi/first/wpilibj/Solenoid.java similarity index 100% rename from wpilibj/src/main/java/edu/wpi/first/wpilibj/Solenoid.java rename to wpilibj/wpilibJava/src/main/java/edu/wpi/first/wpilibj/Solenoid.java diff --git a/wpilibj/src/main/java/edu/wpi/first/wpilibj/SolenoidBase.java b/wpilibj/wpilibJava/src/main/java/edu/wpi/first/wpilibj/SolenoidBase.java similarity index 100% rename from wpilibj/src/main/java/edu/wpi/first/wpilibj/SolenoidBase.java rename to wpilibj/wpilibJava/src/main/java/edu/wpi/first/wpilibj/SolenoidBase.java diff --git a/wpilibj/src/main/java/edu/wpi/first/wpilibj/SpeedController.java b/wpilibj/wpilibJava/src/main/java/edu/wpi/first/wpilibj/SpeedController.java similarity index 100% rename from wpilibj/src/main/java/edu/wpi/first/wpilibj/SpeedController.java rename to wpilibj/wpilibJava/src/main/java/edu/wpi/first/wpilibj/SpeedController.java diff --git a/wpilibj/src/main/java/edu/wpi/first/wpilibj/Talon.java b/wpilibj/wpilibJava/src/main/java/edu/wpi/first/wpilibj/Talon.java similarity index 100% rename from wpilibj/src/main/java/edu/wpi/first/wpilibj/Talon.java rename to wpilibj/wpilibJava/src/main/java/edu/wpi/first/wpilibj/Talon.java diff --git a/wpilibj/src/main/java/edu/wpi/first/wpilibj/Timer.java b/wpilibj/wpilibJava/src/main/java/edu/wpi/first/wpilibj/Timer.java similarity index 100% rename from wpilibj/src/main/java/edu/wpi/first/wpilibj/Timer.java rename to wpilibj/wpilibJava/src/main/java/edu/wpi/first/wpilibj/Timer.java diff --git a/wpilibj/src/main/java/edu/wpi/first/wpilibj/Ultrasonic.java b/wpilibj/wpilibJava/src/main/java/edu/wpi/first/wpilibj/Ultrasonic.java similarity index 100% rename from wpilibj/src/main/java/edu/wpi/first/wpilibj/Ultrasonic.java rename to wpilibj/wpilibJava/src/main/java/edu/wpi/first/wpilibj/Ultrasonic.java diff --git a/wpilibj/src/main/java/edu/wpi/first/wpilibj/Utility.java b/wpilibj/wpilibJava/src/main/java/edu/wpi/first/wpilibj/Utility.java similarity index 100% rename from wpilibj/src/main/java/edu/wpi/first/wpilibj/Utility.java rename to wpilibj/wpilibJava/src/main/java/edu/wpi/first/wpilibj/Utility.java diff --git a/wpilibj/src/main/java/edu/wpi/first/wpilibj/Victor.java b/wpilibj/wpilibJava/src/main/java/edu/wpi/first/wpilibj/Victor.java similarity index 100% rename from wpilibj/src/main/java/edu/wpi/first/wpilibj/Victor.java rename to wpilibj/wpilibJava/src/main/java/edu/wpi/first/wpilibj/Victor.java diff --git a/wpilibj/wpilibJava/src/main/java/edu/wpi/first/wpilibj/Watchdog.java b/wpilibj/wpilibJava/src/main/java/edu/wpi/first/wpilibj/Watchdog.java new file mode 100644 index 0000000000..c0dba57f80 --- /dev/null +++ b/wpilibj/wpilibJava/src/main/java/edu/wpi/first/wpilibj/Watchdog.java @@ -0,0 +1,206 @@ +/*----------------------------------------------------------------------------*/ +/* Copyright (c) FIRST 2008-2012. All Rights Reserved. */ +/* Open Source Software - may be modified and shared by FRC teams. The code */ +/* must be accompanied by the FIRST BSD license file in the root directory of */ +/* the project. */ +/*----------------------------------------------------------------------------*/ +package edu.wpi.first.wpilibj; + +import java.util.logging.*; +import java.nio.ByteOrder; +import java.nio.IntBuffer; +import java.nio.ByteBuffer; + +//import com.sun.jna.Pointer; + + +import edu.wpi.first.wpilibj.hal.WatchdogJNI; +import edu.wpi.first.wpilibj.hal.HALUtil; +import edu.wpi.first.wpilibj.parsing.IUtility; + +/** + * Watchdog timer class. The watchdog timer is designed to keep the robots safe. + * The idea is that the robot program must constantly "feed" the watchdog + * otherwise it will shut down all the motor outputs. That way if a program + * breaks, rather than having the robot continue to operate at the last known + * speed, the motors will be shut down. + * + * This is serious business. Don't just disable the watchdog. You can't afford + * it! + * + * http://thedailywtf.com/Articles/_0x2f__0x2f_TODO_0x3a__Uncomment_Later.aspx + */ +public class Watchdog extends SensorBase implements IUtility { + private static Logger logger = Logger.getLogger("Watchdog"); + private static ConsoleHandler ch = new ConsoleHandler(); + private static Watchdog m_instance; + private ByteBuffer m_watchDog; + + static + { + logger.addHandler(ch); + logger.setLevel(Level.ALL); + } + + /** + * The Watchdog is born. + */ + protected Watchdog() { + // allocate direct + ByteBuffer status = ByteBuffer.allocateDirect(4); + // set the byte order + status.order(ByteOrder.LITTLE_ENDIAN); + m_watchDog = WatchdogJNI.initializeWatchdog(status.asIntBuffer()); + // set the byte order for the return value + m_watchDog.order(ByteOrder.LITTLE_ENDIAN); + logger.info("Initialize Watchdog Status = " + status.getInt(0) ); + logger.info("Watchdog Handle Length = " + m_watchDog.capacity() ); + logger.info("Watchdog Handle Value:" + m_watchDog.getInt(0)); + HALUtil.checkStatus(status.asIntBuffer()); + } + + /** + * Get an instance of the watchdog + * + * @return an instance of the watchdog + */ + public static synchronized Watchdog getInstance() { + if (m_instance == null) { + m_instance = new Watchdog(); + } + return m_instance; + } + + /** + * Throw the dog a bone. + * + * When everything is going well, you feed your dog when you get home. Let's + * hope you don't drive your car off a bridge on the way home... Your dog + * won't get fed and he will starve to death. + * + * By the way, it's not cool to ask the neighbor (some random task) to feed + * your dog for you. He's your responsibility! + */ + public void feed() { + IntBuffer status = ByteBuffer.allocateDirect(4).asIntBuffer(); + WatchdogJNI.feedWatchdog(m_watchDog, status); + HALUtil.checkStatus(status); + } + + /** + * Put the watchdog out of its misery. + * + * Don't wait for your dying robot to starve when there is a problem. Kill + * it quickly, cleanly, and humanely. + */ + public void kill() { + IntBuffer status = ByteBuffer.allocateDirect(4).asIntBuffer(); + WatchdogJNI.killWatchdog(m_watchDog, status); + HALUtil.checkStatus(status); + } + + /** + * Read how long it has been since the watchdog was last fed. + * + * @return The number of seconds since last meal. + */ + public double getTimer() { + IntBuffer status = ByteBuffer.allocateDirect(4).asIntBuffer(); + double value = WatchdogJNI.getWatchdogLastFed(m_watchDog, status); + HALUtil.checkStatus(status); + return value; + } + + /** + * Read what the current expiration is. + * + * @return The number of seconds before starvation following a meal + * (watchdog starves if it doesn't eat this often). + */ + public double getExpiration() { + IntBuffer status = ByteBuffer.allocateDirect(4).asIntBuffer(); + double value = WatchdogJNI.getWatchdogExpiration(m_watchDog, status); + HALUtil.checkStatus(status); + return value; + } + + /** + * Configure how many seconds your watchdog can be neglected before it + * starves to death. + * + * @param expiration + * The number of seconds before starvation following a meal + * (watchdog starves if it doesn't eat this often). + */ + public void setExpiration(double expiration) { + // allocate direct + ByteBuffer status = ByteBuffer.allocateDirect(4); + // set to c++ byte order + status.order(ByteOrder.LITTLE_ENDIAN); + WatchdogJNI.setWatchdogExpiration(m_watchDog, expiration, status.asIntBuffer()); + HALUtil.checkStatus(status.asIntBuffer()); + } + + /** + * Find out if the watchdog is currently enabled or disabled (mortal or + * immortal). + * + * @return Enabled or disabled. + */ + public boolean getEnabled() { + IntBuffer status = ByteBuffer.allocateDirect(4).asIntBuffer(); + boolean value = WatchdogJNI.getWatchdogEnabled(m_watchDog, status) != 0; + HALUtil.checkStatus(status); + return value; + } + + /** + * Enable or disable the watchdog timer. + * + * When enabled, you must keep feeding the watchdog timer to keep the + * watchdog active, and hence the dangerous parts (motor outputs, etc.) can + * keep functioning. When disabled, the watchdog is immortal and will remain + * active even without being fed. It will also ignore any kill commands + * while disabled. + * + * @param enabled + * Enable or disable the watchdog. + */ + public void setEnabled(final boolean enabled) { + IntBuffer status = ByteBuffer.allocateDirect(4).asIntBuffer(); + WatchdogJNI.setWatchdogEnabled(m_watchDog, (byte) (enabled ? 1 : 0), + status); + HALUtil.checkStatus(status); + } + + /** + * Check in on the watchdog and make sure he's still kicking. + * + * This indicates that your watchdog is allowing the system to operate. It + * is still possible that the network communications is not allowing the + * system to run, but you can check this to make sure it's not your fault. + * Check isSystemActive() for overall system status. + * + * If the watchdog is disabled, then your watchdog is immortal. + * + * @return Is the watchdog still alive? + */ + public boolean isAlive() { + IntBuffer status = ByteBuffer.allocateDirect(4).asIntBuffer(); + boolean value = WatchdogJNI.isWatchdogAlive(m_watchDog, status) != 0; + HALUtil.checkStatus(status); + return value; + } + + /** + * Check on the overall status of the system. + * + * @return Is the system active (i.e. PWM motor outputs, etc. enabled)? + */ + public boolean isSystemActive() { + IntBuffer status = ByteBuffer.allocateDirect(4).asIntBuffer(); + boolean value = WatchdogJNI.isWatchdogSystemActive(m_watchDog, status) != 0; + HALUtil.checkStatus(status); + return value; + } +} diff --git a/wpilibj/src/main/java/edu/wpi/first/wpilibj/buttons/AnalogIOButton.java b/wpilibj/wpilibJava/src/main/java/edu/wpi/first/wpilibj/buttons/AnalogIOButton.java similarity index 100% rename from wpilibj/src/main/java/edu/wpi/first/wpilibj/buttons/AnalogIOButton.java rename to wpilibj/wpilibJava/src/main/java/edu/wpi/first/wpilibj/buttons/AnalogIOButton.java diff --git a/wpilibj/src/main/java/edu/wpi/first/wpilibj/buttons/Button.java b/wpilibj/wpilibJava/src/main/java/edu/wpi/first/wpilibj/buttons/Button.java similarity index 100% rename from wpilibj/src/main/java/edu/wpi/first/wpilibj/buttons/Button.java rename to wpilibj/wpilibJava/src/main/java/edu/wpi/first/wpilibj/buttons/Button.java diff --git a/wpilibj/src/main/java/edu/wpi/first/wpilibj/buttons/DigitalIOButton.java b/wpilibj/wpilibJava/src/main/java/edu/wpi/first/wpilibj/buttons/DigitalIOButton.java similarity index 100% rename from wpilibj/src/main/java/edu/wpi/first/wpilibj/buttons/DigitalIOButton.java rename to wpilibj/wpilibJava/src/main/java/edu/wpi/first/wpilibj/buttons/DigitalIOButton.java diff --git a/wpilibj/src/main/java/edu/wpi/first/wpilibj/buttons/InternalButton.java b/wpilibj/wpilibJava/src/main/java/edu/wpi/first/wpilibj/buttons/InternalButton.java similarity index 100% rename from wpilibj/src/main/java/edu/wpi/first/wpilibj/buttons/InternalButton.java rename to wpilibj/wpilibJava/src/main/java/edu/wpi/first/wpilibj/buttons/InternalButton.java diff --git a/wpilibj/src/main/java/edu/wpi/first/wpilibj/buttons/JoystickButton.java b/wpilibj/wpilibJava/src/main/java/edu/wpi/first/wpilibj/buttons/JoystickButton.java similarity index 100% rename from wpilibj/src/main/java/edu/wpi/first/wpilibj/buttons/JoystickButton.java rename to wpilibj/wpilibJava/src/main/java/edu/wpi/first/wpilibj/buttons/JoystickButton.java diff --git a/wpilibj/src/main/java/edu/wpi/first/wpilibj/buttons/NetworkButton.java b/wpilibj/wpilibJava/src/main/java/edu/wpi/first/wpilibj/buttons/NetworkButton.java similarity index 100% rename from wpilibj/src/main/java/edu/wpi/first/wpilibj/buttons/NetworkButton.java rename to wpilibj/wpilibJava/src/main/java/edu/wpi/first/wpilibj/buttons/NetworkButton.java diff --git a/wpilibj/src/main/java/edu/wpi/first/wpilibj/buttons/Trigger.java b/wpilibj/wpilibJava/src/main/java/edu/wpi/first/wpilibj/buttons/Trigger.java similarity index 100% rename from wpilibj/src/main/java/edu/wpi/first/wpilibj/buttons/Trigger.java rename to wpilibj/wpilibJava/src/main/java/edu/wpi/first/wpilibj/buttons/Trigger.java diff --git a/wpilibj/src/main/java/edu/wpi/first/wpilibj/camera/AxisCamera.java b/wpilibj/wpilibJava/src/main/java/edu/wpi/first/wpilibj/camera/AxisCamera.java similarity index 100% rename from wpilibj/src/main/java/edu/wpi/first/wpilibj/camera/AxisCamera.java rename to wpilibj/wpilibJava/src/main/java/edu/wpi/first/wpilibj/camera/AxisCamera.java diff --git a/wpilibj/src/main/java/edu/wpi/first/wpilibj/camera/AxisCameraException.java b/wpilibj/wpilibJava/src/main/java/edu/wpi/first/wpilibj/camera/AxisCameraException.java similarity index 100% rename from wpilibj/src/main/java/edu/wpi/first/wpilibj/camera/AxisCameraException.java rename to wpilibj/wpilibJava/src/main/java/edu/wpi/first/wpilibj/camera/AxisCameraException.java diff --git a/wpilibj/src/main/java/edu/wpi/first/wpilibj/camera/package.html b/wpilibj/wpilibJava/src/main/java/edu/wpi/first/wpilibj/camera/package.html similarity index 100% rename from wpilibj/src/main/java/edu/wpi/first/wpilibj/camera/package.html rename to wpilibj/wpilibJava/src/main/java/edu/wpi/first/wpilibj/camera/package.html diff --git a/wpilibj/src/main/java/edu/wpi/first/wpilibj/can/CANExceptionFactory.java b/wpilibj/wpilibJava/src/main/java/edu/wpi/first/wpilibj/can/CANExceptionFactory.java similarity index 100% rename from wpilibj/src/main/java/edu/wpi/first/wpilibj/can/CANExceptionFactory.java rename to wpilibj/wpilibJava/src/main/java/edu/wpi/first/wpilibj/can/CANExceptionFactory.java diff --git a/wpilibj/src/main/java/edu/wpi/first/wpilibj/can/CANInvalidBufferException.java b/wpilibj/wpilibJava/src/main/java/edu/wpi/first/wpilibj/can/CANInvalidBufferException.java similarity index 100% rename from wpilibj/src/main/java/edu/wpi/first/wpilibj/can/CANInvalidBufferException.java rename to wpilibj/wpilibJava/src/main/java/edu/wpi/first/wpilibj/can/CANInvalidBufferException.java diff --git a/wpilibj/wpilibJava/src/main/java/edu/wpi/first/wpilibj/can/CANJNI.java b/wpilibj/wpilibJava/src/main/java/edu/wpi/first/wpilibj/can/CANJNI.java new file mode 100644 index 0000000000..a7d88f80f7 --- /dev/null +++ b/wpilibj/wpilibJava/src/main/java/edu/wpi/first/wpilibj/can/CANJNI.java @@ -0,0 +1,458 @@ +package edu.wpi.first.wpilibj.can; +//import com.ochafik.lang.jnaerator.runtime.LibraryExtractor; +//import com.ochafik.lang.jnaerator.runtime.MangledFunctionMapper; +//import com.sun.jna.Library; +//import com.sun.jna.Native; +//import com.sun.jna.NativeLibrary; +//import com.sun.jna.Pointer; +//import com.sun.jna.ptr.IntByReference; +import edu.wpi.first.wpilibj.hal.JNIWrapper; +import java.nio.ByteBuffer; +import java.nio.IntBuffer; +/** + * JNA Wrapper for library CAN
+ * This file was autogenerated by JNAerator,
+ * a tool written by Olivier Chafik that uses a few opensource projects..
+ * For help, please visit NativeLibs4Java , Rococoa, or JNA. + */ +public class CANJNI extends JNIWrapper{ + //public static final String JNA_LIBRARY_NAME = LibraryExtractor.getLibraryPath("CAN", true, CANLibrary.class); + //public static final NativeLibrary JNA_NATIVE_LIB = NativeLibrary.getInstance(CANLibrary.JNA_LIBRARY_NAME, MangledFunctionMapper.DEFAULT_OPTIONS); + //static { + // System.loadLibrary("JNIWrappers"); + //Native.register(CANLibrary.class, CANLibrary.JNA_NATIVE_LIB); + //} + /** native declaration : src\main\include\CAN\can_proto.h */ + public static final int LM_STATUS_LIMIT_REV = 0x02; + /** native declaration : src\main\include\CAN\can_proto.h */ + public static final int LM_API_CFG_MAX_VOUT = ((0x00020000 | 0x02000000 | 0x00001c00) | (7 << 6)); + /** native declaration : src\main\include\CAN\can_proto.h */ + public static final int LM_PSTAT_CANERR_B0 = 30; + /** native declaration : src\main\include\CAN\can_proto.h */ + public static final int LM_API_SPD_DIS = ((0x00020000 | 0x02000000 | 0x00000400) | (1 << 6)); + /** native declaration : src\main\include\CAN\can_proto.h */ + public static final int CAN_MSGID_DTYPE_ACCEL = 0x05000000; + /** native declaration : src\main\include\CAN\can_proto.h */ + public static final int LM_API_STATUS_FAULT = ((0x00020000 | 0x02000000 | 0x00001400) | (7 << 6)); + /** native declaration : src\main\include\CAN\can_proto.h */ + public static final int CAN_MSGID_API_FIRMVER = 0x00000200; + /** native declaration : src\main\include\CAN\can_proto.h */ + public static final int LM_API_ICTRL_EN = ((0x00020000 | 0x02000000 | 0x00001000) | (0 << 6)); + /** native declaration : src\main\include\CAN\can_proto.h */ + public static final int CAN_MSGID_API_ENUMERATE = 0x00000240; + /** native declaration : src\main\include\CAN\can_proto.h */ + public static final int LM_API_SPD_EN = ((0x00020000 | 0x02000000 | 0x00000400) | (0 << 6)); + /** native declaration : src\main\include\CAN\can_proto.h */ + public static final int LM_API_CFG_LIMIT_REV = ((0x00020000 | 0x02000000 | 0x00001c00) | (6 << 6)); + /** native declaration : src\main\include\CAN\can_proto.h */ + public static final int LM_PSTAT_POS_B2 = 11; + /** native declaration : src\main\include\CAN\can_proto.h */ + public static final int LM_PSTAT_POS_B3 = 12; + /** native declaration : src\main\include\CAN\can_proto.h */ + public static final int LM_API_VCOMP_EN = ((0x00020000 | 0x02000000 | 0x00000800) | (0 << 6)); + /** native declaration : src\main\include\CAN\can_proto.h */ + public static final int LM_PSTAT_POS_B0 = 9; + /** native declaration : src\main\include\CAN\can_proto.h */ + public static final int LM_PSTAT_POS_B1 = 10; + /** native declaration : src\main\include\CAN\can_proto.h */ + public static final int LM_API_HWVER = ((0x00020000 | 0x1f000000) | (5 << 6)); + /** native declaration : src\main\include\CAN\can_proto.h */ + public static final int LM_STATUS_FAULT_ILIMIT = 0x01; + /** native declaration : src\main\include\CAN\can_proto.h */ + public static final int LM_API_ICTRL_DC = ((0x00020000 | 0x02000000 | 0x00001000) | (5 << 6)); + /** native declaration : src\main\include\CAN\can_proto.h */ + public static final int LM_API_VOLT = (0x00020000 | 0x02000000 | 0x00000000); + /** native declaration : src\main\include\CAN\can_proto.h */ + public static final int CAN_API_MC_VCOMP = 0x00000800; + /** native declaration : src\main\include\CAN\can_proto.h */ + public static final int LM_PSTAT_END = 0; + /** native declaration : src\main\include\CAN\can_proto.h */ + public static final int LM_API_CFG_LIMIT_FWD = ((0x00020000 | 0x02000000 | 0x00001c00) | (5 << 6)); + /** native declaration : src\main\include\CAN\can_proto.h */ + public static final int CAN_MSGID_DTYPE_M = 0x1f000000; + /** native declaration : src\main\include\CAN\can_proto.h */ + public static final int CAN_API_MC_ICTRL = 0x00001000; + /** native declaration : src\main\include\CAN\can_proto.h */ + public static final int CAN_API_MC_CFG = 0x00001c00; + /** native declaration : src\main\include\CAN\can_proto.h */ + public static final int CAN_MSGID_MFR_DEKA = 0x00030000; + /** native declaration : src\main\include\CAN\can_proto.h */ + public static final int CAN_MSGID_API_SYSRST = 0x00000040; + /** native declaration : src\main\include\CAN\can_proto.h */ + public static final int LM_REF_QUAD_ENCODER = 0x03; + /** native declaration : src\main\include\CAN\can_proto.h */ + public static final int LM_API_SYNC_PEND_NOW = 0; + /** native declaration : src\main\include\CAN\can_proto.h */ + public static final int LM_STATUS_CMODE_CURRENT = 0x01; + /** native declaration : src\main\include\CAN\can_proto.h */ + public static final int LM_API_STATUS_TEMP = ((0x00020000 | 0x02000000 | 0x00001400) | (3 << 6)); + /** native declaration : src\main\include\CAN\can_proto.h */ + public static final int LM_API_SPD_DC = ((0x00020000 | 0x02000000 | 0x00000400) | (5 << 6)); + /** native declaration : src\main\include\CAN\can_proto.h */ + public static final int CAN_API_MC_POS = 0x00000c00; + /** native declaration : src\main\include\CAN\can_proto.h */ + public static final int LM_STATUS_LIMIT_SFWD = 0x04; + /** native declaration : src\main\include\CAN\can_proto.h */ + public static final int LM_API_ICTRL_DIS = ((0x00020000 | 0x02000000 | 0x00001000) | (1 << 6)); + /** native declaration : src\main\include\CAN\can_proto.h */ + public static final int LM_API_VOLT_SET = ((0x00020000 | 0x02000000 | 0x00000000) | (2 << 6)); + /** native declaration : src\main\include\CAN\can_proto.h */ + public static final int CAN_MSGID_API_HEARTBEAT = 0x00000140; + /** native declaration : src\main\include\CAN\can_proto.h */ + public static final int LM_FAULT_CURRENT = 0x01; + /** native declaration : src\main\include\CAN\can_proto.h */ + public static final int CAN_MSGID_DTYPE_GYRO = 0x04000000; + /** native declaration : src\main\include\CAN\can_proto.h */ + public static final int LM_STATUS_FAULT_TLIMIT = 0x02; + /** native declaration : src\main\include\CAN\can_proto.h */ + public static final int CAN_MSGID_MFR_S = 16; + /** native declaration : src\main\include\CAN\can_proto.h */ + public static final int LM_API_SPD_T_SET_NO_ACK = ((0x00020000 | 0x02000000 | 0x00000400) | (10 << 6)); + /** native declaration : src\main\include\CAN\can_proto.h */ + public static final int CAN_MSGID_MFR_M = 0x00ff0000; + /** native declaration : src\main\include\CAN\can_proto.h */ + public static final int LM_STATUS_CMODE_POS = 0x03; + /** native declaration : src\main\include\CAN\can_proto.h */ + public static final int LM_REF_POT = 0x01; + /** native declaration : src\main\include\CAN\can_proto.h */ + public static final int LM_HWVER_UNKNOWN = 0x00; + /** native declaration : src\main\include\CAN\can_proto.h */ + public static final int LM_API_CFG_BRAKE_COAST = ((0x00020000 | 0x02000000 | 0x00001c00) | (3 << 6)); + /** native declaration : src\main\include\CAN\can_proto.h */ + public static final int LM_HWVER_JAG_1_0 = 0x01; + /** native declaration : src\main\include\CAN\can_proto.h */ + public static final int CAN_MSGID_DEVNO_BCAST = 0x00000000; + /** native declaration : src\main\include\CAN\can_proto.h */ + public static final int LM_API_VOLT_T_SET = ((0x00020000 | 0x02000000 | 0x00000000) | (5 << 6)); + /** native declaration : src\main\include\CAN\can_proto.h */ + public static final int LM_STATUS_LIMIT_STKY_SREV = 0x80; + /** native declaration : src\main\include\CAN\can_proto.h */ + public static final int LM_API_ICTRL_IC = ((0x00020000 | 0x02000000 | 0x00001000) | (4 << 6)); + /** native declaration : src\main\include\CAN\can_proto.h */ + public static final int LM_FAULT_COMM = 0x10; + /** native declaration : src\main\include\CAN\can_proto.h */ + public static final int LM_API_ICTRL_T_SET_NO_ACK = ((0x00020000 | 0x02000000 | 0x00001000) | (9 << 6)); + /** native declaration : src\main\include\CAN\can_proto.h */ + public static final int LM_PSTAT_SPD_B2 = 15; + /** native declaration : src\main\include\CAN\can_proto.h */ + public static final int LM_PSTAT_SPD_B1 = 14; + /** native declaration : src\main\include\CAN\can_proto.h */ + public static final int LM_PSTAT_STKY_FLT_CLR = 21; + /** native declaration : src\main\include\CAN\can_proto.h */ + public static final int LM_PSTAT_SPD_B3 = 16; + /** native declaration : src\main\include\CAN\can_proto.h */ + public static final int CAN_STATUS_MFG_S = 16; + /** native declaration : src\main\include\CAN\can_proto.h */ + public static final int LM_API_SPD_SET_NO_ACK = ((0x00020000 | 0x02000000 | 0x00000400) | (11 << 6)); + /** native declaration : src\main\include\CAN\can_proto.h */ + public static final int LM_API_STATUS_LIMIT = ((0x00020000 | 0x02000000 | 0x00001400) | (6 << 6)); + /** native declaration : src\main\include\CAN\can_proto.h */ + public static final int LM_API_VOLT_EN = ((0x00020000 | 0x02000000 | 0x00000000) | (0 << 6)); + /** native declaration : src\main\include\CAN\can_proto.h */ + public static final int LM_API_VOLT_RAMP_DIS = 0; + /** native declaration : src\main\include\CAN\can_proto.h */ + public static final int LM_PSTAT_TEMP_B0 = 7; + /** native declaration : src\main\include\CAN\can_proto.h */ + public static final int LM_PSTAT_TEMP_B1 = 8; + /** native declaration : src\main\include\CAN\can_proto.h */ + public static final int LM_API_POS_IC = ((0x00020000 | 0x02000000 | 0x00000c00) | (4 << 6)); + /** native declaration : src\main\include\CAN\can_proto.h */ + public static final int CAN_MSGID_DTYPE_MOTOR = 0x02000000; + /** native declaration : src\main\include\CAN\can_proto.h */ + public static final int LM_API_SPD_T_EN = ((0x00020000 | 0x02000000 | 0x00000400) | (7 << 6)); + /** native declaration : src\main\include\CAN\can_proto.h */ + public static final int CAN_MSGID_DEVNO_M = 0x0000003f; + /** native declaration : src\main\include\CAN\can_proto.h */ + public static final int LM_PSTAT_VOLTBUS_B1 = 4; + /** native declaration : src\main\include\CAN\can_proto.h */ + public static final int LM_API_UPD_PING = ((0x00020000 | 0x1f000000) | (0 << 6)); + /** native declaration : src\main\include\CAN\can_proto.h */ + public static final int LM_API_POS_T_SET_NO_ACK = ((0x00020000 | 0x02000000 | 0x00000c00) | (10 << 6)); + /** native declaration : src\main\include\CAN\can_proto.h */ + public static final int CAN_MSGID_DEVNO_S = 0; + /** native declaration : src\main\include\CAN\can_proto.h */ + public static final int LM_API_TRUST_HEARTBEAT = ((0x00020000 | 0x1f000000) | (13 << 6)); + /** native declaration : src\main\include\CAN\can_proto.h */ + public static final int LM_PSTAT_VOLTBUS_B0 = 3; + /** native declaration : src\main\include\CAN\can_proto.h */ + public static final int LM_PSTAT_SPD_B0 = 13; + /** native declaration : src\main\include\CAN\can_proto.h */ + public static final int LM_API_CFG = (0x00020000 | 0x02000000 | 0x00001c00); + /** native declaration : src\main\include\CAN\can_proto.h */ + public static final int LM_PSTAT_FLT_COUNT_COMM = 28; + /** native declaration : src\main\include\CAN\can_proto.h */ + public static final int CAN_MSGID_API_SYSHALT = 0x00000000; + /** native declaration : src\main\include\CAN\can_proto.h */ + public static final int LM_API_UPD_DOWNLOAD = ((0x00020000 | 0x1f000000) | (1 << 6)); + /** native declaration : src\main\include\CAN\can_proto.h */ + public static final int LM_API_STATUS_CMODE = ((0x00020000 | 0x02000000 | 0x00001400) | (9 << 6)); + /** native declaration : src\main\include\CAN\can_proto.h */ + public static final int LM_API_VCOMP_IN_RAMP = ((0x00020000 | 0x02000000 | 0x00000800) | (3 << 6)); + /** native declaration : src\main\include\CAN\can_proto.h */ + public static final int LM_STATUS_FAULT_VLIMIT = 0x04; + /** native declaration : src\main\include\CAN\can_proto.h */ + public static final int LM_STATUS_LIMIT_SREV = 0x08; + /** native declaration : src\main\include\CAN\can_proto.h */ + public static final int CAN_MSGID_DTYPE_S = 24; + /** native declaration : src\main\include\CAN\can_proto.h */ + public static final int LM_PSTAT_FLT_COUNT_VOLTBUS = 26; + /** native declaration : src\main\include\CAN\can_proto.h */ + public static final int CAN_API_MC_STATUS = 0x00001400; + /** native declaration : src\main\include\CAN\can_proto.h */ + public static final int LM_API_VOLT_T_EN = ((0x00020000 | 0x02000000 | 0x00000000) | (4 << 6)); + /** native declaration : src\main\include\CAN\can_proto.h */ + public static final int LM_API_STATUS_VOLTBUS = ((0x00020000 | 0x02000000 | 0x00001400) | (1 << 6)); + /** native declaration : src\main\include\CAN\can_proto.h */ + public static final int LM_API_UPD = (0x00020000 | 0x1f000000); + /** native declaration : src\main\include\CAN\can_proto.h */ + public static final int LM_API_UPD_REQUEST = ((0x00020000 | 0x1f000000) | (6 << 6)); + /** native declaration : src\main\include\CAN\can_proto.h */ + public static final int CAN_API_MC_VOLTAGE = 0x00000000; + /** native declaration : src\main\include\CAN\can_proto.h */ + public static final int LM_API_PSTAT_PER_EN_S3 = ((0x00020000 | 0x02000000 | 0x00001800) | (3 << 6)); + /** native declaration : src\main\include\CAN\can_proto.h */ + public static final int LM_API_PSTAT_PER_EN_S2 = ((0x00020000 | 0x02000000 | 0x00001800) | (2 << 6)); + /** native declaration : src\main\include\CAN\can_proto.h */ + public static final int CAN_API_MC_PSTAT = 0x00001800; + /** native declaration : src\main\include\CAN\can_proto.h */ + public static final int LM_PSTAT_CANERR_B1 = 31; + /** native declaration : src\main\include\CAN\can_proto.h */ + public static final int LM_API_PSTAT_PER_EN_S1 = ((0x00020000 | 0x02000000 | 0x00001800) | (1 << 6)); + /** native declaration : src\main\include\CAN\can_proto.h */ + public static final int LM_REF_ENCODER = 0x00; + /** native declaration : src\main\include\CAN\can_proto.h */ + public static final int LM_API_PSTAT_PER_EN_S0 = ((0x00020000 | 0x02000000 | 0x00001800) | (0 << 6)); + /** native declaration : src\main\include\CAN\can_proto.h */ + public static final int LM_API_STATUS_CURRENT = ((0x00020000 | 0x02000000 | 0x00001400) | (2 << 6)); + /** native declaration : src\main\include\CAN\can_proto.h */ + public static final int LM_API_POS_SET = ((0x00020000 | 0x02000000 | 0x00000c00) | (2 << 6)); + /** native declaration : src\main\include\CAN\can_proto.h */ + public static final int LM_STATUS_LIMIT_STKY_FWD = 0x10; + /** native declaration : src\main\include\CAN\can_proto.h */ + public static final int LM_API_ICTRL = (0x00020000 | 0x02000000 | 0x00001000); + /** native declaration : src\main\include\CAN\can_proto.h */ + public static final int LM_HWVER_JAG_2_0 = 0x02; + /** native declaration : src\main\include\CAN\can_proto.h */ + public static final int CAN_STATUS_MFG_M = 0x00ff0000; + /** native declaration : src\main\include\CAN\can_proto.h */ + public static final int LM_PSTAT_LIMIT_CLR = 18; + /** native declaration : src\main\include\CAN\can_proto.h */ + public static final int LM_API_CFG_POT_TURNS = ((0x00020000 | 0x02000000 | 0x00001c00) | (2 << 6)); + /** native declaration : src\main\include\CAN\can_proto.h */ + public static final int LM_API_POS_REF = ((0x00020000 | 0x02000000 | 0x00000c00) | (6 << 6)); + /** native declaration : src\main\include\CAN\can_proto.h */ + public static final int LM_API_SPD_PC = ((0x00020000 | 0x02000000 | 0x00000400) | (3 << 6)); + /** native declaration : src\main\include\CAN\can_proto.h */ + public static final int LM_API_STATUS_VOUT = ((0x00020000 | 0x02000000 | 0x00001400) | (10 << 6)); + /** native declaration : src\main\include\CAN\can_proto.h */ + public static final int CAN_MSGID_API_SYSRESUME = 0x00000280; + /** native declaration : src\main\include\CAN\can_proto.h */ + public static final int LM_API_UNTRUST_EN = ((0x00020000 | 0x1f000000) | (11 << 6)); + /** native declaration : src\main\include\CAN\can_proto.h */ + public static final int LM_PSTAT_CANSTS = 29; + /** native declaration : src\main\include\CAN\can_proto.h */ + public static final int LM_API_POS_DC = ((0x00020000 | 0x02000000 | 0x00000c00) | (5 << 6)); + /** native declaration : src\main\include\CAN\can_proto.h */ + public static final int LM_API_STATUS_POS = ((0x00020000 | 0x02000000 | 0x00001400) | (4 << 6)); + /** native declaration : src\main\include\CAN\can_proto.h */ + public static final int LM_API_SPD_SET = ((0x00020000 | 0x02000000 | 0x00000400) | (2 << 6)); + /** native declaration : src\main\include\CAN\can_proto.h */ + public static final int CAN_MSGID_FULL_M = 0x1fffffff; + /** native declaration : src\main\include\CAN\can_proto.h */ + public static final int LM_API_STATUS_SPD = ((0x00020000 | 0x02000000 | 0x00001400) | (5 << 6)); + /** native declaration : src\main\include\CAN\can_proto.h */ + public static final int LM_PSTAT_STKY_FLT_NCLR = 20; + /** native declaration : src\main\include\CAN\can_proto.h */ + public static final int LM_API_STATUS = (0x00020000 | 0x02000000 | 0x00001400); + /** native declaration : src\main\include\CAN\can_proto.h */ + public static final int LM_API_TRUST_EN = ((0x00020000 | 0x1f000000) | (12 << 6)); + /** native declaration : src\main\include\CAN\can_proto.h */ + public static final int LM_API_ICTRL_T_SET = ((0x00020000 | 0x02000000 | 0x00001000) | (7 << 6)); + /** native declaration : src\main\include\CAN\can_proto.h */ + public static final int CAN_STATUS_CODE_M = 0x0000ffff; + /** native declaration : src\main\include\CAN\can_proto.h */ + public static final int CAN_STATUS_CODE_S = 0; + /** native declaration : src\main\include\CAN\can_proto.h */ + public static final int LM_API_POS_T_EN = ((0x00020000 | 0x02000000 | 0x00000c00) | (7 << 6)); + /** native declaration : src\main\include\CAN\can_proto.h */ + public static final int LM_API_PSTAT = (0x00020000 | 0x02000000 | 0x00001800); + /** native declaration : src\main\include\CAN\can_proto.h */ + public static final int LM_PSTAT_FAULT = 19; + /** native declaration : src\main\include\CAN\can_proto.h */ + public static final int LM_PSTAT_FLT_COUNT_GATE = 27; + /** native declaration : src\main\include\CAN\can_proto.h */ + public static final int LM_API_ICTRL_T_EN = ((0x00020000 | 0x02000000 | 0x00001000) | (6 << 6)); + /** native declaration : src\main\include\CAN\can_proto.h */ + public static final int CAN_MSGID_API_DEVQUERY = 0x000000c0; + /** native declaration : src\main\include\CAN\can_proto.h */ + public static final int CAN_MSGID_DTYPE_USONIC = 0x06000000; + /** native declaration : src\main\include\CAN\can_proto.h */ + public static final int LM_STATUS_CMODE_VCOMP = 0x04; + /** native declaration : src\main\include\CAN\can_proto.h */ + public static final int LM_API_SPD_T_SET = ((0x00020000 | 0x02000000 | 0x00000400) | (8 << 6)); + /** native declaration : src\main\include\CAN\can_proto.h */ + public static final int LM_API_POS_EN = ((0x00020000 | 0x02000000 | 0x00000c00) | (0 << 6)); + /** native declaration : src\main\include\CAN\can_proto.h */ + public static final int LM_API_VOLT_DIS = ((0x00020000 | 0x02000000 | 0x00000000) | (1 << 6)); + /** native declaration : src\main\include\CAN\can_proto.h */ + public static final int LM_STATUS_LIMIT_FWD = 0x01; + /** native declaration : src\main\include\CAN\can_proto.h */ + public static final int LM_API_VCOMP_DIS = ((0x00020000 | 0x02000000 | 0x00000800) | (1 << 6)); + /** native declaration : src\main\include\CAN\can_proto.h */ + public static final int LM_REF_INV_ENCODER = 0x02; + /** native declaration : src\main\include\CAN\can_proto.h */ + public static final int LM_API_CFG_NUM_BRUSHES = ((0x00020000 | 0x02000000 | 0x00001c00) | (0 << 6)); + /** native declaration : src\main\include\CAN\can_proto.h */ + public static final int CAN_MSGID_DTYPE_RELAY = 0x03000000; + /** native declaration : src\main\include\CAN\can_proto.h */ + public static final int CAN_MSGID_API_DEVASSIGN = 0x00000080; + /** native declaration : src\main\include\CAN\can_proto.h */ + public static final int LM_API_VOLT_T_SET_NO_ACK = ((0x00020000 | 0x02000000 | 0x00000000) | (7 << 6)); + /** native declaration : src\main\include\CAN\can_proto.h */ + public static final int CAN_API_MC_SPD = 0x00000400; + /** native declaration : src\main\include\CAN\can_proto.h */ + public static final int LM_API_CFG_ENC_LINES = ((0x00020000 | 0x02000000 | 0x00001c00) | (1 << 6)); + /** native declaration : src\main\include\CAN\can_proto.h */ + public static final int LM_REF_NONE = 0xff; + /** native declaration : src\main\include\CAN\can_proto.h */ + public static final int LM_FAULT_VBUS = 0x04; + /** native declaration : src\main\include\CAN\can_proto.h */ + public static final int LM_API_VOLT_SET_RAMP = ((0x00020000 | 0x02000000 | 0x00000000) | (3 << 6)); + /** native declaration : src\main\include\CAN\can_proto.h */ + public static final int LM_API_SPD_REF = ((0x00020000 | 0x02000000 | 0x00000400) | (6 << 6)); + /** native declaration : src\main\include\CAN\can_proto.h */ + public static final int LM_API_STATUS_POWER = ((0x00020000 | 0x02000000 | 0x00001400) | (8 << 6)); + /** native declaration : src\main\include\CAN\can_proto.h */ + public static final int LM_PSTAT_VOLTOUT_B1 = 2; + /** native declaration : src\main\include\CAN\can_proto.h */ + public static final int LM_API_VCOMP_SET_NO_ACK = ((0x00020000 | 0x02000000 | 0x00000800) | (9 << 6)); + /** native declaration : src\main\include\CAN\can_proto.h */ + public static final int LM_PSTAT_VOLTOUT_B0 = 1; + /** native declaration : src\main\include\CAN\can_proto.h */ + public static final int LM_API_CFG_LIMIT_MODE = ((0x00020000 | 0x02000000 | 0x00001c00) | (4 << 6)); + /** native declaration : src\main\include\CAN\can_proto.h */ + public static final int LM_PSTAT_VOUT_B1 = 23; + /** native declaration : src\main\include\CAN\can_proto.h */ + public static final int LM_API_UPD_SEND_DATA = ((0x00020000 | 0x1f000000) | (2 << 6)); + /** native declaration : src\main\include\CAN\can_proto.h */ + public static final int LM_PSTAT_FLT_COUNT_CURRENT = 24; + /** native declaration : src\main\include\CAN\can_proto.h */ + public static final int LM_PSTAT_VOUT_B0 = 22; + /** native declaration : src\main\include\CAN\can_proto.h */ + public static final int LM_API_PSTAT_CFG_S0 = ((0x00020000 | 0x02000000 | 0x00001800) | (4 << 6)); + /** native declaration : src\main\include\CAN\can_proto.h */ + public static final int LM_PSTAT_LIMIT_NCLR = 17; + /** native declaration : src\main\include\CAN\can_proto.h */ + public static final int LM_API_PSTAT_CFG_S1 = ((0x00020000 | 0x02000000 | 0x00001800) | (5 << 6)); + /** native declaration : src\main\include\CAN\can_proto.h */ + public static final int LM_API_PSTAT_CFG_S2 = ((0x00020000 | 0x02000000 | 0x00001800) | (6 << 6)); + /** native declaration : src\main\include\CAN\can_proto.h */ + public static final int LM_API_PSTAT_CFG_S3 = ((0x00020000 | 0x02000000 | 0x00001800) | (7 << 6)); + /** native declaration : src\main\include\CAN\can_proto.h */ + public static final int LM_API_VCOMP_SET = ((0x00020000 | 0x02000000 | 0x00000800) | (2 << 6)); + /** native declaration : src\main\include\CAN\can_proto.h */ + public static final int CAN_MSGID_API_UPDATE = 0x000001c0; + /** native declaration : src\main\include\CAN\can_proto.h */ + public static final int LM_API_CFG_FAULT_TIME = ((0x00020000 | 0x02000000 | 0x00001c00) | (8 << 6)); + /** native declaration : src\main\include\CAN\can_proto.h */ + public static final int LM_API_STATUS_VOLTOUT = ((0x00020000 | 0x02000000 | 0x00001400) | (0 << 6)); + /** native declaration : src\main\include\CAN\can_proto.h */ + public static final int LM_API_ICTRL_SET = ((0x00020000 | 0x02000000 | 0x00001000) | (2 << 6)); + /** native declaration : src\main\include\CAN\can_proto.h */ + public static final int CAN_MSGID_API_M = 0x0000ffc0; + /** native declaration : src\main\include\CAN\can_proto.h */ + public static final int LM_STATUS_CMODE_SPEED = 0x02; + /** native declaration : src\main\include\CAN\can_proto.h */ + public static final int CAN_MSGID_API_CLASS_M = 0x0000fc00; + /** native declaration : src\main\include\CAN\can_proto.h */ + public static final int LM_API_PSTAT_DATA_S3 = ((0x00020000 | 0x02000000 | 0x00001800) | (11 << 6)); + /** native declaration : src\main\include\CAN\can_proto.h */ + public static final int CAN_MSGID_API_S = 6; + /** native declaration : src\main\include\CAN\can_proto.h */ + public static final int LM_API_STATUS_FLT_COUNT = ((0x00020000 | 0x02000000 | 0x00001400) | (12 << 6)); + /** native declaration : src\main\include\CAN\can_proto.h */ + public static final int LM_API_PSTAT_DATA_S2 = ((0x00020000 | 0x02000000 | 0x00001800) | (10 << 6)); + /** native declaration : src\main\include\CAN\can_proto.h */ + public static final int LM_API_PSTAT_DATA_S1 = ((0x00020000 | 0x02000000 | 0x00001800) | (9 << 6)); + /** native declaration : src\main\include\CAN\can_proto.h */ + public static final int LM_API_PSTAT_DATA_S0 = ((0x00020000 | 0x02000000 | 0x00001800) | (8 << 6)); + /** native declaration : src\main\include\CAN\can_proto.h */ + public static final int LM_API_ICTRL_PC = ((0x00020000 | 0x02000000 | 0x00001000) | (3 << 6)); + /** native declaration : src\main\include\CAN\can_proto.h */ + public static final int LM_API_POS_PC = ((0x00020000 | 0x02000000 | 0x00000c00) | (3 << 6)); + /** native declaration : src\main\include\CAN\can_proto.h */ + public static final int CAN_MSGID_MFR_LM = 0x00020000; + /** native declaration : src\main\include\CAN\can_proto.h */ + public static final int LM_API_POS_DIS = ((0x00020000 | 0x02000000 | 0x00000c00) | (1 << 6)); + /** native declaration : src\main\include\CAN\can_proto.h */ + public static final int CAN_MSGID_DTYPE_BCAST = 0x00000000; + /** native declaration : src\main\include\CAN\can_proto.h */ + public static final int LM_STATUS_CMODE_VOLT = 0x00; + /** native declaration : src\main\include\CAN\can_proto.h */ + public static final int CAN_STATUS_DTYPE_S = 24; + /** native declaration : src\main\include\CAN\can_proto.h */ + public static final int LM_API_POS_SET_NO_ACK = ((0x00020000 | 0x02000000 | 0x00000c00) | (11 << 6)); + /** native declaration : src\main\include\CAN\can_proto.h */ + public static final int LM_FAULT_GATE_DRIVE = 0x08; + /** native declaration : src\main\include\CAN\can_proto.h */ + public static final int CAN_STATUS_DTYPE_M = 0x1f000000; + /** native declaration : src\main\include\CAN\can_proto.h */ + public static final int LM_STATUS_LIMIT_STKY_REV = 0x20; + /** native declaration : src\main\include\CAN\can_proto.h */ + public static final int CAN_MSGID_DTYPE_ROBOT = 0x01000000; + /** native declaration : src\main\include\CAN\can_proto.h */ + public static final int CAN_API_MC_ACK = 0x00002000; + /** native declaration : src\main\include\CAN\can_proto.h */ + public static final int LM_API_VCOMP = (0x00020000 | 0x02000000 | 0x00000800); + /** native declaration : src\main\include\CAN\can_proto.h */ + public static final int LM_API_UPD_ACK = ((0x00020000 | 0x1f000000) | (4 << 6)); + /** native declaration : src\main\include\CAN\can_proto.h */ + public static final int LM_API_VCOMP_COMP_RAMP = ((0x00020000 | 0x02000000 | 0x00000800) | (4 << 6)); + /** native declaration : src\main\include\CAN\can_proto.h */ + public static final int LM_API_VCOMP_T_SET_NO_ACK = ((0x00020000 | 0x02000000 | 0x00000800) | (8 << 6)); + /** native declaration : src\main\include\CAN\can_proto.h */ + public static final int LM_API_POS = (0x00020000 | 0x02000000 | 0x00000c00); + /** native declaration : src\main\include\CAN\can_proto.h */ + public static final int CAN_MSGID_API_SYNC = 0x00000180; + /** native declaration : src\main\include\CAN\can_proto.h */ + public static final int LM_API_ICTRL_SET_NO_ACK = ((0x00020000 | 0x02000000 | 0x00001000) | (10 << 6)); + /** native declaration : src\main\include\CAN\can_proto.h */ + public static final int LM_PSTAT_CURRENT_B1 = 6; + /** native declaration : src\main\include\CAN\can_proto.h */ + public static final int LM_API_SPD = (0x00020000 | 0x02000000 | 0x00000400); + /** native declaration : src\main\include\CAN\can_proto.h */ + public static final int LM_PSTAT_CURRENT_B0 = 5; + /** native declaration : src\main\include\CAN\can_proto.h */ + public static final int CAN_MSGID_DTYPE_UPDATE = 0x1f000000; + /** native declaration : src\main\include\CAN\can_proto.h */ + public static final int LM_API_SPD_IC = ((0x00020000 | 0x02000000 | 0x00000400) | (4 << 6)); + /** native declaration : src\main\include\CAN\can_proto.h */ + public static final int LM_API_ACK = (0x00020000 | 0x02000000 | 0x00002000); + /** native declaration : src\main\include\CAN\can_proto.h */ + public static final int LM_FAULT_TEMP = 0x02; + /** native declaration : src\main\include\CAN\can_proto.h */ + public static final int LM_API_VCOMP_T_SET = ((0x00020000 | 0x02000000 | 0x00000800) | (6 << 6)); + /** native declaration : src\main\include\CAN\can_proto.h */ + public static final int LM_PSTAT_FLT_COUNT_TEMP = 25; + /** native declaration : src\main\include\CAN\can_proto.h */ + public static final int LM_API_VOLT_SET_NO_ACK = ((0x00020000 | 0x02000000 | 0x00000000) | (8 << 6)); + /** native declaration : src\main\include\CAN\can_proto.h */ + public static final int CAN_MSGID_DTYPE_GEART = 0x07000000; + /** native declaration : src\main\include\CAN\can_proto.h */ + public static final int CAN_MSGID_MFR_NI = 0x00010000; + /** native declaration : src\main\include\CAN\can_proto.h */ + public static final int LM_API_POS_T_SET = ((0x00020000 | 0x02000000 | 0x00000c00) | (8 << 6)); + /** native declaration : src\main\include\CAN\can_proto.h */ + public static final int LM_API_STATUS_STKY_FLT = ((0x00020000 | 0x02000000 | 0x00001400) | (11 << 6)); + /** native declaration : src\main\include\CAN\can_proto.h */ + public static final int LM_API_UPD_RESET = ((0x00020000 | 0x1f000000) | (3 << 6)); + /** native declaration : src\main\include\CAN\can_proto.h */ + public static final int CAN_MSGID_API_ID_M = 0x000003c0; + /** native declaration : src\main\include\CAN\can_proto.h */ + public static final int LM_API_VCOMP_T_EN = ((0x00020000 | 0x02000000 | 0x00000800) | (5 << 6)); + /** native declaration : src\main\include\CAN\can_proto.h */ + public static final int LM_STATUS_LIMIT_STKY_SFWD = 0x40; + + public static native void FRCNetworkCommunicationJaguarCANDriverSendMessage(int messageID, ByteBuffer data, IntBuffer status); + public static native ByteBuffer FRCNetworkCommunicationJaguarCANDriverReceiveMessage(IntBuffer messageID, int timeoutMs, IntBuffer status); +} diff --git a/wpilibj/src/main/java/edu/wpi/first/wpilibj/can/CANJaguarVersionException.java b/wpilibj/wpilibJava/src/main/java/edu/wpi/first/wpilibj/can/CANJaguarVersionException.java similarity index 100% rename from wpilibj/src/main/java/edu/wpi/first/wpilibj/can/CANJaguarVersionException.java rename to wpilibj/wpilibJava/src/main/java/edu/wpi/first/wpilibj/can/CANJaguarVersionException.java diff --git a/wpilibj/src/main/java/edu/wpi/first/wpilibj/can/CANMessageNotAllowedException.java b/wpilibj/wpilibJava/src/main/java/edu/wpi/first/wpilibj/can/CANMessageNotAllowedException.java similarity index 100% rename from wpilibj/src/main/java/edu/wpi/first/wpilibj/can/CANMessageNotAllowedException.java rename to wpilibj/wpilibJava/src/main/java/edu/wpi/first/wpilibj/can/CANMessageNotAllowedException.java diff --git a/wpilibj/src/main/java/edu/wpi/first/wpilibj/can/CANNotInitializedException.java b/wpilibj/wpilibJava/src/main/java/edu/wpi/first/wpilibj/can/CANNotInitializedException.java similarity index 100% rename from wpilibj/src/main/java/edu/wpi/first/wpilibj/can/CANNotInitializedException.java rename to wpilibj/wpilibJava/src/main/java/edu/wpi/first/wpilibj/can/CANNotInitializedException.java diff --git a/wpilibj/src/main/java/edu/wpi/first/wpilibj/can/CANTimeoutException.java b/wpilibj/wpilibJava/src/main/java/edu/wpi/first/wpilibj/can/CANTimeoutException.java similarity index 90% rename from wpilibj/src/main/java/edu/wpi/first/wpilibj/can/CANTimeoutException.java rename to wpilibj/wpilibJava/src/main/java/edu/wpi/first/wpilibj/can/CANTimeoutException.java index fbf94e91ef..c6a605430c 100644 --- a/wpilibj/src/main/java/edu/wpi/first/wpilibj/can/CANTimeoutException.java +++ b/wpilibj/wpilibJava/src/main/java/edu/wpi/first/wpilibj/can/CANTimeoutException.java @@ -17,4 +17,7 @@ public class CANTimeoutException extends IOException { public CANTimeoutException() { super(); } + public CANTimeoutException(String message) { + super(message); + } } diff --git a/wpilibj/src/main/java/edu/wpi/first/wpilibj/command/Command.java b/wpilibj/wpilibJava/src/main/java/edu/wpi/first/wpilibj/command/Command.java similarity index 100% rename from wpilibj/src/main/java/edu/wpi/first/wpilibj/command/Command.java rename to wpilibj/wpilibJava/src/main/java/edu/wpi/first/wpilibj/command/Command.java diff --git a/wpilibj/src/main/java/edu/wpi/first/wpilibj/command/CommandGroup.java b/wpilibj/wpilibJava/src/main/java/edu/wpi/first/wpilibj/command/CommandGroup.java similarity index 100% rename from wpilibj/src/main/java/edu/wpi/first/wpilibj/command/CommandGroup.java rename to wpilibj/wpilibJava/src/main/java/edu/wpi/first/wpilibj/command/CommandGroup.java diff --git a/wpilibj/src/main/java/edu/wpi/first/wpilibj/command/IllegalUseOfCommandException.java b/wpilibj/wpilibJava/src/main/java/edu/wpi/first/wpilibj/command/IllegalUseOfCommandException.java similarity index 100% rename from wpilibj/src/main/java/edu/wpi/first/wpilibj/command/IllegalUseOfCommandException.java rename to wpilibj/wpilibJava/src/main/java/edu/wpi/first/wpilibj/command/IllegalUseOfCommandException.java diff --git a/wpilibj/src/main/java/edu/wpi/first/wpilibj/command/LinkedListElement.java b/wpilibj/wpilibJava/src/main/java/edu/wpi/first/wpilibj/command/LinkedListElement.java similarity index 100% rename from wpilibj/src/main/java/edu/wpi/first/wpilibj/command/LinkedListElement.java rename to wpilibj/wpilibJava/src/main/java/edu/wpi/first/wpilibj/command/LinkedListElement.java diff --git a/wpilibj/src/main/java/edu/wpi/first/wpilibj/command/PIDCommand.java b/wpilibj/wpilibJava/src/main/java/edu/wpi/first/wpilibj/command/PIDCommand.java similarity index 100% rename from wpilibj/src/main/java/edu/wpi/first/wpilibj/command/PIDCommand.java rename to wpilibj/wpilibJava/src/main/java/edu/wpi/first/wpilibj/command/PIDCommand.java diff --git a/wpilibj/src/main/java/edu/wpi/first/wpilibj/command/PIDSubsystem.java b/wpilibj/wpilibJava/src/main/java/edu/wpi/first/wpilibj/command/PIDSubsystem.java similarity index 100% rename from wpilibj/src/main/java/edu/wpi/first/wpilibj/command/PIDSubsystem.java rename to wpilibj/wpilibJava/src/main/java/edu/wpi/first/wpilibj/command/PIDSubsystem.java diff --git a/wpilibj/src/main/java/edu/wpi/first/wpilibj/command/PrintCommand.java b/wpilibj/wpilibJava/src/main/java/edu/wpi/first/wpilibj/command/PrintCommand.java similarity index 100% rename from wpilibj/src/main/java/edu/wpi/first/wpilibj/command/PrintCommand.java rename to wpilibj/wpilibJava/src/main/java/edu/wpi/first/wpilibj/command/PrintCommand.java diff --git a/wpilibj/src/main/java/edu/wpi/first/wpilibj/command/Scheduler.java b/wpilibj/wpilibJava/src/main/java/edu/wpi/first/wpilibj/command/Scheduler.java similarity index 100% rename from wpilibj/src/main/java/edu/wpi/first/wpilibj/command/Scheduler.java rename to wpilibj/wpilibJava/src/main/java/edu/wpi/first/wpilibj/command/Scheduler.java diff --git a/wpilibj/src/main/java/edu/wpi/first/wpilibj/command/Set.java b/wpilibj/wpilibJava/src/main/java/edu/wpi/first/wpilibj/command/Set.java similarity index 100% rename from wpilibj/src/main/java/edu/wpi/first/wpilibj/command/Set.java rename to wpilibj/wpilibJava/src/main/java/edu/wpi/first/wpilibj/command/Set.java diff --git a/wpilibj/src/main/java/edu/wpi/first/wpilibj/command/StartCommand.java b/wpilibj/wpilibJava/src/main/java/edu/wpi/first/wpilibj/command/StartCommand.java similarity index 100% rename from wpilibj/src/main/java/edu/wpi/first/wpilibj/command/StartCommand.java rename to wpilibj/wpilibJava/src/main/java/edu/wpi/first/wpilibj/command/StartCommand.java diff --git a/wpilibj/src/main/java/edu/wpi/first/wpilibj/command/Subsystem.java b/wpilibj/wpilibJava/src/main/java/edu/wpi/first/wpilibj/command/Subsystem.java similarity index 100% rename from wpilibj/src/main/java/edu/wpi/first/wpilibj/command/Subsystem.java rename to wpilibj/wpilibJava/src/main/java/edu/wpi/first/wpilibj/command/Subsystem.java diff --git a/wpilibj/src/main/java/edu/wpi/first/wpilibj/command/WaitCommand.java b/wpilibj/wpilibJava/src/main/java/edu/wpi/first/wpilibj/command/WaitCommand.java similarity index 100% rename from wpilibj/src/main/java/edu/wpi/first/wpilibj/command/WaitCommand.java rename to wpilibj/wpilibJava/src/main/java/edu/wpi/first/wpilibj/command/WaitCommand.java diff --git a/wpilibj/src/main/java/edu/wpi/first/wpilibj/command/WaitForChildren.java b/wpilibj/wpilibJava/src/main/java/edu/wpi/first/wpilibj/command/WaitForChildren.java similarity index 100% rename from wpilibj/src/main/java/edu/wpi/first/wpilibj/command/WaitForChildren.java rename to wpilibj/wpilibJava/src/main/java/edu/wpi/first/wpilibj/command/WaitForChildren.java diff --git a/wpilibj/src/main/java/edu/wpi/first/wpilibj/command/WaitUntilCommand.java b/wpilibj/wpilibJava/src/main/java/edu/wpi/first/wpilibj/command/WaitUntilCommand.java similarity index 100% rename from wpilibj/src/main/java/edu/wpi/first/wpilibj/command/WaitUntilCommand.java rename to wpilibj/wpilibJava/src/main/java/edu/wpi/first/wpilibj/command/WaitUntilCommand.java diff --git a/wpilibj/src/main/java/edu/wpi/first/wpilibj/communication/FRCCommonControlData.java b/wpilibj/wpilibJava/src/main/java/edu/wpi/first/wpilibj/communication/FRCCommonControlData.java similarity index 100% rename from wpilibj/src/main/java/edu/wpi/first/wpilibj/communication/FRCCommonControlData.java rename to wpilibj/wpilibJava/src/main/java/edu/wpi/first/wpilibj/communication/FRCCommonControlData.java diff --git a/wpilibj/src/main/java/edu/wpi/first/wpilibj/communication/FRCCommonControlMasks.java b/wpilibj/wpilibJava/src/main/java/edu/wpi/first/wpilibj/communication/FRCCommonControlMasks.java similarity index 100% rename from wpilibj/src/main/java/edu/wpi/first/wpilibj/communication/FRCCommonControlMasks.java rename to wpilibj/wpilibJava/src/main/java/edu/wpi/first/wpilibj/communication/FRCCommonControlMasks.java diff --git a/wpilibj/wpilibJava/src/main/java/edu/wpi/first/wpilibj/communication/FRCNetworkCommunicationsLibrary.java b/wpilibj/wpilibJava/src/main/java/edu/wpi/first/wpilibj/communication/FRCNetworkCommunicationsLibrary.java new file mode 100644 index 0000000000..4cf383c4a3 --- /dev/null +++ b/wpilibj/wpilibJava/src/main/java/edu/wpi/first/wpilibj/communication/FRCNetworkCommunicationsLibrary.java @@ -0,0 +1,545 @@ +package edu.wpi.first.wpilibj.communication; + +import java.nio.ByteBuffer; +import java.nio.IntBuffer; +import java.nio.ShortBuffer; + +import edu.wpi.first.wpilibj.hal.JNIWrapper; +/** + * JNA Wrapper for library FRC_NetworkCommunications
+ * This file was autogenerated by JNAerator,
+ * a tool written by Olivier Chafik that uses a few opensource projects..
+ * For help, please visit NativeLibs4Java , Rococoa, or JNA. + */ +public class FRCNetworkCommunicationsLibrary extends JNIWrapper { + //public static final String JNA_LIBRARY_NAME = LibraryExtractor.getLibraryPath("FRC_NetworkCommunications", true, FRC_NetworkCommunicationsLibrary.class); + //public static final NativeLibrary JNA_NATIVE_LIB = NativeLibrary.getInstance(FRC_NetworkCommunicationsLibrary.JNA_LIBRARY_NAME, MangledFunctionMapper.DEFAULT_OPTIONS); + //static { + //System.loadLibrary("JNIWrappers"); + //Native.register(FRC_NetworkCommunicationsLibrary.class, FRC_NetworkCommunicationsLibrary.JNA_NATIVE_LIB); + //} + /** + * native declaration : src\main\include\NetworkCommunication\LoadOut.h
+ * enum values + */ + public static interface tModuleType { + /** native declaration : src\main\include\NetworkCommunication\LoadOut.h:9 */ + public static final int kModuleType_Unknown = 0x00; + /** native declaration : src\main\include\NetworkCommunication\LoadOut.h:10 */ + public static final int kModuleType_Analog = 0x01; + /** native declaration : src\main\include\NetworkCommunication\LoadOut.h:11 */ + public static final int kModuleType_Digital = 0x02; + /** native declaration : src\main\include\NetworkCommunication\LoadOut.h:12 */ + public static final int kModuleType_Solenoid = 0x03; + }; + /** + * native declaration : src\main\include\NetworkCommunication\LoadOut.h
+ * enum values + */ + public static interface tTargetClass { + /** native declaration : src\main\include\NetworkCommunication\LoadOut.h:16 */ + public static final int kTargetClass_Unknown = 0x00; + /** native declaration : src\main\include\NetworkCommunication\LoadOut.h:17 */ + public static final int kTargetClass_FRC1 = 0x10; + /** native declaration : src\main\include\NetworkCommunication\LoadOut.h:18 */ + public static final int kTargetClass_FRC2 = 0x20; + /** native declaration : src\main\include\NetworkCommunication\LoadOut.h:19 */ + public static final int kTargetClass_FRC2_Analog = (int)FRCNetworkCommunicationsLibrary.tTargetClass.kTargetClass_FRC2 | (int)FRCNetworkCommunicationsLibrary.tModuleType.kModuleType_Analog; + /** native declaration : src\main\include\NetworkCommunication\LoadOut.h:20 */ + public static final int kTargetClass_FRC2_Digital = (int)FRCNetworkCommunicationsLibrary.tTargetClass.kTargetClass_FRC2 | (int)FRCNetworkCommunicationsLibrary.tModuleType.kModuleType_Digital; + /** native declaration : src\main\include\NetworkCommunication\LoadOut.h:21 */ + public static final int kTargetClass_FRC2_Solenoid = (int)FRCNetworkCommunicationsLibrary.tTargetClass.kTargetClass_FRC2 | (int)FRCNetworkCommunicationsLibrary.tModuleType.kModuleType_Solenoid; + /** native declaration : src\main\include\NetworkCommunication\LoadOut.h:22 */ + public static final int kTargetClass_FamilyMask = 0xF0; + /** native declaration : src\main\include\NetworkCommunication\LoadOut.h:23 */ + public static final int kTargetClass_ModuleMask = 0x0F; + }; + /** + * native declaration : src\main\include\NetworkCommunication\UsageReporting.h
+ * enum values + */ + public static interface tResourceType { + /** native declaration : src\main\include\NetworkCommunication\UsageReporting.h:10 */ + public static final int kResourceType_Controller = 0; + /** native declaration : src\main\include\NetworkCommunication\UsageReporting.h:11 */ + public static final int kResourceType_Module = 1; + /** native declaration : src\main\include\NetworkCommunication\UsageReporting.h:12 */ + public static final int kResourceType_Language = 2; + /** native declaration : src\main\include\NetworkCommunication\UsageReporting.h:13 */ + public static final int kResourceType_CANPlugin = 3; + /** native declaration : src\main\include\NetworkCommunication\UsageReporting.h:14 */ + public static final int kResourceType_Accelerometer = 4; + /** native declaration : src\main\include\NetworkCommunication\UsageReporting.h:15 */ + public static final int kResourceType_ADXL345 = 5; + /** native declaration : src\main\include\NetworkCommunication\UsageReporting.h:16 */ + public static final int kResourceType_AnalogChannel = 6; + /** native declaration : src\main\include\NetworkCommunication\UsageReporting.h:17 */ + public static final int kResourceType_AnalogTrigger = 7; + /** native declaration : src\main\include\NetworkCommunication\UsageReporting.h:18 */ + public static final int kResourceType_AnalogTriggerOutput = 8; + /** native declaration : src\main\include\NetworkCommunication\UsageReporting.h:19 */ + public static final int kResourceType_CANJaguar = 9; + /** native declaration : src\main\include\NetworkCommunication\UsageReporting.h:20 */ + public static final int kResourceType_Compressor = 10; + /** native declaration : src\main\include\NetworkCommunication\UsageReporting.h:21 */ + public static final int kResourceType_Counter = 11; + /** native declaration : src\main\include\NetworkCommunication\UsageReporting.h:22 */ + public static final int kResourceType_Dashboard = 12; + /** native declaration : src\main\include\NetworkCommunication\UsageReporting.h:23 */ + public static final int kResourceType_DigitalInput = 13; + /** native declaration : src\main\include\NetworkCommunication\UsageReporting.h:24 */ + public static final int kResourceType_DigitalOutput = 14; + /** native declaration : src\main\include\NetworkCommunication\UsageReporting.h:25 */ + public static final int kResourceType_DriverStationCIO = 15; + /** native declaration : src\main\include\NetworkCommunication\UsageReporting.h:26 */ + public static final int kResourceType_DriverStationEIO = 16; + /** native declaration : src\main\include\NetworkCommunication\UsageReporting.h:27 */ + public static final int kResourceType_DriverStationLCD = 17; + /** native declaration : src\main\include\NetworkCommunication\UsageReporting.h:28 */ + public static final int kResourceType_Encoder = 18; + /** native declaration : src\main\include\NetworkCommunication\UsageReporting.h:29 */ + public static final int kResourceType_GearTooth = 19; + /** native declaration : src\main\include\NetworkCommunication\UsageReporting.h:30 */ + public static final int kResourceType_Gyro = 20; + /** native declaration : src\main\include\NetworkCommunication\UsageReporting.h:31 */ + public static final int kResourceType_I2C = 21; + /** native declaration : src\main\include\NetworkCommunication\UsageReporting.h:32 */ + public static final int kResourceType_Framework = 22; + /** native declaration : src\main\include\NetworkCommunication\UsageReporting.h:33 */ + public static final int kResourceType_Jaguar = 23; + /** native declaration : src\main\include\NetworkCommunication\UsageReporting.h:34 */ + public static final int kResourceType_Joystick = 24; + /** native declaration : src\main\include\NetworkCommunication\UsageReporting.h:35 */ + public static final int kResourceType_Kinect = 25; + /** native declaration : src\main\include\NetworkCommunication\UsageReporting.h:36 */ + public static final int kResourceType_KinectStick = 26; + /** native declaration : src\main\include\NetworkCommunication\UsageReporting.h:37 */ + public static final int kResourceType_PIDController = 27; + /** native declaration : src\main\include\NetworkCommunication\UsageReporting.h:38 */ + public static final int kResourceType_Preferences = 28; + /** native declaration : src\main\include\NetworkCommunication\UsageReporting.h:39 */ + public static final int kResourceType_PWM = 29; + /** native declaration : src\main\include\NetworkCommunication\UsageReporting.h:40 */ + public static final int kResourceType_Relay = 30; + /** native declaration : src\main\include\NetworkCommunication\UsageReporting.h:41 */ + public static final int kResourceType_RobotDrive = 31; + /** native declaration : src\main\include\NetworkCommunication\UsageReporting.h:42 */ + public static final int kResourceType_SerialPort = 32; + /** native declaration : src\main\include\NetworkCommunication\UsageReporting.h:43 */ + public static final int kResourceType_Servo = 33; + /** native declaration : src\main\include\NetworkCommunication\UsageReporting.h:44 */ + public static final int kResourceType_Solenoid = 34; + /** native declaration : src\main\include\NetworkCommunication\UsageReporting.h:45 */ + public static final int kResourceType_SPI = 35; + /** native declaration : src\main\include\NetworkCommunication\UsageReporting.h:46 */ + public static final int kResourceType_Task = 36; + /** native declaration : src\main\include\NetworkCommunication\UsageReporting.h:47 */ + public static final int kResourceType_Ultrasonic = 37; + /** native declaration : src\main\include\NetworkCommunication\UsageReporting.h:48 */ + public static final int kResourceType_Victor = 38; + /** native declaration : src\main\include\NetworkCommunication\UsageReporting.h:49 */ + public static final int kResourceType_Button = 39; + /** native declaration : src\main\include\NetworkCommunication\UsageReporting.h:50 */ + public static final int kResourceType_Command = 40; + /** native declaration : src\main\include\NetworkCommunication\UsageReporting.h:51 */ + public static final int kResourceType_AxisCamera = 41; + /** native declaration : src\main\include\NetworkCommunication\UsageReporting.h:52 */ + public static final int kResourceType_PCVideoServer = 42; + /** native declaration : src\main\include\NetworkCommunication\UsageReporting.h:53 */ + public static final int kResourceType_SmartDashboard = 43; + /** native declaration : src\main\include\NetworkCommunication\UsageReporting.h:54 */ + public static final int kResourceType_Talon = 44; + /** native declaration : src\main\include\NetworkCommunication\UsageReporting.h:55 */ + public static final int kResourceType_HiTechnicColorSensor = 45; + /** native declaration : src\main\include\NetworkCommunication\UsageReporting.h:56 */ + public static final int kResourceType_HiTechnicAccel = 46; + /** native declaration : src\main\include\NetworkCommunication\UsageReporting.h:57 */ + public static final int kResourceType_HiTechnicCompass = 47; + /** native declaration : src\main\include\NetworkCommunication\UsageReporting.h:58 */ + public static final int kResourceType_SRF08 = 48; + }; + /** + * native declaration : src\main\include\NetworkCommunication\UsageReporting.h
+ * enum values + */ + public static interface tInstances { + /** native declaration : src\main\include\NetworkCommunication\UsageReporting.h:63 */ + public static final int kLanguage_LabVIEW = 1; + /** native declaration : src\main\include\NetworkCommunication\UsageReporting.h:64 */ + public static final int kLanguage_CPlusPlus = 2; + /** native declaration : src\main\include\NetworkCommunication\UsageReporting.h:65 */ + public static final int kLanguage_Java = 3; + /** native declaration : src\main\include\NetworkCommunication\UsageReporting.h:66 */ + public static final int kLanguage_Python = 4; + /** native declaration : src\main\include\NetworkCommunication\UsageReporting.h:68 */ + public static final int kCANPlugin_BlackJagBridge = 1; + /** native declaration : src\main\include\NetworkCommunication\UsageReporting.h:69 */ + public static final int kCANPlugin_2CAN = 2; + /** native declaration : src\main\include\NetworkCommunication\UsageReporting.h:71 */ + public static final int kFramework_Iterative = 1; + /** native declaration : src\main\include\NetworkCommunication\UsageReporting.h:72 */ + public static final int kFramework_Simple = 2; + /** native declaration : src\main\include\NetworkCommunication\UsageReporting.h:74 */ + public static final int kRobotDrive_ArcadeStandard = 1; + /** native declaration : src\main\include\NetworkCommunication\UsageReporting.h:75 */ + public static final int kRobotDrive_ArcadeButtonSpin = 2; + /** native declaration : src\main\include\NetworkCommunication\UsageReporting.h:76 */ + public static final int kRobotDrive_ArcadeRatioCurve = 3; + /** native declaration : src\main\include\NetworkCommunication\UsageReporting.h:77 */ + public static final int kRobotDrive_Tank = 4; + /** native declaration : src\main\include\NetworkCommunication\UsageReporting.h:78 */ + public static final int kRobotDrive_MecanumPolar = 5; + /** native declaration : src\main\include\NetworkCommunication\UsageReporting.h:79 */ + public static final int kRobotDrive_MecanumCartesian = 6; + /** native declaration : src\main\include\NetworkCommunication\UsageReporting.h:81 */ + public static final int kDriverStationCIO_Analog = 1; + /** native declaration : src\main\include\NetworkCommunication\UsageReporting.h:82 */ + public static final int kDriverStationCIO_DigitalIn = 2; + /** native declaration : src\main\include\NetworkCommunication\UsageReporting.h:83 */ + public static final int kDriverStationCIO_DigitalOut = 3; + /** native declaration : src\main\include\NetworkCommunication\UsageReporting.h:85 */ + public static final int kDriverStationEIO_Acceleration = 1; + /** native declaration : src\main\include\NetworkCommunication\UsageReporting.h:86 */ + public static final int kDriverStationEIO_AnalogIn = 2; + /** native declaration : src\main\include\NetworkCommunication\UsageReporting.h:87 */ + public static final int kDriverStationEIO_AnalogOut = 3; + /** native declaration : src\main\include\NetworkCommunication\UsageReporting.h:88 */ + public static final int kDriverStationEIO_Button = 4; + /** native declaration : src\main\include\NetworkCommunication\UsageReporting.h:89 */ + public static final int kDriverStationEIO_LED = 5; + /** native declaration : src\main\include\NetworkCommunication\UsageReporting.h:90 */ + public static final int kDriverStationEIO_DigitalIn = 6; + /** native declaration : src\main\include\NetworkCommunication\UsageReporting.h:91 */ + public static final int kDriverStationEIO_DigitalOut = 7; + /** native declaration : src\main\include\NetworkCommunication\UsageReporting.h:92 */ + public static final int kDriverStationEIO_FixedDigitalOut = 8; + /** native declaration : src\main\include\NetworkCommunication\UsageReporting.h:93 */ + public static final int kDriverStationEIO_PWM = 9; + /** native declaration : src\main\include\NetworkCommunication\UsageReporting.h:94 */ + public static final int kDriverStationEIO_Encoder = 10; + /** native declaration : src\main\include\NetworkCommunication\UsageReporting.h:95 */ + public static final int kDriverStationEIO_TouchSlider = 11; + /** native declaration : src\main\include\NetworkCommunication\UsageReporting.h:97 */ + public static final int kADXL345_SPI = 1; + /** native declaration : src\main\include\NetworkCommunication\UsageReporting.h:98 */ + public static final int kADXL345_I2C = 2; + /** native declaration : src\main\include\NetworkCommunication\UsageReporting.h:100 */ + public static final int kCommand_Scheduler = 1; + /** native declaration : src\main\include\NetworkCommunication\UsageReporting.h:102 */ + public static final int kSmartDashboard_Instance = 1; + }; + /** native declaration : src\main\include\NetworkCommunication\FRCComm.h */ + public static final int kFRC_NetworkCommunication_DynamicType_DSEnhancedIO_Input = 17; + /** native declaration : src\main\include\NetworkCommunication\FRCComm.h */ + public static final int kFRC_NetworkCommunication_DynamicType_Kinect_Vertices1 = 21; + /** native declaration : src\main\include\NetworkCommunication\FRCComm.h */ + public static final int SYS_STATUS_DATA_SIZE = 44; + /** native declaration : src\main\include\NetworkCommunication\FRCComm.h */ + public static final int kFRC_NetworkCommunication_DynamicType_Kinect_Custom = 25; + /** native declaration : src\main\include\NetworkCommunication\FRCComm.h */ + public static final int kFRC_NetworkCommunication_DynamicType_Kinect_Vertices2 = 23; + /** native declaration : src\main\include\NetworkCommunication\FRCComm.h */ + public static final int kFRC_NetworkCommunication_DynamicType_Kinect_Header = 19; + /** native declaration : src\main\include\NetworkCommunication\FRCComm.h */ + public static final int kFRC_NetworkCommunication_DynamicType_Kinect_Joystick = 24; + /** native declaration : src\main\include\NetworkCommunication\FRCComm.h */ + public static final int IO_CONFIG_DATA_SIZE = 32; + /** native declaration : src\main\include\NetworkCommunication\LoadOut.h */ + public static final int kMaxModuleNumber = 2; + /** native declaration : src\main\include\NetworkCommunication\FRCComm.h */ + public static final int kFRC_NetworkCommunication_DynamicType_DSEnhancedIO_Output = 18; + /** native declaration : src\main\include\NetworkCommunication\FRCComm.h */ + public static final int kFRC_NetworkCommunication_DynamicType_Kinect_Extra2 = 22; + /** native declaration : src\main\include\NetworkCommunication\FRCComm.h */ + public static final int kFRC_NetworkCommunication_DynamicType_Kinect_Extra1 = 20; + /** native declaration : src\main\include\NetworkCommunication\FRCComm.h */ + public static final int USER_DS_LCD_DATA_SIZE = 128; + /** native declaration : src\main\include\NetworkCommunication\UsageReporting.h */ + public static final int kUsageReporting_version = 1; + /** native declaration : src\main\include\NetworkCommunication\FRCComm.h */ + public static final int USER_STATUS_DATA_SIZE = (984 - 32 - 44); + /** + * Original signature : uint32_t FRC_NetworkCommunication_nAICalibration_getLSBWeight(const uint32_t, const uint32_t, int32_t*)
+ * native declaration : src\main\include\NetworkCommunication\AICalibration.h:7
+ * @deprecated use the safer methods {@link #FRC_NetworkCommunication_nAICalibration_getLSBWeight(int, int, java.nio.IntBuffer)} and {@link #FRC_NetworkCommunication_nAICalibration_getLSBWeight(int, int, com.sun.jna.ptr.IntByReference)} instead + */ + //@Deprecated + //public static native int FRC_NetworkCommunication_nAICalibration_getLSBWeight(int aiSystemIndex, int channel, Integer status); + /** + * Original signature : uint32_t FRC_NetworkCommunication_nAICalibration_getLSBWeight(const uint32_t, const uint32_t, int32_t*)
+ * native declaration : src\main\include\NetworkCommunication\AICalibration.h:7 + */ + public static native int FRCNetworkCommunicationAICalibrationGetLSBWeight(int aiSystemIndex, int channel, Integer status); + /** + * Original signature : int32_t FRC_NetworkCommunication_nAICalibration_getOffset(const uint32_t, const uint32_t, int32_t*)
+ * native declaration : src\main\include\NetworkCommunication\AICalibration.h:8
+ * @deprecated use the safer methods {@link #FRC_NetworkCommunication_nAICalibration_getOffset(int, int, java.nio.IntBuffer)} and {@link #FRC_NetworkCommunication_nAICalibration_getOffset(int, int, com.sun.jna.ptr.IntByReference)} instead + */ + //@Deprecated + //public static native int FRC_NetworkCommunication_nAICalibration_getOffset(int aiSystemIndex, int channel, Integer status); + /** + * Original signature : int32_t FRC_NetworkCommunication_nAICalibration_getOffset(const uint32_t, const uint32_t, int32_t*)
+ * native declaration : src\main\include\NetworkCommunication\AICalibration.h:8 + */ + public static native int FRCNetworkCommunicationAICalibrationGetOffset(int aiSystemIndex, int channel, Integer status); + /** + * Original signature : bool getModulePresence(tModuleType, uint8_t)
+ * native declaration : src\main\include\NetworkCommunication\LoadOut.h:14 + */ + public static native byte getModulePresence(int moduleType, byte moduleNumber); + /** + * Original signature : tTargetClass getTargetClass()
+ * native declaration : src\main\include\NetworkCommunication\LoadOut.h:25 + */ + public static native int getTargetClass(); + /** + * Original signature : uint32_t FRC_NetworkCommunication_nLoadOut_getModulePresence(uint32_t, uint8_t)
+ * native declaration : src\main\include\NetworkCommunication\LoadOut.h:32 + */ + public static native int FRCNetworkCommunicationLoadOutGetModulePresence(int moduleType, byte moduleNumber); + /** + * Original signature : uint32_t FRC_NetworkCommunication_nLoadOut_getTargetClass()
+ * native declaration : src\main\include\NetworkCommunication\LoadOut.h:33 + */ + public static native int FRCNetworkCommunicationLoadOutGetTargetClass(); + /** + * Original signature : STATUS moduleNameFindBySymbolName(const char*, char*)
+ * @param symbol symbol name to look for
+ * @param module where to return module name
+ * native declaration : src\main\include\NetworkCommunication\symModuleLink.h:6
+ * @deprecated use the safer methods {@link #moduleNameFindBySymbolName(java.lang.String, java.nio.ByteBuffer)} and {@link #moduleNameFindBySymbolName(com.sun.jna.Pointer, com.sun.jna.Pointer)} instead + */ + //@Deprecated + //public static native FRC_NetworkCommunicationsLibrary.STATUS moduleNameFindBySymbolName(Pointer symbol, Pointer module); + /** + * Original signature : STATUS moduleNameFindBySymbolName(const char*, char*)
+ * @param symbol symbol name to look for
+ * @param module where to return module name
+ * native declaration : src\main\include\NetworkCommunication\symModuleLink.h:6 + */ + //public static native FRC_NetworkCommunicationsLibrary.STATUS moduleNameFindBySymbolName(String symbol, ByteBuffer module); + /** + * Report the usage of a resource of interest.
+ *
+ * @param resource one of the values in the tResourceType above (max value 51).
+ * @param instanceNumber an index that identifies the resource instance.
+ * @param context an optional additional context number for some cases (such as module number). Set to 0 to omit.
+ * @param feature a string to be included describing features in use on a specific resource. Setting the same resource more than once allows you to change the feature string.
+ * Original signature : uint32_t report(tResourceType, uint8_t, uint8_t, const char*)
+ * native declaration : src\main\include\NetworkCommunication\UsageReporting.h:113
+ * @deprecated use the safer methods {@link #report(int, byte, byte, java.lang.String)} and {@link #report(int, byte, byte, com.sun.jna.Pointer)} instead + */ + //@Deprecated + //public static native int report(int resource, byte instanceNumber, byte context, Pointer feature); + /** + * Report the usage of a resource of interest.
+ *
+ * @param resource one of the values in the tResourceType above (max value 51).
+ * @param instanceNumber an index that identifies the resource instance.
+ * @param context an optional additional context number for some cases (such as module number). Set to 0 to omit.
+ * @param feature a string to be included describing features in use on a specific resource. Setting the same resource more than once allows you to change the feature string.
+ * Original signature : uint32_t report(tResourceType, uint8_t, uint8_t, const char*)
+ * native declaration : src\main\include\NetworkCommunication\UsageReporting.h:113 + */ + public static native int report(int resource, byte instanceNumber, byte context, String feature); + /** + * Original signature : uint32_t FRC_NetworkCommunication_nUsageReporting_report(uint8_t, uint8_t, uint8_t, const char*)
+ * native declaration : src\main\include\NetworkCommunication\UsageReporting.h:120
+ * @deprecated use the safer methods {@link #FRC_NetworkCommunication_nUsageReporting_report(byte, byte, byte, java.lang.String)} and {@link #FRC_NetworkCommunication_nUsageReporting_report(byte, byte, byte, com.sun.jna.Pointer)} instead + */ + //@Deprecated + //public static native int FRC_NetworkCommunication_nUsageReporting_report(byte resource, byte instanceNumber, byte context, Pointer feature); + /** + * Original signature : uint32_t FRC_NetworkCommunication_nUsageReporting_report(uint8_t, uint8_t, uint8_t, const char*)
+ * native declaration : src\main\include\NetworkCommunication\UsageReporting.h:120 + */ + public static native int FRCNetworkCommunicationUsageReportingReport(byte resource, byte instanceNumber, byte context, String feature); + /** + * Original signature : void getFPGAHardwareVersion(uint16_t*, uint32_t*)
+ * native declaration : src\main\include\NetworkCommunication\FRCComm.h:124
+ * @deprecated use the safer methods {@link #getFPGAHardwareVersion(java.nio.ShortBuffer, java.nio.IntBuffer)} and {@link #getFPGAHardwareVersion(com.sun.jna.ptr.ShortByReference, com.sun.jna.ptr.IntByReference)} instead + */ + //@Deprecated + //public static native void getFPGAHardwareVersion(ShortByReference fpgaVersion, IntByReference fpgaRevision); + /** + * Original signature : void getFPGAHardwareVersion(uint16_t*, uint32_t*)
+ * native declaration : src\main\include\NetworkCommunication\FRCComm.h:124 + */ + public static native void getFPGAHardwareVersion(ShortBuffer fpgaVersion, IntBuffer fpgaRevision); + /** + * Original signature : int getCommonControlData(FRCCommonControlData*, int)
+ * native declaration : src\main\include\NetworkCommunication\FRCComm.h:126 + */ + public static native int getCommonControlData(FRCCommonControlData data); + /** + * Original signature : int getRecentCommonControlData(FRCCommonControlData*, int)
+ * native declaration : src\main\include\NetworkCommunication\FRCComm.h:127 + */ + public static native int getRecentCommonControlData(FRCCommonControlData commonData, int wait_ms); + /** + * Original signature : int getRecentStatusData(uint8_t*, uint8_t*, uint8_t*, int)
+ * native declaration : src\main\include\NetworkCommunication\FRCComm.h:128
+ * @deprecated use the safer methods {@link #getRecentStatusData(java.nio.ByteBuffer, java.nio.ByteBuffer, java.nio.ByteBuffer, int)} and {@link #getRecentStatusData(com.sun.jna.Pointer, com.sun.jna.Pointer, com.sun.jna.Pointer, int)} instead + */ + //@Deprecated + //public static native int getRecentStatusData(Pointer batteryInt, Pointer batteryDec, Pointer dsDigitalOut, int wait_ms); + /** + * Original signature : int getRecentStatusData(uint8_t*, uint8_t*, uint8_t*, int)
+ * native declaration : src\main\include\NetworkCommunication\FRCComm.h:128 + */ + public static native int getRecentStatusData(ByteBuffer batteryInt, ByteBuffer batteryDec, ByteBuffer dsDigitalOut, int wait_ms); + /** + * Original signature : int getDynamicControlData(uint8_t, char*, int32_t, int)
+ * native declaration : src\main\include\NetworkCommunication\FRCComm.h:129
+ * @deprecated use the safer methods {@link #getDynamicControlData(byte, java.nio.ByteBuffer, int, int)} and {@link #getDynamicControlData(byte, com.sun.jna.Pointer, int, int)} instead + */ + //@Deprecated + //public static native int getDynamicControlData(byte type, Pointer dynamicData, int maxLength, int wait_ms); + /** + * Original signature : int getDynamicControlData(uint8_t, char*, int32_t, int)
+ * native declaration : src\main\include\NetworkCommunication\FRCComm.h:129 + */ + public static native int getDynamicControlData(byte type, ByteBuffer dynamicData, int maxLength, int wait_ms); + /** + * Original signature : int setStatusData(float, uint8_t, uint8_t, const char*, int, const char*, int, int)
+ * native declaration : src\main\include\NetworkCommunication\FRCComm.h:130
+ * @deprecated use the safer methods {@link #setStatusData(float, byte, byte, java.lang.String, int, java.lang.String, int, int)} and {@link #setStatusData(float, byte, byte, com.sun.jna.Pointer, int, com.sun.jna.Pointer, int, int)} instead + */ + //@Deprecated + //public static native int setStatusData(float battery, byte dsDigitalOut, byte updateNumber, Pointer userDataHigh, int userDataHighLength, Pointer userDataLow, int userDataLowLength, int wait_ms); + /** + * Original signature : int setStatusData(float, uint8_t, uint8_t, const char*, int, const char*, int, int)
+ * native declaration : src\main\include\NetworkCommunication\FRCComm.h:130 + */ + public static native int setStatusData(float battery, byte dsDigitalOut, byte updateNumber, String userDataHigh, int userDataHighLength, String userDataLow, int userDataLowLength); + /** + * Original signature : int setStatusDataFloatAsInt(int, uint8_t, uint8_t, const char*, int, const char*, int, int)
+ * native declaration : src\main\include\NetworkCommunication\FRCComm.h:133
+ * @deprecated use the safer methods {@link #setStatusDataFloatAsInt(int, byte, byte, java.lang.String, int, java.lang.String, int, int)} and {@link #setStatusDataFloatAsInt(int, byte, byte, com.sun.jna.Pointer, int, com.sun.jna.Pointer, int, int)} instead + */ + //@Deprecated + //public static native int setStatusDataFloatAsInt(int battery, byte dsDigitalOut, byte updateNumber, Pointer userDataHigh, int userDataHighLength, Pointer userDataLow, int userDataLowLength, int wait_ms); + /** + * Original signature : int setStatusDataFloatAsInt(int, uint8_t, uint8_t, const char*, int, const char*, int, int)
+ * native declaration : src\main\include\NetworkCommunication\FRCComm.h:133 + */ + public static native int setStatusDataFloatAsInt(int battery, byte dsDigitalOut, byte updateNumber, String userDataHigh, int userDataHighLength, String userDataLow, int userDataLowLength, int wait_ms); + /** + * Original signature : int setErrorData(const char*, int, int)
+ * native declaration : src\main\include\NetworkCommunication\FRCComm.h:136
+ * @deprecated use the safer methods {@link #setErrorData(java.lang.String, int, int)} and {@link #setErrorData(com.sun.jna.Pointer, int, int)} instead + */ + //@Deprecated + //public static native int setErrorData(Pointer errors, int errorsLength, int wait_ms); + /** + * Original signature : int setErrorData(const char*, int, int)
+ * native declaration : src\main\include\NetworkCommunication\FRCComm.h:136 + */ + public static native int setErrorData(String errors, int errorsLength, int wait_ms); + /** + * Original signature : int setUserDsLcdData(const char*, int, int)
+ * native declaration : src\main\include\NetworkCommunication\FRCComm.h:137
+ * @deprecated use the safer methods {@link #setUserDsLcdData(java.lang.String, int, int)} and {@link #setUserDsLcdData(com.sun.jna.Pointer, int, int)} instead + */ + //@Deprecated + //public static native int setUserDsLcdData(Pointer userDsLcdData, int userDsLcdDataLength, int wait_ms); + /** + * Original signature : int setUserDsLcdData(const char*, int, int)
+ * native declaration : src\main\include\NetworkCommunication\FRCComm.h:137 + */ + public static native int setUserDsLcdData(String userDsLcdData, int userDsLcdDataLength, int wait_ms); + /** + * Original signature : int overrideIOConfig(const char*, int)
+ * native declaration : src\main\include\NetworkCommunication\FRCComm.h:138
+ * @deprecated use the safer methods {@link #overrideIOConfig(java.lang.String, int)} and {@link #overrideIOConfig(com.sun.jna.Pointer, int)} instead + */ + //@Deprecated + //public static native int overrideIOConfig(String ioConfig, int wait_ms); + /** + * Original signature : int overrideIOConfig(const char*, int)
+ * native declaration : src\main\include\NetworkCommunication\FRCComm.h:138 + */ + public static native int overrideIOConfig(String ioConfig, int wait_ms); + /** + * Original signature : void setNewDataSem(pthread_mutex_t*)
+ * native declaration : src\main\include\NetworkCommunication\FRCComm.h:147 + */ + public static native void setNewDataSem(ByteBuffer mutexId); + /** + * Original signature : void setResyncSem(pthread_mutex_t*)
+ * native declaration : src\main\include\NetworkCommunication\FRCComm.h:148 + */ + //public static native void setResyncSem(FRC_NetworkCommunicationsLibrary.pthread_mutex_t pthread_mutex_tPtr1); + /** + * Original signature : void signalResyncActionDone()
+ * native declaration : src\main\include\NetworkCommunication\FRCComm.h:150 + */ + public static native void signalResyncActionDone(); + /** + * this uint32_t is really a LVRefNum
+ * Original signature : void setNewDataOccurRef(uint32_t)
+ * native declaration : src\main\include\NetworkCommunication\FRCComm.h:154 + */ + public static native void setNewDataOccurRef(int refnum); + /** + * Original signature : void setResyncOccurRef(uint32_t)
+ * native declaration : src\main\include\NetworkCommunication\FRCComm.h:156 + */ + public static native void setResyncOccurRef(int refnum); + /** + * Original signature : void FRC_NetworkCommunication_getVersionString(char*)
+ * native declaration : src\main\include\NetworkCommunication\FRCComm.h:159
+ * @deprecated use the safer methods {@link #FRC_NetworkCommunication_getVersionString(java.nio.ByteBuffer)} and {@link #FRC_NetworkCommunication_getVersionString(com.sun.jna.Pointer)} instead + */ + //@Deprecated + //public static native void FRC_NetworkCommunication_getVersionString(Pointer version); + /** + * Original signature : void FRC_NetworkCommunication_getVersionString(char*)
+ * native declaration : src\main\include\NetworkCommunication\FRCComm.h:159 + */ + public static native void FRCNetworkCommunicationGetVersionString(ByteBuffer version); + public static native void FRCNetworkCommunicationObserveUserProgramStarting(); + public static native void FRCNetworkCommunicationObserveUserProgramDisabled(); + public static native void FRCNetworkCommunicationObserveUserProgramAutonomous(); + public static native void FRCNetworkCommunicationObserveUserProgramTeleop(); + public static native void FRCNetworkCommunicationObserveUserProgramTest(); + public static native void FRCNetworkCommunicationReserve(); + + /* + public static class pthread_mutex_t extends PointerType { + public pthread_mutex_t(Pointer address) { + super(address); + } + public pthread_mutex_t() { + super(); + } + }; + public static class STATUS extends PointerType { + public STATUS(Pointer address) { + super(address); + } + public STATUS() { + super(); + } + };*/ + + // + // JNI Testing + // + public static native void JNIValueParameterTest(boolean booleanValue, byte byteValue, char charValue, short shortValue, int intValue, long longValue, float floatValue, double doubleValue ); + public static native boolean JNIValueReturnBooleanTest(boolean booleanValue); + public static native byte JNIValueReturnByteTest(byte byteValue); + public static native char JNIValueReturnCharTest(char charValue); + public static native short JNIValueReturnShortTest(short shortValue); + public static native int JNIValueReturnIntTest(int intValue); + public static native long JNIValueReturnLongTest(long longValue); + public static native float JNIValueReturnFloatTest(float floatValue); + public static native double JNIValueReturnDoubleTest(double doubleValue); + + public static native String JNIObjectReturnStringTest( String stringObject); + + public static native ByteBuffer JNIObjectReturnByteBufferTest( ByteBuffer byteBuffer ); + + public static native ByteBuffer JNIObjectAndParamReturnIntBufferTest( IntBuffer intBuffer); + +} diff --git a/wpilibj/src/main/java/edu/wpi/first/wpilibj/communication/NIRioStatus.java b/wpilibj/wpilibJava/src/main/java/edu/wpi/first/wpilibj/communication/NIRioStatus.java similarity index 100% rename from wpilibj/src/main/java/edu/wpi/first/wpilibj/communication/NIRioStatus.java rename to wpilibj/wpilibJava/src/main/java/edu/wpi/first/wpilibj/communication/NIRioStatus.java diff --git a/wpilibj/src/main/java/edu/wpi/first/wpilibj/communication/UsageReporting.java b/wpilibj/wpilibJava/src/main/java/edu/wpi/first/wpilibj/communication/UsageReporting.java similarity index 100% rename from wpilibj/src/main/java/edu/wpi/first/wpilibj/communication/UsageReporting.java rename to wpilibj/wpilibJava/src/main/java/edu/wpi/first/wpilibj/communication/UsageReporting.java diff --git a/wpilibj/wpilibJava/src/main/java/edu/wpi/first/wpilibj/hal/AnalogJNI.java b/wpilibj/wpilibJava/src/main/java/edu/wpi/first/wpilibj/hal/AnalogJNI.java new file mode 100644 index 0000000000..f7ac90f9e5 --- /dev/null +++ b/wpilibj/wpilibJava/src/main/java/edu/wpi/first/wpilibj/hal/AnalogJNI.java @@ -0,0 +1,58 @@ +package edu.wpi.first.wpilibj.hal; + +import java.nio.IntBuffer; +import java.nio.ByteBuffer; +import java.nio.LongBuffer; + +public class AnalogJNI extends JNIWrapper { + /** + * native declaration : AthenaJava\target\native\include\HAL\Analog.h:58
+ * enum values + */ + public static interface AnalogTriggerType { + /** native declaration : AthenaJava\target\native\include\HAL\Analog.h:54 */ + public static final int kInWindow = 0; + /** native declaration : AthenaJava\target\native\include\HAL\Analog.h:55 */ + public static final int kState = 1; + /** native declaration : AthenaJava\target\native\include\HAL\Analog.h:56 */ + public static final int kRisingPulse = 2; + /** native declaration : AthenaJava\target\native\include\HAL\Analog.h:57 */ + public static final int kFallingPulse = 3; + }; + + public static native ByteBuffer initializeAnalogPort(ByteBuffer port_pointer, IntBuffer status); + public static native byte checkAnalogModule(byte module); + public static native byte checkAnalogChannel(int pin); + public static native void setAnalogSampleRate(double samplesPerSecond, IntBuffer status); + public static native double getAnalogSampleRate(IntBuffer status); + public static native void setAnalogSampleRateWithModule(byte module, double samplesPerSecond, IntBuffer status); + public static native double getAnalogSampleRateWithModule(byte module, IntBuffer status); + public static native void setAnalogAverageBits(ByteBuffer analog_port_pointer, int bits, IntBuffer status); + public static native int getAnalogAverageBits(ByteBuffer analog_port_pointer, IntBuffer status); + public static native void setAnalogOversampleBits(ByteBuffer analog_port_pointer, int bits, IntBuffer status); + public static native int getAnalogOversampleBits(ByteBuffer analog_port_pointer, IntBuffer status); + public static native short getAnalogValue(ByteBuffer analog_port_pointer, IntBuffer status); + public static native int getAnalogAverageValue(ByteBuffer analog_port_pointer, IntBuffer status); + public static native int getAnalogVoltsToValue(ByteBuffer analog_port_pointer, double voltage, IntBuffer status); + public static native double getAnalogVoltage(ByteBuffer analog_port_pointer, IntBuffer status); + public static native double getAnalogAverageVoltage(ByteBuffer analog_port_pointer, IntBuffer status); + public static native int getAnalogLSBWeight(ByteBuffer analog_port_pointer, IntBuffer status); + public static native int getAnalogOffset(ByteBuffer analog_port_pointer, IntBuffer status); + public static native byte isAccumulatorChannel(ByteBuffer analog_port_pointer, IntBuffer status); + public static native void initAccumulator(ByteBuffer analog_port_pointer, IntBuffer status); + public static native void resetAccumulator(ByteBuffer analog_port_pointer, IntBuffer status); + public static native void setAccumulatorCenter(ByteBuffer analog_port_pointer, int center, IntBuffer status); + public static native void setAccumulatorDeadband(ByteBuffer analog_port_pointer, int deadband, IntBuffer status); + public static native long getAccumulatorValue(ByteBuffer analog_port_pointer, IntBuffer status); + public static native int getAccumulatorCount(ByteBuffer analog_port_pointer, IntBuffer status); + public static native void getAccumulatorOutput(ByteBuffer analog_port_pointer, LongBuffer value, IntBuffer count, IntBuffer status); + public static native ByteBuffer initializeAnalogTrigger(ByteBuffer port_pointer, IntBuffer index, IntBuffer status); + public static native void cleanAnalogTrigger(ByteBuffer analog_trigger_pointer, IntBuffer status); + public static native void setAnalogTriggerLimitsRaw(ByteBuffer analog_trigger_pointer, int lower, int upper, IntBuffer status); + public static native void setAnalogTriggerLimitsVoltage(ByteBuffer analog_trigger_pointer, double lower, double upper, IntBuffer status); + public static native void setAnalogTriggerAveraged(ByteBuffer analog_trigger_pointer, byte useAveragedValue, IntBuffer status); + public static native void setAnalogTriggerFiltered(ByteBuffer analog_trigger_pointer, byte useFilteredValue, IntBuffer status); + public static native byte getAnalogTriggerInWindow(ByteBuffer analog_trigger_pointer, IntBuffer status); + public static native byte getAnalogTriggerTriggerState(ByteBuffer analog_trigger_pointer, IntBuffer status); + public static native byte getAnalogTriggerOutput(ByteBuffer analog_trigger_pointer, int type, IntBuffer status); +} diff --git a/wpilibj/wpilibJava/src/main/java/edu/wpi/first/wpilibj/hal/CounterJNI.java b/wpilibj/wpilibJava/src/main/java/edu/wpi/first/wpilibj/hal/CounterJNI.java new file mode 100644 index 0000000000..fb00f40e2f --- /dev/null +++ b/wpilibj/wpilibJava/src/main/java/edu/wpi/first/wpilibj/hal/CounterJNI.java @@ -0,0 +1,32 @@ +package edu.wpi.first.wpilibj.hal; + +import java.nio.IntBuffer; +import java.nio.ByteBuffer; + +public class CounterJNI extends JNIWrapper { + public static native ByteBuffer initializeCounter(int mode, IntBuffer index, IntBuffer status); + public static native void freeCounter(ByteBuffer counter_pointer, IntBuffer status); + public static native void setCounterAverageSize(ByteBuffer counter_pointer, int size, IntBuffer status); + public static native void setCounterUpSourceWithModule(ByteBuffer counter_pointer, byte module, int pin, byte analogTrigger, IntBuffer status); + public static native void setCounterUpSourceEdge(ByteBuffer counter_pointer, byte risingEdge, byte fallingEdge, IntBuffer status); + public static native void clearCounterUpSource(ByteBuffer counter_pointer, IntBuffer status); + public static native void setCounterDownSourceWithModule(ByteBuffer counter_pointer, byte module, int pin, byte analogTrigger, IntBuffer status); + public static native void setCounterDownSourceEdge(ByteBuffer counter_pointer, byte risingEdge, byte fallingEdge, IntBuffer status); + public static native void clearCounterDownSource(ByteBuffer counter_pointer, IntBuffer status); + public static native void setCounterUpDownMode(ByteBuffer counter_pointer, IntBuffer status); + public static native void setCounterExternalDirectionMode(ByteBuffer counter_pointer, IntBuffer status); + public static native void setCounterSemiPeriodMode(ByteBuffer counter_pointer, byte highSemiPeriod, IntBuffer status); + public static native void setCounterPulseLengthMode(ByteBuffer counter_pointer, double threshold, IntBuffer status); + public static native int getCounterSamplesToAverage(ByteBuffer counter_pointer, IntBuffer status); + public static native void setCounterSamplesToAverage(ByteBuffer counter_pointer, int samplesToAverage, IntBuffer status); + public static native void startCounter(ByteBuffer counter_pointer, IntBuffer status); + public static native void stopCounter(ByteBuffer counter_pointer, IntBuffer status); + public static native void resetCounter(ByteBuffer counter_pointer, IntBuffer status); + public static native int getCounter(ByteBuffer counter_pointer, IntBuffer status); + public static native double getCounterPeriod(ByteBuffer counter_pointer, IntBuffer status); + public static native void setCounterMaxPeriod(ByteBuffer counter_pointer, double maxPeriod, IntBuffer status); + public static native void setCounterUpdateWhenEmpty(ByteBuffer counter_pointer, byte enabled, IntBuffer status); + public static native byte getCounterStopped(ByteBuffer counter_pointer, IntBuffer status); + public static native byte getCounterDirection(ByteBuffer counter_pointer, IntBuffer status); + public static native void setCounterReverseDirection(ByteBuffer counter_pointer, byte reverseDirection, IntBuffer status); +} diff --git a/wpilibj/wpilibJava/src/main/java/edu/wpi/first/wpilibj/hal/DIOJNI.java b/wpilibj/wpilibJava/src/main/java/edu/wpi/first/wpilibj/hal/DIOJNI.java new file mode 100644 index 0000000000..0f92b97a2d --- /dev/null +++ b/wpilibj/wpilibJava/src/main/java/edu/wpi/first/wpilibj/hal/DIOJNI.java @@ -0,0 +1,22 @@ +package edu.wpi.first.wpilibj.hal; + +import java.nio.IntBuffer; +import java.nio.ByteBuffer; + +public class DIOJNI extends JNIWrapper { + public static native ByteBuffer initializeDigitalPort(ByteBuffer port_pointer, IntBuffer status); + public static native byte allocateDIO(ByteBuffer digital_port_pointer, byte input, IntBuffer status); + public static native void freeDIO(ByteBuffer digital_port_pointer, IntBuffer status); + public static native void setDIO(ByteBuffer digital_port_pointer, short value, IntBuffer status); + public static native byte getDIO(ByteBuffer digital_port_pointer, IntBuffer status); + public static native byte getDIODirection(ByteBuffer digital_port_pointer, IntBuffer status); + //public static native byte remapDigitalChannel(int pin, IntBuffer status); + //public static native byte unmapDigitalChannel(int pin, IntBuffer status); + public static native byte checkDigitalModule(byte module); + public static native void pulse(ByteBuffer digital_port_pointer, double pulseLength, IntBuffer status); + public static native byte isPulsing(ByteBuffer digital_port_pointer, IntBuffer status); + public static native byte isAnyPulsing(IntBuffer status); + public static native byte isAnyPulsingWithModule(byte module, IntBuffer status); + public static native short getLoopTiming(IntBuffer status); + public static native short getLoopTimingWithModule(byte module, IntBuffer status); +} diff --git a/wpilibj/wpilibJava/src/main/java/edu/wpi/first/wpilibj/hal/EncoderJNI.java b/wpilibj/wpilibJava/src/main/java/edu/wpi/first/wpilibj/hal/EncoderJNI.java new file mode 100644 index 0000000000..1d51db3dbf --- /dev/null +++ b/wpilibj/wpilibJava/src/main/java/edu/wpi/first/wpilibj/hal/EncoderJNI.java @@ -0,0 +1,20 @@ +package edu.wpi.first.wpilibj.hal; + +import java.nio.IntBuffer; +import java.nio.ByteBuffer; + +public class EncoderJNI extends JNIWrapper { + public static native ByteBuffer initializeEncoder(byte port_a_module, int port_a_pin, byte port_a_analog_trigger, byte port_b_module, int port_b_pin, byte port_b_analog_trigger, byte reverseDirection, IntBuffer index, IntBuffer status); + public static native void freeEncoder(ByteBuffer encoder_pointer, IntBuffer status); + public static native void startEncoder(ByteBuffer encoder_pointer, IntBuffer status); + public static native void stopEncoder(ByteBuffer encoder_pointer, IntBuffer status); + public static native void resetEncoder(ByteBuffer encoder_pointer, IntBuffer status); + public static native int getEncoder(ByteBuffer encoder_pointer, IntBuffer status); + public static native double getEncoderPeriod(ByteBuffer encoder_pointer, IntBuffer status); + public static native void setEncoderMaxPeriod(ByteBuffer encoder_pointer, double maxPeriod, IntBuffer status); + public static native byte getEncoderStopped(ByteBuffer encoder_pointer, IntBuffer status); + public static native byte getEncoderDirection(ByteBuffer encoder_pointer, IntBuffer status); + public static native void setEncoderReverseDirection(ByteBuffer encoder_pointer, byte reverseDirection, IntBuffer status); + public static native void setEncoderSamplesToAverage(ByteBuffer encoder_pointer, int samplesToAverage, IntBuffer status); + public static native int getEncoderSamplesToAverage(ByteBuffer encoder_pointer, IntBuffer status); +} diff --git a/wpilibj/src/main/java/edu/wpi/first/wpilibj/hal/HALLibrary.java b/wpilibj/wpilibJava/src/main/java/edu/wpi/first/wpilibj/hal/HALLibrary.java similarity index 100% rename from wpilibj/src/main/java/edu/wpi/first/wpilibj/hal/HALLibrary.java rename to wpilibj/wpilibJava/src/main/java/edu/wpi/first/wpilibj/hal/HALLibrary.java diff --git a/wpilibj/src/main/java/edu/wpi/first/wpilibj/hal/HALUtil.java b/wpilibj/wpilibJava/src/main/java/edu/wpi/first/wpilibj/hal/HALUtil.java similarity index 100% rename from wpilibj/src/main/java/edu/wpi/first/wpilibj/hal/HALUtil.java rename to wpilibj/wpilibJava/src/main/java/edu/wpi/first/wpilibj/hal/HALUtil.java diff --git a/wpilibj/wpilibJava/src/main/java/edu/wpi/first/wpilibj/hal/I2CJNI.java b/wpilibj/wpilibJava/src/main/java/edu/wpi/first/wpilibj/hal/I2CJNI.java new file mode 100644 index 0000000000..36b0e2c797 --- /dev/null +++ b/wpilibj/wpilibJava/src/main/java/edu/wpi/first/wpilibj/hal/I2CJNI.java @@ -0,0 +1,9 @@ +package edu.wpi.first.wpilibj.hal; + +import java.nio.ByteBuffer; +import java.nio.IntBuffer; + +public class I2CJNI extends JNIWrapper { + public static native byte doI2CTransaction(byte address, byte compatibilityMode, ByteBuffer dataToSend, byte sendSize, ByteBuffer dataReceived, byte receiveSize, IntBuffer status); + public static native byte doI2CTransactionWithModule(byte module, byte address, byte compatibilityMode, ByteBuffer dataToSend, byte sendSize, ByteBuffer dataReceived, byte receiveSize, IntBuffer status); +} diff --git a/wpilibj/wpilibJava/src/main/java/edu/wpi/first/wpilibj/hal/InterruptJNI.java b/wpilibj/wpilibJava/src/main/java/edu/wpi/first/wpilibj/hal/InterruptJNI.java new file mode 100644 index 0000000000..23b722c66a --- /dev/null +++ b/wpilibj/wpilibJava/src/main/java/edu/wpi/first/wpilibj/hal/InterruptJNI.java @@ -0,0 +1,19 @@ +package edu.wpi.first.wpilibj.hal; + +import java.nio.IntBuffer; +import java.nio.ByteBuffer; + +public class InterruptJNI extends JNIWrapper { + public interface InterruptHandlerFunction { + void apply(int interruptAssertedMask, ByteBuffer param); + }; + public static native ByteBuffer initializeInterrupts(int interruptIndex, byte watcher, IntBuffer status); + public static native void cleanInterrupts(ByteBuffer interrupt_pointer, IntBuffer status); + public static native void waitForInterrupt(ByteBuffer interrupt_pointer, double timeout, IntBuffer status); + public static native void enableInterrupts(ByteBuffer interrupt_pointer, IntBuffer status); + public static native void disableInterrupts(ByteBuffer interrupt_pointer, IntBuffer status); + public static native double readInterruptTimestamp(ByteBuffer interrupt_pointer, IntBuffer status); + public static native void requestInterrupts(ByteBuffer interrupt_pointer, byte routing_module, int routing_pin, byte routing_analog_trigger, IntBuffer status); + public static native void attachInterruptHandler(ByteBuffer interrupt_pointer, InterruptHandlerFunction handler, ByteBuffer param, IntBuffer status); + public static native void setInterruptUpSourceEdge(ByteBuffer interrupt_pointer, byte risingEdge, byte fallingEdge, IntBuffer status); +} diff --git a/wpilibj/wpilibJava/src/main/java/edu/wpi/first/wpilibj/hal/JNIWrapper.java b/wpilibj/wpilibJava/src/main/java/edu/wpi/first/wpilibj/hal/JNIWrapper.java new file mode 100644 index 0000000000..c0786c213a --- /dev/null +++ b/wpilibj/wpilibJava/src/main/java/edu/wpi/first/wpilibj/hal/JNIWrapper.java @@ -0,0 +1,62 @@ +package edu.wpi.first.wpilibj.hal; + +import java.io.File; +import java.io.InputStream; +import java.io.OutputStream; +import java.io.FileOutputStream; +import java.nio.ByteBuffer; + +// +// base class for all JNI wrappers +// +public class JNIWrapper +{ + static boolean libraryLoaded = false; + static File jniLibrary = null; + static + { + try + { + if( !libraryLoaded ) + { + // create temporary file + jniLibrary = File.createTempFile("libwpilibJavaJNI", "so"); + // flag for delete on exit + jniLibrary.deleteOnExit(); + + byte [] buffer = new byte[1024]; + + int readBytes; + + InputStream is = JNIWrapper.class.getResourceAsStream("linux-arm/libwpilibJavaJNI.so"); + + OutputStream os = new FileOutputStream(jniLibrary); + + try + { + while((readBytes = is.read(buffer)) != -1 ) + { + os.write(buffer, 0, readBytes); + } + + } + finally + { + os.close(); + is.close(); + } + + + libraryLoaded = true; + } + + System.loadLibrary(jniLibrary.getAbsolutePath()); + } + catch( Exception ex ) + { + ex.printStackTrace(); + System.exit(1); + } + } + public static native ByteBuffer getPortWithModule(byte module, byte pin); +} diff --git a/wpilibj/wpilibJava/src/main/java/edu/wpi/first/wpilibj/hal/PWMJNI.java b/wpilibj/wpilibJava/src/main/java/edu/wpi/first/wpilibj/hal/PWMJNI.java new file mode 100644 index 0000000000..f09c82e786 --- /dev/null +++ b/wpilibj/wpilibJava/src/main/java/edu/wpi/first/wpilibj/hal/PWMJNI.java @@ -0,0 +1,23 @@ +package edu.wpi.first.wpilibj.hal; + +import java.nio.IntBuffer; +import java.nio.ByteBuffer; + +import edu.wpi.first.wpilibj.SensorBase; + + +public class PWMJNI extends DIOJNI { + public static native void setPWM(ByteBuffer digital_port_pointer, short value, IntBuffer status); + public static native short getPWM(ByteBuffer digital_port_pointer, IntBuffer status); + public static native void setPWMPeriodScale(ByteBuffer digital_port_pointer, int squelchMask, IntBuffer status); + public static native ByteBuffer allocatePWM(IntBuffer status); + public static native ByteBuffer allocatePWMWithModule(byte module, IntBuffer status); + public static native void freePWM(ByteBuffer pwmGenerator, IntBuffer status); + public static native void freePWMWithModule(byte module, ByteBuffer pwmGenerator, IntBuffer status); + public static native void setPWMRate(double rate, IntBuffer status); + public static native void setPWMRateWithModule(byte module, double rate, IntBuffer status); + public static native void setPWMDutyCycle(ByteBuffer pwmGenerator, double dutyCycle, IntBuffer status); + public static native void setPWMDutyCycleWithModule(byte module, ByteBuffer pwmGenerator, double dutyCycle, IntBuffer status); + public static native void setPWMOutputChannel(ByteBuffer pwmGenerator, int pin, IntBuffer status); + public static native void setPWMOutputChannelWithModule(byte module, ByteBuffer pwmGenerator, int pin, IntBuffer status); +} diff --git a/wpilibj/wpilibJava/src/main/java/edu/wpi/first/wpilibj/hal/RelayJNI.java b/wpilibj/wpilibJava/src/main/java/edu/wpi/first/wpilibj/hal/RelayJNI.java new file mode 100644 index 0000000000..47b3db453f --- /dev/null +++ b/wpilibj/wpilibJava/src/main/java/edu/wpi/first/wpilibj/hal/RelayJNI.java @@ -0,0 +1,11 @@ +package edu.wpi.first.wpilibj.hal; + +import java.nio.ByteBuffer; +import java.nio.IntBuffer; + +public class RelayJNI extends DIOJNI { + public static native void setRelayForward(ByteBuffer digital_port_pointer, byte on, IntBuffer status); + public static native void setRelayReverse(ByteBuffer digital_port_pointer, byte on, IntBuffer status); + public static native byte getRelayForward(ByteBuffer digital_port_pointer, IntBuffer status); + public static native byte getRelayReverse(ByteBuffer digital_port_pointer, IntBuffer status); +} diff --git a/wpilibj/wpilibJava/src/main/java/edu/wpi/first/wpilibj/hal/SPIJNI.java b/wpilibj/wpilibJava/src/main/java/edu/wpi/first/wpilibj/hal/SPIJNI.java new file mode 100644 index 0000000000..9544a22a43 --- /dev/null +++ b/wpilibj/wpilibJava/src/main/java/edu/wpi/first/wpilibj/hal/SPIJNI.java @@ -0,0 +1,32 @@ +package edu.wpi.first.wpilibj.hal; + +import java.nio.ByteBuffer; +import java.nio.IntBuffer; + +public class SPIJNI extends JNIWrapper { + public static native ByteBuffer initializeSPI(byte sclk_routing_module, int sclk_routing_pin, byte mosi_routing_module, int mosi_routing_pin, byte miso_routing_module, int miso_routing_pin, IntBuffer status); + public static native void cleanSPI(ByteBuffer spi_pointer, IntBuffer status); + public static native void setSPIBitsPerWord(ByteBuffer spi_pointer, int bits, IntBuffer status); + public static native int getSPIBitsPerWord(ByteBuffer spi_pointer, IntBuffer status); + public static native void setSPIClockRate(ByteBuffer spi_pointer, double hz, IntBuffer status); + public static native void setSPIMSBFirst(ByteBuffer spi_pointer, IntBuffer status); + public static native void setSPILSBFirst(ByteBuffer spi_pointer, IntBuffer status); + public static native void setSPISampleDataOnFalling(ByteBuffer spi_pointer, IntBuffer status); + public static native void setSPISampleDataOnRising(ByteBuffer spi_pointer, IntBuffer status); + public static native void setSPISlaveSelect(ByteBuffer spi_pointer, byte ss_routing_module, int ss_routing_pin, IntBuffer status); + public static native void setSPILatchMode(ByteBuffer spi_pointer, int mode, IntBuffer status); + public static native int getSPILatchMode(ByteBuffer spi_pointer, IntBuffer status); + public static native void setSPIFramePolarity(ByteBuffer spi_pointer, byte activeLow, IntBuffer status); + public static native byte getSPIFramePolarity(ByteBuffer spi_pointer, IntBuffer status); + public static native void setSPIClockActiveLow(ByteBuffer spi_pointer, IntBuffer status); + public static native void setSPIClockActiveHigh(ByteBuffer spi_pointer, IntBuffer status); + public static native void applySPIConfig(ByteBuffer spi_pointer, IntBuffer status); + public static native short getSPIOutputFIFOAvailable(ByteBuffer spi_pointer, IntBuffer status); + public static native short getSPINumReceived(ByteBuffer spi_pointer, IntBuffer status); + public static native byte isSPIDone(ByteBuffer spi_pointer, IntBuffer status); + public static native byte hadSPIReceiveOverflow(ByteBuffer spi_pointer, IntBuffer status); + public static native void writeSPI(ByteBuffer spi_pointer, int data, IntBuffer status); + public static native int readSPI(ByteBuffer spi_pointer, byte initiate, IntBuffer status); + public static native void resetSPI(ByteBuffer spi_pointer, IntBuffer status); + public static native void clearSPIReceivedData(ByteBuffer spi_pointer, IntBuffer status); +} diff --git a/wpilibj/wpilibJava/src/main/java/edu/wpi/first/wpilibj/hal/WatchdogJNI.java b/wpilibj/wpilibJava/src/main/java/edu/wpi/first/wpilibj/hal/WatchdogJNI.java new file mode 100644 index 0000000000..76a578b2fc --- /dev/null +++ b/wpilibj/wpilibJava/src/main/java/edu/wpi/first/wpilibj/hal/WatchdogJNI.java @@ -0,0 +1,19 @@ +package edu.wpi.first.wpilibj.hal; + +import java.nio.IntBuffer; +import java.nio.ByteBuffer; + +public class WatchdogJNI extends JNIWrapper { + public static native ByteBuffer initializeWatchdog(IntBuffer status); + public static native void cleanWatchdog(ByteBuffer watchdog_pointer, IntBuffer status); + public static native byte feedWatchdog(ByteBuffer watchdog_pointer, IntBuffer status); + public static native void killWatchdog(ByteBuffer watchdog_pointer, IntBuffer status); + public static native double getWatchdogLastFed(ByteBuffer watchdog_pointer, IntBuffer status); + public static native double getWatchdogExpiration(ByteBuffer watchdog_pointer, IntBuffer status); + public static native void setWatchdogExpiration(ByteBuffer watchdog_pointer, double expiration, IntBuffer status); + public static native byte getWatchdogEnabled(ByteBuffer watchdog_pointer, IntBuffer status); + public static native void setWatchdogEnabled(ByteBuffer watchdog_pointer, byte enabled, IntBuffer status); + public static native byte isWatchdogAlive(ByteBuffer watchdog_pointer, IntBuffer status); + public static native byte isWatchdogSystemActive(ByteBuffer watchdog_pointer, IntBuffer status); + +} diff --git a/wpilibj/src/main/java/edu/wpi/first/wpilibj/image/BinaryImage.java b/wpilibj/wpilibJava/src/main/java/edu/wpi/first/wpilibj/image/BinaryImage.java similarity index 100% rename from wpilibj/src/main/java/edu/wpi/first/wpilibj/image/BinaryImage.java rename to wpilibj/wpilibJava/src/main/java/edu/wpi/first/wpilibj/image/BinaryImage.java diff --git a/wpilibj/src/main/java/edu/wpi/first/wpilibj/image/ColorImage.java b/wpilibj/wpilibJava/src/main/java/edu/wpi/first/wpilibj/image/ColorImage.java similarity index 100% rename from wpilibj/src/main/java/edu/wpi/first/wpilibj/image/ColorImage.java rename to wpilibj/wpilibJava/src/main/java/edu/wpi/first/wpilibj/image/ColorImage.java diff --git a/wpilibj/src/main/java/edu/wpi/first/wpilibj/image/CriteriaCollection.java b/wpilibj/wpilibJava/src/main/java/edu/wpi/first/wpilibj/image/CriteriaCollection.java similarity index 100% rename from wpilibj/src/main/java/edu/wpi/first/wpilibj/image/CriteriaCollection.java rename to wpilibj/wpilibJava/src/main/java/edu/wpi/first/wpilibj/image/CriteriaCollection.java diff --git a/wpilibj/src/main/java/edu/wpi/first/wpilibj/image/CurveOptions.java b/wpilibj/wpilibJava/src/main/java/edu/wpi/first/wpilibj/image/CurveOptions.java similarity index 100% rename from wpilibj/src/main/java/edu/wpi/first/wpilibj/image/CurveOptions.java rename to wpilibj/wpilibJava/src/main/java/edu/wpi/first/wpilibj/image/CurveOptions.java diff --git a/wpilibj/src/main/java/edu/wpi/first/wpilibj/image/EllipseDescriptor.java b/wpilibj/wpilibJava/src/main/java/edu/wpi/first/wpilibj/image/EllipseDescriptor.java similarity index 100% rename from wpilibj/src/main/java/edu/wpi/first/wpilibj/image/EllipseDescriptor.java rename to wpilibj/wpilibJava/src/main/java/edu/wpi/first/wpilibj/image/EllipseDescriptor.java diff --git a/wpilibj/src/main/java/edu/wpi/first/wpilibj/image/EllipseMatch.java b/wpilibj/wpilibJava/src/main/java/edu/wpi/first/wpilibj/image/EllipseMatch.java similarity index 100% rename from wpilibj/src/main/java/edu/wpi/first/wpilibj/image/EllipseMatch.java rename to wpilibj/wpilibJava/src/main/java/edu/wpi/first/wpilibj/image/EllipseMatch.java diff --git a/wpilibj/src/main/java/edu/wpi/first/wpilibj/image/HSLImage.java b/wpilibj/wpilibJava/src/main/java/edu/wpi/first/wpilibj/image/HSLImage.java similarity index 100% rename from wpilibj/src/main/java/edu/wpi/first/wpilibj/image/HSLImage.java rename to wpilibj/wpilibJava/src/main/java/edu/wpi/first/wpilibj/image/HSLImage.java diff --git a/wpilibj/src/main/java/edu/wpi/first/wpilibj/image/Image.java b/wpilibj/wpilibJava/src/main/java/edu/wpi/first/wpilibj/image/Image.java similarity index 100% rename from wpilibj/src/main/java/edu/wpi/first/wpilibj/image/Image.java rename to wpilibj/wpilibJava/src/main/java/edu/wpi/first/wpilibj/image/Image.java diff --git a/wpilibj/src/main/java/edu/wpi/first/wpilibj/image/LinearAverages.java b/wpilibj/wpilibJava/src/main/java/edu/wpi/first/wpilibj/image/LinearAverages.java similarity index 100% rename from wpilibj/src/main/java/edu/wpi/first/wpilibj/image/LinearAverages.java rename to wpilibj/wpilibJava/src/main/java/edu/wpi/first/wpilibj/image/LinearAverages.java diff --git a/wpilibj/src/main/java/edu/wpi/first/wpilibj/image/MonoImage.java b/wpilibj/wpilibJava/src/main/java/edu/wpi/first/wpilibj/image/MonoImage.java similarity index 100% rename from wpilibj/src/main/java/edu/wpi/first/wpilibj/image/MonoImage.java rename to wpilibj/wpilibJava/src/main/java/edu/wpi/first/wpilibj/image/MonoImage.java diff --git a/wpilibj/src/main/java/edu/wpi/first/wpilibj/image/NIVision.java b/wpilibj/wpilibJava/src/main/java/edu/wpi/first/wpilibj/image/NIVision.java similarity index 100% rename from wpilibj/src/main/java/edu/wpi/first/wpilibj/image/NIVision.java rename to wpilibj/wpilibJava/src/main/java/edu/wpi/first/wpilibj/image/NIVision.java diff --git a/wpilibj/src/main/java/edu/wpi/first/wpilibj/image/NIVisionException.java b/wpilibj/wpilibJava/src/main/java/edu/wpi/first/wpilibj/image/NIVisionException.java similarity index 100% rename from wpilibj/src/main/java/edu/wpi/first/wpilibj/image/NIVisionException.java rename to wpilibj/wpilibJava/src/main/java/edu/wpi/first/wpilibj/image/NIVisionException.java diff --git a/wpilibj/src/main/java/edu/wpi/first/wpilibj/image/ParticleAnalysisReport.java b/wpilibj/wpilibJava/src/main/java/edu/wpi/first/wpilibj/image/ParticleAnalysisReport.java similarity index 100% rename from wpilibj/src/main/java/edu/wpi/first/wpilibj/image/ParticleAnalysisReport.java rename to wpilibj/wpilibJava/src/main/java/edu/wpi/first/wpilibj/image/ParticleAnalysisReport.java diff --git a/wpilibj/src/main/java/edu/wpi/first/wpilibj/image/RGBImage.java b/wpilibj/wpilibJava/src/main/java/edu/wpi/first/wpilibj/image/RGBImage.java similarity index 100% rename from wpilibj/src/main/java/edu/wpi/first/wpilibj/image/RGBImage.java rename to wpilibj/wpilibJava/src/main/java/edu/wpi/first/wpilibj/image/RGBImage.java diff --git a/wpilibj/src/main/java/edu/wpi/first/wpilibj/image/RegionOfInterest.java b/wpilibj/wpilibJava/src/main/java/edu/wpi/first/wpilibj/image/RegionOfInterest.java similarity index 100% rename from wpilibj/src/main/java/edu/wpi/first/wpilibj/image/RegionOfInterest.java rename to wpilibj/wpilibJava/src/main/java/edu/wpi/first/wpilibj/image/RegionOfInterest.java diff --git a/wpilibj/src/main/java/edu/wpi/first/wpilibj/image/ShapeDetectionOptions.java b/wpilibj/wpilibJava/src/main/java/edu/wpi/first/wpilibj/image/ShapeDetectionOptions.java similarity index 100% rename from wpilibj/src/main/java/edu/wpi/first/wpilibj/image/ShapeDetectionOptions.java rename to wpilibj/wpilibJava/src/main/java/edu/wpi/first/wpilibj/image/ShapeDetectionOptions.java diff --git a/wpilibj/src/main/java/edu/wpi/first/wpilibj/image/package.html b/wpilibj/wpilibJava/src/main/java/edu/wpi/first/wpilibj/image/package.html similarity index 100% rename from wpilibj/src/main/java/edu/wpi/first/wpilibj/image/package.html rename to wpilibj/wpilibJava/src/main/java/edu/wpi/first/wpilibj/image/package.html diff --git a/wpilibj/src/main/java/edu/wpi/first/wpilibj/livewindow/LiveWindow.java b/wpilibj/wpilibJava/src/main/java/edu/wpi/first/wpilibj/livewindow/LiveWindow.java similarity index 100% rename from wpilibj/src/main/java/edu/wpi/first/wpilibj/livewindow/LiveWindow.java rename to wpilibj/wpilibJava/src/main/java/edu/wpi/first/wpilibj/livewindow/LiveWindow.java diff --git a/wpilibj/src/main/java/edu/wpi/first/wpilibj/livewindow/LiveWindowSendable.java b/wpilibj/wpilibJava/src/main/java/edu/wpi/first/wpilibj/livewindow/LiveWindowSendable.java similarity index 100% rename from wpilibj/src/main/java/edu/wpi/first/wpilibj/livewindow/LiveWindowSendable.java rename to wpilibj/wpilibJava/src/main/java/edu/wpi/first/wpilibj/livewindow/LiveWindowSendable.java diff --git a/wpilibj/src/main/java/edu/wpi/first/wpilibj/package.html b/wpilibj/wpilibJava/src/main/java/edu/wpi/first/wpilibj/package.html similarity index 100% rename from wpilibj/src/main/java/edu/wpi/first/wpilibj/package.html rename to wpilibj/wpilibJava/src/main/java/edu/wpi/first/wpilibj/package.html diff --git a/wpilibj/src/main/java/edu/wpi/first/wpilibj/parsing/IDevice.java b/wpilibj/wpilibJava/src/main/java/edu/wpi/first/wpilibj/parsing/IDevice.java similarity index 100% rename from wpilibj/src/main/java/edu/wpi/first/wpilibj/parsing/IDevice.java rename to wpilibj/wpilibJava/src/main/java/edu/wpi/first/wpilibj/parsing/IDevice.java diff --git a/wpilibj/src/main/java/edu/wpi/first/wpilibj/parsing/IDeviceController.java b/wpilibj/wpilibJava/src/main/java/edu/wpi/first/wpilibj/parsing/IDeviceController.java similarity index 100% rename from wpilibj/src/main/java/edu/wpi/first/wpilibj/parsing/IDeviceController.java rename to wpilibj/wpilibJava/src/main/java/edu/wpi/first/wpilibj/parsing/IDeviceController.java diff --git a/wpilibj/src/main/java/edu/wpi/first/wpilibj/parsing/IInputOutput.java b/wpilibj/wpilibJava/src/main/java/edu/wpi/first/wpilibj/parsing/IInputOutput.java similarity index 100% rename from wpilibj/src/main/java/edu/wpi/first/wpilibj/parsing/IInputOutput.java rename to wpilibj/wpilibJava/src/main/java/edu/wpi/first/wpilibj/parsing/IInputOutput.java diff --git a/wpilibj/src/main/java/edu/wpi/first/wpilibj/parsing/IMechanism.java b/wpilibj/wpilibJava/src/main/java/edu/wpi/first/wpilibj/parsing/IMechanism.java similarity index 100% rename from wpilibj/src/main/java/edu/wpi/first/wpilibj/parsing/IMechanism.java rename to wpilibj/wpilibJava/src/main/java/edu/wpi/first/wpilibj/parsing/IMechanism.java diff --git a/wpilibj/src/main/java/edu/wpi/first/wpilibj/parsing/ISensor.java b/wpilibj/wpilibJava/src/main/java/edu/wpi/first/wpilibj/parsing/ISensor.java similarity index 100% rename from wpilibj/src/main/java/edu/wpi/first/wpilibj/parsing/ISensor.java rename to wpilibj/wpilibJava/src/main/java/edu/wpi/first/wpilibj/parsing/ISensor.java diff --git a/wpilibj/src/main/java/edu/wpi/first/wpilibj/parsing/IUtility.java b/wpilibj/wpilibJava/src/main/java/edu/wpi/first/wpilibj/parsing/IUtility.java similarity index 100% rename from wpilibj/src/main/java/edu/wpi/first/wpilibj/parsing/IUtility.java rename to wpilibj/wpilibJava/src/main/java/edu/wpi/first/wpilibj/parsing/IUtility.java diff --git a/wpilibj/src/main/java/edu/wpi/first/wpilibj/smartdashboard/SendableChooser.java b/wpilibj/wpilibJava/src/main/java/edu/wpi/first/wpilibj/smartdashboard/SendableChooser.java similarity index 100% rename from wpilibj/src/main/java/edu/wpi/first/wpilibj/smartdashboard/SendableChooser.java rename to wpilibj/wpilibJava/src/main/java/edu/wpi/first/wpilibj/smartdashboard/SendableChooser.java diff --git a/wpilibj/src/main/java/edu/wpi/first/wpilibj/smartdashboard/SmartDashboard.java b/wpilibj/wpilibJava/src/main/java/edu/wpi/first/wpilibj/smartdashboard/SmartDashboard.java similarity index 100% rename from wpilibj/src/main/java/edu/wpi/first/wpilibj/smartdashboard/SmartDashboard.java rename to wpilibj/wpilibJava/src/main/java/edu/wpi/first/wpilibj/smartdashboard/SmartDashboard.java diff --git a/wpilibj/src/main/java/edu/wpi/first/wpilibj/util/AllocationException.java b/wpilibj/wpilibJava/src/main/java/edu/wpi/first/wpilibj/util/AllocationException.java similarity index 100% rename from wpilibj/src/main/java/edu/wpi/first/wpilibj/util/AllocationException.java rename to wpilibj/wpilibJava/src/main/java/edu/wpi/first/wpilibj/util/AllocationException.java diff --git a/wpilibj/src/main/java/edu/wpi/first/wpilibj/util/BoundaryException.java b/wpilibj/wpilibJava/src/main/java/edu/wpi/first/wpilibj/util/BoundaryException.java similarity index 100% rename from wpilibj/src/main/java/edu/wpi/first/wpilibj/util/BoundaryException.java rename to wpilibj/wpilibJava/src/main/java/edu/wpi/first/wpilibj/util/BoundaryException.java diff --git a/wpilibj/src/main/java/edu/wpi/first/wpilibj/util/CheckedAllocationException.java b/wpilibj/wpilibJava/src/main/java/edu/wpi/first/wpilibj/util/CheckedAllocationException.java similarity index 100% rename from wpilibj/src/main/java/edu/wpi/first/wpilibj/util/CheckedAllocationException.java rename to wpilibj/wpilibJava/src/main/java/edu/wpi/first/wpilibj/util/CheckedAllocationException.java diff --git a/wpilibj/src/main/java/edu/wpi/first/wpilibj/util/SortedVector.java b/wpilibj/wpilibJava/src/main/java/edu/wpi/first/wpilibj/util/SortedVector.java similarity index 100% rename from wpilibj/src/main/java/edu/wpi/first/wpilibj/util/SortedVector.java rename to wpilibj/wpilibJava/src/main/java/edu/wpi/first/wpilibj/util/SortedVector.java diff --git a/wpilibj/src/main/java/edu/wpi/first/wpilibj/util/UncleanStatusException.java b/wpilibj/wpilibJava/src/main/java/edu/wpi/first/wpilibj/util/UncleanStatusException.java similarity index 100% rename from wpilibj/src/main/java/edu/wpi/first/wpilibj/util/UncleanStatusException.java rename to wpilibj/wpilibJava/src/main/java/edu/wpi/first/wpilibj/util/UncleanStatusException.java diff --git a/wpilibj/src/main/java/edu/wpi/first/wpilibj/visa/Visa.java b/wpilibj/wpilibJava/src/main/java/edu/wpi/first/wpilibj/visa/Visa.java similarity index 100% rename from wpilibj/src/main/java/edu/wpi/first/wpilibj/visa/Visa.java rename to wpilibj/wpilibJava/src/main/java/edu/wpi/first/wpilibj/visa/Visa.java diff --git a/wpilibj/src/main/java/edu/wpi/first/wpilibj/visa/VisaException.java b/wpilibj/wpilibJava/src/main/java/edu/wpi/first/wpilibj/visa/VisaException.java similarity index 100% rename from wpilibj/src/main/java/edu/wpi/first/wpilibj/visa/VisaException.java rename to wpilibj/wpilibJava/src/main/java/edu/wpi/first/wpilibj/visa/VisaException.java diff --git a/wpilibj/src/main/java/edu/wpi/first/wpilibj/visa/package.html b/wpilibj/wpilibJava/src/main/java/edu/wpi/first/wpilibj/visa/package.html similarity index 100% rename from wpilibj/src/main/java/edu/wpi/first/wpilibj/visa/package.html rename to wpilibj/wpilibJava/src/main/java/edu/wpi/first/wpilibj/visa/package.html diff --git a/wpilibj/wpilibJavaFinal/pom.xml b/wpilibj/wpilibJavaFinal/pom.xml new file mode 100644 index 0000000000..aa31593aa4 --- /dev/null +++ b/wpilibj/wpilibJavaFinal/pom.xml @@ -0,0 +1,121 @@ + + + 4.0.0 + edu.wpi.first.wpilibj + wpilibJavaFinal + jar + 0.1.0-SNAPSHOT + + + edu.wpi.first.wpilib.templates.athena + library-jar + 0.1.0-SNAPSHOT + ../../maven-utilities/athena/library-jar + + + + + + + + + + + + + edu.wpi.first.wpilibj + wpilibJava + 0.1.0-SNAPSHOT + + + edu.wpi.first.wpilibj + wpilibJavaJNI + 0.1.0-SNAPSHOT + so + + + + + + + org.apache.maven.plugins + maven-dependency-plugin + 2.8 + + + unpack + generate-sources + + unpack + + + + + edu.wpi.first.wpilibj + wpilibJava + 0.1.0-SNAPSHOT + jar + + + ${project.build.directory}/classes + + + + fetch-dependencies + generate-sources + + copy + + + + + edu.wpi.first.wpilibj + wpilibJavaJNI + 0.1.0-SNAPSHOT + so + libwpilibJavaJNI.so + ${project.build.directory}/classes/linux-arm + + + + false + true + + + + + + org.apache.maven.plugins + maven-install-plugin + 2.5.1 + + + install-jar + install + + install + + + + + + + diff --git a/wpilibj/wpilibJavaJNI/pom.xml b/wpilibj/wpilibJavaJNI/pom.xml new file mode 100644 index 0000000000..6520ee338d --- /dev/null +++ b/wpilibj/wpilibJavaJNI/pom.xml @@ -0,0 +1,112 @@ + + + 4.0.0 + wpilibJavaJNI + edu.wpi.first.wpilibj + 0.1.0-SNAPSHOT + so + + + edu.wpi.first.wpilib.templates.athena + shared-library + 0.1.0-SNAPSHOT + ../../maven-utilities/athena/shared-library + + + + + com.ni.first.libraries + libFRC_NetworkCommunication + so + 0.1.0-SNAPSHOT + + + edu.wpi.first.wpilib.hal + libHALAthena + 0.1.0-SNAPSHOT + a + + + edu.wpi.first.wpilib.hal + include + 0.1.0-SNAPSHOT + inczip + + + edu.wpi.first.wpilibj + wpilibJava + 0.1.0-SNAPSHOT + jar + + + + + + + + + + + + + + org.codehaus.mojo + native-maven-plugin + 1.0-alpha-7 + true + + linux + C:\Users/charris/embeddedJDK/jdk-7u45-linux-arm-vfp-sflt/jdk1.7.0_45/include + + + src/main/native + + **/*.cpp + + + + + + + javah + generate-sources + + + + edu.wpi.first.wpilibj.can.CANJNI + edu.wpi.first.wpilibj.communication.FRCNetworkCommunicationsLibrary + edu.wpi.first.wpilibj.hal.HALUtil + edu.wpi.first.wpilibj.hal.JNIWrapper + edu.wpi.first.wpilibj.hal.AnalogJNI + edu.wpi.first.wpilibj.hal.CounterJNI + edu.wpi.first.wpilibj.hal.DIOJNI + edu.wpi.first.wpilibj.hal.EncoderJNI + edu.wpi.first.wpilibj.hal.I2CJNI + edu.wpi.first.wpilibj.hal.InterruptJNI + edu.wpi.first.wpilibj.hal.PWMJNI + edu.wpi.first.wpilibj.hal.RelayJNI + edu.wpi.first.wpilibj.hal.SPIJNI + edu.wpi.first.wpilibj.hal.WatchdogJNI + + + + + linux + ${project.build.directory}/jni/include + default + true + + + javah + + + + + + + + diff --git a/wpilibj/wpilibJavaJNI/src/main/native/AnalogJNI.cpp b/wpilibj/wpilibJavaJNI/src/main/native/AnalogJNI.cpp new file mode 100644 index 0000000000..ff2fe7361c --- /dev/null +++ b/wpilibj/wpilibJavaJNI/src/main/native/AnalogJNI.cpp @@ -0,0 +1,484 @@ +#include +#include +#include "log.h" + +#include "edu_wpi_first_wpilibj_hal_AnalogJNI.h" + +#include "HAL/Analog.h" + +// set the logging level +TLogLevel analogJNILogLevel = logDEBUG; + +#define ANALOGJNI_LOG(level) \ + if (level > analogJNILogLevel) ; \ + else Log().Get(level) + +/* + * Class: edu_wpi_first_wpilibj_hal_AnalogJNI + * Method: initializeAnalogPort + * Signature: (Ljava/nio/ByteBuffer;Ljava/nio/IntBuffer;)Ljava/nio/ByteBuffer; + */ +JNIEXPORT jobject JNICALL Java_edu_wpi_first_wpilibj_hal_AnalogJNI_initializeAnalogPort + (JNIEnv * env, jclass, jobject id, jobject status) +{ + void ** javaId = (void**)env->GetDirectBufferAddress(id); + ANALOGJNI_LOG(logDEBUG) << "Port Ptr = " << *javaId; + jint * statusPtr = (jint*)env->GetDirectBufferAddress(status); + ANALOGJNI_LOG(logDEBUG) << "Status Ptr = " << statusPtr; + void** analogPtr = (void**)new unsigned char[4]; + *analogPtr = initializeAnalogPort(*javaId, statusPtr); + ANALOGJNI_LOG(logDEBUG) << "Status = " << *statusPtr; + ANALOGJNI_LOG(logDEBUG) << "Analog Ptr = " << *analogPtr; + return env->NewDirectByteBuffer( analogPtr, 4); +} + +/* + * Class: edu_wpi_first_wpilibj_hal_AnalogJNI + * Method: checkAnalogModule + * Signature: (B)B + */ +JNIEXPORT jbyte JNICALL Java_edu_wpi_first_wpilibj_hal_AnalogJNI_checkAnalogModule + (JNIEnv *, jclass, jbyte value) +{ + //ANALOGJNI_LOG(logDEBUG) << "Module = " << (jint)value; + jbyte returnValue = checkAnalogModule( value ); + //ANALOGJNI_LOG(logDEBUG) << "checkAnalogModuleResult = " << (jint)returnValue; + return returnValue; +} + +/* + * Class: edu_wpi_first_wpilibj_hal_AnalogJNI + * Method: checkAnalogChannel + * Signature: (I)B + */ +JNIEXPORT jbyte JNICALL Java_edu_wpi_first_wpilibj_hal_AnalogJNI_checkAnalogChannel + (JNIEnv *, jclass, jint value) +{ + //ANALOGJNI_LOG(logDEBUG) << "Channel = " << value; + jbyte returnValue = checkAnalogChannel( value ); + //ANALOGJNI_LOG(logDEBUG) << "checkAnalogChannelResult = " << (jint)returnValue; + return returnValue; +} + +/* + * Class: edu_wpi_first_wpilibj_hal_AnalogJNI + * Method: setAnalogSampleRate + * Signature: (DLjava/nio/IntBuffer;)V + */ +JNIEXPORT void JNICALL Java_edu_wpi_first_wpilibj_hal_AnalogJNI_setAnalogSampleRate + (JNIEnv * env, jclass, jdouble value, jobject status) +{ + ANALOGJNI_LOG(logDEBUG) << "SampleRate = " << value; + jint * statusPtr = (jint*)env->GetDirectBufferAddress(status); + setAnalogSampleRate( value, statusPtr ); + ANALOGJNI_LOG(logDEBUG) << "Status = " << *statusPtr; +} + +/* + * Class: edu_wpi_first_wpilibj_hal_AnalogJNI + * Method: getAnalogSampleRate + * Signature: (Ljava/nio/IntBuffer;)D + */ +JNIEXPORT jdouble JNICALL Java_edu_wpi_first_wpilibj_hal_AnalogJNI_getAnalogSampleRate + (JNIEnv * env, jclass, jobject status) +{ + jint * statusPtr = (jint*)env->GetDirectBufferAddress(status); + double returnValue = getAnalogSampleRate( statusPtr ); + ANALOGJNI_LOG(logDEBUG) << "Status = " << *statusPtr; + ANALOGJNI_LOG(logDEBUG) << "SampleRate = " << returnValue; + return returnValue; +} + +/* + * Class: edu_wpi_first_wpilibj_hal_AnalogJNI + * Method: setAnalogSampleRateWithModule + * Signature: (BDLjava/nio/IntBuffer;)V + */ +JNIEXPORT void JNICALL Java_edu_wpi_first_wpilibj_hal_AnalogJNI_setAnalogSampleRateWithModule + (JNIEnv * env, jclass, jbyte module, jdouble value, jobject status) +{ + ANALOGJNI_LOG(logDEBUG) << "Module = " << (jint)module; + ANALOGJNI_LOG(logDEBUG) << "SampleRate = " << value; + jint * statusPtr = (jint*)env->GetDirectBufferAddress(status); + setAnalogSampleRateWithModule( module, value, statusPtr ); + ANALOGJNI_LOG(logDEBUG) << "Status = " << *statusPtr; +} + +/* + * Class: edu_wpi_first_wpilibj_hal_AnalogJNI + * Method: getAnalogSampleRateWithModule + * Signature: (BLjava/nio/IntBuffer;)D + */ +JNIEXPORT jdouble JNICALL Java_edu_wpi_first_wpilibj_hal_AnalogJNI_getAnalogSampleRateWithModule + (JNIEnv * env, jclass, jbyte module, jobject status) +{ + ANALOGJNI_LOG(logDEBUG) << "Module = " << (jint)module; + jint * statusPtr = (jint*)env->GetDirectBufferAddress(status); + double returnValue = getAnalogSampleRateWithModule( module, statusPtr ); + ANALOGJNI_LOG(logDEBUG) << "Status = " << *statusPtr; + ANALOGJNI_LOG(logDEBUG) << "SampleRate = " << returnValue; + return returnValue; +} + +/* + * Class: edu_wpi_first_wpilibj_hal_AnalogJNI + * Method: setAnalogAverageBits + * Signature: (Ljava/nio/ByteBuffer;ILjava/nio/IntBuffer;)V + */ +JNIEXPORT void JNICALL Java_edu_wpi_first_wpilibj_hal_AnalogJNI_setAnalogAverageBits + (JNIEnv * env, jclass, jobject id, jint value, jobject status) +{ + ANALOGJNI_LOG(logDEBUG) << "AverageBits = " << value; + void ** javaId = (void**)env->GetDirectBufferAddress(id); + ANALOGJNI_LOG(logDEBUG) << "Analog Ptr = " << *javaId; + jint * statusPtr = (jint*)env->GetDirectBufferAddress(status); + setAnalogAverageBits( *javaId, value, statusPtr ); + ANALOGJNI_LOG(logDEBUG) << "Status = " << *statusPtr; +} + +/* + * Class: edu_wpi_first_wpilibj_hal_AnalogJNI + * Method: getAnalogAverageBits + * Signature: (Ljava/nio/ByteBuffer;Ljava/nio/IntBuffer;)I + */ +JNIEXPORT jint JNICALL Java_edu_wpi_first_wpilibj_hal_AnalogJNI_getAnalogAverageBits + (JNIEnv * env, jclass, jobject id, jobject status) +{ + void ** javaId = (void**)env->GetDirectBufferAddress(id); + ANALOGJNI_LOG(logDEBUG) << "Analog Ptr = " << *javaId; + jint * statusPtr = (jint*)env->GetDirectBufferAddress(status); + jint returnValue = getAnalogAverageBits( *javaId, statusPtr ); + ANALOGJNI_LOG(logDEBUG) << "Status = " << *statusPtr; + ANALOGJNI_LOG(logDEBUG) << "AverageBits = " << returnValue; + return returnValue; +} + +/* + * Class: edu_wpi_first_wpilibj_hal_AnalogJNI + * Method: setAnalogOversampleBits + * Signature: (Ljava/nio/ByteBuffer;ILjava/nio/IntBuffer;)V + */ +JNIEXPORT void JNICALL Java_edu_wpi_first_wpilibj_hal_AnalogJNI_setAnalogOversampleBits + (JNIEnv * env, jclass, jobject id, jint value, jobject status) +{ + ANALOGJNI_LOG(logDEBUG) << "OversampleBits = " << value; + void ** javaId = (void**)env->GetDirectBufferAddress(id); + ANALOGJNI_LOG(logDEBUG) << "Analog Ptr = " << *javaId; + jint * statusPtr = (jint*)env->GetDirectBufferAddress(status); + setAnalogOversampleBits( *javaId, value, statusPtr ); + ANALOGJNI_LOG(logDEBUG) << "Status = " << *statusPtr; +} + +/* + * Class: edu_wpi_first_wpilibj_hal_AnalogJNI + * Method: getAnalogOversampleBits + * Signature: (Ljava/nio/ByteBuffer;Ljava/nio/IntBuffer;)I + */ +JNIEXPORT jint JNICALL Java_edu_wpi_first_wpilibj_hal_AnalogJNI_getAnalogOversampleBits + (JNIEnv * env, jclass, jobject id, jobject status) +{ + void ** javaId = (void**)env->GetDirectBufferAddress(id); + ANALOGJNI_LOG(logDEBUG) << "Analog Ptr = " << *javaId; + jint * statusPtr = (jint*)env->GetDirectBufferAddress(status); + jint returnValue = getAnalogOversampleBits( *javaId, statusPtr ); + ANALOGJNI_LOG(logDEBUG) << "Status = " << *statusPtr; + ANALOGJNI_LOG(logDEBUG) << "OversampleBits = " << returnValue; + return returnValue; +} + +/* + * Class: edu_wpi_first_wpilibj_hal_AnalogJNI + * Method: getAnalogValue + * Signature: (Ljava/nio/ByteBuffer;Ljava/nio/IntBuffer;)S + */ +JNIEXPORT jshort JNICALL Java_edu_wpi_first_wpilibj_hal_AnalogJNI_getAnalogValue + (JNIEnv * env, jclass, jobject id, jobject status) +{ + void ** javaId = (void**)env->GetDirectBufferAddress(id); + //ANALOGJNI_LOG(logDEBUG) << "Analog Ptr = " << *javaId; + jint * statusPtr = (jint*)env->GetDirectBufferAddress(status); + jshort returnValue = getAnalogValue( *javaId, statusPtr ); + //ANALOGJNI_LOG(logDEBUG) << "Status = " << *statusPtr; + //ANALOGJNI_LOG(logDEBUG) << "Value = " << returnValue; + return returnValue; +} + +/* + * Class: edu_wpi_first_wpilibj_hal_AnalogJNI + * Method: getAnalogAverageValue + * Signature: (Ljava/nio/ByteBuffer;Ljava/nio/IntBuffer;)I + */ +JNIEXPORT jint JNICALL Java_edu_wpi_first_wpilibj_hal_AnalogJNI_getAnalogAverageValue + (JNIEnv * env, jclass, jobject id, jobject status) +{ + void ** javaId = (void**)env->GetDirectBufferAddress(id); + ANALOGJNI_LOG(logDEBUG) << "Analog Ptr = " << *javaId; + jint * statusPtr = (jint*)env->GetDirectBufferAddress(status); + jint returnValue = getAnalogAverageValue( *javaId, statusPtr ); + ANALOGJNI_LOG(logDEBUG) << "Status = " << *statusPtr; + ANALOGJNI_LOG(logDEBUG) << "AverageValue = " << returnValue; + return returnValue; +} + +/* + * Class: edu_wpi_first_wpilibj_hal_AnalogJNI + * Method: getAnalogVoltsToValue + * Signature: (Ljava/nio/ByteBuffer;DLjava/nio/IntBuffer;)I + */ +JNIEXPORT jint JNICALL Java_edu_wpi_first_wpilibj_hal_AnalogJNI_getAnalogVoltsToValue + (JNIEnv * env, jclass, jobject id, jdouble voltageValue, jobject status) +{ + void ** javaId = (void**)env->GetDirectBufferAddress(id); + ANALOGJNI_LOG(logDEBUG) << "Analog Ptr = " << *javaId; + ANALOGJNI_LOG(logDEBUG) << "VoltageValue = " << voltageValue; + jint * statusPtr = (jint*)env->GetDirectBufferAddress(status); + jint returnValue = getAnalogVoltsToValue( *javaId, voltageValue, statusPtr ); + ANALOGJNI_LOG(logDEBUG) << "Status = " << *statusPtr; + ANALOGJNI_LOG(logDEBUG) << "Value = " << returnValue; + return returnValue; +} + +/* + * Class: edu_wpi_first_wpilibj_hal_AnalogJNI + * Method: getAnalogVoltage + * Signature: (Ljava/nio/ByteBuffer;Ljava/nio/IntBuffer;)D + */ +JNIEXPORT jdouble JNICALL Java_edu_wpi_first_wpilibj_hal_AnalogJNI_getAnalogVoltage + (JNIEnv * env, jclass, jobject id, jobject status) +{ + void ** javaId = (void**)env->GetDirectBufferAddress(id); + //ANALOGJNI_LOG(logDEBUG) << "Analog Ptr = " << *javaId; + jint * statusPtr = (jint*)env->GetDirectBufferAddress(status); + jdouble returnValue = getAnalogVoltage( *javaId, statusPtr ); + //ANALOGJNI_LOG(logDEBUG) << "Status = " << *statusPtr; + //ANALOGJNI_LOG(logDEBUG) << "Voltage = " << returnValue; + return returnValue; +} + +/* + * Class: edu_wpi_first_wpilibj_hal_AnalogJNI + * Method: getAnalogAverageVoltage + * Signature: (Ljava/nio/ByteBuffer;Ljava/nio/IntBuffer;)D + */ +JNIEXPORT jdouble JNICALL Java_edu_wpi_first_wpilibj_hal_AnalogJNI_getAnalogAverageVoltage + (JNIEnv * env, jclass, jobject id, jobject status) +{ + void ** javaId = (void**)env->GetDirectBufferAddress(id); + ANALOGJNI_LOG(logDEBUG) << "Analog Ptr = " << *javaId; + jint * statusPtr = (jint*)env->GetDirectBufferAddress(status); + jdouble returnValue = getAnalogAverageVoltage( *javaId, statusPtr ); + ANALOGJNI_LOG(logDEBUG) << "Status = " << *statusPtr; + ANALOGJNI_LOG(logDEBUG) << "AverageVoltage = " << returnValue; + return returnValue; +} + +/* + * Class: edu_wpi_first_wpilibj_hal_AnalogJNI + * Method: getAnalogLSBWeight + * Signature: (Ljava/nio/ByteBuffer;Ljava/nio/IntBuffer;)I + */ +JNIEXPORT jint JNICALL Java_edu_wpi_first_wpilibj_hal_AnalogJNI_getAnalogLSBWeight + (JNIEnv *, jclass, jobject, jobject) +{ + assert(false); +} + +/* + * Class: edu_wpi_first_wpilibj_hal_AnalogJNI + * Method: getAnalogOffset + * Signature: (Ljava/nio/ByteBuffer;Ljava/nio/IntBuffer;)I + */ +JNIEXPORT jint JNICALL Java_edu_wpi_first_wpilibj_hal_AnalogJNI_getAnalogOffset + (JNIEnv *, jclass, jobject, jobject) +{ + assert(false); +} + +/* + * Class: edu_wpi_first_wpilibj_hal_AnalogJNI + * Method: isAccumulatorChannel + * Signature: (Ljava/nio/ByteBuffer;Ljava/nio/IntBuffer;)B + */ +JNIEXPORT jbyte JNICALL Java_edu_wpi_first_wpilibj_hal_AnalogJNI_isAccumulatorChannel + (JNIEnv *, jclass, jobject, jobject) +{ + assert(false); +} + +/* + * Class: edu_wpi_first_wpilibj_hal_AnalogJNI + * Method: initAccumulator + * Signature: (Ljava/nio/ByteBuffer;Ljava/nio/IntBuffer;)V + */ +JNIEXPORT void JNICALL Java_edu_wpi_first_wpilibj_hal_AnalogJNI_initAccumulator + (JNIEnv *, jclass, jobject, jobject) +{ + assert(false); +} + +/* + * Class: edu_wpi_first_wpilibj_hal_AnalogJNI + * Method: resetAccumulator + * Signature: (Ljava/nio/ByteBuffer;Ljava/nio/IntBuffer;)V + */ +JNIEXPORT void JNICALL Java_edu_wpi_first_wpilibj_hal_AnalogJNI_resetAccumulator + (JNIEnv *, jclass, jobject, jobject) +{ + assert(false); +} + +/* + * Class: edu_wpi_first_wpilibj_hal_AnalogJNI + * Method: setAccumulatorCenter + * Signature: (Ljava/nio/ByteBuffer;ILjava/nio/IntBuffer;)V + */ +JNIEXPORT void JNICALL Java_edu_wpi_first_wpilibj_hal_AnalogJNI_setAccumulatorCenter + (JNIEnv *, jclass, jobject, jint, jobject) +{ + assert(false); +} + +/* + * Class: edu_wpi_first_wpilibj_hal_AnalogJNI + * Method: setAccumulatorDeadband + * Signature: (Ljava/nio/ByteBuffer;ILjava/nio/IntBuffer;)V + */ +JNIEXPORT void JNICALL Java_edu_wpi_first_wpilibj_hal_AnalogJNI_setAccumulatorDeadband + (JNIEnv *, jclass, jobject, jint, jobject) +{ + assert(false); +} + +/* + * Class: edu_wpi_first_wpilibj_hal_AnalogJNI + * Method: getAccumulatorValue + * Signature: (Ljava/nio/ByteBuffer;Ljava/nio/IntBuffer;)J + */ +JNIEXPORT jlong JNICALL Java_edu_wpi_first_wpilibj_hal_AnalogJNI_getAccumulatorValue + (JNIEnv *, jclass, jobject, jobject) +{ + assert(false); +} + +/* + * Class: edu_wpi_first_wpilibj_hal_AnalogJNI + * Method: getAccumulatorCount + * Signature: (Ljava/nio/ByteBuffer;Ljava/nio/IntBuffer;)I + */ +JNIEXPORT jint JNICALL Java_edu_wpi_first_wpilibj_hal_AnalogJNI_getAccumulatorCount + (JNIEnv *, jclass, jobject, jobject) +{ + assert(false); +} + +/* + * Class: edu_wpi_first_wpilibj_hal_AnalogJNI + * Method: getAccumulatorOutput + * Signature: (Ljava/nio/ByteBuffer;Ljava/nio/LongBuffer;Ljava/nio/IntBuffer;Ljava/nio/IntBuffer;)V + */ +JNIEXPORT void JNICALL Java_edu_wpi_first_wpilibj_hal_AnalogJNI_getAccumulatorOutput + (JNIEnv *, jclass, jobject, jobject, jobject, jobject) +{ + assert(false); +} + +/* + * Class: edu_wpi_first_wpilibj_hal_AnalogJNI + * Method: initializeAnalogTrigger + * Signature: (Ljava/nio/ByteBuffer;Ljava/nio/IntBuffer;Ljava/nio/IntBuffer;)Ljava/nio/ByteBuffer; + */ +JNIEXPORT jobject JNICALL Java_edu_wpi_first_wpilibj_hal_AnalogJNI_initializeAnalogTrigger + (JNIEnv *, jclass, jobject, jobject, jobject) +{ + assert(false); +} + +/* + * Class: edu_wpi_first_wpilibj_hal_AnalogJNI + * Method: cleanAnalogTrigger + * Signature: (Ljava/nio/ByteBuffer;Ljava/nio/IntBuffer;)V + */ +JNIEXPORT void JNICALL Java_edu_wpi_first_wpilibj_hal_AnalogJNI_cleanAnalogTrigger + (JNIEnv *, jclass, jobject, jobject) +{ + assert(false); +} + +/* + * Class: edu_wpi_first_wpilibj_hal_AnalogJNI + * Method: setAnalogTriggerLimitsRaw + * Signature: (Ljava/nio/ByteBuffer;IILjava/nio/IntBuffer;)V + */ +JNIEXPORT void JNICALL Java_edu_wpi_first_wpilibj_hal_AnalogJNI_setAnalogTriggerLimitsRaw + (JNIEnv *, jclass, jobject, jint, jint, jobject) +{ + assert(false); +} + +/* + * Class: edu_wpi_first_wpilibj_hal_AnalogJNI + * Method: setAnalogTriggerLimitsVoltage + * Signature: (Ljava/nio/ByteBuffer;DDLjava/nio/IntBuffer;)V + */ +JNIEXPORT void JNICALL Java_edu_wpi_first_wpilibj_hal_AnalogJNI_setAnalogTriggerLimitsVoltage + (JNIEnv *, jclass, jobject, jdouble, jdouble, jobject) +{ + assert(false); +} + +/* + * Class: edu_wpi_first_wpilibj_hal_AnalogJNI + * Method: setAnalogTriggerAveraged + * Signature: (Ljava/nio/ByteBuffer;BLjava/nio/IntBuffer;)V + */ +JNIEXPORT void JNICALL Java_edu_wpi_first_wpilibj_hal_AnalogJNI_setAnalogTriggerAveraged + (JNIEnv *, jclass, jobject, jbyte, jobject) +{ + assert(false); +} + +/* + * Class: edu_wpi_first_wpilibj_hal_AnalogJNI + * Method: setAnalogTriggerFiltered + * Signature: (Ljava/nio/ByteBuffer;BLjava/nio/IntBuffer;)V + */ +JNIEXPORT void JNICALL Java_edu_wpi_first_wpilibj_hal_AnalogJNI_setAnalogTriggerFiltered + (JNIEnv *, jclass, jobject, jbyte, jobject) +{ + assert(false); +} + +/* + * Class: edu_wpi_first_wpilibj_hal_AnalogJNI + * Method: getAnalogTriggerInWindow + * Signature: (Ljava/nio/ByteBuffer;Ljava/nio/IntBuffer;)B + */ +JNIEXPORT jbyte JNICALL Java_edu_wpi_first_wpilibj_hal_AnalogJNI_getAnalogTriggerInWindow + (JNIEnv *, jclass, jobject, jobject) +{ + assert(false); +} + +/* + * Class: edu_wpi_first_wpilibj_hal_AnalogJNI + * Method: getAnalogTriggerTriggerState + * Signature: (Ljava/nio/ByteBuffer;Ljava/nio/IntBuffer;)B + */ +JNIEXPORT jbyte JNICALL Java_edu_wpi_first_wpilibj_hal_AnalogJNI_getAnalogTriggerTriggerState + (JNIEnv *, jclass, jobject, jobject) +{ + assert(false); + +} + +/* + * Class: edu_wpi_first_wpilibj_hal_AnalogJNI + * Method: getAnalogTriggerOutput + * Signature: (Ljava/nio/ByteBuffer;ILjava/nio/IntBuffer;)B + */ +JNIEXPORT jbyte JNICALL Java_edu_wpi_first_wpilibj_hal_AnalogJNI_getAnalogTriggerOutput + (JNIEnv *, jclass, jobject, jint, jobject) +{ + assert(false); + +} diff --git a/wpilibj/wpilibJavaJNI/src/main/native/CANJNI.cpp b/wpilibj/wpilibJavaJNI/src/main/native/CANJNI.cpp new file mode 100644 index 0000000000..9d619ae1b7 --- /dev/null +++ b/wpilibj/wpilibJavaJNI/src/main/native/CANJNI.cpp @@ -0,0 +1,99 @@ +#include +#include +#include "log.h" + +#include "edu_wpi_first_wpilibj_can_CANJNI.h" + +#include "HAL/CAN.h" + +// set the logging level +TLogLevel canJNILogLevel = logDEBUG; + +#define CANJNI_LOG(level) \ + if (level > canJNILogLevel) ; \ + else Log().Get(level) + +/* + * Class: edu_wpi_first_wpilibj_can_CANJNI + * Method: FRCNetworkCommunicationJaguarCANDriverSendMessage + * Signature: (I[BBLjava/nio/IntBuffer;)V + */ +JNIEXPORT void JNICALL Java_edu_wpi_first_wpilibj_can_CANJNI_FRCNetworkCommunicationJaguarCANDriverSendMessage + (JNIEnv *env, jclass, jint messageID, jobject data, jobject status) +{ + CANJNI_LOG(logDEBUG) << "Calling CANJNI JaguarCANDriverSendMessage"; + CANJNI_LOG(logDEBUG) << "MessageID = " << std::hex << messageID; + jbyte * dataPtr = NULL; + jlong dataCapacity = 0; + + if(data != 0) + { + dataPtr = (jbyte*)env->GetDirectBufferAddress(data); + dataCapacity = env->GetDirectBufferCapacity(data); + } + CANJNI_LOG(logDEBUG) << "MessageSize = " << dataCapacity; + + if( logDEBUG <= canJNILogLevel ) + { + std::ostringstream str; + str << std::setfill('0') << std::hex; + for( int dataIndex = 0; dataIndex < dataCapacity; dataIndex++) + { + str << std::setw(2) << static_cast(dataPtr[dataIndex]) << " "; + } + Log().Get(logDEBUG) << "MSG: " << str.str(); + } + + jint * statusPtr = (jint*)env->GetDirectBufferAddress(status); + //CANJNI_LOG(logDEBUG) << "Status Ptr = " << statusPtr; + JaguarCANSendMessage((uint32_t) messageID, (const uint8_t*)dataPtr, (uint8_t)dataCapacity, statusPtr); + CANJNI_LOG(logDEBUG) << "Status = " << *statusPtr; +} + +/* + * Class: edu_wpi_first_wpilibj_can_CANJNI + * Method: FRCNetworkCommunicationJaguarCANDriverReceiveMessage + * Signature: (Ljava/nio/IntBuffer;Ljava/nio/ByteBuffer;Ljava/nio/ByteBuffer;ILjava/nio/IntBuffer;)V + */ +JNIEXPORT jobject JNICALL Java_edu_wpi_first_wpilibj_can_CANJNI_FRCNetworkCommunicationJaguarCANDriverReceiveMessage + (JNIEnv * env, jclass, jobject messageID, jint timeout, jobject status) +{ + CANJNI_LOG(logDEBUG) << "Calling CANJNI JaguarCANDriverReceiveMessage"; + jint * messageIDPtr = (jint*)env->GetDirectBufferAddress(messageID); + CANJNI_LOG(logDEBUG) << "MessageID In = " << std::hex << *messageIDPtr; + CANJNI_LOG(logDEBUG) << "Timeout = " << timeout; + jint * statusPtr = (jint*)env->GetDirectBufferAddress(status); + //CANJNI_LOG(logDEBUG) << "Status Ptr = " << statusPtr; + uint8_t dataSize = 8; + jbyte* dataPtr = new jbyte[8]; + //CANJNI_LOG(logDEBUG) << "Original MessageSize = " << (jint)dataSize; + //CANJNI_LOG(logDEBUG) << "Original MessagePtr = " << (jint*)dataPtr; + JaguarCANReceiveMessage((uint32_t*)messageIDPtr, (uint8_t*)dataPtr, &dataSize, timeout, statusPtr); + + //CANJNI_LOG(logDEBUG) << "MessageID Out = " << std::hex << *messageIDPtr; + CANJNI_LOG(logDEBUG) << "MessageSize = " << (jint)dataSize; + CANJNI_LOG(logDEBUG) << "MessagePtr = " << (jint*)dataPtr; + + if( logDEBUG <= canJNILogLevel ) + { + std::ostringstream str; + str << std::setfill('0') << std::hex; + for( int dataIndex = 0; dataIndex < dataSize; dataIndex++) + { + str << std::setw(2) << static_cast(dataPtr[dataIndex]) << " "; + } + Log().Get(logDEBUG) << "MSG: " << str.str(); + } + + CANJNI_LOG(logDEBUG) << "Status = " << *statusPtr; + + if( dataSize > 0 ) + { + return env->NewDirectByteBuffer( dataPtr, dataSize); + } + else + { + return 0; + } +} + diff --git a/wpilibj/wpilibJavaJNI/src/main/native/CounterJNI.cpp b/wpilibj/wpilibJavaJNI/src/main/native/CounterJNI.cpp new file mode 100644 index 0000000000..26ad9430be --- /dev/null +++ b/wpilibj/wpilibJavaJNI/src/main/native/CounterJNI.cpp @@ -0,0 +1,471 @@ +#include +#include +#include "log.h" + +#include "edu_wpi_first_wpilibj_hal_CounterJNI.h" + +#include "HAL/Digital.h" + +// set the logging level +TLogLevel counterJNILogLevel = logDEBUG; + +#define COUNTERJNI_LOG(level) \ + if (level > counterJNILogLevel) ; \ + else Log().Get(level) + +/* + * Class: edu_wpi_first_wpilibj_hal_CounterJNI + * Method: initializeCounter + * Signature: (ILjava/nio/IntBuffer;Ljava/nio/IntBuffer;)Ljava/nio/ByteBuffer; + */ +JNIEXPORT jobject JNICALL Java_edu_wpi_first_wpilibj_hal_CounterJNI_initializeCounter + (JNIEnv * env, jclass, jint mode, jobject index, jobject status) +{ + COUNTERJNI_LOG(logDEBUG) << "Calling COUNTERJNI initializeCounter"; + COUNTERJNI_LOG(logDEBUG) << "Mode = " << mode; + jint * indexPtr = (jint*)env->GetDirectBufferAddress(index); + COUNTERJNI_LOG(logDEBUG) << "Index Ptr = " << indexPtr; + jint * statusPtr = (jint*)env->GetDirectBufferAddress(status); + COUNTERJNI_LOG(logDEBUG) << "Status Ptr = " << statusPtr; + void** counterPtr = (void**)new unsigned char[4]; + *counterPtr = initializeCounter((Mode)mode, (uint32_t*)indexPtr, statusPtr); + COUNTERJNI_LOG(logDEBUG) << "Index = " << *indexPtr; + COUNTERJNI_LOG(logDEBUG) << "Status = " << *statusPtr; + COUNTERJNI_LOG(logDEBUG) << "COUNTER Ptr = " << *counterPtr; + return env->NewDirectByteBuffer( counterPtr, 4); +} + +/* + * Class: edu_wpi_first_wpilibj_hal_CounterJNI + * Method: freeCounter + * Signature: (Ljava/nio/ByteBuffer;Ljava/nio/IntBuffer;)V + */ +JNIEXPORT void JNICALL Java_edu_wpi_first_wpilibj_hal_CounterJNI_freeCounter + (JNIEnv * env, jclass, jobject id, jobject status) +{ + COUNTERJNI_LOG(logDEBUG) << "Calling COUNTERJNI freeCounter"; + void ** javaId = (void**)env->GetDirectBufferAddress(id); + COUNTERJNI_LOG(logDEBUG) << "Counter Ptr = " << *javaId; + jint * statusPtr = (jint*)env->GetDirectBufferAddress(status); + COUNTERJNI_LOG(logDEBUG) << "Status Ptr = " << statusPtr; + freeCounter(*javaId, statusPtr); + COUNTERJNI_LOG(logDEBUG) << "Status = " << *statusPtr; +} + +/* + * Class: edu_wpi_first_wpilibj_hal_CounterJNI + * Method: setCounterAverageSize + * Signature: (Ljava/nio/ByteBuffer;ILjava/nio/IntBuffer;)V + */ +JNIEXPORT void JNICALL Java_edu_wpi_first_wpilibj_hal_CounterJNI_setCounterAverageSize + (JNIEnv * env, jclass, jobject id, jint value, jobject status) +{ + COUNTERJNI_LOG(logDEBUG) << "Calling COUNTERJNI setCounterAverageSize"; + void ** javaId = (void**)env->GetDirectBufferAddress(id); + COUNTERJNI_LOG(logDEBUG) << "Counter Ptr = " << *javaId; + COUNTERJNI_LOG(logDEBUG) << "AverageSize = " << value; + jint * statusPtr = (jint*)env->GetDirectBufferAddress(status); + COUNTERJNI_LOG(logDEBUG) << "Status Ptr = " << statusPtr; + setCounterAverageSize(*javaId, value, statusPtr); + COUNTERJNI_LOG(logDEBUG) << "Status = " << *statusPtr; +} + +/* + * Class: edu_wpi_first_wpilibj_hal_CounterJNI + * Method: setCounterUpSourceWithModule + * Signature: (Ljava/nio/ByteBuffer;BIBLjava/nio/IntBuffer;)V + */ +JNIEXPORT void JNICALL Java_edu_wpi_first_wpilibj_hal_CounterJNI_setCounterUpSourceWithModule + (JNIEnv * env, jclass, jobject id, jbyte module, jint pin, jbyte analogTrigger, jobject status) +{ + COUNTERJNI_LOG(logDEBUG) << "Calling COUNTERJNI setCounterUpSourceWithModule"; + void ** javaId = (void**)env->GetDirectBufferAddress(id); + COUNTERJNI_LOG(logDEBUG) << "Counter Ptr = " << *javaId; + COUNTERJNI_LOG(logDEBUG) << "Module = " << (jint)module; + COUNTERJNI_LOG(logDEBUG) << "Pin = " << pin; + COUNTERJNI_LOG(logDEBUG) << "AnalogTrigger = " << (jint)analogTrigger; + jint * statusPtr = (jint*)env->GetDirectBufferAddress(status); + COUNTERJNI_LOG(logDEBUG) << "Status Ptr = " << statusPtr; + setCounterUpSourceWithModule(*javaId, module, pin, analogTrigger, statusPtr); + COUNTERJNI_LOG(logDEBUG) << "Status = " << *statusPtr; +} + +/* + * Class: edu_wpi_first_wpilibj_hal_CounterJNI + * Method: setCounterUpSourceEdge + * Signature: (Ljava/nio/ByteBuffer;BBLjava/nio/IntBuffer;)V + */ +JNIEXPORT void JNICALL Java_edu_wpi_first_wpilibj_hal_CounterJNI_setCounterUpSourceEdge + (JNIEnv * env, jclass, jobject id, jbyte valueRise, jbyte valueFall, jobject status) +{ + COUNTERJNI_LOG(logDEBUG) << "Calling COUNTERJNI setCounterUpSourceEdge"; + void ** javaId = (void**)env->GetDirectBufferAddress(id); + COUNTERJNI_LOG(logDEBUG) << "Counter Ptr = " << *javaId; + COUNTERJNI_LOG(logDEBUG) << "Rise = " << (jint)valueRise; + COUNTERJNI_LOG(logDEBUG) << "Fall = " << (jint)valueFall; + jint * statusPtr = (jint*)env->GetDirectBufferAddress(status); + COUNTERJNI_LOG(logDEBUG) << "Status Ptr = " << statusPtr; + setCounterUpSourceEdge(*javaId, valueRise, valueFall, statusPtr); + COUNTERJNI_LOG(logDEBUG) << "Status = " << *statusPtr; +} + +/* + * Class: edu_wpi_first_wpilibj_hal_CounterJNI + * Method: clearCounterUpSource + * Signature: (Ljava/nio/ByteBuffer;Ljava/nio/IntBuffer;)V + */ +JNIEXPORT void JNICALL Java_edu_wpi_first_wpilibj_hal_CounterJNI_clearCounterUpSource + (JNIEnv * env, jclass, jobject id, jobject status) +{ + COUNTERJNI_LOG(logDEBUG) << "Calling COUNTERJNI clearCounterUpSource"; + void ** javaId = (void**)env->GetDirectBufferAddress(id); + COUNTERJNI_LOG(logDEBUG) << "Counter Ptr = " << *javaId; + jint * statusPtr = (jint*)env->GetDirectBufferAddress(status); + COUNTERJNI_LOG(logDEBUG) << "Status Ptr = " << statusPtr; + clearCounterUpSource(*javaId, statusPtr); + COUNTERJNI_LOG(logDEBUG) << "Status = " << *statusPtr; +} + +/* + * Class: edu_wpi_first_wpilibj_hal_CounterJNI + * Method: setCounterDownSourceWithModule + * Signature: (Ljava/nio/ByteBuffer;BIBLjava/nio/IntBuffer;)V + */ +JNIEXPORT void JNICALL Java_edu_wpi_first_wpilibj_hal_CounterJNI_setCounterDownSourceWithModule + (JNIEnv * env, jclass, jobject id, jbyte module, jint pin, jbyte analogTrigger, jobject status) +{ + COUNTERJNI_LOG(logDEBUG) << "Calling COUNTERJNI setCounterDownSourceWithModule"; + void ** javaId = (void**)env->GetDirectBufferAddress(id); + COUNTERJNI_LOG(logDEBUG) << "Counter Ptr = " << *javaId; + COUNTERJNI_LOG(logDEBUG) << "Module = " << (jint)module; + COUNTERJNI_LOG(logDEBUG) << "Pin = " << pin; + COUNTERJNI_LOG(logDEBUG) << "AnalogTrigger = " << (jint)analogTrigger; + jint * statusPtr = (jint*)env->GetDirectBufferAddress(status); + COUNTERJNI_LOG(logDEBUG) << "Status Ptr = " << statusPtr; + setCounterDownSourceWithModule(*javaId, module, pin, analogTrigger, statusPtr); + COUNTERJNI_LOG(logDEBUG) << "Status = " << *statusPtr; +} + +/* + * Class: edu_wpi_first_wpilibj_hal_CounterJNI + * Method: setCounterDownSourceEdge + * Signature: (Ljava/nio/ByteBuffer;BBLjava/nio/IntBuffer;)V + */ +JNIEXPORT void JNICALL Java_edu_wpi_first_wpilibj_hal_CounterJNI_setCounterDownSourceEdge + (JNIEnv * env, jclass, jobject id, jbyte valueRise, jbyte valueFall, jobject status) +{ + COUNTERJNI_LOG(logDEBUG) << "Calling COUNTERJNI setCounterDownSourceEdge"; + void ** javaId = (void**)env->GetDirectBufferAddress(id); + COUNTERJNI_LOG(logDEBUG) << "Counter Ptr = " << *javaId; + COUNTERJNI_LOG(logDEBUG) << "Rise = " << (jint)valueRise; + COUNTERJNI_LOG(logDEBUG) << "Fall = " << (jint)valueFall; + jint * statusPtr = (jint*)env->GetDirectBufferAddress(status); + COUNTERJNI_LOG(logDEBUG) << "Status Ptr = " << statusPtr; + setCounterDownSourceEdge(*javaId, valueRise, valueFall, statusPtr); + COUNTERJNI_LOG(logDEBUG) << "Status = " << *statusPtr; +} + +/* + * Class: edu_wpi_first_wpilibj_hal_CounterJNI + * Method: clearCounterDownSource + * Signature: (Ljava/nio/ByteBuffer;Ljava/nio/IntBuffer;)V + */ +JNIEXPORT void JNICALL Java_edu_wpi_first_wpilibj_hal_CounterJNI_clearCounterDownSource + (JNIEnv * env, jclass, jobject id, jobject status) +{ + COUNTERJNI_LOG(logDEBUG) << "Calling COUNTERJNI clearCounterDownSource"; + void ** javaId = (void**)env->GetDirectBufferAddress(id); + COUNTERJNI_LOG(logDEBUG) << "Counter Ptr = " << *javaId; + jint * statusPtr = (jint*)env->GetDirectBufferAddress(status); + COUNTERJNI_LOG(logDEBUG) << "Status Ptr = " << statusPtr; + clearCounterDownSource(*javaId, statusPtr); + COUNTERJNI_LOG(logDEBUG) << "Status = " << *statusPtr; +} + +/* + * Class: edu_wpi_first_wpilibj_hal_CounterJNI + * Method: setCounterUpDownMode + * Signature: (Ljava/nio/ByteBuffer;Ljava/nio/IntBuffer;)V + */ +JNIEXPORT void JNICALL Java_edu_wpi_first_wpilibj_hal_CounterJNI_setCounterUpDownMode + (JNIEnv * env, jclass, jobject id, jobject status) +{ + COUNTERJNI_LOG(logDEBUG) << "Calling COUNTERJNI setCounterUpDownMode"; + void ** javaId = (void**)env->GetDirectBufferAddress(id); + COUNTERJNI_LOG(logDEBUG) << "Counter Ptr = " << *javaId; + jint * statusPtr = (jint*)env->GetDirectBufferAddress(status); + COUNTERJNI_LOG(logDEBUG) << "Status Ptr = " << statusPtr; + setCounterUpDownMode(*javaId, statusPtr); + COUNTERJNI_LOG(logDEBUG) << "Status = " << *statusPtr; +} + +/* + * Class: edu_wpi_first_wpilibj_hal_CounterJNI + * Method: setCounterExternalDirectionMode + * Signature: (Ljava/nio/ByteBuffer;Ljava/nio/IntBuffer;)V + */ +JNIEXPORT void JNICALL Java_edu_wpi_first_wpilibj_hal_CounterJNI_setCounterExternalDirectionMode + (JNIEnv * env, jclass, jobject id, jobject status) +{ + COUNTERJNI_LOG(logDEBUG) << "Calling COUNTERJNI setCounterExternalDirectionMode"; + void ** javaId = (void**)env->GetDirectBufferAddress(id); + COUNTERJNI_LOG(logDEBUG) << "Counter Ptr = " << *javaId; + jint * statusPtr = (jint*)env->GetDirectBufferAddress(status); + COUNTERJNI_LOG(logDEBUG) << "Status Ptr = " << statusPtr; + setCounterExternalDirectionMode(*javaId, statusPtr); + COUNTERJNI_LOG(logDEBUG) << "Status = " << *statusPtr; +} + +/* + * Class: edu_wpi_first_wpilibj_hal_CounterJNI + * Method: setCounterSemiPeriodMode + * Signature: (Ljava/nio/ByteBuffer;BLjava/nio/IntBuffer;)V + */ +JNIEXPORT void JNICALL Java_edu_wpi_first_wpilibj_hal_CounterJNI_setCounterSemiPeriodMode + (JNIEnv * env, jclass, jobject id, jbyte value, jobject status) +{ + COUNTERJNI_LOG(logDEBUG) << "Calling COUNTERJNI setCounterSemiPeriodMode"; + void ** javaId = (void**)env->GetDirectBufferAddress(id); + COUNTERJNI_LOG(logDEBUG) << "Counter Ptr = " << *javaId; + COUNTERJNI_LOG(logDEBUG) << "SemiPeriodMode = " << (jint)value; + jint * statusPtr = (jint*)env->GetDirectBufferAddress(status); + COUNTERJNI_LOG(logDEBUG) << "Status Ptr = " << statusPtr; + setCounterSemiPeriodMode(*javaId, value, statusPtr); + COUNTERJNI_LOG(logDEBUG) << "Status = " << *statusPtr; +} + +/* + * Class: edu_wpi_first_wpilibj_hal_CounterJNI + * Method: setCounterPulseLengthMode + * Signature: (Ljava/nio/ByteBuffer;DLjava/nio/IntBuffer;)V + */ +JNIEXPORT void JNICALL Java_edu_wpi_first_wpilibj_hal_CounterJNI_setCounterPulseLengthMode + (JNIEnv * env, jclass, jobject id, jdouble value, jobject status) +{ + COUNTERJNI_LOG(logDEBUG) << "Calling COUNTERJNI setCounterPulseLengthMode"; + void ** javaId = (void**)env->GetDirectBufferAddress(id); + COUNTERJNI_LOG(logDEBUG) << "Counter Ptr = " << *javaId; + COUNTERJNI_LOG(logDEBUG) << "PulseLengthMode = " << value; + jint * statusPtr = (jint*)env->GetDirectBufferAddress(status); + COUNTERJNI_LOG(logDEBUG) << "Status Ptr = " << statusPtr; + setCounterPulseLengthMode(*javaId, value, statusPtr); + COUNTERJNI_LOG(logDEBUG) << "Status = " << *statusPtr; +} + +/* + * Class: edu_wpi_first_wpilibj_hal_CounterJNI + * Method: getCounterSamplesToAverage + * Signature: (Ljava/nio/ByteBuffer;Ljava/nio/IntBuffer;)I + */ +JNIEXPORT jint JNICALL Java_edu_wpi_first_wpilibj_hal_CounterJNI_getCounterSamplesToAverage + (JNIEnv * env, jclass, jobject id, jobject status) +{ + COUNTERJNI_LOG(logDEBUG) << "Calling COUNTERJNI getCounterSamplesToAverage"; + void ** javaId = (void**)env->GetDirectBufferAddress(id); + COUNTERJNI_LOG(logDEBUG) << "Counter Ptr = " << *javaId; + jint * statusPtr = (jint*)env->GetDirectBufferAddress(status); + COUNTERJNI_LOG(logDEBUG) << "Status Ptr = " << statusPtr; + jint returnValue = getCounterSamplesToAverage(*javaId, statusPtr); + COUNTERJNI_LOG(logDEBUG) << "Status = " << *statusPtr; + COUNTERJNI_LOG(logDEBUG) << "getCounterSamplesToAverageResult = " << returnValue; + return returnValue; +} + +/* + * Class: edu_wpi_first_wpilibj_hal_CounterJNI + * Method: setCounterSamplesToAverage + * Signature: (Ljava/nio/ByteBuffer;ILjava/nio/IntBuffer;)V + */ +JNIEXPORT void JNICALL Java_edu_wpi_first_wpilibj_hal_CounterJNI_setCounterSamplesToAverage + (JNIEnv * env, jclass, jobject id, jint value, jobject status) +{ + COUNTERJNI_LOG(logDEBUG) << "Calling COUNTERJNI setCounterSamplesToAverage"; + void ** javaId = (void**)env->GetDirectBufferAddress(id); + COUNTERJNI_LOG(logDEBUG) << "Counter Ptr = " << *javaId; + COUNTERJNI_LOG(logDEBUG) << "SamplesToAverage = " << value; + jint * statusPtr = (jint*)env->GetDirectBufferAddress(status); + COUNTERJNI_LOG(logDEBUG) << "Status Ptr = " << statusPtr; + setCounterSamplesToAverage(*javaId, value, statusPtr); + COUNTERJNI_LOG(logDEBUG) << "Status = " << *statusPtr; +} + +/* + * Class: edu_wpi_first_wpilibj_hal_CounterJNI + * Method: startCounter + * Signature: (Ljava/nio/ByteBuffer;Ljava/nio/IntBuffer;)V + */ +JNIEXPORT void JNICALL Java_edu_wpi_first_wpilibj_hal_CounterJNI_startCounter + (JNIEnv * env, jclass, jobject id, jobject status) +{ + COUNTERJNI_LOG(logDEBUG) << "Calling COUNTERJNI startCounter"; + void ** javaId = (void**)env->GetDirectBufferAddress(id); + COUNTERJNI_LOG(logDEBUG) << "Counter Ptr = " << *javaId; + jint * statusPtr = (jint*)env->GetDirectBufferAddress(status); + COUNTERJNI_LOG(logDEBUG) << "Status Ptr = " << statusPtr; + startCounter(*javaId, statusPtr); + COUNTERJNI_LOG(logDEBUG) << "Status = " << *statusPtr; +} + +/* + * Class: edu_wpi_first_wpilibj_hal_CounterJNI + * Method: stopCounter + * Signature: (Ljava/nio/ByteBuffer;Ljava/nio/IntBuffer;)V + */ +JNIEXPORT void JNICALL Java_edu_wpi_first_wpilibj_hal_CounterJNI_stopCounter + (JNIEnv * env, jclass, jobject id, jobject status) +{ + COUNTERJNI_LOG(logDEBUG) << "Calling COUNTERJNI stopCounter"; + void ** javaId = (void**)env->GetDirectBufferAddress(id); + COUNTERJNI_LOG(logDEBUG) << "Counter Ptr = " << *javaId; + jint * statusPtr = (jint*)env->GetDirectBufferAddress(status); + COUNTERJNI_LOG(logDEBUG) << "Status Ptr = " << statusPtr; + stopCounter(*javaId, statusPtr); + COUNTERJNI_LOG(logDEBUG) << "Status = " << *statusPtr; +} + +/* + * Class: edu_wpi_first_wpilibj_hal_CounterJNI + * Method: resetCounter + * Signature: (Ljava/nio/ByteBuffer;Ljava/nio/IntBuffer;)V + */ +JNIEXPORT void JNICALL Java_edu_wpi_first_wpilibj_hal_CounterJNI_resetCounter + (JNIEnv * env, jclass, jobject id, jobject status) +{ + COUNTERJNI_LOG(logDEBUG) << "Calling COUNTERJNI resetCounter"; + void ** javaId = (void**)env->GetDirectBufferAddress(id); + COUNTERJNI_LOG(logDEBUG) << "Counter Ptr = " << *javaId; + jint * statusPtr = (jint*)env->GetDirectBufferAddress(status); + COUNTERJNI_LOG(logDEBUG) << "Status Ptr = " << statusPtr; + resetCounter(*javaId, statusPtr); + COUNTERJNI_LOG(logDEBUG) << "Status = " << *statusPtr; +} + +/* + * Class: edu_wpi_first_wpilibj_hal_CounterJNI + * Method: getCounter + * Signature: (Ljava/nio/ByteBuffer;Ljava/nio/IntBuffer;)I + */ +JNIEXPORT jint JNICALL Java_edu_wpi_first_wpilibj_hal_CounterJNI_getCounter + (JNIEnv * env, jclass, jobject id, jobject status) +{ + //COUNTERJNI_LOG(logDEBUG) << "Calling COUNTERJNI getCounter"; + void ** javaId = (void**)env->GetDirectBufferAddress(id); + //COUNTERJNI_LOG(logDEBUG) << "Counter Ptr = " << *javaId; + jint * statusPtr = (jint*)env->GetDirectBufferAddress(status); + //COUNTERJNI_LOG(logDEBUG) << "Status Ptr = " << statusPtr; + jint returnValue = getCounter(*javaId, statusPtr); + //COUNTERJNI_LOG(logDEBUG) << "Status = " << *statusPtr; + //COUNTERJNI_LOG(logDEBUG) << "getCounterResult = " << returnValue; + return returnValue; +} + +/* + * Class: edu_wpi_first_wpilibj_hal_CounterJNI + * Method: getCounterPeriod + * Signature: (Ljava/nio/ByteBuffer;Ljava/nio/IntBuffer;)D + */ +JNIEXPORT jdouble JNICALL Java_edu_wpi_first_wpilibj_hal_CounterJNI_getCounterPeriod + (JNIEnv *env, jclass, jobject id, jobject status) +{ + COUNTERJNI_LOG(logDEBUG) << "Calling COUNTERJNI getCounterPeriod"; + void ** javaId = (void**)env->GetDirectBufferAddress(id); + COUNTERJNI_LOG(logDEBUG) << "Counter Ptr = " << *javaId; + jint * statusPtr = (jint*)env->GetDirectBufferAddress(status); + COUNTERJNI_LOG(logDEBUG) << "Status Ptr = " << statusPtr; + jdouble returnValue = getCounterPeriod(*javaId, statusPtr); + COUNTERJNI_LOG(logDEBUG) << "Status = " << *statusPtr; + COUNTERJNI_LOG(logDEBUG) << "getCounterPeriodResult = " << returnValue; + return returnValue; +} + +/* + * Class: edu_wpi_first_wpilibj_hal_CounterJNI + * Method: setCounterMaxPeriod + * Signature: (Ljava/nio/ByteBuffer;DLjava/nio/IntBuffer;)V + */ +JNIEXPORT void JNICALL Java_edu_wpi_first_wpilibj_hal_CounterJNI_setCounterMaxPeriod + (JNIEnv * env, jclass, jobject id, jdouble value, jobject status) +{ + COUNTERJNI_LOG(logDEBUG) << "Calling COUNTERJNI setCounterMaxPeriod"; + void ** javaId = (void**)env->GetDirectBufferAddress(id); + COUNTERJNI_LOG(logDEBUG) << "Counter Ptr = " << *javaId; + COUNTERJNI_LOG(logDEBUG) << "MaxPeriod = " << value; + jint * statusPtr = (jint*)env->GetDirectBufferAddress(status); + COUNTERJNI_LOG(logDEBUG) << "Status Ptr = " << statusPtr; + setCounterMaxPeriod(*javaId, value, statusPtr); + COUNTERJNI_LOG(logDEBUG) << "Status = " << *statusPtr; +} + +/* + * Class: edu_wpi_first_wpilibj_hal_CounterJNI + * Method: setCounterUpdateWhenEmpty + * Signature: (Ljava/nio/ByteBuffer;BLjava/nio/IntBuffer;)V + */ +JNIEXPORT void JNICALL Java_edu_wpi_first_wpilibj_hal_CounterJNI_setCounterUpdateWhenEmpty + (JNIEnv * env, jclass, jobject id, jbyte value, jobject status) +{ + COUNTERJNI_LOG(logDEBUG) << "Calling COUNTERJNI setCounterMaxPeriod"; + void ** javaId = (void**)env->GetDirectBufferAddress(id); + COUNTERJNI_LOG(logDEBUG) << "Counter Ptr = " << *javaId; + COUNTERJNI_LOG(logDEBUG) << "UpdateWhenEmpty = " << (jint)value; + jint * statusPtr = (jint*)env->GetDirectBufferAddress(status); + COUNTERJNI_LOG(logDEBUG) << "Status Ptr = " << statusPtr; + setCounterUpdateWhenEmpty(*javaId, value, statusPtr); + COUNTERJNI_LOG(logDEBUG) << "Status = " << *statusPtr; +} + +/* + * Class: edu_wpi_first_wpilibj_hal_CounterJNI + * Method: getCounterStopped + * Signature: (Ljava/nio/ByteBuffer;Ljava/nio/IntBuffer;)B + */ +JNIEXPORT jbyte JNICALL Java_edu_wpi_first_wpilibj_hal_CounterJNI_getCounterStopped + (JNIEnv * env, jclass, jobject id, jobject status) +{ + COUNTERJNI_LOG(logDEBUG) << "Calling COUNTERJNI getCounterStopped"; + void ** javaId = (void**)env->GetDirectBufferAddress(id); + COUNTERJNI_LOG(logDEBUG) << "Counter Ptr = " << *javaId; + jint * statusPtr = (jint*)env->GetDirectBufferAddress(status); + COUNTERJNI_LOG(logDEBUG) << "Status Ptr = " << statusPtr; + jbyte returnValue = getCounterStopped(*javaId, statusPtr); + COUNTERJNI_LOG(logDEBUG) << "Status = " << *statusPtr; + COUNTERJNI_LOG(logDEBUG) << "getCounterStoppedResult = " << (jint)returnValue; + return returnValue; +} + +/* + * Class: edu_wpi_first_wpilibj_hal_CounterJNI + * Method: getCounterDirection + * Signature: (Ljava/nio/ByteBuffer;Ljava/nio/IntBuffer;)B + */ +JNIEXPORT jbyte JNICALL Java_edu_wpi_first_wpilibj_hal_CounterJNI_getCounterDirection + (JNIEnv * env, jclass, jobject id, jobject status) +{ + COUNTERJNI_LOG(logDEBUG) << "Calling COUNTERJNI getCounterDirection"; + void ** javaId = (void**)env->GetDirectBufferAddress(id); + COUNTERJNI_LOG(logDEBUG) << "Counter Ptr = " << *javaId; + jint * statusPtr = (jint*)env->GetDirectBufferAddress(status); + COUNTERJNI_LOG(logDEBUG) << "Status Ptr = " << statusPtr; + jbyte returnValue = getCounterDirection(*javaId, statusPtr); + COUNTERJNI_LOG(logDEBUG) << "Status = " << *statusPtr; + COUNTERJNI_LOG(logDEBUG) << "getCounterDirectionResult = " << (jint)returnValue; + return returnValue; +} + +/* + * Class: edu_wpi_first_wpilibj_hal_CounterJNI + * Method: setCounterReverseDirection + * Signature: (Ljava/nio/ByteBuffer;BLjava/nio/IntBuffer;)V + */ +JNIEXPORT void JNICALL Java_edu_wpi_first_wpilibj_hal_CounterJNI_setCounterReverseDirection + (JNIEnv * env, jclass, jobject id, jbyte value, jobject status) +{ + COUNTERJNI_LOG(logDEBUG) << "Calling COUNTERJNI setCounterReverseDirection"; + void ** javaId = (void**)env->GetDirectBufferAddress(id); + COUNTERJNI_LOG(logDEBUG) << "Counter Ptr = " << *javaId; + COUNTERJNI_LOG(logDEBUG) << "ReverseDirection = " << (jint)value; + jint * statusPtr = (jint*)env->GetDirectBufferAddress(status); + COUNTERJNI_LOG(logDEBUG) << "Status Ptr = " << statusPtr; + setCounterReverseDirection(*javaId, value, statusPtr); + COUNTERJNI_LOG(logDEBUG) << "Status = " << *statusPtr; +} diff --git a/wpilibj/wpilibJavaJNI/src/main/native/DIOJNI.cpp b/wpilibj/wpilibJavaJNI/src/main/native/DIOJNI.cpp new file mode 100644 index 0000000000..8aa7ead7c7 --- /dev/null +++ b/wpilibj/wpilibJavaJNI/src/main/native/DIOJNI.cpp @@ -0,0 +1,212 @@ +#include +#include +#include "log.h" + +#include "edu_wpi_first_wpilibj_hal_DIOJNI.h" + +#include "HAL/Digital.h" + +// set the logging level +TLogLevel dioJNILogLevel = logDEBUG; + +#define DIOJNI_LOG(level) \ + if (level > dioJNILogLevel) ; \ + else Log().Get(level) + +/* + * Class: edu_wpi_first_wpilibj_hal_DIOJNI + * Method: initializeDigitalPort + * Signature: (Ljava/nio/ByteBuffer;Ljava/nio/IntBuffer;)Ljava/nio/ByteBuffer; + */ +JNIEXPORT jobject JNICALL Java_edu_wpi_first_wpilibj_hal_DIOJNI_initializeDigitalPort + (JNIEnv * env, jclass, jobject id, jobject status) +{ + DIOJNI_LOG(logDEBUG) << "Calling DIOJNI initializeDigitalPort"; + void ** javaId = (void**)env->GetDirectBufferAddress(id); + DIOJNI_LOG(logDEBUG) << "Port Ptr = " << *javaId; + jint * statusPtr = (jint*)env->GetDirectBufferAddress(status); + DIOJNI_LOG(logDEBUG) << "Status Ptr = " << statusPtr; + void** dioPtr = (void**)new unsigned char[4]; + *dioPtr = initializeDigitalPort(*javaId, statusPtr); + DIOJNI_LOG(logDEBUG) << "Status = " << *statusPtr; + DIOJNI_LOG(logDEBUG) << "DIO Ptr = " << *dioPtr; + return env->NewDirectByteBuffer( dioPtr, 4); +} + +/* + * Class: edu_wpi_first_wpilibj_hal_DIOJNI + * Method: allocateDIO + * Signature: (Ljava/nio/ByteBuffer;BLjava/nio/IntBuffer;)B + */ +JNIEXPORT jbyte JNICALL Java_edu_wpi_first_wpilibj_hal_DIOJNI_allocateDIO + (JNIEnv * env, jclass, jobject id, jbyte value, jobject status) +{ + DIOJNI_LOG(logDEBUG) << "Calling DIOJNI allocateDIO"; + void ** javaId = (void**)env->GetDirectBufferAddress(id); + DIOJNI_LOG(logDEBUG) << "Port Ptr = " << *javaId; + jint * statusPtr = (jint*)env->GetDirectBufferAddress(status); + DIOJNI_LOG(logDEBUG) << "Status Ptr = " << statusPtr; + jbyte returnValue = allocateDIO(*javaId, value, statusPtr); + DIOJNI_LOG(logDEBUG) << "Status = " << *statusPtr; + DIOJNI_LOG(logDEBUG) << "allocateDIOResult = " << (jint)returnValue; + return returnValue; +} + +/* + * Class: edu_wpi_first_wpilibj_hal_DIOJNI + * Method: freeDIO + * Signature: (Ljava/nio/ByteBuffer;Ljava/nio/IntBuffer;)V + */ +JNIEXPORT void JNICALL Java_edu_wpi_first_wpilibj_hal_DIOJNI_freeDIO + (JNIEnv * env, jclass, jobject id, jobject status) +{ + DIOJNI_LOG(logDEBUG) << "Calling DIOJNI freeDIO"; + void ** javaId = (void**)env->GetDirectBufferAddress(id); + DIOJNI_LOG(logDEBUG) << "Port Ptr = " << *javaId; + jint * statusPtr = (jint*)env->GetDirectBufferAddress(status); + DIOJNI_LOG(logDEBUG) << "Status Ptr = " << statusPtr; + freeDIO(*javaId, statusPtr); + DIOJNI_LOG(logDEBUG) << "Status = " << *statusPtr; +} + +/* + * Class: edu_wpi_first_wpilibj_hal_DIOJNI + * Method: setDIO + * Signature: (Ljava/nio/ByteBuffer;SLjava/nio/IntBuffer;)V + */ +JNIEXPORT void JNICALL Java_edu_wpi_first_wpilibj_hal_DIOJNI_setDIO + (JNIEnv *env, jclass, jobject id, jshort value, jobject status) +{ + //DIOJNI_LOG(logDEBUG) << "Calling DIOJNI setDIO"; + void ** javaId = (void**)env->GetDirectBufferAddress(id); + //DIOJNI_LOG(logDEBUG) << "Port Ptr = " << *javaId; + //DIOJNI_LOG(logDEBUG) << "Value = " << value; + jint * statusPtr = (jint*)env->GetDirectBufferAddress(status); + //DIOJNI_LOG(logDEBUG) << "Status Ptr = " << statusPtr; + setDIO(*javaId, value, statusPtr); + //DIOJNI_LOG(logDEBUG) << "Status = " << *statusPtr; +} + +/* + * Class: edu_wpi_first_wpilibj_hal_DIOJNI + * Method: getDIO + * Signature: (Ljava/nio/ByteBuffer;Ljava/nio/IntBuffer;)B + */ +JNIEXPORT jbyte JNICALL Java_edu_wpi_first_wpilibj_hal_DIOJNI_getDIO + (JNIEnv * env, jclass, jobject id, jobject status) +{ + //DIOJNI_LOG(logDEBUG) << "Calling DIOJNI getDIO"; + void ** javaId = (void**)env->GetDirectBufferAddress(id); + //DIOJNI_LOG(logDEBUG) << "Port Ptr = " << *javaId; + jint * statusPtr = (jint*)env->GetDirectBufferAddress(status); + //DIOJNI_LOG(logDEBUG) << "Status Ptr = " << statusPtr; + jbyte returnValue = getDIO(*javaId, statusPtr); + //DIOJNI_LOG(logDEBUG) << "Status = " << *statusPtr; + //DIOJNI_LOG(logDEBUG) << "getDIOResult = " << (jint)returnValue; + return returnValue; + +} + +/* + * Class: edu_wpi_first_wpilibj_hal_DIOJNI + * Method: getDIODirection + * Signature: (Ljava/nio/ByteBuffer;Ljava/nio/IntBuffer;)B + */ +JNIEXPORT jbyte JNICALL Java_edu_wpi_first_wpilibj_hal_DIOJNI_getDIODirection + (JNIEnv *, jclass, jobject, jobject) +{ + assert(false); + +} + +/* + * Class: edu_wpi_first_wpilibj_hal_DIOJNI + * Method: checkDigitalModule + * Signature: (B)B + */ +JNIEXPORT jbyte JNICALL Java_edu_wpi_first_wpilibj_hal_DIOJNI_checkDigitalModule + (JNIEnv *, jclass, jbyte value) +{ + DIOJNI_LOG(logDEBUG) << "Calling DIOJNI checkDigitalModule"; + DIOJNI_LOG(logDEBUG) << "Module = " << (jint)value; + jbyte returnValue = checkDigitalModule( value ); + DIOJNI_LOG(logDEBUG) << "checkDigitalModuleResult = " << (jint)returnValue; + return returnValue; +} + +/* + * Class: edu_wpi_first_wpilibj_hal_DIOJNI + * Method: pulse + * Signature: (Ljava/nio/ByteBuffer;DLjava/nio/IntBuffer;)V + */ +JNIEXPORT void JNICALL Java_edu_wpi_first_wpilibj_hal_DIOJNI_pulse + (JNIEnv *, jclass, jobject, jdouble, jobject) +{ + assert(false); + +} + +/* + * Class: edu_wpi_first_wpilibj_hal_DIOJNI + * Method: isPulsing + * Signature: (Ljava/nio/ByteBuffer;Ljava/nio/IntBuffer;)B + */ +JNIEXPORT jbyte JNICALL Java_edu_wpi_first_wpilibj_hal_DIOJNI_isPulsing + (JNIEnv *, jclass, jobject, jobject) +{ + assert(false); + +} + +/* + * Class: edu_wpi_first_wpilibj_hal_DIOJNI + * Method: isAnyPulsing + * Signature: (Ljava/nio/IntBuffer;)B + */ +JNIEXPORT jbyte JNICALL Java_edu_wpi_first_wpilibj_hal_DIOJNI_isAnyPulsing + (JNIEnv *, jclass, jobject) +{ + assert(false); + +} + +/* + * Class: edu_wpi_first_wpilibj_hal_DIOJNI + * Method: isAnyPulsingWithModule + * Signature: (BLjava/nio/IntBuffer;)B + */ +JNIEXPORT jbyte JNICALL Java_edu_wpi_first_wpilibj_hal_DIOJNI_isAnyPulsingWithModule + (JNIEnv *, jclass, jbyte, jobject) +{ + assert(false); + +} + +/* + * Class: edu_wpi_first_wpilibj_hal_DIOJNI + * Method: getLoopTiming + * Signature: (Ljava/nio/IntBuffer;)S + */ +JNIEXPORT jshort JNICALL Java_edu_wpi_first_wpilibj_hal_DIOJNI_getLoopTiming + (JNIEnv * env, jclass, jobject status) +{ + DIOJNI_LOG(logDEBUG) << "Calling DIOJNI getLoopTimeing"; + jint * statusPtr = (jint*)env->GetDirectBufferAddress(status); + jshort returnValue = getLoopTiming( statusPtr ); + DIOJNI_LOG(logDEBUG) << "Status = " << *statusPtr; + DIOJNI_LOG(logDEBUG) << "LoopTiming = " << returnValue; + return returnValue; + +} + +/* + * Class: edu_wpi_first_wpilibj_hal_DIOJNI + * Method: getLoopTimingWithModule + * Signature: (BLjava/nio/IntBuffer;)S + */ +JNIEXPORT jshort JNICALL Java_edu_wpi_first_wpilibj_hal_DIOJNI_getLoopTimingWithModule + (JNIEnv *, jclass, jbyte, jobject) +{ + assert(false); + +} diff --git a/wpilibj/wpilibJavaJNI/src/main/native/EncoderJNI.cpp b/wpilibj/wpilibJavaJNI/src/main/native/EncoderJNI.cpp new file mode 100644 index 0000000000..0d1bc68914 --- /dev/null +++ b/wpilibj/wpilibJavaJNI/src/main/native/EncoderJNI.cpp @@ -0,0 +1,259 @@ +#include +#include +#include "log.h" + +#include "edu_wpi_first_wpilibj_hal_EncoderJNI.h" + +#include "HAL/Digital.h" + +// set the logging level +TLogLevel encoderJNILogLevel = logDEBUG; + +#define ENCODERJNI_LOG(level) \ + if (level > encoderJNILogLevel) ; \ + else Log().Get(level) + +/* + * Class: edu_wpi_first_wpilibj_hal_EncoderJNI + * Method: initializeEncoder + * Signature: (BIBBIBBLjava/nio/IntBuffer;Ljava/nio/IntBuffer;)Ljava/nio/ByteBuffer; + */ +JNIEXPORT jobject JNICALL Java_edu_wpi_first_wpilibj_hal_EncoderJNI_initializeEncoder + (JNIEnv * env, jclass, jbyte port_a_module, jint port_a_pin, jbyte port_a_analog_trigger, jbyte port_b_module, jint port_b_pin, jbyte port_b_analog_trigger, jbyte reverseDirection, jobject index, jobject status) +{ + ENCODERJNI_LOG(logDEBUG) << "Calling ENCODERJNI initializeEncoder"; + ENCODERJNI_LOG(logDEBUG) << "Module A = " << (jint)port_a_module; + ENCODERJNI_LOG(logDEBUG) << "Pin A = " << port_a_pin; + ENCODERJNI_LOG(logDEBUG) << "Analog Trigger A = " << (jint)port_a_analog_trigger; + ENCODERJNI_LOG(logDEBUG) << "Module B = " << (jint)port_b_module; + ENCODERJNI_LOG(logDEBUG) << "Pin B = " << port_b_pin; + ENCODERJNI_LOG(logDEBUG) << "Analog Trigger B = " << (jint)port_b_analog_trigger; + ENCODERJNI_LOG(logDEBUG) << "Reverse direction = " << (jint)reverseDirection; + jint * indexPtr = (jint*)env->GetDirectBufferAddress(index); + ENCODERJNI_LOG(logDEBUG) << "Index Ptr = " << indexPtr; + jint * statusPtr = (jint*)env->GetDirectBufferAddress(status); + ENCODERJNI_LOG(logDEBUG) << "Status Ptr = " << statusPtr; + void** encoderPtr = (void**)new unsigned char[4]; + *encoderPtr = initializeEncoder(port_a_module, port_a_pin, port_a_analog_trigger, + port_b_module, port_b_pin, port_b_analog_trigger, + reverseDirection, indexPtr, statusPtr); + + ENCODERJNI_LOG(logDEBUG) << "Index = " << *indexPtr; + ENCODERJNI_LOG(logDEBUG) << "Status = " << *statusPtr; + ENCODERJNI_LOG(logDEBUG) << "ENCODER Ptr = " << *encoderPtr; + return env->NewDirectByteBuffer( encoderPtr, 4); +} + +/* + * Class: edu_wpi_first_wpilibj_hal_EncoderJNI + * Method: freeEncoder + * Signature: (Ljava/nio/ByteBuffer;Ljava/nio/IntBuffer;)V + */ +JNIEXPORT void JNICALL Java_edu_wpi_first_wpilibj_hal_EncoderJNI_freeEncoder + (JNIEnv * env, jclass, jobject id, jobject status) +{ + ENCODERJNI_LOG(logDEBUG) << "Calling ENCODERJNI freeEncoder"; + void ** javaId = (void**)env->GetDirectBufferAddress(id); + ENCODERJNI_LOG(logDEBUG) << "Encoder Ptr = " << *javaId; + jint * statusPtr = (jint*)env->GetDirectBufferAddress(status); + ENCODERJNI_LOG(logDEBUG) << "Status Ptr = " << statusPtr; + freeEncoder(*javaId, statusPtr); + ENCODERJNI_LOG(logDEBUG) << "Status = " << *statusPtr; +} + +/* + * Class: edu_wpi_first_wpilibj_hal_EncoderJNI + * Method: startEncoder + * Signature: (Ljava/nio/ByteBuffer;Ljava/nio/IntBuffer;)V + */ +JNIEXPORT void JNICALL Java_edu_wpi_first_wpilibj_hal_EncoderJNI_startEncoder + (JNIEnv * env, jclass, jobject id, jobject status) +{ + ENCODERJNI_LOG(logDEBUG) << "Calling ENCODERJNI startEncoder"; + void ** javaId = (void**)env->GetDirectBufferAddress(id); + ENCODERJNI_LOG(logDEBUG) << "Encoder Ptr = " << *javaId; + jint * statusPtr = (jint*)env->GetDirectBufferAddress(status); + ENCODERJNI_LOG(logDEBUG) << "Status Ptr = " << statusPtr; + startEncoder(*javaId, statusPtr); + ENCODERJNI_LOG(logDEBUG) << "Status = " << *statusPtr; +} + +/* + * Class: edu_wpi_first_wpilibj_hal_EncoderJNI + * Method: stopEncoder + * Signature: (Ljava/nio/ByteBuffer;Ljava/nio/IntBuffer;)V + */ +JNIEXPORT void JNICALL Java_edu_wpi_first_wpilibj_hal_EncoderJNI_stopEncoder + (JNIEnv * env, jclass, jobject id, jobject status) +{ + ENCODERJNI_LOG(logDEBUG) << "Calling ENCODERJNI stopEncoder"; + void ** javaId = (void**)env->GetDirectBufferAddress(id); + ENCODERJNI_LOG(logDEBUG) << "Encoder Ptr = " << *javaId; + jint * statusPtr = (jint*)env->GetDirectBufferAddress(status); + ENCODERJNI_LOG(logDEBUG) << "Status Ptr = " << statusPtr; + stopEncoder(*javaId, statusPtr); + ENCODERJNI_LOG(logDEBUG) << "Status = " << *statusPtr; +} + +/* + * Class: edu_wpi_first_wpilibj_hal_EncoderJNI + * Method: resetEncoder + * Signature: (Ljava/nio/ByteBuffer;Ljava/nio/IntBuffer;)V + */ +JNIEXPORT void JNICALL Java_edu_wpi_first_wpilibj_hal_EncoderJNI_resetEncoder + (JNIEnv * env, jclass, jobject id, jobject status) +{ + ENCODERJNI_LOG(logDEBUG) << "Calling ENCODERJNI resetEncoder"; + void ** javaId = (void**)env->GetDirectBufferAddress(id); + ENCODERJNI_LOG(logDEBUG) << "Encoder Ptr = " << *javaId; + jint * statusPtr = (jint*)env->GetDirectBufferAddress(status); + ENCODERJNI_LOG(logDEBUG) << "Status Ptr = " << statusPtr; + resetEncoder(*javaId, statusPtr); + ENCODERJNI_LOG(logDEBUG) << "Status = " << *statusPtr; +} + +/* + * Class: edu_wpi_first_wpilibj_hal_EncoderJNI + * Method: getEncoder + * Signature: (Ljava/nio/ByteBuffer;Ljava/nio/IntBuffer;)I + */ +JNIEXPORT jint JNICALL Java_edu_wpi_first_wpilibj_hal_EncoderJNI_getEncoder + (JNIEnv * env, jclass, jobject id, jobject status) +{ + ENCODERJNI_LOG(logDEBUG) << "Calling ENCODERJNI getEncoder"; + void ** javaId = (void**)env->GetDirectBufferAddress(id); + ENCODERJNI_LOG(logDEBUG) << "Encoder Ptr = " << *javaId; + jint * statusPtr = (jint*)env->GetDirectBufferAddress(status); + ENCODERJNI_LOG(logDEBUG) << "Status Ptr = " << statusPtr; + jint returnValue = getEncoder(*javaId, statusPtr); + ENCODERJNI_LOG(logDEBUG) << "Status = " << *statusPtr; + ENCODERJNI_LOG(logDEBUG) << "getEncoderResult = " << returnValue; + return returnValue; +} + +/* + * Class: edu_wpi_first_wpilibj_hal_EncoderJNI + * Method: getEncoderPeriod + * Signature: (Ljava/nio/ByteBuffer;Ljava/nio/IntBuffer;)D + */ +JNIEXPORT jdouble JNICALL Java_edu_wpi_first_wpilibj_hal_EncoderJNI_getEncoderPeriod + (JNIEnv * env, jclass, jobject id, jobject status) +{ + ENCODERJNI_LOG(logDEBUG) << "Calling ENCODERJNI getEncoderPeriod"; + void ** javaId = (void**)env->GetDirectBufferAddress(id); + ENCODERJNI_LOG(logDEBUG) << "Encoder Ptr = " << *javaId; + jint * statusPtr = (jint*)env->GetDirectBufferAddress(status); + ENCODERJNI_LOG(logDEBUG) << "Status Ptr = " << statusPtr; + double returnValue = getEncoderPeriod(*javaId, statusPtr); + ENCODERJNI_LOG(logDEBUG) << "Status = " << *statusPtr; + ENCODERJNI_LOG(logDEBUG) << "getEncoderPeriodResult = " << returnValue; + return returnValue; +} + +/* + * Class: edu_wpi_first_wpilibj_hal_EncoderJNI + * Method: setEncoderMaxPeriod + * Signature: (Ljava/nio/ByteBuffer;DLjava/nio/IntBuffer;)V + */ +JNIEXPORT void JNICALL Java_edu_wpi_first_wpilibj_hal_EncoderJNI_setEncoderMaxPeriod + (JNIEnv * env, jclass, jobject id, jdouble value, jobject status) +{ + ENCODERJNI_LOG(logDEBUG) << "Calling ENCODERJNI setEncoderMaxPeriod"; + void ** javaId = (void**)env->GetDirectBufferAddress(id); + ENCODERJNI_LOG(logDEBUG) << "Encoder Ptr = " << *javaId; + jint * statusPtr = (jint*)env->GetDirectBufferAddress(status); + ENCODERJNI_LOG(logDEBUG) << "Status Ptr = " << statusPtr; + setEncoderMaxPeriod(*javaId, value, statusPtr); + ENCODERJNI_LOG(logDEBUG) << "Status = " << *statusPtr; +} + +/* + * Class: edu_wpi_first_wpilibj_hal_EncoderJNI + * Method: getEncoderStopped + * Signature: (Ljava/nio/ByteBuffer;Ljava/nio/IntBuffer;)B + */ +JNIEXPORT jbyte JNICALL Java_edu_wpi_first_wpilibj_hal_EncoderJNI_getEncoderStopped + (JNIEnv * env, jclass, jobject id, jobject status) +{ + ENCODERJNI_LOG(logDEBUG) << "Calling ENCODERJNI getEncoderStopped"; + void ** javaId = (void**)env->GetDirectBufferAddress(id); + ENCODERJNI_LOG(logDEBUG) << "Encoder Ptr = " << *javaId; + jint * statusPtr = (jint*)env->GetDirectBufferAddress(status); + ENCODERJNI_LOG(logDEBUG) << "Status Ptr = " << statusPtr; + jbyte returnValue = getEncoderStopped(*javaId, statusPtr); + ENCODERJNI_LOG(logDEBUG) << "Status = " << *statusPtr; + ENCODERJNI_LOG(logDEBUG) << "getEncoderStoppedResult = " << returnValue; + return returnValue; +} + +/* + * Class: edu_wpi_first_wpilibj_hal_EncoderJNI + * Method: getEncoderDirection + * Signature: (Ljava/nio/ByteBuffer;Ljava/nio/IntBuffer;)B + */ +JNIEXPORT jbyte JNICALL Java_edu_wpi_first_wpilibj_hal_EncoderJNI_getEncoderDirection + (JNIEnv * env, jclass, jobject id, jobject status) +{ + ENCODERJNI_LOG(logDEBUG) << "Calling ENCODERJNI getEncoderDirection"; + void ** javaId = (void**)env->GetDirectBufferAddress(id); + ENCODERJNI_LOG(logDEBUG) << "Encoder Ptr = " << *javaId; + jint * statusPtr = (jint*)env->GetDirectBufferAddress(status); + ENCODERJNI_LOG(logDEBUG) << "Status Ptr = " << statusPtr; + jbyte returnValue = getEncoderDirection(*javaId, statusPtr); + ENCODERJNI_LOG(logDEBUG) << "Status = " << *statusPtr; + ENCODERJNI_LOG(logDEBUG) << "getEncoderDirectionResult = " << returnValue; + return returnValue; +} + +/* + * Class: edu_wpi_first_wpilibj_hal_EncoderJNI + * Method: setEncoderReverseDirection + * Signature: (Ljava/nio/ByteBuffer;BLjava/nio/IntBuffer;)V + */ +JNIEXPORT void JNICALL Java_edu_wpi_first_wpilibj_hal_EncoderJNI_setEncoderReverseDirection + (JNIEnv * env, jclass, jobject id, jbyte value, jobject status) +{ + ENCODERJNI_LOG(logDEBUG) << "Calling ENCODERJNI setEncoderReverseDirection"; + void ** javaId = (void**)env->GetDirectBufferAddress(id); + ENCODERJNI_LOG(logDEBUG) << "Encoder Ptr = " << *javaId; + jint * statusPtr = (jint*)env->GetDirectBufferAddress(status); + ENCODERJNI_LOG(logDEBUG) << "Status Ptr = " << statusPtr; + setEncoderReverseDirection(*javaId, value, statusPtr); + ENCODERJNI_LOG(logDEBUG) << "Status = " << *statusPtr; +} + +/* + * Class: edu_wpi_first_wpilibj_hal_EncoderJNI + * Method: setEncoderSamplesToAverage + * Signature: (Ljava/nio/ByteBuffer;ILjava/nio/IntBuffer;)V + */ +JNIEXPORT void JNICALL Java_edu_wpi_first_wpilibj_hal_EncoderJNI_setEncoderSamplesToAverage + (JNIEnv * env, jclass, jobject id, jint value, jobject status) +{ + ENCODERJNI_LOG(logDEBUG) << "Calling ENCODERJNI setEncoderSamplesToAverage"; + void ** javaId = (void**)env->GetDirectBufferAddress(id); + ENCODERJNI_LOG(logDEBUG) << "Encoder Ptr = " << *javaId; + jint * statusPtr = (jint*)env->GetDirectBufferAddress(status); + ENCODERJNI_LOG(logDEBUG) << "Status Ptr = " << statusPtr; + setEncoderSamplesToAverage(*javaId, value, statusPtr); + ENCODERJNI_LOG(logDEBUG) << "Status = " << *statusPtr; +} + +/* + * Class: edu_wpi_first_wpilibj_hal_EncoderJNI + * Method: getEncoderSamplesToAverage + * Signature: (Ljava/nio/ByteBuffer;Ljava/nio/IntBuffer;)I + */ +JNIEXPORT jint JNICALL Java_edu_wpi_first_wpilibj_hal_EncoderJNI_getEncoderSamplesToAverage + (JNIEnv * env, jclass, jobject id, jobject status) +{ + ENCODERJNI_LOG(logDEBUG) << "Calling ENCODERJNI getEncoderSamplesToAverage"; + void ** javaId = (void**)env->GetDirectBufferAddress(id); + ENCODERJNI_LOG(logDEBUG) << "Encoder Ptr = " << *javaId; + jint * statusPtr = (jint*)env->GetDirectBufferAddress(status); + ENCODERJNI_LOG(logDEBUG) << "Status Ptr = " << statusPtr; + jint returnValue = getEncoderSamplesToAverage(*javaId, statusPtr); + ENCODERJNI_LOG(logDEBUG) << "Status = " << *statusPtr; + ENCODERJNI_LOG(logDEBUG) << "getEncoderSamplesToAverageResult = " << returnValue; + return returnValue; +} diff --git a/wpilibj/wpilibJavaJNI/src/main/native/FRCNetworkCommunicationsLibrary.cpp b/wpilibj/wpilibJavaJNI/src/main/native/FRCNetworkCommunicationsLibrary.cpp new file mode 100644 index 0000000000..0c818e3b50 --- /dev/null +++ b/wpilibj/wpilibJavaJNI/src/main/native/FRCNetworkCommunicationsLibrary.cpp @@ -0,0 +1,706 @@ +#include +#include +#include "log.h" + +#include "edu_wpi_first_wpilibj_communication_FRCNetworkCommunicationsLibrary.h" +#include "HAL/HAL.h" +//#include "NetworkCommunication/FRCComm.h" +//#include "NetworkCommunication/UsageReporting.h" + + +/* + * Class: edu_wpi_first_wpilibj_communication_FRC_NetworkCommunicationsLibrary + * Method: FRC_NetworkCommunication_nAICalibration_getLSBWeight + * Signature: (IILjava/lang/Integer;)I + */ +JNIEXPORT jint JNICALL Java_edu_wpi_first_wpilibj_communication_FRCNetworkCommunicationsLibrary_FRCNetworkCommunicationAICalibrationGetLSBWeight + (JNIEnv *, jclass, jint, jint, jobject) +{ + assert(false); + return 0; +} +/* + * Class: edu_wpi_first_wpilibj_communication_FRC_NetworkCommunicationsLibrary + * Method: FRC_NetworkCommunication_nAICalibration_getOffset + * Signature: (IILjava/lang/Integer;)I + */ +JNIEXPORT jint JNICALL Java_edu_wpi_first_wpilibj_communication_FRCNetworkCommunicationsLibrary_FRCNetworkCommunicationAICalibrationGetOffset + (JNIEnv *, jclass, jint, jint, jobject) +{ + assert(false); + return 0; +} +/* + * Class: edu_wpi_first_wpilibj_communication_FRC_NetworkCommunicationsLibrary + * Method: getModulePresence + * Signature: (IB)B + */ +JNIEXPORT jbyte JNICALL Java_edu_wpi_first_wpilibj_communication_FRCNetworkCommunicationsLibrary_getModulePresence + (JNIEnv *, jclass, jint, jbyte) +{ + assert(false); + return 0; +} +/* + * Class: edu_wpi_first_wpilibj_communication_FRC_NetworkCommunicationsLibrary + * Method: getTargetClass + * Signature: ()I + */ +JNIEXPORT jint JNICALL Java_edu_wpi_first_wpilibj_communication_FRCNetworkCommunicationsLibrary_getTargetClass + (JNIEnv *, jclass) +{ + assert(false); + return 0; +} +/* + * Class: edu_wpi_first_wpilibj_communication_FRC_NetworkCommunicationsLibrary + * Method: FRC_NetworkCommunication_nLoadOut_getModulePresence + * Signature: (IB)I + */ +JNIEXPORT jint JNICALL Java_edu_wpi_first_wpilibj_communication_FRCNetworkCommunicationsLibrary_FRCNetworkCommunicationLoadOutGetModulePresence + (JNIEnv *, jclass, jint, jbyte) +{ + assert(false); + return 0; +} +/* + * Class: edu_wpi_first_wpilibj_communication_FRC_NetworkCommunicationsLibrary + * Method: FRC_NetworkCommunication_nLoadOut_getTargetClass + * Signature: ()I + */ +JNIEXPORT jint JNICALL Java_edu_wpi_first_wpilibj_communication_FRCNetworkCommunicationsLibrary_FRCNetworkCommunicationLoadOutGetTargetClass + (JNIEnv *, jclass) +{ + assert(false); +} +/* + * Class: edu_wpi_first_wpilibj_communication_FRC_NetworkCommunicationsLibrary + * Method: report + * Signature: (IBBLjava/lang/String;)I + */ +JNIEXPORT jint JNICALL Java_edu_wpi_first_wpilibj_communication_FRCNetworkCommunicationsLibrary_report + (JNIEnv *, jclass, jint, jbyte, jbyte, jstring) +{ + assert(false); +} +/* + * Class: edu_wpi_first_wpilibj_communication_FRC_NetworkCommunicationsLibrary + * Method: FRC_NetworkCommunication_nUsageReporting_report + * Signature: (BBBLjava/lang/String;)I + */ +JNIEXPORT jint JNICALL Java_edu_wpi_first_wpilibj_communication_FRCNetworkCommunicationsLibrary_FRCNetworkCommunicationUsageReportingReport + (JNIEnv * paramEnv, jclass, jbyte paramResource, jbyte paramInstanceNumber, jbyte paramContext, jstring paramFeature) +{ + FILE_LOG(logDEBUG) << "Calling FRCNetworkCommunicationsLibrary report " << "res:"<< (unsigned int)paramResource << " instance:" << (unsigned int)paramInstanceNumber << " context:" << (unsigned int)paramContext << " feature:" << paramFeature; + const char * featureStr = paramEnv->GetStringUTFChars(paramFeature, NULL); + jint returnValue = HALReport(paramResource, paramInstanceNumber, paramContext, featureStr); + paramEnv->ReleaseStringUTFChars(paramFeature,featureStr); + return returnValue; +} +/* + * Class: edu_wpi_first_wpilibj_communication_FRC_NetworkCommunicationsLibrary + * Method: getFPGAHardwareVersion + * Signature: (Ljava/nio/ShortBuffer;Ljava/nio/IntBuffer;)V + */ +JNIEXPORT void JNICALL Java_edu_wpi_first_wpilibj_communication_FRCNetworkCommunicationsLibrary_getFPGAHardwareVersion + (JNIEnv *, jclass, jobject, jobject) +{ + assert(false); +} + +// +// field ids +// +bool initializeComplete = false; +jclass dataClass; +jfieldID packetIndexFieldID; +jfieldID controlFieldID; +jfieldID dsDigitalInFieldID; +jfieldID teamIDFieldID; +jfieldID dsID_AllianceFieldID; +jfieldID dsID_PositionFieldID; +jfieldID stick0AxesFieldID; +jfieldID stick0ButtonsFieldID; +jfieldID stick1AxesFieldID; +jfieldID stick1ButtonsFieldID; +jfieldID stick2AxesFieldID; +jfieldID stick2ButtonsFieldID; +jfieldID stick3AxesFieldID; +jfieldID stick3ButtonsFieldID; +jfieldID analog1FieldID; +jfieldID analog2FieldID; +jfieldID analog3FieldID; +jfieldID analog4FieldID; +jfieldID cRIOChecksumFieldID; +jfieldID FPGAChecksum0FieldID; +jfieldID FPGAChecksum1FieldID; +jfieldID FPGAChecksum2FieldID; +jfieldID FPGAChecksum3FieldID; +jfieldID versionDataFieldID; + +/* + * Class: edu_wpi_first_wpilibj_communication_FRC_NetworkCommunicationsLibrary + * Method: getCommonControlData + * Signature: (Ledu/wpi/first/wpilibj/communication/FRCCommonControlData;I)I + */ +JNIEXPORT jint JNICALL Java_edu_wpi_first_wpilibj_communication_FRCNetworkCommunicationsLibrary_getCommonControlData + (JNIEnv * env, jclass, jobject controlData) +{ + HALCommonControlData controlDataNative; + + controlDataNative.packetIndex = 0xFF; + controlDataNative.control = 0xFF; + + int returnValue = HALGetCommonControlData(&controlDataNative, HAL_WAIT_FOREVER); + + //FILE_LOG(logDEBUG) << "PacketIndex: " << (void*)controlDataNative.packetIndex << " Control: " << (void*)controlDataNative.control << " ReturnValue: " << (void*)returnValue; + + if(!initializeComplete) + { + // control data class + dataClass = (jclass)env->NewGlobalRef(env->GetObjectClass(controlData)); + //dataClass = env->GetObjectClass(controlData); + // public short packetIndex; + packetIndexFieldID = env->GetFieldID(dataClass, "packetIndex", "S" ); + // public byte control; + controlFieldID = env->GetFieldID(dataClass, "control", "B" ); + // public byte dsDigitalIn; + dsDigitalInFieldID = env->GetFieldID(dataClass, "dsDigitalIn", "B" ); + // public short teamID; + teamIDFieldID = env->GetFieldID(dataClass, "teamID", "S" ); + // public byte dsID_Alliance; + dsID_AllianceFieldID = env->GetFieldID(dataClass, "dsID_Alliance", "B" ); + // public byte dsID_Position; + dsID_PositionFieldID = env->GetFieldID(dataClass, "dsID_Position", "B" ); + // public byte[] stick0Axes; + stick0AxesFieldID = env->GetFieldID(dataClass, "stick0Axes", "[B" ); + // public short stick0Buttons; + stick0ButtonsFieldID = env->GetFieldID(dataClass, "stick0Buttons", "S" ); + // public byte[] stick1Axes; + stick1AxesFieldID = env->GetFieldID(dataClass, "stick1Axes", "[B" ); + // public short stick1Buttons; + stick1ButtonsFieldID = env->GetFieldID(dataClass, "stick1Buttons", "S" ); + // public byte[] stick2Axes; + stick2AxesFieldID = env->GetFieldID(dataClass, "stick2Axes", "[B" ); + // public short stick2Buttons; + stick2ButtonsFieldID = env->GetFieldID(dataClass, "stick2Buttons", "S" ); + // public byte[] stick3Axes; + stick3AxesFieldID = env->GetFieldID(dataClass, "stick3Axes", "[B" ); + // public short stick3Buttons; + stick3ButtonsFieldID = env->GetFieldID(dataClass, "stick3Buttons", "S" ); + // public short analog1; + analog1FieldID = env->GetFieldID(dataClass, "analog1", "S" ); + // public short analog2; + analog2FieldID = env->GetFieldID(dataClass, "analog2", "S" ); + // public short analog3; + analog3FieldID = env->GetFieldID(dataClass, "analog3", "S" ); + // public short analog4; + analog4FieldID = env->GetFieldID(dataClass, "analog4", "S" ); + // public long cRIOChecksum; + cRIOChecksumFieldID = env->GetFieldID(dataClass, "cRIOChecksum", "J" ); + // public int FPGAChecksum0; + FPGAChecksum0FieldID = env->GetFieldID(dataClass, "FPGAChecksum0", "I" ); + // public int FPGAChecksum1; + FPGAChecksum1FieldID = env->GetFieldID(dataClass, "FPGAChecksum1", "I" ); + // public int FPGAChecksum2; + FPGAChecksum2FieldID = env->GetFieldID(dataClass, "FPGAChecksum2", "I" ); + // public int FPGAChecksum3; + FPGAChecksum3FieldID = env->GetFieldID(dataClass, "FPGAChecksum3", "I" ); + // public byte[] versionData; + versionDataFieldID = env->GetFieldID(dataClass, "versionData", "[B" ); + + initializeComplete = true; + } + + //FILE_LOG(logDEBUG) << "PacketIndex : " << (short)controlDataNative.packetIndex; + env->SetShortField(controlData,packetIndexFieldID, controlDataNative.packetIndex); + //FILE_LOG(logDEBUG) << "Control : " << (short)controlDataNative.control; + env->SetByteField(controlData,controlFieldID, controlDataNative.control); + env->SetByteField(controlData,dsDigitalInFieldID, controlDataNative.dsDigitalIn); + env->SetShortField(controlData,teamIDFieldID, controlDataNative.teamID); + env->SetByteField(controlData,dsID_AllianceFieldID, controlDataNative.dsID_Alliance); + env->SetByteField(controlData,dsID_PositionFieldID, controlDataNative.dsID_Position); + + // process the axes for joystick 0 + jobject stick0Axes = env->GetObjectField(controlData, stick0AxesFieldID); + jbyteArray * stick0AxesPtr = reinterpret_cast(&stick0Axes); + jbyte * stick0AxesBytePtr = env->GetByteArrayElements(*stick0AxesPtr,NULL); + + for( short axisCount = 0; axisCount < 6; axisCount++) + { + stick0AxesBytePtr[axisCount]=controlDataNative.stick0Axes[axisCount]; + } + + env->ReleaseByteArrayElements(*stick0AxesPtr,stick0AxesBytePtr,0); + + // /** C type : field2_union */ + // public field2_union field2; + // /** Left-most 4 bits are unused */ + env->SetShortField(controlData,stick0ButtonsFieldID, controlDataNative.stick0Buttons); + + // process the axes for joystick 1 + jobject stick1Axes = env->GetObjectField(controlData, stick1AxesFieldID); + jbyteArray * stick1AxesPtr = reinterpret_cast(&stick1Axes); + jbyte * stick1AxesBytePtr = env->GetByteArrayElements(*stick1AxesPtr,NULL); + + for( short axisCount = 0; axisCount < 6; axisCount++) + { + stick1AxesBytePtr[axisCount]=controlDataNative.stick1Axes[axisCount]; + } + + env->ReleaseByteArrayElements(*stick1AxesPtr,stick1AxesBytePtr,0); + + // /** C type : field3_union */ + // public field3_union field3; + // /** Left-most 4 bits are unused */ + env->SetShortField(controlData,stick1ButtonsFieldID, controlDataNative.stick1Buttons); + + // process the axes for joystick 2 + jobject stick2Axes = env->GetObjectField(controlData, stick2AxesFieldID); + jbyteArray * stick2AxesPtr = reinterpret_cast(&stick2Axes); + jbyte * stick2AxesBytePtr = env->GetByteArrayElements(*stick2AxesPtr,NULL); + + for( short axisCount = 0; axisCount < 6; axisCount++) + { + stick2AxesBytePtr[axisCount]=controlDataNative.stick2Axes[axisCount]; + } + + env->ReleaseByteArrayElements(*stick2AxesPtr,stick2AxesBytePtr,0); + + // /** C type : field4_union */ + // public field4_union field4; + // /** Left-most 4 bits are unused */ + env->SetShortField(controlData,stick2ButtonsFieldID, controlDataNative.stick2Buttons); + + // process the axes for joystick 3 + jobject stick3Axes = env->GetObjectField(controlData, stick3AxesFieldID); + jbyteArray * stick3AxesPtr = reinterpret_cast(&stick3Axes); + jbyte * stick3AxesBytePtr = env->GetByteArrayElements(*stick3AxesPtr,NULL); + + for( short axisCount = 0; axisCount < 6; axisCount++) + { + stick3AxesBytePtr[axisCount]=controlDataNative.stick3Axes[axisCount]; + } + + env->ReleaseByteArrayElements(*stick3AxesPtr,stick3AxesBytePtr,0); + + // /** C type : field5_union */ + // public field5_union field5; + // /** Left-most 4 bits are unused */ + env->SetShortField(controlData,stick3ButtonsFieldID, controlDataNative.stick3Buttons); + // /** Analog inputs are 10 bit right-justified */ + env->SetShortField(controlData,analog1FieldID, controlDataNative.analog1); + env->SetShortField(controlData,analog2FieldID, controlDataNative.analog2); + env->SetShortField(controlData,analog3FieldID, controlDataNative.analog3); + env->SetShortField(controlData,analog4FieldID, controlDataNative.analog4); + env->SetLongField(controlData,cRIOChecksumFieldID, controlDataNative.cRIOChecksum); + env->SetIntField(controlData,FPGAChecksum0FieldID, controlDataNative.FPGAChecksum0); + env->SetIntField(controlData,FPGAChecksum1FieldID, controlDataNative.FPGAChecksum1); + env->SetIntField(controlData,FPGAChecksum2FieldID, controlDataNative.FPGAChecksum2); + env->SetIntField(controlData,FPGAChecksum3FieldID, controlDataNative.FPGAChecksum3); + // /** C type : char[8] */ + // public byte[] versionData; + jobject versionData = env->GetObjectField(controlData, versionDataFieldID); + jbyteArray * versionDataPtr = reinterpret_cast(&versionData); + jbyte * versionDataBytePtr = env->GetByteArrayElements(*versionDataPtr,NULL); + + for( short byteCount = 0; byteCount < 8; byteCount++) + { + versionDataBytePtr[byteCount]=controlDataNative.versionData[byteCount]; + } + + env->ReleaseByteArrayElements(*versionDataPtr,versionDataBytePtr,0); + + return returnValue; +} +/* + * Class: edu_wpi_first_wpilibj_communication_FRC_NetworkCommunicationsLibrary + * Method: getRecentCommonControlData + * Signature: (Ledu/wpi/first/wpilibj/communication/FRCCommonControlData;I)I + */ +JNIEXPORT jint JNICALL Java_edu_wpi_first_wpilibj_communication_FRCNetworkCommunicationsLibrary_getRecentCommonControlData + (JNIEnv *, jclass, jobject, jint) +{ + assert(false); +} +/* + * Class: edu_wpi_first_wpilibj_communication_FRC_NetworkCommunicationsLibrary + * Method: getRecentStatusData + * Signature: (Ljava/nio/ByteBuffer;Ljava/nio/ByteBuffer;Ljava/nio/ByteBuffer;I)I + */ +JNIEXPORT jint JNICALL Java_edu_wpi_first_wpilibj_communication_FRCNetworkCommunicationsLibrary_getRecentStatusData + (JNIEnv *, jclass, jobject, jobject, jobject, jint) +{ + assert(false); +} +/* + * Class: edu_wpi_first_wpilibj_communication_FRC_NetworkCommunicationsLibrary + * Method: getDynamicControlData + * Signature: (BLjava/nio/ByteBuffer;II)I + */ +JNIEXPORT jint JNICALL Java_edu_wpi_first_wpilibj_communication_FRCNetworkCommunicationsLibrary_getDynamicControlData + (JNIEnv *, jclass, jbyte, jobject, jint, jint) +{ + assert(false); +} + +/* + * Class: edu_wpi_first_wpilibj_communication_FRC_NetworkCommunicationsLibrary + * Method: setStatusData + * Signature: (FBBLjava/lang/String;ILjava/lang/String;II)I + */ +JNIEXPORT jint JNICALL Java_edu_wpi_first_wpilibj_communication_FRCNetworkCommunicationsLibrary_setStatusData + (JNIEnv * env, jclass, jfloat paramBattery, jbyte param1, jbyte param2, jstring paramUserDataHigh, jint param4, jstring paramUserDataLow, jint param6) +{ + //FILE_LOG(logDEBUG) << "Voltage - " << paramBattery; + const char * userDataHighStr = env->GetStringUTFChars(paramUserDataHigh, NULL); + const char * userDataLowStr = env->GetStringUTFChars(paramUserDataLow, NULL); + jint returnValue = HALSetStatusData(paramBattery, param1, param2, userDataHighStr, param4, userDataLowStr, param6, HAL_WAIT_FOREVER ); + env->ReleaseStringUTFChars(paramUserDataHigh,userDataHighStr); + env->ReleaseStringUTFChars(paramUserDataLow,userDataLowStr); + return returnValue; +} +/* + * Class: edu_wpi_first_wpilibj_communication_FRC_NetworkCommunicationsLibrary + * Method: setStatusDataFloatAsInt + * Signature: (IBBLjava/lang/String;ILjava/lang/String;II)I + */ +JNIEXPORT jint JNICALL Java_edu_wpi_first_wpilibj_communication_FRCNetworkCommunicationsLibrary_setStatusDataFloatAsInt + (JNIEnv *, jclass, jint, jbyte, jbyte, jstring, jint, jstring, jint, jint) +{ + assert(false); +} +/* + * Class: edu_wpi_first_wpilibj_communication_FRC_NetworkCommunicationsLibrary + * Method: setErrorData + * Signature: (Ljava/lang/String;II)I + */ +JNIEXPORT jint JNICALL Java_edu_wpi_first_wpilibj_communication_FRCNetworkCommunicationsLibrary_setErrorData + (JNIEnv *, jclass, jstring, jint, jint) +{ + assert(false); +} +/* + * Class: edu_wpi_first_wpilibj_communication_FRC_NetworkCommunicationsLibrary + * Method: setUserDsLcdData + * Signature: (Ljava/lang/String;II)I + */ +JNIEXPORT jint JNICALL Java_edu_wpi_first_wpilibj_communication_FRCNetworkCommunicationsLibrary_setUserDsLcdData + (JNIEnv *, jclass, jstring, jint, jint) +{ + assert(false); +} +/* + * Class: edu_wpi_first_wpilibj_communication_FRC_NetworkCommunicationsLibrary + * Method: overrideIOConfig + * Signature: (Ljava/lang/String;I)I + */ +JNIEXPORT jint JNICALL Java_edu_wpi_first_wpilibj_communication_FRCNetworkCommunicationsLibrary_overrideIOConfig + (JNIEnv *, jclass, jstring, jint) +{ + assert(false); +} +/* + * Class: edu_wpi_first_wpilibj_communication_FRC_NetworkCommunicationsLibrary + * Method: signalResyncActionDone + * Signature: ()V + */ +JNIEXPORT void JNICALL Java_edu_wpi_first_wpilibj_communication_FRCNetworkCommunicationsLibrary_signalResyncActionDone + (JNIEnv *, jclass) +{ + assert(false); +} +/* + * Class: edu_wpi_first_wpilibj_communication_FRC_NetworkCommunicationsLibrary + * Method: setNewDataOccurRef + * Signature: (I)V + */ +JNIEXPORT void JNICALL Java_edu_wpi_first_wpilibj_communication_FRCNetworkCommunicationsLibrary_setNewDataOccurRef + (JNIEnv *, jclass, jint) +{ + assert(false); +} +/* + * Class: edu_wpi_first_wpilibj_communication_FRC_NetworkCommunicationsLibrary + * Method: setResyncOccurRef + * Signature: (I)V + */ +JNIEXPORT void JNICALL Java_edu_wpi_first_wpilibj_communication_FRCNetworkCommunicationsLibrary_setResyncOccurRef + (JNIEnv *, jclass, jint) +{ + assert(false); +} +/* + * Class: edu_wpi_first_wpilibj_communication_FRC_NetworkCommunicationsLibrary + * Method: FRC_NetworkCommunication_getVersionString + * Signature: (Ljava/nio/ByteBuffer;)V + */ +JNIEXPORT void JNICALL Java_edu_wpi_first_wpilibj_communication_FRCNetworkCommunicationsLibrary_FRCNetworkCommunicationGetVersionString + (JNIEnv *, jclass, jobject) +{ + assert(false); +} +/* + * Class: edu_wpi_first_wpilibj_communication_FRC_NetworkCommunicationsLibrary + * Method: FRC_NetworkCommunication_observeUserProgramStarting + * Signature: ()V + */ +JNIEXPORT void JNICALL Java_edu_wpi_first_wpilibj_communication_FRCNetworkCommunicationsLibrary_FRCNetworkCommunicationObserveUserProgramStarting + (JNIEnv *, jclass) +{ + HALNetworkCommunicationObserveUserProgramStarting(); +} +/* + * Class: edu_wpi_first_wpilibj_communication_FRC_NetworkCommunicationsLibrary + * Method: FRC_NetworkCommunication_observeUserProgramDisabled + * Signature: ()V + */ +JNIEXPORT void JNICALL Java_edu_wpi_first_wpilibj_communication_FRCNetworkCommunicationsLibrary_FRCNetworkCommunicationObserveUserProgramDisabled + (JNIEnv *, jclass) +{ + HALNetworkCommunicationObserveUserProgramDisabled(); +} +/* + * Class: edu_wpi_first_wpilibj_communication_FRC_NetworkCommunicationsLibrary + * Method: FRC_NetworkCommunication_observeUserProgramAutonomous + * Signature: ()V + */ +JNIEXPORT void JNICALL Java_edu_wpi_first_wpilibj_communication_FRCNetworkCommunicationsLibrary_FRCNetworkCommunicationObserveUserProgramAutonomous + (JNIEnv *, jclass) +{ + HALNetworkCommunicationObserveUserProgramAutonomous(); +} + +/* + * Class: edu_wpi_first_wpilibj_communication_FRC_NetworkCommunicationsLibrary + * Method: FRC_NetworkCommunication_observeUserProgramTeleop + * Signature: ()V + */ +JNIEXPORT void JNICALL Java_edu_wpi_first_wpilibj_communication_FRCNetworkCommunicationsLibrary_FRCNetworkCommunicationObserveUserProgramTeleop + (JNIEnv *, jclass) +{ + HALNetworkCommunicationObserveUserProgramTeleop(); +} + +/* + * Class: edu_wpi_first_wpilibj_communication_FRC_NetworkCommunicationsLibrary + * Method: FRC_NetworkCommunication_observeUserProgramTest + * Signature: ()V + */ +JNIEXPORT void JNICALL Java_edu_wpi_first_wpilibj_communication_FRCNetworkCommunicationsLibrary_FRCNetworkCommunicationObserveUserProgramTest + (JNIEnv *, jclass) +{ + HALNetworkCommunicationObserveUserProgramTest(); +} + +/* + * Class: edu_wpi_first_wpilibj_communication_FRCNetworkCommunicationsLibrary + * Method: FRCNetworkCommunicationReserve + * Signature: ()V + */ +JNIEXPORT void JNICALL Java_edu_wpi_first_wpilibj_communication_FRCNetworkCommunicationsLibrary_FRCNetworkCommunicationReserve + (JNIEnv *, jclass) +{ + HALNetworkCommunicationReserve(); +} + +/* + * Class: edu_wpi_first_wpilibj_communication_FRCNetworkCommunicationsLibrary + * Method: setNewDataSem + * Signature: ([B)V + */ +JNIEXPORT void JNICALL Java_edu_wpi_first_wpilibj_communication_FRCNetworkCommunicationsLibrary_setNewDataSem + (JNIEnv * env, jclass, jobject id ) +{ + MUTEX_ID* javaId = (MUTEX_ID*)env->GetDirectBufferAddress(id); + FILE_LOG(logDEBUG) << "Mutex Ptr = " << *javaId; + HALSetNewDataSem(*javaId); +} + +/* + * Class: edu_wpi_first_wpilibj_communication_FRCNetworkCommunicationsLibrary + * Method: JNIValueParameterTest + * Signature: (ZBCSIJFD)V + */ +JNIEXPORT void JNICALL Java_edu_wpi_first_wpilibj_communication_FRCNetworkCommunicationsLibrary_JNIValueParameterTest + (JNIEnv *, jclass, jboolean booleanParam, jbyte byteParam, jchar charParam, jshort shortParam, jint intParam, jlong longParam, jfloat floatParam, jdouble doubleParam) +{ + FILE_LOG(logDEBUG) << "Boolean: " << booleanParam; + FILE_LOG(logDEBUG) << "Byte : " << byteParam; + FILE_LOG(logDEBUG) << "Char : " << charParam; + FILE_LOG(logDEBUG) << "Short : " << shortParam; + FILE_LOG(logDEBUG) << "Int : " << intParam; + FILE_LOG(logDEBUG) << "Long : " << longParam; + FILE_LOG(logDEBUG) << "Float : " << floatParam; + FILE_LOG(logDEBUG) << "Double : " << doubleParam; +} + +/* + * Class: edu_wpi_first_wpilibj_communication_FRCNetworkCommunicationsLibrary + * Method: JNIValueReturnBooleanTest + * Signature: (Z)Z + */ +JNIEXPORT jboolean JNICALL Java_edu_wpi_first_wpilibj_communication_FRCNetworkCommunicationsLibrary_JNIValueReturnBooleanTest + (JNIEnv *, jclass, jboolean booleanParam ) +{ + FILE_LOG(logDEBUG) << "Boolean: " << booleanParam; + return !booleanParam; +} + +/* + * Class: edu_wpi_first_wpilibj_communication_FRCNetworkCommunicationsLibrary + * Method: JNIValueReturnByteTest + * Signature: (B)B + */ +JNIEXPORT jbyte JNICALL Java_edu_wpi_first_wpilibj_communication_FRCNetworkCommunicationsLibrary_JNIValueReturnByteTest + (JNIEnv *, jclass, jbyte byteParam) +{ + FILE_LOG(logDEBUG) << "Byte: " << byteParam; + return byteParam+1; +} + +/* + * Class: edu_wpi_first_wpilibj_communication_FRCNetworkCommunicationsLibrary + * Method: JNIValueReturnCharTest + * Signature: (C)C + */ +JNIEXPORT jchar JNICALL Java_edu_wpi_first_wpilibj_communication_FRCNetworkCommunicationsLibrary_JNIValueReturnCharTest + (JNIEnv *, jclass, jchar charParam) +{ + FILE_LOG(logDEBUG) << "Char: " << charParam; + return charParam+1; +} + +/* + * Class: edu_wpi_first_wpilibj_communication_FRCNetworkCommunicationsLibrary + * Method: JNIValueReturnShortTest + * Signature: (S)S + */ +JNIEXPORT jshort JNICALL Java_edu_wpi_first_wpilibj_communication_FRCNetworkCommunicationsLibrary_JNIValueReturnShortTest + (JNIEnv *, jclass, jshort shortParam) +{ + FILE_LOG(logDEBUG) << "Short: " << shortParam; + return shortParam+1; +} + +/* + * Class: edu_wpi_first_wpilibj_communication_FRCNetworkCommunicationsLibrary + * Method: JNIValueReturnIntTest + * Signature: (I)I + */ +JNIEXPORT jint JNICALL Java_edu_wpi_first_wpilibj_communication_FRCNetworkCommunicationsLibrary_JNIValueReturnIntTest + (JNIEnv *, jclass, jint intParam) +{ + FILE_LOG(logDEBUG) << "Int: " << intParam; + return intParam+1; +} + +/* + * Class: edu_wpi_first_wpilibj_communication_FRCNetworkCommunicationsLibrary + * Method: JNIValueReturnLongTest + * Signature: (J)J + */ +JNIEXPORT jlong JNICALL Java_edu_wpi_first_wpilibj_communication_FRCNetworkCommunicationsLibrary_JNIValueReturnLongTest + (JNIEnv *, jclass, jlong longParam) +{ + FILE_LOG(logDEBUG) << "Long: " << longParam; + return longParam+1; +} + +/* + * Class: edu_wpi_first_wpilibj_communication_FRCNetworkCommunicationsLibrary + * Method: JNIValueReturnFloatTest + * Signature: (F)F + */ +JNIEXPORT jfloat JNICALL Java_edu_wpi_first_wpilibj_communication_FRCNetworkCommunicationsLibrary_JNIValueReturnFloatTest + (JNIEnv *, jclass, jfloat floatParam) +{ + FILE_LOG(logDEBUG) << "Float: " << floatParam; + return floatParam/100.0f; +} + +/* + * Class: edu_wpi_first_wpilibj_communication_FRCNetworkCommunicationsLibrary + * Method: JNIValueReturnDoubleTest + * Signature: (D)D + */ +JNIEXPORT jdouble JNICALL Java_edu_wpi_first_wpilibj_communication_FRCNetworkCommunicationsLibrary_JNIValueReturnDoubleTest + (JNIEnv *, jclass, jdouble doubleParam) +{ + FILE_LOG(logDEBUG) << "Double: " << doubleParam; + return doubleParam * 100.0; +} + +/* + * Class: edu_wpi_first_wpilibj_communication_FRCNetworkCommunicationsLibrary + * Method: JNIObjectReturnString + * Signature: (Ljava/lang/String;)Ljava/lang/String; + */ +JNIEXPORT jstring JNICALL Java_edu_wpi_first_wpilibj_communication_FRCNetworkCommunicationsLibrary_JNIObjectReturnStringTest + (JNIEnv * env, jclass, jstring stringParam) +{ + const char * stringParamLocal = env->GetStringUTFChars(stringParam, NULL); + FILE_LOG(logDEBUG) << "String: " << stringParamLocal; + env->ReleaseStringUTFChars(stringParam,stringParamLocal); + + char returnStringLocal[] = "this is the return string"; + + return env->NewStringUTF(returnStringLocal); +} + +/* + * Class: edu_wpi_first_wpilibj_communication_FRCNetworkCommunicationsLibrary + * Method: JNIObjectReturnByteBufferTest + * Signature: (Ljava/nio/ByteBuffer;)Ljava/nio/ByteBuffer; + */ +JNIEXPORT jobject JNICALL Java_edu_wpi_first_wpilibj_communication_FRCNetworkCommunicationsLibrary_JNIObjectReturnByteBufferTest + (JNIEnv * env, jclass, jobject byteArrayIn ) +{ + jbyte * byteArray = (jbyte*)env->GetDirectBufferAddress(byteArrayIn); + FILE_LOG(logDEBUG) << "Ptr: " << (long)byteArray; + jlong byteArrayLength = env->GetDirectBufferCapacity(byteArrayIn); + FILE_LOG(logDEBUG) << "Capacity: " << byteArrayLength; + FILE_LOG(logDEBUG) << "Byte0: " << (short)byteArray[0]; + FILE_LOG(logDEBUG) << "Byte1: " << (short)byteArray[1]; + FILE_LOG(logDEBUG) << "Byte2: " << (short)byteArray[2]; + FILE_LOG(logDEBUG) << "Byte3: " << (short)byteArray[3]; + + jbyte * returnByteArray = new jbyte[4]; + returnByteArray[0] = byteArray[0]; + returnByteArray[1] = byteArray[1]; + returnByteArray[2] = byteArray[2]; + returnByteArray[3] = byteArray[3]; + + return env->NewDirectByteBuffer(returnByteArray, 4); +} + +/* + * Class: edu_wpi_first_wpilibj_communication_FRCNetworkCommunicationsLibrary + * Method: JNIObjectAndParamReturnIntBufferTest + * Signature: (Ljava/nio/IntBuffer;)Ljava/nio/ByteBuffer; + */ +JNIEXPORT jobject JNICALL Java_edu_wpi_first_wpilibj_communication_FRCNetworkCommunicationsLibrary_JNIObjectAndParamReturnIntBufferTest + (JNIEnv * env, jclass, jobject intArrayIn) +{ + jint * intArray = (jint*)env->GetDirectBufferAddress(intArrayIn); + jbyte * byteArray = (jbyte*)env->GetDirectBufferAddress(intArrayIn); + FILE_LOG(logDEBUG) << "Ptr: " << (long)intArray; + jlong byteArrayLength = env->GetDirectBufferCapacity(intArrayIn); + FILE_LOG(logDEBUG) << "Capacity: " << byteArrayLength; + FILE_LOG(logDEBUG) << "Int0: " << intArray[0]; + FILE_LOG(logDEBUG) << "Byte0: " << (short)byteArray[0]; + FILE_LOG(logDEBUG) << "Byte1: " << (short)byteArray[1]; + FILE_LOG(logDEBUG) << "Byte2: " << (short)byteArray[2]; + FILE_LOG(logDEBUG) << "Byte3: " << (short)byteArray[3]; + + // increment the param + intArray[0]++; + + jbyte * returnByteArray = new jbyte[4]; + returnByteArray[0] = byteArray[0]; + returnByteArray[1] = byteArray[1]; + returnByteArray[2] = byteArray[2]; + returnByteArray[3] = byteArray[3]; + + return env->NewDirectByteBuffer(returnByteArray, 4); +} diff --git a/wpilibj/wpilibJavaJNI/src/main/native/HALUtil.cpp b/wpilibj/wpilibJavaJNI/src/main/native/HALUtil.cpp new file mode 100644 index 0000000000..ef3e8abd5c --- /dev/null +++ b/wpilibj/wpilibJavaJNI/src/main/native/HALUtil.cpp @@ -0,0 +1,130 @@ +#include +#include +#include "log.h" +#include "edu_wpi_first_wpilibj_hal_HALUtil.h" +#include "HAL/HAL.h" + +// set the logging level +TLogLevel halUtilLogLevel = logDEBUG; + +#define HALUTIL_LOG(level) \ + if (level > halUtilLogLevel) ; \ + else Log().Get(level) + + +// +// indicate JNI version support desired +// +JNIEXPORT jint JNICALL JNI_OnLoad(JavaVM *vm, void *reserved) +{ + // set our logging level + Log::ReportingLevel() = logDEBUG; + return JNI_VERSION_1_6; +} + +/* + * Class: edu_wpi_first_wpilibj_hal_HALUtil + * Method: initializeMutex + * Signature: (I)Ljava/nio/ByteBuffer; + */ +JNIEXPORT jobject JNICALL Java_edu_wpi_first_wpilibj_hal_HALUtil_initializeMutexNormal +(JNIEnv * env, jclass) +{ + HALUTIL_LOG(logDEBUG) << "Calling HALUtil initializeMutex"; + MUTEX_ID* mutexPtr = (MUTEX_ID*)new unsigned char[4]; + *mutexPtr = initializeMutexNormal(); + HALUTIL_LOG(logDEBUG) << "Mutex Ptr = " << *mutexPtr; + return env->NewDirectByteBuffer( mutexPtr, 4); +} + +/* + * Class: edu_wpi_first_wpilibj_hal_HALUtil + * Method: deleteMutex + * Signature: (Ljava/nio/ByteBuffer;)V + */ +JNIEXPORT void JNICALL Java_edu_wpi_first_wpilibj_hal_HALUtil_deleteMutex +(JNIEnv * env, jclass, jobject id ) +{ + HALUTIL_LOG(logDEBUG) << "Calling HALUtil deleteMutex"; + MUTEX_ID* javaId = (MUTEX_ID*)env->GetDirectBufferAddress(id); + HALUTIL_LOG(logDEBUG) << "Mutex Ptr = " << *javaId; + deleteMutex( *javaId ); +} + +/* + * Class: edu_wpi_first_wpilibj_hal_HALUtil + * Method: takeMutex + * Signature: (Ljava/nio/ByteBuffer;I)B + */ +JNIEXPORT jbyte JNICALL Java_edu_wpi_first_wpilibj_hal_HALUtil_takeMutex +(JNIEnv * env, jclass, jobject id) +{ + //HALUTIL_LOG(logDEBUG) << "Calling HALUtil takeMutex"; + MUTEX_ID* javaId = (MUTEX_ID*)env->GetDirectBufferAddress(id); + //HALUTIL_LOG(logDEBUG) << "Mutex Ptr = " << *javaId; + jbyte returnValue = takeMutex(*javaId); + //HALUTIL_LOG(logDEBUG) << "Take Result = " << (void*)returnValue; + return returnValue; +} + +/* + * Class: edu_wpi_first_wpilibj_hal_HALUtil + * Method: getFPGAVersion + * Signature: (Ljava/nio/IntBuffer;)S + */ +JNIEXPORT jshort JNICALL Java_edu_wpi_first_wpilibj_hal_HALUtil_getFPGAVersion + (JNIEnv * env, jclass, jobject status) +{ + HALUTIL_LOG(logDEBUG) << "Calling HALUtil getFPGAVersion"; + jint * statusPtr = (jint*)env->GetDirectBufferAddress(status); + jshort returnValue = getFPGAVersion( statusPtr ); + HALUTIL_LOG(logDEBUG) << "Status = " << *statusPtr; + HALUTIL_LOG(logDEBUG) << "FPGAVersion = " << returnValue; + return returnValue; +} + +/* + * Class: edu_wpi_first_wpilibj_hal_HALUtil + * Method: getFPGARevision + * Signature: (Ljava/nio/IntBuffer;)I + */ +JNIEXPORT jint JNICALL Java_edu_wpi_first_wpilibj_hal_HALUtil_getFPGARevision + (JNIEnv * env, jclass, jobject status) +{ + HALUTIL_LOG(logDEBUG) << "Calling HALUtil getFPGARevision"; + jint * statusPtr = (jint*)env->GetDirectBufferAddress(status); + jint returnValue = getFPGARevision( statusPtr ); + HALUTIL_LOG(logDEBUG) << "Status = " << *statusPtr; + HALUTIL_LOG(logDEBUG) << "FPGARevision = " << returnValue; + return returnValue; +} + +/* + * Class: edu_wpi_first_wpilibj_hal_HALUtil + * Method: getFPGATime + * Signature: (Ljava/nio/IntBuffer;)I + */ +JNIEXPORT jlong JNICALL Java_edu_wpi_first_wpilibj_hal_HALUtil_getFPGATime + (JNIEnv * env, jclass, jobject status) +{ + //HALUTIL_LOG(logDEBUG) << "Calling HALUtil getFPGATime"; + jint * statusPtr = (jint*)env->GetDirectBufferAddress(status); + jlong returnValue = getFPGATime( statusPtr ); + //HALUTIL_LOG(logDEBUG) << "Status = " << *statusPtr; + //HALUTIL_LOG(logDEBUG) << "FPGATime = " << returnValue; + return returnValue; + +} + +/* + * Class: edu_wpi_first_wpilibj_hal_HALUtil + * Method: getHALErrorMessage + * Signature: (I)Ljava/lang/String; + */ +JNIEXPORT jstring JNICALL Java_edu_wpi_first_wpilibj_hal_HALUtil_getHALErrorMessage + (JNIEnv * paramEnv, jclass, jint paramId) +{ + const char * msg = getHALErrorMessage(paramId); + HALUTIL_LOG(logDEBUG) << "Calling HALUtil getHALErrorMessage id=" << paramId << " msg=" << msg; + return paramEnv->NewStringUTF(msg); +} diff --git a/wpilibj/wpilibJavaJNI/src/main/native/I2CJNI.cpp b/wpilibj/wpilibJavaJNI/src/main/native/I2CJNI.cpp new file mode 100644 index 0000000000..2b98dc0e9e --- /dev/null +++ b/wpilibj/wpilibJavaJNI/src/main/native/I2CJNI.cpp @@ -0,0 +1,35 @@ +#include +#include +#include "log.h" + +#include "edu_wpi_first_wpilibj_hal_I2CJNI.h" + + +// set the logging level +TLogLevel i2cJNILogLevel = logDEBUG; + +#define I2CJNI_LOG(level) \ + if (level > i2cJNILogLevel) ; \ + else Log().Get(level) + +/* + * Class: edu_wpi_first_wpilibj_hal_I2CJNI + * Method: doI2CTransaction + * Signature: (BBLjava/nio/ByteBuffer;BLjava/nio/ByteBuffer;BLjava/nio/IntBuffer;)B + */ +JNIEXPORT jbyte JNICALL Java_edu_wpi_first_wpilibj_hal_I2CJNI_doI2CTransaction + (JNIEnv *, jclass, jbyte, jbyte, jobject, jbyte, jobject, jbyte, jobject) +{ + assert(false); +} + +/* + * Class: edu_wpi_first_wpilibj_hal_I2CJNI + * Method: doI2CTransactionWithModule + * Signature: (BBBLjava/nio/ByteBuffer;BLjava/nio/ByteBuffer;BLjava/nio/IntBuffer;)B + */ +JNIEXPORT jbyte JNICALL Java_edu_wpi_first_wpilibj_hal_I2CJNI_doI2CTransactionWithModule + (JNIEnv *, jclass, jbyte, jbyte, jbyte, jobject, jbyte, jobject, jbyte, jobject) +{ + assert(false); +} diff --git a/wpilibj/wpilibJavaJNI/src/main/native/InterruptJNI.cpp b/wpilibj/wpilibJavaJNI/src/main/native/InterruptJNI.cpp new file mode 100644 index 0000000000..d4af298dd5 --- /dev/null +++ b/wpilibj/wpilibJavaJNI/src/main/native/InterruptJNI.cpp @@ -0,0 +1,113 @@ +#include +#include +#include "log.h" + +#include "edu_wpi_first_wpilibj_hal_InterruptJNI.h" + +/* + * Class: edu_wpi_first_wpilibj_hal_InterruptJNI + * Method: initializeInterrupts + * Signature: (IBLjava/nio/IntBuffer;)Ljava/nio/ByteBuffer; + */ +JNIEXPORT jobject JNICALL Java_edu_wpi_first_wpilibj_hal_InterruptJNI_initializeInterrupts + (JNIEnv *, jclass, jint, jbyte, jobject) +{ + assert(false); + +} + +/* + * Class: edu_wpi_first_wpilibj_hal_InterruptJNI + * Method: cleanInterrupts + * Signature: (Ljava/nio/ByteBuffer;Ljava/nio/IntBuffer;)V + */ +JNIEXPORT void JNICALL Java_edu_wpi_first_wpilibj_hal_InterruptJNI_cleanInterrupts + (JNIEnv *, jclass, jobject, jobject) +{ + assert(false); + +} + +/* + * Class: edu_wpi_first_wpilibj_hal_InterruptJNI + * Method: waitForInterrupt + * Signature: (Ljava/nio/ByteBuffer;DLjava/nio/IntBuffer;)V + */ +JNIEXPORT void JNICALL Java_edu_wpi_first_wpilibj_hal_InterruptJNI_waitForInterrupt + (JNIEnv *, jclass, jobject, jdouble, jobject) +{ + assert(false); + +} + +/* + * Class: edu_wpi_first_wpilibj_hal_InterruptJNI + * Method: enableInterrupts + * Signature: (Ljava/nio/ByteBuffer;Ljava/nio/IntBuffer;)V + */ +JNIEXPORT void JNICALL Java_edu_wpi_first_wpilibj_hal_InterruptJNI_enableInterrupts + (JNIEnv *, jclass, jobject, jobject) +{ + assert(false); + +} + +/* + * Class: edu_wpi_first_wpilibj_hal_InterruptJNI + * Method: disableInterrupts + * Signature: (Ljava/nio/ByteBuffer;Ljava/nio/IntBuffer;)V + */ +JNIEXPORT void JNICALL Java_edu_wpi_first_wpilibj_hal_InterruptJNI_disableInterrupts + (JNIEnv *, jclass, jobject, jobject) +{ + assert(false); + +} + +/* + * Class: edu_wpi_first_wpilibj_hal_InterruptJNI + * Method: readInterruptTimestamp + * Signature: (Ljava/nio/ByteBuffer;Ljava/nio/IntBuffer;)D + */ +JNIEXPORT jdouble JNICALL Java_edu_wpi_first_wpilibj_hal_InterruptJNI_readInterruptTimestamp + (JNIEnv *, jclass, jobject, jobject) +{ + assert(false); + +} + +/* + * Class: edu_wpi_first_wpilibj_hal_InterruptJNI + * Method: requestInterrupts + * Signature: (Ljava/nio/ByteBuffer;BIBLjava/nio/IntBuffer;)V + */ +JNIEXPORT void JNICALL Java_edu_wpi_first_wpilibj_hal_InterruptJNI_requestInterrupts + (JNIEnv *, jclass, jobject, jbyte, jint, jbyte, jobject) +{ + assert(false); + +} + +/* + * Class: edu_wpi_first_wpilibj_hal_InterruptJNI + * Method: attachInterruptHandler + * Signature: (Ljava/nio/ByteBuffer;Ledu/wpi/first/wpilibj/hal/InterruptJNI/InterruptHandlerFunction;Ljava/nio/ByteBuffer;Ljava/nio/IntBuffer;)V + */ +JNIEXPORT void JNICALL Java_edu_wpi_first_wpilibj_hal_InterruptJNI_attachInterruptHandler + (JNIEnv *, jclass, jobject, jobject, jobject, jobject) +{ + assert(false); + +} + +/* + * Class: edu_wpi_first_wpilibj_hal_InterruptJNI + * Method: setInterruptUpSourceEdge + * Signature: (Ljava/nio/ByteBuffer;BBLjava/nio/IntBuffer;)V + */ +JNIEXPORT void JNICALL Java_edu_wpi_first_wpilibj_hal_InterruptJNI_setInterruptUpSourceEdge + (JNIEnv *, jclass, jobject, jbyte, jbyte, jobject) +{ + assert(false); + +} diff --git a/wpilibj/wpilibJavaJNI/src/main/native/JNIWrapper.cpp b/wpilibj/wpilibJavaJNI/src/main/native/JNIWrapper.cpp new file mode 100644 index 0000000000..3f7f73c945 --- /dev/null +++ b/wpilibj/wpilibJavaJNI/src/main/native/JNIWrapper.cpp @@ -0,0 +1,25 @@ +#include +#include +#include "log.h" + +#include "edu_wpi_first_wpilibj_hal_JNIWrapper.h" + +#include "HAL/HAL.h" + +/* + * Class: edu_wpi_first_wpilibj_hal_JNIWrapper + * Method: getPortWithModule + * Signature: (BB)Ljava/nio/ByteBuffer; + */ +JNIEXPORT jobject JNICALL Java_edu_wpi_first_wpilibj_hal_JNIWrapper_getPortWithModule + (JNIEnv * env, jclass, jbyte module, jbyte pin) +{ + //FILE_LOG(logDEBUG) << "Calling JNIWrapper getPortWithModlue"; + //FILE_LOG(logDEBUG) << "Module = " << (jint)module; + //FILE_LOG(logDEBUG) << "Pin = " << (jint)pin; + void** portPtr = (void**)new unsigned char[4]; + *portPtr = getPortWithModule(module,pin); + //FILE_LOG(logDEBUG) << "Port Ptr = " << *portPtr; + return env->NewDirectByteBuffer( portPtr, 4); +} + diff --git a/wpilibj/wpilibJavaJNI/src/main/native/PWMJNI.cpp b/wpilibj/wpilibJavaJNI/src/main/native/PWMJNI.cpp new file mode 100644 index 0000000000..573285d782 --- /dev/null +++ b/wpilibj/wpilibJavaJNI/src/main/native/PWMJNI.cpp @@ -0,0 +1,244 @@ +#include +#include +#include "log.h" + +#include "edu_wpi_first_wpilibj_hal_PWMJNI.h" + +#include "HAL/Digital.h" + +// set the logging level +TLogLevel pwmJNILogLevel = logERROR; + +#define PWMJNI_LOG(level) \ + if (level > pwmJNILogLevel) ; \ + else Log().Get(level) + + +/* + * Class: edu_wpi_first_wpilibj_hal_PWMJNI + * Method: setPWM + * Signature: (Ljava/nio/ByteBuffer;SLjava/nio/IntBuffer;)V + */ +JNIEXPORT void JNICALL Java_edu_wpi_first_wpilibj_hal_PWMJNI_setPWM + (JNIEnv * env, jclass, jobject id, jshort value, jobject status) +{ + void ** javaId = (void**)env->GetDirectBufferAddress(id); + PWMJNI_LOG(logDEBUG) << "DigitalPort Ptr = " << *javaId; + PWMJNI_LOG(logDEBUG) << "PWM Value = " << value; + jint * statusPtr = (jint*)env->GetDirectBufferAddress(status); + setPWM( *javaId, value, statusPtr ); + PWMJNI_LOG(logDEBUG) << "Status = " << *statusPtr; +} + +/* + * Class: edu_wpi_first_wpilibj_hal_PWMJNI + * Method: getPWM + * Signature: (Ljava/nio/ByteBuffer;Ljava/nio/IntBuffer;)S + */ +JNIEXPORT jshort JNICALL Java_edu_wpi_first_wpilibj_hal_PWMJNI_getPWM + (JNIEnv * env, jclass, jobject id, jobject status) +{ + void ** javaId = (void**)env->GetDirectBufferAddress(id); + PWMJNI_LOG(logDEBUG) << "PWM Ptr = " << *javaId; + jint * statusPtr = (jint*)env->GetDirectBufferAddress(status); + jshort returnValue = getPWM( *javaId, statusPtr ); + PWMJNI_LOG(logDEBUG) << "Status = " << *statusPtr; + PWMJNI_LOG(logDEBUG) << "Value = " << returnValue; + return returnValue; +} + +/* + * Class: edu_wpi_first_wpilibj_hal_PWMJNI + * Method: setPWMPeriodScale + * Signature: (Ljava/nio/ByteBuffer;ILjava/nio/IntBuffer;)V + */ +JNIEXPORT void JNICALL Java_edu_wpi_first_wpilibj_hal_PWMJNI_setPWMPeriodScale + (JNIEnv * env, jclass, jobject id, jint value, jobject status ) +{ + void ** javaId = (void**)env->GetDirectBufferAddress(id); + PWMJNI_LOG(logDEBUG) << "DigitalPort Ptr = " << *javaId; + PWMJNI_LOG(logDEBUG) << "PeriodScale Value = " << value; + jint * statusPtr = (jint*)env->GetDirectBufferAddress(status); + setPWMPeriodScale( *javaId, value, statusPtr ); + PWMJNI_LOG(logDEBUG) << "Status = " << *statusPtr; +} + +/* + * Class: edu_wpi_first_wpilibj_hal_PWMJNI + * Method: allocatePWM + * Signature: (Ljava/nio/IntBuffer;)Ljava/nio/ByteBuffer; + */ +JNIEXPORT jobject JNICALL Java_edu_wpi_first_wpilibj_hal_PWMJNI_allocatePWM + (JNIEnv * env, jclass, jobject status) +{ + PWMJNI_LOG(logDEBUG) << "Calling PWMJNI allocatePWM"; + jint * statusPtr = (jint*)env->GetDirectBufferAddress(status); + PWMJNI_LOG(logDEBUG) << "Status Ptr = " << statusPtr; + void** pwmPtr = (void**)new unsigned char[4]; + *pwmPtr = allocatePWM(statusPtr); + PWMJNI_LOG(logDEBUG) << "Status = " << *statusPtr; + PWMJNI_LOG(logDEBUG) << "PWM Ptr = " << *pwmPtr; + return env->NewDirectByteBuffer( pwmPtr, 4); + +} + +/* + * Class: edu_wpi_first_wpilibj_hal_PWMJNI + * Method: allocatePWMWithModule + * Signature: (BLjava/nio/IntBuffer;)Ljava/nio/ByteBuffer; + */ +JNIEXPORT jobject JNICALL Java_edu_wpi_first_wpilibj_hal_PWMJNI_allocatePWMWithModule + (JNIEnv * env, jclass, jbyte module, jobject status) +{ + PWMJNI_LOG(logDEBUG) << "Calling PWMJNI allocatePWMWithModule"; + PWMJNI_LOG(logDEBUG) << "Module = " << (jint)module; + jint * statusPtr = (jint*)env->GetDirectBufferAddress(status); + PWMJNI_LOG(logDEBUG) << "Status Ptr = " << statusPtr; + void** pwmPtr = (void**)new unsigned char[4]; + *pwmPtr = allocatePWMWithModule(module, statusPtr); + PWMJNI_LOG(logDEBUG) << "Status = " << *statusPtr; + PWMJNI_LOG(logDEBUG) << "PWM Ptr = " << *pwmPtr; + return env->NewDirectByteBuffer( pwmPtr, 4); +} + +/* + * Class: edu_wpi_first_wpilibj_hal_PWMJNI + * Method: freePWM + * Signature: (Ljava/nio/ByteBuffer;Ljava/nio/IntBuffer;)V + */ +JNIEXPORT void JNICALL Java_edu_wpi_first_wpilibj_hal_PWMJNI_freePWM + (JNIEnv * env, jclass, jobject id, jobject status) +{ + PWMJNI_LOG(logDEBUG) << "Calling PWMJNI freePWM"; + void ** javaId = (void**)env->GetDirectBufferAddress(id); + PWMJNI_LOG(logDEBUG) << "PWM Ptr = " << *javaId; + jint * statusPtr = (jint*)env->GetDirectBufferAddress(status); + PWMJNI_LOG(logDEBUG) << "Status Ptr = " << statusPtr; + freePWM(*javaId, statusPtr); + PWMJNI_LOG(logDEBUG) << "Status = " << *statusPtr; +} + +/* + * Class: edu_wpi_first_wpilibj_hal_PWMJNI + * Method: freePWMWithModule + * Signature: (BLjava/nio/ByteBuffer;Ljava/nio/IntBuffer;)V + */ +JNIEXPORT void JNICALL Java_edu_wpi_first_wpilibj_hal_PWMJNI_freePWMWithModule + (JNIEnv * env, jclass, jbyte module, jobject id, jobject status) +{ + PWMJNI_LOG(logDEBUG) << "Calling PWMJNI freePWMWithModule"; + PWMJNI_LOG(logDEBUG) << "Module = " << (jint)module; + void ** javaId = (void**)env->GetDirectBufferAddress(id); + PWMJNI_LOG(logDEBUG) << "PWM Ptr = " << *javaId; + jint * statusPtr = (jint*)env->GetDirectBufferAddress(status); + PWMJNI_LOG(logDEBUG) << "Status Ptr = " << statusPtr; + freePWMWithModule(module, *javaId, statusPtr); + PWMJNI_LOG(logDEBUG) << "Status = " << *statusPtr; +} + +/* + * Class: edu_wpi_first_wpilibj_hal_PWMJNI + * Method: setPWMRate + * Signature: (DLjava/nio/IntBuffer;)V + */ +JNIEXPORT void JNICALL Java_edu_wpi_first_wpilibj_hal_PWMJNI_setPWMRate + (JNIEnv * env, jclass, jdouble value, jobject status) +{ + PWMJNI_LOG(logDEBUG) << "Calling PWMJNI setPWMRate"; + PWMJNI_LOG(logDEBUG) << "Rate= " << value; + jint * statusPtr = (jint*)env->GetDirectBufferAddress(status); + PWMJNI_LOG(logDEBUG) << "Status Ptr = " << statusPtr; + setPWMRate(value, statusPtr); + PWMJNI_LOG(logDEBUG) << "Status = " << *statusPtr; +} + +/* + * Class: edu_wpi_first_wpilibj_hal_PWMJNI + * Method: setPWMRateWithModule + * Signature: (BDLjava/nio/IntBuffer;)V + */ +JNIEXPORT void JNICALL Java_edu_wpi_first_wpilibj_hal_PWMJNI_setPWMRateWithModule + (JNIEnv * env, jclass, jbyte module, jdouble value, jobject status) +{ + PWMJNI_LOG(logDEBUG) << "Calling PWMJNI setPWMRateWithModule"; + PWMJNI_LOG(logDEBUG) << "Module = " << (jint)module; + PWMJNI_LOG(logDEBUG) << "Rate= " << value; + jint * statusPtr = (jint*)env->GetDirectBufferAddress(status); + PWMJNI_LOG(logDEBUG) << "Status Ptr = " << statusPtr; + setPWMRateWithModule(module, value, statusPtr); + PWMJNI_LOG(logDEBUG) << "Status = " << *statusPtr; +} + +/* + * Class: edu_wpi_first_wpilibj_hal_PWMJNI + * Method: setPWMDutyCycle + * Signature: (Ljava/nio/ByteBuffer;DLjava/nio/IntBuffer;)V + */ +JNIEXPORT void JNICALL Java_edu_wpi_first_wpilibj_hal_PWMJNI_setPWMDutyCycle + (JNIEnv * env, jclass, jobject id, jdouble value, jobject status) +{ + PWMJNI_LOG(logDEBUG) << "Calling PWMJNI setPWMDutyCycle"; + void ** javaId = (void**)env->GetDirectBufferAddress(id); + PWMJNI_LOG(logDEBUG) << "PWM Ptr = " << *javaId; + PWMJNI_LOG(logDEBUG) << "DutyCycle= " << value; + jint * statusPtr = (jint*)env->GetDirectBufferAddress(status); + PWMJNI_LOG(logDEBUG) << "Status Ptr = " << statusPtr; + setPWMDutyCycle(*javaId, value, statusPtr); + PWMJNI_LOG(logDEBUG) << "Status = " << *statusPtr; +} + +/* + * Class: edu_wpi_first_wpilibj_hal_PWMJNI + * Method: setPWMDutyCycleWithModule + * Signature: (BLjava/nio/ByteBuffer;DLjava/nio/IntBuffer;)V + */ +JNIEXPORT void JNICALL Java_edu_wpi_first_wpilibj_hal_PWMJNI_setPWMDutyCycleWithModule + (JNIEnv * env, jclass, jbyte module, jobject id, jdouble value, jobject status) +{ + PWMJNI_LOG(logDEBUG) << "Calling PWMJNI setPWMDutyCycleWithModule"; + PWMJNI_LOG(logDEBUG) << "Module = " << (jint)module; + void ** javaId = (void**)env->GetDirectBufferAddress(id); + PWMJNI_LOG(logDEBUG) << "PWM Ptr = " << *javaId; + PWMJNI_LOG(logDEBUG) << "DutyCycle= " << value; + jint * statusPtr = (jint*)env->GetDirectBufferAddress(status); + PWMJNI_LOG(logDEBUG) << "Status Ptr = " << statusPtr; + setPWMDutyCycleWithModule( module, *javaId, value, statusPtr); + PWMJNI_LOG(logDEBUG) << "Status = " << *statusPtr; +} + +/* + * Class: edu_wpi_first_wpilibj_hal_PWMJNI + * Method: setPWMOutputChannel + * Signature: (Ljava/nio/ByteBuffer;ILjava/nio/IntBuffer;)V + */ +JNIEXPORT void JNICALL Java_edu_wpi_first_wpilibj_hal_PWMJNI_setPWMOutputChannel + (JNIEnv * env, jclass, jobject id, jint value, jobject status) +{ + PWMJNI_LOG(logDEBUG) << "Calling PWMJNI setPWMOutputChannel"; + void ** javaId = (void**)env->GetDirectBufferAddress(id); + PWMJNI_LOG(logDEBUG) << "PWM Ptr = " << *javaId; + PWMJNI_LOG(logDEBUG) << "Pin= " << value; + jint * statusPtr = (jint*)env->GetDirectBufferAddress(status); + PWMJNI_LOG(logDEBUG) << "Status Ptr = " << statusPtr; + setPWMOutputChannel(*javaId, (uint32_t) value, statusPtr); + PWMJNI_LOG(logDEBUG) << "Status = " << *statusPtr; +} + +/* + * Class: edu_wpi_first_wpilibj_hal_PWMJNI + * Method: setPWMOutputChannelWithModule + * Signature: (BLjava/nio/ByteBuffer;ILjava/nio/IntBuffer;)V + */ +JNIEXPORT void JNICALL Java_edu_wpi_first_wpilibj_hal_PWMJNI_setPWMOutputChannelWithModule + (JNIEnv * env, jclass, jbyte module, jobject id, jint value, jobject status) +{ + PWMJNI_LOG(logDEBUG) << "Calling PWMJNI setPWMOutputChannelWithModule"; + PWMJNI_LOG(logDEBUG) << "Module = " << (jint)module; + void ** javaId = (void**)env->GetDirectBufferAddress(id); + PWMJNI_LOG(logDEBUG) << "PWM Ptr = " << *javaId; + PWMJNI_LOG(logDEBUG) << "Pin= " << value; + jint * statusPtr = (jint*)env->GetDirectBufferAddress(status); + PWMJNI_LOG(logDEBUG) << "Status Ptr = " << statusPtr; + setPWMOutputChannelWithModule( module, *javaId, (uint32_t) value, statusPtr); + PWMJNI_LOG(logDEBUG) << "Status = " << *statusPtr; +} diff --git a/wpilibj/wpilibJavaJNI/src/main/native/RelayJNI.cpp b/wpilibj/wpilibJavaJNI/src/main/native/RelayJNI.cpp new file mode 100644 index 0000000000..991dbe9860 --- /dev/null +++ b/wpilibj/wpilibJavaJNI/src/main/native/RelayJNI.cpp @@ -0,0 +1,88 @@ +#include +#include +#include "log.h" + +#include "edu_wpi_first_wpilibj_hal_RelayJNI.h" + +#include "HAL/Digital.h" + +// set the logging level +TLogLevel relayJNILogLevel = logDEBUG; + +#define RELAYJNI_LOG(level) \ + if (level > relayJNILogLevel) ; \ + else Log().Get(level) + +/* + * Class: edu_wpi_first_wpilibj_hal_RelayJNI + * Method: setRelayForward + * Signature: (Ljava/nio/ByteBuffer;BLjava/nio/IntBuffer;)V + */ +JNIEXPORT void JNICALL Java_edu_wpi_first_wpilibj_hal_RelayJNI_setRelayForward + (JNIEnv * env, jclass, jobject id, jbyte value, jobject status) +{ + RELAYJNI_LOG(logDEBUG) << "Calling RELAYJNI setRelayForward"; + void ** javaId = (void**)env->GetDirectBufferAddress(id); + RELAYJNI_LOG(logDEBUG) << "Port Ptr = " << *javaId; + RELAYJNI_LOG(logDEBUG) << "Flag = " << (jint)value; + jint * statusPtr = (jint*)env->GetDirectBufferAddress(status); + RELAYJNI_LOG(logDEBUG) << "Status Ptr = " << statusPtr; + setRelayForward(*javaId, value, statusPtr); + RELAYJNI_LOG(logDEBUG) << "Status = " << *statusPtr; +} + +/* + * Class: edu_wpi_first_wpilibj_hal_RelayJNI + * Method: setRelayReverse + * Signature: (Ljava/nio/ByteBuffer;BLjava/nio/IntBuffer;)V + */ +JNIEXPORT void JNICALL Java_edu_wpi_first_wpilibj_hal_RelayJNI_setRelayReverse + (JNIEnv * env, jclass, jobject id, jbyte value, jobject status) +{ + RELAYJNI_LOG(logDEBUG) << "Calling RELAYJNI setRelayReverse"; + void ** javaId = (void**)env->GetDirectBufferAddress(id); + RELAYJNI_LOG(logDEBUG) << "Port Ptr = " << *javaId; + RELAYJNI_LOG(logDEBUG) << "Flag = " << (jint)value; + jint * statusPtr = (jint*)env->GetDirectBufferAddress(status); + RELAYJNI_LOG(logDEBUG) << "Status Ptr = " << statusPtr; + setRelayReverse(*javaId, value, statusPtr); + RELAYJNI_LOG(logDEBUG) << "Status = " << *statusPtr; +} + +/* + * Class: edu_wpi_first_wpilibj_hal_RelayJNI + * Method: getRelayForward + * Signature: (Ljava/nio/ByteBuffer;Ljava/nio/IntBuffer;)B + */ +JNIEXPORT jbyte JNICALL Java_edu_wpi_first_wpilibj_hal_RelayJNI_getRelayForward + (JNIEnv * env, jclass, jobject id, jobject status) +{ + RELAYJNI_LOG(logDEBUG) << "Calling RELAYJNI getRelayForward"; + void ** javaId = (void**)env->GetDirectBufferAddress(id); + RELAYJNI_LOG(logDEBUG) << "Port Ptr = " << *javaId; + jint * statusPtr = (jint*)env->GetDirectBufferAddress(status); + RELAYJNI_LOG(logDEBUG) << "Status Ptr = " << statusPtr; + jbyte returnValue = getRelayForward(*javaId, statusPtr); + RELAYJNI_LOG(logDEBUG) << "Status = " << *statusPtr; + RELAYJNI_LOG(logDEBUG) << "getRelayForwardResult = " << (jint)returnValue; + return returnValue; +} + +/* + * Class: edu_wpi_first_wpilibj_hal_RelayJNI + * Method: getRelayReverse + * Signature: (Ljava/nio/ByteBuffer;Ljava/nio/IntBuffer;)B + */ +JNIEXPORT jbyte JNICALL Java_edu_wpi_first_wpilibj_hal_RelayJNI_getRelayReverse + (JNIEnv * env, jclass, jobject id, jobject status) +{ + RELAYJNI_LOG(logDEBUG) << "Calling RELAYJNI getRelayReverse"; + void ** javaId = (void**)env->GetDirectBufferAddress(id); + RELAYJNI_LOG(logDEBUG) << "Port Ptr = " << *javaId; + jint * statusPtr = (jint*)env->GetDirectBufferAddress(status); + RELAYJNI_LOG(logDEBUG) << "Status Ptr = " << statusPtr; + jbyte returnValue = getRelayReverse(*javaId, statusPtr); + RELAYJNI_LOG(logDEBUG) << "Status = " << *statusPtr; + RELAYJNI_LOG(logDEBUG) << "getRelayReverseResult = " << (jint)returnValue; + return returnValue; +} diff --git a/wpilibj/wpilibJavaJNI/src/main/native/SPIJNI.cpp b/wpilibj/wpilibJavaJNI/src/main/native/SPIJNI.cpp new file mode 100644 index 0000000000..df157ed378 --- /dev/null +++ b/wpilibj/wpilibJavaJNI/src/main/native/SPIJNI.cpp @@ -0,0 +1,289 @@ +#include +#include +#include "log.h" + +#include "edu_wpi_first_wpilibj_hal_SPIJNI.h" + + +// set the logging level +TLogLevel spiJNILogLevel = logDEBUG; + +#define SPIJNI_LOG(level) \ + if (level > spiJNILogLevel) ; \ + else Log().Get(level) + +/* + * Class: edu_wpi_first_wpilibj_hal_SPIJNI + * Method: initializeSPI + * Signature: (BIBIBILjava/nio/IntBuffer;)Ljava/nio/ByteBuffer; + */ +JNIEXPORT jobject JNICALL Java_edu_wpi_first_wpilibj_hal_SPIJNI_initializeSPI + (JNIEnv *, jclass, jbyte, jint, jbyte, jint, jbyte, jint, jobject) +{ + assert(false); +} + +/* + * Class: edu_wpi_first_wpilibj_hal_SPIJNI + * Method: cleanSPI + * Signature: (Ljava/nio/ByteBuffer;Ljava/nio/IntBuffer;)V + */ +JNIEXPORT void JNICALL Java_edu_wpi_first_wpilibj_hal_SPIJNI_cleanSPI + (JNIEnv *, jclass, jobject, jobject) +{ + assert(false); +} + +/* + * Class: edu_wpi_first_wpilibj_hal_SPIJNI + * Method: setSPIBitsPerWord + * Signature: (Ljava/nio/ByteBuffer;ILjava/nio/IntBuffer;)V + */ +JNIEXPORT void JNICALL Java_edu_wpi_first_wpilibj_hal_SPIJNI_setSPIBitsPerWord + (JNIEnv *, jclass, jobject, jint, jobject) +{ + assert(false); +} + +/* + * Class: edu_wpi_first_wpilibj_hal_SPIJNI + * Method: getSPIBitsPerWord + * Signature: (Ljava/nio/ByteBuffer;Ljava/nio/IntBuffer;)I + */ +JNIEXPORT jint JNICALL Java_edu_wpi_first_wpilibj_hal_SPIJNI_getSPIBitsPerWord + (JNIEnv *, jclass, jobject, jobject) +{ + assert(false); +} + +/* + * Class: edu_wpi_first_wpilibj_hal_SPIJNI + * Method: setSPIClockRate + * Signature: (Ljava/nio/ByteBuffer;DLjava/nio/IntBuffer;)V + */ +JNIEXPORT void JNICALL Java_edu_wpi_first_wpilibj_hal_SPIJNI_setSPIClockRate + (JNIEnv *, jclass, jobject, jdouble, jobject) +{ + assert(false); +} + +/* + * Class: edu_wpi_first_wpilibj_hal_SPIJNI + * Method: setSPIMSBFirst + * Signature: (Ljava/nio/ByteBuffer;Ljava/nio/IntBuffer;)V + */ +JNIEXPORT void JNICALL Java_edu_wpi_first_wpilibj_hal_SPIJNI_setSPIMSBFirst + (JNIEnv *, jclass, jobject, jobject) +{ + assert(false); +} + +/* + * Class: edu_wpi_first_wpilibj_hal_SPIJNI + * Method: setSPILSBFirst + * Signature: (Ljava/nio/ByteBuffer;Ljava/nio/IntBuffer;)V + */ +JNIEXPORT void JNICALL Java_edu_wpi_first_wpilibj_hal_SPIJNI_setSPILSBFirst + (JNIEnv *, jclass, jobject, jobject) +{ + assert(false); +} + +/* + * Class: edu_wpi_first_wpilibj_hal_SPIJNI + * Method: setSPISampleDataOnFalling + * Signature: (Ljava/nio/ByteBuffer;Ljava/nio/IntBuffer;)V + */ +JNIEXPORT void JNICALL Java_edu_wpi_first_wpilibj_hal_SPIJNI_setSPISampleDataOnFalling + (JNIEnv *, jclass, jobject, jobject) +{ + assert(false); +} + +/* + * Class: edu_wpi_first_wpilibj_hal_SPIJNI + * Method: setSPISampleDataOnRising + * Signature: (Ljava/nio/ByteBuffer;Ljava/nio/IntBuffer;)V + */ +JNIEXPORT void JNICALL Java_edu_wpi_first_wpilibj_hal_SPIJNI_setSPISampleDataOnRising + (JNIEnv *, jclass, jobject, jobject) +{ + assert(false); +} + +/* + * Class: edu_wpi_first_wpilibj_hal_SPIJNI + * Method: setSPISlaveSelect + * Signature: (Ljava/nio/ByteBuffer;BILjava/nio/IntBuffer;)V + */ +JNIEXPORT void JNICALL Java_edu_wpi_first_wpilibj_hal_SPIJNI_setSPISlaveSelect + (JNIEnv *, jclass, jobject, jbyte, jint, jobject) +{ + assert(false); +} + +/* + * Class: edu_wpi_first_wpilibj_hal_SPIJNI + * Method: setSPILatchMode + * Signature: (Ljava/nio/ByteBuffer;ILjava/nio/IntBuffer;)V + */ +JNIEXPORT void JNICALL Java_edu_wpi_first_wpilibj_hal_SPIJNI_setSPILatchMode + (JNIEnv *, jclass, jobject, jint, jobject) +{ + assert(false); +} + +/* + * Class: edu_wpi_first_wpilibj_hal_SPIJNI + * Method: getSPILatchMode + * Signature: (Ljava/nio/ByteBuffer;Ljava/nio/IntBuffer;)I + */ +JNIEXPORT jint JNICALL Java_edu_wpi_first_wpilibj_hal_SPIJNI_getSPILatchMode + (JNIEnv *, jclass, jobject, jobject) +{ + assert(false); +} + +/* + * Class: edu_wpi_first_wpilibj_hal_SPIJNI + * Method: setSPIFramePolarity + * Signature: (Ljava/nio/ByteBuffer;BLjava/nio/IntBuffer;)V + */ +JNIEXPORT void JNICALL Java_edu_wpi_first_wpilibj_hal_SPIJNI_setSPIFramePolarity + (JNIEnv *, jclass, jobject, jbyte, jobject) +{ + assert(false); +} + +/* + * Class: edu_wpi_first_wpilibj_hal_SPIJNI + * Method: getSPIFramePolarity + * Signature: (Ljava/nio/ByteBuffer;Ljava/nio/IntBuffer;)B + */ +JNIEXPORT jbyte JNICALL Java_edu_wpi_first_wpilibj_hal_SPIJNI_getSPIFramePolarity + (JNIEnv *, jclass, jobject, jobject) +{ + assert(false); +} + + +/* + * Class: edu_wpi_first_wpilibj_hal_SPIJNI + * Method: setSPIClockActiveLow + * Signature: (Ljava/nio/ByteBuffer;Ljava/nio/IntBuffer;)V + */ +JNIEXPORT void JNICALL Java_edu_wpi_first_wpilibj_hal_SPIJNI_setSPIClockActiveLow + (JNIEnv *, jclass, jobject, jobject) +{ + assert(false); +} + +/* + * Class: edu_wpi_first_wpilibj_hal_SPIJNI + * Method: setSPIClockActiveHigh + * Signature: (Ljava/nio/ByteBuffer;Ljava/nio/IntBuffer;)V + */ +JNIEXPORT void JNICALL Java_edu_wpi_first_wpilibj_hal_SPIJNI_setSPIClockActiveHigh + (JNIEnv *, jclass, jobject, jobject) +{ + assert(false); +} + +/* + * Class: edu_wpi_first_wpilibj_hal_SPIJNI + * Method: applySPIConfig + * Signature: (Ljava/nio/ByteBuffer;Ljava/nio/IntBuffer;)V + */ +JNIEXPORT void JNICALL Java_edu_wpi_first_wpilibj_hal_SPIJNI_applySPIConfig + (JNIEnv *, jclass, jobject, jobject) +{ + assert(false); +} + +/* + * Class: edu_wpi_first_wpilibj_hal_SPIJNI + * Method: getSPIOutputFIFOAvailable + * Signature: (Ljava/nio/ByteBuffer;Ljava/nio/IntBuffer;)S + */ +JNIEXPORT jshort JNICALL Java_edu_wpi_first_wpilibj_hal_SPIJNI_getSPIOutputFIFOAvailable + (JNIEnv *, jclass, jobject, jobject) +{ + assert(false); +} + +/* + * Class: edu_wpi_first_wpilibj_hal_SPIJNI + * Method: getSPINumReceived + * Signature: (Ljava/nio/ByteBuffer;Ljava/nio/IntBuffer;)S + */ +JNIEXPORT jshort JNICALL Java_edu_wpi_first_wpilibj_hal_SPIJNI_getSPINumReceived + (JNIEnv *, jclass, jobject, jobject) +{ + assert(false); +} + +/* + * Class: edu_wpi_first_wpilibj_hal_SPIJNI + * Method: isSPIDone + * Signature: (Ljava/nio/ByteBuffer;Ljava/nio/IntBuffer;)B + */ +JNIEXPORT jbyte JNICALL Java_edu_wpi_first_wpilibj_hal_SPIJNI_isSPIDone + (JNIEnv *, jclass, jobject, jobject) +{ + assert(false); +} + +/* + * Class: edu_wpi_first_wpilibj_hal_SPIJNI + * Method: hadSPIReceiveOverflow + * Signature: (Ljava/nio/ByteBuffer;Ljava/nio/IntBuffer;)B + */ +JNIEXPORT jbyte JNICALL Java_edu_wpi_first_wpilibj_hal_SPIJNI_hadSPIReceiveOverflow + (JNIEnv *, jclass, jobject, jobject) +{ + assert(false); +} + +/* + * Class: edu_wpi_first_wpilibj_hal_SPIJNI + * Method: writeSPI + * Signature: (Ljava/nio/ByteBuffer;ILjava/nio/IntBuffer;)V + */ +JNIEXPORT void JNICALL Java_edu_wpi_first_wpilibj_hal_SPIJNI_writeSPI + (JNIEnv *, jclass, jobject, jint, jobject) +{ + assert(false); +} + +/* + * Class: edu_wpi_first_wpilibj_hal_SPIJNI + * Method: readSPI + * Signature: (Ljava/nio/ByteBuffer;BLjava/nio/IntBuffer;)I + */ +JNIEXPORT jint JNICALL Java_edu_wpi_first_wpilibj_hal_SPIJNI_readSPI + (JNIEnv *, jclass, jobject, jbyte, jobject) +{ + assert(false); +} + +/* + * Class: edu_wpi_first_wpilibj_hal_SPIJNI + * Method: resetSPI + * Signature: (Ljava/nio/ByteBuffer;Ljava/nio/IntBuffer;)V + */ +JNIEXPORT void JNICALL Java_edu_wpi_first_wpilibj_hal_SPIJNI_resetSPI + (JNIEnv *, jclass, jobject, jobject) +{ + assert(false); +} + +/* + * Class: edu_wpi_first_wpilibj_hal_SPIJNI + * Method: clearSPIReceivedData + * Signature: (Ljava/nio/ByteBuffer;Ljava/nio/IntBuffer;)V + */ +JNIEXPORT void JNICALL Java_edu_wpi_first_wpilibj_hal_SPIJNI_clearSPIReceivedData + (JNIEnv *, jclass, jobject, jobject) +{ + assert(false); +} diff --git a/wpilibj/wpilibJavaJNI/src/main/native/WatchdogJNI.cpp b/wpilibj/wpilibJavaJNI/src/main/native/WatchdogJNI.cpp new file mode 100644 index 0000000000..6807813cb4 --- /dev/null +++ b/wpilibj/wpilibJavaJNI/src/main/native/WatchdogJNI.cpp @@ -0,0 +1,208 @@ +#include +#include +#include "log.h" + +#include "edu_wpi_first_wpilibj_hal_WatchdogJNI.h" + +#include "HAL/Watchdog.h" +// set the logging level +TLogLevel watchdogJNILogLevel = logDEBUG; + +#define WATCHDOGJNI_LOG(level) \ + if (level > watchdogJNILogLevel) ; \ + else Log().Get(level) + +/* + * Class: edu_wpi_first_wpilibj_hal_WatchdogJNI + * Method: initializeWatchdog + * Signature: (Ljava/nio/IntBuffer;)Ljava/nio/ByteBuffer; + */ +JNIEXPORT jobject JNICALL Java_edu_wpi_first_wpilibj_hal_WatchdogJNI_initializeWatchdog + (JNIEnv * env, jclass, jobject status) +{ + WATCHDOGJNI_LOG(logDEBUG) << "Calling Watchdog initializeWatchdog"; + jint * statusPtr = (jint*)env->GetDirectBufferAddress(status); + WATCHDOGJNI_LOG(logDEBUG) << "Status Ptr = " << statusPtr; + jlong statusCapacity = env->GetDirectBufferCapacity(status); + WATCHDOGJNI_LOG(logDEBUG) << "Status Capacity = " << statusCapacity; + void** watchdogPtr = (void**)new unsigned char[4]; + *watchdogPtr = initializeWatchdog(statusPtr); + WATCHDOGJNI_LOG(logDEBUG) << "Status = " << *statusPtr; + WATCHDOGJNI_LOG(logDEBUG) << "Watchdog Ptr = " << *watchdogPtr; + return env->NewDirectByteBuffer( watchdogPtr, 4); +} + +/* + * Class: edu_wpi_first_wpilibj_hal_WatchdogJNI + * Method: cleanWatchdog + * Signature: (Ljava/nio/ByteBuffer;Ljava/nio/IntBuffer;)V + */ +JNIEXPORT void JNICALL Java_edu_wpi_first_wpilibj_hal_WatchdogJNI_cleanWatchdog + (JNIEnv * env, jclass, jobject id, jobject status) +{ + WATCHDOGJNI_LOG(logDEBUG) << "Calling Watchdog cleanWatchdog"; + void ** javaId = (void**)env->GetDirectBufferAddress(id); + WATCHDOGJNI_LOG(logDEBUG) << "Watchdog Ptr = " << *javaId; + jint * statusPtr = (jint*)env->GetDirectBufferAddress(status); + cleanWatchdog( *javaId, statusPtr ); + WATCHDOGJNI_LOG(logDEBUG) << "Status = " << *statusPtr; +} + +/* + * Class: edu_wpi_first_wpilibj_hal_WatchdogJNI + * Method: feedWatchdog + * Signature: (Ljava/nio/ByteBuffer;Ljava/nio/IntBuffer;)B + */ +JNIEXPORT jbyte JNICALL Java_edu_wpi_first_wpilibj_hal_WatchdogJNI_feedWatchdog + (JNIEnv * env, jclass, jobject id, jobject status ) +{ + WATCHDOGJNI_LOG(logDEBUG) << "Calling Watchdog feedWatchdog"; + void ** javaId = (void**)env->GetDirectBufferAddress(id); + WATCHDOGJNI_LOG(logDEBUG) << "Watchdog Ptr = " << *javaId; + jint * statusPtr = (jint*)env->GetDirectBufferAddress(status); + jbyte returnValue = feedWatchdog( *javaId, statusPtr ); + WATCHDOGJNI_LOG(logDEBUG) << "Status = " << *statusPtr; + WATCHDOGJNI_LOG(logDEBUG) << "feedWatchdog return = " << (short)returnValue; + return returnValue; +} + +/* + * Class: edu_wpi_first_wpilibj_hal_WatchdogJNI + * Method: killWatchdog + * Signature: (Ljava/nio/ByteBuffer;Ljava/nio/IntBuffer;)V + */ +JNIEXPORT void JNICALL Java_edu_wpi_first_wpilibj_hal_WatchdogJNI_killWatchdog + (JNIEnv * env, jclass, jobject id, jobject status) +{ + WATCHDOGJNI_LOG(logDEBUG) << "Calling Watchdog killWatchdog"; + void ** javaId = (void**)env->GetDirectBufferAddress(id); + WATCHDOGJNI_LOG(logDEBUG) << "Watchdog Ptr = " << *javaId; + jint * statusPtr = (jint*)env->GetDirectBufferAddress(status); + killWatchdog( *javaId, statusPtr ); + WATCHDOGJNI_LOG(logDEBUG) << "Status = " << *statusPtr; +} + +/* + * Class: edu_wpi_first_wpilibj_hal_WatchdogJNI + * Method: getWatchdogLastFed + * Signature: (Ljava/nio/ByteBuffer;Ljava/nio/IntBuffer;)D + */ +JNIEXPORT jdouble JNICALL Java_edu_wpi_first_wpilibj_hal_WatchdogJNI_getWatchdogLastFed + (JNIEnv * env, jclass, jobject id, jobject status) +{ + WATCHDOGJNI_LOG(logDEBUG) << "Calling Watchdog getWatchdogLastFed"; + void ** javaId = (void**)env->GetDirectBufferAddress(id); + WATCHDOGJNI_LOG(logDEBUG) << "Watchdog Ptr = " << *javaId; + jint * statusPtr = (jint*)env->GetDirectBufferAddress(status); + double returnValue = getWatchdogLastFed( *javaId, statusPtr ); + WATCHDOGJNI_LOG(logDEBUG) << "Status = " << *statusPtr; + WATCHDOGJNI_LOG(logDEBUG) << "LastFed = " << returnValue; + return returnValue; +} + +/* + * Class: edu_wpi_first_wpilibj_hal_WatchdogJNI + * Method: getWatchdogExpiration + * Signature: (Ljava/nio/ByteBuffer;Ljava/nio/IntBuffer;)D + */ +JNIEXPORT jdouble JNICALL Java_edu_wpi_first_wpilibj_hal_WatchdogJNI_getWatchdogExpiration + (JNIEnv * env, jclass, jobject id, jobject status) +{ + WATCHDOGJNI_LOG(logDEBUG) << "Calling Watchdog getWatchdogExpiration"; + void ** javaId = (void**)env->GetDirectBufferAddress(id); + WATCHDOGJNI_LOG(logDEBUG) << "Watchdog Ptr = " << *javaId; + jint * statusPtr = (jint*)env->GetDirectBufferAddress(status); + double returnValue = getWatchdogExpiration( *javaId, statusPtr ); + WATCHDOGJNI_LOG(logDEBUG) << "Status = " << *statusPtr; + WATCHDOGJNI_LOG(logDEBUG) << "Expiration = " << returnValue; + return returnValue; +} + +/* + * Class: edu_wpi_first_wpilibj_hal_WatchdogJNI + * Method: setWatchdogExpiration + * Signature: (Ljava/nio/ByteBuffer;DLjava/nio/IntBuffer;)V + */ +JNIEXPORT void JNICALL Java_edu_wpi_first_wpilibj_hal_WatchdogJNI_setWatchdogExpiration + (JNIEnv * env, jclass, jobject id, jdouble value, jobject status) +{ + WATCHDOGJNI_LOG(logDEBUG) << "Calling Watchdog setWatchdogExpiration"; + WATCHDOGJNI_LOG(logDEBUG) << "Expiration = " << value; + void ** javaId = (void**)env->GetDirectBufferAddress(id); + WATCHDOGJNI_LOG(logDEBUG) << "Watchdog Ptr = " << *javaId; + jint * statusPtr = (jint*)env->GetDirectBufferAddress(status); + setWatchdogExpiration( *javaId, value, statusPtr ); + WATCHDOGJNI_LOG(logDEBUG) << "Status = " << *statusPtr; +} + +/* + * Class: edu_wpi_first_wpilibj_hal_WatchdogJNI + * Method: getWatchdogEnabled + * Signature: (Ljava/nio/ByteBuffer;Ljava/nio/IntBuffer;)B + */ +JNIEXPORT jbyte JNICALL Java_edu_wpi_first_wpilibj_hal_WatchdogJNI_getWatchdogEnabled + (JNIEnv * env, jclass, jobject id, jobject status) +{ + WATCHDOGJNI_LOG(logDEBUG) << "Calling Watchdog getWatchdogEnabled"; + void ** javaId = (void**)env->GetDirectBufferAddress(id); + WATCHDOGJNI_LOG(logDEBUG) << "Watchdog Ptr = " << *javaId; + jint * statusPtr = (jint*)env->GetDirectBufferAddress(status); + jbyte returnValue = getWatchdogEnabled( *javaId, statusPtr ); + WATCHDOGJNI_LOG(logDEBUG) << "Status = " << *statusPtr; + WATCHDOGJNI_LOG(logDEBUG) << "Enabled = " << (short)returnValue; + return returnValue; +} + +/* + * Class: edu_wpi_first_wpilibj_hal_WatchdogJNI + * Method: setWatchdogEnabled + * Signature: (Ljava/nio/ByteBuffer;BLjava/nio/IntBuffer;)V + */ +JNIEXPORT void JNICALL Java_edu_wpi_first_wpilibj_hal_WatchdogJNI_setWatchdogEnabled + (JNIEnv * env, jclass, jobject id, jbyte value, jobject status) +{ + WATCHDOGJNI_LOG(logDEBUG) << "Calling Watchdog setWatchdogEnabled"; + WATCHDOGJNI_LOG(logDEBUG) << "Enabled = " << (short)value; + void ** javaId = (void**)env->GetDirectBufferAddress(id); + WATCHDOGJNI_LOG(logDEBUG) << "Watchdog Ptr = " << *javaId; + jint * statusPtr = (jint*)env->GetDirectBufferAddress(status); + setWatchdogEnabled( *javaId, value, statusPtr ); + WATCHDOGJNI_LOG(logDEBUG) << "Status = " << *statusPtr; +} + +/* + * Class: edu_wpi_first_wpilibj_hal_WatchdogJNI + * Method: isWatchdogAlive + * Signature: (Ljava/nio/ByteBuffer;Ljava/nio/IntBuffer;)B + */ +JNIEXPORT jbyte JNICALL Java_edu_wpi_first_wpilibj_hal_WatchdogJNI_isWatchdogAlive + (JNIEnv * env, jclass, jobject id, jobject status) +{ + WATCHDOGJNI_LOG(logDEBUG) << "Calling Watchdog isWatchdogAlive"; + void ** javaId = (void**)env->GetDirectBufferAddress(id); + WATCHDOGJNI_LOG(logDEBUG) << "Watchdog Ptr = " << *javaId; + jint * statusPtr = (jint*)env->GetDirectBufferAddress(status); + jbyte returnValue = isWatchdogAlive( *javaId, statusPtr ); + WATCHDOGJNI_LOG(logDEBUG) << "Status = " << *statusPtr; + WATCHDOGJNI_LOG(logDEBUG) << "IsAlive = " << (short)returnValue; + return returnValue; +} + +/* + * Class: edu_wpi_first_wpilibj_hal_WatchdogJNI + * Method: isWatchdogSystemActive + * Signature: (Ljava/nio/ByteBuffer;Ljava/nio/IntBuffer;)B + */ +JNIEXPORT jbyte JNICALL Java_edu_wpi_first_wpilibj_hal_WatchdogJNI_isWatchdogSystemActive + (JNIEnv * env, jclass, jobject id, jobject status) +{ + WATCHDOGJNI_LOG(logDEBUG) << "Calling Watchdog isWatchdogSystemActive"; + void ** javaId = (void**)env->GetDirectBufferAddress(id); + WATCHDOGJNI_LOG(logDEBUG) << "Watchdog Ptr = " << *javaId; + jint * statusPtr = (jint*)env->GetDirectBufferAddress(status); + jbyte returnValue = isWatchdogSystemActive( *javaId, statusPtr ); + WATCHDOGJNI_LOG(logDEBUG) << "Status = " << *statusPtr; + WATCHDOGJNI_LOG(logDEBUG) << "IsActive = " << (short)returnValue; + return returnValue; +} +