From 6729a7d6b1dfd9d23b58f51d3e7e76e5d0bf42aa Mon Sep 17 00:00:00 2001 From: Tyler Veness Date: Sun, 13 May 2018 17:09:56 -0700 Subject: [PATCH] Run wpiformat on merged repo (#1021) --- .styleguide | 22 +- .travis.yml | 2 +- CONTRIBUTING.md | 2 +- cameraserver/.styleguide | 28 + .../src/main/native/cpp/CameraServer.cpp | 3 +- .../src/main/native/include/CameraServer.h | 3 +- cscore/.styleguide | 19 +- cscore/src/main/native/cpp/CvSinkImpl.cpp | 2 +- cscore/src/main/native/cpp/HttpCameraImpl.cpp | 3 +- cscore/src/main/native/cpp/JpegUtil.cpp | 8 +- .../src/main/native/cpp/MjpegServerImpl.cpp | 10 +- cscore/src/main/native/cpp/SinkImpl.cpp | 3 +- cscore/src/main/native/cpp/SourceImpl.cpp | 6 +- cscore/src/main/native/cpp/SourceImpl.h | 3 +- cscore/src/main/native/cpp/UsbCameraImpl.cpp | 6 +- cscore/src/main/native/cpp/UsbCameraImpl.h | 2 +- .../src/main/native/cpp/UsbCameraProperty.h | 2 +- cscore/src/main/native/cpp/cscore_cpp.cpp | 19 +- .../main/native/cpp/jni/CameraServerJNI.cpp | 280 +++++--- cscore/src/main/native/include/cscore_cpp.h | 21 +- cscore/src/main/native/include/cscore_oo.h | 3 +- hal/.styleguide | 9 +- hal/src/main/native/athena/DIO.cpp | 4 +- hal/src/main/native/athena/PWM.cpp | 4 +- hal/src/main/native/athena/SPI.cpp | 2 +- .../main/native/athena/cpp/SerialHelper.cpp | 2 +- .../main/native/cpp/jni/AccelerometerJNI.cpp | 30 +- hal/src/main/native/cpp/jni/AnalogGyroJNI.cpp | 105 ++- hal/src/main/native/cpp/jni/AnalogJNI.cpp | 298 +++++--- hal/src/main/native/cpp/jni/CANJNI.cpp | 69 +- hal/src/main/native/cpp/jni/CompressorJNI.cpp | 133 ++-- hal/src/main/native/cpp/jni/ConstantsJNI.cpp | 24 +- hal/src/main/native/cpp/jni/CounterJNI.cpp | 165 +++-- hal/src/main/native/cpp/jni/DIOJNI.cpp | 118 +-- .../native/cpp/jni/DigitalGlitchFilterJNI.cpp | 28 +- hal/src/main/native/cpp/jni/EncoderJNI.cpp | 174 +++-- hal/src/main/native/cpp/jni/HAL.cpp | 270 ++++--- hal/src/main/native/cpp/jni/HALUtil.cpp | 196 ++--- hal/src/main/native/cpp/jni/HALUtil.h | 42 +- hal/src/main/native/cpp/jni/I2CJNI.cpp | 117 +-- hal/src/main/native/cpp/jni/InterruptJNI.cpp | 148 ++-- hal/src/main/native/cpp/jni/NotifierJNI.cpp | 50 +- .../main/native/cpp/jni/OSSerialPortJNI.cpp | 128 ++-- hal/src/main/native/cpp/jni/PDPJNI.cpp | 75 +- hal/src/main/native/cpp/jni/PWMJNI.cpp | 164 +++-- hal/src/main/native/cpp/jni/PortsJNI.cpp | 123 ++-- hal/src/main/native/cpp/jni/PowerJNI.cpp | 64 +- hal/src/main/native/cpp/jni/RelayJNI.cpp | 68 +- hal/src/main/native/cpp/jni/SPIJNI.cpp | 226 +++--- hal/src/main/native/cpp/jni/SerialPortJNI.cpp | 130 ++-- hal/src/main/native/cpp/jni/SolenoidJNI.cpp | 104 +-- hal/src/main/native/cpp/jni/ThreadsJNI.cpp | 43 +- .../native/include/Simulation/CallbackStore.h | 4 +- .../native/sim/jni/AccelerometerDataJNI.cpp | 218 ++++-- .../main/native/sim/jni/AnalogGyroDataJNI.cpp | 132 +++- .../main/native/sim/jni/AnalogInDataJNI.cpp | 375 ++++++++-- .../main/native/sim/jni/AnalogOutDataJNI.cpp | 91 ++- .../native/sim/jni/AnalogTriggerDataJNI.cpp | 131 +++- .../native/sim/jni/BufferCallbackStore.cpp | 1 + .../main/native/sim/jni/BufferCallbackStore.h | 1 + hal/src/main/native/sim/jni/CallbackStore.cpp | 1 + hal/src/main/native/sim/jni/CallbackStore.h | 1 + .../sim/jni/ConstBufferCallbackStore.cpp | 1 + .../native/sim/jni/ConstBufferCallbackStore.h | 1 + hal/src/main/native/sim/jni/DIODataJNI.cpp | 216 ++++-- .../main/native/sim/jni/DigitalPWMDataJNI.cpp | 132 +++- .../native/sim/jni/DriverStationDataJNI.cpp | 296 ++++++-- .../main/native/sim/jni/EncoderDataJNI.cpp | 335 +++++++-- hal/src/main/native/sim/jni/I2CDataJNI.cpp | 73 +- hal/src/main/native/sim/jni/PCMDataJNI.cpp | 319 ++++++-- hal/src/main/native/sim/jni/PDPDataJNI.cpp | 179 +++-- hal/src/main/native/sim/jni/PWMDataJNI.cpp | 257 +++++-- hal/src/main/native/sim/jni/RelayDataJNI.cpp | 172 ++++- .../main/native/sim/jni/RoboRioDataJNI.cpp | 621 ++++++++++++---- .../sim/jni/SPIAccelerometerDataJNI.cpp | 213 ++++-- hal/src/main/native/sim/jni/SPIDataJNI.cpp | 89 +-- hal/src/main/native/sim/jni/SimulatorJNI.cpp | 22 +- .../SpiReadAutoReceiveBufferCallbackStore.cpp | 1 + .../SpiReadAutoReceiveBufferCallbackStore.h | 1 + ntcore/.styleguide | 31 + ntcore/manualTests/java/Client.java | 2 +- ntcore/manualTests/java/Server.java | 2 +- ntcore/manualTests/native/client.cpp | 2 +- ntcore/manualTests/native/rpc_local.cpp | 2 +- ntcore/manualTests/native/rpc_speed.cpp | 2 +- ntcore/manualTests/native/server.cpp | 2 +- .../java/edu/wpi/first/ntcore/DevMain.java | 2 +- ntcore/src/dev/native/cpp/main.cpp | 2 +- .../first/networktables/ConnectionInfo.java | 2 +- .../networktables/ConnectionNotification.java | 2 +- .../wpi/first/networktables/EntryInfo.java | 2 +- .../networktables/EntryListenerFlags.java | 2 +- .../networktables/EntryNotification.java | 2 +- .../wpi/first/networktables/LogMessage.java | 2 +- .../wpi/first/networktables/NetworkTable.java | 2 +- .../networktables/NetworkTableEntry.java | 2 +- .../networktables/NetworkTableInstance.java | 2 +- .../first/networktables/NetworkTableType.java | 2 +- .../networktables/NetworkTableValue.java | 2 +- .../first/networktables/NetworkTablesJNI.java | 2 +- .../networktables/PersistentException.java | 2 +- .../wpi/first/networktables/RpcAnswer.java | 2 +- .../edu/wpi/first/networktables/RpcCall.java | 2 +- .../networktables/TableEntryListener.java | 2 +- .../first/networktables/TableListener.java | 2 +- .../wpilibj/networktables/NetworkTable.java | 2 +- .../edu/wpi/first/wpilibj/tables/IRemote.java | 44 +- .../tables/IRemoteConnectionListener.java | 58 +- .../edu/wpi/first/wpilibj/tables/ITable.java | 2 +- .../first/wpilibj/tables/ITableListener.java | 2 +- ntcore/src/main/native/cpp/CallbackManager.h | 2 +- .../main/native/cpp/ConnectionNotifier.cpp | 2 +- .../src/main/native/cpp/ConnectionNotifier.h | 2 +- ntcore/src/main/native/cpp/Dispatcher.cpp | 2 +- ntcore/src/main/native/cpp/Dispatcher.h | 2 +- ntcore/src/main/native/cpp/DsClient.cpp | 2 +- ntcore/src/main/native/cpp/DsClient.h | 2 +- ntcore/src/main/native/cpp/EntryNotifier.cpp | 2 +- ntcore/src/main/native/cpp/EntryNotifier.h | 2 +- ntcore/src/main/native/cpp/Handle.h | 2 +- .../src/main/native/cpp/IConnectionNotifier.h | 2 +- ntcore/src/main/native/cpp/IDispatcher.h | 2 +- ntcore/src/main/native/cpp/IEntryNotifier.h | 5 +- .../src/main/native/cpp/INetworkConnection.h | 2 +- ntcore/src/main/native/cpp/IRpcServer.h | 2 +- ntcore/src/main/native/cpp/IStorage.h | 2 +- ntcore/src/main/native/cpp/InstanceImpl.cpp | 2 +- ntcore/src/main/native/cpp/InstanceImpl.h | 2 +- ntcore/src/main/native/cpp/Log.h | 2 +- ntcore/src/main/native/cpp/LoggerImpl.cpp | 2 +- ntcore/src/main/native/cpp/LoggerImpl.h | 2 +- ntcore/src/main/native/cpp/Message.cpp | 2 +- ntcore/src/main/native/cpp/Message.h | 2 +- .../src/main/native/cpp/NetworkConnection.cpp | 2 +- .../src/main/native/cpp/NetworkConnection.h | 2 +- ntcore/src/main/native/cpp/RpcServer.cpp | 2 +- ntcore/src/main/native/cpp/RpcServer.h | 2 +- ntcore/src/main/native/cpp/SequenceNumber.cpp | 2 +- ntcore/src/main/native/cpp/SequenceNumber.h | 2 +- ntcore/src/main/native/cpp/Storage.cpp | 2 +- ntcore/src/main/native/cpp/Storage.h | 2 +- ntcore/src/main/native/cpp/Storage_load.cpp | 4 +- ntcore/src/main/native/cpp/Storage_save.cpp | 2 +- ntcore/src/main/native/cpp/Value.cpp | 2 +- ntcore/src/main/native/cpp/Value_internal.h | 2 +- ntcore/src/main/native/cpp/WireDecoder.cpp | 2 +- ntcore/src/main/native/cpp/WireDecoder.h | 2 +- ntcore/src/main/native/cpp/WireEncoder.cpp | 2 +- ntcore/src/main/native/cpp/WireEncoder.h | 2 +- .../main/native/cpp/jni/NetworkTablesJNI.cpp | 680 +++++++++++------- .../native/cpp/networktables/NetworkTable.cpp | 2 +- .../cpp/networktables/NetworkTableEntry.cpp | 2 +- .../networktables/NetworkTableInstance.cpp | 2 +- .../main/native/cpp/networktables/RpcCall.cpp | 2 +- ntcore/src/main/native/cpp/ntcore_c.cpp | 2 +- ntcore/src/main/native/cpp/ntcore_cpp.cpp | 2 +- ntcore/src/main/native/cpp/ntcore_test.cpp | 2 +- .../main/native/cpp/tables/ITableListener.cpp | 2 +- .../networktables/EntryListenerFlags.h | 2 +- .../include/networktables/NetworkTable.h | 2 +- .../include/networktables/NetworkTableEntry.h | 2 +- .../networktables/NetworkTableInstance.h | 2 +- .../include/networktables/NetworkTableType.h | 2 +- .../include/networktables/NetworkTableValue.h | 2 +- .../native/include/networktables/RpcCall.h | 2 +- .../networktables/TableEntryListener.h | 2 +- .../include/networktables/TableListener.h | 2 +- ntcore/src/main/native/include/ntcore.h | 2 +- ntcore/src/main/native/include/ntcore_c.h | 24 +- ntcore/src/main/native/include/ntcore_cpp.h | 2 +- ntcore/src/main/native/include/ntcore_test.h | 2 +- .../src/main/native/include/tables/ITable.h | 2 +- .../native/include/tables/ITableListener.h | 2 +- .../networktables/ConnectionListenerTest.java | 2 +- .../networktables/EntryListenerTest.java | 2 +- .../edu/wpi/first/networktables/JNITest.java | 2 +- .../wpi/first/networktables/LoggerTest.java | 2 +- .../first/networktables/NetworkTableTest.java | 2 +- .../native/cpp/ConnectionListenerTest.cpp | 2 +- .../src/test/native/cpp/EntryListenerTest.cpp | 2 +- .../src/test/native/cpp/EntryNotifierTest.cpp | 2 +- ntcore/src/test/native/cpp/MessageMatcher.cpp | 2 +- ntcore/src/test/native/cpp/MessageMatcher.h | 2 +- .../test/native/cpp/MockConnectionNotifier.h | 2 +- ntcore/src/test/native/cpp/MockDispatcher.h | 2 +- .../src/test/native/cpp/MockEntryNotifier.h | 2 +- .../test/native/cpp/MockNetworkConnection.h | 2 +- ntcore/src/test/native/cpp/MockRpcServer.h | 2 +- .../src/test/native/cpp/NetworkTableTest.cpp | 2 +- ntcore/src/test/native/cpp/StorageTest.cpp | 2 +- ntcore/src/test/native/cpp/StorageTest.h | 2 +- ntcore/src/test/native/cpp/TestPrinters.cpp | 2 +- ntcore/src/test/native/cpp/TestPrinters.h | 2 +- ntcore/src/test/native/cpp/ValueMatcher.cpp | 2 +- ntcore/src/test/native/cpp/ValueMatcher.h | 2 +- ntcore/src/test/native/cpp/ValueTest.cpp | 2 +- .../src/test/native/cpp/WireDecoderTest.cpp | 2 +- .../src/test/native/cpp/WireEncoderTest.cpp | 17 +- ntcore/src/test/native/cpp/main.cpp | 2 +- ...tyleEclipse.xml => checkstyleExamples.xml} | 28 +- .../src/main/native/cpp/Commands/Command.cpp | 3 +- .../main/native/cpp/Commands/PIDSubsystem.cpp | 11 +- .../src/main/native/cpp/DoubleSolenoid.cpp | 5 +- .../main/native/cpp/Drive/RobotDriveBase.cpp | 3 +- wpilibc/src/main/native/cpp/ErrorBase.cpp | 12 +- .../main/native/cpp/LiveWindow/LiveWindow.cpp | 11 +- wpilibc/src/main/native/cpp/SPI.cpp | 3 +- .../cpp/SmartDashboard/SendableBase.cpp | 3 +- .../cpp/SmartDashboard/SmartDashboard.cpp | 7 +- wpilibc/src/main/native/cpp/Solenoid.cpp | 5 +- wpilibc/src/main/native/cpp/Utility.cpp | 5 +- .../src/main/native/include/DriverStation.h | 3 +- wpilibc/src/main/native/include/Error.h | 4 +- wpilibc/src/main/native/include/ErrorBase.h | 3 +- .../include/Filters/LinearDigitalFilter.h | 8 +- .../main/native/include/HLUsageReporting.h | 2 +- .../include/SmartDashboard/SendableBuilder.h | 6 +- .../SmartDashboard/SendableBuilderImpl.h | 6 +- .../include/SmartDashboard/SmartDashboard.h | 7 +- wpilibc/src/main/native/include/Utility.h | 5 +- wpilibcExamples/.clang-format | 76 -- wpilibcExamples/.styleguide | 45 -- .../cpp/examples/ArcadeDrive/src/Robot.cpp | 18 +- .../examples/AxisCameraSample/src/Robot.cpp | 79 +- .../main/cpp/examples/CANPDP/src/Robot.cpp | 37 +- .../main/cpp/examples/Encoder/src/Robot.cpp | 127 ++-- .../GearsBot/src/Commands/Autonomous.cpp | 25 +- .../GearsBot/src/Commands/Autonomous.h | 4 +- .../GearsBot/src/Commands/CloseClaw.cpp | 15 +- .../GearsBot/src/Commands/CloseClaw.h | 10 +- .../GearsBot/src/Commands/DriveStraight.cpp | 28 +- .../GearsBot/src/Commands/DriveStraight.h | 38 +- .../GearsBot/src/Commands/OpenClaw.cpp | 19 +- .../examples/GearsBot/src/Commands/OpenClaw.h | 10 +- .../examples/GearsBot/src/Commands/Pickup.cpp | 9 +- .../examples/GearsBot/src/Commands/Pickup.h | 4 +- .../examples/GearsBot/src/Commands/Place.cpp | 9 +- .../examples/GearsBot/src/Commands/Place.h | 4 +- .../GearsBot/src/Commands/PrepareToPickup.cpp | 9 +- .../GearsBot/src/Commands/PrepareToPickup.h | 4 +- .../src/Commands/SetDistanceToBox.cpp | 28 +- .../GearsBot/src/Commands/SetDistanceToBox.h | 38 +- .../src/Commands/SetElevatorSetpoint.cpp | 12 +- .../src/Commands/SetElevatorSetpoint.h | 12 +- .../src/Commands/SetWristSetpoint.cpp | 12 +- .../GearsBot/src/Commands/SetWristSetpoint.h | 12 +- .../src/Commands/TankDriveWithJoystick.cpp | 14 +- .../src/Commands/TankDriveWithJoystick.h | 10 +- .../src/main/cpp/examples/GearsBot/src/OI.cpp | 26 +- .../src/main/cpp/examples/GearsBot/src/OI.h | 28 +- .../main/cpp/examples/GearsBot/src/Robot.cpp | 33 +- .../main/cpp/examples/GearsBot/src/Robot.h | 30 +- .../examples/GearsBot/src/Subsystems/Claw.cpp | 23 +- .../examples/GearsBot/src/Subsystems/Claw.h | 48 +- .../GearsBot/src/Subsystems/DriveTrain.cpp | 69 +- .../GearsBot/src/Subsystems/DriveTrain.h | 90 +-- .../GearsBot/src/Subsystems/Elevator.cpp | 23 +- .../GearsBot/src/Subsystems/Elevator.h | 52 +- .../GearsBot/src/Subsystems/Wrist.cpp | 23 +- .../examples/GearsBot/src/Subsystems/Wrist.h | 48 +- .../cpp/examples/GettingStarted/src/Robot.cpp | 66 +- .../src/main/cpp/examples/Gyro/src/Robot.cpp | 58 +- .../cpp/examples/GyroMecanum/src/Robot.cpp | 67 +- .../examples/IntermediateVision/src/Robot.cpp | 85 ++- .../cpp/examples/MecanumDrive/src/Robot.cpp | 54 +- .../cpp/examples/MotorControl/src/Robot.cpp | 10 +- .../PacGoat/src/Commands/CheckForHotGoal.cpp | 6 +- .../PacGoat/src/Commands/CheckForHotGoal.h | 6 +- .../PacGoat/src/Commands/CloseClaw.cpp | 8 +- .../examples/PacGoat/src/Commands/CloseClaw.h | 6 +- .../examples/PacGoat/src/Commands/Collect.cpp | 8 +- .../examples/PacGoat/src/Commands/Collect.h | 4 +- .../src/Commands/DriveAndShootAutonomous.cpp | 14 +- .../src/Commands/DriveAndShootAutonomous.h | 4 +- .../PacGoat/src/Commands/DriveForward.cpp | 42 +- .../PacGoat/src/Commands/DriveForward.h | 30 +- .../src/Commands/DriveWithJoystick.cpp | 16 +- .../PacGoat/src/Commands/DriveWithJoystick.h | 10 +- .../PacGoat/src/Commands/ExtendShooter.cpp | 13 +- .../PacGoat/src/Commands/ExtendShooter.h | 8 +- .../examples/PacGoat/src/Commands/LowGoal.cpp | 6 +- .../examples/PacGoat/src/Commands/LowGoal.h | 4 +- .../PacGoat/src/Commands/OpenClaw.cpp | 12 +- .../examples/PacGoat/src/Commands/OpenClaw.h | 8 +- .../src/Commands/SetCollectionSpeed.cpp | 8 +- .../PacGoat/src/Commands/SetCollectionSpeed.h | 10 +- .../PacGoat/src/Commands/SetPivotSetpoint.cpp | 12 +- .../PacGoat/src/Commands/SetPivotSetpoint.h | 12 +- .../examples/PacGoat/src/Commands/Shoot.cpp | 8 +- .../cpp/examples/PacGoat/src/Commands/Shoot.h | 4 +- .../PacGoat/src/Commands/WaitForBall.cpp | 8 +- .../PacGoat/src/Commands/WaitForBall.h | 6 +- .../PacGoat/src/Commands/WaitForPressure.cpp | 8 +- .../PacGoat/src/Commands/WaitForPressure.h | 6 +- .../src/main/cpp/examples/PacGoat/src/OI.cpp | 32 +- .../src/main/cpp/examples/PacGoat/src/OI.h | 20 +- .../main/cpp/examples/PacGoat/src/Robot.cpp | 70 +- .../src/main/cpp/examples/PacGoat/src/Robot.h | 42 +- .../PacGoat/src/Subsystems/Collector.cpp | 33 +- .../PacGoat/src/Subsystems/Collector.h | 90 +-- .../PacGoat/src/Subsystems/DriveTrain.cpp | 75 +- .../PacGoat/src/Subsystems/DriveTrain.h | 86 +-- .../examples/PacGoat/src/Subsystems/Pivot.cpp | 43 +- .../examples/PacGoat/src/Subsystems/Pivot.h | 86 +-- .../PacGoat/src/Subsystems/Pneumatics.cpp | 14 +- .../PacGoat/src/Subsystems/Pneumatics.h | 46 +- .../PacGoat/src/Subsystems/Shooter.cpp | 77 +- .../examples/PacGoat/src/Subsystems/Shooter.h | 170 ++--- .../PacGoat/src/Triggers/DoubleButton.cpp | 6 +- .../PacGoat/src/Triggers/DoubleButton.h | 14 +- .../examples/PotentiometerPID/src/Robot.cpp | 88 ++- .../cpp/examples/QuickVision/src/Robot.cpp | 17 +- .../src/main/cpp/examples/Relay/src/Robot.cpp | 67 +- .../main/cpp/examples/Solenoid/src/Robot.cpp | 83 +-- .../cpp/examples/Ultrasonic/src/Robot.cpp | 55 +- .../cpp/examples/UltrasonicPID/src/Robot.cpp | 97 ++- .../commandbased/Commands/ExampleCommand.cpp | 8 +- .../commandbased/Commands/ExampleCommand.h | 14 +- .../commandbased/Commands/MyAutoCommand.cpp | 8 +- .../commandbased/Commands/MyAutoCommand.h | 14 +- .../main/cpp/templates/commandbased/OI.cpp | 2 +- .../src/main/cpp/templates/commandbased/OI.h | 4 +- .../main/cpp/templates/commandbased/Robot.cpp | 56 +- .../main/cpp/templates/commandbased/Robot.h | 36 +- .../Subsystems/ExampleSubsystem.cpp | 7 +- .../Subsystems/ExampleSubsystem.h | 12 +- .../main/cpp/templates/iterative/Robot.cpp | 34 +- .../src/main/cpp/templates/iterative/Robot.h | 24 +- .../src/main/cpp/templates/sample/Robot.cpp | 75 +- .../src/main/cpp/templates/sample/Robot.h | 39 +- .../src/main/cpp/templates/timed/Robot.cpp | 34 +- .../src/main/cpp/templates/timed/Robot.h | 24 +- .../src/main/native/cpp/FilterNoiseTest.cpp | 2 +- .../src/main/native/cpp/FilterOutputTest.cpp | 2 +- .../src/main/native/cpp/MotorEncoderTest.cpp | 3 +- .../main/native/cpp/MotorInvertingTest.cpp | 3 +- .../src/main/native/dt/main.cpp | 7 + wpilibjExamples/build.gradle | 2 +- .../wpilibj/examples/axiscamera/Robot.java | 76 +- .../first/wpilibj/examples/gearsbot/OI.java | 66 +- .../wpilibj/examples/gearsbot/Robot.java | 138 ++-- .../gearsbot/commands/Autonomous.java | 26 +- .../examples/gearsbot/commands/CloseClaw.java | 48 +- .../gearsbot/commands/DriveStraight.java | 82 +-- .../examples/gearsbot/commands/OpenClaw.java | 28 +- .../examples/gearsbot/commands/Pickup.java | 10 +- .../examples/gearsbot/commands/Place.java | 10 +- .../gearsbot/commands/PrepareToPickup.java | 10 +- .../gearsbot/commands/SetDistanceToBox.java | 82 +-- .../commands/SetElevatorSetpoint.java | 32 +- .../gearsbot/commands/SetWristSetpoint.java | 32 +- .../commands/TankDriveWithJoystick.java | 36 +- .../examples/gearsbot/subsystems/Claw.java | 76 +- .../gearsbot/subsystems/DriveTrain.java | 204 +++--- .../gearsbot/subsystems/Elevator.java | 98 +-- .../examples/gearsbot/subsystems/Wrist.java | 94 +-- .../examples/gettingstarted/Robot.java | 100 +-- .../first/wpilibj/examples/gyro/Robot.java | 58 +- .../wpilibj/examples/gyromecanum/Robot.java | 66 +- .../examples/intermediatevision/Robot.java | 74 +- .../wpilibj/examples/mecanumdrive/Robot.java | 54 +- .../wpilibj/examples/motorcontrol/Robot.java | 26 +- .../first/wpilibj/examples/pacgoat/OI.java | 44 +- .../first/wpilibj/examples/pacgoat/Robot.java | 162 ++--- .../pacgoat/commands/CheckForHotGoal.java | 16 +- .../examples/pacgoat/commands/CloseClaw.java | 16 +- .../examples/pacgoat/commands/Collect.java | 12 +- .../commands/DriveAndShootAutonomous.java | 22 +- .../pacgoat/commands/DriveForward.java | 78 +- .../pacgoat/commands/DriveWithJoystick.java | 30 +- .../pacgoat/commands/ExtendShooter.java | 28 +- .../examples/pacgoat/commands/LowGoal.java | 10 +- .../examples/pacgoat/commands/OpenClaw.java | 26 +- .../pacgoat/commands/SetCollectionSpeed.java | 20 +- .../pacgoat/commands/SetPivotSetpoint.java | 32 +- .../examples/pacgoat/commands/Shoot.java | 12 +- .../pacgoat/commands/WaitForBall.java | 16 +- .../pacgoat/commands/WaitForPressure.java | 16 +- .../pacgoat/subsystems/Collector.java | 136 ++-- .../pacgoat/subsystems/DriveTrain.java | 196 ++--- .../examples/pacgoat/subsystems/Pivot.java | 138 ++-- .../pacgoat/subsystems/Pneumatics.java | 54 +- .../examples/pacgoat/subsystems/Shooter.java | 260 +++---- .../pacgoat/triggers/DoubleButton.java | 24 +- .../examples/potentiometerpid/Robot.java | 86 +-- .../wpilibj/examples/quickvision/Robot.java | 8 +- .../wpilibj/examples/tankdrive/Robot.java | 26 +- .../wpilibj/examples/ultrasonic/Robot.java | 50 +- .../wpilibj/examples/ultrasonicpid/Robot.java | 80 +-- .../wpilibj/templates/commandbased/OI.java | 44 +- .../wpilibj/templates/commandbased/Robot.java | 164 ++--- .../templates/commandbased/RobotMap.java | 16 +- .../commandbased/commands/ExampleCommand.java | 52 +- .../subsystems/ExampleSubsystem.java | 12 +- .../wpilibj/templates/iterative/Robot.java | 118 +-- .../first/wpilibj/templates/sample/Robot.java | 216 +++--- .../first/wpilibj/templates/timed/Robot.java | 118 +-- wpiutil/.styleguide | 9 +- .../src/main/native/include/llvm/AlignOf.h | 2 + .../src/main/native/include/llvm/ArrayRef.h | 2 + .../src/main/native/include/llvm/Compiler.h | 2 + .../src/main/native/include/llvm/ConvertUTF.h | 2 + .../src/main/native/include/llvm/DenseMap.h | 2 + .../main/native/include/llvm/DenseMapInfo.h | 2 + .../main/native/include/llvm/EpochTracker.h | 2 + .../src/main/native/include/llvm/FileSystem.h | 2 + wpiutil/src/main/native/include/llvm/Format.h | 2 + .../src/main/native/include/llvm/Hashing.h | 2 + .../native/include/llvm/IntrusiveRefCntPtr.h | 2 + .../src/main/native/include/llvm/MathExtras.h | 2 + wpiutil/src/main/native/include/llvm/None.h | 2 + .../src/main/native/include/llvm/Optional.h | 2 + wpiutil/src/main/native/include/llvm/Path.h | 2 + .../include/llvm/PointerLikeTypeTraits.h | 2 + .../src/main/native/include/llvm/STLExtras.h | 2 + .../main/native/include/llvm/SmallPtrSet.h | 2 + .../src/main/native/include/llvm/SmallSet.h | 2 + .../main/native/include/llvm/SmallString.h | 2 + .../main/native/include/llvm/SmallVector.h | 2 + .../main/native/include/llvm/StringExtras.h | 2 + .../src/main/native/include/llvm/StringMap.h | 2 + .../src/main/native/include/llvm/StringRef.h | 2 + wpiutil/src/main/native/include/llvm/Twine.h | 2 + .../main/native/include/llvm/WindowsError.h | 2 + .../main/native/include/llvm/iterator_range.h | 2 + .../main/native/include/llvm/raw_os_ostream.h | 2 + .../main/native/include/llvm/raw_ostream.h | 2 + .../main/native/include/llvm/type_traits.h | 2 + .../src/main/native/include/support/Base64.h | 3 + .../native/include/support/ConcurrentQueue.h | 3 + .../main/native/include/support/HttpUtil.h | 3 + .../main/native/include/support/HttpUtil.inl | 2 + .../src/main/native/include/support/Logger.h | 3 + .../main/native/include/support/SafeThread.h | 3 + .../main/native/include/support/UidVector.h | 3 + .../native/include/support/atomic_static.h | 3 + .../include/support/condition_variable.h | 3 + .../main/native/include/support/deprecated.h | 3 + .../main/native/include/support/hostname.h | 3 + .../main/native/include/support/jni_util.h | 3 + .../src/main/native/include/support/json.h | 3 + .../src/main/native/include/support/leb128.h | 3 + .../src/main/native/include/support/mutex.h | 3 + .../support/priority_condition_variable.h | 3 + .../native/include/support/priority_mutex.h | 3 + .../main/native/include/support/raw_istream.h | 3 + .../include/support/raw_socket_istream.h | 3 + .../include/support/raw_socket_ostream.h | 3 + .../src/main/native/include/support/sha1.h | 3 + .../main/native/include/support/timestamp.h | 3 + .../include/tcpsockets/NetworkAcceptor.h | 3 + .../native/include/tcpsockets/NetworkStream.h | 3 + .../native/include/tcpsockets/SocketError.h | 3 + .../native/include/tcpsockets/TCPAcceptor.h | 3 + .../native/include/tcpsockets/TCPConnector.h | 3 + .../native/include/tcpsockets/TCPStream.h | 3 + .../native/include/udpsockets/UDPClient.h | 3 + wpiutil/src/main/native/include/wpi/Base64.h | 6 +- .../main/native/include/wpi/ConcurrentQueue.h | 6 +- .../src/main/native/include/wpi/HttpUtil.h | 6 +- wpiutil/src/main/native/include/wpi/Logger.h | 6 +- .../main/native/include/wpi/NetworkAcceptor.h | 6 +- .../main/native/include/wpi/NetworkStream.h | 6 +- wpiutil/src/main/native/include/wpi/Path.h | 27 +- .../src/main/native/include/wpi/SafeThread.h | 6 +- .../src/main/native/include/wpi/SocketError.h | 6 +- .../src/main/native/include/wpi/TCPAcceptor.h | 6 +- .../main/native/include/wpi/TCPConnector.h | 6 +- .../src/main/native/include/wpi/TCPStream.h | 6 +- .../src/main/native/include/wpi/UDPClient.h | 6 +- .../src/main/native/include/wpi/UidVector.h | 6 +- .../src/main/native/include/wpi/deprecated.h | 6 +- .../src/main/native/include/wpi/hostname.h | 6 +- .../src/main/native/include/wpi/jni_util.h | 12 +- wpiutil/src/main/native/include/wpi/leb128.h | 6 +- wpiutil/src/main/native/include/wpi/memory.h | 6 +- .../src/main/native/include/wpi/raw_istream.h | 6 +- .../native/include/wpi/raw_socket_istream.h | 6 +- .../native/include/wpi/raw_socket_ostream.h | 6 +- wpiutil/src/main/native/include/wpi/sha1.h | 6 +- .../src/main/native/include/wpi/timestamp.h | 6 +- 481 files changed, 9581 insertions(+), 6828 deletions(-) create mode 100644 cameraserver/.styleguide create mode 100644 ntcore/.styleguide rename styleguide/{checkstyleEclipse.xml => checkstyleExamples.xml} (92%) delete mode 100644 wpilibcExamples/.clang-format delete mode 100644 wpilibcExamples/.styleguide diff --git a/.styleguide b/.styleguide index a18f24ca9d..a4498ed996 100644 --- a/.styleguide +++ b/.styleguide @@ -9,33 +9,25 @@ cppSrcFileInclude { } generatedFileExclude { - gmock/ + gtest/ ni-libraries/include/ ni-libraries/lib/ - hal/src/main/native/athena/ctre/ - hal/src/main/native/athena/frccansae/ - hal/src/main/native/athena/visa/ - hal/src/main/native/include/ctre/ - UsageReporting\.h$ } modifiableFileExclude { - wpilibj/src/arm-linux-jni/ - wpilibj/src/main/native/cpp/ - \.patch$ - \.png$ + shared/arm-linux-jni/ \.py$ \.so$ } +repoRootNameOverride { + wpilib +} + includeOtherLibs { ^HAL/ - ^llvm/ ^networktables/ ^opencv2/ ^support/ -} - -includeProject { - ^ctre/ + ^wpi/ } diff --git a/.travis.yml b/.travis.yml index f8014d001c..d05513b0f7 100644 --- a/.travis.yml +++ b/.travis.yml @@ -37,4 +37,4 @@ cache: script: - python3.5 -m wpiformat -y 2018 -clang 5.0 - git --no-pager diff --exit-code HEAD # Ensure formatter made no changes - - ./gradlew --no-daemon --console=plain -PskipAthena :hal:halSimSharedLibrary :wpilibc:wpilibcSharedLibrary :wpilibj:wpilibJNISharedSharedLibrary :wpilibj:jar + - ./gradlew --no-daemon --console=plain -PskipAthena :hal:halSharedLibrary :hal:halJNISharedLibrary :wpilibc:wpilibcSharedLibrary :wpilibj:jar diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 6e186a170d..b25e4d4e28 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -37,7 +37,7 @@ So you want to contribute your changes back to WPILib. Great! We have a few cont ## Coding Guidelines -WPILib uses modified Google style guides for both C++ and Java, which can be found in the [styleguide repository](https://github.com/wpilibsuite/styleguide). Autoformatters are available for many popular editors at https://github.com/google/styleguide. Running wpiformat is required for all contributions and is enforced by our continuous integration system. +WPILib uses modified Google style guides for both C++ and Java, which can be found in the [styleguide repository](https://github.com/wpilibsuite/styleguide). Autoformatters are available for many popular editors at https://github.com/google/styleguide. Running wpiformat is required for all contributions and is enforced by our continuous integration system. We currently use clang-format 5.0 with wpiformat. While the library should be fully formatted according to the styles, additional elements of the style guide were not followed when the library was initially created. All new code should follow the guidelines. If you are looking for some easy ramp-up tasks, finding areas that don't follow the style guide and fixing them is very welcome. diff --git a/cameraserver/.styleguide b/cameraserver/.styleguide new file mode 100644 index 0000000000..899d9c2de3 --- /dev/null +++ b/cameraserver/.styleguide @@ -0,0 +1,28 @@ +cppHeaderFileInclude { + \.h$ + \.inc$ +} + +cppSrcFileInclude { + \.cpp$ +} + +modifiableFileExclude { + \.so$ +} + +repoRootNameOverride { + cameraserver +} + +includeOtherLibs { + ^HAL/ + ^networktables/ + ^opencv2/ + ^support/ + ^wpi/ +} + +includeGuardRoots { + cameraserver/src/main/native/include/ +} diff --git a/cameraserver/src/main/native/cpp/CameraServer.cpp b/cameraserver/src/main/native/cpp/CameraServer.cpp index 4fa779e80e..55c69e8bff 100644 --- a/cameraserver/src/main/native/cpp/CameraServer.cpp +++ b/cameraserver/src/main/native/cpp/CameraServer.cpp @@ -193,8 +193,7 @@ static std::vector GetSourceModeValues(int source) { return rv; } -static inline wpi::StringRef Concatenate(wpi::StringRef lhs, - wpi::StringRef rhs, +static inline wpi::StringRef Concatenate(wpi::StringRef lhs, wpi::StringRef rhs, wpi::SmallVectorImpl& buf) { buf.clear(); wpi::raw_svector_ostream oss{buf}; diff --git a/cameraserver/src/main/native/include/CameraServer.h b/cameraserver/src/main/native/include/CameraServer.h index 32a2b04319..916a8d64d3 100644 --- a/cameraserver/src/main/native/include/CameraServer.h +++ b/cameraserver/src/main/native/include/CameraServer.h @@ -80,8 +80,7 @@ class CameraServer { * @param name The name to give the camera * @param path The device path (e.g. "/dev/video0") of the camera */ - cs::UsbCamera StartAutomaticCapture(wpi::StringRef name, - wpi::StringRef path); + cs::UsbCamera StartAutomaticCapture(wpi::StringRef name, wpi::StringRef path); #endif /** diff --git a/cscore/.styleguide b/cscore/.styleguide index baededc2ea..f3e6dffe0d 100644 --- a/cscore/.styleguide +++ b/cscore/.styleguide @@ -1,5 +1,9 @@ +cHeaderFileInclude { + _c\.h$ +} + cppHeaderFileInclude { - \.h$ + (?& buf, - CS_Status* status) { + CS_Status* status) { auto data = Sinks::GetInstance().Get(sink); if (!data || data->kind != CS_SINK_CV) { *status = CS_INVALID_HANDLE; diff --git a/cscore/src/main/native/cpp/HttpCameraImpl.cpp b/cscore/src/main/native/cpp/HttpCameraImpl.cpp index a16c672f29..e87891ea7d 100644 --- a/cscore/src/main/native/cpp/HttpCameraImpl.cpp +++ b/cscore/src/main/native/cpp/HttpCameraImpl.cpp @@ -494,8 +494,7 @@ CS_Source CreateHttpCamera(wpi::StringRef name, wpi::StringRef url, return handle; } -CS_Source CreateHttpCamera(wpi::StringRef name, - wpi::ArrayRef urls, +CS_Source CreateHttpCamera(wpi::StringRef name, wpi::ArrayRef urls, CS_HttpCameraKind kind, CS_Status* status) { if (urls.empty()) { *status = CS_EMPTY_VALUE; diff --git a/cscore/src/main/native/cpp/JpegUtil.cpp b/cscore/src/main/native/cpp/JpegUtil.cpp index 357aaf56eb..35891e84e8 100644 --- a/cscore/src/main/native/cpp/JpegUtil.cpp +++ b/cscore/src/main/native/cpp/JpegUtil.cpp @@ -93,9 +93,9 @@ bool JpegNeedsDHT(const char* data, size_t* size, size_t* locSOF) { for (;;) { if (sdata.size() < 4) return false; // EOF bytes = sdata.bytes_begin(); - if (bytes[0] != 0xff) return false; // not a tag - if (bytes[1] == 0xda) break; // SOS - if (bytes[1] == 0xc4) return false; // DHT + if (bytes[0] != 0xff) return false; // not a tag + if (bytes[1] == 0xda) break; // SOS + if (bytes[1] == 0xc4) return false; // DHT if (bytes[1] == 0xc0) *locSOF = sdata.data() - data; // SOF // Go to the next block sdata = sdata.substr(bytes[2] * 256 + bytes[3] + 2); @@ -111,7 +111,7 @@ bool JpegNeedsDHT(const char* data, size_t* size, size_t* locSOF) { wpi::StringRef JpegGetDHT() { return wpi::StringRef(reinterpret_cast(dhtData), - sizeof(dhtData)); + sizeof(dhtData)); } static inline void ReadInto(wpi::raw_istream& is, std::string& buf, diff --git a/cscore/src/main/native/cpp/MjpegServerImpl.cpp b/cscore/src/main/native/cpp/MjpegServerImpl.cpp index d8a5a0bc7e..cf0278db61 100644 --- a/cscore/src/main/native/cpp/MjpegServerImpl.cpp +++ b/cscore/src/main/native/cpp/MjpegServerImpl.cpp @@ -124,8 +124,8 @@ class MjpegServerImpl::ConnThread : public wpi::SafeThread { // A browser should connect for each file and not serve files from its cache. // Using cached pictures would lead to showing old/outdated pictures. // Many browsers seem to ignore, or at least not always obey, those headers. -static void SendHeader(wpi::raw_ostream& os, int code, - wpi::StringRef codeText, wpi::StringRef contentType, +static void SendHeader(wpi::raw_ostream& os, int code, wpi::StringRef codeText, + wpi::StringRef contentType, wpi::StringRef extra = wpi::StringRef{}) { os << "HTTP/1.0 " << code << ' ' << codeText << "\r\n"; os << "Connection: close\r\n" @@ -143,8 +143,7 @@ static void SendHeader(wpi::raw_ostream& os, int code, // Send error header and message // @param code HTTP error code (e.g. 404) // @param message Additional message text -static void SendError(wpi::raw_ostream& os, int code, - wpi::StringRef message) { +static void SendError(wpi::raw_ostream& os, int code, wpi::StringRef message) { wpi::StringRef codeText, extra, baseMessage; switch (code) { case 401: @@ -733,8 +732,7 @@ void MjpegServerImpl::ConnThread::ProcessRequest() { } else if (req.find("GET /output") != wpi::StringRef::npos && req.find(".json") != wpi::StringRef::npos) { kind = kGetSettings; - } else if ((pos = req.find("GET /?action=command")) != - wpi::StringRef::npos) { + } else if ((pos = req.find("GET /?action=command")) != wpi::StringRef::npos) { kind = kCommand; parameters = req.substr(req.find('&', pos + 20)).substr(1); } else if (req.find("GET / ") != wpi::StringRef::npos || req == "GET /\n") { diff --git a/cscore/src/main/native/cpp/SinkImpl.cpp b/cscore/src/main/native/cpp/SinkImpl.cpp index 15a75bf79a..3253b54f90 100644 --- a/cscore/src/main/native/cpp/SinkImpl.cpp +++ b/cscore/src/main/native/cpp/SinkImpl.cpp @@ -26,8 +26,7 @@ void SinkImpl::SetDescription(wpi::StringRef description) { m_description = description; } -wpi::StringRef SinkImpl::GetDescription( - wpi::SmallVectorImpl& buf) const { +wpi::StringRef SinkImpl::GetDescription(wpi::SmallVectorImpl& buf) const { std::lock_guard lock(m_mutex); buf.append(m_description.begin(), m_description.end()); return wpi::StringRef{buf.data(), buf.size()}; diff --git a/cscore/src/main/native/cpp/SourceImpl.cpp b/cscore/src/main/native/cpp/SourceImpl.cpp index 730b3c0203..6ac553354d 100644 --- a/cscore/src/main/native/cpp/SourceImpl.cpp +++ b/cscore/src/main/native/cpp/SourceImpl.cpp @@ -131,8 +131,7 @@ CS_PropertyKind SourceImpl::GetPropertyKind(int property) const { wpi::StringRef SourceImpl::GetPropertyName(int property, wpi::SmallVectorImpl& buf, CS_Status* status) const { - if (!m_properties_cached && !CacheProperties(status)) - return wpi::StringRef{}; + if (!m_properties_cached && !CacheProperties(status)) return wpi::StringRef{}; std::lock_guard lock(m_mutex); auto prop = GetProperty(property); if (!prop) { @@ -206,8 +205,7 @@ int SourceImpl::GetPropertyDefault(int property, CS_Status* status) const { wpi::StringRef SourceImpl::GetStringProperty(int property, wpi::SmallVectorImpl& buf, CS_Status* status) const { - if (!m_properties_cached && !CacheProperties(status)) - return wpi::StringRef{}; + if (!m_properties_cached && !CacheProperties(status)) return wpi::StringRef{}; std::lock_guard lock(m_mutex); auto prop = GetProperty(property); if (!prop) { diff --git a/cscore/src/main/native/cpp/SourceImpl.h b/cscore/src/main/native/cpp/SourceImpl.h index dd98041bf8..c1182bef4f 100644 --- a/cscore/src/main/native/cpp/SourceImpl.h +++ b/cscore/src/main/native/cpp/SourceImpl.h @@ -94,8 +94,7 @@ class SourceImpl { wpi::ArrayRef EnumerateProperties(wpi::SmallVectorImpl& vec, CS_Status* status) const; CS_PropertyKind GetPropertyKind(int property) const; - wpi::StringRef GetPropertyName(int property, - wpi::SmallVectorImpl& buf, + wpi::StringRef GetPropertyName(int property, wpi::SmallVectorImpl& buf, CS_Status* status) const; int GetProperty(int property, CS_Status* status) const; virtual void SetProperty(int property, int value, CS_Status* status) = 0; diff --git a/cscore/src/main/native/cpp/UsbCameraImpl.cpp b/cscore/src/main/native/cpp/UsbCameraImpl.cpp index ae46b06013..500ab78068 100644 --- a/cscore/src/main/native/cpp/UsbCameraImpl.cpp +++ b/cscore/src/main/native/cpp/UsbCameraImpl.cpp @@ -28,8 +28,8 @@ #include #include -#include #include +#include #include #include "Handle.h" @@ -389,7 +389,7 @@ void UsbCameraImpl::CameraThreadMain() { DeviceStreamOff(); DeviceDisconnect(); notified = true; // device wasn't deleted, just error'ed - continue; // will reconnect + continue; // will reconnect } if ((buf.flags & V4L2_BUF_FLAG_ERROR) == 0) { @@ -415,7 +415,7 @@ void UsbCameraImpl::CameraThreadMain() { DeviceStreamOff(); DeviceDisconnect(); notified = true; // device wasn't deleted, just error'ed - continue; // will reconnect + continue; // will reconnect } } } diff --git a/cscore/src/main/native/cpp/UsbCameraImpl.h b/cscore/src/main/native/cpp/UsbCameraImpl.h index de449b5e47..20726d6689 100644 --- a/cscore/src/main/native/cpp/UsbCameraImpl.h +++ b/cscore/src/main/native/cpp/UsbCameraImpl.h @@ -75,7 +75,7 @@ class UsbCameraImpl : public SourceImpl { kCmdSetFPS, kCmdSetProperty, kCmdSetPropertyStr, - kNumSinksChanged, // no response + kNumSinksChanged, // no response kNumSinksEnabledChanged, // no response // Responses kOk, diff --git a/cscore/src/main/native/cpp/UsbCameraProperty.h b/cscore/src/main/native/cpp/UsbCameraProperty.h index 8c774aee23..6a3c8e4702 100644 --- a/cscore/src/main/native/cpp/UsbCameraProperty.h +++ b/cscore/src/main/native/cpp/UsbCameraProperty.h @@ -62,7 +62,7 @@ class UsbCameraProperty : public PropertyImpl { int propPair{0}; unsigned id{0}; // implementation-level id - int type{0}; // implementation type, not CS_PropertyKind! + int type{0}; // implementation type, not CS_PropertyKind! }; } // namespace cs diff --git a/cscore/src/main/native/cpp/cscore_cpp.cpp b/cscore/src/main/native/cpp/cscore_cpp.cpp index fb5abfec4b..8c63cbd346 100644 --- a/cscore/src/main/native/cpp/cscore_cpp.cpp +++ b/cscore/src/main/native/cpp/cscore_cpp.cpp @@ -171,8 +171,7 @@ std::string GetSourceName(CS_Source source, CS_Status* status) { return data->source->GetName(); } -wpi::StringRef GetSourceName(CS_Source source, - wpi::SmallVectorImpl& buf, +wpi::StringRef GetSourceName(CS_Source source, wpi::SmallVectorImpl& buf, CS_Status* status) { auto data = Sources::GetInstance().Get(source); if (!data) { @@ -309,8 +308,9 @@ std::vector EnumerateSourceVideoModes(CS_Source source, return data->source->EnumerateVideoModes(status); } -wpi::ArrayRef EnumerateSourceSinks( - CS_Source source, wpi::SmallVectorImpl& vec, CS_Status* status) { +wpi::ArrayRef EnumerateSourceSinks(CS_Source source, + wpi::SmallVectorImpl& vec, + CS_Status* status) { auto data = Sources::GetInstance().Get(source); if (!data) { *status = CS_INVALID_HANDLE; @@ -468,8 +468,7 @@ std::string GetSinkDescription(CS_Sink sink, CS_Status* status) { return data->sink->GetDescription(buf); } -wpi::StringRef GetSinkDescription(CS_Sink sink, - wpi::SmallVectorImpl& buf, +wpi::StringRef GetSinkDescription(CS_Sink sink, wpi::SmallVectorImpl& buf, CS_Status* status) { auto data = Sinks::GetInstance().Get(sink); if (!data) { @@ -630,8 +629,8 @@ wpi::ArrayRef EnumerateSourceHandles( return Sources::GetInstance().GetAll(vec); } -wpi::ArrayRef EnumerateSinkHandles( - wpi::SmallVectorImpl& vec, CS_Status* status) { +wpi::ArrayRef EnumerateSinkHandles(wpi::SmallVectorImpl& vec, + CS_Status* status) { return Sinks::GetInstance().GetAll(vec); } @@ -642,7 +641,7 @@ std::string GetHostname() { name[255] = '\0'; // Per POSIX, may not be null terminated if too long return name; #else - return ""; // TODO + return ""; // TODO #endif } @@ -654,7 +653,7 @@ std::vector GetNetworkInterfaces() { std::vector rv; char buf[256]; for (struct ifaddrs* i = ifa; i; i = i->ifa_next) { - if (!i->ifa_addr) continue; // no address + if (!i->ifa_addr) continue; // no address if (i->ifa_addr->sa_family != AF_INET) continue; // only return IPv4 struct sockaddr_in* addr_in = reinterpret_cast(i->ifa_addr); const char* addr = diff --git a/cscore/src/main/native/cpp/jni/CameraServerJNI.cpp b/cscore/src/main/native/cpp/jni/CameraServerJNI.cpp index b5b5f77f2d..3b53348584 100644 --- a/cscore/src/main/native/cpp/jni/CameraServerJNI.cpp +++ b/cscore/src/main/native/cpp/jni/CameraServerJNI.cpp @@ -1,5 +1,5 @@ /*----------------------------------------------------------------------------*/ -/* Copyright (c) 2016-2017 FIRST. All Rights Reserved. */ +/* Copyright (c) 2016-2018 FIRST. 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. */ @@ -106,7 +106,8 @@ JNIEXPORT void JNICALL JNI_OnUnload(JavaVM* vm, void* reserved) { template class JCSGlobal { public: - JCSGlobal(JNIEnv* env, T obj) : m_obj(static_cast(env->NewGlobalRef(obj))) {} + JCSGlobal(JNIEnv* env, T obj) + : m_obj(static_cast(env->NewGlobalRef(obj))) {} ~JCSGlobal() { if (!jvm || cs::NotifierDestroyed()) return; JNIEnv* env; @@ -179,7 +180,7 @@ static inline bool CheckStatus(JNIEnv* env, CS_Status status) { } #ifdef __linux__ -static jobject MakeJObject(JNIEnv* env, const cs::UsbCameraInfo &info) { +static jobject MakeJObject(JNIEnv* env, const cs::UsbCameraInfo& info) { static jmethodID constructor = env->GetMethodID( usbCameraInfoCls, "", "(ILjava/lang/String;Ljava/lang/String;)V"); JLocal path(env, MakeJString(env, info.path)); @@ -230,7 +231,8 @@ extern "C" { * Method: getPropertyKind * Signature: (I)I */ -JNIEXPORT jint JNICALL Java_edu_wpi_cscore_CameraServerJNI_getPropertyKind +JNIEXPORT jint JNICALL +Java_edu_wpi_cscore_CameraServerJNI_getPropertyKind (JNIEnv* env, jclass, jint property) { CS_Status status = 0; @@ -244,7 +246,8 @@ JNIEXPORT jint JNICALL Java_edu_wpi_cscore_CameraServerJNI_getPropertyKind * Method: getPropertyName * Signature: (I)Ljava/lang/String; */ -JNIEXPORT jstring JNICALL Java_edu_wpi_cscore_CameraServerJNI_getPropertyName +JNIEXPORT jstring JNICALL +Java_edu_wpi_cscore_CameraServerJNI_getPropertyName (JNIEnv* env, jclass, jint property) { CS_Status status = 0; @@ -259,7 +262,8 @@ JNIEXPORT jstring JNICALL Java_edu_wpi_cscore_CameraServerJNI_getPropertyName * Method: getProperty * Signature: (I)I */ -JNIEXPORT jint JNICALL Java_edu_wpi_cscore_CameraServerJNI_getProperty +JNIEXPORT jint JNICALL +Java_edu_wpi_cscore_CameraServerJNI_getProperty (JNIEnv* env, jclass, jint property) { CS_Status status = 0; @@ -273,7 +277,8 @@ JNIEXPORT jint JNICALL Java_edu_wpi_cscore_CameraServerJNI_getProperty * Method: setProperty * Signature: (II)V */ -JNIEXPORT void JNICALL Java_edu_wpi_cscore_CameraServerJNI_setProperty +JNIEXPORT void JNICALL +Java_edu_wpi_cscore_CameraServerJNI_setProperty (JNIEnv* env, jclass, jint property, jint value) { CS_Status status = 0; @@ -286,7 +291,8 @@ JNIEXPORT void JNICALL Java_edu_wpi_cscore_CameraServerJNI_setProperty * Method: getPropertyMin * Signature: (I)I */ -JNIEXPORT jint JNICALL Java_edu_wpi_cscore_CameraServerJNI_getPropertyMin +JNIEXPORT jint JNICALL +Java_edu_wpi_cscore_CameraServerJNI_getPropertyMin (JNIEnv* env, jclass, jint property) { CS_Status status = 0; @@ -300,7 +306,8 @@ JNIEXPORT jint JNICALL Java_edu_wpi_cscore_CameraServerJNI_getPropertyMin * Method: getPropertyMax * Signature: (I)I */ -JNIEXPORT jint JNICALL Java_edu_wpi_cscore_CameraServerJNI_getPropertyMax +JNIEXPORT jint JNICALL +Java_edu_wpi_cscore_CameraServerJNI_getPropertyMax (JNIEnv* env, jclass, jint property) { CS_Status status = 0; @@ -314,7 +321,8 @@ JNIEXPORT jint JNICALL Java_edu_wpi_cscore_CameraServerJNI_getPropertyMax * Method: getPropertyStep * Signature: (I)I */ -JNIEXPORT jint JNICALL Java_edu_wpi_cscore_CameraServerJNI_getPropertyStep +JNIEXPORT jint JNICALL +Java_edu_wpi_cscore_CameraServerJNI_getPropertyStep (JNIEnv* env, jclass, jint property) { CS_Status status = 0; @@ -328,7 +336,8 @@ JNIEXPORT jint JNICALL Java_edu_wpi_cscore_CameraServerJNI_getPropertyStep * Method: getPropertyDefault * Signature: (I)I */ -JNIEXPORT jint JNICALL Java_edu_wpi_cscore_CameraServerJNI_getPropertyDefault +JNIEXPORT jint JNICALL +Java_edu_wpi_cscore_CameraServerJNI_getPropertyDefault (JNIEnv* env, jclass, jint property) { CS_Status status = 0; @@ -342,7 +351,8 @@ JNIEXPORT jint JNICALL Java_edu_wpi_cscore_CameraServerJNI_getPropertyDefault * Method: getStringProperty * Signature: (I)Ljava/lang/String; */ -JNIEXPORT jstring JNICALL Java_edu_wpi_cscore_CameraServerJNI_getStringProperty +JNIEXPORT jstring JNICALL +Java_edu_wpi_cscore_CameraServerJNI_getStringProperty (JNIEnv* env, jclass, jint property) { CS_Status status = 0; @@ -357,7 +367,8 @@ JNIEXPORT jstring JNICALL Java_edu_wpi_cscore_CameraServerJNI_getStringProperty * Method: setStringProperty * Signature: (ILjava/lang/String;)V */ -JNIEXPORT void JNICALL Java_edu_wpi_cscore_CameraServerJNI_setStringProperty +JNIEXPORT void JNICALL +Java_edu_wpi_cscore_CameraServerJNI_setStringProperty (JNIEnv* env, jclass, jint property, jstring value) { if (!value) { @@ -372,9 +383,10 @@ JNIEXPORT void JNICALL Java_edu_wpi_cscore_CameraServerJNI_setStringProperty /* * Class: edu_wpi_cscore_CameraServerJNI * Method: getEnumPropertyChoices - * Signature: (I)[Ljava/lang/String; + * Signature: (I)[Ljava/lang/Object; */ -JNIEXPORT jobjectArray JNICALL Java_edu_wpi_cscore_CameraServerJNI_getEnumPropertyChoices +JNIEXPORT jobjectArray JNICALL +Java_edu_wpi_cscore_CameraServerJNI_getEnumPropertyChoices (JNIEnv* env, jclass, jint property) { CS_Status status = 0; @@ -388,7 +400,8 @@ JNIEXPORT jobjectArray JNICALL Java_edu_wpi_cscore_CameraServerJNI_getEnumProper * Method: createUsbCameraDev * Signature: (Ljava/lang/String;I)I */ -JNIEXPORT jint JNICALL Java_edu_wpi_cscore_CameraServerJNI_createUsbCameraDev +JNIEXPORT jint JNICALL +Java_edu_wpi_cscore_CameraServerJNI_createUsbCameraDev (JNIEnv* env, jclass, jstring name, jint dev) { #ifndef __linux__ @@ -411,7 +424,8 @@ JNIEXPORT jint JNICALL Java_edu_wpi_cscore_CameraServerJNI_createUsbCameraDev * Method: createUsbCameraPath * Signature: (Ljava/lang/String;Ljava/lang/String;)I */ -JNIEXPORT jint JNICALL Java_edu_wpi_cscore_CameraServerJNI_createUsbCameraPath +JNIEXPORT jint JNICALL +Java_edu_wpi_cscore_CameraServerJNI_createUsbCameraPath (JNIEnv* env, jclass, jstring name, jstring path) { #ifndef __linux__ @@ -439,7 +453,8 @@ JNIEXPORT jint JNICALL Java_edu_wpi_cscore_CameraServerJNI_createUsbCameraPath * Method: createHttpCamera * Signature: (Ljava/lang/String;Ljava/lang/String;I)I */ -JNIEXPORT jint JNICALL Java_edu_wpi_cscore_CameraServerJNI_createHttpCamera +JNIEXPORT jint JNICALL +Java_edu_wpi_cscore_CameraServerJNI_createHttpCamera (JNIEnv* env, jclass, jstring name, jstring url, jint kind) { if (!name) { @@ -461,9 +476,10 @@ JNIEXPORT jint JNICALL Java_edu_wpi_cscore_CameraServerJNI_createHttpCamera /* * Class: edu_wpi_cscore_CameraServerJNI * Method: createHttpCameraMulti - * Signature: (Ljava/lang/String;[Ljava/lang/String;I)I + * Signature: (Ljava/lang/String;[Ljava/lang/Object;I)I */ -JNIEXPORT jint JNICALL Java_edu_wpi_cscore_CameraServerJNI_createHttpCameraMulti +JNIEXPORT jint JNICALL +Java_edu_wpi_cscore_CameraServerJNI_createHttpCameraMulti (JNIEnv* env, jclass, jstring name, jobjectArray urls, jint kind) { if (!name) { @@ -499,9 +515,10 @@ JNIEXPORT jint JNICALL Java_edu_wpi_cscore_CameraServerJNI_createHttpCameraMulti * Method: createCvSource * Signature: (Ljava/lang/String;IIII)I */ -JNIEXPORT jint JNICALL Java_edu_wpi_cscore_CameraServerJNI_createCvSource - (JNIEnv* env, jclass, jstring name, jint pixelFormat, jint width, - jint height, jint fps) +JNIEXPORT jint JNICALL +Java_edu_wpi_cscore_CameraServerJNI_createCvSource + (JNIEnv* env, jclass, jstring name, jint pixelFormat, jint width, jint height, + jint fps) { if (!name) { nullPointerEx.Throw(env, "name cannot be null"); @@ -523,7 +540,8 @@ JNIEXPORT jint JNICALL Java_edu_wpi_cscore_CameraServerJNI_createCvSource * Method: getSourceKind * Signature: (I)I */ -JNIEXPORT jint JNICALL Java_edu_wpi_cscore_CameraServerJNI_getSourceKind +JNIEXPORT jint JNICALL +Java_edu_wpi_cscore_CameraServerJNI_getSourceKind (JNIEnv* env, jclass, jint source) { CS_Status status = 0; @@ -537,7 +555,8 @@ JNIEXPORT jint JNICALL Java_edu_wpi_cscore_CameraServerJNI_getSourceKind * Method: getSourceName * Signature: (I)Ljava/lang/String; */ -JNIEXPORT jstring JNICALL Java_edu_wpi_cscore_CameraServerJNI_getSourceName +JNIEXPORT jstring JNICALL +Java_edu_wpi_cscore_CameraServerJNI_getSourceName (JNIEnv* env, jclass, jint source) { CS_Status status = 0; @@ -552,7 +571,8 @@ JNIEXPORT jstring JNICALL Java_edu_wpi_cscore_CameraServerJNI_getSourceName * Method: getSourceDescription * Signature: (I)Ljava/lang/String; */ -JNIEXPORT jstring JNICALL Java_edu_wpi_cscore_CameraServerJNI_getSourceDescription +JNIEXPORT jstring JNICALL +Java_edu_wpi_cscore_CameraServerJNI_getSourceDescription (JNIEnv* env, jclass, jint source) { CS_Status status = 0; @@ -567,7 +587,8 @@ JNIEXPORT jstring JNICALL Java_edu_wpi_cscore_CameraServerJNI_getSourceDescripti * Method: getSourceLastFrameTime * Signature: (I)J */ -JNIEXPORT jlong JNICALL Java_edu_wpi_cscore_CameraServerJNI_getSourceLastFrameTime +JNIEXPORT jlong JNICALL +Java_edu_wpi_cscore_CameraServerJNI_getSourceLastFrameTime (JNIEnv* env, jclass, jint source) { CS_Status status = 0; @@ -581,7 +602,8 @@ JNIEXPORT jlong JNICALL Java_edu_wpi_cscore_CameraServerJNI_getSourceLastFrameTi * Method: isSourceConnected * Signature: (I)Z */ -JNIEXPORT jboolean JNICALL Java_edu_wpi_cscore_CameraServerJNI_isSourceConnected +JNIEXPORT jboolean JNICALL +Java_edu_wpi_cscore_CameraServerJNI_isSourceConnected (JNIEnv* env, jclass, jint source) { CS_Status status = 0; @@ -595,7 +617,8 @@ JNIEXPORT jboolean JNICALL Java_edu_wpi_cscore_CameraServerJNI_isSourceConnected * Method: getSourceProperty * Signature: (ILjava/lang/String;)I */ -JNIEXPORT jint JNICALL Java_edu_wpi_cscore_CameraServerJNI_getSourceProperty +JNIEXPORT jint JNICALL +Java_edu_wpi_cscore_CameraServerJNI_getSourceProperty (JNIEnv* env, jclass, jint source, jstring name) { if (!name) { @@ -613,7 +636,8 @@ JNIEXPORT jint JNICALL Java_edu_wpi_cscore_CameraServerJNI_getSourceProperty * Method: enumerateSourceProperties * Signature: (I)[I */ -JNIEXPORT jintArray JNICALL Java_edu_wpi_cscore_CameraServerJNI_enumerateSourceProperties +JNIEXPORT jintArray JNICALL +Java_edu_wpi_cscore_CameraServerJNI_enumerateSourceProperties (JNIEnv* env, jclass, jint source) { CS_Status status = 0; @@ -626,9 +650,10 @@ JNIEXPORT jintArray JNICALL Java_edu_wpi_cscore_CameraServerJNI_enumerateSourceP /* * Class: edu_wpi_cscore_CameraServerJNI * Method: getSourceVideoMode - * Signature: (I)Ledu/wpi/cameraserver/VideoMode; + * Signature: (I)Ljava/lang/Object; */ -JNIEXPORT jobject JNICALL Java_edu_wpi_cscore_CameraServerJNI_getSourceVideoMode +JNIEXPORT jobject JNICALL +Java_edu_wpi_cscore_CameraServerJNI_getSourceVideoMode (JNIEnv* env, jclass, jint source) { CS_Status status = 0; @@ -642,7 +667,8 @@ JNIEXPORT jobject JNICALL Java_edu_wpi_cscore_CameraServerJNI_getSourceVideoMode * Method: setSourceVideoMode * Signature: (IIIII)Z */ -JNIEXPORT jboolean JNICALL Java_edu_wpi_cscore_CameraServerJNI_setSourceVideoMode +JNIEXPORT jboolean JNICALL +Java_edu_wpi_cscore_CameraServerJNI_setSourceVideoMode (JNIEnv* env, jclass, jint source, jint pixelFormat, jint width, jint height, jint fps) { @@ -661,7 +687,8 @@ JNIEXPORT jboolean JNICALL Java_edu_wpi_cscore_CameraServerJNI_setSourceVideoMod * Method: setSourcePixelFormat * Signature: (II)Z */ -JNIEXPORT jboolean JNICALL Java_edu_wpi_cscore_CameraServerJNI_setSourcePixelFormat +JNIEXPORT jboolean JNICALL +Java_edu_wpi_cscore_CameraServerJNI_setSourcePixelFormat (JNIEnv* env, jclass, jint source, jint pixelFormat) { CS_Status status = 0; @@ -676,7 +703,8 @@ JNIEXPORT jboolean JNICALL Java_edu_wpi_cscore_CameraServerJNI_setSourcePixelFor * Method: setSourceResolution * Signature: (III)Z */ -JNIEXPORT jboolean JNICALL Java_edu_wpi_cscore_CameraServerJNI_setSourceResolution +JNIEXPORT jboolean JNICALL +Java_edu_wpi_cscore_CameraServerJNI_setSourceResolution (JNIEnv* env, jclass, jint source, jint width, jint height) { CS_Status status = 0; @@ -690,7 +718,8 @@ JNIEXPORT jboolean JNICALL Java_edu_wpi_cscore_CameraServerJNI_setSourceResoluti * Method: setSourceFPS * Signature: (II)Z */ -JNIEXPORT jboolean JNICALL Java_edu_wpi_cscore_CameraServerJNI_setSourceFPS +JNIEXPORT jboolean JNICALL +Java_edu_wpi_cscore_CameraServerJNI_setSourceFPS (JNIEnv* env, jclass, jint source, jint fps) { CS_Status status = 0; @@ -702,9 +731,10 @@ JNIEXPORT jboolean JNICALL Java_edu_wpi_cscore_CameraServerJNI_setSourceFPS /* * Class: edu_wpi_cscore_CameraServerJNI * Method: enumerateSourceVideoModes - * Signature: (I)[Ledu/wpi/cameraserver/VideoMode; + * Signature: (I)[Ljava/lang/Object; */ -JNIEXPORT jobjectArray JNICALL Java_edu_wpi_cscore_CameraServerJNI_enumerateSourceVideoModes +JNIEXPORT jobjectArray JNICALL +Java_edu_wpi_cscore_CameraServerJNI_enumerateSourceVideoModes (JNIEnv* env, jclass, jint source) { CS_Status status = 0; @@ -724,7 +754,8 @@ JNIEXPORT jobjectArray JNICALL Java_edu_wpi_cscore_CameraServerJNI_enumerateSour * Method: enumerateSourceSinks * Signature: (I)[I */ -JNIEXPORT jintArray JNICALL Java_edu_wpi_cscore_CameraServerJNI_enumerateSourceSinks +JNIEXPORT jintArray JNICALL +Java_edu_wpi_cscore_CameraServerJNI_enumerateSourceSinks (JNIEnv* env, jclass, jint source) { CS_Status status = 0; @@ -739,7 +770,8 @@ JNIEXPORT jintArray JNICALL Java_edu_wpi_cscore_CameraServerJNI_enumerateSourceS * Method: copySource * Signature: (I)I */ -JNIEXPORT jint JNICALL Java_edu_wpi_cscore_CameraServerJNI_copySource +JNIEXPORT jint JNICALL +Java_edu_wpi_cscore_CameraServerJNI_copySource (JNIEnv* env, jclass, jint source) { CS_Status status = 0; @@ -753,7 +785,8 @@ JNIEXPORT jint JNICALL Java_edu_wpi_cscore_CameraServerJNI_copySource * Method: releaseSource * Signature: (I)V */ -JNIEXPORT void JNICALL Java_edu_wpi_cscore_CameraServerJNI_releaseSource +JNIEXPORT void JNICALL +Java_edu_wpi_cscore_CameraServerJNI_releaseSource (JNIEnv* env, jclass, jint source) { CS_Status status = 0; @@ -766,7 +799,8 @@ JNIEXPORT void JNICALL Java_edu_wpi_cscore_CameraServerJNI_releaseSource * Method: setCameraBrightness * Signature: (II)V */ -JNIEXPORT void JNICALL Java_edu_wpi_cscore_CameraServerJNI_setCameraBrightness +JNIEXPORT void JNICALL +Java_edu_wpi_cscore_CameraServerJNI_setCameraBrightness (JNIEnv* env, jclass, jint source, jint brightness) { CS_Status status = 0; @@ -779,7 +813,8 @@ JNIEXPORT void JNICALL Java_edu_wpi_cscore_CameraServerJNI_setCameraBrightness * Method: getCameraBrightness * Signature: (I)I */ -JNIEXPORT jint JNICALL Java_edu_wpi_cscore_CameraServerJNI_getCameraBrightness +JNIEXPORT jint JNICALL +Java_edu_wpi_cscore_CameraServerJNI_getCameraBrightness (JNIEnv* env, jclass, jint source) { CS_Status status = 0; @@ -793,7 +828,8 @@ JNIEXPORT jint JNICALL Java_edu_wpi_cscore_CameraServerJNI_getCameraBrightness * Method: setCameraWhiteBalanceAuto * Signature: (I)V */ -JNIEXPORT void JNICALL Java_edu_wpi_cscore_CameraServerJNI_setCameraWhiteBalanceAuto +JNIEXPORT void JNICALL +Java_edu_wpi_cscore_CameraServerJNI_setCameraWhiteBalanceAuto (JNIEnv* env, jclass, jint source) { CS_Status status = 0; @@ -806,7 +842,8 @@ JNIEXPORT void JNICALL Java_edu_wpi_cscore_CameraServerJNI_setCameraWhiteBalance * Method: setCameraWhiteBalanceHoldCurrent * Signature: (I)V */ -JNIEXPORT void JNICALL Java_edu_wpi_cscore_CameraServerJNI_setCameraWhiteBalanceHoldCurrent +JNIEXPORT void JNICALL +Java_edu_wpi_cscore_CameraServerJNI_setCameraWhiteBalanceHoldCurrent (JNIEnv* env, jclass, jint source) { CS_Status status = 0; @@ -819,7 +856,8 @@ JNIEXPORT void JNICALL Java_edu_wpi_cscore_CameraServerJNI_setCameraWhiteBalance * Method: setCameraWhiteBalanceManual * Signature: (II)V */ -JNIEXPORT void JNICALL Java_edu_wpi_cscore_CameraServerJNI_setCameraWhiteBalanceManual +JNIEXPORT void JNICALL +Java_edu_wpi_cscore_CameraServerJNI_setCameraWhiteBalanceManual (JNIEnv* env, jclass, jint source, jint value) { CS_Status status = 0; @@ -832,7 +870,8 @@ JNIEXPORT void JNICALL Java_edu_wpi_cscore_CameraServerJNI_setCameraWhiteBalance * Method: setCameraExposureAuto * Signature: (I)V */ -JNIEXPORT void JNICALL Java_edu_wpi_cscore_CameraServerJNI_setCameraExposureAuto +JNIEXPORT void JNICALL +Java_edu_wpi_cscore_CameraServerJNI_setCameraExposureAuto (JNIEnv* env, jclass, jint source) { CS_Status status = 0; @@ -845,7 +884,8 @@ JNIEXPORT void JNICALL Java_edu_wpi_cscore_CameraServerJNI_setCameraExposureAuto * Method: setCameraExposureHoldCurrent * Signature: (I)V */ -JNIEXPORT void JNICALL Java_edu_wpi_cscore_CameraServerJNI_setCameraExposureHoldCurrent +JNIEXPORT void JNICALL +Java_edu_wpi_cscore_CameraServerJNI_setCameraExposureHoldCurrent (JNIEnv* env, jclass, jint source) { CS_Status status = 0; @@ -858,7 +898,8 @@ JNIEXPORT void JNICALL Java_edu_wpi_cscore_CameraServerJNI_setCameraExposureHold * Method: setCameraExposureManual * Signature: (II)V */ -JNIEXPORT void JNICALL Java_edu_wpi_cscore_CameraServerJNI_setCameraExposureManual +JNIEXPORT void JNICALL +Java_edu_wpi_cscore_CameraServerJNI_setCameraExposureManual (JNIEnv* env, jclass, jint source, jint value) { CS_Status status = 0; @@ -871,7 +912,8 @@ JNIEXPORT void JNICALL Java_edu_wpi_cscore_CameraServerJNI_setCameraExposureManu * Method: getUsbCameraPath * Signature: (I)Ljava/lang/String; */ -JNIEXPORT jstring JNICALL Java_edu_wpi_cscore_CameraServerJNI_getUsbCameraPath +JNIEXPORT jstring JNICALL +Java_edu_wpi_cscore_CameraServerJNI_getUsbCameraPath (JNIEnv* env, jclass, jint source) { #ifndef __linux__ @@ -890,7 +932,8 @@ JNIEXPORT jstring JNICALL Java_edu_wpi_cscore_CameraServerJNI_getUsbCameraPath * Method: getHttpCameraKind * Signature: (I)I */ -JNIEXPORT jint JNICALL Java_edu_wpi_cscore_CameraServerJNI_getHttpCameraKind +JNIEXPORT jint JNICALL +Java_edu_wpi_cscore_CameraServerJNI_getHttpCameraKind (JNIEnv* env, jclass, jint source) { CS_Status status = 0; @@ -902,9 +945,10 @@ JNIEXPORT jint JNICALL Java_edu_wpi_cscore_CameraServerJNI_getHttpCameraKind /* * Class: edu_wpi_cscore_CameraServerJNI * Method: setHttpCameraUrls - * Signature: (I[Ljava/lang/String;)V + * Signature: (I[Ljava/lang/Object;)V */ -JNIEXPORT void JNICALL Java_edu_wpi_cscore_CameraServerJNI_setHttpCameraUrls +JNIEXPORT void JNICALL +Java_edu_wpi_cscore_CameraServerJNI_setHttpCameraUrls (JNIEnv* env, jclass, jint source, jobjectArray urls) { if (!urls) { @@ -931,9 +975,10 @@ JNIEXPORT void JNICALL Java_edu_wpi_cscore_CameraServerJNI_setHttpCameraUrls /* * Class: edu_wpi_cscore_CameraServerJNI * Method: getHttpCameraUrls - * Signature: (I)[Ljava/lang/String; + * Signature: (I)[Ljava/lang/Object; */ -JNIEXPORT jobjectArray JNICALL Java_edu_wpi_cscore_CameraServerJNI_getHttpCameraUrls +JNIEXPORT jobjectArray JNICALL +Java_edu_wpi_cscore_CameraServerJNI_getHttpCameraUrls (JNIEnv* env, jclass, jint source) { CS_Status status = 0; @@ -947,7 +992,8 @@ JNIEXPORT jobjectArray JNICALL Java_edu_wpi_cscore_CameraServerJNI_getHttpCamera * Method: putSourceFrame * Signature: (IJ)V */ -JNIEXPORT void JNICALL Java_edu_wpi_cscore_CameraServerJNI_putSourceFrame +JNIEXPORT void JNICALL +Java_edu_wpi_cscore_CameraServerJNI_putSourceFrame (JNIEnv* env, jclass, jint source, jlong imageNativeObj) { cv::Mat& image = *((cv::Mat*)imageNativeObj); @@ -961,7 +1007,8 @@ JNIEXPORT void JNICALL Java_edu_wpi_cscore_CameraServerJNI_putSourceFrame * Method: notifySourceError * Signature: (ILjava/lang/String;)V */ -JNIEXPORT void JNICALL Java_edu_wpi_cscore_CameraServerJNI_notifySourceError +JNIEXPORT void JNICALL +Java_edu_wpi_cscore_CameraServerJNI_notifySourceError (JNIEnv* env, jclass, jint source, jstring msg) { if (!msg) { @@ -978,7 +1025,8 @@ JNIEXPORT void JNICALL Java_edu_wpi_cscore_CameraServerJNI_notifySourceError * Method: setSourceConnected * Signature: (IZ)V */ -JNIEXPORT void JNICALL Java_edu_wpi_cscore_CameraServerJNI_setSourceConnected +JNIEXPORT void JNICALL +Java_edu_wpi_cscore_CameraServerJNI_setSourceConnected (JNIEnv* env, jclass, jint source, jboolean connected) { CS_Status status = 0; @@ -991,7 +1039,8 @@ JNIEXPORT void JNICALL Java_edu_wpi_cscore_CameraServerJNI_setSourceConnected * Method: setSourceDescription * Signature: (ILjava/lang/String;)V */ -JNIEXPORT void JNICALL Java_edu_wpi_cscore_CameraServerJNI_setSourceDescription +JNIEXPORT void JNICALL +Java_edu_wpi_cscore_CameraServerJNI_setSourceDescription (JNIEnv* env, jclass, jint source, jstring description) { if (!description) { @@ -1008,7 +1057,8 @@ JNIEXPORT void JNICALL Java_edu_wpi_cscore_CameraServerJNI_setSourceDescription * Method: createSourceProperty * Signature: (ILjava/lang/String;IIIIII)I */ -JNIEXPORT jint JNICALL Java_edu_wpi_cscore_CameraServerJNI_createSourceProperty +JNIEXPORT jint JNICALL +Java_edu_wpi_cscore_CameraServerJNI_createSourceProperty (JNIEnv* env, jclass, jint source, jstring name, jint kind, jint minimum, jint maximum, jint step, jint defaultValue, jint value) { @@ -1023,9 +1073,10 @@ JNIEXPORT jint JNICALL Java_edu_wpi_cscore_CameraServerJNI_createSourceProperty /* * Class: edu_wpi_cscore_CameraServerJNI * Method: setSourceEnumPropertyChoices - * Signature: (II[Ljava/lang/String;)V + * Signature: (II[Ljava/lang/Object;)V */ -JNIEXPORT void JNICALL Java_edu_wpi_cscore_CameraServerJNI_setSourceEnumPropertyChoices +JNIEXPORT void JNICALL +Java_edu_wpi_cscore_CameraServerJNI_setSourceEnumPropertyChoices (JNIEnv* env, jclass, jint source, jint property, jobjectArray choices) { if (!choices) { @@ -1054,7 +1105,8 @@ JNIEXPORT void JNICALL Java_edu_wpi_cscore_CameraServerJNI_setSourceEnumProperty * Method: createMjpegServer * Signature: (Ljava/lang/String;Ljava/lang/String;I)I */ -JNIEXPORT jint JNICALL Java_edu_wpi_cscore_CameraServerJNI_createMjpegServer +JNIEXPORT jint JNICALL +Java_edu_wpi_cscore_CameraServerJNI_createMjpegServer (JNIEnv* env, jclass, jstring name, jstring listenAddress, jint port) { if (!name) { @@ -1077,7 +1129,8 @@ JNIEXPORT jint JNICALL Java_edu_wpi_cscore_CameraServerJNI_createMjpegServer * Method: createCvSink * Signature: (Ljava/lang/String;)I */ -JNIEXPORT jint JNICALL Java_edu_wpi_cscore_CameraServerJNI_createCvSink +JNIEXPORT jint JNICALL +Java_edu_wpi_cscore_CameraServerJNI_createCvSink (JNIEnv* env, jclass, jstring name) { if (!name) { @@ -1095,7 +1148,8 @@ JNIEXPORT jint JNICALL Java_edu_wpi_cscore_CameraServerJNI_createCvSink * Method: getSinkKind * Signature: (I)I */ -JNIEXPORT jint JNICALL Java_edu_wpi_cscore_CameraServerJNI_getSinkKind +JNIEXPORT jint JNICALL +Java_edu_wpi_cscore_CameraServerJNI_getSinkKind (JNIEnv* env, jclass, jint sink) { CS_Status status = 0; @@ -1109,7 +1163,8 @@ JNIEXPORT jint JNICALL Java_edu_wpi_cscore_CameraServerJNI_getSinkKind * Method: getSinkName * Signature: (I)Ljava/lang/String; */ -JNIEXPORT jstring JNICALL Java_edu_wpi_cscore_CameraServerJNI_getSinkName +JNIEXPORT jstring JNICALL +Java_edu_wpi_cscore_CameraServerJNI_getSinkName (JNIEnv* env, jclass, jint sink) { CS_Status status = 0; @@ -1124,7 +1179,8 @@ JNIEXPORT jstring JNICALL Java_edu_wpi_cscore_CameraServerJNI_getSinkName * Method: getSinkDescription * Signature: (I)Ljava/lang/String; */ -JNIEXPORT jstring JNICALL Java_edu_wpi_cscore_CameraServerJNI_getSinkDescription +JNIEXPORT jstring JNICALL +Java_edu_wpi_cscore_CameraServerJNI_getSinkDescription (JNIEnv* env, jclass, jint sink) { CS_Status status = 0; @@ -1139,7 +1195,8 @@ JNIEXPORT jstring JNICALL Java_edu_wpi_cscore_CameraServerJNI_getSinkDescription * Method: setSinkSource * Signature: (II)V */ -JNIEXPORT void JNICALL Java_edu_wpi_cscore_CameraServerJNI_setSinkSource +JNIEXPORT void JNICALL +Java_edu_wpi_cscore_CameraServerJNI_setSinkSource (JNIEnv* env, jclass, jint sink, jint source) { CS_Status status = 0; @@ -1152,7 +1209,8 @@ JNIEXPORT void JNICALL Java_edu_wpi_cscore_CameraServerJNI_setSinkSource * Method: getSinkSourceProperty * Signature: (ILjava/lang/String;)I */ -JNIEXPORT jint JNICALL Java_edu_wpi_cscore_CameraServerJNI_getSinkSourceProperty +JNIEXPORT jint JNICALL +Java_edu_wpi_cscore_CameraServerJNI_getSinkSourceProperty (JNIEnv* env, jclass, jint sink, jstring name) { if (!name) { @@ -1170,7 +1228,8 @@ JNIEXPORT jint JNICALL Java_edu_wpi_cscore_CameraServerJNI_getSinkSourceProperty * Method: getSinkSource * Signature: (I)I */ -JNIEXPORT jint JNICALL Java_edu_wpi_cscore_CameraServerJNI_getSinkSource +JNIEXPORT jint JNICALL +Java_edu_wpi_cscore_CameraServerJNI_getSinkSource (JNIEnv* env, jclass, jint sink) { CS_Status status = 0; @@ -1184,7 +1243,8 @@ JNIEXPORT jint JNICALL Java_edu_wpi_cscore_CameraServerJNI_getSinkSource * Method: copySink * Signature: (I)I */ -JNIEXPORT jint JNICALL Java_edu_wpi_cscore_CameraServerJNI_copySink +JNIEXPORT jint JNICALL +Java_edu_wpi_cscore_CameraServerJNI_copySink (JNIEnv* env, jclass, jint sink) { CS_Status status = 0; @@ -1198,7 +1258,8 @@ JNIEXPORT jint JNICALL Java_edu_wpi_cscore_CameraServerJNI_copySink * Method: releaseSink * Signature: (I)V */ -JNIEXPORT void JNICALL Java_edu_wpi_cscore_CameraServerJNI_releaseSink +JNIEXPORT void JNICALL +Java_edu_wpi_cscore_CameraServerJNI_releaseSink (JNIEnv* env, jclass, jint sink) { CS_Status status = 0; @@ -1211,7 +1272,8 @@ JNIEXPORT void JNICALL Java_edu_wpi_cscore_CameraServerJNI_releaseSink * Method: getMjpegServerListenAddress * Signature: (I)Ljava/lang/String; */ -JNIEXPORT jstring JNICALL Java_edu_wpi_cscore_CameraServerJNI_getMjpegServerListenAddress +JNIEXPORT jstring JNICALL +Java_edu_wpi_cscore_CameraServerJNI_getMjpegServerListenAddress (JNIEnv* env, jclass, jint sink) { CS_Status status = 0; @@ -1225,7 +1287,8 @@ JNIEXPORT jstring JNICALL Java_edu_wpi_cscore_CameraServerJNI_getMjpegServerList * Method: getMjpegServerPort * Signature: (I)I */ -JNIEXPORT jint JNICALL Java_edu_wpi_cscore_CameraServerJNI_getMjpegServerPort +JNIEXPORT jint JNICALL +Java_edu_wpi_cscore_CameraServerJNI_getMjpegServerPort (JNIEnv* env, jclass, jint sink) { CS_Status status = 0; @@ -1239,7 +1302,8 @@ JNIEXPORT jint JNICALL Java_edu_wpi_cscore_CameraServerJNI_getMjpegServerPort * Method: setSinkDescription * Signature: (ILjava/lang/String;)V */ -JNIEXPORT void JNICALL Java_edu_wpi_cscore_CameraServerJNI_setSinkDescription +JNIEXPORT void JNICALL +Java_edu_wpi_cscore_CameraServerJNI_setSinkDescription (JNIEnv* env, jclass, jint sink, jstring description) { if (!description) { @@ -1256,7 +1320,8 @@ JNIEXPORT void JNICALL Java_edu_wpi_cscore_CameraServerJNI_setSinkDescription * Method: grabSinkFrame * Signature: (IJ)J */ -JNIEXPORT jlong JNICALL Java_edu_wpi_cscore_CameraServerJNI_grabSinkFrame +JNIEXPORT jlong JNICALL +Java_edu_wpi_cscore_CameraServerJNI_grabSinkFrame (JNIEnv* env, jclass, jint sink, jlong imageNativeObj) { cv::Mat& image = *((cv::Mat*)imageNativeObj); @@ -1271,7 +1336,8 @@ JNIEXPORT jlong JNICALL Java_edu_wpi_cscore_CameraServerJNI_grabSinkFrame * Method: grabSinkFrameTimeout * Signature: (IJD)J */ -JNIEXPORT jlong JNICALL Java_edu_wpi_cscore_CameraServerJNI_grabSinkFrameTimeout +JNIEXPORT jlong JNICALL +Java_edu_wpi_cscore_CameraServerJNI_grabSinkFrameTimeout (JNIEnv* env, jclass, jint sink, jlong imageNativeObj, jdouble timeout) { cv::Mat& image = *((cv::Mat*)imageNativeObj); @@ -1286,7 +1352,8 @@ JNIEXPORT jlong JNICALL Java_edu_wpi_cscore_CameraServerJNI_grabSinkFrameTimeout * Method: getSinkError * Signature: (I)Ljava/lang/String; */ -JNIEXPORT jstring JNICALL Java_edu_wpi_cscore_CameraServerJNI_getSinkError +JNIEXPORT jstring JNICALL +Java_edu_wpi_cscore_CameraServerJNI_getSinkError (JNIEnv* env, jclass, jint sink) { CS_Status status = 0; @@ -1301,7 +1368,8 @@ JNIEXPORT jstring JNICALL Java_edu_wpi_cscore_CameraServerJNI_getSinkError * Method: setSinkEnabled * Signature: (IZ)V */ -JNIEXPORT void JNICALL Java_edu_wpi_cscore_CameraServerJNI_setSinkEnabled +JNIEXPORT void JNICALL +Java_edu_wpi_cscore_CameraServerJNI_setSinkEnabled (JNIEnv* env, jclass, jint sink, jboolean enabled) { CS_Status status = 0; @@ -1312,9 +1380,10 @@ JNIEXPORT void JNICALL Java_edu_wpi_cscore_CameraServerJNI_setSinkEnabled /* * Class: edu_wpi_cscore_CameraServerJNI * Method: addListener - * Signature: (Ljava/util/function/Consumer;IZ)I + * Signature: (Ljava/lang/Object;IZ)I */ -JNIEXPORT jint JNICALL Java_edu_wpi_cscore_CameraServerJNI_addListener +JNIEXPORT jint JNICALL +Java_edu_wpi_cscore_CameraServerJNI_addListener (JNIEnv* envouter, jclass, jobject listener, jint eventMask, jboolean immediateNotify) { @@ -1324,7 +1393,8 @@ JNIEXPORT jint JNICALL Java_edu_wpi_cscore_CameraServerJNI_addListener } // the shared pointer to the weak global will keep it around until the // entry listener is destroyed - auto listener_global = std::make_shared>(envouter, listener); + auto listener_global = + std::make_shared>(envouter, listener); // cls is a temporary here; cannot be used within callback functor jclass cls = envouter->GetObjectClass(listener); @@ -1368,7 +1438,8 @@ JNIEXPORT jint JNICALL Java_edu_wpi_cscore_CameraServerJNI_addListener * Method: removeListener * Signature: (I)V */ -JNIEXPORT void JNICALL Java_edu_wpi_cscore_CameraServerJNI_removeListener +JNIEXPORT void JNICALL +Java_edu_wpi_cscore_CameraServerJNI_removeListener (JNIEnv* env, jclass, jint handle) { CS_Status status = 0; @@ -1381,7 +1452,8 @@ JNIEXPORT void JNICALL Java_edu_wpi_cscore_CameraServerJNI_removeListener * Method: setTelemetryPeriod * Signature: (D)V */ -JNIEXPORT void JNICALL Java_edu_wpi_cscore_CameraServerJNI_setTelemetryPeriod +JNIEXPORT void JNICALL +Java_edu_wpi_cscore_CameraServerJNI_setTelemetryPeriod (JNIEnv* env, jclass, jdouble seconds) { cs::SetTelemetryPeriod(seconds); @@ -1392,7 +1464,8 @@ JNIEXPORT void JNICALL Java_edu_wpi_cscore_CameraServerJNI_setTelemetryPeriod * Method: getTelemetryElapsedTime * Signature: ()D */ -JNIEXPORT jdouble JNICALL Java_edu_wpi_cscore_CameraServerJNI_getTelemetryElapsedTime +JNIEXPORT jdouble JNICALL +Java_edu_wpi_cscore_CameraServerJNI_getTelemetryElapsedTime (JNIEnv* env, jclass) { return cs::GetTelemetryElapsedTime(); @@ -1403,7 +1476,8 @@ JNIEXPORT jdouble JNICALL Java_edu_wpi_cscore_CameraServerJNI_getTelemetryElapse * Method: getTelemetryValue * Signature: (II)J */ -JNIEXPORT jlong JNICALL Java_edu_wpi_cscore_CameraServerJNI_getTelemetryValue +JNIEXPORT jlong JNICALL +Java_edu_wpi_cscore_CameraServerJNI_getTelemetryValue (JNIEnv* env, jclass, jint handle, jint kind) { CS_Status status = 0; @@ -1418,13 +1492,13 @@ JNIEXPORT jlong JNICALL Java_edu_wpi_cscore_CameraServerJNI_getTelemetryValue * Method: getTelemetryAverageValue * Signature: (II)D */ -JNIEXPORT jdouble JNICALL Java_edu_wpi_cscore_CameraServerJNI_getTelemetryAverageValue +JNIEXPORT jdouble JNICALL +Java_edu_wpi_cscore_CameraServerJNI_getTelemetryAverageValue (JNIEnv* env, jclass, jint handle, jint kind) { CS_Status status = 0; - auto val = cs::GetTelemetryAverageValue(handle, - static_cast(kind), - &status); + auto val = cs::GetTelemetryAverageValue( + handle, static_cast(kind), &status); CheckStatus(env, status); return val; } @@ -1432,9 +1506,10 @@ JNIEXPORT jdouble JNICALL Java_edu_wpi_cscore_CameraServerJNI_getTelemetryAverag /* * Class: edu_wpi_cscore_CameraServerJNI * Method: enumerateUsbCameras - * Signature: ()[Ledu/wpi/cameraserver/UsbCameraInfo; + * Signature: ()[Ljava/lang/Object; */ -JNIEXPORT jobjectArray JNICALL Java_edu_wpi_cscore_CameraServerJNI_enumerateUsbCameras +JNIEXPORT jobjectArray JNICALL +Java_edu_wpi_cscore_CameraServerJNI_enumerateUsbCameras (JNIEnv* env, jclass) { #ifndef __linux__ @@ -1460,7 +1535,8 @@ JNIEXPORT jobjectArray JNICALL Java_edu_wpi_cscore_CameraServerJNI_enumerateUsbC * Method: enumerateSources * Signature: ()[I */ -JNIEXPORT jintArray JNICALL Java_edu_wpi_cscore_CameraServerJNI_enumerateSources +JNIEXPORT jintArray JNICALL +Java_edu_wpi_cscore_CameraServerJNI_enumerateSources (JNIEnv* env, jclass) { CS_Status status = 0; @@ -1475,7 +1551,8 @@ JNIEXPORT jintArray JNICALL Java_edu_wpi_cscore_CameraServerJNI_enumerateSources * Method: enumerateSinks * Signature: ()[I */ -JNIEXPORT jintArray JNICALL Java_edu_wpi_cscore_CameraServerJNI_enumerateSinks +JNIEXPORT jintArray JNICALL +Java_edu_wpi_cscore_CameraServerJNI_enumerateSinks (JNIEnv* env, jclass) { CS_Status status = 0; @@ -1490,7 +1567,8 @@ JNIEXPORT jintArray JNICALL Java_edu_wpi_cscore_CameraServerJNI_enumerateSinks * Method: getHostname * Signature: ()Ljava/lang/String; */ -JNIEXPORT jstring JNICALL Java_edu_wpi_cscore_CameraServerJNI_getHostname +JNIEXPORT jstring JNICALL +Java_edu_wpi_cscore_CameraServerJNI_getHostname (JNIEnv* env, jclass) { return MakeJString(env, cs::GetHostname()); @@ -1499,9 +1577,10 @@ JNIEXPORT jstring JNICALL Java_edu_wpi_cscore_CameraServerJNI_getHostname /* * Class: edu_wpi_cscore_CameraServerJNI * Method: getNetworkInterfaces - * Signature: ()[Ljava/lang/String; + * Signature: ()[Ljava/lang/Object; */ -JNIEXPORT jobjectArray JNICALL Java_edu_wpi_cscore_CameraServerJNI_getNetworkInterfaces +JNIEXPORT jobjectArray JNICALL +Java_edu_wpi_cscore_CameraServerJNI_getNetworkInterfaces (JNIEnv* env, jclass) { return MakeJStringArray(env, cs::GetNetworkInterfaces()); @@ -1536,16 +1615,17 @@ struct LogMessage { typedef JSingletonCallbackManager LoggerJNI; -} // anonymous namespace +} // namespace extern "C" { /* * Class: edu_wpi_cscore_CameraServerJNI * Method: setLogger - * Signature: (Ledu/wpi/cscore/CameraServerJNI/LoggerFunction;I)V + * Signature: (Ljava/lang/Object;I)V */ -JNIEXPORT void JNICALL Java_edu_wpi_cscore_CameraServerJNI_setLogger +JNIEXPORT void JNICALL +Java_edu_wpi_cscore_CameraServerJNI_setLogger (JNIEnv* env, jclass, jobject func, jint minLevel) { if (!func) { diff --git a/cscore/src/main/native/include/cscore_cpp.h b/cscore/src/main/native/include/cscore_cpp.h index 5cba871b6f..7aea1a744b 100644 --- a/cscore/src/main/native/include/cscore_cpp.h +++ b/cscore/src/main/native/include/cscore_cpp.h @@ -164,8 +164,7 @@ CS_Source CreateUsbCameraPath(wpi::StringRef name, wpi::StringRef path, CS_Status* status); CS_Source CreateHttpCamera(wpi::StringRef name, wpi::StringRef url, CS_HttpCameraKind kind, CS_Status* status); -CS_Source CreateHttpCamera(wpi::StringRef name, - wpi::ArrayRef urls, +CS_Source CreateHttpCamera(wpi::StringRef name, wpi::ArrayRef urls, CS_HttpCameraKind kind, CS_Status* status); CS_Source CreateCvSource(wpi::StringRef name, const VideoMode& mode, CS_Status* status); @@ -175,8 +174,7 @@ CS_Source CreateCvSource(wpi::StringRef name, const VideoMode& mode, // CS_SourceKind GetSourceKind(CS_Source source, CS_Status* status); std::string GetSourceName(CS_Source source, CS_Status* status); -wpi::StringRef GetSourceName(CS_Source source, - wpi::SmallVectorImpl& buf, +wpi::StringRef GetSourceName(CS_Source source, wpi::SmallVectorImpl& buf, CS_Status* status); std::string GetSourceDescription(CS_Source source, CS_Status* status); wpi::StringRef GetSourceDescription(CS_Source source, @@ -199,8 +197,9 @@ bool SetSourceResolution(CS_Source source, int width, int height, bool SetSourceFPS(CS_Source source, int fps, CS_Status* status); std::vector EnumerateSourceVideoModes(CS_Source source, CS_Status* status); -wpi::ArrayRef EnumerateSourceSinks( - CS_Source source, wpi::SmallVectorImpl& vec, CS_Status* status); +wpi::ArrayRef EnumerateSourceSinks(CS_Source source, + wpi::SmallVectorImpl& vec, + CS_Status* status); CS_Source CopySource(CS_Source source, CS_Status* status); void ReleaseSource(CS_Source source, CS_Status* status); @@ -234,8 +233,7 @@ std::vector GetHttpCameraUrls(CS_Source source, CS_Status* status); // OpenCV Source Functions // void PutSourceFrame(CS_Source source, cv::Mat& image, CS_Status* status); -void NotifySourceError(CS_Source source, wpi::StringRef msg, - CS_Status* status); +void NotifySourceError(CS_Source source, wpi::StringRef msg, CS_Status* status); void SetSourceConnected(CS_Source source, bool connected, CS_Status* status); void SetSourceDescription(CS_Source source, wpi::StringRef description, CS_Status* status); @@ -265,8 +263,7 @@ std::string GetSinkName(CS_Sink sink, CS_Status* status); wpi::StringRef GetSinkName(CS_Sink sink, wpi::SmallVectorImpl& buf, CS_Status* status); std::string GetSinkDescription(CS_Sink sink, CS_Status* status); -wpi::StringRef GetSinkDescription(CS_Sink sink, - wpi::SmallVectorImpl& buf, +wpi::StringRef GetSinkDescription(CS_Sink sink, wpi::SmallVectorImpl& buf, CS_Status* status); void SetSinkSource(CS_Sink sink, CS_Source source, CS_Status* status); CS_Property GetSinkSourceProperty(CS_Sink sink, wpi::StringRef name, @@ -333,8 +330,8 @@ std::vector EnumerateUsbCameras(CS_Status* status); wpi::ArrayRef EnumerateSourceHandles( wpi::SmallVectorImpl& vec, CS_Status* status); -wpi::ArrayRef EnumerateSinkHandles( - wpi::SmallVectorImpl& vec, CS_Status* status); +wpi::ArrayRef EnumerateSinkHandles(wpi::SmallVectorImpl& vec, + CS_Status* status); std::string GetHostname(); diff --git a/cscore/src/main/native/include/cscore_oo.h b/cscore/src/main/native/include/cscore_oo.h index 34858f6ccd..65ea7f0d8b 100644 --- a/cscore/src/main/native/include/cscore_oo.h +++ b/cscore/src/main/native/include/cscore_oo.h @@ -448,8 +448,7 @@ class CvSource : public VideoSource { /// @param defaultValue Default value /// @param value Current value /// @return Property - VideoProperty CreateStringProperty(wpi::StringRef name, - wpi::StringRef value); + VideoProperty CreateStringProperty(wpi::StringRef name, wpi::StringRef value); /// Configure enum property choices. /// @param property Property diff --git a/hal/.styleguide b/hal/.styleguide index 1f79392205..3a0be47533 100644 --- a/hal/.styleguide +++ b/hal/.styleguide @@ -9,9 +9,6 @@ cppSrcFileInclude { } generatedFileExclude { - gtest/ - ni-libraries/include/ - ni-libraries/lib/ hal/src/main/native/athena/ctre/ hal/src/main/native/athena/frccansae/ hal/src/main/native/athena/visa/ @@ -20,13 +17,16 @@ generatedFileExclude { } modifiableFileExclude { - src/main/native/cpp/jni/ \.patch$ \.png$ \.py$ \.so$ } +repoRootNameOverride { + hal +} + includeOtherLibs { ^FRC_FPGA_ChipObject/ ^FRC_NetworkCommunication/ @@ -35,6 +35,7 @@ includeOtherLibs { ^opencv2/ ^spilib/ ^support/ + ^wpi/ } includeProject { diff --git a/hal/src/main/native/athena/DIO.cpp b/hal/src/main/native/athena/DIO.cpp index 732f7f985d..cf5fb060c7 100644 --- a/hal/src/main/native/athena/DIO.cpp +++ b/hal/src/main/native/athena/DIO.cpp @@ -7,11 +7,11 @@ #include "HAL/DIO.h" -#include - #include #include +#include + #include "DigitalInternal.h" #include "HAL/cpp/fpga_clock.h" #include "HAL/handles/HandlesInternal.h" diff --git a/hal/src/main/native/athena/PWM.cpp b/hal/src/main/native/athena/PWM.cpp index 175fff3a3c..b8b11a9842 100644 --- a/hal/src/main/native/athena/PWM.cpp +++ b/hal/src/main/native/athena/PWM.cpp @@ -7,11 +7,11 @@ #include "HAL/PWM.h" -#include - #include #include +#include + #include "ConstantsInternal.h" #include "DigitalInternal.h" #include "HAL/cpp/fpga_clock.h" diff --git a/hal/src/main/native/athena/SPI.cpp b/hal/src/main/native/athena/SPI.cpp index c3b1575cf0..a245c41174 100644 --- a/hal/src/main/native/athena/SPI.cpp +++ b/hal/src/main/native/athena/SPI.cpp @@ -16,8 +16,8 @@ #include #include -#include #include +#include #include "DigitalInternal.h" #include "HAL/DIO.h" diff --git a/hal/src/main/native/athena/cpp/SerialHelper.cpp b/hal/src/main/native/athena/cpp/SerialHelper.cpp index b6cffd04bb..b4acbf82da 100644 --- a/hal/src/main/native/athena/cpp/SerialHelper.cpp +++ b/hal/src/main/native/athena/cpp/SerialHelper.cpp @@ -151,7 +151,7 @@ void SerialHelper::CoiteratedSort( for (auto& str : m_sortedHubPath) { for (size_t i = 0; i < m_unsortedHubPath.size(); i++) { if (wpi::StringRef{m_unsortedHubPath[i].begin(), - m_unsortedHubPath[i].size()} + m_unsortedHubPath[i].size()} .equals(wpi::StringRef{str.begin(), str.size()})) { sortedVec.push_back(vec[i]); break; diff --git a/hal/src/main/native/cpp/jni/AccelerometerJNI.cpp b/hal/src/main/native/cpp/jni/AccelerometerJNI.cpp index d67c084a4a..2405d2f0a9 100644 --- a/hal/src/main/native/cpp/jni/AccelerometerJNI.cpp +++ b/hal/src/main/native/cpp/jni/AccelerometerJNI.cpp @@ -1,12 +1,13 @@ /*----------------------------------------------------------------------------*/ -/* Copyright (c) FIRST 2016. All Rights Reserved. */ +/* Copyright (c) 2016-2018 FIRST. 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. */ /*----------------------------------------------------------------------------*/ -#include "HAL/Accelerometer.h" #include + +#include "HAL/Accelerometer.h" #include "edu_wpi_first_wpilibj_hal_AccelerometerJNI.h" extern "C" { @@ -17,8 +18,9 @@ extern "C" { * Signature: (Z)V */ JNIEXPORT void JNICALL -Java_edu_wpi_first_wpilibj_hal_AccelerometerJNI_setAccelerometerActive( - JNIEnv *, jclass, jboolean active) { +Java_edu_wpi_first_wpilibj_hal_AccelerometerJNI_setAccelerometerActive + (JNIEnv*, jclass, jboolean active) +{ HAL_SetAccelerometerActive(active); } @@ -28,8 +30,9 @@ Java_edu_wpi_first_wpilibj_hal_AccelerometerJNI_setAccelerometerActive( * Signature: (I)V */ JNIEXPORT void JNICALL -Java_edu_wpi_first_wpilibj_hal_AccelerometerJNI_setAccelerometerRange( - JNIEnv *, jclass, jint range) { +Java_edu_wpi_first_wpilibj_hal_AccelerometerJNI_setAccelerometerRange + (JNIEnv*, jclass, jint range) +{ HAL_SetAccelerometerRange((HAL_AccelerometerRange)range); } @@ -39,8 +42,9 @@ Java_edu_wpi_first_wpilibj_hal_AccelerometerJNI_setAccelerometerRange( * Signature: ()D */ JNIEXPORT jdouble JNICALL -Java_edu_wpi_first_wpilibj_hal_AccelerometerJNI_getAccelerometerX( - JNIEnv *, jclass) { +Java_edu_wpi_first_wpilibj_hal_AccelerometerJNI_getAccelerometerX + (JNIEnv*, jclass) +{ return HAL_GetAccelerometerX(); } @@ -50,8 +54,9 @@ Java_edu_wpi_first_wpilibj_hal_AccelerometerJNI_getAccelerometerX( * Signature: ()D */ JNIEXPORT jdouble JNICALL -Java_edu_wpi_first_wpilibj_hal_AccelerometerJNI_getAccelerometerY( - JNIEnv *, jclass) { +Java_edu_wpi_first_wpilibj_hal_AccelerometerJNI_getAccelerometerY + (JNIEnv*, jclass) +{ return HAL_GetAccelerometerY(); } @@ -61,8 +66,9 @@ Java_edu_wpi_first_wpilibj_hal_AccelerometerJNI_getAccelerometerY( * Signature: ()D */ JNIEXPORT jdouble JNICALL -Java_edu_wpi_first_wpilibj_hal_AccelerometerJNI_getAccelerometerZ( - JNIEnv *, jclass) { +Java_edu_wpi_first_wpilibj_hal_AccelerometerJNI_getAccelerometerZ + (JNIEnv*, jclass) +{ return HAL_GetAccelerometerZ(); } diff --git a/hal/src/main/native/cpp/jni/AnalogGyroJNI.cpp b/hal/src/main/native/cpp/jni/AnalogGyroJNI.cpp index f5e019f872..7ea9bb5427 100644 --- a/hal/src/main/native/cpp/jni/AnalogGyroJNI.cpp +++ b/hal/src/main/native/cpp/jni/AnalogGyroJNI.cpp @@ -1,19 +1,19 @@ /*----------------------------------------------------------------------------*/ -/* Copyright (c) FIRST 2016. All Rights Reserved. */ +/* Copyright (c) 2016-2018 FIRST. 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. */ /*----------------------------------------------------------------------------*/ -#include #include -#include "HAL/cpp/Log.h" -#include "edu_wpi_first_wpilibj_hal_AnalogGyroJNI.h" +#include #include "HAL/AnalogGyro.h" -#include "HALUtil.h" +#include "HAL/cpp/Log.h" #include "HAL/handles/HandlesInternal.h" +#include "HALUtil.h" +#include "edu_wpi_first_wpilibj_hal_AnalogGyroJNI.h" using namespace frc; @@ -22,9 +22,9 @@ TLogLevel analogGyroJNILogLevel = logWARNING; #define ANALOGGYROJNI_LOG(level) \ if (level > analogGyroJNILogLevel) \ - ; \ - else \ - Log().Get(level) + ; \ + else \ + Log().Get(level) extern "C" { /* @@ -32,17 +32,21 @@ extern "C" { * Method: initializeAnalogGyro * Signature: (I)I */ -JNIEXPORT jint JNICALL Java_edu_wpi_first_wpilibj_hal_AnalogGyroJNI_initializeAnalogGyro( - JNIEnv* env, jclass, jint id) { +JNIEXPORT jint JNICALL +Java_edu_wpi_first_wpilibj_hal_AnalogGyroJNI_initializeAnalogGyro + (JNIEnv* env, jclass, jint id) +{ ANALOGGYROJNI_LOG(logDEBUG) << "Calling ANALOGGYROJNI initializeAnalogGyro"; - ANALOGGYROJNI_LOG(logDEBUG) << "Analog Input Handle = " << (HAL_AnalogInputHandle)id; + ANALOGGYROJNI_LOG(logDEBUG) + << "Analog Input Handle = " << (HAL_AnalogInputHandle)id; int32_t status = 0; - HAL_GyroHandle handle = HAL_InitializeAnalogGyro((HAL_AnalogInputHandle)id, &status); + HAL_GyroHandle handle = + HAL_InitializeAnalogGyro((HAL_AnalogInputHandle)id, &status); ANALOGGYROJNI_LOG(logDEBUG) << "Status = " << status; ANALOGGYROJNI_LOG(logDEBUG) << "Gyro Handle = " << handle; // Analog input does range checking, so we don't need to do so. CheckStatusForceThrow(env, status); - return (jint) handle; + return (jint)handle; } /* @@ -50,8 +54,10 @@ JNIEXPORT jint JNICALL Java_edu_wpi_first_wpilibj_hal_AnalogGyroJNI_initializeAn * Method: setupAnalogGyro * Signature: (I)V */ -JNIEXPORT void JNICALL Java_edu_wpi_first_wpilibj_hal_AnalogGyroJNI_setupAnalogGyro( - JNIEnv* env, jclass, jint id) { +JNIEXPORT void JNICALL +Java_edu_wpi_first_wpilibj_hal_AnalogGyroJNI_setupAnalogGyro + (JNIEnv* env, jclass, jint id) +{ ANALOGGYROJNI_LOG(logDEBUG) << "Calling ANALOGGYROJNI setupAnalogGyro"; ANALOGGYROJNI_LOG(logDEBUG) << "Gyro Handle = " << (HAL_GyroHandle)id; int32_t status = 0; @@ -65,8 +71,10 @@ JNIEXPORT void JNICALL Java_edu_wpi_first_wpilibj_hal_AnalogGyroJNI_setupAnalogG * Method: freeAnalogGyro * Signature: (I)V */ -JNIEXPORT void JNICALL Java_edu_wpi_first_wpilibj_hal_AnalogGyroJNI_freeAnalogGyro( - JNIEnv* env, jclass, jint id) { +JNIEXPORT void JNICALL +Java_edu_wpi_first_wpilibj_hal_AnalogGyroJNI_freeAnalogGyro + (JNIEnv* env, jclass, jint id) +{ ANALOGGYROJNI_LOG(logDEBUG) << "Calling ANALOGGYROJNI freeAnalogGyro"; ANALOGGYROJNI_LOG(logDEBUG) << "Gyro Handle = " << (HAL_GyroHandle)id; HAL_FreeAnalogGyro((HAL_GyroHandle)id); @@ -77,12 +85,16 @@ JNIEXPORT void JNICALL Java_edu_wpi_first_wpilibj_hal_AnalogGyroJNI_freeAnalogGy * Method: setAnalogGyroParameters * Signature: (IDDI)V */ -JNIEXPORT void JNICALL Java_edu_wpi_first_wpilibj_hal_AnalogGyroJNI_setAnalogGyroParameters( - JNIEnv* env, jclass, jint id, jdouble vPDPS, jdouble offset, jint center) { - ANALOGGYROJNI_LOG(logDEBUG) << "Calling ANALOGGYROJNI setAnalogGyroParameters"; +JNIEXPORT void JNICALL +Java_edu_wpi_first_wpilibj_hal_AnalogGyroJNI_setAnalogGyroParameters + (JNIEnv* env, jclass, jint id, jdouble vPDPS, jdouble offset, jint center) +{ + ANALOGGYROJNI_LOG(logDEBUG) + << "Calling ANALOGGYROJNI setAnalogGyroParameters"; ANALOGGYROJNI_LOG(logDEBUG) << "Gyro Handle = " << (HAL_GyroHandle)id; int32_t status = 0; - HAL_SetAnalogGyroParameters((HAL_GyroHandle)id, vPDPS, offset, center, &status); + HAL_SetAnalogGyroParameters((HAL_GyroHandle)id, vPDPS, offset, center, + &status); ANALOGGYROJNI_LOG(logDEBUG) << "Status = " << status; CheckStatus(env, status); } @@ -92,9 +104,12 @@ JNIEXPORT void JNICALL Java_edu_wpi_first_wpilibj_hal_AnalogGyroJNI_setAnalogGyr * Method: setAnalogGyroVoltsPerDegreePerSecond * Signature: (ID)V */ -JNIEXPORT void JNICALL Java_edu_wpi_first_wpilibj_hal_AnalogGyroJNI_setAnalogGyroVoltsPerDegreePerSecond( - JNIEnv* env, jclass, jint id, jdouble vPDPS) { - ANALOGGYROJNI_LOG(logDEBUG) << "Calling ANALOGGYROJNI setAnalogGyroVoltsPerDegreePerSecond"; +JNIEXPORT void JNICALL +Java_edu_wpi_first_wpilibj_hal_AnalogGyroJNI_setAnalogGyroVoltsPerDegreePerSecond + (JNIEnv* env, jclass, jint id, jdouble vPDPS) +{ + ANALOGGYROJNI_LOG(logDEBUG) + << "Calling ANALOGGYROJNI setAnalogGyroVoltsPerDegreePerSecond"; ANALOGGYROJNI_LOG(logDEBUG) << "Gyro Handle = " << (HAL_GyroHandle)id; ANALOGGYROJNI_LOG(logDEBUG) << "vPDPS = " << vPDPS; int32_t status = 0; @@ -108,8 +123,10 @@ JNIEXPORT void JNICALL Java_edu_wpi_first_wpilibj_hal_AnalogGyroJNI_setAnalogGyr * Method: resetAnalogGyro * Signature: (I)V */ -JNIEXPORT void JNICALL Java_edu_wpi_first_wpilibj_hal_AnalogGyroJNI_resetAnalogGyro( - JNIEnv* env, jclass, jint id) { +JNIEXPORT void JNICALL +Java_edu_wpi_first_wpilibj_hal_AnalogGyroJNI_resetAnalogGyro + (JNIEnv* env, jclass, jint id) +{ ANALOGGYROJNI_LOG(logDEBUG) << "Calling ANALOGGYROJNI resetAnalogGyro"; ANALOGGYROJNI_LOG(logDEBUG) << "Gyro Handle = " << (HAL_GyroHandle)id; int32_t status = 0; @@ -123,8 +140,10 @@ JNIEXPORT void JNICALL Java_edu_wpi_first_wpilibj_hal_AnalogGyroJNI_resetAnalogG * Method: calibrateAnalogGyro * Signature: (I)V */ -JNIEXPORT void JNICALL Java_edu_wpi_first_wpilibj_hal_AnalogGyroJNI_calibrateAnalogGyro( - JNIEnv* env, jclass, jint id) { +JNIEXPORT void JNICALL +Java_edu_wpi_first_wpilibj_hal_AnalogGyroJNI_calibrateAnalogGyro + (JNIEnv* env, jclass, jint id) +{ ANALOGGYROJNI_LOG(logDEBUG) << "Calling ANALOGGYROJNI calibrateAnalogGyro"; ANALOGGYROJNI_LOG(logDEBUG) << "Gyro Handle = " << (HAL_GyroHandle)id; int32_t status = 0; @@ -138,8 +157,10 @@ JNIEXPORT void JNICALL Java_edu_wpi_first_wpilibj_hal_AnalogGyroJNI_calibrateAna * Method: setAnalogGyroDeadband * Signature: (ID)V */ -JNIEXPORT void JNICALL Java_edu_wpi_first_wpilibj_hal_AnalogGyroJNI_setAnalogGyroDeadband( - JNIEnv* env, jclass, jint id, jdouble deadband) { +JNIEXPORT void JNICALL +Java_edu_wpi_first_wpilibj_hal_AnalogGyroJNI_setAnalogGyroDeadband + (JNIEnv* env, jclass, jint id, jdouble deadband) +{ ANALOGGYROJNI_LOG(logDEBUG) << "Calling ANALOGGYROJNI setAnalogGyroDeadband"; ANALOGGYROJNI_LOG(logDEBUG) << "Gyro Handle = " << (HAL_GyroHandle)id; int32_t status = 0; @@ -153,8 +174,10 @@ JNIEXPORT void JNICALL Java_edu_wpi_first_wpilibj_hal_AnalogGyroJNI_setAnalogGyr * Method: getAnalogGyroAngle * Signature: (I)D */ -JNIEXPORT jdouble JNICALL Java_edu_wpi_first_wpilibj_hal_AnalogGyroJNI_getAnalogGyroAngle( - JNIEnv* env, jclass, jint id) { +JNIEXPORT jdouble JNICALL +Java_edu_wpi_first_wpilibj_hal_AnalogGyroJNI_getAnalogGyroAngle + (JNIEnv* env, jclass, jint id) +{ ANALOGGYROJNI_LOG(logDEBUG) << "Calling ANALOGGYROJNI getAnalogGyroAngle"; ANALOGGYROJNI_LOG(logDEBUG) << "Gyro Handle = " << (HAL_GyroHandle)id; int32_t status = 0; @@ -170,8 +193,10 @@ JNIEXPORT jdouble JNICALL Java_edu_wpi_first_wpilibj_hal_AnalogGyroJNI_getAnalog * Method: getAnalogGyroRate * Signature: (I)D */ -JNIEXPORT jdouble JNICALL Java_edu_wpi_first_wpilibj_hal_AnalogGyroJNI_getAnalogGyroRate( - JNIEnv* env, jclass, jint id) { +JNIEXPORT jdouble JNICALL +Java_edu_wpi_first_wpilibj_hal_AnalogGyroJNI_getAnalogGyroRate + (JNIEnv* env, jclass, jint id) +{ ANALOGGYROJNI_LOG(logDEBUG) << "Calling ANALOGGYROJNI getAnalogGyroRate"; ANALOGGYROJNI_LOG(logDEBUG) << "Gyro Handle = " << (HAL_GyroHandle)id; int32_t status = 0; @@ -187,8 +212,10 @@ JNIEXPORT jdouble JNICALL Java_edu_wpi_first_wpilibj_hal_AnalogGyroJNI_getAnalog * Method: getAnalogGyroOffset * Signature: (I)D */ -JNIEXPORT jdouble JNICALL Java_edu_wpi_first_wpilibj_hal_AnalogGyroJNI_getAnalogGyroOffset( - JNIEnv* env, jclass, jint id) { +JNIEXPORT jdouble JNICALL +Java_edu_wpi_first_wpilibj_hal_AnalogGyroJNI_getAnalogGyroOffset + (JNIEnv* env, jclass, jint id) +{ ANALOGGYROJNI_LOG(logDEBUG) << "Calling ANALOGGYROJNI getAnalogGyroOffset"; ANALOGGYROJNI_LOG(logDEBUG) << "Gyro Handle = " << (HAL_GyroHandle)id; int32_t status = 0; @@ -204,8 +231,10 @@ JNIEXPORT jdouble JNICALL Java_edu_wpi_first_wpilibj_hal_AnalogGyroJNI_getAnalog * Method: getAnalogGyroCenter * Signature: (I)I */ -JNIEXPORT jint JNICALL Java_edu_wpi_first_wpilibj_hal_AnalogGyroJNI_getAnalogGyroCenter( - JNIEnv* env, jclass, jint id) { +JNIEXPORT jint JNICALL +Java_edu_wpi_first_wpilibj_hal_AnalogGyroJNI_getAnalogGyroCenter + (JNIEnv* env, jclass, jint id) +{ ANALOGGYROJNI_LOG(logDEBUG) << "Calling ANALOGGYROJNI getAnalogGyroCenter"; ANALOGGYROJNI_LOG(logDEBUG) << "Gyro Handle = " << (HAL_GyroHandle)id; int32_t status = 0; diff --git a/hal/src/main/native/cpp/jni/AnalogJNI.cpp b/hal/src/main/native/cpp/jni/AnalogJNI.cpp index 51a126efc0..82b5c9ad72 100644 --- a/hal/src/main/native/cpp/jni/AnalogJNI.cpp +++ b/hal/src/main/native/cpp/jni/AnalogJNI.cpp @@ -1,23 +1,23 @@ /*----------------------------------------------------------------------------*/ -/* Copyright (c) FIRST 2016. All Rights Reserved. */ +/* Copyright (c) 2016-2018 FIRST. 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. */ /*----------------------------------------------------------------------------*/ -#include #include -#include "HAL/cpp/Log.h" -#include "edu_wpi_first_wpilibj_hal_AnalogJNI.h" +#include +#include "HAL/AnalogAccumulator.h" #include "HAL/AnalogInput.h" #include "HAL/AnalogOutput.h" -#include "HAL/AnalogAccumulator.h" #include "HAL/AnalogTrigger.h" #include "HAL/Ports.h" -#include "HALUtil.h" +#include "HAL/cpp/Log.h" #include "HAL/handles/HandlesInternal.h" +#include "HALUtil.h" +#include "edu_wpi_first_wpilibj_hal_AnalogJNI.h" using namespace frc; @@ -28,7 +28,7 @@ TLogLevel analogJNILogLevel = logWARNING; if (level > analogJNILogLevel) \ ; \ else \ - Log().Get(level) + Log().Get(level) extern "C" { @@ -38,14 +38,15 @@ extern "C" { * Signature: (I)I */ JNIEXPORT jint JNICALL -Java_edu_wpi_first_wpilibj_hal_AnalogJNI_initializeAnalogInputPort( - JNIEnv *env, jclass, jint id) { +Java_edu_wpi_first_wpilibj_hal_AnalogJNI_initializeAnalogInputPort + (JNIEnv* env, jclass, jint id) +{ ANALOGJNI_LOG(logDEBUG) << "Port Handle = " << (HAL_PortHandle)id; int32_t status = 0; auto analog = HAL_InitializeAnalogInputPort((HAL_PortHandle)id, &status); ANALOGJNI_LOG(logDEBUG) << "Status = " << status; ANALOGJNI_LOG(logDEBUG) << "Analog Handle = " << analog; - CheckStatusRange(env, status, 0, HAL_GetNumAnalogInputs(), + CheckStatusRange(env, status, 0, HAL_GetNumAnalogInputs(), hal::getPortHandleChannel((HAL_PortHandle)id)); return (jint)analog; } @@ -56,8 +57,9 @@ Java_edu_wpi_first_wpilibj_hal_AnalogJNI_initializeAnalogInputPort( * Signature: (I)V */ JNIEXPORT void JNICALL -Java_edu_wpi_first_wpilibj_hal_AnalogJNI_freeAnalogInputPort( - JNIEnv *env, jclass, jint id) { +Java_edu_wpi_first_wpilibj_hal_AnalogJNI_freeAnalogInputPort + (JNIEnv* env, jclass, jint id) +{ ANALOGJNI_LOG(logDEBUG) << "Port Handle = " << (HAL_AnalogInputHandle)id; HAL_FreeAnalogInputPort((HAL_AnalogInputHandle)id); } @@ -68,14 +70,16 @@ Java_edu_wpi_first_wpilibj_hal_AnalogJNI_freeAnalogInputPort( * Signature: (I)I */ JNIEXPORT jint JNICALL -Java_edu_wpi_first_wpilibj_hal_AnalogJNI_initializeAnalogOutputPort( - JNIEnv *env, jclass, jint id) { +Java_edu_wpi_first_wpilibj_hal_AnalogJNI_initializeAnalogOutputPort + (JNIEnv* env, jclass, jint id) +{ ANALOGJNI_LOG(logDEBUG) << "Port Handle = " << (HAL_PortHandle)id; int32_t status = 0; - HAL_AnalogOutputHandle analog = HAL_InitializeAnalogOutputPort((HAL_PortHandle)id, &status); + HAL_AnalogOutputHandle analog = + HAL_InitializeAnalogOutputPort((HAL_PortHandle)id, &status); ANALOGJNI_LOG(logDEBUG) << "Status = " << status; ANALOGJNI_LOG(logDEBUG) << "Analog Handle = " << analog; - CheckStatusRange(env, status, 0, HAL_GetNumAnalogOutputs(), + CheckStatusRange(env, status, 0, HAL_GetNumAnalogOutputs(), hal::getPortHandleChannel((HAL_PortHandle)id)); return (jlong)analog; } @@ -86,8 +90,9 @@ Java_edu_wpi_first_wpilibj_hal_AnalogJNI_initializeAnalogOutputPort( * Signature: (I)V */ JNIEXPORT void JNICALL -Java_edu_wpi_first_wpilibj_hal_AnalogJNI_freeAnalogOutputPort( - JNIEnv *env, jclass, jint id) { +Java_edu_wpi_first_wpilibj_hal_AnalogJNI_freeAnalogOutputPort + (JNIEnv* env, jclass, jint id) +{ ANALOGJNI_LOG(logDEBUG) << "Port Handle = " << id; HAL_FreeAnalogOutputPort((HAL_AnalogOutputHandle)id); } @@ -98,8 +103,9 @@ Java_edu_wpi_first_wpilibj_hal_AnalogJNI_freeAnalogOutputPort( * Signature: (B)Z */ JNIEXPORT jboolean JNICALL -Java_edu_wpi_first_wpilibj_hal_AnalogJNI_checkAnalogModule( - JNIEnv *, jclass, jbyte value) { +Java_edu_wpi_first_wpilibj_hal_AnalogJNI_checkAnalogModule + (JNIEnv*, jclass, jbyte value) +{ // ANALOGJNI_LOG(logDEBUG) << "Module = " << (jint)value; jboolean returnValue = HAL_CheckAnalogModule(value); // ANALOGJNI_LOG(logDEBUG) << "checkAnalogModuleResult = " << @@ -113,8 +119,9 @@ Java_edu_wpi_first_wpilibj_hal_AnalogJNI_checkAnalogModule( * Signature: (I)Z */ JNIEXPORT jboolean JNICALL -Java_edu_wpi_first_wpilibj_hal_AnalogJNI_checkAnalogInputChannel( - JNIEnv *, jclass, jint value) { +Java_edu_wpi_first_wpilibj_hal_AnalogJNI_checkAnalogInputChannel + (JNIEnv*, jclass, jint value) +{ // ANALOGJNI_LOG(logDEBUG) << "Channel = " << value; jboolean returnValue = HAL_CheckAnalogInputChannel(value); // ANALOGJNI_LOG(logDEBUG) << "checkAnalogChannelResult = " << @@ -128,8 +135,9 @@ Java_edu_wpi_first_wpilibj_hal_AnalogJNI_checkAnalogInputChannel( * Signature: (I)Z */ JNIEXPORT jboolean JNICALL -Java_edu_wpi_first_wpilibj_hal_AnalogJNI_checkAnalogOutputChannel( - JNIEnv *, jclass, jint value) { +Java_edu_wpi_first_wpilibj_hal_AnalogJNI_checkAnalogOutputChannel + (JNIEnv*, jclass, jint value) +{ // ANALOGJNI_LOG(logDEBUG) << "Channel = " << value; jboolean returnValue = HAL_CheckAnalogOutputChannel(value); // ANALOGJNI_LOG(logDEBUG) << "checkAnalogChannelResult = " << @@ -142,8 +150,10 @@ Java_edu_wpi_first_wpilibj_hal_AnalogJNI_checkAnalogOutputChannel( * Method: setAnalogOutput * Signature: (ID)V */ -JNIEXPORT void JNICALL Java_edu_wpi_first_wpilibj_hal_AnalogJNI_setAnalogOutput( - JNIEnv *env, jclass, jint id, jdouble voltage) { +JNIEXPORT void JNICALL +Java_edu_wpi_first_wpilibj_hal_AnalogJNI_setAnalogOutput + (JNIEnv* env, jclass, jint id, jdouble voltage) +{ ANALOGJNI_LOG(logDEBUG) << "Calling setAnalogOutput"; ANALOGJNI_LOG(logDEBUG) << "Voltage = " << voltage; ANALOGJNI_LOG(logDEBUG) << "Analog Handle = " << id; @@ -158,8 +168,9 @@ JNIEXPORT void JNICALL Java_edu_wpi_first_wpilibj_hal_AnalogJNI_setAnalogOutput( * Signature: (I)D */ JNIEXPORT jdouble JNICALL -Java_edu_wpi_first_wpilibj_hal_AnalogJNI_getAnalogOutput( - JNIEnv *env, jclass, jint id) { +Java_edu_wpi_first_wpilibj_hal_AnalogJNI_getAnalogOutput + (JNIEnv* env, jclass, jint id) +{ int32_t status = 0; double val = HAL_GetAnalogOutput((HAL_AnalogOutputHandle)id, &status); CheckStatus(env, status); @@ -172,8 +183,9 @@ Java_edu_wpi_first_wpilibj_hal_AnalogJNI_getAnalogOutput( * Signature: (D)V */ JNIEXPORT void JNICALL -Java_edu_wpi_first_wpilibj_hal_AnalogJNI_setAnalogSampleRate( - JNIEnv *env, jclass, jdouble value) { +Java_edu_wpi_first_wpilibj_hal_AnalogJNI_setAnalogSampleRate + (JNIEnv* env, jclass, jdouble value) +{ ANALOGJNI_LOG(logDEBUG) << "SampleRate = " << value; int32_t status = 0; HAL_SetAnalogSampleRate(value, &status); @@ -187,8 +199,9 @@ Java_edu_wpi_first_wpilibj_hal_AnalogJNI_setAnalogSampleRate( * Signature: ()D */ JNIEXPORT jdouble JNICALL -Java_edu_wpi_first_wpilibj_hal_AnalogJNI_getAnalogSampleRate( - JNIEnv *env, jclass) { +Java_edu_wpi_first_wpilibj_hal_AnalogJNI_getAnalogSampleRate + (JNIEnv* env, jclass) +{ int32_t status = 0; double returnValue = HAL_GetAnalogSampleRate(&status); ANALOGJNI_LOG(logDEBUG) << "Status = " << status; @@ -203,8 +216,9 @@ Java_edu_wpi_first_wpilibj_hal_AnalogJNI_getAnalogSampleRate( * Signature: (II)V */ JNIEXPORT void JNICALL -Java_edu_wpi_first_wpilibj_hal_AnalogJNI_setAnalogAverageBits( - JNIEnv *env, jclass, jint id, jint value) { +Java_edu_wpi_first_wpilibj_hal_AnalogJNI_setAnalogAverageBits + (JNIEnv* env, jclass, jint id, jint value) +{ ANALOGJNI_LOG(logDEBUG) << "AverageBits = " << value; ANALOGJNI_LOG(logDEBUG) << "Analog Handle = " << (HAL_AnalogInputHandle)id; int32_t status = 0; @@ -219,11 +233,13 @@ Java_edu_wpi_first_wpilibj_hal_AnalogJNI_setAnalogAverageBits( * Signature: (I)I */ JNIEXPORT jint JNICALL -Java_edu_wpi_first_wpilibj_hal_AnalogJNI_getAnalogAverageBits( - JNIEnv *env, jclass, jint id) { +Java_edu_wpi_first_wpilibj_hal_AnalogJNI_getAnalogAverageBits + (JNIEnv* env, jclass, jint id) +{ ANALOGJNI_LOG(logDEBUG) << "Analog Handle = " << (HAL_AnalogInputHandle)id; int32_t status = 0; - jint returnValue = HAL_GetAnalogAverageBits((HAL_AnalogInputHandle)id, &status); + jint returnValue = + HAL_GetAnalogAverageBits((HAL_AnalogInputHandle)id, &status); ANALOGJNI_LOG(logDEBUG) << "Status = " << status; ANALOGJNI_LOG(logDEBUG) << "AverageBits = " << returnValue; CheckStatus(env, status); @@ -236,8 +252,9 @@ Java_edu_wpi_first_wpilibj_hal_AnalogJNI_getAnalogAverageBits( * Signature: (II)V */ JNIEXPORT void JNICALL -Java_edu_wpi_first_wpilibj_hal_AnalogJNI_setAnalogOversampleBits( - JNIEnv *env, jclass, jint id, jint value) { +Java_edu_wpi_first_wpilibj_hal_AnalogJNI_setAnalogOversampleBits + (JNIEnv* env, jclass, jint id, jint value) +{ ANALOGJNI_LOG(logDEBUG) << "OversampleBits = " << value; ANALOGJNI_LOG(logDEBUG) << "Analog Handle = " << (HAL_AnalogInputHandle)id; int32_t status = 0; @@ -252,11 +269,13 @@ Java_edu_wpi_first_wpilibj_hal_AnalogJNI_setAnalogOversampleBits( * Signature: (I)I */ JNIEXPORT jint JNICALL -Java_edu_wpi_first_wpilibj_hal_AnalogJNI_getAnalogOversampleBits( - JNIEnv *env, jclass, jint id) { +Java_edu_wpi_first_wpilibj_hal_AnalogJNI_getAnalogOversampleBits + (JNIEnv* env, jclass, jint id) +{ ANALOGJNI_LOG(logDEBUG) << "Analog Handle = " << (HAL_AnalogInputHandle)id; int32_t status = 0; - jint returnValue = HAL_GetAnalogOversampleBits((HAL_AnalogInputHandle)id, &status); + jint returnValue = + HAL_GetAnalogOversampleBits((HAL_AnalogInputHandle)id, &status); ANALOGJNI_LOG(logDEBUG) << "Status = " << status; ANALOGJNI_LOG(logDEBUG) << "OversampleBits = " << returnValue; CheckStatus(env, status); @@ -269,8 +288,9 @@ Java_edu_wpi_first_wpilibj_hal_AnalogJNI_getAnalogOversampleBits( * Signature: (I)S */ JNIEXPORT jshort JNICALL -Java_edu_wpi_first_wpilibj_hal_AnalogJNI_getAnalogValue( - JNIEnv *env, jclass, jint id) { +Java_edu_wpi_first_wpilibj_hal_AnalogJNI_getAnalogValue + (JNIEnv* env, jclass, jint id) +{ // ANALOGJNI_LOG(logDEBUG) << "Analog Handle = " << (void*)id; int32_t status = 0; jshort returnValue = HAL_GetAnalogValue((HAL_AnalogInputHandle)id, &status); @@ -286,11 +306,13 @@ Java_edu_wpi_first_wpilibj_hal_AnalogJNI_getAnalogValue( * Signature: (I)I */ JNIEXPORT jint JNICALL -Java_edu_wpi_first_wpilibj_hal_AnalogJNI_getAnalogAverageValue( - JNIEnv *env, jclass, jint id) { +Java_edu_wpi_first_wpilibj_hal_AnalogJNI_getAnalogAverageValue + (JNIEnv* env, jclass, jint id) +{ ANALOGJNI_LOG(logDEBUG) << "Analog Handle = " << (HAL_AnalogInputHandle)id; int32_t status = 0; - jint returnValue = HAL_GetAnalogAverageValue((HAL_AnalogInputHandle)id, &status); + jint returnValue = + HAL_GetAnalogAverageValue((HAL_AnalogInputHandle)id, &status); ANALOGJNI_LOG(logDEBUG) << "Status = " << status; ANALOGJNI_LOG(logDEBUG) << "AverageValue = " << returnValue; CheckStatus(env, status); @@ -303,12 +325,14 @@ Java_edu_wpi_first_wpilibj_hal_AnalogJNI_getAnalogAverageValue( * Signature: (ID)I */ JNIEXPORT jint JNICALL -Java_edu_wpi_first_wpilibj_hal_AnalogJNI_getAnalogVoltsToValue( - JNIEnv *env, jclass, jint id, jdouble voltageValue) { +Java_edu_wpi_first_wpilibj_hal_AnalogJNI_getAnalogVoltsToValue + (JNIEnv* env, jclass, jint id, jdouble voltageValue) +{ ANALOGJNI_LOG(logDEBUG) << "Analog Handle = " << (HAL_AnalogInputHandle)id; ANALOGJNI_LOG(logDEBUG) << "VoltageValue = " << voltageValue; int32_t status = 0; - jint returnValue = HAL_GetAnalogVoltsToValue((HAL_AnalogInputHandle)id, voltageValue, &status); + jint returnValue = HAL_GetAnalogVoltsToValue((HAL_AnalogInputHandle)id, + voltageValue, &status); ANALOGJNI_LOG(logDEBUG) << "Status = " << status; ANALOGJNI_LOG(logDEBUG) << "Value = " << returnValue; CheckStatus(env, status); @@ -321,11 +345,13 @@ Java_edu_wpi_first_wpilibj_hal_AnalogJNI_getAnalogVoltsToValue( * Signature: (I)D */ JNIEXPORT jdouble JNICALL -Java_edu_wpi_first_wpilibj_hal_AnalogJNI_getAnalogVoltage( - JNIEnv *env, jclass, jint id) { +Java_edu_wpi_first_wpilibj_hal_AnalogJNI_getAnalogVoltage + (JNIEnv* env, jclass, jint id) +{ // ANALOGJNI_LOG(logDEBUG) << "Analog Handle = " << (void*)id; int32_t status = 0; - jdouble returnValue = HAL_GetAnalogVoltage((HAL_AnalogInputHandle)id, &status); + jdouble returnValue = + HAL_GetAnalogVoltage((HAL_AnalogInputHandle)id, &status); // ANALOGJNI_LOG(logDEBUG) << "Status = " << status; // ANALOGJNI_LOG(logDEBUG) << "Voltage = " << returnValue; CheckStatus(env, status); @@ -338,11 +364,13 @@ Java_edu_wpi_first_wpilibj_hal_AnalogJNI_getAnalogVoltage( * Signature: (I)D */ JNIEXPORT jdouble JNICALL -Java_edu_wpi_first_wpilibj_hal_AnalogJNI_getAnalogAverageVoltage( - JNIEnv *env, jclass, jint id) { +Java_edu_wpi_first_wpilibj_hal_AnalogJNI_getAnalogAverageVoltage + (JNIEnv* env, jclass, jint id) +{ ANALOGJNI_LOG(logDEBUG) << "Analog Handle = " << (HAL_AnalogInputHandle)id; int32_t status = 0; - jdouble returnValue = HAL_GetAnalogAverageVoltage((HAL_AnalogInputHandle)id, &status); + jdouble returnValue = + HAL_GetAnalogAverageVoltage((HAL_AnalogInputHandle)id, &status); ANALOGJNI_LOG(logDEBUG) << "Status = " << status; ANALOGJNI_LOG(logDEBUG) << "AverageVoltage = " << returnValue; CheckStatus(env, status); @@ -355,8 +383,9 @@ Java_edu_wpi_first_wpilibj_hal_AnalogJNI_getAnalogAverageVoltage( * Signature: (I)I */ JNIEXPORT jint JNICALL -Java_edu_wpi_first_wpilibj_hal_AnalogJNI_getAnalogLSBWeight( - JNIEnv *env, jclass, jint id) { +Java_edu_wpi_first_wpilibj_hal_AnalogJNI_getAnalogLSBWeight + (JNIEnv* env, jclass, jint id) +{ ANALOGJNI_LOG(logDEBUG) << "Analog Handle = " << (HAL_AnalogInputHandle)id; int32_t status = 0; @@ -372,8 +401,10 @@ Java_edu_wpi_first_wpilibj_hal_AnalogJNI_getAnalogLSBWeight( * Method: getAnalogOffset * Signature: (I)I */ -JNIEXPORT jint JNICALL Java_edu_wpi_first_wpilibj_hal_AnalogJNI_getAnalogOffset( - JNIEnv *env, jclass, jint id) { +JNIEXPORT jint JNICALL +Java_edu_wpi_first_wpilibj_hal_AnalogJNI_getAnalogOffset + (JNIEnv* env, jclass, jint id) +{ ANALOGJNI_LOG(logDEBUG) << "Analog Handle = " << (HAL_AnalogInputHandle)id; int32_t status = 0; @@ -390,13 +421,15 @@ JNIEXPORT jint JNICALL Java_edu_wpi_first_wpilibj_hal_AnalogJNI_getAnalogOffset( * Signature: (I)Z */ JNIEXPORT jboolean JNICALL -Java_edu_wpi_first_wpilibj_hal_AnalogJNI_isAccumulatorChannel( - JNIEnv *env, jclass, jint id) { +Java_edu_wpi_first_wpilibj_hal_AnalogJNI_isAccumulatorChannel + (JNIEnv* env, jclass, jint id) +{ ANALOGJNI_LOG(logDEBUG) << "isAccumulatorChannel"; ANALOGJNI_LOG(logDEBUG) << "Analog Handle = " << (HAL_AnalogInputHandle)id; int32_t status = 0; - jboolean returnValue = HAL_IsAccumulatorChannel((HAL_AnalogInputHandle)id, &status); + jboolean returnValue = + HAL_IsAccumulatorChannel((HAL_AnalogInputHandle)id, &status); ANALOGJNI_LOG(logDEBUG) << "Status = " << status; ANALOGJNI_LOG(logDEBUG) << "AnalogOffset = " << returnValue; CheckStatus(env, status); @@ -408,8 +441,10 @@ Java_edu_wpi_first_wpilibj_hal_AnalogJNI_isAccumulatorChannel( * Method: initAccumulator * Signature: (I)V */ -JNIEXPORT void JNICALL Java_edu_wpi_first_wpilibj_hal_AnalogJNI_initAccumulator( - JNIEnv *env, jclass, jint id) { +JNIEXPORT void JNICALL +Java_edu_wpi_first_wpilibj_hal_AnalogJNI_initAccumulator + (JNIEnv* env, jclass, jint id) +{ ANALOGJNI_LOG(logDEBUG) << "Analog Handle = " << (HAL_AnalogInputHandle)id; int32_t status = 0; HAL_InitAccumulator((HAL_AnalogInputHandle)id, &status); @@ -423,8 +458,9 @@ JNIEXPORT void JNICALL Java_edu_wpi_first_wpilibj_hal_AnalogJNI_initAccumulator( * Signature: (I)V */ JNIEXPORT void JNICALL -Java_edu_wpi_first_wpilibj_hal_AnalogJNI_resetAccumulator( - JNIEnv *env, jclass, jint id) { +Java_edu_wpi_first_wpilibj_hal_AnalogJNI_resetAccumulator + (JNIEnv* env, jclass, jint id) +{ ANALOGJNI_LOG(logDEBUG) << "Analog Handle = " << (HAL_AnalogInputHandle)id; int32_t status = 0; HAL_ResetAccumulator((HAL_AnalogInputHandle)id, &status); @@ -438,8 +474,9 @@ Java_edu_wpi_first_wpilibj_hal_AnalogJNI_resetAccumulator( * Signature: (II)V */ JNIEXPORT void JNICALL -Java_edu_wpi_first_wpilibj_hal_AnalogJNI_setAccumulatorCenter( - JNIEnv *env, jclass, jint id, jint center) { +Java_edu_wpi_first_wpilibj_hal_AnalogJNI_setAccumulatorCenter + (JNIEnv* env, jclass, jint id, jint center) +{ ANALOGJNI_LOG(logDEBUG) << "Analog Handle = " << (HAL_AnalogInputHandle)id; int32_t status = 0; HAL_SetAccumulatorCenter((HAL_AnalogInputHandle)id, center, &status); @@ -453,8 +490,9 @@ Java_edu_wpi_first_wpilibj_hal_AnalogJNI_setAccumulatorCenter( * Signature: (II)V */ JNIEXPORT void JNICALL -Java_edu_wpi_first_wpilibj_hal_AnalogJNI_setAccumulatorDeadband( - JNIEnv *env, jclass, jint id, jint deadband) { +Java_edu_wpi_first_wpilibj_hal_AnalogJNI_setAccumulatorDeadband + (JNIEnv* env, jclass, jint id, jint deadband) +{ ANALOGJNI_LOG(logDEBUG) << "Analog Handle = " << (HAL_AnalogInputHandle)id; int32_t status = 0; HAL_SetAccumulatorDeadband((HAL_AnalogInputHandle)id, deadband, &status); @@ -468,11 +506,13 @@ Java_edu_wpi_first_wpilibj_hal_AnalogJNI_setAccumulatorDeadband( * Signature: (I)J */ JNIEXPORT jlong JNICALL -Java_edu_wpi_first_wpilibj_hal_AnalogJNI_getAccumulatorValue( - JNIEnv *env, jclass, jint id) { +Java_edu_wpi_first_wpilibj_hal_AnalogJNI_getAccumulatorValue + (JNIEnv* env, jclass, jint id) +{ ANALOGJNI_LOG(logDEBUG) << "Analog Handle = " << (HAL_AnalogInputHandle)id; int32_t status = 0; - jlong returnValue = HAL_GetAccumulatorValue((HAL_AnalogInputHandle)id, &status); + jlong returnValue = + HAL_GetAccumulatorValue((HAL_AnalogInputHandle)id, &status); ANALOGJNI_LOG(logDEBUG) << "Status = " << status; ANALOGJNI_LOG(logDEBUG) << "AccumulatorValue = " << returnValue; CheckStatus(env, status); @@ -486,11 +526,13 @@ Java_edu_wpi_first_wpilibj_hal_AnalogJNI_getAccumulatorValue( * Signature: (I)I */ JNIEXPORT jint JNICALL -Java_edu_wpi_first_wpilibj_hal_AnalogJNI_getAccumulatorCount( - JNIEnv *env, jclass, jint id) { +Java_edu_wpi_first_wpilibj_hal_AnalogJNI_getAccumulatorCount + (JNIEnv* env, jclass, jint id) +{ ANALOGJNI_LOG(logDEBUG) << "Analog Handle = " << (HAL_AnalogInputHandle)id; int32_t status = 0; - jint returnValue = HAL_GetAccumulatorCount((HAL_AnalogInputHandle)id, &status); + jint returnValue = + HAL_GetAccumulatorCount((HAL_AnalogInputHandle)id, &status); ANALOGJNI_LOG(logDEBUG) << "Status = " << status; ANALOGJNI_LOG(logDEBUG) << "AccumulatorCount = " << returnValue; CheckStatus(env, status); @@ -500,11 +542,12 @@ Java_edu_wpi_first_wpilibj_hal_AnalogJNI_getAccumulatorCount( /* * Class: edu_wpi_first_wpilibj_hal_AnalogJNI * Method: getAccumulatorOutput - * Signature: (ILedu/wpi/first/wpilibj/AccumulatorResult;)V + * Signature: (ILjava/lang/Object;)V */ JNIEXPORT void JNICALL -Java_edu_wpi_first_wpilibj_hal_AnalogJNI_getAccumulatorOutput( - JNIEnv *env, jclass, jint id, jobject accumulatorResult) { +Java_edu_wpi_first_wpilibj_hal_AnalogJNI_getAccumulatorOutput + (JNIEnv* env, jclass, jint id, jobject accumulatorResult) +{ ANALOGJNI_LOG(logDEBUG) << "Analog Handle = " << (HAL_AnalogInputHandle)id; int32_t status = 0; int64_t value = 0; @@ -520,17 +563,20 @@ Java_edu_wpi_first_wpilibj_hal_AnalogJNI_getAccumulatorOutput( /* * Class: edu_wpi_first_wpilibj_hal_AnalogJNI * Method: initializeAnalogTrigger - * Signature: (ILjava/nio/IntBuffer;)J + * Signature: (ILjava/lang/Object;)I */ JNIEXPORT jint JNICALL -Java_edu_wpi_first_wpilibj_hal_AnalogJNI_initializeAnalogTrigger( - JNIEnv *env, jclass, jint id, jobject index) { +Java_edu_wpi_first_wpilibj_hal_AnalogJNI_initializeAnalogTrigger + (JNIEnv* env, jclass, jint id, jobject index) +{ ANALOGJNI_LOG(logDEBUG) << "Port Handle = " << (HAL_AnalogInputHandle)id; - jint *indexHandle = (jint *)env->GetDirectBufferAddress(index); + jint* indexHandle = + reinterpret_cast(env->GetDirectBufferAddress(index)); ANALOGJNI_LOG(logDEBUG) << "Index Ptr = " << indexHandle; int32_t status = 0; - HAL_AnalogTriggerHandle analogTrigger = - HAL_InitializeAnalogTrigger((HAL_AnalogInputHandle)id, (int32_t *)indexHandle, &status); + HAL_AnalogTriggerHandle analogTrigger = HAL_InitializeAnalogTrigger( + (HAL_AnalogInputHandle)id, reinterpret_cast(indexHandle), + &status); ANALOGJNI_LOG(logDEBUG) << "Status = " << status; ANALOGJNI_LOG(logDEBUG) << "AnalogTrigger Handle = " << analogTrigger; CheckStatus(env, status); @@ -543,9 +589,11 @@ Java_edu_wpi_first_wpilibj_hal_AnalogJNI_initializeAnalogTrigger( * Signature: (I)V */ JNIEXPORT void JNICALL -Java_edu_wpi_first_wpilibj_hal_AnalogJNI_cleanAnalogTrigger( - JNIEnv *env, jclass,jint id) { - ANALOGJNI_LOG(logDEBUG) << "Analog Trigger Handle = " << (HAL_AnalogTriggerHandle)id; +Java_edu_wpi_first_wpilibj_hal_AnalogJNI_cleanAnalogTrigger + (JNIEnv* env, jclass, jint id) +{ + ANALOGJNI_LOG(logDEBUG) << "Analog Trigger Handle = " + << (HAL_AnalogTriggerHandle)id; int32_t status = 0; HAL_CleanAnalogTrigger((HAL_AnalogTriggerHandle)id, &status); CheckStatus(env, status); @@ -557,11 +605,14 @@ Java_edu_wpi_first_wpilibj_hal_AnalogJNI_cleanAnalogTrigger( * Signature: (III)V */ JNIEXPORT void JNICALL -Java_edu_wpi_first_wpilibj_hal_AnalogJNI_setAnalogTriggerLimitsRaw( - JNIEnv *env, jclass,jint id, jint lower, jint upper) { - ANALOGJNI_LOG(logDEBUG) << "Analog Trigger Handle = " << (HAL_AnalogTriggerHandle)id; +Java_edu_wpi_first_wpilibj_hal_AnalogJNI_setAnalogTriggerLimitsRaw + (JNIEnv* env, jclass, jint id, jint lower, jint upper) +{ + ANALOGJNI_LOG(logDEBUG) << "Analog Trigger Handle = " + << (HAL_AnalogTriggerHandle)id; int32_t status = 0; - HAL_SetAnalogTriggerLimitsRaw((HAL_AnalogTriggerHandle)id, lower, upper, &status); + HAL_SetAnalogTriggerLimitsRaw((HAL_AnalogTriggerHandle)id, lower, upper, + &status); CheckStatus(env, status); } @@ -571,11 +622,14 @@ Java_edu_wpi_first_wpilibj_hal_AnalogJNI_setAnalogTriggerLimitsRaw( * Signature: (IDD)V */ JNIEXPORT void JNICALL -Java_edu_wpi_first_wpilibj_hal_AnalogJNI_setAnalogTriggerLimitsVoltage( - JNIEnv *env, jclass,jint id, jdouble lower, jdouble upper) { - ANALOGJNI_LOG(logDEBUG) << "Analog Trigger Handle = " << (HAL_AnalogTriggerHandle)id; +Java_edu_wpi_first_wpilibj_hal_AnalogJNI_setAnalogTriggerLimitsVoltage + (JNIEnv* env, jclass, jint id, jdouble lower, jdouble upper) +{ + ANALOGJNI_LOG(logDEBUG) << "Analog Trigger Handle = " + << (HAL_AnalogTriggerHandle)id; int32_t status = 0; - HAL_SetAnalogTriggerLimitsVoltage((HAL_AnalogTriggerHandle)id, lower, upper, &status); + HAL_SetAnalogTriggerLimitsVoltage((HAL_AnalogTriggerHandle)id, lower, upper, + &status); CheckStatus(env, status); } @@ -585,9 +639,11 @@ Java_edu_wpi_first_wpilibj_hal_AnalogJNI_setAnalogTriggerLimitsVoltage( * Signature: (IZ)V */ JNIEXPORT void JNICALL -Java_edu_wpi_first_wpilibj_hal_AnalogJNI_setAnalogTriggerAveraged( - JNIEnv *env, jclass,jint id, jboolean averaged) { - ANALOGJNI_LOG(logDEBUG) << "Analog Trigger Handle = " << (HAL_AnalogTriggerHandle)id; +Java_edu_wpi_first_wpilibj_hal_AnalogJNI_setAnalogTriggerAveraged + (JNIEnv* env, jclass, jint id, jboolean averaged) +{ + ANALOGJNI_LOG(logDEBUG) << "Analog Trigger Handle = " + << (HAL_AnalogTriggerHandle)id; int32_t status = 0; HAL_SetAnalogTriggerAveraged((HAL_AnalogTriggerHandle)id, averaged, &status); CheckStatus(env, status); @@ -599,9 +655,11 @@ Java_edu_wpi_first_wpilibj_hal_AnalogJNI_setAnalogTriggerAveraged( * Signature: (IZ)V */ JNIEXPORT void JNICALL -Java_edu_wpi_first_wpilibj_hal_AnalogJNI_setAnalogTriggerFiltered( - JNIEnv *env, jclass,jint id, jboolean filtered) { - ANALOGJNI_LOG(logDEBUG) << "Analog Trigger Handle = " << (HAL_AnalogTriggerHandle)id; +Java_edu_wpi_first_wpilibj_hal_AnalogJNI_setAnalogTriggerFiltered + (JNIEnv* env, jclass, jint id, jboolean filtered) +{ + ANALOGJNI_LOG(logDEBUG) << "Analog Trigger Handle = " + << (HAL_AnalogTriggerHandle)id; int32_t status = 0; HAL_SetAnalogTriggerFiltered((HAL_AnalogTriggerHandle)id, filtered, &status); CheckStatus(env, status); @@ -613,11 +671,14 @@ Java_edu_wpi_first_wpilibj_hal_AnalogJNI_setAnalogTriggerFiltered( * Signature: (I)Z */ JNIEXPORT jboolean JNICALL -Java_edu_wpi_first_wpilibj_hal_AnalogJNI_getAnalogTriggerInWindow( - JNIEnv *env, jclass,jint id) { - ANALOGJNI_LOG(logDEBUG) << "Analog Trigger Handle = " << (HAL_AnalogTriggerHandle)id; +Java_edu_wpi_first_wpilibj_hal_AnalogJNI_getAnalogTriggerInWindow + (JNIEnv* env, jclass, jint id) +{ + ANALOGJNI_LOG(logDEBUG) << "Analog Trigger Handle = " + << (HAL_AnalogTriggerHandle)id; int32_t status = 0; - jboolean val = HAL_GetAnalogTriggerInWindow((HAL_AnalogTriggerHandle)id, &status); + jboolean val = + HAL_GetAnalogTriggerInWindow((HAL_AnalogTriggerHandle)id, &status); CheckStatus(env, status); return val; } @@ -628,11 +689,14 @@ Java_edu_wpi_first_wpilibj_hal_AnalogJNI_getAnalogTriggerInWindow( * Signature: (I)Z */ JNIEXPORT jboolean JNICALL -Java_edu_wpi_first_wpilibj_hal_AnalogJNI_getAnalogTriggerTriggerState( - JNIEnv *env, jclass,jint id) { - ANALOGJNI_LOG(logDEBUG) << "Analog Trigger Handle = " << (HAL_AnalogTriggerHandle)id; +Java_edu_wpi_first_wpilibj_hal_AnalogJNI_getAnalogTriggerTriggerState + (JNIEnv* env, jclass, jint id) +{ + ANALOGJNI_LOG(logDEBUG) << "Analog Trigger Handle = " + << (HAL_AnalogTriggerHandle)id; int32_t status = 0; - jboolean val = HAL_GetAnalogTriggerTriggerState((HAL_AnalogTriggerHandle)id, &status); + jboolean val = + HAL_GetAnalogTriggerTriggerState((HAL_AnalogTriggerHandle)id, &status); CheckStatus(env, status); return val; } @@ -643,12 +707,14 @@ Java_edu_wpi_first_wpilibj_hal_AnalogJNI_getAnalogTriggerTriggerState( * Signature: (II)Z */ JNIEXPORT jboolean JNICALL -Java_edu_wpi_first_wpilibj_hal_AnalogJNI_getAnalogTriggerOutput( - JNIEnv *env, jclass,jint id, jint type) { - ANALOGJNI_LOG(logDEBUG) << "Analog Trigger Handle = " << (HAL_AnalogTriggerHandle)id; +Java_edu_wpi_first_wpilibj_hal_AnalogJNI_getAnalogTriggerOutput + (JNIEnv* env, jclass, jint id, jint type) +{ + ANALOGJNI_LOG(logDEBUG) << "Analog Trigger Handle = " + << (HAL_AnalogTriggerHandle)id; int32_t status = 0; - jboolean val = - HAL_GetAnalogTriggerOutput((HAL_AnalogTriggerHandle)id, (HAL_AnalogTriggerType)type, &status); + jboolean val = HAL_GetAnalogTriggerOutput( + (HAL_AnalogTriggerHandle)id, (HAL_AnalogTriggerType)type, &status); CheckStatus(env, status); return val; } diff --git a/hal/src/main/native/cpp/jni/CANJNI.cpp b/hal/src/main/native/cpp/jni/CANJNI.cpp index 5d46b284df..2238d37621 100644 --- a/hal/src/main/native/cpp/jni/CANJNI.cpp +++ b/hal/src/main/native/cpp/jni/CANJNI.cpp @@ -1,20 +1,22 @@ /*----------------------------------------------------------------------------*/ -/* Copyright (c) FIRST 2016. All Rights Reserved. */ +/* Copyright (c) 2016-2018 FIRST. 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. */ /*----------------------------------------------------------------------------*/ -#include #include -#include "HAL/cpp/Log.h" +#include + +#include +#include +#include + #include "HAL/CAN.h" +#include "HAL/cpp/Log.h" #include "HALUtil.h" #include "edu_wpi_first_wpilibj_can_CANJNI.h" -#include "wpi/SmallString.h" -#include "wpi/jni_util.h" -#include "wpi/raw_ostream.h" using namespace frc; using namespace wpi::java; @@ -27,7 +29,7 @@ TLogLevel canJNILogLevel = logERROR; if (level > canJNILogLevel) \ ; \ else \ - Log().Get(level) + Log().Get(level) extern "C" { @@ -37,15 +39,15 @@ extern "C" { * Signature: (I[BI)V */ JNIEXPORT void JNICALL -Java_edu_wpi_first_wpilibj_can_CANJNI_FRCNetCommCANSessionMuxSendMessage( - JNIEnv *env, jclass, jint messageID, jbyteArray data, jint periodMs) { - - CANJNI_LOG(logDEBUG) - << "Calling CANJNI FRCNetCommCANSessionMuxSendMessage"; +Java_edu_wpi_first_wpilibj_can_CANJNI_FRCNetCommCANSessionMuxSendMessage + (JNIEnv* env, jclass, jint messageID, jbyteArray data, jint periodMs) +{ + CANJNI_LOG(logDEBUG) << "Calling CANJNI FRCNetCommCANSessionMuxSendMessage"; JByteArrayRef dataArray{env, data}; - const uint8_t *dataBuffer = reinterpret_cast(dataArray.array().data()); + const uint8_t* dataBuffer = + reinterpret_cast(dataArray.array().data()); uint8_t dataSize = dataArray.array().size(); CANJNI_LOG(logDEBUG) << "Message ID "; @@ -68,8 +70,7 @@ Java_edu_wpi_first_wpilibj_can_CANJNI_FRCNetCommCANSessionMuxSendMessage( CANJNI_LOG(logDEBUG) << "Period: " << periodMs; int32_t status = 0; - HAL_CAN_SendMessage( - messageID, dataBuffer, dataSize, periodMs, &status); + HAL_CAN_SendMessage(messageID, dataBuffer, dataSize, periodMs, &status); CANJNI_LOG(logDEBUG) << "Status: " << status; CheckCANStatus(env, status, messageID); @@ -78,25 +79,27 @@ Java_edu_wpi_first_wpilibj_can_CANJNI_FRCNetCommCANSessionMuxSendMessage( /* * Class: edu_wpi_first_wpilibj_can_CANJNI * Method: FRCNetCommCANSessionMuxReceiveMessage - * Signature: (Ljava/nio/IntBuffer;ILjava/nio/ByteBuffer;)[B + * Signature: (Ljava/lang/Object;ILjava/lang/Object;)[B */ JNIEXPORT jbyteArray JNICALL -Java_edu_wpi_first_wpilibj_can_CANJNI_FRCNetCommCANSessionMuxReceiveMessage( - JNIEnv *env, jclass, jobject messageID, jint messageIDMask, - jobject timeStamp) { - +Java_edu_wpi_first_wpilibj_can_CANJNI_FRCNetCommCANSessionMuxReceiveMessage + (JNIEnv* env, jclass, jobject messageID, jint messageIDMask, + jobject timeStamp) +{ CANJNI_LOG(logDEBUG) << "Calling CANJNI FRCNetCommCANSessionMuxReceiveMessage"; - uint32_t *messageIDPtr = (uint32_t *)env->GetDirectBufferAddress(messageID); - uint32_t *timeStampPtr = (uint32_t *)env->GetDirectBufferAddress(timeStamp); + uint32_t* messageIDPtr = + reinterpret_cast(env->GetDirectBufferAddress(messageID)); + uint32_t* timeStampPtr = + reinterpret_cast(env->GetDirectBufferAddress(timeStamp)); uint8_t dataSize = 0; uint8_t buffer[8]; int32_t status = 0; - HAL_CAN_ReceiveMessage( - messageIDPtr, messageIDMask, buffer, &dataSize, timeStampPtr, &status); + HAL_CAN_ReceiveMessage(messageIDPtr, messageIDMask, buffer, &dataSize, + timeStampPtr, &status); CANJNI_LOG(logDEBUG) << "Message ID "; CANJNI_LOG(logDEBUG).write_hex(*messageIDPtr); @@ -121,19 +124,21 @@ Java_edu_wpi_first_wpilibj_can_CANJNI_FRCNetCommCANSessionMuxReceiveMessage( CANJNI_LOG(logDEBUG) << "Status: " << status; if (!CheckCANStatus(env, status, *messageIDPtr)) return nullptr; - return MakeJByteArray(env, wpi::StringRef{reinterpret_cast(buffer), - static_cast(dataSize)}); + return MakeJByteArray(env, + wpi::StringRef{reinterpret_cast(buffer), + static_cast(dataSize)}); } /* * Class: edu_wpi_first_wpilibj_can_CANJNI * Method: GetCANStatus - * Signature: (Ledu/wpi/first/wpilibj/can/CANStatus;)V + * Signature: (Ljava/lang/Object;)V */ -JNIEXPORT void JNICALL Java_edu_wpi_first_wpilibj_can_CANJNI_GetCANStatus -(JNIEnv *env, jclass, jobject canStatus) { - CANJNI_LOG(logDEBUG) - << "Calling CANJNI HAL_CAN_GetCANStatus"; +JNIEXPORT void JNICALL +Java_edu_wpi_first_wpilibj_can_CANJNI_GetCANStatus + (JNIEnv* env, jclass, jobject canStatus) +{ + CANJNI_LOG(logDEBUG) << "Calling CANJNI HAL_CAN_GetCANStatus"; float percentBusUtilization = 0; uint32_t busOffCount = 0; @@ -143,7 +148,7 @@ JNIEXPORT void JNICALL Java_edu_wpi_first_wpilibj_can_CANJNI_GetCANStatus int32_t status = 0; HAL_CAN_GetCANStatus(&percentBusUtilization, &busOffCount, &txFullCount, &receiveErrorCount, &transmitErrorCount, &status); - + if (!CheckStatus(env, status)) return; SetCanStatusObject(env, canStatus, percentBusUtilization, busOffCount, diff --git a/hal/src/main/native/cpp/jni/CompressorJNI.cpp b/hal/src/main/native/cpp/jni/CompressorJNI.cpp index 31cc8d807f..3565882fd0 100644 --- a/hal/src/main/native/cpp/jni/CompressorJNI.cpp +++ b/hal/src/main/native/cpp/jni/CompressorJNI.cpp @@ -1,5 +1,5 @@ /*----------------------------------------------------------------------------*/ -/* Copyright (c) FIRST 2016. All Rights Reserved. */ +/* Copyright (c) 2016-2018 FIRST. 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. */ @@ -8,8 +8,8 @@ #include "HAL/Compressor.h" #include "HAL/Ports.h" #include "HAL/Solenoid.h" -#include "HALUtil.h" #include "HAL/cpp/Log.h" +#include "HALUtil.h" #include "edu_wpi_first_wpilibj_hal_CompressorJNI.h" using namespace frc; @@ -22,12 +22,13 @@ extern "C" { * Signature: (B)I */ JNIEXPORT jint JNICALL -Java_edu_wpi_first_wpilibj_hal_CompressorJNI_initializeCompressor( - JNIEnv *env, jclass, jbyte module) { +Java_edu_wpi_first_wpilibj_hal_CompressorJNI_initializeCompressor + (JNIEnv* env, jclass, jbyte module) +{ int32_t status = 0; auto handle = HAL_InitializeCompressor(module, &status); CheckStatusRange(env, status, 0, HAL_GetNumPCMModules(), module); - + return (jint)handle; } @@ -37,19 +38,21 @@ Java_edu_wpi_first_wpilibj_hal_CompressorJNI_initializeCompressor( * Signature: (B)Z */ JNIEXPORT jboolean JNICALL -Java_edu_wpi_first_wpilibj_hal_CompressorJNI_checkCompressorModule( - JNIEnv *env, jclass, jbyte module) { +Java_edu_wpi_first_wpilibj_hal_CompressorJNI_checkCompressorModule + (JNIEnv* env, jclass, jbyte module) +{ return HAL_CheckCompressorModule(module); } /* * Class: edu_wpi_first_wpilibj_hal_CompressorJNI * Method: getCompressor - * Signature: (J)Z + * Signature: (I)Z */ JNIEXPORT jboolean JNICALL -Java_edu_wpi_first_wpilibj_hal_CompressorJNI_getCompressor( - JNIEnv *env, jclass, jint compressorHandle) { +Java_edu_wpi_first_wpilibj_hal_CompressorJNI_getCompressor + (JNIEnv* env, jclass, jint compressorHandle) +{ int32_t status = 0; bool val = HAL_GetCompressor((HAL_CompressorHandle)compressorHandle, &status); CheckStatus(env, status); @@ -59,26 +62,30 @@ Java_edu_wpi_first_wpilibj_hal_CompressorJNI_getCompressor( /* * Class: edu_wpi_first_wpilibj_hal_CompressorJNI * Method: setCompressorClosedLoopControl - * Signature: (JZ)V + * Signature: (IZ)V */ JNIEXPORT void JNICALL -Java_edu_wpi_first_wpilibj_hal_CompressorJNI_setCompressorClosedLoopControl( - JNIEnv *env, jclass, jint compressorHandle, jboolean value) { +Java_edu_wpi_first_wpilibj_hal_CompressorJNI_setCompressorClosedLoopControl + (JNIEnv* env, jclass, jint compressorHandle, jboolean value) +{ int32_t status = 0; - HAL_SetCompressorClosedLoopControl((HAL_CompressorHandle)compressorHandle, value, &status); + HAL_SetCompressorClosedLoopControl((HAL_CompressorHandle)compressorHandle, + value, &status); CheckStatus(env, status); } /* * Class: edu_wpi_first_wpilibj_hal_CompressorJNI * Method: getCompressorClosedLoopControl - * Signature: (J)Z + * Signature: (I)Z */ JNIEXPORT jboolean JNICALL -Java_edu_wpi_first_wpilibj_hal_CompressorJNI_getCompressorClosedLoopControl( - JNIEnv *env, jclass, jint compressorHandle) { +Java_edu_wpi_first_wpilibj_hal_CompressorJNI_getCompressorClosedLoopControl + (JNIEnv* env, jclass, jint compressorHandle) +{ int32_t status = 0; - bool val = HAL_GetCompressorClosedLoopControl((HAL_CompressorHandle)compressorHandle, &status); + bool val = HAL_GetCompressorClosedLoopControl( + (HAL_CompressorHandle)compressorHandle, &status); CheckStatus(env, status); return val; } @@ -86,13 +93,15 @@ Java_edu_wpi_first_wpilibj_hal_CompressorJNI_getCompressorClosedLoopControl( /* * Class: edu_wpi_first_wpilibj_hal_CompressorJNI * Method: getCompressorPressureSwitch - * Signature: (J)Z + * Signature: (I)Z */ JNIEXPORT jboolean JNICALL -Java_edu_wpi_first_wpilibj_hal_CompressorJNI_getCompressorPressureSwitch( - JNIEnv *env, jclass, jint compressorHandle) { +Java_edu_wpi_first_wpilibj_hal_CompressorJNI_getCompressorPressureSwitch + (JNIEnv* env, jclass, jint compressorHandle) +{ int32_t status = 0; - bool val = HAL_GetCompressorPressureSwitch((HAL_CompressorHandle)compressorHandle, &status); + bool val = HAL_GetCompressorPressureSwitch( + (HAL_CompressorHandle)compressorHandle, &status); CheckStatus(env, status); return val; } @@ -100,13 +109,15 @@ Java_edu_wpi_first_wpilibj_hal_CompressorJNI_getCompressorPressureSwitch( /* * Class: edu_wpi_first_wpilibj_hal_CompressorJNI * Method: getCompressorCurrent - * Signature: (J)D + * Signature: (I)D */ JNIEXPORT jdouble JNICALL -Java_edu_wpi_first_wpilibj_hal_CompressorJNI_getCompressorCurrent( - JNIEnv *env, jclass, jint compressorHandle) { +Java_edu_wpi_first_wpilibj_hal_CompressorJNI_getCompressorCurrent + (JNIEnv* env, jclass, jint compressorHandle) +{ int32_t status = 0; - double val = HAL_GetCompressorCurrent((HAL_CompressorHandle)compressorHandle, &status); + double val = + HAL_GetCompressorCurrent((HAL_CompressorHandle)compressorHandle, &status); CheckStatus(env, status); return val; } @@ -114,13 +125,15 @@ Java_edu_wpi_first_wpilibj_hal_CompressorJNI_getCompressorCurrent( /* * Class: edu_wpi_first_wpilibj_hal_CompressorJNI * Method: getCompressorCurrentTooHighFault - * Signature: (J)Z + * Signature: (I)Z */ JNIEXPORT jboolean JNICALL -Java_edu_wpi_first_wpilibj_hal_CompressorJNI_getCompressorCurrentTooHighFault( - JNIEnv *env, jclass, jint compressorHandle) { +Java_edu_wpi_first_wpilibj_hal_CompressorJNI_getCompressorCurrentTooHighFault + (JNIEnv* env, jclass, jint compressorHandle) +{ int32_t status = 0; - bool val = HAL_GetCompressorCurrentTooHighFault((HAL_CompressorHandle)compressorHandle, &status); + bool val = HAL_GetCompressorCurrentTooHighFault( + (HAL_CompressorHandle)compressorHandle, &status); CheckStatus(env, status); return val; } @@ -128,14 +141,15 @@ Java_edu_wpi_first_wpilibj_hal_CompressorJNI_getCompressorCurrentTooHighFault( /* * Class: edu_wpi_first_wpilibj_hal_CompressorJNI * Method: getCompressorCurrentTooHighStickyFault - * Signature: (J)Z + * Signature: (I)Z */ JNIEXPORT jboolean JNICALL -Java_edu_wpi_first_wpilibj_hal_CompressorJNI_getCompressorCurrentTooHighStickyFault( - JNIEnv *env, jclass, jint compressorHandle) { +Java_edu_wpi_first_wpilibj_hal_CompressorJNI_getCompressorCurrentTooHighStickyFault + (JNIEnv* env, jclass, jint compressorHandle) +{ int32_t status = 0; - bool val = - HAL_GetCompressorCurrentTooHighStickyFault((HAL_CompressorHandle)compressorHandle, &status); + bool val = HAL_GetCompressorCurrentTooHighStickyFault( + (HAL_CompressorHandle)compressorHandle, &status); CheckStatus(env, status); return val; } @@ -143,13 +157,15 @@ Java_edu_wpi_first_wpilibj_hal_CompressorJNI_getCompressorCurrentTooHighStickyFa /* * Class: edu_wpi_first_wpilibj_hal_CompressorJNI * Method: getCompressorShortedStickyFault - * Signature: (J)Z + * Signature: (I)Z */ JNIEXPORT jboolean JNICALL -Java_edu_wpi_first_wpilibj_hal_CompressorJNI_getCompressorShortedStickyFault( - JNIEnv *env, jclass, jint compressorHandle) { +Java_edu_wpi_first_wpilibj_hal_CompressorJNI_getCompressorShortedStickyFault + (JNIEnv* env, jclass, jint compressorHandle) +{ int32_t status = 0; - bool val = HAL_GetCompressorShortedStickyFault((HAL_CompressorHandle)compressorHandle, &status); + bool val = HAL_GetCompressorShortedStickyFault( + (HAL_CompressorHandle)compressorHandle, &status); CheckStatus(env, status); return val; } @@ -157,13 +173,15 @@ Java_edu_wpi_first_wpilibj_hal_CompressorJNI_getCompressorShortedStickyFault( /* * Class: edu_wpi_first_wpilibj_hal_CompressorJNI * Method: getCompressorShortedFault - * Signature: (J)Z + * Signature: (I)Z */ JNIEXPORT jboolean JNICALL -Java_edu_wpi_first_wpilibj_hal_CompressorJNI_getCompressorShortedFault( - JNIEnv *env, jclass, jint compressorHandle) { +Java_edu_wpi_first_wpilibj_hal_CompressorJNI_getCompressorShortedFault + (JNIEnv* env, jclass, jint compressorHandle) +{ int32_t status = 0; - bool val = HAL_GetCompressorShortedFault((HAL_CompressorHandle)compressorHandle, &status); + bool val = HAL_GetCompressorShortedFault( + (HAL_CompressorHandle)compressorHandle, &status); CheckStatus(env, status); return val; } @@ -171,13 +189,15 @@ Java_edu_wpi_first_wpilibj_hal_CompressorJNI_getCompressorShortedFault( /* * Class: edu_wpi_first_wpilibj_hal_CompressorJNI * Method: getCompressorNotConnectedStickyFault - * Signature: (J)Z + * Signature: (I)Z */ JNIEXPORT jboolean JNICALL -Java_edu_wpi_first_wpilibj_hal_CompressorJNI_getCompressorNotConnectedStickyFault( - JNIEnv *env, jclass, jint compressorHandle) { +Java_edu_wpi_first_wpilibj_hal_CompressorJNI_getCompressorNotConnectedStickyFault + (JNIEnv* env, jclass, jint compressorHandle) +{ int32_t status = 0; - bool val = HAL_GetCompressorNotConnectedStickyFault((HAL_CompressorHandle)compressorHandle, &status); + bool val = HAL_GetCompressorNotConnectedStickyFault( + (HAL_CompressorHandle)compressorHandle, &status); CheckStatus(env, status); return val; } @@ -185,26 +205,29 @@ Java_edu_wpi_first_wpilibj_hal_CompressorJNI_getCompressorNotConnectedStickyFaul /* * Class: edu_wpi_first_wpilibj_hal_CompressorJNI * Method: getCompressorNotConnectedFault - * Signature: (J)Z + * Signature: (I)Z */ JNIEXPORT jboolean JNICALL -Java_edu_wpi_first_wpilibj_hal_CompressorJNI_getCompressorNotConnectedFault( - JNIEnv *env, jclass, jint compressorHandle) { +Java_edu_wpi_first_wpilibj_hal_CompressorJNI_getCompressorNotConnectedFault + (JNIEnv* env, jclass, jint compressorHandle) +{ int32_t status = 0; - bool val = HAL_GetCompressorNotConnectedFault((HAL_CompressorHandle)compressorHandle, &status); + bool val = HAL_GetCompressorNotConnectedFault( + (HAL_CompressorHandle)compressorHandle, &status); CheckStatus(env, status); return val; } /* * Class: edu_wpi_first_wpilibj_hal_CompressorJNI * Method: clearAllPCMStickyFaults - * Signature: (J)V + * Signature: (B)V */ JNIEXPORT void JNICALL -Java_edu_wpi_first_wpilibj_hal_CompressorJNI_clearAllPCMStickyFaults( - JNIEnv *env, jclass, jbyte module) { +Java_edu_wpi_first_wpilibj_hal_CompressorJNI_clearAllPCMStickyFaults + (JNIEnv* env, jclass, jbyte module) +{ int32_t status = 0; - HAL_ClearAllPCMStickyFaults((uint8_t)module, &status); + HAL_ClearAllPCMStickyFaults(static_cast(module), &status); CheckStatus(env, status); } diff --git a/hal/src/main/native/cpp/jni/ConstantsJNI.cpp b/hal/src/main/native/cpp/jni/ConstantsJNI.cpp index e1eb416c42..07205d00ab 100644 --- a/hal/src/main/native/cpp/jni/ConstantsJNI.cpp +++ b/hal/src/main/native/cpp/jni/ConstantsJNI.cpp @@ -1,18 +1,18 @@ /*----------------------------------------------------------------------------*/ -/* Copyright (c) FIRST 2016. All Rights Reserved. */ +/* Copyright (c) 2016-2018 FIRST. 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. */ /*----------------------------------------------------------------------------*/ -#include #include -#include "HAL/cpp/Log.h" -#include "edu_wpi_first_wpilibj_hal_ConstantsJNI.h" +#include #include "HAL/Constants.h" +#include "HAL/cpp/Log.h" #include "HALUtil.h" +#include "edu_wpi_first_wpilibj_hal_ConstantsJNI.h" using namespace frc; @@ -21,9 +21,9 @@ TLogLevel constantsJNILogLevel = logWARNING; #define CONSTANTSJNI_LOG(level) \ if (level > constantsJNILogLevel) \ - ; \ - else \ - Log().Get(level) + ; \ + else \ + Log().Get(level) extern "C" { /* @@ -32,11 +32,13 @@ extern "C" { * Signature: ()I */ JNIEXPORT jint JNICALL -Java_edu_wpi_first_wpilibj_hal_ConstantsJNI_getSystemClockTicksPerMicrosecond( - JNIEnv *env, jclass) { - CONSTANTSJNI_LOG(logDEBUG) << "Calling ConstantsJNI getSystemClockTicksPerMicrosecond"; +Java_edu_wpi_first_wpilibj_hal_ConstantsJNI_getSystemClockTicksPerMicrosecond + (JNIEnv* env, jclass) +{ + CONSTANTSJNI_LOG(logDEBUG) + << "Calling ConstantsJNI getSystemClockTicksPerMicrosecond"; jint value = HAL_GetSystemClockTicksPerMicrosecond(); CONSTANTSJNI_LOG(logDEBUG) << "Value = " << value; return value; } -} +} // extern "C" diff --git a/hal/src/main/native/cpp/jni/CounterJNI.cpp b/hal/src/main/native/cpp/jni/CounterJNI.cpp index d43bb78ec8..60548c9afc 100644 --- a/hal/src/main/native/cpp/jni/CounterJNI.cpp +++ b/hal/src/main/native/cpp/jni/CounterJNI.cpp @@ -1,19 +1,19 @@ /*----------------------------------------------------------------------------*/ -/* Copyright (c) FIRST 2016. All Rights Reserved. */ +/* Copyright (c) 2016-2018 FIRST. 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. */ /*----------------------------------------------------------------------------*/ -#include #include -#include "HAL/cpp/Log.h" -#include "edu_wpi_first_wpilibj_hal_CounterJNI.h" +#include #include "HAL/Counter.h" #include "HAL/Errors.h" +#include "HAL/cpp/Log.h" #include "HALUtil.h" +#include "edu_wpi_first_wpilibj_hal_CounterJNI.h" using namespace frc; @@ -24,24 +24,27 @@ TLogLevel counterJNILogLevel = logWARNING; if (level > counterJNILogLevel) \ ; \ else \ - Log().Get(level) + Log().Get(level) extern "C" { /* * Class: edu_wpi_first_wpilibj_hal_CounterJNI * Method: initializeCounter - * Signature: (ILjava/nio/IntBuffer;)I + * Signature: (ILjava/lang/Object;)I */ JNIEXPORT jint JNICALL -Java_edu_wpi_first_wpilibj_hal_CounterJNI_initializeCounter( - JNIEnv* env, jclass, jint mode, jobject index) { +Java_edu_wpi_first_wpilibj_hal_CounterJNI_initializeCounter + (JNIEnv* env, jclass, jint mode, jobject index) +{ COUNTERJNI_LOG(logDEBUG) << "Calling COUNTERJNI initializeCounter"; COUNTERJNI_LOG(logDEBUG) << "Mode = " << mode; - jint* indexPtr = (jint*)env->GetDirectBufferAddress(index); - COUNTERJNI_LOG(logDEBUG) << "Index Ptr = " << (int32_t*)indexPtr; + jint* indexPtr = reinterpret_cast(env->GetDirectBufferAddress(index)); + COUNTERJNI_LOG(logDEBUG) << "Index Ptr = " + << reinterpret_cast(indexPtr); int32_t status = 0; - auto counter = HAL_InitializeCounter((HAL_Counter_Mode)mode, (int32_t*)indexPtr, &status); + auto counter = HAL_InitializeCounter( + (HAL_Counter_Mode)mode, reinterpret_cast(indexPtr), &status); COUNTERJNI_LOG(logDEBUG) << "Index = " << *indexPtr; COUNTERJNI_LOG(logDEBUG) << "Status = " << status; COUNTERJNI_LOG(logDEBUG) << "COUNTER Handle = " << counter; @@ -54,8 +57,10 @@ Java_edu_wpi_first_wpilibj_hal_CounterJNI_initializeCounter( * Method: freeCounter * Signature: (I)V */ -JNIEXPORT void JNICALL Java_edu_wpi_first_wpilibj_hal_CounterJNI_freeCounter( - JNIEnv* env, jclass, jint id) { +JNIEXPORT void JNICALL +Java_edu_wpi_first_wpilibj_hal_CounterJNI_freeCounter + (JNIEnv* env, jclass, jint id) +{ COUNTERJNI_LOG(logDEBUG) << "Calling COUNTERJNI freeCounter"; COUNTERJNI_LOG(logDEBUG) << "Counter Handle = " << (HAL_CounterHandle)id; int32_t status = 0; @@ -70,8 +75,9 @@ JNIEXPORT void JNICALL Java_edu_wpi_first_wpilibj_hal_CounterJNI_freeCounter( * Signature: (II)V */ JNIEXPORT void JNICALL -Java_edu_wpi_first_wpilibj_hal_CounterJNI_setCounterAverageSize( - JNIEnv* env, jclass, jint id, jint value) { +Java_edu_wpi_first_wpilibj_hal_CounterJNI_setCounterAverageSize + (JNIEnv* env, jclass, jint id, jint value) +{ COUNTERJNI_LOG(logDEBUG) << "Calling COUNTERJNI setCounterAverageSize"; COUNTERJNI_LOG(logDEBUG) << "Counter Handle = " << (HAL_CounterHandle)id; COUNTERJNI_LOG(logDEBUG) << "AverageSize = " << value; @@ -87,16 +93,17 @@ Java_edu_wpi_first_wpilibj_hal_CounterJNI_setCounterAverageSize( * Signature: (III)V */ JNIEXPORT void JNICALL -Java_edu_wpi_first_wpilibj_hal_CounterJNI_setCounterUpSource( - JNIEnv* env, jclass, jint id, jint digitalSourceHandle, - jint analogTriggerType) { +Java_edu_wpi_first_wpilibj_hal_CounterJNI_setCounterUpSource + (JNIEnv* env, jclass, jint id, jint digitalSourceHandle, + jint analogTriggerType) +{ COUNTERJNI_LOG(logDEBUG) << "Calling COUNTERJNI setCounterUpSource"; COUNTERJNI_LOG(logDEBUG) << "Counter Handle = " << (HAL_CounterHandle)id; COUNTERJNI_LOG(logDEBUG) << "digitalSourceHandle = " << digitalSourceHandle; COUNTERJNI_LOG(logDEBUG) << "analogTriggerType = " << analogTriggerType; int32_t status = 0; - HAL_SetCounterUpSource((HAL_CounterHandle)id, (HAL_Handle)digitalSourceHandle, - (HAL_AnalogTriggerType)analogTriggerType, &status); + HAL_SetCounterUpSource((HAL_CounterHandle)id, (HAL_Handle)digitalSourceHandle, + (HAL_AnalogTriggerType)analogTriggerType, &status); COUNTERJNI_LOG(logDEBUG) << "Status = " << status; CheckStatus(env, status); } @@ -107,14 +114,16 @@ Java_edu_wpi_first_wpilibj_hal_CounterJNI_setCounterUpSource( * Signature: (IZZ)V */ JNIEXPORT void JNICALL -Java_edu_wpi_first_wpilibj_hal_CounterJNI_setCounterUpSourceEdge( - JNIEnv* env, jclass, jint id, jboolean valueRise, jboolean valueFall) { +Java_edu_wpi_first_wpilibj_hal_CounterJNI_setCounterUpSourceEdge + (JNIEnv* env, jclass, jint id, jboolean valueRise, jboolean valueFall) +{ COUNTERJNI_LOG(logDEBUG) << "Calling COUNTERJNI setCounterUpSourceEdge"; COUNTERJNI_LOG(logDEBUG) << "Counter Handle = " << (HAL_CounterHandle)id; COUNTERJNI_LOG(logDEBUG) << "Rise = " << (jint)valueRise; COUNTERJNI_LOG(logDEBUG) << "Fall = " << (jint)valueFall; int32_t status = 0; - HAL_SetCounterUpSourceEdge((HAL_CounterHandle)id, valueRise, valueFall, &status); + HAL_SetCounterUpSourceEdge((HAL_CounterHandle)id, valueRise, valueFall, + &status); COUNTERJNI_LOG(logDEBUG) << "Status = " << status; CheckStatus(env, status); } @@ -125,8 +134,9 @@ Java_edu_wpi_first_wpilibj_hal_CounterJNI_setCounterUpSourceEdge( * Signature: (I)V */ JNIEXPORT void JNICALL -Java_edu_wpi_first_wpilibj_hal_CounterJNI_clearCounterUpSource( - JNIEnv* env, jclass, jint id) { +Java_edu_wpi_first_wpilibj_hal_CounterJNI_clearCounterUpSource + (JNIEnv* env, jclass, jint id) +{ COUNTERJNI_LOG(logDEBUG) << "Calling COUNTERJNI clearCounterUpSource"; COUNTERJNI_LOG(logDEBUG) << "Counter Handle = " << (HAL_CounterHandle)id; int32_t status = 0; @@ -138,19 +148,21 @@ Java_edu_wpi_first_wpilibj_hal_CounterJNI_clearCounterUpSource( /* * Class: edu_wpi_first_wpilibj_hal_CounterJNI * Method: setCounterDownSource - * Signature: (IIZ)V + * Signature: (III)V */ JNIEXPORT void JNICALL -Java_edu_wpi_first_wpilibj_hal_CounterJNI_setCounterDownSource( - JNIEnv* env, jclass, jint id, jint digitalSourceHandle, - jint analogTriggerType) { +Java_edu_wpi_first_wpilibj_hal_CounterJNI_setCounterDownSource + (JNIEnv* env, jclass, jint id, jint digitalSourceHandle, + jint analogTriggerType) +{ COUNTERJNI_LOG(logDEBUG) << "Calling COUNTERJNI setCounterDownSource"; COUNTERJNI_LOG(logDEBUG) << "Counter Handle = " << (HAL_CounterHandle)id; COUNTERJNI_LOG(logDEBUG) << "digitalSourceHandle = " << digitalSourceHandle; COUNTERJNI_LOG(logDEBUG) << "analogTriggerType = " << analogTriggerType; int32_t status = 0; - HAL_SetCounterDownSource((HAL_CounterHandle)id, (HAL_Handle)digitalSourceHandle, - (HAL_AnalogTriggerType)analogTriggerType, &status); + HAL_SetCounterDownSource((HAL_CounterHandle)id, + (HAL_Handle)digitalSourceHandle, + (HAL_AnalogTriggerType)analogTriggerType, &status); COUNTERJNI_LOG(logDEBUG) << "Status = " << status; if (status == PARAMETER_OUT_OF_RANGE) { ThrowIllegalArgumentException(env, @@ -167,14 +179,16 @@ Java_edu_wpi_first_wpilibj_hal_CounterJNI_setCounterDownSource( * Signature: (IZZ)V */ JNIEXPORT void JNICALL -Java_edu_wpi_first_wpilibj_hal_CounterJNI_setCounterDownSourceEdge( - JNIEnv* env, jclass, jint id, jboolean valueRise, jboolean valueFall) { +Java_edu_wpi_first_wpilibj_hal_CounterJNI_setCounterDownSourceEdge + (JNIEnv* env, jclass, jint id, jboolean valueRise, jboolean valueFall) +{ COUNTERJNI_LOG(logDEBUG) << "Calling COUNTERJNI setCounterDownSourceEdge"; COUNTERJNI_LOG(logDEBUG) << "Counter Handle = " << (HAL_CounterHandle)id; COUNTERJNI_LOG(logDEBUG) << "Rise = " << (jint)valueRise; COUNTERJNI_LOG(logDEBUG) << "Fall = " << (jint)valueFall; int32_t status = 0; - HAL_SetCounterDownSourceEdge((HAL_CounterHandle)id, valueRise, valueFall, &status); + HAL_SetCounterDownSourceEdge((HAL_CounterHandle)id, valueRise, valueFall, + &status); COUNTERJNI_LOG(logDEBUG) << "Status = " << status; CheckStatus(env, status); } @@ -185,8 +199,9 @@ Java_edu_wpi_first_wpilibj_hal_CounterJNI_setCounterDownSourceEdge( * Signature: (I)V */ JNIEXPORT void JNICALL -Java_edu_wpi_first_wpilibj_hal_CounterJNI_clearCounterDownSource( - JNIEnv* env, jclass, jint id) { +Java_edu_wpi_first_wpilibj_hal_CounterJNI_clearCounterDownSource + (JNIEnv* env, jclass, jint id) +{ COUNTERJNI_LOG(logDEBUG) << "Calling COUNTERJNI clearCounterDownSource"; COUNTERJNI_LOG(logDEBUG) << "Counter Handle = " << (HAL_CounterHandle)id; int32_t status = 0; @@ -201,8 +216,9 @@ Java_edu_wpi_first_wpilibj_hal_CounterJNI_clearCounterDownSource( * Signature: (I)V */ JNIEXPORT void JNICALL -Java_edu_wpi_first_wpilibj_hal_CounterJNI_setCounterUpDownMode( - JNIEnv* env, jclass, jint id) { +Java_edu_wpi_first_wpilibj_hal_CounterJNI_setCounterUpDownMode + (JNIEnv* env, jclass, jint id) +{ COUNTERJNI_LOG(logDEBUG) << "Calling COUNTERJNI setCounterUpDownMode"; COUNTERJNI_LOG(logDEBUG) << "Counter Handle = " << (HAL_CounterHandle)id; int32_t status = 0; @@ -217,8 +233,9 @@ Java_edu_wpi_first_wpilibj_hal_CounterJNI_setCounterUpDownMode( * Signature: (I)V */ JNIEXPORT void JNICALL -Java_edu_wpi_first_wpilibj_hal_CounterJNI_setCounterExternalDirectionMode( - JNIEnv* env, jclass, jint id) { +Java_edu_wpi_first_wpilibj_hal_CounterJNI_setCounterExternalDirectionMode + (JNIEnv* env, jclass, jint id) +{ COUNTERJNI_LOG(logDEBUG) << "Calling COUNTERJNI setCounterExternalDirectionMode"; COUNTERJNI_LOG(logDEBUG) << "Counter Handle = " << (HAL_CounterHandle)id; @@ -234,8 +251,9 @@ Java_edu_wpi_first_wpilibj_hal_CounterJNI_setCounterExternalDirectionMode( * Signature: (IZ)V */ JNIEXPORT void JNICALL -Java_edu_wpi_first_wpilibj_hal_CounterJNI_setCounterSemiPeriodMode( - JNIEnv* env, jclass, jint id, jboolean value) { +Java_edu_wpi_first_wpilibj_hal_CounterJNI_setCounterSemiPeriodMode + (JNIEnv* env, jclass, jint id, jboolean value) +{ COUNTERJNI_LOG(logDEBUG) << "Calling COUNTERJNI setCounterSemiPeriodMode"; COUNTERJNI_LOG(logDEBUG) << "Counter Handle = " << (HAL_CounterHandle)id; COUNTERJNI_LOG(logDEBUG) << "SemiPeriodMode = " << (jint)value; @@ -251,8 +269,9 @@ Java_edu_wpi_first_wpilibj_hal_CounterJNI_setCounterSemiPeriodMode( * Signature: (ID)V */ JNIEXPORT void JNICALL -Java_edu_wpi_first_wpilibj_hal_CounterJNI_setCounterPulseLengthMode( - JNIEnv* env, jclass, jint id, jdouble value) { +Java_edu_wpi_first_wpilibj_hal_CounterJNI_setCounterPulseLengthMode + (JNIEnv* env, jclass, jint id, jdouble value) +{ COUNTERJNI_LOG(logDEBUG) << "Calling COUNTERJNI setCounterPulseLengthMode"; COUNTERJNI_LOG(logDEBUG) << "Counter Handle = " << (HAL_CounterHandle)id; COUNTERJNI_LOG(logDEBUG) << "PulseLengthMode = " << value; @@ -268,12 +287,14 @@ Java_edu_wpi_first_wpilibj_hal_CounterJNI_setCounterPulseLengthMode( * Signature: (I)I */ JNIEXPORT jint JNICALL -Java_edu_wpi_first_wpilibj_hal_CounterJNI_getCounterSamplesToAverage( - JNIEnv* env, jclass, jint id) { +Java_edu_wpi_first_wpilibj_hal_CounterJNI_getCounterSamplesToAverage + (JNIEnv* env, jclass, jint id) +{ COUNTERJNI_LOG(logDEBUG) << "Calling COUNTERJNI getCounterSamplesToAverage"; COUNTERJNI_LOG(logDEBUG) << "Counter Handle = " << (HAL_CounterHandle)id; int32_t status = 0; - jint returnValue = HAL_GetCounterSamplesToAverage((HAL_CounterHandle)id, &status); + jint returnValue = + HAL_GetCounterSamplesToAverage((HAL_CounterHandle)id, &status); COUNTERJNI_LOG(logDEBUG) << "Status = " << status; COUNTERJNI_LOG(logDEBUG) << "getCounterSamplesToAverageResult = " << returnValue; @@ -287,8 +308,9 @@ Java_edu_wpi_first_wpilibj_hal_CounterJNI_getCounterSamplesToAverage( * Signature: (II)V */ JNIEXPORT void JNICALL -Java_edu_wpi_first_wpilibj_hal_CounterJNI_setCounterSamplesToAverage( - JNIEnv* env, jclass, jint id, jint value) { +Java_edu_wpi_first_wpilibj_hal_CounterJNI_setCounterSamplesToAverage + (JNIEnv* env, jclass, jint id, jint value) +{ COUNTERJNI_LOG(logDEBUG) << "Calling COUNTERJNI setCounterSamplesToAverage"; COUNTERJNI_LOG(logDEBUG) << "Counter Handle = " << (HAL_CounterHandle)id; COUNTERJNI_LOG(logDEBUG) << "SamplesToAverage = " << value; @@ -307,8 +329,10 @@ Java_edu_wpi_first_wpilibj_hal_CounterJNI_setCounterSamplesToAverage( * Method: resetCounter * Signature: (I)V */ -JNIEXPORT void JNICALL Java_edu_wpi_first_wpilibj_hal_CounterJNI_resetCounter( - JNIEnv* env, jclass, jint id) { +JNIEXPORT void JNICALL +Java_edu_wpi_first_wpilibj_hal_CounterJNI_resetCounter + (JNIEnv* env, jclass, jint id) +{ COUNTERJNI_LOG(logDEBUG) << "Calling COUNTERJNI resetCounter"; COUNTERJNI_LOG(logDEBUG) << "Counter Handle = " << (HAL_CounterHandle)id; int32_t status = 0; @@ -322,8 +346,10 @@ JNIEXPORT void JNICALL Java_edu_wpi_first_wpilibj_hal_CounterJNI_resetCounter( * Method: getCounter * Signature: (I)I */ -JNIEXPORT jint JNICALL Java_edu_wpi_first_wpilibj_hal_CounterJNI_getCounter( - JNIEnv* env, jclass, jint id) { +JNIEXPORT jint JNICALL +Java_edu_wpi_first_wpilibj_hal_CounterJNI_getCounter + (JNIEnv* env, jclass, jint id) +{ // COUNTERJNI_LOG(logDEBUG) << "Calling COUNTERJNI getCounter"; // COUNTERJNI_LOG(logDEBUG) << "Counter Handle = " << (HAL_CounterHandle)id; int32_t status = 0; @@ -340,8 +366,9 @@ JNIEXPORT jint JNICALL Java_edu_wpi_first_wpilibj_hal_CounterJNI_getCounter( * Signature: (I)D */ JNIEXPORT jdouble JNICALL -Java_edu_wpi_first_wpilibj_hal_CounterJNI_getCounterPeriod( - JNIEnv* env, jclass, jint id) { +Java_edu_wpi_first_wpilibj_hal_CounterJNI_getCounterPeriod + (JNIEnv* env, jclass, jint id) +{ COUNTERJNI_LOG(logDEBUG) << "Calling COUNTERJNI getCounterPeriod"; COUNTERJNI_LOG(logDEBUG) << "Counter Handle = " << (HAL_CounterHandle)id; int32_t status = 0; @@ -358,8 +385,9 @@ Java_edu_wpi_first_wpilibj_hal_CounterJNI_getCounterPeriod( * Signature: (ID)V */ JNIEXPORT void JNICALL -Java_edu_wpi_first_wpilibj_hal_CounterJNI_setCounterMaxPeriod( - JNIEnv* env, jclass, jint id, jdouble value) { +Java_edu_wpi_first_wpilibj_hal_CounterJNI_setCounterMaxPeriod + (JNIEnv* env, jclass, jint id, jdouble value) +{ COUNTERJNI_LOG(logDEBUG) << "Calling COUNTERJNI setCounterMaxPeriod"; COUNTERJNI_LOG(logDEBUG) << "Counter Handle = " << (HAL_CounterHandle)id; COUNTERJNI_LOG(logDEBUG) << "MaxPeriod = " << value; @@ -375,8 +403,9 @@ Java_edu_wpi_first_wpilibj_hal_CounterJNI_setCounterMaxPeriod( * Signature: (IZ)V */ JNIEXPORT void JNICALL -Java_edu_wpi_first_wpilibj_hal_CounterJNI_setCounterUpdateWhenEmpty( - JNIEnv* env, jclass, jint id, jboolean value) { +Java_edu_wpi_first_wpilibj_hal_CounterJNI_setCounterUpdateWhenEmpty + (JNIEnv* env, jclass, jint id, jboolean value) +{ COUNTERJNI_LOG(logDEBUG) << "Calling COUNTERJNI setCounterMaxPeriod"; COUNTERJNI_LOG(logDEBUG) << "Counter Handle = " << (HAL_CounterHandle)id; COUNTERJNI_LOG(logDEBUG) << "UpdateWhenEmpty = " << (jint)value; @@ -392,8 +421,9 @@ Java_edu_wpi_first_wpilibj_hal_CounterJNI_setCounterUpdateWhenEmpty( * Signature: (I)Z */ JNIEXPORT jboolean JNICALL -Java_edu_wpi_first_wpilibj_hal_CounterJNI_getCounterStopped( - JNIEnv* env, jclass, jint id) { +Java_edu_wpi_first_wpilibj_hal_CounterJNI_getCounterStopped + (JNIEnv* env, jclass, jint id) +{ COUNTERJNI_LOG(logDEBUG) << "Calling COUNTERJNI getCounterStopped"; COUNTERJNI_LOG(logDEBUG) << "Counter Handle = " << (HAL_CounterHandle)id; int32_t status = 0; @@ -410,12 +440,14 @@ Java_edu_wpi_first_wpilibj_hal_CounterJNI_getCounterStopped( * Signature: (I)Z */ JNIEXPORT jboolean JNICALL -Java_edu_wpi_first_wpilibj_hal_CounterJNI_getCounterDirection( - JNIEnv* env, jclass, jint id) { +Java_edu_wpi_first_wpilibj_hal_CounterJNI_getCounterDirection + (JNIEnv* env, jclass, jint id) +{ COUNTERJNI_LOG(logDEBUG) << "Calling COUNTERJNI getCounterDirection"; COUNTERJNI_LOG(logDEBUG) << "Counter Handle = " << (HAL_CounterHandle)id; int32_t status = 0; - jboolean returnValue = HAL_GetCounterDirection((HAL_CounterHandle)id, &status); + jboolean returnValue = + HAL_GetCounterDirection((HAL_CounterHandle)id, &status); COUNTERJNI_LOG(logDEBUG) << "Status = " << status; COUNTERJNI_LOG(logDEBUG) << "getCounterDirectionResult = " << (jint)returnValue; @@ -429,8 +461,9 @@ Java_edu_wpi_first_wpilibj_hal_CounterJNI_getCounterDirection( * Signature: (IZ)V */ JNIEXPORT void JNICALL -Java_edu_wpi_first_wpilibj_hal_CounterJNI_setCounterReverseDirection( - JNIEnv* env, jclass, jint id, jboolean value) { +Java_edu_wpi_first_wpilibj_hal_CounterJNI_setCounterReverseDirection + (JNIEnv* env, jclass, jint id, jboolean value) +{ COUNTERJNI_LOG(logDEBUG) << "Calling COUNTERJNI setCounterReverseDirection"; COUNTERJNI_LOG(logDEBUG) << "Counter Handle = " << (HAL_CounterHandle)id; COUNTERJNI_LOG(logDEBUG) << "ReverseDirection = " << (jint)value; diff --git a/hal/src/main/native/cpp/jni/DIOJNI.cpp b/hal/src/main/native/cpp/jni/DIOJNI.cpp index 95867c8d2e..9f2df7aab0 100644 --- a/hal/src/main/native/cpp/jni/DIOJNI.cpp +++ b/hal/src/main/native/cpp/jni/DIOJNI.cpp @@ -1,21 +1,21 @@ /*----------------------------------------------------------------------------*/ -/* Copyright (c) FIRST 2016. All Rights Reserved. */ +/* Copyright (c) 2016-2018 FIRST. 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. */ /*----------------------------------------------------------------------------*/ -#include #include -#include "HAL/cpp/Log.h" -#include "edu_wpi_first_wpilibj_hal_DIOJNI.h" +#include #include "HAL/DIO.h" #include "HAL/PWM.h" -#include "HALUtil.h" #include "HAL/Ports.h" +#include "HAL/cpp/Log.h" #include "HAL/handles/HandlesInternal.h" +#include "HALUtil.h" +#include "edu_wpi_first_wpilibj_hal_DIOJNI.h" using namespace frc; @@ -26,23 +26,25 @@ TLogLevel dioJNILogLevel = logWARNING; if (level > dioJNILogLevel) \ ; \ else \ - Log().Get(level) + Log().Get(level) extern "C" { /* * Class: edu_wpi_first_wpilibj_hal_DIOJNI * Method: initializeDIOPort - * Signature: (IZ)I; + * Signature: (IZ)I */ JNIEXPORT jint JNICALL -Java_edu_wpi_first_wpilibj_hal_DIOJNI_initializeDIOPort( - JNIEnv *env, jclass, jint id, jboolean input) { +Java_edu_wpi_first_wpilibj_hal_DIOJNI_initializeDIOPort + (JNIEnv* env, jclass, jint id, jboolean input) +{ DIOJNI_LOG(logDEBUG) << "Calling DIOJNI initializeDIOPort"; DIOJNI_LOG(logDEBUG) << "Port Handle = " << (HAL_PortHandle)id; DIOJNI_LOG(logDEBUG) << "Input = " << (jint)input; int32_t status = 0; - auto dio = HAL_InitializeDIOPort((HAL_PortHandle)id, (uint8_t)input, &status); + auto dio = HAL_InitializeDIOPort((HAL_PortHandle)id, + static_cast(input), &status); DIOJNI_LOG(logDEBUG) << "Status = " << status; DIOJNI_LOG(logDEBUG) << "DIO Handle = " << dio; CheckStatusRange(env, status, 0, HAL_GetNumDigitalChannels(), @@ -53,10 +55,12 @@ Java_edu_wpi_first_wpilibj_hal_DIOJNI_initializeDIOPort( /* * Class: edu_wpi_first_wpilibj_hal_DIOJNI * Method: checkDIOChannel - * Signature: (I)Z; -*/ -JNIEXPORT jboolean JNICALL Java_edu_wpi_first_wpilibj_hal_DIOJNI_checkDIOChannel( - JNIEnv *env, jclass, jint channel) { + * Signature: (I)Z + */ +JNIEXPORT jboolean JNICALL +Java_edu_wpi_first_wpilibj_hal_DIOJNI_checkDIOChannel + (JNIEnv* env, jclass, jint channel) +{ DIOJNI_LOG(logDEBUG) << "Calling DIOJNI checkDIOChannel"; DIOJNI_LOG(logDEBUG) << "Channel = " << channel; return HAL_CheckDIOChannel(channel); @@ -65,10 +69,12 @@ JNIEXPORT jboolean JNICALL Java_edu_wpi_first_wpilibj_hal_DIOJNI_checkDIOChannel /* * Class: edu_wpi_first_wpilibj_hal_DIOJNI * Method: freeDIOPort - * Signature: (I)V; -*/ -JNIEXPORT void JNICALL Java_edu_wpi_first_wpilibj_hal_DIOJNI_freeDIOPort( - JNIEnv *env, jclass, jint id) { + * Signature: (I)V + */ +JNIEXPORT void JNICALL +Java_edu_wpi_first_wpilibj_hal_DIOJNI_freeDIOPort + (JNIEnv* env, jclass, jint id) +{ DIOJNI_LOG(logDEBUG) << "Calling DIOJNI freeDIOPort"; DIOJNI_LOG(logDEBUG) << "Port Handle = " << (HAL_DigitalHandle)id; HAL_FreeDIOPort((HAL_DigitalHandle)id); @@ -79,8 +85,10 @@ JNIEXPORT void JNICALL Java_edu_wpi_first_wpilibj_hal_DIOJNI_freeDIOPort( * Method: setDIO * Signature: (IS)V */ -JNIEXPORT void JNICALL Java_edu_wpi_first_wpilibj_hal_DIOJNI_setDIO( - JNIEnv *env, jclass, jint id, jshort value) { +JNIEXPORT void JNICALL +Java_edu_wpi_first_wpilibj_hal_DIOJNI_setDIO + (JNIEnv* env, jclass, jint id, jshort value) +{ // DIOJNI_LOG(logDEBUG) << "Calling DIOJNI setDIO"; // DIOJNI_LOG(logDEBUG) << "Port Handle = " << (HAL_DigitalHandle)id; // DIOJNI_LOG(logDEBUG) << "Value = " << value; @@ -95,8 +103,10 @@ JNIEXPORT void JNICALL Java_edu_wpi_first_wpilibj_hal_DIOJNI_setDIO( * Method: setDIODirection * Signature: (IZ)V */ -JNIEXPORT void JNICALL Java_edu_wpi_first_wpilibj_hal_DIOJNI_setDIODirection( - JNIEnv *env, jclass, jint id, jboolean input) { +JNIEXPORT void JNICALL +Java_edu_wpi_first_wpilibj_hal_DIOJNI_setDIODirection + (JNIEnv* env, jclass, jint id, jboolean input) +{ // DIOJNI_LOG(logDEBUG) << "Calling DIOJNI setDIO"; // DIOJNI_LOG(logDEBUG) << "Port Handle = " << (HAL_DigitalHandle)id; // DIOJNI_LOG(logDEBUG) << "IsInput = " << input; @@ -109,10 +119,12 @@ JNIEXPORT void JNICALL Java_edu_wpi_first_wpilibj_hal_DIOJNI_setDIODirection( /* * Class: edu_wpi_first_wpilibj_hal_DIOJNI * Method: getDIO - * Signature: (J)Z + * Signature: (I)Z */ JNIEXPORT jboolean JNICALL -Java_edu_wpi_first_wpilibj_hal_DIOJNI_getDIO(JNIEnv *env, jclass, jint id) { +Java_edu_wpi_first_wpilibj_hal_DIOJNI_getDIO + (JNIEnv* env, jclass, jint id) +{ // DIOJNI_LOG(logDEBUG) << "Calling DIOJNI getDIO"; // DIOJNI_LOG(logDEBUG) << "Port Handle = " << (HAL_DigitalHandle)id; int32_t status = 0; @@ -126,11 +138,12 @@ Java_edu_wpi_first_wpilibj_hal_DIOJNI_getDIO(JNIEnv *env, jclass, jint id) { /* * Class: edu_wpi_first_wpilibj_hal_DIOJNI * Method: getDIODirection - * Signature: (J)Z + * Signature: (I)Z */ JNIEXPORT jboolean JNICALL -Java_edu_wpi_first_wpilibj_hal_DIOJNI_getDIODirection( - JNIEnv *env, jclass, jint id) { +Java_edu_wpi_first_wpilibj_hal_DIOJNI_getDIODirection + (JNIEnv* env, jclass, jint id) +{ DIOJNI_LOG(logDEBUG) << "Calling DIOJNI getDIODirection (RR upd)"; // DIOJNI_LOG(logDEBUG) << "Port Handle = " << (HAL_DigitalHandle)id; int32_t status = 0; @@ -144,10 +157,12 @@ Java_edu_wpi_first_wpilibj_hal_DIOJNI_getDIODirection( /* * Class: edu_wpi_first_wpilibj_hal_DIOJNI * Method: pulse - * Signature: (JD)V + * Signature: (ID)V */ -JNIEXPORT void JNICALL Java_edu_wpi_first_wpilibj_hal_DIOJNI_pulse( - JNIEnv *env, jclass, jint id, jdouble value) { +JNIEXPORT void JNICALL +Java_edu_wpi_first_wpilibj_hal_DIOJNI_pulse + (JNIEnv* env, jclass, jint id, jdouble value) +{ DIOJNI_LOG(logDEBUG) << "Calling DIOJNI pulse (RR upd)"; // DIOJNI_LOG(logDEBUG) << "Port Handle = " << (HAL_DigitalHandle)id; // DIOJNI_LOG(logDEBUG) << "Value = " << value; @@ -160,10 +175,12 @@ JNIEXPORT void JNICALL Java_edu_wpi_first_wpilibj_hal_DIOJNI_pulse( /* * Class: edu_wpi_first_wpilibj_hal_DIOJNI * Method: isPulsing - * Signature: (J)Z + * Signature: (I)Z */ JNIEXPORT jboolean JNICALL -Java_edu_wpi_first_wpilibj_hal_DIOJNI_isPulsing(JNIEnv *env, jclass, jint id) { +Java_edu_wpi_first_wpilibj_hal_DIOJNI_isPulsing + (JNIEnv* env, jclass, jint id) +{ DIOJNI_LOG(logDEBUG) << "Calling DIOJNI isPulsing (RR upd)"; // DIOJNI_LOG(logDEBUG) << "Port Handle = " << (HAL_DigitalHandle)id; int32_t status = 0; @@ -180,7 +197,9 @@ Java_edu_wpi_first_wpilibj_hal_DIOJNI_isPulsing(JNIEnv *env, jclass, jint id) { * Signature: ()Z */ JNIEXPORT jboolean JNICALL -Java_edu_wpi_first_wpilibj_hal_DIOJNI_isAnyPulsing(JNIEnv *env, jclass) { +Java_edu_wpi_first_wpilibj_hal_DIOJNI_isAnyPulsing + (JNIEnv* env, jclass) +{ DIOJNI_LOG(logDEBUG) << "Calling DIOJNI isAnyPulsing (RR upd)"; int32_t status = 0; jboolean returnValue = HAL_IsAnyPulsing(&status); @@ -196,7 +215,9 @@ Java_edu_wpi_first_wpilibj_hal_DIOJNI_isAnyPulsing(JNIEnv *env, jclass) { * Signature: ()S */ JNIEXPORT jshort JNICALL -Java_edu_wpi_first_wpilibj_hal_DIOJNI_getLoopTiming(JNIEnv *env, jclass) { +Java_edu_wpi_first_wpilibj_hal_DIOJNI_getLoopTiming + (JNIEnv* env, jclass) +{ DIOJNI_LOG(logDEBUG) << "Calling DIOJNI getLoopTimeing"; int32_t status = 0; jshort returnValue = HAL_GetPWMLoopTiming(&status); @@ -206,14 +227,15 @@ Java_edu_wpi_first_wpilibj_hal_DIOJNI_getLoopTiming(JNIEnv *env, jclass) { return returnValue; } - /* * Class: edu_wpi_first_wpilibj_hal_DIOJNI * Method: allocateDigitalPWM * Signature: ()I */ JNIEXPORT jint JNICALL -Java_edu_wpi_first_wpilibj_hal_DIOJNI_allocateDigitalPWM(JNIEnv* env, jclass) { +Java_edu_wpi_first_wpilibj_hal_DIOJNI_allocateDigitalPWM + (JNIEnv* env, jclass) +{ DIOJNI_LOG(logDEBUG) << "Calling DIOJNI allocateDigitalPWM"; int32_t status = 0; auto pwm = HAL_AllocateDigitalPWM(&status); @@ -229,7 +251,9 @@ Java_edu_wpi_first_wpilibj_hal_DIOJNI_allocateDigitalPWM(JNIEnv* env, jclass) { * Signature: (I)V */ JNIEXPORT void JNICALL -Java_edu_wpi_first_wpilibj_hal_DIOJNI_freeDigitalPWM(JNIEnv* env, jclass, jint id) { +Java_edu_wpi_first_wpilibj_hal_DIOJNI_freeDigitalPWM + (JNIEnv* env, jclass, jint id) +{ DIOJNI_LOG(logDEBUG) << "Calling DIOJNI freeDigitalPWM"; DIOJNI_LOG(logDEBUG) << "PWM Handle = " << (HAL_DigitalPWMHandle)id; int32_t status = 0; @@ -243,8 +267,10 @@ Java_edu_wpi_first_wpilibj_hal_DIOJNI_freeDigitalPWM(JNIEnv* env, jclass, jint i * Method: setDigitalPWMRate * Signature: (D)V */ -JNIEXPORT void JNICALL Java_edu_wpi_first_wpilibj_hal_DIOJNI_setDigitalPWMRate( - JNIEnv* env, jclass, jdouble value) { +JNIEXPORT void JNICALL +Java_edu_wpi_first_wpilibj_hal_DIOJNI_setDigitalPWMRate + (JNIEnv* env, jclass, jdouble value) +{ DIOJNI_LOG(logDEBUG) << "Calling DIOJNI setDigitalPWMRate"; DIOJNI_LOG(logDEBUG) << "Rate= " << value; int32_t status = 0; @@ -258,8 +284,10 @@ JNIEXPORT void JNICALL Java_edu_wpi_first_wpilibj_hal_DIOJNI_setDigitalPWMRate( * Method: setDigitalPWMDutyCycle * Signature: (ID)V */ -JNIEXPORT void JNICALL Java_edu_wpi_first_wpilibj_hal_DIOJNI_setDigitalPWMDutyCycle( - JNIEnv* env, jclass, jint id, jdouble value) { +JNIEXPORT void JNICALL +Java_edu_wpi_first_wpilibj_hal_DIOJNI_setDigitalPWMDutyCycle + (JNIEnv* env, jclass, jint id, jdouble value) +{ DIOJNI_LOG(logDEBUG) << "Calling DIOJNI setDigitalPWMDutyCycle"; DIOJNI_LOG(logDEBUG) << "PWM Handle = " << (HAL_DigitalPWMHandle)id; DIOJNI_LOG(logDEBUG) << "DutyCycle= " << value; @@ -275,13 +303,15 @@ JNIEXPORT void JNICALL Java_edu_wpi_first_wpilibj_hal_DIOJNI_setDigitalPWMDutyCy * Signature: (II)V */ JNIEXPORT void JNICALL -Java_edu_wpi_first_wpilibj_hal_DIOJNI_setDigitalPWMOutputChannel( - JNIEnv* env, jclass, jint id, jint value) { +Java_edu_wpi_first_wpilibj_hal_DIOJNI_setDigitalPWMOutputChannel + (JNIEnv* env, jclass, jint id, jint value) +{ DIOJNI_LOG(logDEBUG) << "Calling DIOJNI setDigitalPWMOutputChannel"; DIOJNI_LOG(logDEBUG) << "PWM Handle = " << (HAL_DigitalPWMHandle)id; DIOJNI_LOG(logDEBUG) << "Channel= " << value; int32_t status = 0; - HAL_SetDigitalPWMOutputChannel((HAL_DigitalPWMHandle)id, (uint32_t)value, &status); + HAL_SetDigitalPWMOutputChannel((HAL_DigitalPWMHandle)id, + static_cast(value), &status); DIOJNI_LOG(logDEBUG) << "Status = " << status; CheckStatus(env, status); } diff --git a/hal/src/main/native/cpp/jni/DigitalGlitchFilterJNI.cpp b/hal/src/main/native/cpp/jni/DigitalGlitchFilterJNI.cpp index 8e5ed23e43..746e3c5de0 100644 --- a/hal/src/main/native/cpp/jni/DigitalGlitchFilterJNI.cpp +++ b/hal/src/main/native/cpp/jni/DigitalGlitchFilterJNI.cpp @@ -1,14 +1,14 @@ /*----------------------------------------------------------------------------*/ -/* Copyright (c) FIRST 2016. All Rights Reserved. */ +/* Copyright (c) 2016-2018 FIRST. 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. */ /*----------------------------------------------------------------------------*/ #include + #include "HAL/DIO.h" #include "HALUtil.h" - #include "edu_wpi_first_wpilibj_hal_DigitalGlitchFilterJNI.h" using namespace frc; @@ -16,10 +16,12 @@ using namespace frc; /* * Class: edu_wpi_first_wpilibj_hal_DigitalGlitchFilterJNI * Method: setFilterSelect + * Signature: (II)V */ JNIEXPORT void JNICALL -Java_edu_wpi_first_wpilibj_hal_DigitalGlitchFilterJNI_setFilterSelect( - JNIEnv* env, jclass, jint id, jint filter_index) { +Java_edu_wpi_first_wpilibj_hal_DigitalGlitchFilterJNI_setFilterSelect + (JNIEnv* env, jclass, jint id, jint filter_index) +{ int32_t status = 0; HAL_SetFilterSelect(static_cast(id), filter_index, @@ -30,10 +32,12 @@ Java_edu_wpi_first_wpilibj_hal_DigitalGlitchFilterJNI_setFilterSelect( /* * Class: edu_wpi_first_wpilibj_hal_DigitalGlitchFilterJNI * Method: getFilterSelect + * Signature: (I)I */ JNIEXPORT jint JNICALL -Java_edu_wpi_first_wpilibj_hal_DigitalGlitchFilterJNI_getFilterSelect( - JNIEnv* env, jclass, jint id) { +Java_edu_wpi_first_wpilibj_hal_DigitalGlitchFilterJNI_getFilterSelect + (JNIEnv* env, jclass, jint id) +{ int32_t status = 0; jint result = @@ -45,10 +49,12 @@ Java_edu_wpi_first_wpilibj_hal_DigitalGlitchFilterJNI_getFilterSelect( /* * Class: edu_wpi_first_wpilibj_hal_DigitalGlitchFilterJNI * Method: setFilterPeriod + * Signature: (II)V */ JNIEXPORT void JNICALL -Java_edu_wpi_first_wpilibj_hal_DigitalGlitchFilterJNI_setFilterPeriod( - JNIEnv* env, jclass, jint filter_index, jint fpga_cycles) { +Java_edu_wpi_first_wpilibj_hal_DigitalGlitchFilterJNI_setFilterPeriod + (JNIEnv* env, jclass, jint filter_index, jint fpga_cycles) +{ int32_t status = 0; HAL_SetFilterPeriod(filter_index, fpga_cycles, &status); @@ -58,10 +64,12 @@ Java_edu_wpi_first_wpilibj_hal_DigitalGlitchFilterJNI_setFilterPeriod( /* * Class: edu_wpi_first_wpilibj_hal_DigitalGlitchFilterJNI * Method: getFilterPeriod + * Signature: (I)I */ JNIEXPORT jint JNICALL -Java_edu_wpi_first_wpilibj_hal_DigitalGlitchFilterJNI_getFilterPeriod( - JNIEnv* env, jclass, jint filter_index) { +Java_edu_wpi_first_wpilibj_hal_DigitalGlitchFilterJNI_getFilterPeriod + (JNIEnv* env, jclass, jint filter_index) +{ int32_t status = 0; jint result = HAL_GetFilterPeriod(filter_index, &status); diff --git a/hal/src/main/native/cpp/jni/EncoderJNI.cpp b/hal/src/main/native/cpp/jni/EncoderJNI.cpp index 30bce240a4..1dc3194d50 100644 --- a/hal/src/main/native/cpp/jni/EncoderJNI.cpp +++ b/hal/src/main/native/cpp/jni/EncoderJNI.cpp @@ -1,19 +1,19 @@ /*----------------------------------------------------------------------------*/ -/* Copyright (c) FIRST 2016. All Rights Reserved. */ +/* Copyright (c) 2016-2018 FIRST. 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. */ /*----------------------------------------------------------------------------*/ -#include #include -#include "HAL/cpp/Log.h" -#include "edu_wpi_first_wpilibj_hal_EncoderJNI.h" +#include #include "HAL/Encoder.h" #include "HAL/Errors.h" +#include "HAL/cpp/Log.h" #include "HALUtil.h" +#include "edu_wpi_first_wpilibj_hal_EncoderJNI.h" using namespace frc; @@ -24,7 +24,7 @@ TLogLevel encoderJNILogLevel = logWARNING; if (level > encoderJNILogLevel) \ ; \ else \ - Log().Get(level) + Log().Get(level) extern "C" { @@ -34,24 +34,25 @@ extern "C" { * Signature: (IIIIZI)I */ JNIEXPORT jint JNICALL -Java_edu_wpi_first_wpilibj_hal_EncoderJNI_initializeEncoder( - JNIEnv* env, jclass, jint digitalSourceHandleA, jint analogTriggerTypeA, - jint digitalSourceHandleB, jint analogTriggerTypeB, jboolean reverseDirection, - jint encodingType) { +Java_edu_wpi_first_wpilibj_hal_EncoderJNI_initializeEncoder + (JNIEnv* env, jclass, jint digitalSourceHandleA, jint analogTriggerTypeA, + jint digitalSourceHandleB, jint analogTriggerTypeB, + jboolean reverseDirection, jint encodingType) +{ ENCODERJNI_LOG(logDEBUG) << "Calling ENCODERJNI initializeEncoder"; ENCODERJNI_LOG(logDEBUG) << "Source Handle A = " << digitalSourceHandleA; - ENCODERJNI_LOG(logDEBUG) << "Analog Trigger Type A = " - << analogTriggerTypeA; + ENCODERJNI_LOG(logDEBUG) << "Analog Trigger Type A = " << analogTriggerTypeA; ENCODERJNI_LOG(logDEBUG) << "Source Handle B = " << digitalSourceHandleB; - ENCODERJNI_LOG(logDEBUG) << "Analog Trigger Type B = " - << analogTriggerTypeB; + ENCODERJNI_LOG(logDEBUG) << "Analog Trigger Type B = " << analogTriggerTypeB; ENCODERJNI_LOG(logDEBUG) << "Reverse direction = " << (jint)reverseDirection; ENCODERJNI_LOG(logDEBUG) << "EncodingType = " << encodingType; int32_t status = 0; auto encoder = HAL_InitializeEncoder( - (HAL_Handle)digitalSourceHandleA, (HAL_AnalogTriggerType)analogTriggerTypeA, - (HAL_Handle)digitalSourceHandleB, (HAL_AnalogTriggerType)analogTriggerTypeB, - reverseDirection, (HAL_EncoderEncodingType)encodingType, &status); + (HAL_Handle)digitalSourceHandleA, + (HAL_AnalogTriggerType)analogTriggerTypeA, + (HAL_Handle)digitalSourceHandleB, + (HAL_AnalogTriggerType)analogTriggerTypeB, reverseDirection, + (HAL_EncoderEncodingType)encodingType, &status); ENCODERJNI_LOG(logDEBUG) << "Status = " << status; ENCODERJNI_LOG(logDEBUG) << "ENCODER Handle = " << encoder; @@ -64,8 +65,10 @@ Java_edu_wpi_first_wpilibj_hal_EncoderJNI_initializeEncoder( * Method: freeEncoder * Signature: (I)V */ -JNIEXPORT void JNICALL Java_edu_wpi_first_wpilibj_hal_EncoderJNI_freeEncoder( - JNIEnv* env, jclass, jint id) { +JNIEXPORT void JNICALL +Java_edu_wpi_first_wpilibj_hal_EncoderJNI_freeEncoder + (JNIEnv* env, jclass, jint id) +{ ENCODERJNI_LOG(logDEBUG) << "Calling ENCODERJNI freeEncoder"; ENCODERJNI_LOG(logDEBUG) << "Encoder Handle = " << (HAL_EncoderHandle)id; int32_t status = 0; @@ -79,8 +82,10 @@ JNIEXPORT void JNICALL Java_edu_wpi_first_wpilibj_hal_EncoderJNI_freeEncoder( * Method: getEncoder * Signature: (I)I */ -JNIEXPORT jint JNICALL Java_edu_wpi_first_wpilibj_hal_EncoderJNI_getEncoder( - JNIEnv* env, jclass, jint id) { +JNIEXPORT jint JNICALL +Java_edu_wpi_first_wpilibj_hal_EncoderJNI_getEncoder + (JNIEnv* env, jclass, jint id) +{ ENCODERJNI_LOG(logDEBUG) << "Calling ENCODERJNI getEncoder"; ENCODERJNI_LOG(logDEBUG) << "Encoder Handle = " << (HAL_EncoderHandle)id; int32_t status = 0; @@ -96,8 +101,10 @@ JNIEXPORT jint JNICALL Java_edu_wpi_first_wpilibj_hal_EncoderJNI_getEncoder( * Method: getEncoderRaw * Signature: (I)I */ -JNIEXPORT jint JNICALL Java_edu_wpi_first_wpilibj_hal_EncoderJNI_getEncoderRaw( - JNIEnv* env, jclass, jint id) { +JNIEXPORT jint JNICALL +Java_edu_wpi_first_wpilibj_hal_EncoderJNI_getEncoderRaw + (JNIEnv* env, jclass, jint id) +{ ENCODERJNI_LOG(logDEBUG) << "Calling ENCODERJNI getEncoderRaw"; ENCODERJNI_LOG(logDEBUG) << "Encoder Handle = " << (HAL_EncoderHandle)id; int32_t status = 0; @@ -113,12 +120,15 @@ JNIEXPORT jint JNICALL Java_edu_wpi_first_wpilibj_hal_EncoderJNI_getEncoderRaw( * Method: getEncodingScaleFactor * Signature: (I)I */ -JNIEXPORT jint JNICALL Java_edu_wpi_first_wpilibj_hal_EncoderJNI_getEncodingScaleFactor( - JNIEnv* env, jclass, jint id) { +JNIEXPORT jint JNICALL +Java_edu_wpi_first_wpilibj_hal_EncoderJNI_getEncodingScaleFactor + (JNIEnv* env, jclass, jint id) +{ ENCODERJNI_LOG(logDEBUG) << "Calling ENCODERJNI getEncodingScaleFactor"; ENCODERJNI_LOG(logDEBUG) << "Encoder Handle = " << (HAL_EncoderHandle)id; int32_t status = 0; - jint returnValue = HAL_GetEncoderEncodingScale((HAL_EncoderHandle)id, &status); + jint returnValue = + HAL_GetEncoderEncodingScale((HAL_EncoderHandle)id, &status); ENCODERJNI_LOG(logDEBUG) << "Status = " << status; ENCODERJNI_LOG(logDEBUG) << "getEncodingScaleFactorResult = " << returnValue; CheckStatus(env, status); @@ -130,8 +140,10 @@ JNIEXPORT jint JNICALL Java_edu_wpi_first_wpilibj_hal_EncoderJNI_getEncodingScal * Method: resetEncoder * Signature: (I)V */ -JNIEXPORT void JNICALL Java_edu_wpi_first_wpilibj_hal_EncoderJNI_resetEncoder( - JNIEnv* env, jclass, jint id) { +JNIEXPORT void JNICALL +Java_edu_wpi_first_wpilibj_hal_EncoderJNI_resetEncoder + (JNIEnv* env, jclass, jint id) +{ ENCODERJNI_LOG(logDEBUG) << "Calling ENCODERJNI resetEncoder"; ENCODERJNI_LOG(logDEBUG) << "Encoder Handle = " << (HAL_EncoderHandle)id; int32_t status = 0; @@ -146,8 +158,9 @@ JNIEXPORT void JNICALL Java_edu_wpi_first_wpilibj_hal_EncoderJNI_resetEncoder( * Signature: (I)D */ JNIEXPORT jdouble JNICALL -Java_edu_wpi_first_wpilibj_hal_EncoderJNI_getEncoderPeriod( - JNIEnv* env, jclass, jint id) { +Java_edu_wpi_first_wpilibj_hal_EncoderJNI_getEncoderPeriod + (JNIEnv* env, jclass, jint id) +{ ENCODERJNI_LOG(logDEBUG) << "Calling ENCODERJNI getEncoderPeriod"; ENCODERJNI_LOG(logDEBUG) << "Encoder Handle = " << (HAL_EncoderHandle)id; int32_t status = 0; @@ -164,8 +177,9 @@ Java_edu_wpi_first_wpilibj_hal_EncoderJNI_getEncoderPeriod( * Signature: (ID)V */ JNIEXPORT void JNICALL -Java_edu_wpi_first_wpilibj_hal_EncoderJNI_setEncoderMaxPeriod( - JNIEnv* env, jclass, jint id, jdouble value) { +Java_edu_wpi_first_wpilibj_hal_EncoderJNI_setEncoderMaxPeriod + (JNIEnv* env, jclass, jint id, jdouble value) +{ ENCODERJNI_LOG(logDEBUG) << "Calling ENCODERJNI setEncoderMaxPeriod"; ENCODERJNI_LOG(logDEBUG) << "Encoder Handle = " << (HAL_EncoderHandle)id; int32_t status = 0; @@ -180,8 +194,9 @@ Java_edu_wpi_first_wpilibj_hal_EncoderJNI_setEncoderMaxPeriod( * Signature: (I)Z */ JNIEXPORT jboolean JNICALL -Java_edu_wpi_first_wpilibj_hal_EncoderJNI_getEncoderStopped( - JNIEnv* env, jclass, jint id) { +Java_edu_wpi_first_wpilibj_hal_EncoderJNI_getEncoderStopped + (JNIEnv* env, jclass, jint id) +{ ENCODERJNI_LOG(logDEBUG) << "Calling ENCODERJNI getEncoderStopped"; ENCODERJNI_LOG(logDEBUG) << "Encoder Handle = " << (HAL_EncoderHandle)id; int32_t status = 0; @@ -198,12 +213,14 @@ Java_edu_wpi_first_wpilibj_hal_EncoderJNI_getEncoderStopped( * Signature: (I)Z */ JNIEXPORT jboolean JNICALL -Java_edu_wpi_first_wpilibj_hal_EncoderJNI_getEncoderDirection( - JNIEnv* env, jclass, jint id) { +Java_edu_wpi_first_wpilibj_hal_EncoderJNI_getEncoderDirection + (JNIEnv* env, jclass, jint id) +{ ENCODERJNI_LOG(logDEBUG) << "Calling ENCODERJNI getEncoderDirection"; ENCODERJNI_LOG(logDEBUG) << "Encoder Handle = " << (HAL_EncoderHandle)id; int32_t status = 0; - jboolean returnValue = HAL_GetEncoderDirection((HAL_EncoderHandle)id, &status); + jboolean returnValue = + HAL_GetEncoderDirection((HAL_EncoderHandle)id, &status); ENCODERJNI_LOG(logDEBUG) << "Status = " << status; ENCODERJNI_LOG(logDEBUG) << "getDirectionEncoderResult = " << returnValue; CheckStatus(env, status); @@ -216,8 +233,9 @@ Java_edu_wpi_first_wpilibj_hal_EncoderJNI_getEncoderDirection( * Signature: (I)D */ JNIEXPORT jdouble JNICALL -Java_edu_wpi_first_wpilibj_hal_EncoderJNI_getEncoderDistance( - JNIEnv* env, jclass, jint id) { +Java_edu_wpi_first_wpilibj_hal_EncoderJNI_getEncoderDistance + (JNIEnv* env, jclass, jint id) +{ ENCODERJNI_LOG(logDEBUG) << "Calling ENCODERJNI getEncoderDistance"; ENCODERJNI_LOG(logDEBUG) << "Encoder Handle = " << (HAL_EncoderHandle)id; int32_t status = 0; @@ -234,8 +252,9 @@ Java_edu_wpi_first_wpilibj_hal_EncoderJNI_getEncoderDistance( * Signature: (I)D */ JNIEXPORT jdouble JNICALL -Java_edu_wpi_first_wpilibj_hal_EncoderJNI_getEncoderRate( - JNIEnv* env, jclass, jint id) { +Java_edu_wpi_first_wpilibj_hal_EncoderJNI_getEncoderRate + (JNIEnv* env, jclass, jint id) +{ ENCODERJNI_LOG(logDEBUG) << "Calling ENCODERJNI getEncoderRate"; ENCODERJNI_LOG(logDEBUG) << "Encoder Handle = " << (HAL_EncoderHandle)id; int32_t status = 0; @@ -252,8 +271,9 @@ Java_edu_wpi_first_wpilibj_hal_EncoderJNI_getEncoderRate( * Signature: (ID)V */ JNIEXPORT void JNICALL -Java_edu_wpi_first_wpilibj_hal_EncoderJNI_setEncoderMinRate( - JNIEnv* env, jclass, jint id, jdouble value) { +Java_edu_wpi_first_wpilibj_hal_EncoderJNI_setEncoderMinRate + (JNIEnv* env, jclass, jint id, jdouble value) +{ ENCODERJNI_LOG(logDEBUG) << "Calling ENCODERJNI setEncoderMinRate"; ENCODERJNI_LOG(logDEBUG) << "Encoder Handle = " << (HAL_EncoderHandle)id; int32_t status = 0; @@ -268,8 +288,9 @@ Java_edu_wpi_first_wpilibj_hal_EncoderJNI_setEncoderMinRate( * Signature: (ID)V */ JNIEXPORT void JNICALL -Java_edu_wpi_first_wpilibj_hal_EncoderJNI_setEncoderDistancePerPulse( - JNIEnv* env, jclass, jint id, jdouble value) { +Java_edu_wpi_first_wpilibj_hal_EncoderJNI_setEncoderDistancePerPulse + (JNIEnv* env, jclass, jint id, jdouble value) +{ ENCODERJNI_LOG(logDEBUG) << "Calling ENCODERJNI setEncoderDistancePerPulse"; ENCODERJNI_LOG(logDEBUG) << "Encoder Handle = " << (HAL_EncoderHandle)id; int32_t status = 0; @@ -284,8 +305,9 @@ Java_edu_wpi_first_wpilibj_hal_EncoderJNI_setEncoderDistancePerPulse( * Signature: (IZ)V */ JNIEXPORT void JNICALL -Java_edu_wpi_first_wpilibj_hal_EncoderJNI_setEncoderReverseDirection( - JNIEnv* env, jclass, jint id, jboolean value) { +Java_edu_wpi_first_wpilibj_hal_EncoderJNI_setEncoderReverseDirection + (JNIEnv* env, jclass, jint id, jboolean value) +{ ENCODERJNI_LOG(logDEBUG) << "Calling ENCODERJNI setEncoderReverseDirection"; ENCODERJNI_LOG(logDEBUG) << "Encoder Handle = " << (HAL_EncoderHandle)id; int32_t status = 0; @@ -300,8 +322,9 @@ Java_edu_wpi_first_wpilibj_hal_EncoderJNI_setEncoderReverseDirection( * Signature: (II)V */ JNIEXPORT void JNICALL -Java_edu_wpi_first_wpilibj_hal_EncoderJNI_setEncoderSamplesToAverage( - JNIEnv* env, jclass, jint id, jint value) { +Java_edu_wpi_first_wpilibj_hal_EncoderJNI_setEncoderSamplesToAverage + (JNIEnv* env, jclass, jint id, jint value) +{ ENCODERJNI_LOG(logDEBUG) << "Calling ENCODERJNI setEncoderSamplesToAverage"; ENCODERJNI_LOG(logDEBUG) << "Encoder Handle = " << (HAL_EncoderHandle)id; int32_t status = 0; @@ -320,12 +343,14 @@ Java_edu_wpi_first_wpilibj_hal_EncoderJNI_setEncoderSamplesToAverage( * Signature: (I)I */ JNIEXPORT jint JNICALL -Java_edu_wpi_first_wpilibj_hal_EncoderJNI_getEncoderSamplesToAverage( - JNIEnv* env, jclass, jint id) { +Java_edu_wpi_first_wpilibj_hal_EncoderJNI_getEncoderSamplesToAverage + (JNIEnv* env, jclass, jint id) +{ ENCODERJNI_LOG(logDEBUG) << "Calling ENCODERJNI getEncoderSamplesToAverage"; ENCODERJNI_LOG(logDEBUG) << "Encoder Handle = " << (HAL_EncoderHandle)id; int32_t status = 0; - jint returnValue = HAL_GetEncoderSamplesToAverage((HAL_EncoderHandle)id, &status); + jint returnValue = + HAL_GetEncoderSamplesToAverage((HAL_EncoderHandle)id, &status); ENCODERJNI_LOG(logDEBUG) << "Status = " << status; ENCODERJNI_LOG(logDEBUG) << "getEncoderSamplesToAverageResult = " << returnValue; @@ -339,17 +364,18 @@ Java_edu_wpi_first_wpilibj_hal_EncoderJNI_getEncoderSamplesToAverage( * Signature: (IIII)V */ JNIEXPORT void JNICALL -Java_edu_wpi_first_wpilibj_hal_EncoderJNI_setEncoderIndexSource( - JNIEnv* env, jclass, jint id, jint digitalSourceHandle, - jint analogTriggerType, jint type) { +Java_edu_wpi_first_wpilibj_hal_EncoderJNI_setEncoderIndexSource + (JNIEnv* env, jclass, jint id, jint digitalSourceHandle, + jint analogTriggerType, jint type) +{ ENCODERJNI_LOG(logDEBUG) << "Calling ENCODERJNI setEncoderIndexSource"; ENCODERJNI_LOG(logDEBUG) << "Encoder Handle = " << (HAL_EncoderHandle)id; ENCODERJNI_LOG(logDEBUG) << "Source Handle = " << digitalSourceHandle; - ENCODERJNI_LOG(logDEBUG) << "Analog Trigger Type = " - << analogTriggerType; + ENCODERJNI_LOG(logDEBUG) << "Analog Trigger Type = " << analogTriggerType; ENCODERJNI_LOG(logDEBUG) << "IndexingType = " << type; int32_t status = 0; - HAL_SetEncoderIndexSource((HAL_EncoderHandle)id, (HAL_Handle)digitalSourceHandle, + HAL_SetEncoderIndexSource((HAL_EncoderHandle)id, + (HAL_Handle)digitalSourceHandle, (HAL_AnalogTriggerType)analogTriggerType, (HAL_EncoderIndexingType)type, &status); ENCODERJNI_LOG(logDEBUG) << "Status = " << status; @@ -362,8 +388,9 @@ Java_edu_wpi_first_wpilibj_hal_EncoderJNI_setEncoderIndexSource( * Signature: (I)I */ JNIEXPORT jint JNICALL -Java_edu_wpi_first_wpilibj_hal_EncoderJNI_getEncoderFPGAIndex( - JNIEnv* env, jclass, jint id) { +Java_edu_wpi_first_wpilibj_hal_EncoderJNI_getEncoderFPGAIndex + (JNIEnv* env, jclass, jint id) +{ ENCODERJNI_LOG(logDEBUG) << "Calling ENCODERJNI getEncoderSamplesToAverage"; ENCODERJNI_LOG(logDEBUG) << "Encoder Handle = " << (HAL_EncoderHandle)id; int32_t status = 0; @@ -381,12 +408,14 @@ Java_edu_wpi_first_wpilibj_hal_EncoderJNI_getEncoderFPGAIndex( * Signature: (I)I */ JNIEXPORT jint JNICALL -Java_edu_wpi_first_wpilibj_hal_EncoderJNI_getEncoderEncodingScale( - JNIEnv* env, jclass, jint id) { +Java_edu_wpi_first_wpilibj_hal_EncoderJNI_getEncoderEncodingScale + (JNIEnv* env, jclass, jint id) +{ ENCODERJNI_LOG(logDEBUG) << "Calling ENCODERJNI getEncoderSamplesToAverage"; ENCODERJNI_LOG(logDEBUG) << "Encoder Handle = " << (HAL_EncoderHandle)id; int32_t status = 0; - jint returnValue = HAL_GetEncoderEncodingScale((HAL_EncoderHandle)id, &status); + jint returnValue = + HAL_GetEncoderEncodingScale((HAL_EncoderHandle)id, &status); ENCODERJNI_LOG(logDEBUG) << "Status = " << status; ENCODERJNI_LOG(logDEBUG) << "getEncoderSamplesToAverageResult = " << returnValue; @@ -400,12 +429,14 @@ Java_edu_wpi_first_wpilibj_hal_EncoderJNI_getEncoderEncodingScale( * Signature: (I)D */ JNIEXPORT jdouble JNICALL -Java_edu_wpi_first_wpilibj_hal_EncoderJNI_getEncoderDecodingScaleFactor( - JNIEnv* env, jclass, jint id) { +Java_edu_wpi_first_wpilibj_hal_EncoderJNI_getEncoderDecodingScaleFactor + (JNIEnv* env, jclass, jint id) +{ ENCODERJNI_LOG(logDEBUG) << "Calling ENCODERJNI getEncoderSamplesToAverage"; ENCODERJNI_LOG(logDEBUG) << "Encoder Handle = " << (HAL_EncoderHandle)id; int32_t status = 0; - jdouble returnValue = HAL_GetEncoderDecodingScaleFactor((HAL_EncoderHandle)id, &status); + jdouble returnValue = + HAL_GetEncoderDecodingScaleFactor((HAL_EncoderHandle)id, &status); ENCODERJNI_LOG(logDEBUG) << "Status = " << status; ENCODERJNI_LOG(logDEBUG) << "getEncoderSamplesToAverageResult = " << returnValue; @@ -419,12 +450,14 @@ Java_edu_wpi_first_wpilibj_hal_EncoderJNI_getEncoderDecodingScaleFactor( * Signature: (I)D */ JNIEXPORT jdouble JNICALL -Java_edu_wpi_first_wpilibj_hal_EncoderJNI_getEncoderDistancePerPulse( - JNIEnv* env, jclass, jint id) { +Java_edu_wpi_first_wpilibj_hal_EncoderJNI_getEncoderDistancePerPulse + (JNIEnv* env, jclass, jint id) +{ ENCODERJNI_LOG(logDEBUG) << "Calling ENCODERJNI getEncoderSamplesToAverage"; ENCODERJNI_LOG(logDEBUG) << "Encoder Handle = " << (HAL_EncoderHandle)id; int32_t status = 0; - jdouble returnValue = HAL_GetEncoderDistancePerPulse((HAL_EncoderHandle)id, &status); + jdouble returnValue = + HAL_GetEncoderDistancePerPulse((HAL_EncoderHandle)id, &status); ENCODERJNI_LOG(logDEBUG) << "Status = " << status; ENCODERJNI_LOG(logDEBUG) << "getEncoderSamplesToAverageResult = " << returnValue; @@ -438,8 +471,9 @@ Java_edu_wpi_first_wpilibj_hal_EncoderJNI_getEncoderDistancePerPulse( * Signature: (I)I */ JNIEXPORT jint JNICALL -Java_edu_wpi_first_wpilibj_hal_EncoderJNI_getEncoderEncodingType( - JNIEnv* env, jclass, jint id) { +Java_edu_wpi_first_wpilibj_hal_EncoderJNI_getEncoderEncodingType + (JNIEnv* env, jclass, jint id) +{ ENCODERJNI_LOG(logDEBUG) << "Calling ENCODERJNI getEncoderSamplesToAverage"; ENCODERJNI_LOG(logDEBUG) << "Encoder Handle = " << (HAL_EncoderHandle)id; int32_t status = 0; diff --git a/hal/src/main/native/cpp/jni/HAL.cpp b/hal/src/main/native/cpp/jni/HAL.cpp index ac02ab9975..099bf35e6d 100644 --- a/hal/src/main/native/cpp/jni/HAL.cpp +++ b/hal/src/main/native/cpp/jni/HAL.cpp @@ -1,21 +1,23 @@ /*----------------------------------------------------------------------------*/ -/* Copyright (c) FIRST 2016. All Rights Reserved. */ +/* Copyright (c) 2016-2018 FIRST. 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. */ /*----------------------------------------------------------------------------*/ +#include "HAL/HAL.h" + +#include + +#include #include -#include -#include -#include "HAL/cpp/Log.h" +#include -#include "HAL/HAL.h" #include "HAL/DriverStation.h" -#include "edu_wpi_first_wpilibj_hal_HAL.h" +#include "HAL/cpp/Log.h" #include "HALUtil.h" -#include "wpi/jni_util.h" +#include "edu_wpi_first_wpilibj_hal_HAL.h" using namespace frc; using namespace wpi::java; @@ -27,101 +29,115 @@ static TLogLevel netCommLogLevel = logWARNING; if (level > netCommLogLevel) \ ; \ else \ - Log().Get(level) + Log().Get(level) extern "C" { /* - * Class: edu_wpi_first_wpilibj_hal_HAL - * Method: Initialize - * Signature: (Z)II + * Class: edu_wpi_first_wpilibj_hal_HAL + * Method: initialize + * Signature: (II)Z */ JNIEXPORT jboolean JNICALL -Java_edu_wpi_first_wpilibj_hal_HAL_initialize(JNIEnv*, jclass, jint timeout, jint mode) { +Java_edu_wpi_first_wpilibj_hal_HAL_initialize + (JNIEnv*, jclass, jint timeout, jint mode) +{ return HAL_Initialize(timeout, mode); } /* - * Class: edu_wpi_first_wpilibj_hal_HAL + * Class: edu_wpi_first_wpilibj_hal_HAL * Method: observeUserProgramStarting * Signature: ()V */ JNIEXPORT void JNICALL -Java_edu_wpi_first_wpilibj_hal_HAL_observeUserProgramStarting(JNIEnv*, jclass) { +Java_edu_wpi_first_wpilibj_hal_HAL_observeUserProgramStarting + (JNIEnv*, jclass) +{ HAL_ObserveUserProgramStarting(); } /* - * Class: edu_wpi_first_wpilibj_hal_HAL + * Class: edu_wpi_first_wpilibj_hal_HAL * Method: observeUserProgramDisabled * Signature: ()V */ JNIEXPORT void JNICALL -Java_edu_wpi_first_wpilibj_hal_HAL_observeUserProgramDisabled(JNIEnv*, jclass) { +Java_edu_wpi_first_wpilibj_hal_HAL_observeUserProgramDisabled + (JNIEnv*, jclass) +{ HAL_ObserveUserProgramDisabled(); } /* - * Class: edu_wpi_first_wpilibj_hal_HAL + * Class: edu_wpi_first_wpilibj_hal_HAL * Method: observeUserProgramAutonomous * Signature: ()V */ JNIEXPORT void JNICALL -Java_edu_wpi_first_wpilibj_hal_HAL_observeUserProgramAutonomous( - JNIEnv*, jclass) { +Java_edu_wpi_first_wpilibj_hal_HAL_observeUserProgramAutonomous + (JNIEnv*, jclass) +{ HAL_ObserveUserProgramAutonomous(); } /* - * Class: edu_wpi_first_wpilibj_hal_HAL + * Class: edu_wpi_first_wpilibj_hal_HAL * Method: observeUserProgramTeleop * Signature: ()V */ JNIEXPORT void JNICALL -Java_edu_wpi_first_wpilibj_hal_HAL_observeUserProgramTeleop(JNIEnv*, jclass) { +Java_edu_wpi_first_wpilibj_hal_HAL_observeUserProgramTeleop + (JNIEnv*, jclass) +{ HAL_ObserveUserProgramTeleop(); } /* - * Class: edu_wpi_first_wpilibj_hal_HAL + * Class: edu_wpi_first_wpilibj_hal_HAL * Method: observeUserProgramTest * Signature: ()V */ JNIEXPORT void JNICALL -Java_edu_wpi_first_wpilibj_hal_HAL_observeUserProgramTest(JNIEnv*, jclass) { +Java_edu_wpi_first_wpilibj_hal_HAL_observeUserProgramTest + (JNIEnv*, jclass) +{ HAL_ObserveUserProgramTest(); } /* - * Class: edu_wpi_first_wpilibj_hal_HAL - * Method: HAL_Report + * Class: edu_wpi_first_wpilibj_hal_HAL + * Method: report * Signature: (IIILjava/lang/String;)I */ JNIEXPORT jint JNICALL -Java_edu_wpi_first_wpilibj_hal_HAL_report( - JNIEnv* paramEnv, jclass, jint paramResource, jint paramInstanceNumber, - jint paramContext, jstring paramFeature) { +Java_edu_wpi_first_wpilibj_hal_HAL_report + (JNIEnv* paramEnv, jclass, jint paramResource, jint paramInstanceNumber, + jint paramContext, jstring paramFeature) +{ JStringRef featureStr{paramEnv, paramFeature}; NETCOMM_LOG(logDEBUG) << "Calling HAL report " << "res:" << paramResource << " instance:" << paramInstanceNumber << " context:" << paramContext << " feature:" << featureStr.c_str(); - jint returnValue = - HAL_Report(paramResource, paramInstanceNumber, paramContext, featureStr.c_str()); + jint returnValue = HAL_Report(paramResource, paramInstanceNumber, + paramContext, featureStr.c_str()); return returnValue; } /* - * Class: edu_wpi_first_wpilibj_hal_HAL - * Method: NativeGetControlWord + * Class: edu_wpi_first_wpilibj_hal_HAL + * Method: nativeGetControlWord * Signature: ()I */ JNIEXPORT jint JNICALL -Java_edu_wpi_first_wpilibj_hal_HAL_nativeGetControlWord(JNIEnv*, jclass) { +Java_edu_wpi_first_wpilibj_hal_HAL_nativeGetControlWord + (JNIEnv*, jclass) +{ NETCOMM_LOG(logDEBUG) << "Calling HAL Control Word"; static_assert(sizeof(HAL_ControlWord) == sizeof(jint), - "Java int must match the size of control word"); + "Java int must match the size of control word"); HAL_ControlWord controlWord; std::memset(&controlWord, 0, sizeof(HAL_ControlWord)); HAL_GetControlWord(&controlWord); @@ -131,12 +147,14 @@ Java_edu_wpi_first_wpilibj_hal_HAL_nativeGetControlWord(JNIEnv*, jclass) { } /* - * Class: edu_wpi_first_wpilibj_hal_HAL - * Method: NativeGetAllianceStation + * Class: edu_wpi_first_wpilibj_hal_HAL + * Method: nativeGetAllianceStation * Signature: ()I */ JNIEXPORT jint JNICALL -Java_edu_wpi_first_wpilibj_hal_HAL_nativeGetAllianceStation(JNIEnv*, jclass) { +Java_edu_wpi_first_wpilibj_hal_HAL_nativeGetAllianceStation + (JNIEnv*, jclass) +{ NETCOMM_LOG(logDEBUG) << "Calling HAL Alliance Station"; int32_t status = 0; auto allianceStation = HAL_GetAllianceStation(&status); @@ -144,22 +162,22 @@ Java_edu_wpi_first_wpilibj_hal_HAL_nativeGetAllianceStation(JNIEnv*, jclass) { } /* - * Class: edu_wpi_first_wpilibj_hal_HAL - * Method: HAL_GetJoystickAxes + * Class: edu_wpi_first_wpilibj_hal_HAL + * Method: getJoystickAxes * Signature: (B[F)S */ JNIEXPORT jshort JNICALL -Java_edu_wpi_first_wpilibj_hal_HAL_getJoystickAxes(JNIEnv* env, jclass, - jbyte joystickNum, - jfloatArray axesArray) { +Java_edu_wpi_first_wpilibj_hal_HAL_getJoystickAxes + (JNIEnv* env, jclass, jbyte joystickNum, jfloatArray axesArray) +{ NETCOMM_LOG(logDEBUG) << "Calling HALJoystickAxes"; HAL_JoystickAxes axes; HAL_GetJoystickAxes(joystickNum, &axes); jsize javaSize = env->GetArrayLength(axesArray); - if (axes.count > javaSize) - { - ThrowIllegalArgumentException(env, "Native array size larger then passed in java array size"); + if (axes.count > javaSize) { + ThrowIllegalArgumentException( + env, "Native array size larger then passed in java array size"); } env->SetFloatArrayRegion(axesArray, 0, axes.count, axes.axes); @@ -168,22 +186,22 @@ Java_edu_wpi_first_wpilibj_hal_HAL_getJoystickAxes(JNIEnv* env, jclass, } /* - * Class: edu_wpi_first_wpilibj_hal_HAL - * Method: HAL_GetJoystickPOVs + * Class: edu_wpi_first_wpilibj_hal_HAL + * Method: getJoystickPOVs * Signature: (B[S)S */ JNIEXPORT jshort JNICALL -Java_edu_wpi_first_wpilibj_hal_HAL_getJoystickPOVs(JNIEnv* env, jclass, - jbyte joystickNum, - jshortArray povsArray) { +Java_edu_wpi_first_wpilibj_hal_HAL_getJoystickPOVs + (JNIEnv* env, jclass, jbyte joystickNum, jshortArray povsArray) +{ NETCOMM_LOG(logDEBUG) << "Calling HALJoystickPOVs"; HAL_JoystickPOVs povs; HAL_GetJoystickPOVs(joystickNum, &povs); jsize javaSize = env->GetArrayLength(povsArray); - if (povs.count > javaSize) - { - ThrowIllegalArgumentException(env, "Native array size larger then passed in java array size"); + if (povs.count > javaSize) { + ThrowIllegalArgumentException( + env, "Native array size larger then passed in java array size"); } env->SetShortArrayRegion(povsArray, 0, povs.count, povs.povs); @@ -192,18 +210,19 @@ Java_edu_wpi_first_wpilibj_hal_HAL_getJoystickPOVs(JNIEnv* env, jclass, } /* - * Class: edu_wpi_first_wpilibj_hal_HAL - * Method: HAL_GetJoystickButtons - * Signature: (BL)I + * Class: edu_wpi_first_wpilibj_hal_HAL + * Method: getJoystickButtons + * Signature: (BLjava/lang/Object;)I */ JNIEXPORT jint JNICALL -Java_edu_wpi_first_wpilibj_hal_HAL_getJoystickButtons(JNIEnv* env, jclass, - jbyte joystickNum, - jobject count) { +Java_edu_wpi_first_wpilibj_hal_HAL_getJoystickButtons + (JNIEnv* env, jclass, jbyte joystickNum, jobject count) +{ NETCOMM_LOG(logDEBUG) << "Calling HALJoystickButtons"; HAL_JoystickButtons joystickButtons; HAL_GetJoystickButtons(joystickNum, &joystickButtons); - jbyte *countPtr = (jbyte *)env->GetDirectBufferAddress(count); + jbyte* countPtr = + reinterpret_cast(env->GetDirectBufferAddress(count)); NETCOMM_LOG(logDEBUG) << "Buttons = " << joystickButtons.buttons; NETCOMM_LOG(logDEBUG) << "Count = " << (jint)joystickButtons.count; *countPtr = joystickButtons.count; @@ -212,15 +231,15 @@ Java_edu_wpi_first_wpilibj_hal_HAL_getJoystickButtons(JNIEnv* env, jclass, } /* - * Class: edu_wpi_first_wpilibj_hal_HAL - * Method: HAL_SetJoystickOutputs + * Class: edu_wpi_first_wpilibj_hal_HAL + * Method: setJoystickOutputs * Signature: (BISS)I */ JNIEXPORT jint JNICALL -Java_edu_wpi_first_wpilibj_hal_HAL_setJoystickOutputs(JNIEnv*, jclass, - jbyte port, jint outputs, - jshort leftRumble, - jshort rightRumble) { +Java_edu_wpi_first_wpilibj_hal_HAL_setJoystickOutputs + (JNIEnv*, jclass, jbyte port, jint outputs, jshort leftRumble, + jshort rightRumble) +{ NETCOMM_LOG(logDEBUG) << "Calling HAL_SetJoystickOutputs on port " << port; NETCOMM_LOG(logDEBUG) << "Outputs: " << outputs; NETCOMM_LOG(logDEBUG) << "Left Rumble: " << leftRumble @@ -229,53 +248,56 @@ Java_edu_wpi_first_wpilibj_hal_HAL_setJoystickOutputs(JNIEnv*, jclass, } /* - * Class: edu_wpi_first_wpilibj_hal_HAL - * Method: HAL_GetJoystickIsXbox + * Class: edu_wpi_first_wpilibj_hal_HAL + * Method: getJoystickIsXbox * Signature: (B)I */ JNIEXPORT jint JNICALL -Java_edu_wpi_first_wpilibj_hal_HAL_getJoystickIsXbox(JNIEnv*, jclass, - jbyte port) { +Java_edu_wpi_first_wpilibj_hal_HAL_getJoystickIsXbox + (JNIEnv*, jclass, jbyte port) +{ NETCOMM_LOG(logDEBUG) << "Calling HAL_GetJoystickIsXbox"; return HAL_GetJoystickIsXbox(port); } /* - * Class: edu_wpi_first_wpilibj_hal_HAL - * Method: HAL_GetJoystickType + * Class: edu_wpi_first_wpilibj_hal_HAL + * Method: getJoystickType * Signature: (B)I */ JNIEXPORT jint JNICALL -Java_edu_wpi_first_wpilibj_hal_HAL_getJoystickType(JNIEnv*, jclass, - jbyte port) { +Java_edu_wpi_first_wpilibj_hal_HAL_getJoystickType + (JNIEnv*, jclass, jbyte port) +{ NETCOMM_LOG(logDEBUG) << "Calling HAL_GetJoystickType"; return HAL_GetJoystickType(port); } /* - * Class: edu_wpi_first_wpilibj_hal_HAL - * Method: HAL_GetJoystickName + * Class: edu_wpi_first_wpilibj_hal_HAL + * Method: getJoystickName * Signature: (B)Ljava/lang/String; */ JNIEXPORT jstring JNICALL -Java_edu_wpi_first_wpilibj_hal_HAL_getJoystickName(JNIEnv* env, jclass, - jbyte port) { +Java_edu_wpi_first_wpilibj_hal_HAL_getJoystickName + (JNIEnv* env, jclass, jbyte port) +{ NETCOMM_LOG(logDEBUG) << "Calling HAL_GetJoystickName"; - char *joystickName = HAL_GetJoystickName(port); + char* joystickName = HAL_GetJoystickName(port); jstring str = MakeJString(env, joystickName); HAL_FreeJoystickName(joystickName); return str; } /* - * Class: edu_wpi_first_wpilibj_hal_HAL - * Method: HAL_GetJoystickAxisType + * Class: edu_wpi_first_wpilibj_hal_HAL + * Method: getJoystickAxisType * Signature: (BB)I */ JNIEXPORT jint JNICALL -Java_edu_wpi_first_wpilibj_hal_HAL_getJoystickAxisType(JNIEnv*, jclass, - jbyte joystickNum, - jbyte axis) { +Java_edu_wpi_first_wpilibj_hal_HAL_getJoystickAxisType + (JNIEnv*, jclass, jbyte joystickNum, jbyte axis) +{ NETCOMM_LOG(logDEBUG) << "Calling HAL_GetJoystickAxisType"; return HAL_GetJoystickAxisType(joystickNum, axis); } @@ -286,27 +308,33 @@ Java_edu_wpi_first_wpilibj_hal_HAL_getJoystickAxisType(JNIEnv*, jclass, * Signature: ()Z */ JNIEXPORT jboolean JNICALL -Java_edu_wpi_first_wpilibj_hal_HAL_isNewControlData(JNIEnv *, jclass) { +Java_edu_wpi_first_wpilibj_hal_HAL_isNewControlData + (JNIEnv*, jclass) +{ return static_cast(HAL_IsNewControlData()); } /* - * Class: edu_wpi_first_wpilibj_hal_HAL + * Class: edu_wpi_first_wpilibj_hal_HAL * Method: waitForDSData * Signature: ()V */ JNIEXPORT void JNICALL -Java_edu_wpi_first_wpilibj_hal_HAL_waitForDSData(JNIEnv* env, jclass) { +Java_edu_wpi_first_wpilibj_hal_HAL_waitForDSData + (JNIEnv* env, jclass) +{ HAL_WaitForDSData(); } /* - * Class: edu_wpi_first_wpilibj_hal_HAL + * Class: edu_wpi_first_wpilibj_hal_HAL * Method: releaseDSMutex * Signature: ()V */ JNIEXPORT void JNICALL -Java_edu_wpi_first_wpilibj_hal_HAL_releaseDSMutex(JNIEnv* env, jclass) { +Java_edu_wpi_first_wpilibj_hal_HAL_releaseDSMutex + (JNIEnv* env, jclass) +{ HAL_ReleaseDSMutex(); } @@ -316,29 +344,34 @@ Java_edu_wpi_first_wpilibj_hal_HAL_releaseDSMutex(JNIEnv* env, jclass) { * Signature: (D)Z */ JNIEXPORT jboolean JNICALL -Java_edu_wpi_first_wpilibj_hal_HAL_waitForDSDataTimeout(JNIEnv *, jclass, - jdouble timeout) { +Java_edu_wpi_first_wpilibj_hal_HAL_waitForDSDataTimeout + (JNIEnv*, jclass, jdouble timeout) +{ return static_cast(HAL_WaitForDSDataTimeout(timeout)); } /* - * Class: edu_wpi_first_wpilibj_hal_HAL - * Method: HAL_GetMatchTime + * Class: edu_wpi_first_wpilibj_hal_HAL + * Method: getMatchTime * Signature: ()D */ JNIEXPORT jdouble JNICALL -Java_edu_wpi_first_wpilibj_hal_HAL_getMatchTime(JNIEnv* env, jclass) { +Java_edu_wpi_first_wpilibj_hal_HAL_getMatchTime + (JNIEnv* env, jclass) +{ int32_t status = 0; return HAL_GetMatchTime(&status); } /* - * Class: edu_wpi_first_wpilibj_hal_HAL - * Method: HAL_GetSystemActive + * Class: edu_wpi_first_wpilibj_hal_HAL + * Method: getSystemActive * Signature: ()Z */ JNIEXPORT jboolean JNICALL -Java_edu_wpi_first_wpilibj_hal_HAL_getSystemActive(JNIEnv* env, jclass) { +Java_edu_wpi_first_wpilibj_hal_HAL_getSystemActive + (JNIEnv* env, jclass) +{ int32_t status = 0; bool val = HAL_GetSystemActive(&status); CheckStatus(env, status); @@ -346,12 +379,14 @@ Java_edu_wpi_first_wpilibj_hal_HAL_getSystemActive(JNIEnv* env, jclass) { } /* - * Class: edu_wpi_first_wpilibj_hal_HAL - * Method: HAL_GetBrownedOut + * Class: edu_wpi_first_wpilibj_hal_HAL + * Method: getBrownedOut * Signature: ()Z */ JNIEXPORT jboolean JNICALL -Java_edu_wpi_first_wpilibj_hal_HAL_getBrownedOut(JNIEnv* env, jclass) { +Java_edu_wpi_first_wpilibj_hal_HAL_getBrownedOut + (JNIEnv* env, jclass) +{ int32_t status = 0; bool val = HAL_GetBrownedOut(&status); CheckStatus(env, status); @@ -361,11 +396,12 @@ Java_edu_wpi_first_wpilibj_hal_HAL_getBrownedOut(JNIEnv* env, jclass) { /* * Class: edu_wpi_first_wpilibj_hal_HAL * Method: getMatchInfo - * Signature: (Ledu/wpi/first/wpilibj/hal/MatchInfoData;)I + * Signature: (Ljava/lang/Object;)I */ JNIEXPORT jint JNICALL Java_edu_wpi_first_wpilibj_hal_HAL_getMatchInfo -(JNIEnv * env, jclass, jobject info) { + (JNIEnv* env, jclass, jobject info) +{ HAL_MatchInfo matchInfo; auto status = HAL_GetMatchInfo(&matchInfo); if (status == 0) { @@ -376,17 +412,15 @@ Java_edu_wpi_first_wpilibj_hal_HAL_getMatchInfo } /* - * Class: edu_wpi_first_wpilibj_hal_HAL - * Method: HAL_SendError + * Class: edu_wpi_first_wpilibj_hal_HAL + * Method: sendError * Signature: (ZIZLjava/lang/String;Ljava/lang/String;Ljava/lang/String;Z)I */ JNIEXPORT jint JNICALL -Java_edu_wpi_first_wpilibj_hal_HAL_sendError(JNIEnv* env, jclass, - jboolean isError, jint errorCode, - jboolean isLVCode, jstring details, - jstring location, - jstring callStack, - jboolean printMsg) { +Java_edu_wpi_first_wpilibj_hal_HAL_sendError + (JNIEnv* env, jclass, jboolean isError, jint errorCode, jboolean isLVCode, + jstring details, jstring location, jstring callStack, jboolean printMsg) +{ JStringRef detailsStr{env, details}; JStringRef locationStr{env, location}; JStringRef callStackStr{env, callStack}; @@ -394,8 +428,9 @@ Java_edu_wpi_first_wpilibj_hal_HAL_sendError(JNIEnv* env, jclass, NETCOMM_LOG(logDEBUG) << "Send Error: " << detailsStr.c_str(); NETCOMM_LOG(logDEBUG) << "Location: " << locationStr.c_str(); NETCOMM_LOG(logDEBUG) << "Call Stack: " << callStackStr.c_str(); - jint returnValue = HAL_SendError(isError, errorCode, isLVCode, detailsStr.c_str(), - locationStr.c_str(), callStackStr.c_str(), printMsg); + jint returnValue = + HAL_SendError(isError, errorCode, isLVCode, detailsStr.c_str(), + locationStr.c_str(), callStackStr.c_str(), printMsg); return returnValue; } @@ -405,8 +440,9 @@ Java_edu_wpi_first_wpilibj_hal_HAL_sendError(JNIEnv* env, jclass, * Signature: (BB)I */ JNIEXPORT jint JNICALL -Java_edu_wpi_first_wpilibj_hal_HAL_getPortWithModule( - JNIEnv* env, jclass, jbyte module, jbyte channel) { +Java_edu_wpi_first_wpilibj_hal_HAL_getPortWithModule + (JNIEnv* env, jclass, jbyte module, jbyte channel) +{ // FILE_LOG(logDEBUG) << "Calling HAL getPortWithModlue"; // FILE_LOG(logDEBUG) << "Module = " << (jint)module; // FILE_LOG(logDEBUG) << "Channel = " << (jint)channel; @@ -420,8 +456,10 @@ Java_edu_wpi_first_wpilibj_hal_HAL_getPortWithModule( * Method: getPort * Signature: (B)I */ -JNIEXPORT jint JNICALL Java_edu_wpi_first_wpilibj_hal_HAL_getPort( - JNIEnv* env, jclass, jbyte channel) { +JNIEXPORT jint JNICALL +Java_edu_wpi_first_wpilibj_hal_HAL_getPort + (JNIEnv* env, jclass, jbyte channel) +{ // FILE_LOG(logDEBUG) << "Calling HAL getPortWithModlue"; // FILE_LOG(logDEBUG) << "Module = " << (jint)module; // FILE_LOG(logDEBUG) << "Channel = " << (jint)channel; diff --git a/hal/src/main/native/cpp/jni/HALUtil.cpp b/hal/src/main/native/cpp/jni/HALUtil.cpp index 8e734031db..2d17ddc465 100644 --- a/hal/src/main/native/cpp/jni/HALUtil.cpp +++ b/hal/src/main/native/cpp/jni/HALUtil.cpp @@ -1,5 +1,5 @@ /*----------------------------------------------------------------------------*/ -/* Copyright (c) FIRST 2016. All Rights Reserved. */ +/* Copyright (c) 2016-2018 FIRST. 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. */ @@ -7,23 +7,24 @@ #include "HALUtil.h" -#include -#include #include +#include +#include #include #include #include +#include +#include +#include + #include "HAL/CAN.h" -#include "HAL/HAL.h" #include "HAL/DriverStation.h" #include "HAL/Errors.h" +#include "HAL/HAL.h" #include "HAL/cpp/Log.h" #include "edu_wpi_first_wpilibj_hal_HALUtil.h" -#include "wpi/SmallString.h" -#include "wpi/jni_util.h" -#include "wpi/raw_ostream.h" using namespace wpi::java; @@ -34,7 +35,7 @@ TLogLevel halUtilLogLevel = logWARNING; if (level > halUtilLogLevel) \ ; \ else \ - Log().Get(level) + Log().Get(level) #define kRioStatusOffset -63000 #define kRioStatusSuccess 0 @@ -43,7 +44,7 @@ TLogLevel halUtilLogLevel = logWARNING; #define kRIOStatusFeatureNotSupported (kRioStatusOffset - 193) #define kRIOStatusResourceNotInitialized -52010 -static JavaVM *jvm = nullptr; +static JavaVM* jvm = nullptr; static JException runtimeExCls; static JException illegalArgExCls; static JException boundaryExCls; @@ -61,32 +62,32 @@ static JClass accumulatorResultCls; namespace frc { -void ThrowAllocationException(JNIEnv *env, int32_t minRange, int32_t maxRange, - int32_t requestedValue, int32_t status) { - const char *message = HAL_GetErrorMessage(status); +void ThrowAllocationException(JNIEnv* env, int32_t minRange, int32_t maxRange, + int32_t requestedValue, int32_t status) { + const char* message = HAL_GetErrorMessage(status); wpi::SmallString<1024> buf; wpi::raw_svector_ostream oss(buf); - oss << " Code: " << status << ". " << message << ", Minimum Value: " - << minRange << ", Maximum Value: " << maxRange << ", Requested Value: " - << requestedValue; + oss << " Code: " << status << ". " << message + << ", Minimum Value: " << minRange << ", Maximum Value: " << maxRange + << ", Requested Value: " << requestedValue; env->ThrowNew(allocationExCls, buf.c_str()); allocationExCls.Throw(env, buf.c_str()); } -void ThrowHalHandleException(JNIEnv *env, int32_t status) { - const char *message = HAL_GetErrorMessage(status); +void ThrowHalHandleException(JNIEnv* env, int32_t status) { + const char* message = HAL_GetErrorMessage(status); wpi::SmallString<1024> buf; wpi::raw_svector_ostream oss(buf); oss << " Code: " << status << ". " << message; halHandleExCls.Throw(env, buf.c_str()); } -void ReportError(JNIEnv *env, int32_t status, bool doThrow) { +void ReportError(JNIEnv* env, int32_t status, bool doThrow) { if (status == 0) return; if (status == HAL_HANDLE_ERROR) { ThrowHalHandleException(env, status); } - const char *message = HAL_GetErrorMessage(status); + const char* message = HAL_GetErrorMessage(status); if (doThrow && status < 0) { wpi::SmallString<1024> buf; wpi::raw_svector_ostream oss(buf); @@ -99,25 +100,24 @@ void ReportError(JNIEnv *env, int32_t status, bool doThrow) { } } -void ThrowError(JNIEnv *env, int32_t status, int32_t minRange, int32_t maxRange, +void ThrowError(JNIEnv* env, int32_t status, int32_t minRange, int32_t maxRange, int32_t requestedValue) { if (status == 0) return; - if (status == NO_AVAILABLE_RESOURCES || - status == RESOURCE_IS_ALLOCATED || + if (status == NO_AVAILABLE_RESOURCES || status == RESOURCE_IS_ALLOCATED || status == RESOURCE_OUT_OF_RANGE) { ThrowAllocationException(env, minRange, maxRange, requestedValue, status); } if (status == HAL_HANDLE_ERROR) { ThrowHalHandleException(env, status); } - const char *message = HAL_GetErrorMessage(status); + const char* message = HAL_GetErrorMessage(status); wpi::SmallString<1024> buf; wpi::raw_svector_ostream oss(buf); oss << " Code: " << status << ". " << message; runtimeExCls.Throw(env, buf.c_str()); } -void ReportCANError(JNIEnv *env, int32_t status, int message_id) { +void ReportCANError(JNIEnv* env, int32_t status, int message_id) { if (status >= 0) return; switch (status) { case kRioStatusSuccess: @@ -174,11 +174,11 @@ void ReportCANError(JNIEnv *env, int32_t status, int message_id) { } } -void ThrowIllegalArgumentException(JNIEnv *env, const char *msg) { +void ThrowIllegalArgumentException(JNIEnv* env, const char* msg) { illegalArgExCls.Throw(env, msg); } -void ThrowBoundaryException(JNIEnv *env, double value, double lower, +void ThrowBoundaryException(JNIEnv* env, double value, double lower, double upper) { static jmethodID getMessage = nullptr; if (!getMessage) @@ -190,69 +190,61 @@ void ThrowBoundaryException(JNIEnv *env, double value, double lower, constructor = env->GetMethodID(boundaryExCls, "", "(Ljava/lang/String;)V"); - jobject msg = - env->CallStaticObjectMethod(boundaryExCls, getMessage, - static_cast(value), - static_cast(lower), - static_cast(upper)); + jobject msg = env->CallStaticObjectMethod( + boundaryExCls, getMessage, static_cast(value), + static_cast(lower), static_cast(upper)); jobject ex = env->NewObject(boundaryExCls, constructor, msg); env->Throw(static_cast(ex)); } -jobject CreatePWMConfigDataResult(JNIEnv *env, int32_t maxPwm, - int32_t deadbandMaxPwm, int32_t centerPwm, - int32_t deadbandMinPwm, int32_t minPwm) { +jobject CreatePWMConfigDataResult(JNIEnv* env, int32_t maxPwm, + int32_t deadbandMaxPwm, int32_t centerPwm, + int32_t deadbandMinPwm, int32_t minPwm) { static jmethodID constructor = - env->GetMethodID(pwmConfigDataResultCls, "", - "(IIIII)V"); + env->GetMethodID(pwmConfigDataResultCls, "", "(IIIII)V"); return env->NewObject(pwmConfigDataResultCls, constructor, maxPwm, - deadbandMaxPwm, centerPwm, deadbandMinPwm, - minPwm); + deadbandMaxPwm, centerPwm, deadbandMinPwm, minPwm); } -void SetCanStatusObject(JNIEnv *env, jobject canStatus, - float percentBusUtilization, - uint32_t busOffCount, uint32_t txFullCount, - uint32_t receiveErrorCount, +void SetCanStatusObject(JNIEnv* env, jobject canStatus, + float percentBusUtilization, uint32_t busOffCount, + uint32_t txFullCount, uint32_t receiveErrorCount, uint32_t transmitErrorCount) { - static jmethodID func = env->GetMethodID(canStatusCls, "setStatus", - "(DIIII)V"); + static jmethodID func = + env->GetMethodID(canStatusCls, "setStatus", "(DIIII)V"); env->CallVoidMethod(canStatus, func, (jdouble)percentBusUtilization, - (jint)busOffCount, (jint)txFullCount, - (jint)receiveErrorCount, (jint)transmitErrorCount); + (jint)busOffCount, (jint)txFullCount, + (jint)receiveErrorCount, (jint)transmitErrorCount); } void SetMatchInfoObject(JNIEnv* env, jobject matchStatus, const HAL_MatchInfo& matchInfo) { - static jmethodID func = env->GetMethodID(matchInfoDataCls, "setData", - "(Ljava/lang/String;Ljava/lang/String;III)V"); + static jmethodID func = + env->GetMethodID(matchInfoDataCls, "setData", + "(Ljava/lang/String;Ljava/lang/String;III)V"); - env->CallVoidMethod(matchStatus, func, - MakeJString(env, matchInfo.eventName), - MakeJString(env, matchInfo.gameSpecificMessage), - (jint)matchInfo.matchNumber, - (jint)matchInfo.replayNumber, - (jint)matchInfo.matchType); + env->CallVoidMethod(matchStatus, func, MakeJString(env, matchInfo.eventName), + MakeJString(env, matchInfo.gameSpecificMessage), + (jint)matchInfo.matchNumber, (jint)matchInfo.replayNumber, + (jint)matchInfo.matchType); } void SetAccumulatorResultObject(JNIEnv* env, jobject accumulatorResult, int64_t value, int64_t count) { - static jmethodID func = env->GetMethodID(accumulatorResultCls, "set", - "(JJ)V"); + static jmethodID func = + env->GetMethodID(accumulatorResultCls, "set", "(JJ)V"); env->CallVoidMethod(accumulatorResult, func, (jlong)value, (jlong)count); } -JavaVM* GetJVM() { - return jvm; -} +JavaVM* GetJVM() { return jvm; } } // namespace frc namespace sim { - jint SimOnLoad(JavaVM* vm, void* reserved); - void SimOnUnload(JavaVM* vm, void* reserved); -} +jint SimOnLoad(JavaVM* vm, void* reserved); +void SimOnUnload(JavaVM* vm, void* reserved); +} // namespace sim using namespace frc; @@ -261,14 +253,14 @@ extern "C" { // // indicate JNI version support desired and load classes // -JNIEXPORT jint JNICALL JNI_OnLoad(JavaVM *vm, void *reserved) { +JNIEXPORT jint JNICALL JNI_OnLoad(JavaVM* vm, void* reserved) { jvm = vm; // set our logging level Log::ReportingLevel() = logDEBUG; - JNIEnv *env; - if (vm->GetEnv(reinterpret_cast(&env), JNI_VERSION_1_6) != JNI_OK) + JNIEnv* env; + if (vm->GetEnv(reinterpret_cast(&env), JNI_VERSION_1_6) != JNI_OK) return JNI_ERR; runtimeExCls = JException(env, "java/lang/RuntimeException"); @@ -277,31 +269,40 @@ JNIEXPORT jint JNICALL JNI_OnLoad(JavaVM *vm, void *reserved) { illegalArgExCls = JException(env, "java/lang/IllegalArgumentException"); if (!illegalArgExCls) return JNI_ERR; - boundaryExCls = JException(env, "edu/wpi/first/wpilibj/util/BoundaryException"); + boundaryExCls = + JException(env, "edu/wpi/first/wpilibj/util/BoundaryException"); if (!boundaryExCls) return JNI_ERR; - allocationExCls = JException(env, "edu/wpi/first/wpilibj/util/AllocationException"); + allocationExCls = + JException(env, "edu/wpi/first/wpilibj/util/AllocationException"); if (!allocationExCls) return JNI_ERR; - halHandleExCls = JException(env, "edu/wpi/first/wpilibj/util/HalHandleException"); + halHandleExCls = + JException(env, "edu/wpi/first/wpilibj/util/HalHandleException"); if (!halHandleExCls) return JNI_ERR; - canInvalidBufferExCls = JException(env, "edu/wpi/first/wpilibj/can/CANInvalidBufferException"); + canInvalidBufferExCls = + JException(env, "edu/wpi/first/wpilibj/can/CANInvalidBufferException"); if (!canInvalidBufferExCls) return JNI_ERR; - canMessageNotFoundExCls = JException(env, "edu/wpi/first/wpilibj/can/CANMessageNotFoundException"); + canMessageNotFoundExCls = + JException(env, "edu/wpi/first/wpilibj/can/CANMessageNotFoundException"); if (!canMessageNotFoundExCls) return JNI_ERR; - canMessageNotAllowedExCls = JException(env, "edu/wpi/first/wpilibj/can/CANMessageNotAllowedException"); + canMessageNotAllowedExCls = JException( + env, "edu/wpi/first/wpilibj/can/CANMessageNotAllowedException"); if (!canMessageNotAllowedExCls) return JNI_ERR; - canNotInitializedExCls = JException(env, "edu/wpi/first/wpilibj/can/CANNotInitializedException"); + canNotInitializedExCls = + JException(env, "edu/wpi/first/wpilibj/can/CANNotInitializedException"); if (!canNotInitializedExCls) return JNI_ERR; - uncleanStatusExCls = JException(env,"edu/wpi/first/wpilibj/util/UncleanStatusException"); + uncleanStatusExCls = + JException(env, "edu/wpi/first/wpilibj/util/UncleanStatusException"); if (!uncleanStatusExCls) return JNI_ERR; - pwmConfigDataResultCls = JClass(env, "edu/wpi/first/wpilibj/PWMConfigDataResult"); + pwmConfigDataResultCls = + JClass(env, "edu/wpi/first/wpilibj/PWMConfigDataResult"); if (!pwmConfigDataResultCls) return JNI_ERR; canStatusCls = JClass(env, "edu/wpi/first/wpilibj/can/CANStatus"); @@ -316,11 +317,11 @@ JNIEXPORT jint JNICALL JNI_OnLoad(JavaVM *vm, void *reserved) { return sim::SimOnLoad(vm, reserved); } -JNIEXPORT void JNICALL JNI_OnUnload(JavaVM *vm, void *reserved) { +JNIEXPORT void JNICALL JNI_OnUnload(JavaVM* vm, void* reserved) { sim::SimOnUnload(vm, reserved); - JNIEnv *env; - if (vm->GetEnv(reinterpret_cast(&env), JNI_VERSION_1_6) != JNI_OK) + JNIEnv* env; + if (vm->GetEnv(reinterpret_cast(&env), JNI_VERSION_1_6) != JNI_OK) return; // Delete global references runtimeExCls.free(env); @@ -346,7 +347,9 @@ JNIEXPORT void JNICALL JNI_OnUnload(JavaVM *vm, void *reserved) { * Signature: ()S */ JNIEXPORT jshort JNICALL -Java_edu_wpi_first_wpilibj_hal_HALUtil_getFPGAVersion(JNIEnv *env, jclass) { +Java_edu_wpi_first_wpilibj_hal_HALUtil_getFPGAVersion + (JNIEnv* env, jclass) +{ HALUTIL_LOG(logDEBUG) << "Calling HALUtil getFPGAVersion"; int32_t status = 0; jshort returnValue = HAL_GetFPGAVersion(&status); @@ -362,7 +365,9 @@ Java_edu_wpi_first_wpilibj_hal_HALUtil_getFPGAVersion(JNIEnv *env, jclass) { * Signature: ()I */ JNIEXPORT jint JNICALL -Java_edu_wpi_first_wpilibj_hal_HALUtil_getFPGARevision(JNIEnv *env, jclass) { +Java_edu_wpi_first_wpilibj_hal_HALUtil_getFPGARevision + (JNIEnv* env, jclass) +{ HALUTIL_LOG(logDEBUG) << "Calling HALUtil getFPGARevision"; int32_t status = 0; jint returnValue = HAL_GetFPGARevision(&status); @@ -378,7 +383,9 @@ Java_edu_wpi_first_wpilibj_hal_HALUtil_getFPGARevision(JNIEnv *env, jclass) { * Signature: ()J */ JNIEXPORT jlong JNICALL -Java_edu_wpi_first_wpilibj_hal_HALUtil_getFPGATime(JNIEnv *env, jclass) { +Java_edu_wpi_first_wpilibj_hal_HALUtil_getFPGATime + (JNIEnv* env, jclass) +{ // HALUTIL_LOG(logDEBUG) << "Calling HALUtil getFPGATime"; int32_t status = 0; jlong returnValue = HAL_GetFPGATime(&status); @@ -394,7 +401,9 @@ Java_edu_wpi_first_wpilibj_hal_HALUtil_getFPGATime(JNIEnv *env, jclass) { * Signature: ()I */ JNIEXPORT jint JNICALL -Java_edu_wpi_first_wpilibj_hal_HALUtil_getHALRuntimeType(JNIEnv *env, jclass) { +Java_edu_wpi_first_wpilibj_hal_HALUtil_getHALRuntimeType + (JNIEnv* env, jclass) +{ // HALUTIL_LOG(logDEBUG) << "Calling HALUtil getHALRuntimeType"; jint returnValue = HAL_GetRuntimeType(); // HALUTIL_LOG(logDEBUG) << "RuntimeType = " << returnValue; @@ -404,10 +413,12 @@ Java_edu_wpi_first_wpilibj_hal_HALUtil_getHALRuntimeType(JNIEnv *env, jclass) { /* * Class: edu_wpi_first_wpilibj_hal_HALUtil * Method: getFPGAButton - * Signature: ()I + * Signature: ()Z */ JNIEXPORT jboolean JNICALL -Java_edu_wpi_first_wpilibj_hal_HALUtil_getFPGAButton(JNIEnv *env, jclass) { +Java_edu_wpi_first_wpilibj_hal_HALUtil_getFPGAButton + (JNIEnv* env, jclass) +{ // HALUTIL_LOG(logDEBUG) << "Calling HALUtil getFPGATime"; int32_t status = 0; jboolean returnValue = HAL_GetFPGAButton(&status); @@ -423,9 +434,10 @@ Java_edu_wpi_first_wpilibj_hal_HALUtil_getFPGAButton(JNIEnv *env, jclass) { * Signature: (I)Ljava/lang/String; */ JNIEXPORT jstring JNICALL -Java_edu_wpi_first_wpilibj_hal_HALUtil_getHALErrorMessage( - JNIEnv *paramEnv, jclass, jint paramId) { - const char *msg = HAL_GetErrorMessage(paramId); +Java_edu_wpi_first_wpilibj_hal_HALUtil_getHALErrorMessage + (JNIEnv* paramEnv, jclass, jint paramId) +{ + const char* msg = HAL_GetErrorMessage(paramId); HALUTIL_LOG(logDEBUG) << "Calling HALUtil HAL_GetErrorMessage id=" << paramId << " msg=" << msg; return MakeJString(paramEnv, msg); @@ -437,7 +449,9 @@ Java_edu_wpi_first_wpilibj_hal_HALUtil_getHALErrorMessage( * Signature: ()I */ JNIEXPORT jint JNICALL -Java_edu_wpi_first_wpilibj_hal_HALUtil_getHALErrno(JNIEnv *, jclass) { +Java_edu_wpi_first_wpilibj_hal_HALUtil_getHALErrno + (JNIEnv*, jclass) +{ return errno; } @@ -446,9 +460,11 @@ Java_edu_wpi_first_wpilibj_hal_HALUtil_getHALErrno(JNIEnv *, jclass) { * Method: getHALstrerror * Signature: (I)Ljava/lang/String; */ -JNIEXPORT jstring JNICALL Java_edu_wpi_first_wpilibj_hal_HALUtil_getHALstrerror( - JNIEnv *env, jclass, jint errorCode) { - const char *msg = strerror(errno); +JNIEXPORT jstring JNICALL +Java_edu_wpi_first_wpilibj_hal_HALUtil_getHALstrerror + (JNIEnv* env, jclass, jint errorCode) +{ + const char* msg = std::strerror(errno); HALUTIL_LOG(logDEBUG) << "Calling HALUtil getHALstrerror errorCode=" << errorCode << " msg=" << msg; return MakeJString(env, msg); diff --git a/hal/src/main/native/cpp/jni/HALUtil.h b/hal/src/main/native/cpp/jni/HALUtil.h index c2f8a5d2ca..dd2cc3566b 100644 --- a/hal/src/main/native/cpp/jni/HALUtil.h +++ b/hal/src/main/native/cpp/jni/HALUtil.h @@ -1,61 +1,59 @@ /*----------------------------------------------------------------------------*/ -/* Copyright (c) FIRST 2016. All Rights Reserved. */ +/* Copyright (c) 2016-2018 FIRST. 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. */ /*----------------------------------------------------------------------------*/ -#ifndef HALUTIL_H -#define HALUTIL_H - -#include +#ifndef HAL_HAL_SRC_MAIN_NATIVE_CPP_JNI_HALUTIL_H_ +#define HAL_HAL_SRC_MAIN_NATIVE_CPP_JNI_HALUTIL_H_ #include +#include struct HAL_MatchInfo; namespace frc { -void ReportError(JNIEnv *env, int32_t status, bool doThrow = true); +void ReportError(JNIEnv* env, int32_t status, bool doThrow = true); -void ThrowError(JNIEnv *env, int32_t status, int32_t minRange, int32_t maxRange, +void ThrowError(JNIEnv* env, int32_t status, int32_t minRange, int32_t maxRange, int32_t requestedValue); -inline bool CheckStatus(JNIEnv *env, int32_t status, bool doThrow = true) { +inline bool CheckStatus(JNIEnv* env, int32_t status, bool doThrow = true) { if (status != 0) ReportError(env, status, doThrow); return status == 0; } -inline bool CheckStatusRange(JNIEnv *env, int32_t status, int32_t minRange, +inline bool CheckStatusRange(JNIEnv* env, int32_t status, int32_t minRange, int32_t maxRange, int32_t requestedValue) { if (status != 0) ThrowError(env, status, minRange, maxRange, requestedValue); return status == 0; } -inline bool CheckStatusForceThrow(JNIEnv *env, int32_t status) { +inline bool CheckStatusForceThrow(JNIEnv* env, int32_t status) { if (status != 0) ThrowError(env, status, 0, 0, 0); return status == 0; } -void ReportCANError(JNIEnv *env, int32_t status, int32_t message_id); +void ReportCANError(JNIEnv* env, int32_t status, int32_t message_id); -inline bool CheckCANStatus(JNIEnv *env, int32_t status, int32_t message_id) { +inline bool CheckCANStatus(JNIEnv* env, int32_t status, int32_t message_id) { if (status != 0) ReportCANError(env, status, message_id); return status == 0; } -void ThrowIllegalArgumentException(JNIEnv *env, const char *msg); -void ThrowBoundaryException(JNIEnv *env, double value, double lower, +void ThrowIllegalArgumentException(JNIEnv* env, const char* msg); +void ThrowBoundaryException(JNIEnv* env, double value, double lower, double upper); -jobject CreatePWMConfigDataResult(JNIEnv *env, int32_t maxPwm, - int32_t deadbandMaxPwm, int32_t centerPwm, - int32_t deadbandMinPwm, int32_t minPwm); +jobject CreatePWMConfigDataResult(JNIEnv* env, int32_t maxPwm, + int32_t deadbandMaxPwm, int32_t centerPwm, + int32_t deadbandMinPwm, int32_t minPwm); -void SetCanStatusObject(JNIEnv *env, jobject canStatus, - float percentBusUtilization, - uint32_t busOffCount, uint32_t txFullCount, - uint32_t receiveErrorCount, +void SetCanStatusObject(JNIEnv* env, jobject canStatus, + float percentBusUtilization, uint32_t busOffCount, + uint32_t txFullCount, uint32_t receiveErrorCount, uint32_t transmitErrorCount); void SetMatchInfoObject(JNIEnv* env, jobject matchStatus, @@ -68,4 +66,4 @@ JavaVM* GetJVM(); } // namespace frc -#endif // HALUTIL_H +#endif // HAL_HAL_SRC_MAIN_NATIVE_CPP_JNI_HALUTIL_H_ diff --git a/hal/src/main/native/cpp/jni/I2CJNI.cpp b/hal/src/main/native/cpp/jni/I2CJNI.cpp index 65d9b76728..e5123997ee 100644 --- a/hal/src/main/native/cpp/jni/I2CJNI.cpp +++ b/hal/src/main/native/cpp/jni/I2CJNI.cpp @@ -1,19 +1,20 @@ /*----------------------------------------------------------------------------*/ -/* Copyright (c) FIRST 2016. All Rights Reserved. */ +/* Copyright (c) 2016-2018 FIRST. 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. */ /*----------------------------------------------------------------------------*/ -#include #include -#include "HAL/cpp/Log.h" -#include "edu_wpi_first_wpilibj_hal_I2CJNI.h" +#include + +#include #include "HAL/I2C.h" +#include "HAL/cpp/Log.h" #include "HALUtil.h" -#include "wpi/jni_util.h" +#include "edu_wpi_first_wpilibj_hal_I2CJNI.h" using namespace frc; using namespace wpi::java; @@ -25,17 +26,19 @@ TLogLevel i2cJNILogLevel = logWARNING; if (level > i2cJNILogLevel) \ ; \ else \ - Log().Get(level) + Log().Get(level) extern "C" { /* * Class: edu_wpi_first_wpilibj_hal_I2CJNI - * Method: i2cInitialize + * Method: i2CInitialize * Signature: (I)V */ -JNIEXPORT void JNICALL Java_edu_wpi_first_wpilibj_hal_I2CJNI_i2CInitialize( - JNIEnv* env, jclass, jint port) { +JNIEXPORT void JNICALL +Java_edu_wpi_first_wpilibj_hal_I2CJNI_i2CInitialize + (JNIEnv* env, jclass, jint port) +{ I2CJNI_LOG(logDEBUG) << "Calling I2CJNI i2CInititalize"; I2CJNI_LOG(logDEBUG) << "Port: " << port; int32_t status = 0; @@ -47,26 +50,32 @@ JNIEXPORT void JNICALL Java_edu_wpi_first_wpilibj_hal_I2CJNI_i2CInitialize( /* * Class: edu_wpi_first_wpilibj_hal_I2CJNI * Method: i2CTransaction - * Signature: (IBLjava/nio/ByteBuffer;BLjava/nio/ByteBuffer;B)I + * Signature: (IBLjava/lang/Object;BLjava/lang/Object;B)I */ -JNIEXPORT jint JNICALL Java_edu_wpi_first_wpilibj_hal_I2CJNI_i2CTransaction( - JNIEnv* env, jclass, jint port, jbyte address, jobject dataToSend, - jbyte sendSize, jobject dataReceived, jbyte receiveSize) { +JNIEXPORT jint JNICALL +Java_edu_wpi_first_wpilibj_hal_I2CJNI_i2CTransaction + (JNIEnv* env, jclass, jint port, jbyte address, jobject dataToSend, + jbyte sendSize, jobject dataReceived, jbyte receiveSize) +{ I2CJNI_LOG(logDEBUG) << "Calling I2CJNI i2CTransaction"; I2CJNI_LOG(logDEBUG) << "Port = " << port; I2CJNI_LOG(logDEBUG) << "Address = " << (jint)address; uint8_t* dataToSendPtr = nullptr; if (dataToSend != 0) { - dataToSendPtr = (uint8_t*)env->GetDirectBufferAddress(dataToSend); + dataToSendPtr = + reinterpret_cast(env->GetDirectBufferAddress(dataToSend)); } - I2CJNI_LOG(logDEBUG) << "DataToSendPtr = " << (jint*)dataToSendPtr; + I2CJNI_LOG(logDEBUG) << "DataToSendPtr = " + << reinterpret_cast(dataToSendPtr); I2CJNI_LOG(logDEBUG) << "SendSize = " << (jint)sendSize; uint8_t* dataReceivedPtr = - (uint8_t*)env->GetDirectBufferAddress(dataReceived); - I2CJNI_LOG(logDEBUG) << "DataReceivedPtr = " << (jint*)dataReceivedPtr; + reinterpret_cast(env->GetDirectBufferAddress(dataReceived)); + I2CJNI_LOG(logDEBUG) << "DataReceivedPtr = " + << reinterpret_cast(dataReceivedPtr); I2CJNI_LOG(logDEBUG) << "ReceiveSize = " << (jint)receiveSize; - jint returnValue = HAL_TransactionI2C(static_cast(port), address, dataToSendPtr, sendSize, - dataReceivedPtr, receiveSize); + jint returnValue = + HAL_TransactionI2C(static_cast(port), address, dataToSendPtr, + sendSize, dataReceivedPtr, receiveSize); I2CJNI_LOG(logDEBUG) << "ReturnValue = " << returnValue; return returnValue; } @@ -76,9 +85,11 @@ JNIEXPORT jint JNICALL Java_edu_wpi_first_wpilibj_hal_I2CJNI_i2CTransaction( * Method: i2CTransactionB * Signature: (IB[BB[BB)I */ -JNIEXPORT jint JNICALL Java_edu_wpi_first_wpilibj_hal_I2CJNI_i2CTransactionB( - JNIEnv* env, jclass, jint port, jbyte address, jbyteArray dataToSend, - jbyte sendSize, jbyteArray dataReceived, jbyte receiveSize) { +JNIEXPORT jint JNICALL +Java_edu_wpi_first_wpilibj_hal_I2CJNI_i2CTransactionB + (JNIEnv* env, jclass, jint port, jbyte address, jbyteArray dataToSend, + jbyte sendSize, jbyteArray dataReceived, jbyte receiveSize) +{ I2CJNI_LOG(logDEBUG) << "Calling I2CJNI i2CTransactionB"; I2CJNI_LOG(logDEBUG) << "Port = " << port; I2CJNI_LOG(logDEBUG) << "Address = " << (jint)address; @@ -88,11 +99,11 @@ JNIEXPORT jint JNICALL Java_edu_wpi_first_wpilibj_hal_I2CJNI_i2CTransactionB( I2CJNI_LOG(logDEBUG) << "ReceiveSize = " << (jint)receiveSize; jint returnValue = HAL_TransactionI2C(static_cast(port), address, - reinterpret_cast( + reinterpret_cast( JByteArrayRef(env, dataToSend).array().data()), sendSize, recvBuf.data(), receiveSize); env->SetByteArrayRegion(dataReceived, 0, receiveSize, - reinterpret_cast(recvBuf.data())); + reinterpret_cast(recvBuf.data())); I2CJNI_LOG(logDEBUG) << "ReturnValue = " << returnValue; return returnValue; } @@ -100,22 +111,26 @@ JNIEXPORT jint JNICALL Java_edu_wpi_first_wpilibj_hal_I2CJNI_i2CTransactionB( /* * Class: edu_wpi_first_wpilibj_hal_I2CJNI * Method: i2CWrite - * Signature: (IBLjava/nio/ByteBuffer;B)I + * Signature: (IBLjava/lang/Object;B)I */ -JNIEXPORT jint JNICALL Java_edu_wpi_first_wpilibj_hal_I2CJNI_i2CWrite( - JNIEnv* env, jclass, jint port, jbyte address, jobject dataToSend, - jbyte sendSize) { +JNIEXPORT jint JNICALL +Java_edu_wpi_first_wpilibj_hal_I2CJNI_i2CWrite + (JNIEnv* env, jclass, jint port, jbyte address, jobject dataToSend, + jbyte sendSize) +{ I2CJNI_LOG(logDEBUG) << "Calling I2CJNI i2CWrite"; I2CJNI_LOG(logDEBUG) << "Port = " << port; I2CJNI_LOG(logDEBUG) << "Address = " << (jint)address; uint8_t* dataToSendPtr = nullptr; if (dataToSend != 0) { - dataToSendPtr = (uint8_t*)env->GetDirectBufferAddress(dataToSend); + dataToSendPtr = + reinterpret_cast(env->GetDirectBufferAddress(dataToSend)); } I2CJNI_LOG(logDEBUG) << "DataToSendPtr = " << dataToSendPtr; I2CJNI_LOG(logDEBUG) << "SendSize = " << (jint)sendSize; - jint returnValue = HAL_WriteI2C(static_cast(port), address, dataToSendPtr, sendSize); + jint returnValue = HAL_WriteI2C(static_cast(port), address, + dataToSendPtr, sendSize); I2CJNI_LOG(logDEBUG) << "ReturnValue = " << (jint)returnValue; return returnValue; } @@ -125,16 +140,18 @@ JNIEXPORT jint JNICALL Java_edu_wpi_first_wpilibj_hal_I2CJNI_i2CWrite( * Method: i2CWriteB * Signature: (IB[BB)I */ -JNIEXPORT jint JNICALL Java_edu_wpi_first_wpilibj_hal_I2CJNI_i2CWriteB( - JNIEnv* env, jclass, jint port, jbyte address, jbyteArray dataToSend, - jbyte sendSize) { +JNIEXPORT jint JNICALL +Java_edu_wpi_first_wpilibj_hal_I2CJNI_i2CWriteB + (JNIEnv* env, jclass, jint port, jbyte address, jbyteArray dataToSend, + jbyte sendSize) +{ I2CJNI_LOG(logDEBUG) << "Calling I2CJNI i2CWrite"; I2CJNI_LOG(logDEBUG) << "Port = " << port; I2CJNI_LOG(logDEBUG) << "Address = " << (jint)address; I2CJNI_LOG(logDEBUG) << "SendSize = " << (jint)sendSize; jint returnValue = HAL_WriteI2C(static_cast(port), address, - reinterpret_cast( + reinterpret_cast( JByteArrayRef(env, dataToSend).array().data()), sendSize); I2CJNI_LOG(logDEBUG) << "ReturnValue = " << (jint)returnValue; @@ -144,19 +161,22 @@ JNIEXPORT jint JNICALL Java_edu_wpi_first_wpilibj_hal_I2CJNI_i2CWriteB( /* * Class: edu_wpi_first_wpilibj_hal_I2CJNI * Method: i2CRead - * Signature: (IBLjava/nio/ByteBuffer;B)I + * Signature: (IBLjava/lang/Object;B)I */ -JNIEXPORT jint JNICALL Java_edu_wpi_first_wpilibj_hal_I2CJNI_i2CRead( - JNIEnv* env, jclass, jint port, jbyte address, jobject dataReceived, - jbyte receiveSize) { +JNIEXPORT jint JNICALL +Java_edu_wpi_first_wpilibj_hal_I2CJNI_i2CRead + (JNIEnv* env, jclass, jint port, jbyte address, jobject dataReceived, + jbyte receiveSize) +{ I2CJNI_LOG(logDEBUG) << "Calling I2CJNI i2CRead"; I2CJNI_LOG(logDEBUG) << "Port = " << port; I2CJNI_LOG(logDEBUG) << "Address = " << address; uint8_t* dataReceivedPtr = - (uint8_t*)env->GetDirectBufferAddress(dataReceived); + reinterpret_cast(env->GetDirectBufferAddress(dataReceived)); I2CJNI_LOG(logDEBUG) << "DataReceivedPtr = " << dataReceivedPtr; I2CJNI_LOG(logDEBUG) << "ReceiveSize = " << receiveSize; - jint returnValue = HAL_ReadI2C(static_cast(port), address, dataReceivedPtr, receiveSize); + jint returnValue = HAL_ReadI2C(static_cast(port), address, + dataReceivedPtr, receiveSize); I2CJNI_LOG(logDEBUG) << "ReturnValue = " << returnValue; return returnValue; } @@ -166,18 +186,21 @@ JNIEXPORT jint JNICALL Java_edu_wpi_first_wpilibj_hal_I2CJNI_i2CRead( * Method: i2CReadB * Signature: (IB[BB)I */ -JNIEXPORT jint JNICALL Java_edu_wpi_first_wpilibj_hal_I2CJNI_i2CReadB( - JNIEnv* env, jclass, jint port, jbyte address, jbyteArray dataReceived, - jbyte receiveSize) { +JNIEXPORT jint JNICALL +Java_edu_wpi_first_wpilibj_hal_I2CJNI_i2CReadB + (JNIEnv* env, jclass, jint port, jbyte address, jbyteArray dataReceived, + jbyte receiveSize) +{ I2CJNI_LOG(logDEBUG) << "Calling I2CJNI i2CRead"; I2CJNI_LOG(logDEBUG) << "Port = " << port; I2CJNI_LOG(logDEBUG) << "Address = " << address; I2CJNI_LOG(logDEBUG) << "ReceiveSize = " << receiveSize; wpi::SmallVector recvBuf; recvBuf.resize(receiveSize); - jint returnValue = HAL_ReadI2C(static_cast(port), address, recvBuf.data(), receiveSize); + jint returnValue = HAL_ReadI2C(static_cast(port), address, + recvBuf.data(), receiveSize); env->SetByteArrayRegion(dataReceived, 0, receiveSize, - reinterpret_cast(recvBuf.data())); + reinterpret_cast(recvBuf.data())); I2CJNI_LOG(logDEBUG) << "ReturnValue = " << returnValue; return returnValue; } @@ -188,7 +211,9 @@ JNIEXPORT jint JNICALL Java_edu_wpi_first_wpilibj_hal_I2CJNI_i2CReadB( * Signature: (I)V */ JNIEXPORT void JNICALL -Java_edu_wpi_first_wpilibj_hal_I2CJNI_i2CClose(JNIEnv*, jclass, jint port) { +Java_edu_wpi_first_wpilibj_hal_I2CJNI_i2CClose + (JNIEnv*, jclass, jint port) +{ I2CJNI_LOG(logDEBUG) << "Calling I2CJNI i2CClose"; HAL_CloseI2C(static_cast(port)); } diff --git a/hal/src/main/native/cpp/jni/InterruptJNI.cpp b/hal/src/main/native/cpp/jni/InterruptJNI.cpp index c4a1b111d4..84bf58ed05 100644 --- a/hal/src/main/native/cpp/jni/InterruptJNI.cpp +++ b/hal/src/main/native/cpp/jni/InterruptJNI.cpp @@ -1,21 +1,21 @@ /*----------------------------------------------------------------------------*/ -/* Copyright (c) FIRST 2016. All Rights Reserved. */ +/* Copyright (c) 2016-2018 FIRST. 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. */ /*----------------------------------------------------------------------------*/ -#include #include + #include +#include #include #include #include -#include "HAL/cpp/Log.h" - #include "HAL/Interrupts.h" +#include "HAL/cpp/Log.h" #include "HALUtil.h" #include "edu_wpi_first_wpilibj_hal_InterruptJNI.h" @@ -27,7 +27,7 @@ TLogLevel interruptJNILogLevel = logERROR; if (level > interruptJNILogLevel) \ ; \ else \ - Log().Get(level) + Log().Get(level) // Thread where callbacks are actually performed. // @@ -84,8 +84,8 @@ void InterruptThreadJNI::Main() { args.version = JNI_VERSION_1_2; args.name = const_cast("Interrupt"); args.group = nullptr; - jint rs = GetJVM()->AttachCurrentThreadAsDaemon(reinterpret_cast(&env), - &args); + jint rs = GetJVM()->AttachCurrentThreadAsDaemon( + reinterpret_cast(&env), &args); if (rs != JNI_OK) return; std::unique_lock lock(m_mutex); @@ -126,10 +126,11 @@ extern "C" { * Signature: (Z)I */ JNIEXPORT jint JNICALL -Java_edu_wpi_first_wpilibj_hal_InterruptJNI_initializeInterrupts( - JNIEnv* env, jclass, jboolean watcher) { +Java_edu_wpi_first_wpilibj_hal_InterruptJNI_initializeInterrupts + (JNIEnv* env, jclass, jboolean watcher) +{ INTERRUPTJNI_LOG(logDEBUG) << "Calling INTERRUPTJNI initializeInterrupts"; - INTERRUPTJNI_LOG(logDEBUG) << "watcher = " << (bool)watcher; + INTERRUPTJNI_LOG(logDEBUG) << "watcher = " << static_cast(watcher); int32_t status = 0; HAL_InterruptHandle interrupt = HAL_InitializeInterrupts(watcher, &status); @@ -144,13 +145,15 @@ Java_edu_wpi_first_wpilibj_hal_InterruptJNI_initializeInterrupts( /* * Class: edu_wpi_first_wpilibj_hal_InterruptJNI * Method: cleanInterrupts - * Signature: (J)V + * Signature: (I)V */ JNIEXPORT void JNICALL -Java_edu_wpi_first_wpilibj_hal_InterruptJNI_cleanInterrupts( - JNIEnv* env, jclass, jint interruptHandle) { +Java_edu_wpi_first_wpilibj_hal_InterruptJNI_cleanInterrupts + (JNIEnv* env, jclass, jint interruptHandle) +{ INTERRUPTJNI_LOG(logDEBUG) << "Calling INTERRUPTJNI cleanInterrupts"; - INTERRUPTJNI_LOG(logDEBUG) << "Interrupt Handle = " << (HAL_InterruptHandle)interruptHandle; + INTERRUPTJNI_LOG(logDEBUG) + << "Interrupt Handle = " << (HAL_InterruptHandle)interruptHandle; int32_t status = 0; HAL_CleanInterrupts((HAL_InterruptHandle)interruptHandle, &status); @@ -163,14 +166,16 @@ Java_edu_wpi_first_wpilibj_hal_InterruptJNI_cleanInterrupts( /* * Class: edu_wpi_first_wpilibj_hal_InterruptJNI * Method: waitForInterrupt - * Signature: (JD)V + * Signature: (IDZ)I */ JNIEXPORT jint JNICALL -Java_edu_wpi_first_wpilibj_hal_InterruptJNI_waitForInterrupt( - JNIEnv* env, jclass, jint interruptHandle, jdouble timeout, - jboolean ignorePrevious) { +Java_edu_wpi_first_wpilibj_hal_InterruptJNI_waitForInterrupt + (JNIEnv* env, jclass, jint interruptHandle, jdouble timeout, + jboolean ignorePrevious) +{ INTERRUPTJNI_LOG(logDEBUG) << "Calling INTERRUPTJNI waitForInterrupt"; - INTERRUPTJNI_LOG(logDEBUG) << "Interrupt Handle = " << (HAL_InterruptHandle)interruptHandle; + INTERRUPTJNI_LOG(logDEBUG) + << "Interrupt Handle = " << (HAL_InterruptHandle)interruptHandle; int32_t status = 0; int32_t result = HAL_WaitForInterrupt((HAL_InterruptHandle)interruptHandle, @@ -185,13 +190,15 @@ Java_edu_wpi_first_wpilibj_hal_InterruptJNI_waitForInterrupt( /* * Class: edu_wpi_first_wpilibj_hal_InterruptJNI * Method: enableInterrupts - * Signature: (J)V + * Signature: (I)V */ JNIEXPORT void JNICALL -Java_edu_wpi_first_wpilibj_hal_InterruptJNI_enableInterrupts( - JNIEnv* env, jclass, jint interruptHandle) { +Java_edu_wpi_first_wpilibj_hal_InterruptJNI_enableInterrupts + (JNIEnv* env, jclass, jint interruptHandle) +{ INTERRUPTJNI_LOG(logDEBUG) << "Calling INTERRUPTJNI enableInterrupts"; - INTERRUPTJNI_LOG(logDEBUG) << "Interrupt Handle = " << (HAL_InterruptHandle)interruptHandle; + INTERRUPTJNI_LOG(logDEBUG) + << "Interrupt Handle = " << (HAL_InterruptHandle)interruptHandle; int32_t status = 0; HAL_EnableInterrupts((HAL_InterruptHandle)interruptHandle, &status); @@ -204,13 +211,15 @@ Java_edu_wpi_first_wpilibj_hal_InterruptJNI_enableInterrupts( /* * Class: edu_wpi_first_wpilibj_hal_InterruptJNI * Method: disableInterrupts - * Signature: (J)V + * Signature: (I)V */ JNIEXPORT void JNICALL -Java_edu_wpi_first_wpilibj_hal_InterruptJNI_disableInterrupts( - JNIEnv* env, jclass, jint interruptHandle) { +Java_edu_wpi_first_wpilibj_hal_InterruptJNI_disableInterrupts + (JNIEnv* env, jclass, jint interruptHandle) +{ INTERRUPTJNI_LOG(logDEBUG) << "Calling INTERRUPTJNI disableInterrupts"; - INTERRUPTJNI_LOG(logDEBUG) << "Interrupt Handle = " << (HAL_InterruptHandle)interruptHandle; + INTERRUPTJNI_LOG(logDEBUG) + << "Interrupt Handle = " << (HAL_InterruptHandle)interruptHandle; int32_t status = 0; HAL_DisableInterrupts((HAL_InterruptHandle)interruptHandle, &status); @@ -223,16 +232,20 @@ Java_edu_wpi_first_wpilibj_hal_InterruptJNI_disableInterrupts( /* * Class: edu_wpi_first_wpilibj_hal_InterruptJNI * Method: readInterruptRisingTimestamp - * Signature: (J)D + * Signature: (I)D */ JNIEXPORT jdouble JNICALL -Java_edu_wpi_first_wpilibj_hal_InterruptJNI_readInterruptRisingTimestamp( - JNIEnv* env, jclass, jint interruptHandle) { - INTERRUPTJNI_LOG(logDEBUG) << "Calling INTERRUPTJNI readInterruptRisingTimestamp"; - INTERRUPTJNI_LOG(logDEBUG) << "Interrupt Handle = " << (HAL_InterruptHandle)interruptHandle; +Java_edu_wpi_first_wpilibj_hal_InterruptJNI_readInterruptRisingTimestamp + (JNIEnv* env, jclass, jint interruptHandle) +{ + INTERRUPTJNI_LOG(logDEBUG) + << "Calling INTERRUPTJNI readInterruptRisingTimestamp"; + INTERRUPTJNI_LOG(logDEBUG) + << "Interrupt Handle = " << (HAL_InterruptHandle)interruptHandle; int32_t status = 0; - jdouble timeStamp = HAL_ReadInterruptRisingTimestamp((HAL_InterruptHandle)interruptHandle, &status); + jdouble timeStamp = HAL_ReadInterruptRisingTimestamp( + (HAL_InterruptHandle)interruptHandle, &status); INTERRUPTJNI_LOG(logDEBUG) << "Status = " << status; CheckStatus(env, status); @@ -242,16 +255,20 @@ Java_edu_wpi_first_wpilibj_hal_InterruptJNI_readInterruptRisingTimestamp( /* * Class: edu_wpi_first_wpilibj_hal_InterruptJNI * Method: readInterruptFallingTimestamp - * Signature: (J)D + * Signature: (I)D */ JNIEXPORT jdouble JNICALL -Java_edu_wpi_first_wpilibj_hal_InterruptJNI_readInterruptFallingTimestamp( - JNIEnv* env, jclass, jint interruptHandle) { - INTERRUPTJNI_LOG(logDEBUG) << "Calling INTERRUPTJNI readInterruptFallingTimestamp"; - INTERRUPTJNI_LOG(logDEBUG) << "Interrupt Handle = " << (HAL_InterruptHandle)interruptHandle; +Java_edu_wpi_first_wpilibj_hal_InterruptJNI_readInterruptFallingTimestamp + (JNIEnv* env, jclass, jint interruptHandle) +{ + INTERRUPTJNI_LOG(logDEBUG) + << "Calling INTERRUPTJNI readInterruptFallingTimestamp"; + INTERRUPTJNI_LOG(logDEBUG) + << "Interrupt Handle = " << (HAL_InterruptHandle)interruptHandle; int32_t status = 0; - jdouble timeStamp = HAL_ReadInterruptFallingTimestamp((HAL_InterruptHandle)interruptHandle, &status); + jdouble timeStamp = HAL_ReadInterruptFallingTimestamp( + (HAL_InterruptHandle)interruptHandle, &status); INTERRUPTJNI_LOG(logDEBUG) << "Status = " << status; CheckStatus(env, status); @@ -264,17 +281,20 @@ Java_edu_wpi_first_wpilibj_hal_InterruptJNI_readInterruptFallingTimestamp( * Signature: (III)V */ JNIEXPORT void JNICALL -Java_edu_wpi_first_wpilibj_hal_InterruptJNI_requestInterrupts( - JNIEnv* env, jclass, jint interruptHandle, jint digitalSourceHandle, - jint analogTriggerType) { +Java_edu_wpi_first_wpilibj_hal_InterruptJNI_requestInterrupts + (JNIEnv* env, jclass, jint interruptHandle, jint digitalSourceHandle, + jint analogTriggerType) +{ INTERRUPTJNI_LOG(logDEBUG) << "Calling INTERRUPTJNI requestInterrupts"; - INTERRUPTJNI_LOG(logDEBUG) << "Interrupt Handle = " << (HAL_InterruptHandle)interruptHandle; + INTERRUPTJNI_LOG(logDEBUG) + << "Interrupt Handle = " << (HAL_InterruptHandle)interruptHandle; INTERRUPTJNI_LOG(logDEBUG) << "digitalSourceHandle = " << digitalSourceHandle; INTERRUPTJNI_LOG(logDEBUG) << "analogTriggerType = " << analogTriggerType; int32_t status = 0; - HAL_RequestInterrupts((HAL_InterruptHandle)interruptHandle, (HAL_Handle)digitalSourceHandle, - (HAL_AnalogTriggerType)analogTriggerType, &status); + HAL_RequestInterrupts((HAL_InterruptHandle)interruptHandle, + (HAL_Handle)digitalSourceHandle, + (HAL_AnalogTriggerType)analogTriggerType, &status); INTERRUPTJNI_LOG(logDEBUG) << "Status = " << status; CheckStatus(env, status); @@ -283,15 +303,15 @@ Java_edu_wpi_first_wpilibj_hal_InterruptJNI_requestInterrupts( /* * Class: edu_wpi_first_wpilibj_hal_InterruptJNI * Method: attachInterruptHandler - * Signature: - * (JLedu/wpi/first/wpilibj/hal/InterruptJNI/InterruptHandlerFunction;Ljava/nio/ByteBuffer;)V + * Signature: (ILjava/lang/Object;Ljava/lang/Object;)V */ JNIEXPORT void JNICALL -Java_edu_wpi_first_wpilibj_hal_InterruptJNI_attachInterruptHandler( - JNIEnv* env, jclass, jint interruptHandle, jobject handler, - jobject param) { +Java_edu_wpi_first_wpilibj_hal_InterruptJNI_attachInterruptHandler + (JNIEnv* env, jclass, jint interruptHandle, jobject handler, jobject param) +{ INTERRUPTJNI_LOG(logDEBUG) << "Calling INTERRUPTJNI attachInterruptHandler"; - INTERRUPTJNI_LOG(logDEBUG) << "Interrupt Handle = " << (HAL_InterruptHandle)interruptHandle; + INTERRUPTJNI_LOG(logDEBUG) + << "Interrupt Handle = " << (HAL_InterruptHandle)interruptHandle; jclass cls = env->GetObjectClass(handler); INTERRUPTJNI_LOG(logDEBUG) << "class = " << cls; @@ -315,8 +335,8 @@ Java_edu_wpi_first_wpilibj_hal_InterruptJNI_attachInterruptHandler( INTERRUPTJNI_LOG(logDEBUG) << "InterruptThreadJNI Ptr = " << intr; int32_t status = 0; - HAL_AttachInterruptHandler((HAL_InterruptHandle)interruptHandle, interruptHandler, intr, - &status); + HAL_AttachInterruptHandler((HAL_InterruptHandle)interruptHandle, + interruptHandler, intr, &status); INTERRUPTJNI_LOG(logDEBUG) << "Status = " << status; CheckStatus(env, status); @@ -325,20 +345,24 @@ Java_edu_wpi_first_wpilibj_hal_InterruptJNI_attachInterruptHandler( /* * Class: edu_wpi_first_wpilibj_hal_InterruptJNI * Method: setInterruptUpSourceEdge - * Signature: (JZZ)V + * Signature: (IZZ)V */ JNIEXPORT void JNICALL -Java_edu_wpi_first_wpilibj_hal_InterruptJNI_setInterruptUpSourceEdge( - JNIEnv* env, jclass, jint interruptHandle, jboolean risingEdge, - jboolean fallingEdge) { +Java_edu_wpi_first_wpilibj_hal_InterruptJNI_setInterruptUpSourceEdge + (JNIEnv* env, jclass, jint interruptHandle, jboolean risingEdge, + jboolean fallingEdge) +{ INTERRUPTJNI_LOG(logDEBUG) << "Calling INTERRUPTJNI setInterruptUpSourceEdge"; - INTERRUPTJNI_LOG(logDEBUG) << "Interrupt Handle = " << (HAL_InterruptHandle)interruptHandle; - INTERRUPTJNI_LOG(logDEBUG) << "Rising Edge = " << (bool)risingEdge; - INTERRUPTJNI_LOG(logDEBUG) << "Falling Edge = " << (bool)fallingEdge; + INTERRUPTJNI_LOG(logDEBUG) + << "Interrupt Handle = " << (HAL_InterruptHandle)interruptHandle; + INTERRUPTJNI_LOG(logDEBUG) + << "Rising Edge = " << static_cast(risingEdge); + INTERRUPTJNI_LOG(logDEBUG) + << "Falling Edge = " << static_cast(fallingEdge); int32_t status = 0; - HAL_SetInterruptUpSourceEdge((HAL_InterruptHandle)interruptHandle, risingEdge, fallingEdge, - &status); + HAL_SetInterruptUpSourceEdge((HAL_InterruptHandle)interruptHandle, risingEdge, + fallingEdge, &status); INTERRUPTJNI_LOG(logDEBUG) << "Status = " << status; CheckStatus(env, status); diff --git a/hal/src/main/native/cpp/jni/NotifierJNI.cpp b/hal/src/main/native/cpp/jni/NotifierJNI.cpp index b55bddcb54..0befd678ba 100644 --- a/hal/src/main/native/cpp/jni/NotifierJNI.cpp +++ b/hal/src/main/native/cpp/jni/NotifierJNI.cpp @@ -1,16 +1,18 @@ /*----------------------------------------------------------------------------*/ -/* Copyright (c) FIRST 2016. All Rights Reserved. */ +/* Copyright (c) 2016-2018 FIRST. 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. */ /*----------------------------------------------------------------------------*/ -#include "HAL/Notifier.h" -#include #include -#include -#include "HALUtil.h" + +#include +#include + +#include "HAL/Notifier.h" #include "HAL/cpp/Log.h" +#include "HALUtil.h" #include "edu_wpi_first_wpilibj_hal_NotifierJNI.h" using namespace frc; @@ -22,7 +24,7 @@ TLogLevel notifierJNILogLevel = logWARNING; if (level > notifierJNILogLevel) \ ; \ else \ - Log().Get(level) + Log().Get(level) extern "C" { @@ -32,8 +34,9 @@ extern "C" { * Signature: ()I */ JNIEXPORT jint JNICALL -Java_edu_wpi_first_wpilibj_hal_NotifierJNI_initializeNotifier( - JNIEnv *env, jclass) { +Java_edu_wpi_first_wpilibj_hal_NotifierJNI_initializeNotifier + (JNIEnv* env, jclass) +{ NOTIFIERJNI_LOG(logDEBUG) << "Calling NOTIFIERJNI initializeNotifier"; int32_t status = 0; @@ -43,7 +46,7 @@ Java_edu_wpi_first_wpilibj_hal_NotifierJNI_initializeNotifier( NOTIFIERJNI_LOG(logDEBUG) << "Status = " << status; if (notifierHandle <= 0 || !CheckStatusForceThrow(env, status)) { - return 0; // something went wrong in HAL + return 0; // something went wrong in HAL } return (jint)notifierHandle; @@ -55,8 +58,9 @@ Java_edu_wpi_first_wpilibj_hal_NotifierJNI_initializeNotifier( * Signature: (I)V */ JNIEXPORT void JNICALL -Java_edu_wpi_first_wpilibj_hal_NotifierJNI_stopNotifier( - JNIEnv *env, jclass cls, jint notifierHandle) { +Java_edu_wpi_first_wpilibj_hal_NotifierJNI_stopNotifier + (JNIEnv* env, jclass cls, jint notifierHandle) +{ NOTIFIERJNI_LOG(logDEBUG) << "Calling NOTIFIERJNI stopNotifier"; NOTIFIERJNI_LOG(logDEBUG) << "Notifier Handle = " << notifierHandle; @@ -72,8 +76,10 @@ Java_edu_wpi_first_wpilibj_hal_NotifierJNI_stopNotifier( * Method: cleanNotifier * Signature: (I)V */ -JNIEXPORT void JNICALL Java_edu_wpi_first_wpilibj_hal_NotifierJNI_cleanNotifier( - JNIEnv *env, jclass, jint notifierHandle) { +JNIEXPORT void JNICALL +Java_edu_wpi_first_wpilibj_hal_NotifierJNI_cleanNotifier + (JNIEnv* env, jclass, jint notifierHandle) +{ NOTIFIERJNI_LOG(logDEBUG) << "Calling NOTIFIERJNI cleanNotifier"; NOTIFIERJNI_LOG(logDEBUG) << "Notifier Handle = " << notifierHandle; @@ -90,8 +96,9 @@ JNIEXPORT void JNICALL Java_edu_wpi_first_wpilibj_hal_NotifierJNI_cleanNotifier( * Signature: (IJ)V */ JNIEXPORT void JNICALL -Java_edu_wpi_first_wpilibj_hal_NotifierJNI_updateNotifierAlarm( - JNIEnv *env, jclass cls, jint notifierHandle, jlong triggerTime) { +Java_edu_wpi_first_wpilibj_hal_NotifierJNI_updateNotifierAlarm + (JNIEnv* env, jclass cls, jint notifierHandle, jlong triggerTime) +{ NOTIFIERJNI_LOG(logDEBUG) << "Calling NOTIFIERJNI updateNotifierAlarm"; NOTIFIERJNI_LOG(logDEBUG) << "Notifier Handle = " << notifierHandle; @@ -99,7 +106,8 @@ Java_edu_wpi_first_wpilibj_hal_NotifierJNI_updateNotifierAlarm( NOTIFIERJNI_LOG(logDEBUG) << "triggerTime = " << triggerTime; int32_t status = 0; - HAL_UpdateNotifierAlarm((HAL_NotifierHandle)notifierHandle, (uint64_t)triggerTime, &status); + HAL_UpdateNotifierAlarm((HAL_NotifierHandle)notifierHandle, + static_cast(triggerTime), &status); NOTIFIERJNI_LOG(logDEBUG) << "Status = " << status; CheckStatus(env, status); } @@ -110,8 +118,9 @@ Java_edu_wpi_first_wpilibj_hal_NotifierJNI_updateNotifierAlarm( * Signature: (I)V */ JNIEXPORT void JNICALL -Java_edu_wpi_first_wpilibj_hal_NotifierJNI_cancelNotifierAlarm( - JNIEnv *env, jclass cls, jint notifierHandle) { +Java_edu_wpi_first_wpilibj_hal_NotifierJNI_cancelNotifierAlarm + (JNIEnv* env, jclass cls, jint notifierHandle) +{ NOTIFIERJNI_LOG(logDEBUG) << "Calling NOTIFIERJNI cancelNotifierAlarm"; NOTIFIERJNI_LOG(logDEBUG) << "Notifier Handle = " << notifierHandle; @@ -128,8 +137,9 @@ Java_edu_wpi_first_wpilibj_hal_NotifierJNI_cancelNotifierAlarm( * Signature: (I)J */ JNIEXPORT jlong JNICALL -Java_edu_wpi_first_wpilibj_hal_NotifierJNI_waitForNotifierAlarm( - JNIEnv *env, jclass cls, jint notifierHandle) { +Java_edu_wpi_first_wpilibj_hal_NotifierJNI_waitForNotifierAlarm + (JNIEnv* env, jclass cls, jint notifierHandle) +{ NOTIFIERJNI_LOG(logDEBUG) << "Calling NOTIFIERJNI waitForNotifierAlarm"; NOTIFIERJNI_LOG(logDEBUG) << "Notifier Handle = " << notifierHandle; diff --git a/hal/src/main/native/cpp/jni/OSSerialPortJNI.cpp b/hal/src/main/native/cpp/jni/OSSerialPortJNI.cpp index 7a6c9a5d3e..33f6652f99 100644 --- a/hal/src/main/native/cpp/jni/OSSerialPortJNI.cpp +++ b/hal/src/main/native/cpp/jni/OSSerialPortJNI.cpp @@ -1,19 +1,20 @@ /*----------------------------------------------------------------------------*/ -/* Copyright (c) FIRST 2016. All Rights Reserved. */ +/* Copyright (c) 2016-2018 FIRST. 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. */ /*----------------------------------------------------------------------------*/ -#include #include -#include "HAL/cpp/Log.h" -#include "edu_wpi_first_wpilibj_hal_OSSerialPortJNI.h" +#include + +#include #include "HAL/OSSerialPort.h" +#include "HAL/cpp/Log.h" #include "HALUtil.h" -#include "wpi/jni_util.h" +#include "edu_wpi_first_wpilibj_hal_OSSerialPortJNI.h" using namespace frc; using namespace wpi::java; @@ -25,7 +26,7 @@ TLogLevel osserialJNILogLevel = logWARNING; if (level > osserialJNILogLevel) \ ; \ else \ - Log().Get(level) + Log().Get(level) extern "C" { @@ -35,8 +36,9 @@ extern "C" { * Signature: (B)V */ JNIEXPORT void JNICALL -Java_edu_wpi_first_wpilibj_hal_OSSerialPortJNI_serialInitializePort( - JNIEnv* env, jclass, jbyte port) { +Java_edu_wpi_first_wpilibj_hal_OSSerialPortJNI_serialInitializePort + (JNIEnv* env, jclass, jbyte port) +{ SERIALJNI_LOG(logDEBUG) << "Calling Serial Initialize"; SERIALJNI_LOG(logDEBUG) << "Port = " << (jint)port; int32_t status = 0; @@ -51,8 +53,9 @@ Java_edu_wpi_first_wpilibj_hal_OSSerialPortJNI_serialInitializePort( * Signature: (BI)V */ JNIEXPORT void JNICALL -Java_edu_wpi_first_wpilibj_hal_OSSerialPortJNI_serialSetBaudRate( - JNIEnv* env, jclass, jbyte port, jint rate) { +Java_edu_wpi_first_wpilibj_hal_OSSerialPortJNI_serialSetBaudRate + (JNIEnv* env, jclass, jbyte port, jint rate) +{ SERIALJNI_LOG(logDEBUG) << "Setting Serial Baud Rate"; SERIALJNI_LOG(logDEBUG) << "Baud: " << rate; int32_t status = 0; @@ -67,8 +70,9 @@ Java_edu_wpi_first_wpilibj_hal_OSSerialPortJNI_serialSetBaudRate( * Signature: (BB)V */ JNIEXPORT void JNICALL -Java_edu_wpi_first_wpilibj_hal_OSSerialPortJNI_serialSetDataBits( - JNIEnv* env, jclass, jbyte port, jbyte bits) { +Java_edu_wpi_first_wpilibj_hal_OSSerialPortJNI_serialSetDataBits + (JNIEnv* env, jclass, jbyte port, jbyte bits) +{ SERIALJNI_LOG(logDEBUG) << "Setting Serial Data Bits"; SERIALJNI_LOG(logDEBUG) << "Data Bits: " << bits; int32_t status = 0; @@ -83,8 +87,9 @@ Java_edu_wpi_first_wpilibj_hal_OSSerialPortJNI_serialSetDataBits( * Signature: (BB)V */ JNIEXPORT void JNICALL -Java_edu_wpi_first_wpilibj_hal_OSSerialPortJNI_serialSetParity( - JNIEnv* env, jclass, jbyte port, jbyte parity) { +Java_edu_wpi_first_wpilibj_hal_OSSerialPortJNI_serialSetParity + (JNIEnv* env, jclass, jbyte port, jbyte parity) +{ SERIALJNI_LOG(logDEBUG) << "Setting Serial Parity"; SERIALJNI_LOG(logDEBUG) << "Parity: " << parity; int32_t status = 0; @@ -99,8 +104,9 @@ Java_edu_wpi_first_wpilibj_hal_OSSerialPortJNI_serialSetParity( * Signature: (BB)V */ JNIEXPORT void JNICALL -Java_edu_wpi_first_wpilibj_hal_OSSerialPortJNI_serialSetStopBits( - JNIEnv* env, jclass, jbyte port, jbyte bits) { +Java_edu_wpi_first_wpilibj_hal_OSSerialPortJNI_serialSetStopBits + (JNIEnv* env, jclass, jbyte port, jbyte bits) +{ SERIALJNI_LOG(logDEBUG) << "Setting Serial Stop Bits"; SERIALJNI_LOG(logDEBUG) << "Stop Bits: " << bits; int32_t status = 0; @@ -115,8 +121,9 @@ Java_edu_wpi_first_wpilibj_hal_OSSerialPortJNI_serialSetStopBits( * Signature: (BB)V */ JNIEXPORT void JNICALL -Java_edu_wpi_first_wpilibj_hal_OSSerialPortJNI_serialSetWriteMode( - JNIEnv* env, jclass, jbyte port, jbyte mode) { +Java_edu_wpi_first_wpilibj_hal_OSSerialPortJNI_serialSetWriteMode + (JNIEnv* env, jclass, jbyte port, jbyte mode) +{ SERIALJNI_LOG(logDEBUG) << "Setting Serial Write Mode"; SERIALJNI_LOG(logDEBUG) << "Write mode: " << mode; int32_t status = 0; @@ -131,8 +138,9 @@ Java_edu_wpi_first_wpilibj_hal_OSSerialPortJNI_serialSetWriteMode( * Signature: (BB)V */ JNIEXPORT void JNICALL -Java_edu_wpi_first_wpilibj_hal_OSSerialPortJNI_serialSetFlowControl( - JNIEnv* env, jclass, jbyte port, jbyte flow) { +Java_edu_wpi_first_wpilibj_hal_OSSerialPortJNI_serialSetFlowControl + (JNIEnv* env, jclass, jbyte port, jbyte flow) +{ SERIALJNI_LOG(logDEBUG) << "Setting Serial Flow Control"; SERIALJNI_LOG(logDEBUG) << "Flow Control: " << flow; int32_t status = 0; @@ -147,8 +155,9 @@ Java_edu_wpi_first_wpilibj_hal_OSSerialPortJNI_serialSetFlowControl( * Signature: (BD)V */ JNIEXPORT void JNICALL -Java_edu_wpi_first_wpilibj_hal_OSSerialPortJNI_serialSetTimeout( - JNIEnv* env, jclass, jbyte port, jdouble timeout) { +Java_edu_wpi_first_wpilibj_hal_OSSerialPortJNI_serialSetTimeout + (JNIEnv* env, jclass, jbyte port, jdouble timeout) +{ SERIALJNI_LOG(logDEBUG) << "Setting Serial Timeout"; SERIALJNI_LOG(logDEBUG) << "Timeout: " << timeout; int32_t status = 0; @@ -163,12 +172,14 @@ Java_edu_wpi_first_wpilibj_hal_OSSerialPortJNI_serialSetTimeout( * Signature: (BC)V */ JNIEXPORT void JNICALL -Java_edu_wpi_first_wpilibj_hal_OSSerialPortJNI_serialEnableTermination( - JNIEnv* env, jclass, jbyte port, jchar terminator) { +Java_edu_wpi_first_wpilibj_hal_OSSerialPortJNI_serialEnableTermination + (JNIEnv* env, jclass, jbyte port, jchar terminator) +{ SERIALJNI_LOG(logDEBUG) << "Setting Serial Enable Termination"; SERIALJNI_LOG(logDEBUG) << "Terminator: " << terminator; int32_t status = 0; - HAL_EnableOSSerialTermination(static_cast(port), terminator, &status); + HAL_EnableOSSerialTermination(static_cast(port), terminator, + &status); SERIALJNI_LOG(logDEBUG) << "Status = " << status; CheckStatus(env, status); } @@ -179,8 +190,9 @@ Java_edu_wpi_first_wpilibj_hal_OSSerialPortJNI_serialEnableTermination( * Signature: (B)V */ JNIEXPORT void JNICALL -Java_edu_wpi_first_wpilibj_hal_OSSerialPortJNI_serialDisableTermination( - JNIEnv* env, jclass, jbyte port) { +Java_edu_wpi_first_wpilibj_hal_OSSerialPortJNI_serialDisableTermination + (JNIEnv* env, jclass, jbyte port) +{ SERIALJNI_LOG(logDEBUG) << "Setting Serial Disable termination"; int32_t status = 0; HAL_DisableOSSerialTermination(static_cast(port), &status); @@ -194,12 +206,14 @@ Java_edu_wpi_first_wpilibj_hal_OSSerialPortJNI_serialDisableTermination( * Signature: (BI)V */ JNIEXPORT void JNICALL -Java_edu_wpi_first_wpilibj_hal_OSSerialPortJNI_serialSetReadBufferSize( - JNIEnv* env, jclass, jbyte port, jint size) { +Java_edu_wpi_first_wpilibj_hal_OSSerialPortJNI_serialSetReadBufferSize + (JNIEnv* env, jclass, jbyte port, jint size) +{ SERIALJNI_LOG(logDEBUG) << "Setting Serial Read Buffer Size"; SERIALJNI_LOG(logDEBUG) << "Size: " << size; int32_t status = 0; - HAL_SetOSSerialReadBufferSize(static_cast(port), size, &status); + HAL_SetOSSerialReadBufferSize(static_cast(port), size, + &status); SERIALJNI_LOG(logDEBUG) << "Status = " << status; CheckStatus(env, status); } @@ -210,12 +224,14 @@ Java_edu_wpi_first_wpilibj_hal_OSSerialPortJNI_serialSetReadBufferSize( * Signature: (BI)V */ JNIEXPORT void JNICALL -Java_edu_wpi_first_wpilibj_hal_OSSerialPortJNI_serialSetWriteBufferSize( - JNIEnv* env, jclass, jbyte port, jint size) { +Java_edu_wpi_first_wpilibj_hal_OSSerialPortJNI_serialSetWriteBufferSize + (JNIEnv* env, jclass, jbyte port, jint size) +{ SERIALJNI_LOG(logDEBUG) << "Setting Serial Write Buffer Size"; SERIALJNI_LOG(logDEBUG) << "Size: " << size; int32_t status = 0; - HAL_SetOSSerialWriteBufferSize(static_cast(port), size, &status); + HAL_SetOSSerialWriteBufferSize(static_cast(port), size, + &status); SERIALJNI_LOG(logDEBUG) << "Status = " << status; CheckStatus(env, status); } @@ -226,11 +242,13 @@ Java_edu_wpi_first_wpilibj_hal_OSSerialPortJNI_serialSetWriteBufferSize( * Signature: (B)I */ JNIEXPORT jint JNICALL -Java_edu_wpi_first_wpilibj_hal_OSSerialPortJNI_serialGetBytesReceived( - JNIEnv* env, jclass, jbyte port) { +Java_edu_wpi_first_wpilibj_hal_OSSerialPortJNI_serialGetBytesReceived + (JNIEnv* env, jclass, jbyte port) +{ SERIALJNI_LOG(logDEBUG) << "Serial Get Bytes Received"; int32_t status = 0; - jint retVal = HAL_GetOSSerialBytesReceived(static_cast(port), &status); + jint retVal = + HAL_GetOSSerialBytesReceived(static_cast(port), &status); SERIALJNI_LOG(logDEBUG) << "Status = " << status; CheckStatus(env, status); return retVal; @@ -241,16 +259,18 @@ Java_edu_wpi_first_wpilibj_hal_OSSerialPortJNI_serialGetBytesReceived( * Method: serialRead * Signature: (B[BI)I */ -JNIEXPORT jint JNICALL Java_edu_wpi_first_wpilibj_hal_OSSerialPortJNI_serialRead( - JNIEnv* env, jclass, jbyte port, jbyteArray dataReceived, jint size) { +JNIEXPORT jint JNICALL +Java_edu_wpi_first_wpilibj_hal_OSSerialPortJNI_serialRead + (JNIEnv* env, jclass, jbyte port, jbyteArray dataReceived, jint size) +{ SERIALJNI_LOG(logDEBUG) << "Serial Read"; wpi::SmallVector recvBuf; recvBuf.resize(size); int32_t status = 0; - jint retVal = HAL_ReadOSSerial(static_cast(port), recvBuf.data(), - size, &status); + jint retVal = HAL_ReadOSSerial(static_cast(port), + recvBuf.data(), size, &status); env->SetByteArrayRegion(dataReceived, 0, size, - reinterpret_cast(recvBuf.data())); + reinterpret_cast(recvBuf.data())); SERIALJNI_LOG(logDEBUG) << "ReturnValue = " << retVal; SERIALJNI_LOG(logDEBUG) << "Status = " << status; CheckStatus(env, status); @@ -262,13 +282,15 @@ JNIEXPORT jint JNICALL Java_edu_wpi_first_wpilibj_hal_OSSerialPortJNI_serialRead * Method: serialWrite * Signature: (B[BI)I */ -JNIEXPORT jint JNICALL Java_edu_wpi_first_wpilibj_hal_OSSerialPortJNI_serialWrite( - JNIEnv* env, jclass, jbyte port, jbyteArray dataToSend, jint size) { +JNIEXPORT jint JNICALL +Java_edu_wpi_first_wpilibj_hal_OSSerialPortJNI_serialWrite + (JNIEnv* env, jclass, jbyte port, jbyteArray dataToSend, jint size) +{ SERIALJNI_LOG(logDEBUG) << "Serial Write"; int32_t status = 0; jint retVal = HAL_WriteOSSerial(static_cast(port), - reinterpret_cast( + reinterpret_cast( JByteArrayRef(env, dataToSend).array().data()), size, &status); SERIALJNI_LOG(logDEBUG) << "ReturnValue = " << retVal; @@ -282,8 +304,10 @@ JNIEXPORT jint JNICALL Java_edu_wpi_first_wpilibj_hal_OSSerialPortJNI_serialWrit * Method: serialFlush * Signature: (B)V */ -JNIEXPORT void JNICALL Java_edu_wpi_first_wpilibj_hal_OSSerialPortJNI_serialFlush( - JNIEnv* env, jclass, jbyte port) { +JNIEXPORT void JNICALL +Java_edu_wpi_first_wpilibj_hal_OSSerialPortJNI_serialFlush + (JNIEnv* env, jclass, jbyte port) +{ SERIALJNI_LOG(logDEBUG) << "Serial Flush"; int32_t status = 0; HAL_FlushOSSerial(static_cast(port), &status); @@ -296,8 +320,10 @@ JNIEXPORT void JNICALL Java_edu_wpi_first_wpilibj_hal_OSSerialPortJNI_serialFlus * Method: serialClear * Signature: (B)V */ -JNIEXPORT void JNICALL Java_edu_wpi_first_wpilibj_hal_OSSerialPortJNI_serialClear( - JNIEnv* env, jclass, jbyte port) { +JNIEXPORT void JNICALL +Java_edu_wpi_first_wpilibj_hal_OSSerialPortJNI_serialClear + (JNIEnv* env, jclass, jbyte port) +{ SERIALJNI_LOG(logDEBUG) << "Serial Clear"; int32_t status = 0; HAL_ClearOSSerial(static_cast(port), &status); @@ -310,8 +336,10 @@ JNIEXPORT void JNICALL Java_edu_wpi_first_wpilibj_hal_OSSerialPortJNI_serialClea * Method: serialClose * Signature: (B)V */ -JNIEXPORT void JNICALL Java_edu_wpi_first_wpilibj_hal_OSSerialPortJNI_serialClose( - JNIEnv* env, jclass, jbyte port) { +JNIEXPORT void JNICALL +Java_edu_wpi_first_wpilibj_hal_OSSerialPortJNI_serialClose + (JNIEnv* env, jclass, jbyte port) +{ SERIALJNI_LOG(logDEBUG) << "Serial Close"; int32_t status = 0; HAL_CloseOSSerial(static_cast(port), &status); diff --git a/hal/src/main/native/cpp/jni/PDPJNI.cpp b/hal/src/main/native/cpp/jni/PDPJNI.cpp index 54ea85799a..3cf97d2905 100644 --- a/hal/src/main/native/cpp/jni/PDPJNI.cpp +++ b/hal/src/main/native/cpp/jni/PDPJNI.cpp @@ -1,5 +1,5 @@ /*----------------------------------------------------------------------------*/ -/* Copyright (c) FIRST 2016. All Rights Reserved. */ +/* Copyright (c) 2016-2018 FIRST. 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. */ @@ -16,11 +16,13 @@ extern "C" { /* * Class: edu_wpi_first_wpilibj_hal_PDPJNI - * Method: getPDPTemperature + * Method: initializePDP * Signature: (I)V */ -JNIEXPORT void JNICALL Java_edu_wpi_first_wpilibj_hal_PDPJNI_initializePDP( - JNIEnv *env, jclass, jint module) { +JNIEXPORT void JNICALL +Java_edu_wpi_first_wpilibj_hal_PDPJNI_initializePDP + (JNIEnv* env, jclass, jint module) +{ int32_t status = 0; HAL_InitializePDP(module, &status); CheckStatusRange(env, status, 0, HAL_GetNumPDPModules(), module); @@ -29,20 +31,24 @@ JNIEXPORT void JNICALL Java_edu_wpi_first_wpilibj_hal_PDPJNI_initializePDP( /* * Class: edu_wpi_first_wpilibj_hal_PDPJNI * Method: checkPDPChannel - * Signature: (I)Z; -*/ -JNIEXPORT jboolean JNICALL Java_edu_wpi_first_wpilibj_hal_PDPJNI_checkPDPChannel( - JNIEnv *env, jclass, jint channel) { + * Signature: (I)Z + */ +JNIEXPORT jboolean JNICALL +Java_edu_wpi_first_wpilibj_hal_PDPJNI_checkPDPChannel + (JNIEnv* env, jclass, jint channel) +{ return HAL_CheckPDPChannel(channel); } /* * Class: edu_wpi_first_wpilibj_hal_PDPJNI * Method: checkPDPModule - * Signature: (I)Z; -*/ -JNIEXPORT jboolean JNICALL Java_edu_wpi_first_wpilibj_hal_PDPJNI_checkPDPModule( - JNIEnv *env, jclass, jint module) { + * Signature: (I)Z + */ +JNIEXPORT jboolean JNICALL +Java_edu_wpi_first_wpilibj_hal_PDPJNI_checkPDPModule + (JNIEnv* env, jclass, jint module) +{ return HAL_CheckPDPModule(module); } @@ -52,8 +58,9 @@ JNIEXPORT jboolean JNICALL Java_edu_wpi_first_wpilibj_hal_PDPJNI_checkPDPModule( * Signature: (I)D */ JNIEXPORT jdouble JNICALL -Java_edu_wpi_first_wpilibj_hal_PDPJNI_getPDPTemperature( - JNIEnv *env, jclass, jint module) { +Java_edu_wpi_first_wpilibj_hal_PDPJNI_getPDPTemperature + (JNIEnv* env, jclass, jint module) +{ int32_t status = 0; double temperature = HAL_GetPDPTemperature(module, &status); CheckStatus(env, status, false); @@ -65,8 +72,10 @@ Java_edu_wpi_first_wpilibj_hal_PDPJNI_getPDPTemperature( * Method: getPDPVoltage * Signature: (I)D */ -JNIEXPORT jdouble JNICALL Java_edu_wpi_first_wpilibj_hal_PDPJNI_getPDPVoltage( - JNIEnv *env, jclass, jint module) { +JNIEXPORT jdouble JNICALL +Java_edu_wpi_first_wpilibj_hal_PDPJNI_getPDPVoltage + (JNIEnv* env, jclass, jint module) +{ int32_t status = 0; double voltage = HAL_GetPDPVoltage(module, &status); CheckStatus(env, status, false); @@ -79,8 +88,9 @@ JNIEXPORT jdouble JNICALL Java_edu_wpi_first_wpilibj_hal_PDPJNI_getPDPVoltage( * Signature: (BI)D */ JNIEXPORT jdouble JNICALL -Java_edu_wpi_first_wpilibj_hal_PDPJNI_getPDPChannelCurrent( - JNIEnv *env, jclass, jbyte channel, jint module) { +Java_edu_wpi_first_wpilibj_hal_PDPJNI_getPDPChannelCurrent + (JNIEnv* env, jclass, jbyte channel, jint module) +{ int32_t status = 0; double current = HAL_GetPDPChannelCurrent(module, channel, &status); CheckStatus(env, status, false); @@ -93,8 +103,9 @@ Java_edu_wpi_first_wpilibj_hal_PDPJNI_getPDPChannelCurrent( * Signature: (I)D */ JNIEXPORT jdouble JNICALL -Java_edu_wpi_first_wpilibj_hal_PDPJNI_getPDPTotalCurrent( - JNIEnv *env, jclass, jint module) { +Java_edu_wpi_first_wpilibj_hal_PDPJNI_getPDPTotalCurrent + (JNIEnv* env, jclass, jint module) +{ int32_t status = 0; double current = HAL_GetPDPTotalCurrent(module, &status); CheckStatus(env, status, false); @@ -107,8 +118,9 @@ Java_edu_wpi_first_wpilibj_hal_PDPJNI_getPDPTotalCurrent( * Signature: (I)D */ JNIEXPORT jdouble JNICALL -Java_edu_wpi_first_wpilibj_hal_PDPJNI_getPDPTotalPower( - JNIEnv *env, jclass, jint module) { +Java_edu_wpi_first_wpilibj_hal_PDPJNI_getPDPTotalPower + (JNIEnv* env, jclass, jint module) +{ int32_t status = 0; double power = HAL_GetPDPTotalPower(module, &status); CheckStatus(env, status, false); @@ -117,12 +129,13 @@ Java_edu_wpi_first_wpilibj_hal_PDPJNI_getPDPTotalPower( /* * Class: edu_wpi_first_wpilibj_hal_PDPJNI - * Method: resetPDPTotalEnergy + * Method: getPDPTotalEnergy * Signature: (I)D */ JNIEXPORT jdouble JNICALL -Java_edu_wpi_first_wpilibj_hal_PDPJNI_getPDPTotalEnergy( - JNIEnv *env, jclass, jint module) { +Java_edu_wpi_first_wpilibj_hal_PDPJNI_getPDPTotalEnergy + (JNIEnv* env, jclass, jint module) +{ int32_t status = 0; double energy = HAL_GetPDPTotalEnergy(module, &status); CheckStatus(env, status, false); @@ -135,8 +148,9 @@ Java_edu_wpi_first_wpilibj_hal_PDPJNI_getPDPTotalEnergy( * Signature: (I)V */ JNIEXPORT void JNICALL -Java_edu_wpi_first_wpilibj_hal_PDPJNI_resetPDPTotalEnergy( - JNIEnv *env, jclass, jint module) { +Java_edu_wpi_first_wpilibj_hal_PDPJNI_resetPDPTotalEnergy + (JNIEnv* env, jclass, jint module) +{ int32_t status = 0; HAL_ResetPDPTotalEnergy(module, &status); CheckStatus(env, status, false); @@ -144,12 +158,13 @@ Java_edu_wpi_first_wpilibj_hal_PDPJNI_resetPDPTotalEnergy( /* * Class: edu_wpi_first_wpilibj_hal_PDPJNI - * Method: clearStickyFaults + * Method: clearPDPStickyFaults * Signature: (I)V */ JNIEXPORT void JNICALL -Java_edu_wpi_first_wpilibj_hal_PDPJNI_clearPDPStickyFaults( - JNIEnv *env, jclass, jint module) { +Java_edu_wpi_first_wpilibj_hal_PDPJNI_clearPDPStickyFaults + (JNIEnv* env, jclass, jint module) +{ int32_t status = 0; HAL_ClearPDPStickyFaults(module, &status); CheckStatus(env, status, false); diff --git a/hal/src/main/native/cpp/jni/PWMJNI.cpp b/hal/src/main/native/cpp/jni/PWMJNI.cpp index 3869176c37..ffbf5064d9 100644 --- a/hal/src/main/native/cpp/jni/PWMJNI.cpp +++ b/hal/src/main/native/cpp/jni/PWMJNI.cpp @@ -1,21 +1,21 @@ /*----------------------------------------------------------------------------*/ -/* Copyright (c) FIRST 2016. All Rights Reserved. */ +/* Copyright (c) 2016-2018 FIRST. 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. */ /*----------------------------------------------------------------------------*/ -#include #include -#include "HAL/cpp/Log.h" -#include "edu_wpi_first_wpilibj_hal_PWMJNI.h" +#include #include "HAL/DIO.h" #include "HAL/PWM.h" #include "HAL/Ports.h" -#include "HALUtil.h" +#include "HAL/cpp/Log.h" #include "HAL/handles/HandlesInternal.h" +#include "HALUtil.h" +#include "edu_wpi_first_wpilibj_hal_PWMJNI.h" using namespace frc; @@ -26,18 +26,19 @@ TLogLevel pwmJNILogLevel = logWARNING; if (level > pwmJNILogLevel) \ ; \ else \ - Log().Get(level) + Log().Get(level) extern "C" { /* * Class: edu_wpi_first_wpilibj_hal_PWMJNI * Method: initializePWMPort - * Signature: (I)I; + * Signature: (I)I */ JNIEXPORT jint JNICALL -Java_edu_wpi_first_wpilibj_hal_PWMJNI_initializePWMPort( - JNIEnv *env, jclass, jint id) { +Java_edu_wpi_first_wpilibj_hal_PWMJNI_initializePWMPort + (JNIEnv* env, jclass, jint id) +{ PWMJNI_LOG(logDEBUG) << "Calling PWMJNI initializePWMPort"; PWMJNI_LOG(logDEBUG) << "Port Handle = " << (HAL_PortHandle)id; int32_t status = 0; @@ -52,22 +53,26 @@ Java_edu_wpi_first_wpilibj_hal_PWMJNI_initializePWMPort( /* * Class: edu_wpi_first_wpilibj_hal_PWMJNI * Method: checkPWMChannel - * Signature: (I)Z; -*/ -JNIEXPORT jboolean JNICALL Java_edu_wpi_first_wpilibj_hal_PWMJNI_checkPWMChannel( - JNIEnv *env, jclass, jint channel) { + * Signature: (I)Z + */ +JNIEXPORT jboolean JNICALL +Java_edu_wpi_first_wpilibj_hal_PWMJNI_checkPWMChannel + (JNIEnv* env, jclass, jint channel) +{ PWMJNI_LOG(logDEBUG) << "Calling PWMJNI checkPWMChannel"; PWMJNI_LOG(logDEBUG) << "Channel = " << channel; return HAL_CheckPWMChannel(channel); } /* -* Class: edu_wpi_first_wpilibj_hal_DIOJNI -* Method: freeDIOPort -* Signature: (I)V; -*/ -JNIEXPORT void JNICALL Java_edu_wpi_first_wpilibj_hal_PWMJNI_freePWMPort( - JNIEnv *env, jclass, jint id) { + * Class: edu_wpi_first_wpilibj_hal_PWMJNI + * Method: freePWMPort + * Signature: (I)V + */ +JNIEXPORT void JNICALL +Java_edu_wpi_first_wpilibj_hal_PWMJNI_freePWMPort + (JNIEnv* env, jclass, jint id) +{ PWMJNI_LOG(logDEBUG) << "Calling PWMJNI freePWMPort"; PWMJNI_LOG(logDEBUG) << "Port Handle = " << (HAL_DigitalHandle)id; int32_t status = 0; @@ -76,44 +81,50 @@ JNIEXPORT void JNICALL Java_edu_wpi_first_wpilibj_hal_PWMJNI_freePWMPort( } /* -* Class: edu_wpi_first_wpilibj_hal_DIOJNI -* Method: setPWMConfigRaw -* Signature: (IIIIII)V; -*/ -JNIEXPORT void JNICALL Java_edu_wpi_first_wpilibj_hal_PWMJNI_setPWMConfigRaw( - JNIEnv *env, jclass, jint id, jint maxPwm, jint deadbandMaxPwm, - jint centerPwm, jint deadbandMinPwm, jint minPwm) { + * Class: edu_wpi_first_wpilibj_hal_PWMJNI + * Method: setPWMConfigRaw + * Signature: (IIIIII)V + */ +JNIEXPORT void JNICALL +Java_edu_wpi_first_wpilibj_hal_PWMJNI_setPWMConfigRaw + (JNIEnv* env, jclass, jint id, jint maxPwm, jint deadbandMaxPwm, + jint centerPwm, jint deadbandMinPwm, jint minPwm) +{ PWMJNI_LOG(logDEBUG) << "Calling PWMJNI setPWMConfigRaw"; PWMJNI_LOG(logDEBUG) << "Port Handle = " << (HAL_DigitalHandle)id; int32_t status = 0; - HAL_SetPWMConfigRaw((HAL_DigitalHandle)id, maxPwm, deadbandMaxPwm, centerPwm, - deadbandMinPwm, minPwm, &status); + HAL_SetPWMConfigRaw((HAL_DigitalHandle)id, maxPwm, deadbandMaxPwm, centerPwm, + deadbandMinPwm, minPwm, &status); CheckStatus(env, status); } /* -* Class: edu_wpi_first_wpilibj_hal_DIOJNI -* Method: setPWMConfig -* Signature: (IDDDDD)V; -*/ -JNIEXPORT void JNICALL Java_edu_wpi_first_wpilibj_hal_PWMJNI_setPWMConfig( - JNIEnv *env, jclass, jint id, jdouble maxPwm, jdouble deadbandMaxPwm, - jdouble centerPwm, jdouble deadbandMinPwm, jdouble minPwm) { + * Class: edu_wpi_first_wpilibj_hal_PWMJNI + * Method: setPWMConfig + * Signature: (IDDDDD)V + */ +JNIEXPORT void JNICALL +Java_edu_wpi_first_wpilibj_hal_PWMJNI_setPWMConfig + (JNIEnv* env, jclass, jint id, jdouble maxPwm, jdouble deadbandMaxPwm, + jdouble centerPwm, jdouble deadbandMinPwm, jdouble minPwm) +{ PWMJNI_LOG(logDEBUG) << "Calling PWMJNI setPWMConfig"; PWMJNI_LOG(logDEBUG) << "Port Handle = " << (HAL_DigitalHandle)id; int32_t status = 0; - HAL_SetPWMConfig((HAL_DigitalHandle)id, maxPwm, deadbandMaxPwm, centerPwm, - deadbandMinPwm, minPwm, &status); + HAL_SetPWMConfig((HAL_DigitalHandle)id, maxPwm, deadbandMaxPwm, centerPwm, + deadbandMinPwm, minPwm, &status); CheckStatus(env, status); } /* -* Class: edu_wpi_first_wpilibj_hal_DIOJNI -* Method: getPWMConfigRaw -* Signature: (I)Ledu/wpi/first/wpilibj/PWMConfigDataResult; -*/ -JNIEXPORT jobject JNICALL Java_edu_wpi_first_wpilibj_hal_PWMJNI_getPWMConfigRaw( - JNIEnv *env, jclass, jint id) { + * Class: edu_wpi_first_wpilibj_hal_PWMJNI + * Method: getPWMConfigRaw + * Signature: (I)Ljava/lang/Object; + */ +JNIEXPORT jobject JNICALL +Java_edu_wpi_first_wpilibj_hal_PWMJNI_getPWMConfigRaw + (JNIEnv* env, jclass, jint id) +{ PWMJNI_LOG(logDEBUG) << "Calling PWMJNI getPWMConfigRaw"; PWMJNI_LOG(logDEBUG) << "Port Handle = " << (HAL_DigitalHandle)id; int32_t status = 0; @@ -122,8 +133,8 @@ JNIEXPORT jobject JNICALL Java_edu_wpi_first_wpilibj_hal_PWMJNI_getPWMConfigRaw( int32_t centerPwm = 0; int32_t deadbandMinPwm = 0; int32_t minPwm = 0; - HAL_GetPWMConfigRaw((HAL_DigitalHandle)id, &maxPwm, &deadbandMaxPwm, ¢erPwm, - &deadbandMinPwm, &minPwm, &status); + HAL_GetPWMConfigRaw((HAL_DigitalHandle)id, &maxPwm, &deadbandMaxPwm, + ¢erPwm, &deadbandMinPwm, &minPwm, &status); CheckStatus(env, status); return CreatePWMConfigDataResult(env, maxPwm, deadbandMaxPwm, centerPwm, deadbandMinPwm, minPwm); @@ -134,8 +145,10 @@ JNIEXPORT jobject JNICALL Java_edu_wpi_first_wpilibj_hal_PWMJNI_getPWMConfigRaw( * Method: setPWMEliminateDeadband * Signature: (IZ)V */ -JNIEXPORT void JNICALL Java_edu_wpi_first_wpilibj_hal_PWMJNI_setPWMEliminateDeadband( - JNIEnv* env, jclass, jint id, jboolean value) { +JNIEXPORT void JNICALL +Java_edu_wpi_first_wpilibj_hal_PWMJNI_setPWMEliminateDeadband + (JNIEnv* env, jclass, jint id, jboolean value) +{ PWMJNI_LOG(logDEBUG) << "PWM Handle = " << (HAL_DigitalHandle)id; int32_t status = 0; HAL_SetPWMEliminateDeadband((HAL_DigitalHandle)id, value, &status); @@ -148,8 +161,10 @@ JNIEXPORT void JNICALL Java_edu_wpi_first_wpilibj_hal_PWMJNI_setPWMEliminateDead * Method: getPWMEliminateDeadband * Signature: (I)Z */ -JNIEXPORT jboolean JNICALL Java_edu_wpi_first_wpilibj_hal_PWMJNI_getPWMEliminateDeadband( - JNIEnv* env, jclass, jint id) { +JNIEXPORT jboolean JNICALL +Java_edu_wpi_first_wpilibj_hal_PWMJNI_getPWMEliminateDeadband + (JNIEnv* env, jclass, jint id) +{ PWMJNI_LOG(logDEBUG) << "PWM Handle = " << (HAL_DigitalHandle)id; int32_t status = 0; auto val = HAL_GetPWMEliminateDeadband((HAL_DigitalHandle)id, &status); @@ -163,8 +178,10 @@ JNIEXPORT jboolean JNICALL Java_edu_wpi_first_wpilibj_hal_PWMJNI_getPWMEliminate * Method: setPWMRaw * Signature: (IS)V */ -JNIEXPORT void JNICALL Java_edu_wpi_first_wpilibj_hal_PWMJNI_setPWMRaw( - JNIEnv* env, jclass, jint id, jshort value) { +JNIEXPORT void JNICALL +Java_edu_wpi_first_wpilibj_hal_PWMJNI_setPWMRaw + (JNIEnv* env, jclass, jint id, jshort value) +{ PWMJNI_LOG(logDEBUG) << "PWM Handle = " << (HAL_DigitalHandle)id; PWMJNI_LOG(logDEBUG) << "PWM Value = " << value; int32_t status = 0; @@ -178,8 +195,10 @@ JNIEXPORT void JNICALL Java_edu_wpi_first_wpilibj_hal_PWMJNI_setPWMRaw( * Method: setPWMSpeed * Signature: (ID)V */ -JNIEXPORT void JNICALL Java_edu_wpi_first_wpilibj_hal_PWMJNI_setPWMSpeed( - JNIEnv* env, jclass, jint id, jdouble value) { +JNIEXPORT void JNICALL +Java_edu_wpi_first_wpilibj_hal_PWMJNI_setPWMSpeed + (JNIEnv* env, jclass, jint id, jdouble value) +{ PWMJNI_LOG(logDEBUG) << "PWM Handle = " << (HAL_DigitalHandle)id; PWMJNI_LOG(logDEBUG) << "PWM Value = " << value; int32_t status = 0; @@ -193,8 +212,10 @@ JNIEXPORT void JNICALL Java_edu_wpi_first_wpilibj_hal_PWMJNI_setPWMSpeed( * Method: setPWMPosition * Signature: (ID)V */ -JNIEXPORT void JNICALL Java_edu_wpi_first_wpilibj_hal_PWMJNI_setPWMPosition( - JNIEnv* env, jclass, jint id, jdouble value) { +JNIEXPORT void JNICALL +Java_edu_wpi_first_wpilibj_hal_PWMJNI_setPWMPosition + (JNIEnv* env, jclass, jint id, jdouble value) +{ PWMJNI_LOG(logDEBUG) << "PWM Handle = " << (HAL_DigitalHandle)id; PWMJNI_LOG(logDEBUG) << "PWM Value = " << value; int32_t status = 0; @@ -209,8 +230,9 @@ JNIEXPORT void JNICALL Java_edu_wpi_first_wpilibj_hal_PWMJNI_setPWMPosition( * Signature: (I)S */ JNIEXPORT jshort JNICALL -Java_edu_wpi_first_wpilibj_hal_PWMJNI_getPWMRaw( - JNIEnv* env, jclass, jint id) { +Java_edu_wpi_first_wpilibj_hal_PWMJNI_getPWMRaw + (JNIEnv* env, jclass, jint id) +{ PWMJNI_LOG(logDEBUG) << "PWM Handle = " << (HAL_DigitalHandle)id; int32_t status = 0; jshort returnValue = HAL_GetPWMRaw((HAL_DigitalHandle)id, &status); @@ -226,8 +248,9 @@ Java_edu_wpi_first_wpilibj_hal_PWMJNI_getPWMRaw( * Signature: (I)D */ JNIEXPORT jdouble JNICALL -Java_edu_wpi_first_wpilibj_hal_PWMJNI_getPWMSpeed( - JNIEnv* env, jclass, jint id) { +Java_edu_wpi_first_wpilibj_hal_PWMJNI_getPWMSpeed + (JNIEnv* env, jclass, jint id) +{ PWMJNI_LOG(logDEBUG) << "PWM Handle = " << (HAL_DigitalHandle)id; int32_t status = 0; jdouble returnValue = HAL_GetPWMSpeed((HAL_DigitalHandle)id, &status); @@ -243,8 +266,9 @@ Java_edu_wpi_first_wpilibj_hal_PWMJNI_getPWMSpeed( * Signature: (I)D */ JNIEXPORT jdouble JNICALL -Java_edu_wpi_first_wpilibj_hal_PWMJNI_getPWMPosition( - JNIEnv* env, jclass, jint id) { +Java_edu_wpi_first_wpilibj_hal_PWMJNI_getPWMPosition + (JNIEnv* env, jclass, jint id) +{ PWMJNI_LOG(logDEBUG) << "PWM Handle = " << (HAL_DigitalHandle)id; int32_t status = 0; jdouble returnValue = HAL_GetPWMPosition((HAL_DigitalHandle)id, &status); @@ -259,8 +283,10 @@ Java_edu_wpi_first_wpilibj_hal_PWMJNI_getPWMPosition( * Method: setPWMDisabled * Signature: (I)V */ -JNIEXPORT void JNICALL Java_edu_wpi_first_wpilibj_hal_PWMJNI_setPWMDisabled( - JNIEnv* env, jclass, jint id) { +JNIEXPORT void JNICALL +Java_edu_wpi_first_wpilibj_hal_PWMJNI_setPWMDisabled + (JNIEnv* env, jclass, jint id) +{ PWMJNI_LOG(logDEBUG) << "PWM Handle = " << (HAL_DigitalHandle)id; int32_t status = 0; HAL_SetPWMDisabled((HAL_DigitalHandle)id, &status); @@ -273,8 +299,10 @@ JNIEXPORT void JNICALL Java_edu_wpi_first_wpilibj_hal_PWMJNI_setPWMDisabled( * Method: latchPWMZero * Signature: (I)V */ -JNIEXPORT void JNICALL Java_edu_wpi_first_wpilibj_hal_PWMJNI_latchPWMZero( - JNIEnv* env, jclass, jint id) { +JNIEXPORT void JNICALL +Java_edu_wpi_first_wpilibj_hal_PWMJNI_latchPWMZero + (JNIEnv* env, jclass, jint id) +{ PWMJNI_LOG(logDEBUG) << "PWM Handle = " << (HAL_DigitalHandle)id; int32_t status = 0; HAL_LatchPWMZero((HAL_DigitalHandle)id, &status); @@ -287,8 +315,10 @@ JNIEXPORT void JNICALL Java_edu_wpi_first_wpilibj_hal_PWMJNI_latchPWMZero( * Method: setPWMPeriodScale * Signature: (II)V */ -JNIEXPORT void JNICALL Java_edu_wpi_first_wpilibj_hal_PWMJNI_setPWMPeriodScale( - JNIEnv* env, jclass, jint id, jint value) { +JNIEXPORT void JNICALL +Java_edu_wpi_first_wpilibj_hal_PWMJNI_setPWMPeriodScale + (JNIEnv* env, jclass, jint id, jint value) +{ PWMJNI_LOG(logDEBUG) << "PWM Handle = " << (HAL_DigitalHandle)id; PWMJNI_LOG(logDEBUG) << "PeriodScale Value = " << value; int32_t status = 0; diff --git a/hal/src/main/native/cpp/jni/PortsJNI.cpp b/hal/src/main/native/cpp/jni/PortsJNI.cpp index 89c63a3ab8..e09d6879f5 100644 --- a/hal/src/main/native/cpp/jni/PortsJNI.cpp +++ b/hal/src/main/native/cpp/jni/PortsJNI.cpp @@ -1,18 +1,18 @@ /*----------------------------------------------------------------------------*/ -/* Copyright (c) FIRST 2016. All Rights Reserved. */ +/* Copyright (c) 2016-2018 FIRST. 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. */ /*----------------------------------------------------------------------------*/ -#include #include -#include "HAL/cpp/Log.h" -#include "edu_wpi_first_wpilibj_hal_PortsJNI.h" +#include #include "HAL/Ports.h" +#include "HAL/cpp/Log.h" #include "HALUtil.h" +#include "edu_wpi_first_wpilibj_hal_PortsJNI.h" using namespace frc; @@ -21,9 +21,9 @@ TLogLevel portsJNILogLevel = logWARNING; #define PORTSJNI_LOG(level) \ if (level > portsJNILogLevel) \ - ; \ - else \ - Log().Get(level) + ; \ + else \ + Log().Get(level) extern "C" { /* @@ -32,266 +32,267 @@ extern "C" { * Signature: ()I */ JNIEXPORT jint JNICALL -Java_edu_wpi_first_wpilibj_hal_PortsJNI_getNumAccumulators( - JNIEnv *env, jclass) { +Java_edu_wpi_first_wpilibj_hal_PortsJNI_getNumAccumulators + (JNIEnv* env, jclass) +{ PORTSJNI_LOG(logDEBUG) << "Calling PortsJNI getNumAccumulators"; jint value = HAL_GetNumAccumulators(); PORTSJNI_LOG(logDEBUG) << "Value = " << value; return value; } - /* * Class: edu_wpi_first_wpilibj_hal_PortsJNI * Method: getNumAnalogTriggers * Signature: ()I */ JNIEXPORT jint JNICALL -Java_edu_wpi_first_wpilibj_hal_PortsJNI_getNumAnalogTriggers( - JNIEnv *env, jclass) { +Java_edu_wpi_first_wpilibj_hal_PortsJNI_getNumAnalogTriggers + (JNIEnv* env, jclass) +{ PORTSJNI_LOG(logDEBUG) << "Calling PortsJNI getNumAnalogTriggers"; jint value = HAL_GetNumAnalogTriggers(); PORTSJNI_LOG(logDEBUG) << "Value = " << value; return value; } - /* * Class: edu_wpi_first_wpilibj_hal_PortsJNI * Method: getNumAnalogInputs * Signature: ()I */ JNIEXPORT jint JNICALL -Java_edu_wpi_first_wpilibj_hal_PortsJNI_getNumAnalogInputs( - JNIEnv *env, jclass) { +Java_edu_wpi_first_wpilibj_hal_PortsJNI_getNumAnalogInputs + (JNIEnv* env, jclass) +{ PORTSJNI_LOG(logDEBUG) << "Calling PortsJNI getNumAnalogInputs"; jint value = HAL_GetNumAnalogInputs(); PORTSJNI_LOG(logDEBUG) << "Value = " << value; return value; } - /* * Class: edu_wpi_first_wpilibj_hal_PortsJNI * Method: getNumAnalogOutputs * Signature: ()I */ JNIEXPORT jint JNICALL -Java_edu_wpi_first_wpilibj_hal_PortsJNI_getNumAnalogOutputs( - JNIEnv *env, jclass) { +Java_edu_wpi_first_wpilibj_hal_PortsJNI_getNumAnalogOutputs + (JNIEnv* env, jclass) +{ PORTSJNI_LOG(logDEBUG) << "Calling PortsJNI getNumAnalogOutputs"; jint value = HAL_GetNumAnalogOutputs(); PORTSJNI_LOG(logDEBUG) << "Value = " << value; return value; } - /* * Class: edu_wpi_first_wpilibj_hal_PortsJNI * Method: getNumCounters * Signature: ()I */ JNIEXPORT jint JNICALL -Java_edu_wpi_first_wpilibj_hal_PortsJNI_getNumCounters( - JNIEnv *env, jclass) { +Java_edu_wpi_first_wpilibj_hal_PortsJNI_getNumCounters + (JNIEnv* env, jclass) +{ PORTSJNI_LOG(logDEBUG) << "Calling PortsJNI getNumCounters"; jint value = HAL_GetNumCounters(); PORTSJNI_LOG(logDEBUG) << "Value = " << value; return value; } - /* * Class: edu_wpi_first_wpilibj_hal_PortsJNI * Method: getNumDigitalHeaders * Signature: ()I */ JNIEXPORT jint JNICALL -Java_edu_wpi_first_wpilibj_hal_PortsJNI_getNumDigitalHeaders( - JNIEnv *env, jclass) { +Java_edu_wpi_first_wpilibj_hal_PortsJNI_getNumDigitalHeaders + (JNIEnv* env, jclass) +{ PORTSJNI_LOG(logDEBUG) << "Calling PortsJNI getNumDigitalHeaders"; jint value = HAL_GetNumDigitalHeaders(); PORTSJNI_LOG(logDEBUG) << "Value = " << value; return value; } - /* * Class: edu_wpi_first_wpilibj_hal_PortsJNI * Method: getNumPWMHeaders * Signature: ()I */ JNIEXPORT jint JNICALL -Java_edu_wpi_first_wpilibj_hal_PortsJNI_getNumPWMHeaders( - JNIEnv *env, jclass) { +Java_edu_wpi_first_wpilibj_hal_PortsJNI_getNumPWMHeaders + (JNIEnv* env, jclass) +{ PORTSJNI_LOG(logDEBUG) << "Calling PortsJNI getNumPWMHeaders"; jint value = HAL_GetNumPWMHeaders(); PORTSJNI_LOG(logDEBUG) << "Value = " << value; return value; } - /* * Class: edu_wpi_first_wpilibj_hal_PortsJNI * Method: getNumDigitalChannels * Signature: ()I */ JNIEXPORT jint JNICALL -Java_edu_wpi_first_wpilibj_hal_PortsJNI_getNumDigitalChannels( - JNIEnv *env, jclass) { +Java_edu_wpi_first_wpilibj_hal_PortsJNI_getNumDigitalChannels + (JNIEnv* env, jclass) +{ PORTSJNI_LOG(logDEBUG) << "Calling PortsJNI getNumDigitalChannels"; jint value = HAL_GetNumDigitalChannels(); PORTSJNI_LOG(logDEBUG) << "Value = " << value; return value; } - /* * Class: edu_wpi_first_wpilibj_hal_PortsJNI * Method: getNumPWMChannels * Signature: ()I */ JNIEXPORT jint JNICALL -Java_edu_wpi_first_wpilibj_hal_PortsJNI_getNumPWMChannels( - JNIEnv *env, jclass) { +Java_edu_wpi_first_wpilibj_hal_PortsJNI_getNumPWMChannels + (JNIEnv* env, jclass) +{ PORTSJNI_LOG(logDEBUG) << "Calling PortsJNI getNumPWMChannels"; jint value = HAL_GetNumPWMChannels(); PORTSJNI_LOG(logDEBUG) << "Value = " << value; return value; } - /* * Class: edu_wpi_first_wpilibj_hal_PortsJNI * Method: getNumDigitalPWMOutputs * Signature: ()I */ JNIEXPORT jint JNICALL -Java_edu_wpi_first_wpilibj_hal_PortsJNI_getNumDigitalPWMOutputs( - JNIEnv *env, jclass) { +Java_edu_wpi_first_wpilibj_hal_PortsJNI_getNumDigitalPWMOutputs + (JNIEnv* env, jclass) +{ PORTSJNI_LOG(logDEBUG) << "Calling PortsJNI getNumDigitalPWMOutputs"; jint value = HAL_GetNumDigitalPWMOutputs(); PORTSJNI_LOG(logDEBUG) << "Value = " << value; return value; } - /* * Class: edu_wpi_first_wpilibj_hal_PortsJNI * Method: getNumEncoders * Signature: ()I */ JNIEXPORT jint JNICALL -Java_edu_wpi_first_wpilibj_hal_PortsJNI_getNumEncoders( - JNIEnv *env, jclass) { +Java_edu_wpi_first_wpilibj_hal_PortsJNI_getNumEncoders + (JNIEnv* env, jclass) +{ PORTSJNI_LOG(logDEBUG) << "Calling PortsJNI getNumEncoders"; jint value = HAL_GetNumEncoders(); PORTSJNI_LOG(logDEBUG) << "Value = " << value; return value; } - /* * Class: edu_wpi_first_wpilibj_hal_PortsJNI * Method: getNumInterrupts * Signature: ()I */ JNIEXPORT jint JNICALL -Java_edu_wpi_first_wpilibj_hal_PortsJNI_getNumInterrupts( - JNIEnv *env, jclass) { +Java_edu_wpi_first_wpilibj_hal_PortsJNI_getNumInterrupts + (JNIEnv* env, jclass) +{ PORTSJNI_LOG(logDEBUG) << "Calling PortsJNI getNumInterrupts"; jint value = HAL_GetNumInterrupts(); PORTSJNI_LOG(logDEBUG) << "Value = " << value; return value; } - /* * Class: edu_wpi_first_wpilibj_hal_PortsJNI * Method: getNumRelayChannels * Signature: ()I */ JNIEXPORT jint JNICALL -Java_edu_wpi_first_wpilibj_hal_PortsJNI_getNumRelayChannels( - JNIEnv *env, jclass) { +Java_edu_wpi_first_wpilibj_hal_PortsJNI_getNumRelayChannels + (JNIEnv* env, jclass) +{ PORTSJNI_LOG(logDEBUG) << "Calling PortsJNI getNumRelayChannels"; jint value = HAL_GetNumRelayChannels(); PORTSJNI_LOG(logDEBUG) << "Value = " << value; return value; } - /* * Class: edu_wpi_first_wpilibj_hal_PortsJNI * Method: getNumRelayHeaders * Signature: ()I */ JNIEXPORT jint JNICALL -Java_edu_wpi_first_wpilibj_hal_PortsJNI_getNumRelayHeaders( - JNIEnv *env, jclass) { +Java_edu_wpi_first_wpilibj_hal_PortsJNI_getNumRelayHeaders + (JNIEnv* env, jclass) +{ PORTSJNI_LOG(logDEBUG) << "Calling PortsJNI getNumRelayHeaders"; jint value = HAL_GetNumRelayHeaders(); PORTSJNI_LOG(logDEBUG) << "Value = " << value; return value; } - /* * Class: edu_wpi_first_wpilibj_hal_PortsJNI * Method: getNumPCMModules * Signature: ()I */ JNIEXPORT jint JNICALL -Java_edu_wpi_first_wpilibj_hal_PortsJNI_getNumPCMModules( - JNIEnv *env, jclass) { +Java_edu_wpi_first_wpilibj_hal_PortsJNI_getNumPCMModules + (JNIEnv* env, jclass) +{ PORTSJNI_LOG(logDEBUG) << "Calling PortsJNI getNumPCMModules"; jint value = HAL_GetNumPCMModules(); PORTSJNI_LOG(logDEBUG) << "Value = " << value; return value; } - /* * Class: edu_wpi_first_wpilibj_hal_PortsJNI * Method: getNumSolenoidChannels * Signature: ()I */ JNIEXPORT jint JNICALL -Java_edu_wpi_first_wpilibj_hal_PortsJNI_getNumSolenoidChannels( - JNIEnv *env, jclass) { +Java_edu_wpi_first_wpilibj_hal_PortsJNI_getNumSolenoidChannels + (JNIEnv* env, jclass) +{ PORTSJNI_LOG(logDEBUG) << "Calling PortsJNI getNumSolenoidChannels"; jint value = HAL_GetNumSolenoidChannels(); PORTSJNI_LOG(logDEBUG) << "Value = " << value; return value; } - /* * Class: edu_wpi_first_wpilibj_hal_PortsJNI * Method: getNumPDPModules * Signature: ()I */ JNIEXPORT jint JNICALL -Java_edu_wpi_first_wpilibj_hal_PortsJNI_getNumPDPModules( - JNIEnv *env, jclass) { +Java_edu_wpi_first_wpilibj_hal_PortsJNI_getNumPDPModules + (JNIEnv* env, jclass) +{ PORTSJNI_LOG(logDEBUG) << "Calling PortsJNI getNumPDPModules"; jint value = HAL_GetNumPDPModules(); PORTSJNI_LOG(logDEBUG) << "Value = " << value; return value; } - /* * Class: edu_wpi_first_wpilibj_hal_PortsJNI * Method: getNumPDPChannels * Signature: ()I */ JNIEXPORT jint JNICALL -Java_edu_wpi_first_wpilibj_hal_PortsJNI_getNumPDPChannels( - JNIEnv *env, jclass) { +Java_edu_wpi_first_wpilibj_hal_PortsJNI_getNumPDPChannels + (JNIEnv* env, jclass) +{ PORTSJNI_LOG(logDEBUG) << "Calling PortsJNI getNumPDPChannels"; jint value = HAL_GetNumPDPChannels(); PORTSJNI_LOG(logDEBUG) << "Value = " << value; return value; } -} +} // extern "C" diff --git a/hal/src/main/native/cpp/jni/PowerJNI.cpp b/hal/src/main/native/cpp/jni/PowerJNI.cpp index 85f6c16510..a21ceaf365 100644 --- a/hal/src/main/native/cpp/jni/PowerJNI.cpp +++ b/hal/src/main/native/cpp/jni/PowerJNI.cpp @@ -1,12 +1,13 @@ /*----------------------------------------------------------------------------*/ -/* Copyright (c) FIRST 2016. All Rights Reserved. */ +/* Copyright (c) 2016-2018 FIRST. 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. */ /*----------------------------------------------------------------------------*/ -#include "HAL/Power.h" #include + +#include "HAL/Power.h" #include "HALUtil.h" #include "edu_wpi_first_wpilibj_hal_PowerJNI.h" @@ -20,7 +21,9 @@ extern "C" { * Signature: ()D */ JNIEXPORT jdouble JNICALL -Java_edu_wpi_first_wpilibj_hal_PowerJNI_getVinVoltage(JNIEnv* env, jclass) { +Java_edu_wpi_first_wpilibj_hal_PowerJNI_getVinVoltage + (JNIEnv* env, jclass) +{ int32_t status = 0; double val = HAL_GetVinVoltage(&status); CheckStatus(env, status); @@ -33,7 +36,9 @@ Java_edu_wpi_first_wpilibj_hal_PowerJNI_getVinVoltage(JNIEnv* env, jclass) { * Signature: ()D */ JNIEXPORT jdouble JNICALL -Java_edu_wpi_first_wpilibj_hal_PowerJNI_getVinCurrent(JNIEnv* env, jclass) { +Java_edu_wpi_first_wpilibj_hal_PowerJNI_getVinCurrent + (JNIEnv* env, jclass) +{ int32_t status = 0; double val = HAL_GetVinCurrent(&status); CheckStatus(env, status); @@ -46,7 +51,9 @@ Java_edu_wpi_first_wpilibj_hal_PowerJNI_getVinCurrent(JNIEnv* env, jclass) { * Signature: ()D */ JNIEXPORT jdouble JNICALL -Java_edu_wpi_first_wpilibj_hal_PowerJNI_getUserVoltage6V(JNIEnv* env, jclass) { +Java_edu_wpi_first_wpilibj_hal_PowerJNI_getUserVoltage6V + (JNIEnv* env, jclass) +{ int32_t status = 0; double val = HAL_GetUserVoltage6V(&status); CheckStatus(env, status); @@ -59,7 +66,9 @@ Java_edu_wpi_first_wpilibj_hal_PowerJNI_getUserVoltage6V(JNIEnv* env, jclass) { * Signature: ()D */ JNIEXPORT jdouble JNICALL -Java_edu_wpi_first_wpilibj_hal_PowerJNI_getUserCurrent6V(JNIEnv* env, jclass) { +Java_edu_wpi_first_wpilibj_hal_PowerJNI_getUserCurrent6V + (JNIEnv* env, jclass) +{ int32_t status = 0; double val = HAL_GetUserCurrent6V(&status); CheckStatus(env, status); @@ -72,7 +81,9 @@ Java_edu_wpi_first_wpilibj_hal_PowerJNI_getUserCurrent6V(JNIEnv* env, jclass) { * Signature: ()Z */ JNIEXPORT jboolean JNICALL -Java_edu_wpi_first_wpilibj_hal_PowerJNI_getUserActive6V(JNIEnv* env, jclass) { +Java_edu_wpi_first_wpilibj_hal_PowerJNI_getUserActive6V + (JNIEnv* env, jclass) +{ int32_t status = 0; bool val = HAL_GetUserActive6V(&status); CheckStatus(env, status); @@ -85,8 +96,9 @@ Java_edu_wpi_first_wpilibj_hal_PowerJNI_getUserActive6V(JNIEnv* env, jclass) { * Signature: ()I */ JNIEXPORT jint JNICALL -Java_edu_wpi_first_wpilibj_hal_PowerJNI_getUserCurrentFaults6V( - JNIEnv* env, jclass) { +Java_edu_wpi_first_wpilibj_hal_PowerJNI_getUserCurrentFaults6V + (JNIEnv* env, jclass) +{ int32_t status = 0; int32_t val = HAL_GetUserCurrentFaults6V(&status); CheckStatus(env, status); @@ -99,7 +111,9 @@ Java_edu_wpi_first_wpilibj_hal_PowerJNI_getUserCurrentFaults6V( * Signature: ()D */ JNIEXPORT jdouble JNICALL -Java_edu_wpi_first_wpilibj_hal_PowerJNI_getUserVoltage5V(JNIEnv* env, jclass) { +Java_edu_wpi_first_wpilibj_hal_PowerJNI_getUserVoltage5V + (JNIEnv* env, jclass) +{ int32_t status = 0; double val = HAL_GetUserVoltage5V(&status); CheckStatus(env, status); @@ -112,7 +126,9 @@ Java_edu_wpi_first_wpilibj_hal_PowerJNI_getUserVoltage5V(JNIEnv* env, jclass) { * Signature: ()D */ JNIEXPORT jdouble JNICALL -Java_edu_wpi_first_wpilibj_hal_PowerJNI_getUserCurrent5V(JNIEnv* env, jclass) { +Java_edu_wpi_first_wpilibj_hal_PowerJNI_getUserCurrent5V + (JNIEnv* env, jclass) +{ int32_t status = 0; double val = HAL_GetUserCurrent5V(&status); CheckStatus(env, status); @@ -125,7 +141,9 @@ Java_edu_wpi_first_wpilibj_hal_PowerJNI_getUserCurrent5V(JNIEnv* env, jclass) { * Signature: ()Z */ JNIEXPORT jboolean JNICALL -Java_edu_wpi_first_wpilibj_hal_PowerJNI_getUserActive5V(JNIEnv* env, jclass) { +Java_edu_wpi_first_wpilibj_hal_PowerJNI_getUserActive5V + (JNIEnv* env, jclass) +{ int32_t status = 0; bool val = HAL_GetUserActive5V(&status); CheckStatus(env, status); @@ -138,8 +156,9 @@ Java_edu_wpi_first_wpilibj_hal_PowerJNI_getUserActive5V(JNIEnv* env, jclass) { * Signature: ()I */ JNIEXPORT jint JNICALL -Java_edu_wpi_first_wpilibj_hal_PowerJNI_getUserCurrentFaults5V( - JNIEnv* env, jclass) { +Java_edu_wpi_first_wpilibj_hal_PowerJNI_getUserCurrentFaults5V + (JNIEnv* env, jclass) +{ int32_t status = 0; int32_t val = HAL_GetUserCurrentFaults5V(&status); CheckStatus(env, status); @@ -152,7 +171,9 @@ Java_edu_wpi_first_wpilibj_hal_PowerJNI_getUserCurrentFaults5V( * Signature: ()D */ JNIEXPORT jdouble JNICALL -Java_edu_wpi_first_wpilibj_hal_PowerJNI_getUserVoltage3V3(JNIEnv* env, jclass) { +Java_edu_wpi_first_wpilibj_hal_PowerJNI_getUserVoltage3V3 + (JNIEnv* env, jclass) +{ int32_t status = 0; double val = HAL_GetUserVoltage3V3(&status); CheckStatus(env, status); @@ -165,7 +186,9 @@ Java_edu_wpi_first_wpilibj_hal_PowerJNI_getUserVoltage3V3(JNIEnv* env, jclass) { * Signature: ()D */ JNIEXPORT jdouble JNICALL -Java_edu_wpi_first_wpilibj_hal_PowerJNI_getUserCurrent3V3(JNIEnv* env, jclass) { +Java_edu_wpi_first_wpilibj_hal_PowerJNI_getUserCurrent3V3 + (JNIEnv* env, jclass) +{ int32_t status = 0; double val = HAL_GetUserCurrent3V3(&status); CheckStatus(env, status); @@ -178,7 +201,9 @@ Java_edu_wpi_first_wpilibj_hal_PowerJNI_getUserCurrent3V3(JNIEnv* env, jclass) { * Signature: ()Z */ JNIEXPORT jboolean JNICALL -Java_edu_wpi_first_wpilibj_hal_PowerJNI_getUserActive3V3(JNIEnv* env, jclass) { +Java_edu_wpi_first_wpilibj_hal_PowerJNI_getUserActive3V3 + (JNIEnv* env, jclass) +{ int32_t status = 0; bool val = HAL_GetUserActive3V3(&status); CheckStatus(env, status); @@ -191,8 +216,9 @@ Java_edu_wpi_first_wpilibj_hal_PowerJNI_getUserActive3V3(JNIEnv* env, jclass) { * Signature: ()I */ JNIEXPORT jint JNICALL -Java_edu_wpi_first_wpilibj_hal_PowerJNI_getUserCurrentFaults3V3( - JNIEnv* env, jclass) { +Java_edu_wpi_first_wpilibj_hal_PowerJNI_getUserCurrentFaults3V3 + (JNIEnv* env, jclass) +{ int32_t status = 0; int32_t val = HAL_GetUserCurrentFaults3V3(&status); CheckStatus(env, status); diff --git a/hal/src/main/native/cpp/jni/RelayJNI.cpp b/hal/src/main/native/cpp/jni/RelayJNI.cpp index 7522f972e3..317d432607 100644 --- a/hal/src/main/native/cpp/jni/RelayJNI.cpp +++ b/hal/src/main/native/cpp/jni/RelayJNI.cpp @@ -1,20 +1,20 @@ /*----------------------------------------------------------------------------*/ -/* Copyright (c) FIRST 2016. All Rights Reserved. */ +/* Copyright (c) 2016-2018 FIRST. 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. */ /*----------------------------------------------------------------------------*/ -#include #include -#include "HAL/cpp/Log.h" -#include "edu_wpi_first_wpilibj_hal_RelayJNI.h" +#include -#include "HAL/Relay.h" #include "HAL/Ports.h" -#include "HALUtil.h" +#include "HAL/Relay.h" +#include "HAL/cpp/Log.h" #include "HAL/handles/HandlesInternal.h" +#include "HALUtil.h" +#include "edu_wpi_first_wpilibj_hal_RelayJNI.h" using namespace frc; @@ -25,51 +25,58 @@ TLogLevel relayJNILogLevel = logWARNING; if (level > relayJNILogLevel) \ ; \ else \ - Log().Get(level) + Log().Get(level) extern "C" { /* * Class: edu_wpi_first_wpilibj_hal_RelayJNI * Method: initializeRelayPort - * Signature: (IZ)I; + * Signature: (IZ)I */ -JNIEXPORT jint JNICALL Java_edu_wpi_first_wpilibj_hal_RelayJNI_initializeRelayPort( - JNIEnv* env, jclass, jint id, jboolean fwd) { +JNIEXPORT jint JNICALL +Java_edu_wpi_first_wpilibj_hal_RelayJNI_initializeRelayPort + (JNIEnv* env, jclass, jint id, jboolean fwd) +{ RELAYJNI_LOG(logDEBUG) << "Calling RELAYJNI initializeRelayPort"; RELAYJNI_LOG(logDEBUG) << "Port Handle = " << (HAL_PortHandle)id; RELAYJNI_LOG(logDEBUG) << "Forward = " << (jint)fwd; int32_t status = 0; - HAL_RelayHandle handle = HAL_InitializeRelayPort((HAL_PortHandle)id, (uint8_t) fwd, &status); + HAL_RelayHandle handle = HAL_InitializeRelayPort( + (HAL_PortHandle)id, static_cast(fwd), &status); RELAYJNI_LOG(logDEBUG) << "Status = " << status; RELAYJNI_LOG(logDEBUG) << "Relay Handle = " << handle; CheckStatusRange(env, status, 0, HAL_GetNumRelayChannels(), hal::getPortHandleChannel((HAL_PortHandle)id)); - return (jint) handle; + return (jint)handle; } /* -* Class: edu_wpi_first_wpilibj_hal_RelayJNI -* Method: freeRelayPort -* Signature: (I)V; -*/ -JNIEXPORT void JNICALL Java_edu_wpi_first_wpilibj_hal_RelayJNI_freeRelayPort( - JNIEnv *env, jclass, jint id) { + * Class: edu_wpi_first_wpilibj_hal_RelayJNI + * Method: freeRelayPort + * Signature: (I)V + */ +JNIEXPORT void JNICALL +Java_edu_wpi_first_wpilibj_hal_RelayJNI_freeRelayPort + (JNIEnv* env, jclass, jint id) +{ RELAYJNI_LOG(logDEBUG) << "Calling RELAYJNI freeRelayPort"; RELAYJNI_LOG(logDEBUG) << "Port Handle = " << (HAL_RelayHandle)id; HAL_FreeRelayPort((HAL_RelayHandle)id); } /* -* Class: edu_wpi_first_wpilibj_hal_RelayJNI -* Method: checkRelayChannel -* Signature: (I)Z; -*/ -JNIEXPORT jboolean JNICALL Java_edu_wpi_first_wpilibj_hal_RelayJNI_checkRelayChannel( - JNIEnv *env, jclass, jint channel) { + * Class: edu_wpi_first_wpilibj_hal_RelayJNI + * Method: checkRelayChannel + * Signature: (I)Z + */ +JNIEXPORT jboolean JNICALL +Java_edu_wpi_first_wpilibj_hal_RelayJNI_checkRelayChannel + (JNIEnv* env, jclass, jint channel) +{ RELAYJNI_LOG(logDEBUG) << "Calling RELAYJNI checkRelayChannel"; RELAYJNI_LOG(logDEBUG) << "Channel = " << channel; - return (jboolean)HAL_CheckRelayChannel((uint8_t) channel); + return (jboolean)HAL_CheckRelayChannel(static_cast(channel)); } /* @@ -77,8 +84,10 @@ JNIEXPORT jboolean JNICALL Java_edu_wpi_first_wpilibj_hal_RelayJNI_checkRelayCha * Method: setRelay * Signature: (IZ)V */ -JNIEXPORT void JNICALL Java_edu_wpi_first_wpilibj_hal_RelayJNI_setRelay( - JNIEnv* env, jclass, jint id, jboolean value) { +JNIEXPORT void JNICALL +Java_edu_wpi_first_wpilibj_hal_RelayJNI_setRelay + (JNIEnv* env, jclass, jint id, jboolean value) +{ RELAYJNI_LOG(logDEBUG) << "Calling RELAYJNI setRelay"; RELAYJNI_LOG(logDEBUG) << "Port Handle = " << (HAL_RelayHandle)id; RELAYJNI_LOG(logDEBUG) << "Flag = " << (jint)value; @@ -94,8 +103,9 @@ JNIEXPORT void JNICALL Java_edu_wpi_first_wpilibj_hal_RelayJNI_setRelay( * Signature: (I)Z */ JNIEXPORT jboolean JNICALL -Java_edu_wpi_first_wpilibj_hal_RelayJNI_getRelay( - JNIEnv* env, jclass, jint id) { +Java_edu_wpi_first_wpilibj_hal_RelayJNI_getRelay + (JNIEnv* env, jclass, jint id) +{ RELAYJNI_LOG(logDEBUG) << "Calling RELAYJNI getRelay"; RELAYJNI_LOG(logDEBUG) << "Port Handle = " << (HAL_RelayHandle)id; int32_t status = 0; diff --git a/hal/src/main/native/cpp/jni/SPIJNI.cpp b/hal/src/main/native/cpp/jni/SPIJNI.cpp index 919e8ab4ea..e031a8c720 100644 --- a/hal/src/main/native/cpp/jni/SPIJNI.cpp +++ b/hal/src/main/native/cpp/jni/SPIJNI.cpp @@ -1,19 +1,20 @@ /*----------------------------------------------------------------------------*/ -/* Copyright (c) FIRST 2016. All Rights Reserved. */ +/* Copyright (c) 2016-2018 FIRST. 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. */ /*----------------------------------------------------------------------------*/ -#include #include -#include "HAL/cpp/Log.h" -#include "edu_wpi_first_wpilibj_hal_SPIJNI.h" +#include + +#include #include "HAL/SPI.h" +#include "HAL/cpp/Log.h" #include "HALUtil.h" -#include "wpi/jni_util.h" +#include "edu_wpi_first_wpilibj_hal_SPIJNI.h" using namespace frc; using namespace wpi::java; @@ -25,7 +26,7 @@ TLogLevel spiJNILogLevel = logWARNING; if (level > spiJNILogLevel) \ ; \ else \ - Log().Get(level) + Log().Get(level) extern "C" { @@ -34,8 +35,10 @@ extern "C" { * Method: spiInitialize * Signature: (I)V */ -JNIEXPORT void JNICALL Java_edu_wpi_first_wpilibj_hal_SPIJNI_spiInitialize( - JNIEnv *env, jclass, jint port) { +JNIEXPORT void JNICALL +Java_edu_wpi_first_wpilibj_hal_SPIJNI_spiInitialize + (JNIEnv* env, jclass, jint port) +{ SPIJNI_LOG(logDEBUG) << "Calling SPIJNI spiInitialize"; SPIJNI_LOG(logDEBUG) << "Port = " << (jint)port; int32_t status = 0; @@ -47,23 +50,27 @@ JNIEXPORT void JNICALL Java_edu_wpi_first_wpilibj_hal_SPIJNI_spiInitialize( /* * Class: edu_wpi_first_wpilibj_hal_SPIJNI * Method: spiTransaction - * Signature: (ILjava/nio/ByteBuffer;Ljava/nio/ByteBuffer;B)I + * Signature: (ILjava/lang/Object;Ljava/lang/Object;B)I */ -JNIEXPORT jint JNICALL Java_edu_wpi_first_wpilibj_hal_SPIJNI_spiTransaction( - JNIEnv *env, jclass, jint port, jobject dataToSend, jobject dataReceived, - jbyte size) { +JNIEXPORT jint JNICALL +Java_edu_wpi_first_wpilibj_hal_SPIJNI_spiTransaction + (JNIEnv* env, jclass, jint port, jobject dataToSend, jobject dataReceived, + jbyte size) +{ SPIJNI_LOG(logDEBUG) << "Calling SPIJNI spiTransaction"; SPIJNI_LOG(logDEBUG) << "Port = " << (jint)port; - uint8_t *dataToSendPtr = nullptr; + uint8_t* dataToSendPtr = nullptr; if (dataToSend != 0) { - dataToSendPtr = (uint8_t *)env->GetDirectBufferAddress(dataToSend); + dataToSendPtr = + reinterpret_cast(env->GetDirectBufferAddress(dataToSend)); } - uint8_t *dataReceivedPtr = - (uint8_t *)env->GetDirectBufferAddress(dataReceived); + uint8_t* dataReceivedPtr = + reinterpret_cast(env->GetDirectBufferAddress(dataReceived)); SPIJNI_LOG(logDEBUG) << "Size = " << (jint)size; SPIJNI_LOG(logDEBUG) << "DataToSendPtr = " << dataToSendPtr; SPIJNI_LOG(logDEBUG) << "DataReceivedPtr = " << dataReceivedPtr; - jint retVal = HAL_TransactionSPI(static_cast(port), dataToSendPtr, dataReceivedPtr, size); + jint retVal = HAL_TransactionSPI(static_cast(port), + dataToSendPtr, dataReceivedPtr, size); SPIJNI_LOG(logDEBUG) << "ReturnValue = " << (jint)retVal; return retVal; } @@ -73,9 +80,11 @@ JNIEXPORT jint JNICALL Java_edu_wpi_first_wpilibj_hal_SPIJNI_spiTransaction( * Method: spiTransactionB * Signature: (I[B[BB)I */ -JNIEXPORT jint JNICALL Java_edu_wpi_first_wpilibj_hal_SPIJNI_spiTransactionB( - JNIEnv *env, jclass, jint port, jbyteArray dataToSend, jbyteArray dataReceived, - jbyte size) { +JNIEXPORT jint JNICALL +Java_edu_wpi_first_wpilibj_hal_SPIJNI_spiTransactionB + (JNIEnv* env, jclass, jint port, jbyteArray dataToSend, + jbyteArray dataReceived, jbyte size) +{ SPIJNI_LOG(logDEBUG) << "Calling SPIJNI spiTransactionB"; SPIJNI_LOG(logDEBUG) << "Port = " << (jint)port; SPIJNI_LOG(logDEBUG) << "Size = " << (jint)size; @@ -83,11 +92,11 @@ JNIEXPORT jint JNICALL Java_edu_wpi_first_wpilibj_hal_SPIJNI_spiTransactionB( recvBuf.resize(size); jint retVal = HAL_TransactionSPI(static_cast(port), - reinterpret_cast( + reinterpret_cast( JByteArrayRef(env, dataToSend).array().data()), recvBuf.data(), size); env->SetByteArrayRegion(dataReceived, 0, size, - reinterpret_cast(recvBuf.data())); + reinterpret_cast(recvBuf.data())); SPIJNI_LOG(logDEBUG) << "ReturnValue = " << (jint)retVal; return retVal; } @@ -95,19 +104,23 @@ JNIEXPORT jint JNICALL Java_edu_wpi_first_wpilibj_hal_SPIJNI_spiTransactionB( /* * Class: edu_wpi_first_wpilibj_hal_SPIJNI * Method: spiWrite - * Signature: (ILjava/nio/ByteBuffer;B)I + * Signature: (ILjava/lang/Object;B)I */ -JNIEXPORT jint JNICALL Java_edu_wpi_first_wpilibj_hal_SPIJNI_spiWrite( - JNIEnv *env, jclass, jint port, jobject dataToSend, jbyte size) { +JNIEXPORT jint JNICALL +Java_edu_wpi_first_wpilibj_hal_SPIJNI_spiWrite + (JNIEnv* env, jclass, jint port, jobject dataToSend, jbyte size) +{ SPIJNI_LOG(logDEBUG) << "Calling SPIJNI spiWrite"; SPIJNI_LOG(logDEBUG) << "Port = " << (jint)port; - uint8_t *dataToSendPtr = nullptr; + uint8_t* dataToSendPtr = nullptr; if (dataToSend != 0) { - dataToSendPtr = (uint8_t *)env->GetDirectBufferAddress(dataToSend); + dataToSendPtr = + reinterpret_cast(env->GetDirectBufferAddress(dataToSend)); } SPIJNI_LOG(logDEBUG) << "Size = " << (jint)size; SPIJNI_LOG(logDEBUG) << "DataToSendPtr = " << dataToSendPtr; - jint retVal = HAL_WriteSPI(static_cast(port), dataToSendPtr, size); + jint retVal = + HAL_WriteSPI(static_cast(port), dataToSendPtr, size); SPIJNI_LOG(logDEBUG) << "ReturnValue = " << (jint)retVal; return retVal; } @@ -117,13 +130,15 @@ JNIEXPORT jint JNICALL Java_edu_wpi_first_wpilibj_hal_SPIJNI_spiWrite( * Method: spiWriteB * Signature: (I[BB)I */ -JNIEXPORT jint JNICALL Java_edu_wpi_first_wpilibj_hal_SPIJNI_spiWriteB( - JNIEnv *env, jclass, jint port, jbyteArray dataToSend, jbyte size) { +JNIEXPORT jint JNICALL +Java_edu_wpi_first_wpilibj_hal_SPIJNI_spiWriteB + (JNIEnv* env, jclass, jint port, jbyteArray dataToSend, jbyte size) +{ SPIJNI_LOG(logDEBUG) << "Calling SPIJNI spiWriteB"; SPIJNI_LOG(logDEBUG) << "Port = " << (jint)port; SPIJNI_LOG(logDEBUG) << "Size = " << (jint)size; jint retVal = HAL_WriteSPI(static_cast(port), - reinterpret_cast( + reinterpret_cast( JByteArrayRef(env, dataToSend).array().data()), size); SPIJNI_LOG(logDEBUG) << "ReturnValue = " << (jint)retVal; @@ -133,24 +148,29 @@ JNIEXPORT jint JNICALL Java_edu_wpi_first_wpilibj_hal_SPIJNI_spiWriteB( /* * Class: edu_wpi_first_wpilibj_hal_SPIJNI * Method: spiRead - * Signature: (IZLjava/nio/ByteBuffer;B)I + * Signature: (IZLjava/lang/Object;B)I */ -JNIEXPORT jint JNICALL Java_edu_wpi_first_wpilibj_hal_SPIJNI_spiRead( - JNIEnv *env, jclass, jint port, jboolean initiate, jobject dataReceived, jbyte size) { +JNIEXPORT jint JNICALL +Java_edu_wpi_first_wpilibj_hal_SPIJNI_spiRead + (JNIEnv* env, jclass, jint port, jboolean initiate, jobject dataReceived, + jbyte size) +{ SPIJNI_LOG(logDEBUG) << "Calling SPIJNI spiRead"; SPIJNI_LOG(logDEBUG) << "Port = " << (jint)port; SPIJNI_LOG(logDEBUG) << "Initiate = " << (jboolean)initiate; - uint8_t *dataReceivedPtr = - (uint8_t *)env->GetDirectBufferAddress(dataReceived); + uint8_t* dataReceivedPtr = + reinterpret_cast(env->GetDirectBufferAddress(dataReceived)); SPIJNI_LOG(logDEBUG) << "Size = " << (jint)size; SPIJNI_LOG(logDEBUG) << "DataReceivedPtr = " << dataReceivedPtr; jint retVal; if (initiate) { wpi::SmallVector sendBuf; sendBuf.resize(size); - retVal = HAL_TransactionSPI(static_cast(port), sendBuf.data(), dataReceivedPtr, size); + retVal = HAL_TransactionSPI(static_cast(port), sendBuf.data(), + dataReceivedPtr, size); } else { - retVal = HAL_ReadSPI(static_cast(port), (uint8_t *)dataReceivedPtr, size); + retVal = HAL_ReadSPI(static_cast(port), + reinterpret_cast(dataReceivedPtr), size); } SPIJNI_LOG(logDEBUG) << "ReturnValue = " << (jint)retVal; return retVal; @@ -161,8 +181,11 @@ JNIEXPORT jint JNICALL Java_edu_wpi_first_wpilibj_hal_SPIJNI_spiRead( * Method: spiReadB * Signature: (IZ[BB)I */ -JNIEXPORT jint JNICALL Java_edu_wpi_first_wpilibj_hal_SPIJNI_spiReadB( - JNIEnv *env, jclass, jint port, jboolean initiate, jbyteArray dataReceived, jbyte size) { +JNIEXPORT jint JNICALL +Java_edu_wpi_first_wpilibj_hal_SPIJNI_spiReadB + (JNIEnv* env, jclass, jint port, jboolean initiate, jbyteArray dataReceived, + jbyte size) +{ SPIJNI_LOG(logDEBUG) << "Calling SPIJNI spiReadB"; SPIJNI_LOG(logDEBUG) << "Port = " << (jint)port; SPIJNI_LOG(logDEBUG) << "Initiate = " << (jboolean)initiate; @@ -173,12 +196,13 @@ JNIEXPORT jint JNICALL Java_edu_wpi_first_wpilibj_hal_SPIJNI_spiReadB( if (initiate) { wpi::SmallVector sendBuf; sendBuf.resize(size); - retVal = HAL_TransactionSPI(static_cast(port), sendBuf.data(), recvBuf.data(), size); + retVal = HAL_TransactionSPI(static_cast(port), sendBuf.data(), + recvBuf.data(), size); } else { retVal = HAL_ReadSPI(static_cast(port), recvBuf.data(), size); } env->SetByteArrayRegion(dataReceived, 0, size, - reinterpret_cast(recvBuf.data())); + reinterpret_cast(recvBuf.data())); SPIJNI_LOG(logDEBUG) << "ReturnValue = " << (jint)retVal; return retVal; } @@ -189,7 +213,9 @@ JNIEXPORT jint JNICALL Java_edu_wpi_first_wpilibj_hal_SPIJNI_spiReadB( * Signature: (I)V */ JNIEXPORT void JNICALL -Java_edu_wpi_first_wpilibj_hal_SPIJNI_spiClose(JNIEnv *, jclass, jint port) { +Java_edu_wpi_first_wpilibj_hal_SPIJNI_spiClose + (JNIEnv*, jclass, jint port) +{ SPIJNI_LOG(logDEBUG) << "Calling SPIJNI spiClose"; SPIJNI_LOG(logDEBUG) << "Port = " << (jint)port; HAL_CloseSPI(static_cast(port)); @@ -200,8 +226,10 @@ Java_edu_wpi_first_wpilibj_hal_SPIJNI_spiClose(JNIEnv *, jclass, jint port) { * Method: spiSetSpeed * Signature: (II)V */ -JNIEXPORT void JNICALL Java_edu_wpi_first_wpilibj_hal_SPIJNI_spiSetSpeed( - JNIEnv *, jclass, jint port, jint speed) { +JNIEXPORT void JNICALL +Java_edu_wpi_first_wpilibj_hal_SPIJNI_spiSetSpeed + (JNIEnv*, jclass, jint port, jint speed) +{ SPIJNI_LOG(logDEBUG) << "Calling SPIJNI spiSetSpeed"; SPIJNI_LOG(logDEBUG) << "Port = " << (jint)port; SPIJNI_LOG(logDEBUG) << "Speed = " << (jint)speed; @@ -213,15 +241,18 @@ JNIEXPORT void JNICALL Java_edu_wpi_first_wpilibj_hal_SPIJNI_spiSetSpeed( * Method: spiSetOpts * Signature: (IIII)V */ -JNIEXPORT void JNICALL Java_edu_wpi_first_wpilibj_hal_SPIJNI_spiSetOpts( - JNIEnv *, jclass, jint port, jint msb_first, jint sample_on_trailing, - jint clk_idle_high) { +JNIEXPORT void JNICALL +Java_edu_wpi_first_wpilibj_hal_SPIJNI_spiSetOpts + (JNIEnv*, jclass, jint port, jint msb_first, jint sample_on_trailing, + jint clk_idle_high) +{ SPIJNI_LOG(logDEBUG) << "Calling SPIJNI spiSetOpts"; SPIJNI_LOG(logDEBUG) << "Port = " << (jint)port; SPIJNI_LOG(logDEBUG) << "msb_first = " << msb_first; SPIJNI_LOG(logDEBUG) << "sample_on_trailing = " << sample_on_trailing; SPIJNI_LOG(logDEBUG) << "clk_idle_high = " << clk_idle_high; - HAL_SetSPIOpts(static_cast(port), msb_first, sample_on_trailing, clk_idle_high); + HAL_SetSPIOpts(static_cast(port), msb_first, sample_on_trailing, + clk_idle_high); } /* @@ -230,8 +261,9 @@ JNIEXPORT void JNICALL Java_edu_wpi_first_wpilibj_hal_SPIJNI_spiSetOpts( * Signature: (I)V */ JNIEXPORT void JNICALL -Java_edu_wpi_first_wpilibj_hal_SPIJNI_spiSetChipSelectActiveHigh( - JNIEnv *env, jclass, jint port) { +Java_edu_wpi_first_wpilibj_hal_SPIJNI_spiSetChipSelectActiveHigh + (JNIEnv* env, jclass, jint port) +{ SPIJNI_LOG(logDEBUG) << "Calling SPIJNI spiSetCSActiveHigh"; SPIJNI_LOG(logDEBUG) << "Port = " << (jint)port; int32_t status = 0; @@ -246,8 +278,9 @@ Java_edu_wpi_first_wpilibj_hal_SPIJNI_spiSetChipSelectActiveHigh( * Signature: (I)V */ JNIEXPORT void JNICALL -Java_edu_wpi_first_wpilibj_hal_SPIJNI_spiSetChipSelectActiveLow( - JNIEnv *env, jclass, jint port) { +Java_edu_wpi_first_wpilibj_hal_SPIJNI_spiSetChipSelectActiveLow + (JNIEnv* env, jclass, jint port) +{ SPIJNI_LOG(logDEBUG) << "Calling SPIJNI spiSetCSActiveLow"; SPIJNI_LOG(logDEBUG) << "Port = " << (jint)port; int32_t status = 0; @@ -261,8 +294,10 @@ Java_edu_wpi_first_wpilibj_hal_SPIJNI_spiSetChipSelectActiveLow( * Method: spiInitAuto * Signature: (II)V */ -JNIEXPORT void JNICALL Java_edu_wpi_first_wpilibj_hal_SPIJNI_spiInitAuto - (JNIEnv *env, jclass, jint port, jint bufferSize) { +JNIEXPORT void JNICALL +Java_edu_wpi_first_wpilibj_hal_SPIJNI_spiInitAuto + (JNIEnv* env, jclass, jint port, jint bufferSize) +{ SPIJNI_LOG(logDEBUG) << "Calling SPIJNI spiInitAuto"; SPIJNI_LOG(logDEBUG) << "Port = " << port; SPIJNI_LOG(logDEBUG) << "BufferSize = " << bufferSize; @@ -277,8 +312,10 @@ JNIEXPORT void JNICALL Java_edu_wpi_first_wpilibj_hal_SPIJNI_spiInitAuto * Method: spiFreeAuto * Signature: (I)V */ -JNIEXPORT void JNICALL Java_edu_wpi_first_wpilibj_hal_SPIJNI_spiFreeAuto - (JNIEnv *env, jclass, jint port) { +JNIEXPORT void JNICALL +Java_edu_wpi_first_wpilibj_hal_SPIJNI_spiFreeAuto + (JNIEnv* env, jclass, jint port) +{ SPIJNI_LOG(logDEBUG) << "Calling SPIJNI spiFreeAuto"; SPIJNI_LOG(logDEBUG) << "Port = " << port; int32_t status = 0; @@ -292,8 +329,10 @@ JNIEXPORT void JNICALL Java_edu_wpi_first_wpilibj_hal_SPIJNI_spiFreeAuto * Method: spiStartAutoRate * Signature: (ID)V */ -JNIEXPORT void JNICALL Java_edu_wpi_first_wpilibj_hal_SPIJNI_spiStartAutoRate - (JNIEnv *env, jclass, jint port, jdouble period) { +JNIEXPORT void JNICALL +Java_edu_wpi_first_wpilibj_hal_SPIJNI_spiStartAutoRate + (JNIEnv* env, jclass, jint port, jdouble period) +{ SPIJNI_LOG(logDEBUG) << "Calling SPIJNI spiStartAutoRate"; SPIJNI_LOG(logDEBUG) << "Port = " << port; SPIJNI_LOG(logDEBUG) << "Period = " << period; @@ -308,8 +347,11 @@ JNIEXPORT void JNICALL Java_edu_wpi_first_wpilibj_hal_SPIJNI_spiStartAutoRate * Method: spiStartAutoTrigger * Signature: (IIIZZ)V */ -JNIEXPORT void JNICALL Java_edu_wpi_first_wpilibj_hal_SPIJNI_spiStartAutoTrigger - (JNIEnv *env, jclass, jint port, jint digitalSourceHandle, jint analogTriggerType, jboolean triggerRising, jboolean triggerFalling) { +JNIEXPORT void JNICALL +Java_edu_wpi_first_wpilibj_hal_SPIJNI_spiStartAutoTrigger + (JNIEnv* env, jclass, jint port, jint digitalSourceHandle, + jint analogTriggerType, jboolean triggerRising, jboolean triggerFalling) +{ SPIJNI_LOG(logDEBUG) << "Calling SPIJNI spiStartAutoTrigger"; SPIJNI_LOG(logDEBUG) << "Port = " << port; SPIJNI_LOG(logDEBUG) << "DigitalSourceHandle = " << digitalSourceHandle; @@ -318,8 +360,8 @@ JNIEXPORT void JNICALL Java_edu_wpi_first_wpilibj_hal_SPIJNI_spiStartAutoTrigger SPIJNI_LOG(logDEBUG) << "TriggerFalling = " << (jint)triggerFalling; int32_t status = 0; HAL_StartSPIAutoTrigger(static_cast(port), digitalSourceHandle, - static_cast(analogTriggerType), triggerRising, - triggerFalling, &status); + static_cast(analogTriggerType), + triggerRising, triggerFalling, &status); SPIJNI_LOG(logDEBUG) << "Status = " << status; CheckStatus(env, status); } @@ -329,8 +371,10 @@ JNIEXPORT void JNICALL Java_edu_wpi_first_wpilibj_hal_SPIJNI_spiStartAutoTrigger * Method: spiStopAuto * Signature: (I)V */ -JNIEXPORT void JNICALL Java_edu_wpi_first_wpilibj_hal_SPIJNI_spiStopAuto - (JNIEnv *env, jclass, jint port) { +JNIEXPORT void JNICALL +Java_edu_wpi_first_wpilibj_hal_SPIJNI_spiStopAuto + (JNIEnv* env, jclass, jint port) +{ SPIJNI_LOG(logDEBUG) << "Calling SPIJNI spiStopAuto"; SPIJNI_LOG(logDEBUG) << "Port = " << port; int32_t status = 0; @@ -344,14 +388,17 @@ JNIEXPORT void JNICALL Java_edu_wpi_first_wpilibj_hal_SPIJNI_spiStopAuto * Method: spiSetAutoTransmitData * Signature: (I[BI)V */ -JNIEXPORT void JNICALL Java_edu_wpi_first_wpilibj_hal_SPIJNI_spiSetAutoTransmitData - (JNIEnv *env, jclass, jint port, jbyteArray dataToSend, jint zeroSize) { +JNIEXPORT void JNICALL +Java_edu_wpi_first_wpilibj_hal_SPIJNI_spiSetAutoTransmitData + (JNIEnv* env, jclass, jint port, jbyteArray dataToSend, jint zeroSize) +{ SPIJNI_LOG(logDEBUG) << "Calling SPIJNI spiSetAutoTransmitData"; SPIJNI_LOG(logDEBUG) << "Port = " << port; SPIJNI_LOG(logDEBUG) << "ZeroSize = " << zeroSize; JByteArrayRef jarr(env, dataToSend); int32_t status = 0; - HAL_SetSPIAutoTransmitData(static_cast(port), + HAL_SetSPIAutoTransmitData( + static_cast(port), reinterpret_cast(jarr.array().data()), jarr.array().size(), zeroSize, &status); SPIJNI_LOG(logDEBUG) << "Status = " << status; @@ -363,8 +410,10 @@ JNIEXPORT void JNICALL Java_edu_wpi_first_wpilibj_hal_SPIJNI_spiSetAutoTransmitD * Method: spiForceAutoRead * Signature: (I)V */ -JNIEXPORT void JNICALL Java_edu_wpi_first_wpilibj_hal_SPIJNI_spiForceAutoRead - (JNIEnv *env, jclass, jint port) { +JNIEXPORT void JNICALL +Java_edu_wpi_first_wpilibj_hal_SPIJNI_spiForceAutoRead + (JNIEnv* env, jclass, jint port) +{ SPIJNI_LOG(logDEBUG) << "Calling SPIJNI spiForceAutoRead"; SPIJNI_LOG(logDEBUG) << "Port = " << port; int32_t status = 0; @@ -376,17 +425,22 @@ JNIEXPORT void JNICALL Java_edu_wpi_first_wpilibj_hal_SPIJNI_spiForceAutoRead /* * Class: edu_wpi_first_wpilibj_hal_SPIJNI * Method: spiReadAutoReceivedData - * Signature: (ILjava/nio/ByteBuffer;ID)I + * Signature: (ILjava/lang/Object;ID)I */ -JNIEXPORT jint JNICALL Java_edu_wpi_first_wpilibj_hal_SPIJNI_spiReadAutoReceivedData__ILjava_nio_ByteBuffer_2ID - (JNIEnv *env, jclass, jint port, jobject buffer, jint numToRead, jdouble timeout) { +JNIEXPORT jint JNICALL +Java_edu_wpi_first_wpilibj_hal_SPIJNI_spiReadAutoReceivedData__ILjava_nio_ByteBuffer_2ID + (JNIEnv* env, jclass, jint port, jobject buffer, jint numToRead, + jdouble timeout) +{ SPIJNI_LOG(logDEBUG) << "Calling SPIJNI spiReadAutoReceivedData"; SPIJNI_LOG(logDEBUG) << "Port = " << port; SPIJNI_LOG(logDEBUG) << "NumToRead = " << numToRead; SPIJNI_LOG(logDEBUG) << "Timeout = " << timeout; - uint8_t *recvBuf = (uint8_t *)env->GetDirectBufferAddress(buffer); + uint8_t* recvBuf = + reinterpret_cast(env->GetDirectBufferAddress(buffer)); int32_t status = 0; - jint retval = HAL_ReadSPIAutoReceivedData(static_cast(port), recvBuf, numToRead, timeout, &status); + jint retval = HAL_ReadSPIAutoReceivedData( + static_cast(port), recvBuf, numToRead, timeout, &status); SPIJNI_LOG(logDEBUG) << "Status = " << status; SPIJNI_LOG(logDEBUG) << "Return = " << retval; CheckStatus(env, status); @@ -398,8 +452,11 @@ JNIEXPORT jint JNICALL Java_edu_wpi_first_wpilibj_hal_SPIJNI_spiReadAutoReceived * Method: spiReadAutoReceivedData * Signature: (I[BID)I */ -JNIEXPORT jint JNICALL Java_edu_wpi_first_wpilibj_hal_SPIJNI_spiReadAutoReceivedData__I_3BID - (JNIEnv *env, jclass, jint port, jbyteArray buffer, jint numToRead, jdouble timeout) { +JNIEXPORT jint JNICALL +Java_edu_wpi_first_wpilibj_hal_SPIJNI_spiReadAutoReceivedData__I_3BID + (JNIEnv* env, jclass, jint port, jbyteArray buffer, jint numToRead, + jdouble timeout) +{ SPIJNI_LOG(logDEBUG) << "Calling SPIJNI spiReadAutoReceivedData"; SPIJNI_LOG(logDEBUG) << "Port = " << port; SPIJNI_LOG(logDEBUG) << "NumToRead = " << numToRead; @@ -407,13 +464,15 @@ JNIEXPORT jint JNICALL Java_edu_wpi_first_wpilibj_hal_SPIJNI_spiReadAutoReceived wpi::SmallVector recvBuf; recvBuf.resize(numToRead); int32_t status = 0; - jint retval = HAL_ReadSPIAutoReceivedData(static_cast(port), recvBuf.data(), numToRead, timeout, &status); + jint retval = + HAL_ReadSPIAutoReceivedData(static_cast(port), + recvBuf.data(), numToRead, timeout, &status); SPIJNI_LOG(logDEBUG) << "Status = " << status; SPIJNI_LOG(logDEBUG) << "Return = " << retval; if (!CheckStatus(env, status)) return retval; if (numToRead > 0) { env->SetByteArrayRegion(buffer, 0, numToRead, - reinterpret_cast(recvBuf.data())); + reinterpret_cast(recvBuf.data())); } return retval; } @@ -423,12 +482,15 @@ JNIEXPORT jint JNICALL Java_edu_wpi_first_wpilibj_hal_SPIJNI_spiReadAutoReceived * Method: spiGetAutoDroppedCount * Signature: (I)I */ -JNIEXPORT jint JNICALL Java_edu_wpi_first_wpilibj_hal_SPIJNI_spiGetAutoDroppedCount - (JNIEnv *env, jclass, jint port) { +JNIEXPORT jint JNICALL +Java_edu_wpi_first_wpilibj_hal_SPIJNI_spiGetAutoDroppedCount + (JNIEnv* env, jclass, jint port) +{ SPIJNI_LOG(logDEBUG) << "Calling SPIJNI spiGetAutoDroppedCount"; SPIJNI_LOG(logDEBUG) << "Port = " << port; int32_t status = 0; - auto retval = HAL_GetSPIAutoDroppedCount(static_cast(port), &status); + auto retval = + HAL_GetSPIAutoDroppedCount(static_cast(port), &status); SPIJNI_LOG(logDEBUG) << "Status = " << status; SPIJNI_LOG(logDEBUG) << "Return = " << retval; CheckStatus(env, status); diff --git a/hal/src/main/native/cpp/jni/SerialPortJNI.cpp b/hal/src/main/native/cpp/jni/SerialPortJNI.cpp index 33e6358e34..5fe51721be 100644 --- a/hal/src/main/native/cpp/jni/SerialPortJNI.cpp +++ b/hal/src/main/native/cpp/jni/SerialPortJNI.cpp @@ -1,19 +1,20 @@ /*----------------------------------------------------------------------------*/ -/* Copyright (c) FIRST 2016. All Rights Reserved. */ +/* Copyright (c) 2016-2018 FIRST. 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. */ /*----------------------------------------------------------------------------*/ -#include #include -#include "HAL/cpp/Log.h" -#include "edu_wpi_first_wpilibj_hal_SerialPortJNI.h" +#include + +#include #include "HAL/SerialPort.h" +#include "HAL/cpp/Log.h" #include "HALUtil.h" -#include "wpi/jni_util.h" +#include "edu_wpi_first_wpilibj_hal_SerialPortJNI.h" using namespace frc; using namespace wpi::java; @@ -25,7 +26,7 @@ TLogLevel serialJNILogLevel = logWARNING; if (level > serialJNILogLevel) \ ; \ else \ - Log().Get(level) + Log().Get(level) extern "C" { @@ -35,8 +36,9 @@ extern "C" { * Signature: (B)V */ JNIEXPORT void JNICALL -Java_edu_wpi_first_wpilibj_hal_SerialPortJNI_serialInitializePort( - JNIEnv* env, jclass, jbyte port) { +Java_edu_wpi_first_wpilibj_hal_SerialPortJNI_serialInitializePort + (JNIEnv* env, jclass, jbyte port) +{ SERIALJNI_LOG(logDEBUG) << "Calling Serial Initialize"; SERIALJNI_LOG(logDEBUG) << "Port = " << (jint)port; int32_t status = 0; @@ -51,8 +53,9 @@ Java_edu_wpi_first_wpilibj_hal_SerialPortJNI_serialInitializePort( * Signature: (BLjava/lang/String;)V */ JNIEXPORT void JNICALL -Java_edu_wpi_first_wpilibj_hal_SerialPortJNI_serialInitializePortDirect( - JNIEnv* env, jclass, jbyte port, jstring portName) { +Java_edu_wpi_first_wpilibj_hal_SerialPortJNI_serialInitializePortDirect + (JNIEnv* env, jclass, jbyte port, jstring portName) +{ SERIALJNI_LOG(logDEBUG) << "Calling Serial Initialize Direct"; SERIALJNI_LOG(logDEBUG) << "Port = " << (jint)port; JStringRef portNameRef{env, portName}; @@ -70,8 +73,9 @@ Java_edu_wpi_first_wpilibj_hal_SerialPortJNI_serialInitializePortDirect( * Signature: (BI)V */ JNIEXPORT void JNICALL -Java_edu_wpi_first_wpilibj_hal_SerialPortJNI_serialSetBaudRate( - JNIEnv* env, jclass, jbyte port, jint rate) { +Java_edu_wpi_first_wpilibj_hal_SerialPortJNI_serialSetBaudRate + (JNIEnv* env, jclass, jbyte port, jint rate) +{ SERIALJNI_LOG(logDEBUG) << "Setting Serial Baud Rate"; SERIALJNI_LOG(logDEBUG) << "Baud: " << rate; int32_t status = 0; @@ -86,8 +90,9 @@ Java_edu_wpi_first_wpilibj_hal_SerialPortJNI_serialSetBaudRate( * Signature: (BB)V */ JNIEXPORT void JNICALL -Java_edu_wpi_first_wpilibj_hal_SerialPortJNI_serialSetDataBits( - JNIEnv* env, jclass, jbyte port, jbyte bits) { +Java_edu_wpi_first_wpilibj_hal_SerialPortJNI_serialSetDataBits + (JNIEnv* env, jclass, jbyte port, jbyte bits) +{ SERIALJNI_LOG(logDEBUG) << "Setting Serial Data Bits"; SERIALJNI_LOG(logDEBUG) << "Data Bits: " << bits; int32_t status = 0; @@ -102,8 +107,9 @@ Java_edu_wpi_first_wpilibj_hal_SerialPortJNI_serialSetDataBits( * Signature: (BB)V */ JNIEXPORT void JNICALL -Java_edu_wpi_first_wpilibj_hal_SerialPortJNI_serialSetParity( - JNIEnv* env, jclass, jbyte port, jbyte parity) { +Java_edu_wpi_first_wpilibj_hal_SerialPortJNI_serialSetParity + (JNIEnv* env, jclass, jbyte port, jbyte parity) +{ SERIALJNI_LOG(logDEBUG) << "Setting Serial Parity"; SERIALJNI_LOG(logDEBUG) << "Parity: " << parity; int32_t status = 0; @@ -118,8 +124,9 @@ Java_edu_wpi_first_wpilibj_hal_SerialPortJNI_serialSetParity( * Signature: (BB)V */ JNIEXPORT void JNICALL -Java_edu_wpi_first_wpilibj_hal_SerialPortJNI_serialSetStopBits( - JNIEnv* env, jclass, jbyte port, jbyte bits) { +Java_edu_wpi_first_wpilibj_hal_SerialPortJNI_serialSetStopBits + (JNIEnv* env, jclass, jbyte port, jbyte bits) +{ SERIALJNI_LOG(logDEBUG) << "Setting Serial Stop Bits"; SERIALJNI_LOG(logDEBUG) << "Stop Bits: " << bits; int32_t status = 0; @@ -134,8 +141,9 @@ Java_edu_wpi_first_wpilibj_hal_SerialPortJNI_serialSetStopBits( * Signature: (BB)V */ JNIEXPORT void JNICALL -Java_edu_wpi_first_wpilibj_hal_SerialPortJNI_serialSetWriteMode( - JNIEnv* env, jclass, jbyte port, jbyte mode) { +Java_edu_wpi_first_wpilibj_hal_SerialPortJNI_serialSetWriteMode + (JNIEnv* env, jclass, jbyte port, jbyte mode) +{ SERIALJNI_LOG(logDEBUG) << "Setting Serial Write Mode"; SERIALJNI_LOG(logDEBUG) << "Write mode: " << mode; int32_t status = 0; @@ -150,8 +158,9 @@ Java_edu_wpi_first_wpilibj_hal_SerialPortJNI_serialSetWriteMode( * Signature: (BB)V */ JNIEXPORT void JNICALL -Java_edu_wpi_first_wpilibj_hal_SerialPortJNI_serialSetFlowControl( - JNIEnv* env, jclass, jbyte port, jbyte flow) { +Java_edu_wpi_first_wpilibj_hal_SerialPortJNI_serialSetFlowControl + (JNIEnv* env, jclass, jbyte port, jbyte flow) +{ SERIALJNI_LOG(logDEBUG) << "Setting Serial Flow Control"; SERIALJNI_LOG(logDEBUG) << "Flow Control: " << flow; int32_t status = 0; @@ -166,8 +175,9 @@ Java_edu_wpi_first_wpilibj_hal_SerialPortJNI_serialSetFlowControl( * Signature: (BD)V */ JNIEXPORT void JNICALL -Java_edu_wpi_first_wpilibj_hal_SerialPortJNI_serialSetTimeout( - JNIEnv* env, jclass, jbyte port, jdouble timeout) { +Java_edu_wpi_first_wpilibj_hal_SerialPortJNI_serialSetTimeout + (JNIEnv* env, jclass, jbyte port, jdouble timeout) +{ SERIALJNI_LOG(logDEBUG) << "Setting Serial Timeout"; SERIALJNI_LOG(logDEBUG) << "Timeout: " << timeout; int32_t status = 0; @@ -182,12 +192,14 @@ Java_edu_wpi_first_wpilibj_hal_SerialPortJNI_serialSetTimeout( * Signature: (BC)V */ JNIEXPORT void JNICALL -Java_edu_wpi_first_wpilibj_hal_SerialPortJNI_serialEnableTermination( - JNIEnv* env, jclass, jbyte port, jchar terminator) { +Java_edu_wpi_first_wpilibj_hal_SerialPortJNI_serialEnableTermination + (JNIEnv* env, jclass, jbyte port, jchar terminator) +{ SERIALJNI_LOG(logDEBUG) << "Setting Serial Enable Termination"; SERIALJNI_LOG(logDEBUG) << "Terminator: " << terminator; int32_t status = 0; - HAL_EnableSerialTermination(static_cast(port), terminator, &status); + HAL_EnableSerialTermination(static_cast(port), terminator, + &status); SERIALJNI_LOG(logDEBUG) << "Status = " << status; CheckStatus(env, status); } @@ -198,8 +210,9 @@ Java_edu_wpi_first_wpilibj_hal_SerialPortJNI_serialEnableTermination( * Signature: (B)V */ JNIEXPORT void JNICALL -Java_edu_wpi_first_wpilibj_hal_SerialPortJNI_serialDisableTermination( - JNIEnv* env, jclass, jbyte port) { +Java_edu_wpi_first_wpilibj_hal_SerialPortJNI_serialDisableTermination + (JNIEnv* env, jclass, jbyte port) +{ SERIALJNI_LOG(logDEBUG) << "Setting Serial Disable termination"; int32_t status = 0; HAL_DisableSerialTermination(static_cast(port), &status); @@ -213,8 +226,9 @@ Java_edu_wpi_first_wpilibj_hal_SerialPortJNI_serialDisableTermination( * Signature: (BI)V */ JNIEXPORT void JNICALL -Java_edu_wpi_first_wpilibj_hal_SerialPortJNI_serialSetReadBufferSize( - JNIEnv* env, jclass, jbyte port, jint size) { +Java_edu_wpi_first_wpilibj_hal_SerialPortJNI_serialSetReadBufferSize + (JNIEnv* env, jclass, jbyte port, jint size) +{ SERIALJNI_LOG(logDEBUG) << "Setting Serial Read Buffer Size"; SERIALJNI_LOG(logDEBUG) << "Size: " << size; int32_t status = 0; @@ -229,12 +243,14 @@ Java_edu_wpi_first_wpilibj_hal_SerialPortJNI_serialSetReadBufferSize( * Signature: (BI)V */ JNIEXPORT void JNICALL -Java_edu_wpi_first_wpilibj_hal_SerialPortJNI_serialSetWriteBufferSize( - JNIEnv* env, jclass, jbyte port, jint size) { +Java_edu_wpi_first_wpilibj_hal_SerialPortJNI_serialSetWriteBufferSize + (JNIEnv* env, jclass, jbyte port, jint size) +{ SERIALJNI_LOG(logDEBUG) << "Setting Serial Write Buffer Size"; SERIALJNI_LOG(logDEBUG) << "Size: " << size; int32_t status = 0; - HAL_SetSerialWriteBufferSize(static_cast(port), size, &status); + HAL_SetSerialWriteBufferSize(static_cast(port), size, + &status); SERIALJNI_LOG(logDEBUG) << "Status = " << status; CheckStatus(env, status); } @@ -245,11 +261,13 @@ Java_edu_wpi_first_wpilibj_hal_SerialPortJNI_serialSetWriteBufferSize( * Signature: (B)I */ JNIEXPORT jint JNICALL -Java_edu_wpi_first_wpilibj_hal_SerialPortJNI_serialGetBytesReceived( - JNIEnv* env, jclass, jbyte port) { +Java_edu_wpi_first_wpilibj_hal_SerialPortJNI_serialGetBytesReceived + (JNIEnv* env, jclass, jbyte port) +{ SERIALJNI_LOG(logDEBUG) << "Serial Get Bytes Received"; int32_t status = 0; - jint retVal = HAL_GetSerialBytesReceived(static_cast(port), &status); + jint retVal = + HAL_GetSerialBytesReceived(static_cast(port), &status); SERIALJNI_LOG(logDEBUG) << "Status = " << status; CheckStatus(env, status); return retVal; @@ -260,16 +278,18 @@ Java_edu_wpi_first_wpilibj_hal_SerialPortJNI_serialGetBytesReceived( * Method: serialRead * Signature: (B[BI)I */ -JNIEXPORT jint JNICALL Java_edu_wpi_first_wpilibj_hal_SerialPortJNI_serialRead( - JNIEnv* env, jclass, jbyte port, jbyteArray dataReceived, jint size) { +JNIEXPORT jint JNICALL +Java_edu_wpi_first_wpilibj_hal_SerialPortJNI_serialRead + (JNIEnv* env, jclass, jbyte port, jbyteArray dataReceived, jint size) +{ SERIALJNI_LOG(logDEBUG) << "Serial Read"; wpi::SmallVector recvBuf; recvBuf.resize(size); int32_t status = 0; - jint retVal = HAL_ReadSerial(static_cast(port), recvBuf.data(), - size, &status); + jint retVal = HAL_ReadSerial(static_cast(port), + recvBuf.data(), size, &status); env->SetByteArrayRegion(dataReceived, 0, size, - reinterpret_cast(recvBuf.data())); + reinterpret_cast(recvBuf.data())); SERIALJNI_LOG(logDEBUG) << "ReturnValue = " << retVal; SERIALJNI_LOG(logDEBUG) << "Status = " << status; CheckStatus(env, status); @@ -281,13 +301,15 @@ JNIEXPORT jint JNICALL Java_edu_wpi_first_wpilibj_hal_SerialPortJNI_serialRead( * Method: serialWrite * Signature: (B[BI)I */ -JNIEXPORT jint JNICALL Java_edu_wpi_first_wpilibj_hal_SerialPortJNI_serialWrite( - JNIEnv* env, jclass, jbyte port, jbyteArray dataToSend, jint size) { +JNIEXPORT jint JNICALL +Java_edu_wpi_first_wpilibj_hal_SerialPortJNI_serialWrite + (JNIEnv* env, jclass, jbyte port, jbyteArray dataToSend, jint size) +{ SERIALJNI_LOG(logDEBUG) << "Serial Write"; int32_t status = 0; jint retVal = HAL_WriteSerial(static_cast(port), - reinterpret_cast( + reinterpret_cast( JByteArrayRef(env, dataToSend).array().data()), size, &status); SERIALJNI_LOG(logDEBUG) << "ReturnValue = " << retVal; @@ -301,8 +323,10 @@ JNIEXPORT jint JNICALL Java_edu_wpi_first_wpilibj_hal_SerialPortJNI_serialWrite( * Method: serialFlush * Signature: (B)V */ -JNIEXPORT void JNICALL Java_edu_wpi_first_wpilibj_hal_SerialPortJNI_serialFlush( - JNIEnv* env, jclass, jbyte port) { +JNIEXPORT void JNICALL +Java_edu_wpi_first_wpilibj_hal_SerialPortJNI_serialFlush + (JNIEnv* env, jclass, jbyte port) +{ SERIALJNI_LOG(logDEBUG) << "Serial Flush"; int32_t status = 0; HAL_FlushSerial(static_cast(port), &status); @@ -315,8 +339,10 @@ JNIEXPORT void JNICALL Java_edu_wpi_first_wpilibj_hal_SerialPortJNI_serialFlush( * Method: serialClear * Signature: (B)V */ -JNIEXPORT void JNICALL Java_edu_wpi_first_wpilibj_hal_SerialPortJNI_serialClear( - JNIEnv* env, jclass, jbyte port) { +JNIEXPORT void JNICALL +Java_edu_wpi_first_wpilibj_hal_SerialPortJNI_serialClear + (JNIEnv* env, jclass, jbyte port) +{ SERIALJNI_LOG(logDEBUG) << "Serial Clear"; int32_t status = 0; HAL_ClearSerial(static_cast(port), &status); @@ -329,8 +355,10 @@ JNIEXPORT void JNICALL Java_edu_wpi_first_wpilibj_hal_SerialPortJNI_serialClear( * Method: serialClose * Signature: (B)V */ -JNIEXPORT void JNICALL Java_edu_wpi_first_wpilibj_hal_SerialPortJNI_serialClose( - JNIEnv* env, jclass, jbyte port) { +JNIEXPORT void JNICALL +Java_edu_wpi_first_wpilibj_hal_SerialPortJNI_serialClose + (JNIEnv* env, jclass, jbyte port) +{ SERIALJNI_LOG(logDEBUG) << "Serial Close"; int32_t status = 0; HAL_CloseSerial(static_cast(port), &status); diff --git a/hal/src/main/native/cpp/jni/SolenoidJNI.cpp b/hal/src/main/native/cpp/jni/SolenoidJNI.cpp index 63c805e4b3..9711c9972b 100644 --- a/hal/src/main/native/cpp/jni/SolenoidJNI.cpp +++ b/hal/src/main/native/cpp/jni/SolenoidJNI.cpp @@ -1,19 +1,18 @@ /*----------------------------------------------------------------------------*/ -/* Copyright (c) FIRST 2016. All Rights Reserved. */ +/* Copyright (c) 2016-2018 FIRST. 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. */ /*----------------------------------------------------------------------------*/ #include -#include "HAL/Solenoid.h" + #include "HAL/Ports.h" -#include "HAL/handles/HandlesInternal.h" +#include "HAL/Solenoid.h" #include "HAL/cpp/Log.h" - -#include "edu_wpi_first_wpilibj_hal_SolenoidJNI.h" - +#include "HAL/handles/HandlesInternal.h" #include "HALUtil.h" +#include "edu_wpi_first_wpilibj_hal_SolenoidJNI.h" using namespace frc; @@ -23,7 +22,7 @@ TLogLevel solenoidJNILogLevel = logERROR; if (level > solenoidJNILogLevel) \ ; \ else \ - Log().Get(level) + Log().Get(level) extern "C" { @@ -33,8 +32,9 @@ extern "C" { * Signature: (I)I */ JNIEXPORT jint JNICALL -Java_edu_wpi_first_wpilibj_hal_SolenoidJNI_initializeSolenoidPort( - JNIEnv *env, jclass, jint id) { +Java_edu_wpi_first_wpilibj_hal_SolenoidJNI_initializeSolenoidPort + (JNIEnv* env, jclass, jint id) +{ SOLENOIDJNI_LOG(logDEBUG) << "Calling SolenoidJNI initializeSolenoidPort"; SOLENOIDJNI_LOG(logDEBUG) << "Port Handle = " << (HAL_PortHandle)id; @@ -55,10 +55,12 @@ Java_edu_wpi_first_wpilibj_hal_SolenoidJNI_initializeSolenoidPort( /* * Class: edu_wpi_first_wpilibj_hal_SolenoidJNI * Method: checkSolenoidChannel - * Signature: (I)Z; -*/ -JNIEXPORT jboolean JNICALL Java_edu_wpi_first_wpilibj_hal_SolenoidJNI_checkSolenoidChannel( - JNIEnv *env, jclass, jint channel) { + * Signature: (I)Z + */ +JNIEXPORT jboolean JNICALL +Java_edu_wpi_first_wpilibj_hal_SolenoidJNI_checkSolenoidChannel + (JNIEnv* env, jclass, jint channel) +{ SOLENOIDJNI_LOG(logDEBUG) << "Calling SolenoidJNI checkSolenoidChannel"; SOLENOIDJNI_LOG(logDEBUG) << "Channel = " << channel; return HAL_CheckSolenoidChannel(channel); @@ -67,10 +69,12 @@ JNIEXPORT jboolean JNICALL Java_edu_wpi_first_wpilibj_hal_SolenoidJNI_checkSolen /* * Class: edu_wpi_first_wpilibj_hal_SolenoidJNI * Method: checkSolenoidModule - * Signature: (I)Z; -*/ -JNIEXPORT jboolean JNICALL Java_edu_wpi_first_wpilibj_hal_SolenoidJNI_checkSolenoidModule( - JNIEnv *env, jclass, jint module) { + * Signature: (I)Z + */ +JNIEXPORT jboolean JNICALL +Java_edu_wpi_first_wpilibj_hal_SolenoidJNI_checkSolenoidModule + (JNIEnv* env, jclass, jint module) +{ SOLENOIDJNI_LOG(logDEBUG) << "Calling SolenoidJNI checkSolenoidModule"; SOLENOIDJNI_LOG(logDEBUG) << "Module = " << module; return HAL_CheckSolenoidModule(module); @@ -82,8 +86,9 @@ JNIEXPORT jboolean JNICALL Java_edu_wpi_first_wpilibj_hal_SolenoidJNI_checkSolen * Signature: (I)V */ JNIEXPORT void JNICALL -Java_edu_wpi_first_wpilibj_hal_SolenoidJNI_freeSolenoidPort( - JNIEnv *env, jclass, jint id) { +Java_edu_wpi_first_wpilibj_hal_SolenoidJNI_freeSolenoidPort + (JNIEnv* env, jclass, jint id) +{ SOLENOIDJNI_LOG(logDEBUG) << "Calling SolenoidJNI initializeSolenoidPort"; SOLENOIDJNI_LOG(logDEBUG) << "Port Handle = " << (HAL_SolenoidHandle)id; @@ -95,12 +100,14 @@ Java_edu_wpi_first_wpilibj_hal_SolenoidJNI_freeSolenoidPort( * Method: setSolenoid * Signature: (IZ)V */ -JNIEXPORT void JNICALL Java_edu_wpi_first_wpilibj_hal_SolenoidJNI_setSolenoid( - JNIEnv *env, jclass, jint solenoid_port, jboolean value) { +JNIEXPORT void JNICALL +Java_edu_wpi_first_wpilibj_hal_SolenoidJNI_setSolenoid + (JNIEnv* env, jclass, jint solenoid_port, jboolean value) +{ SOLENOIDJNI_LOG(logDEBUG) << "Calling SolenoidJNI SetSolenoid"; - SOLENOIDJNI_LOG(logDEBUG) << "Solenoid Port Handle = " - << (HAL_SolenoidHandle)solenoid_port; + SOLENOIDJNI_LOG(logDEBUG) + << "Solenoid Port Handle = " << (HAL_SolenoidHandle)solenoid_port; int32_t status = 0; HAL_SetSolenoid((HAL_SolenoidHandle)solenoid_port, value, &status); @@ -113,8 +120,9 @@ JNIEXPORT void JNICALL Java_edu_wpi_first_wpilibj_hal_SolenoidJNI_setSolenoid( * Signature: (I)Z */ JNIEXPORT jboolean JNICALL -Java_edu_wpi_first_wpilibj_hal_SolenoidJNI_getSolenoid( - JNIEnv *env, jclass, jint solenoid_port) { +Java_edu_wpi_first_wpilibj_hal_SolenoidJNI_getSolenoid + (JNIEnv* env, jclass, jint solenoid_port) +{ int32_t status = 0; jboolean val = HAL_GetSolenoid((HAL_SolenoidHandle)solenoid_port, &status); CheckStatus(env, status); @@ -127,8 +135,9 @@ Java_edu_wpi_first_wpilibj_hal_SolenoidJNI_getSolenoid( * Signature: (I)I */ JNIEXPORT jint JNICALL -Java_edu_wpi_first_wpilibj_hal_SolenoidJNI_getAllSolenoids( - JNIEnv *env, jclass, jint module) { +Java_edu_wpi_first_wpilibj_hal_SolenoidJNI_getAllSolenoids + (JNIEnv* env, jclass, jint module) +{ int32_t status = 0; jint val = HAL_GetAllSolenoids(module, &status); CheckStatus(env, status); @@ -141,8 +150,9 @@ Java_edu_wpi_first_wpilibj_hal_SolenoidJNI_getAllSolenoids( * Signature: (I)I */ JNIEXPORT jint JNICALL -Java_edu_wpi_first_wpilibj_hal_SolenoidJNI_getPCMSolenoidBlackList( - JNIEnv *env, jclass, jint module) { +Java_edu_wpi_first_wpilibj_hal_SolenoidJNI_getPCMSolenoidBlackList + (JNIEnv* env, jclass, jint module) +{ int32_t status = 0; jint val = HAL_GetPCMSolenoidBlackList(module, &status); CheckStatus(env, status); @@ -154,8 +164,9 @@ Java_edu_wpi_first_wpilibj_hal_SolenoidJNI_getPCMSolenoidBlackList( * Signature: (I)Z */ JNIEXPORT jboolean JNICALL -Java_edu_wpi_first_wpilibj_hal_SolenoidJNI_getPCMSolenoidVoltageStickyFault( - JNIEnv *env, jclass, jint module) { +Java_edu_wpi_first_wpilibj_hal_SolenoidJNI_getPCMSolenoidVoltageStickyFault + (JNIEnv* env, jclass, jint module) +{ int32_t status = 0; bool val = HAL_GetPCMSolenoidVoltageStickyFault(module, &status); CheckStatus(env, status); @@ -167,8 +178,9 @@ Java_edu_wpi_first_wpilibj_hal_SolenoidJNI_getPCMSolenoidVoltageStickyFault( * Signature: (I)Z */ JNIEXPORT jboolean JNICALL -Java_edu_wpi_first_wpilibj_hal_SolenoidJNI_getPCMSolenoidVoltageFault( - JNIEnv *env, jclass, jint module) { +Java_edu_wpi_first_wpilibj_hal_SolenoidJNI_getPCMSolenoidVoltageFault + (JNIEnv* env, jclass, jint module) +{ int32_t status = 0; bool val = HAL_GetPCMSolenoidVoltageFault(module, &status); CheckStatus(env, status); @@ -180,8 +192,9 @@ Java_edu_wpi_first_wpilibj_hal_SolenoidJNI_getPCMSolenoidVoltageFault( * Signature: (I)V */ JNIEXPORT void JNICALL -Java_edu_wpi_first_wpilibj_hal_SolenoidJNI_clearAllPCMStickyFaults( - JNIEnv *env, jclass, jint module) { +Java_edu_wpi_first_wpilibj_hal_SolenoidJNI_clearAllPCMStickyFaults + (JNIEnv* env, jclass, jint module) +{ int32_t status = 0; HAL_ClearAllPCMStickyFaults(module, &status); CheckStatus(env, status); @@ -192,17 +205,19 @@ Java_edu_wpi_first_wpilibj_hal_SolenoidJNI_clearAllPCMStickyFaults( * Method: setOneShotDuration * Signature: (IJ)V */ -JNIEXPORT void JNICALL Java_edu_wpi_first_wpilibj_hal_SolenoidJNI_setOneShotDuration - (JNIEnv *env, jclass, jint solenoid_port, jlong durationMS) +JNIEXPORT void JNICALL +Java_edu_wpi_first_wpilibj_hal_SolenoidJNI_setOneShotDuration + (JNIEnv* env, jclass, jint solenoid_port, jlong durationMS) { SOLENOIDJNI_LOG(logDEBUG) << "Calling SolenoidJNI SetOneShotDuration"; - SOLENOIDJNI_LOG(logDEBUG) << "Solenoid Port Handle = " - << (HAL_SolenoidHandle)solenoid_port; + SOLENOIDJNI_LOG(logDEBUG) + << "Solenoid Port Handle = " << (HAL_SolenoidHandle)solenoid_port; SOLENOIDJNI_LOG(logDEBUG) << "Duration (MS) = " << durationMS; int32_t status = 0; - HAL_SetOneShotDuration((HAL_SolenoidHandle)solenoid_port, durationMS, &status); + HAL_SetOneShotDuration((HAL_SolenoidHandle)solenoid_port, durationMS, + &status); CheckStatus(env, status); } @@ -211,13 +226,14 @@ JNIEXPORT void JNICALL Java_edu_wpi_first_wpilibj_hal_SolenoidJNI_setOneShotDura * Method: fireOneShot * Signature: (I)V */ -JNIEXPORT void JNICALL Java_edu_wpi_first_wpilibj_hal_SolenoidJNI_fireOneShot - (JNIEnv *env, jclass, jint solenoid_port) +JNIEXPORT void JNICALL +Java_edu_wpi_first_wpilibj_hal_SolenoidJNI_fireOneShot + (JNIEnv* env, jclass, jint solenoid_port) { SOLENOIDJNI_LOG(logDEBUG) << "Calling SolenoidJNI fireOneShot"; - SOLENOIDJNI_LOG(logDEBUG) << "Solenoid Port Handle = " - << (HAL_SolenoidHandle)solenoid_port; + SOLENOIDJNI_LOG(logDEBUG) + << "Solenoid Port Handle = " << (HAL_SolenoidHandle)solenoid_port; int32_t status = 0; HAL_FireOneShot((HAL_SolenoidHandle)solenoid_port, &status); diff --git a/hal/src/main/native/cpp/jni/ThreadsJNI.cpp b/hal/src/main/native/cpp/jni/ThreadsJNI.cpp index 7121b8d80a..572763387c 100644 --- a/hal/src/main/native/cpp/jni/ThreadsJNI.cpp +++ b/hal/src/main/native/cpp/jni/ThreadsJNI.cpp @@ -1,18 +1,18 @@ /*----------------------------------------------------------------------------*/ -/* Copyright (c) FIRST 2016. All Rights Reserved. */ +/* Copyright (c) 2016-2018 FIRST. 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. */ /*----------------------------------------------------------------------------*/ -#include #include -#include "HAL/cpp/Log.h" -#include "edu_wpi_first_wpilibj_hal_ThreadsJNI.h" +#include #include "HAL/Threads.h" +#include "HAL/cpp/Log.h" #include "HALUtil.h" +#include "edu_wpi_first_wpilibj_hal_ThreadsJNI.h" using namespace frc; @@ -21,18 +21,20 @@ TLogLevel threadsJNILogLevel = logWARNING; #define THREADSJNI_LOG(level) \ if (level > threadsJNILogLevel) \ - ; \ - else \ - Log().Get(level) + ; \ + else \ + Log().Get(level) extern "C" { /* * Class: edu_wpi_first_wpilibj_hal_ThreadsJNI - * Method: GetCurrentThreadPriority + * Method: getCurrentThreadPriority * Signature: ()I */ -JNIEXPORT jint JNICALL Java_edu_wpi_first_wpilibj_hal_ThreadsJNI_getCurrentThreadPriority - (JNIEnv *env, jclass) { +JNIEXPORT jint JNICALL +Java_edu_wpi_first_wpilibj_hal_ThreadsJNI_getCurrentThreadPriority + (JNIEnv* env, jclass) +{ THREADSJNI_LOG(logDEBUG) << "Callling GetCurrentThreadPriority"; int32_t status = 0; HAL_Bool isRT = false; @@ -43,11 +45,13 @@ JNIEXPORT jint JNICALL Java_edu_wpi_first_wpilibj_hal_ThreadsJNI_getCurrentThrea /* * Class: edu_wpi_first_wpilibj_hal_ThreadsJNI - * Method: GetCurrentThreadIsRealTime + * Method: getCurrentThreadIsRealTime * Signature: ()Z */ -JNIEXPORT jboolean JNICALL Java_edu_wpi_first_wpilibj_hal_ThreadsJNI_getCurrentThreadIsRealTime - (JNIEnv *env, jclass) { +JNIEXPORT jboolean JNICALL +Java_edu_wpi_first_wpilibj_hal_ThreadsJNI_getCurrentThreadIsRealTime + (JNIEnv* env, jclass) +{ THREADSJNI_LOG(logDEBUG) << "Callling GetCurrentThreadIsRealTime"; int32_t status = 0; HAL_Bool isRT = false; @@ -58,16 +62,19 @@ JNIEXPORT jboolean JNICALL Java_edu_wpi_first_wpilibj_hal_ThreadsJNI_getCurrentT /* * Class: edu_wpi_first_wpilibj_hal_ThreadsJNI - * Method: SetCurrentThreadPriority + * Method: setCurrentThreadPriority * Signature: (ZI)Z */ -JNIEXPORT jboolean JNICALL Java_edu_wpi_first_wpilibj_hal_ThreadsJNI_setCurrentThreadPriority - (JNIEnv *env, jclass, jboolean realTime, jint priority) { +JNIEXPORT jboolean JNICALL +Java_edu_wpi_first_wpilibj_hal_ThreadsJNI_setCurrentThreadPriority + (JNIEnv* env, jclass, jboolean realTime, jint priority) +{ THREADSJNI_LOG(logDEBUG) << "Callling SetCurrentThreadPriority"; int32_t status = 0; - auto ret = HAL_SetCurrentThreadPriority((HAL_Bool)realTime, (int32_t)priority, &status); + auto ret = HAL_SetCurrentThreadPriority( + (HAL_Bool)realTime, static_cast(priority), &status); CheckStatus(env, status); return (jboolean)ret; } -} +} // extern "C" diff --git a/hal/src/main/native/include/Simulation/CallbackStore.h b/hal/src/main/native/include/Simulation/CallbackStore.h index b5f66b8920..6e39f47ca6 100644 --- a/hal/src/main/native/include/Simulation/CallbackStore.h +++ b/hal/src/main/native/include/Simulation/CallbackStore.h @@ -9,10 +9,10 @@ #ifndef __FRC_ROBORIO__ -#include - #include +#include + #include "MockData/HAL_Value.h" namespace frc { diff --git a/hal/src/main/native/sim/jni/AccelerometerDataJNI.cpp b/hal/src/main/native/sim/jni/AccelerometerDataJNI.cpp index ad9ef5039a..1f487131e4 100644 --- a/hal/src/main/native/sim/jni/AccelerometerDataJNI.cpp +++ b/hal/src/main/native/sim/jni/AccelerometerDataJNI.cpp @@ -13,148 +13,266 @@ extern "C" { +/* + * Class: edu_wpi_first_hal_sim_mockdata_AccelerometerDataJNI + * Method: registerActiveCallback + * Signature: (ILjava/lang/Object;Z)I + */ JNIEXPORT jint JNICALL -Java_edu_wpi_first_hal_sim_mockdata_AccelerometerDataJNI_registerActiveCallback( - JNIEnv* env, jclass, jint index, jobject callback, jboolean initialNotify) { +Java_edu_wpi_first_hal_sim_mockdata_AccelerometerDataJNI_registerActiveCallback + (JNIEnv* env, jclass, jint index, jobject callback, jboolean initialNotify) +{ return sim::AllocateCallback(env, index, callback, initialNotify, &HALSIM_RegisterAccelerometerActiveCallback); } +/* + * Class: edu_wpi_first_hal_sim_mockdata_AccelerometerDataJNI + * Method: cancelActiveCallback + * Signature: (II)V + */ JNIEXPORT void JNICALL -Java_edu_wpi_first_hal_sim_mockdata_AccelerometerDataJNI_cancelActiveCallback( - JNIEnv* env, jclass, jint index, jint handle) { +Java_edu_wpi_first_hal_sim_mockdata_AccelerometerDataJNI_cancelActiveCallback + (JNIEnv* env, jclass, jint index, jint handle) +{ return sim::FreeCallback(env, handle, index, &HALSIM_CancelAccelerometerActiveCallback); } +/* + * Class: edu_wpi_first_hal_sim_mockdata_AccelerometerDataJNI + * Method: getActive + * Signature: (I)Z + */ JNIEXPORT jboolean JNICALL -Java_edu_wpi_first_hal_sim_mockdata_AccelerometerDataJNI_getActive(JNIEnv*, - jclass, - jint index) { +Java_edu_wpi_first_hal_sim_mockdata_AccelerometerDataJNI_getActive + (JNIEnv*, jclass, jint index) +{ return HALSIM_GetAccelerometerActive(index); } +/* + * Class: edu_wpi_first_hal_sim_mockdata_AccelerometerDataJNI + * Method: setActive + * Signature: (IZ)V + */ JNIEXPORT void JNICALL -Java_edu_wpi_first_hal_sim_mockdata_AccelerometerDataJNI_setActive( - JNIEnv*, jclass, jint index, jboolean value) { +Java_edu_wpi_first_hal_sim_mockdata_AccelerometerDataJNI_setActive + (JNIEnv*, jclass, jint index, jboolean value) +{ HALSIM_SetAccelerometerActive(index, value); } +/* + * Class: edu_wpi_first_hal_sim_mockdata_AccelerometerDataJNI + * Method: registerRangeCallback + * Signature: (ILjava/lang/Object;Z)I + */ JNIEXPORT jint JNICALL -Java_edu_wpi_first_hal_sim_mockdata_AccelerometerDataJNI_registerRangeCallback( - JNIEnv* env, jclass, jint index, jobject callback, jboolean initialNotify) { +Java_edu_wpi_first_hal_sim_mockdata_AccelerometerDataJNI_registerRangeCallback + (JNIEnv* env, jclass, jint index, jobject callback, jboolean initialNotify) +{ return sim::AllocateCallback(env, index, callback, initialNotify, &HALSIM_RegisterAccelerometerRangeCallback); } +/* + * Class: edu_wpi_first_hal_sim_mockdata_AccelerometerDataJNI + * Method: cancelRangeCallback + * Signature: (II)V + */ JNIEXPORT void JNICALL -Java_edu_wpi_first_hal_sim_mockdata_AccelerometerDataJNI_cancelRangeCallback( - JNIEnv* env, jclass, jint index, jint handle) { +Java_edu_wpi_first_hal_sim_mockdata_AccelerometerDataJNI_cancelRangeCallback + (JNIEnv* env, jclass, jint index, jint handle) +{ return sim::FreeCallback(env, handle, index, &HALSIM_CancelAccelerometerRangeCallback); } +/* + * Class: edu_wpi_first_hal_sim_mockdata_AccelerometerDataJNI + * Method: getRange + * Signature: (I)I + */ JNIEXPORT jint JNICALL -Java_edu_wpi_first_hal_sim_mockdata_AccelerometerDataJNI_getRange(JNIEnv*, - jclass, - jint index) { +Java_edu_wpi_first_hal_sim_mockdata_AccelerometerDataJNI_getRange + (JNIEnv*, jclass, jint index) +{ return HALSIM_GetAccelerometerRange(index); } +/* + * Class: edu_wpi_first_hal_sim_mockdata_AccelerometerDataJNI + * Method: setRange + * Signature: (II)V + */ JNIEXPORT void JNICALL -Java_edu_wpi_first_hal_sim_mockdata_AccelerometerDataJNI_setRange(JNIEnv*, - jclass, - jint index, - jint value) { +Java_edu_wpi_first_hal_sim_mockdata_AccelerometerDataJNI_setRange + (JNIEnv*, jclass, jint index, jint value) +{ HALSIM_SetAccelerometerRange(index, static_cast(value)); } +/* + * Class: edu_wpi_first_hal_sim_mockdata_AccelerometerDataJNI + * Method: registerXCallback + * Signature: (ILjava/lang/Object;Z)I + */ JNIEXPORT jint JNICALL -Java_edu_wpi_first_hal_sim_mockdata_AccelerometerDataJNI_registerXCallback( - JNIEnv* env, jclass, jint index, jobject callback, jboolean initialNotify) { +Java_edu_wpi_first_hal_sim_mockdata_AccelerometerDataJNI_registerXCallback + (JNIEnv* env, jclass, jint index, jobject callback, jboolean initialNotify) +{ return sim::AllocateCallback(env, index, callback, initialNotify, &HALSIM_RegisterAccelerometerXCallback); } +/* + * Class: edu_wpi_first_hal_sim_mockdata_AccelerometerDataJNI + * Method: cancelXCallback + * Signature: (II)V + */ JNIEXPORT void JNICALL -Java_edu_wpi_first_hal_sim_mockdata_AccelerometerDataJNI_cancelXCallback( - JNIEnv* env, jclass, jint index, jint handle) { +Java_edu_wpi_first_hal_sim_mockdata_AccelerometerDataJNI_cancelXCallback + (JNIEnv* env, jclass, jint index, jint handle) +{ return sim::FreeCallback(env, handle, index, &HALSIM_CancelAccelerometerXCallback); } +/* + * Class: edu_wpi_first_hal_sim_mockdata_AccelerometerDataJNI + * Method: getX + * Signature: (I)D + */ JNIEXPORT jdouble JNICALL -Java_edu_wpi_first_hal_sim_mockdata_AccelerometerDataJNI_getX(JNIEnv*, jclass, - jint index) { +Java_edu_wpi_first_hal_sim_mockdata_AccelerometerDataJNI_getX + (JNIEnv*, jclass, jint index) +{ return HALSIM_GetAccelerometerX(index); } +/* + * Class: edu_wpi_first_hal_sim_mockdata_AccelerometerDataJNI + * Method: setX + * Signature: (ID)V + */ JNIEXPORT void JNICALL -Java_edu_wpi_first_hal_sim_mockdata_AccelerometerDataJNI_setX(JNIEnv*, jclass, - jint index, - jdouble value) { +Java_edu_wpi_first_hal_sim_mockdata_AccelerometerDataJNI_setX + (JNIEnv*, jclass, jint index, jdouble value) +{ HALSIM_SetAccelerometerX(index, value); } +/* + * Class: edu_wpi_first_hal_sim_mockdata_AccelerometerDataJNI + * Method: registerYCallback + * Signature: (ILjava/lang/Object;Z)I + */ JNIEXPORT jint JNICALL -Java_edu_wpi_first_hal_sim_mockdata_AccelerometerDataJNI_registerYCallback( - JNIEnv* env, jclass, jint index, jobject callback, jboolean initialNotify) { +Java_edu_wpi_first_hal_sim_mockdata_AccelerometerDataJNI_registerYCallback + (JNIEnv* env, jclass, jint index, jobject callback, jboolean initialNotify) +{ return sim::AllocateCallback(env, index, callback, initialNotify, &HALSIM_RegisterAccelerometerYCallback); } +/* + * Class: edu_wpi_first_hal_sim_mockdata_AccelerometerDataJNI + * Method: cancelYCallback + * Signature: (II)V + */ JNIEXPORT void JNICALL -Java_edu_wpi_first_hal_sim_mockdata_AccelerometerDataJNI_cancelYCallback( - JNIEnv* env, jclass, jint index, jint handle) { +Java_edu_wpi_first_hal_sim_mockdata_AccelerometerDataJNI_cancelYCallback + (JNIEnv* env, jclass, jint index, jint handle) +{ return sim::FreeCallback(env, handle, index, &HALSIM_CancelAccelerometerYCallback); } +/* + * Class: edu_wpi_first_hal_sim_mockdata_AccelerometerDataJNI + * Method: getY + * Signature: (I)D + */ JNIEXPORT jdouble JNICALL -Java_edu_wpi_first_hal_sim_mockdata_AccelerometerDataJNI_getY(JNIEnv*, jclass, - jint index) { +Java_edu_wpi_first_hal_sim_mockdata_AccelerometerDataJNI_getY + (JNIEnv*, jclass, jint index) +{ return HALSIM_GetAccelerometerY(index); } +/* + * Class: edu_wpi_first_hal_sim_mockdata_AccelerometerDataJNI + * Method: setY + * Signature: (ID)V + */ JNIEXPORT void JNICALL -Java_edu_wpi_first_hal_sim_mockdata_AccelerometerDataJNI_setY(JNIEnv*, jclass, - jint index, - jdouble value) { +Java_edu_wpi_first_hal_sim_mockdata_AccelerometerDataJNI_setY + (JNIEnv*, jclass, jint index, jdouble value) +{ HALSIM_SetAccelerometerY(index, value); } +/* + * Class: edu_wpi_first_hal_sim_mockdata_AccelerometerDataJNI + * Method: registerZCallback + * Signature: (ILjava/lang/Object;Z)I + */ JNIEXPORT jint JNICALL -Java_edu_wpi_first_hal_sim_mockdata_AccelerometerDataJNI_registerZCallback( - JNIEnv* env, jclass, jint index, jobject callback, jboolean initialNotify) { +Java_edu_wpi_first_hal_sim_mockdata_AccelerometerDataJNI_registerZCallback + (JNIEnv* env, jclass, jint index, jobject callback, jboolean initialNotify) +{ return sim::AllocateCallback(env, index, callback, initialNotify, &HALSIM_RegisterAccelerometerZCallback); } +/* + * Class: edu_wpi_first_hal_sim_mockdata_AccelerometerDataJNI + * Method: cancelZCallback + * Signature: (II)V + */ JNIEXPORT void JNICALL -Java_edu_wpi_first_hal_sim_mockdata_AccelerometerDataJNI_cancelZCallback( - JNIEnv* env, jclass, jint index, jint handle) { +Java_edu_wpi_first_hal_sim_mockdata_AccelerometerDataJNI_cancelZCallback + (JNIEnv* env, jclass, jint index, jint handle) +{ return sim::FreeCallback(env, handle, index, &HALSIM_CancelAccelerometerZCallback); } +/* + * Class: edu_wpi_first_hal_sim_mockdata_AccelerometerDataJNI + * Method: getZ + * Signature: (I)D + */ JNIEXPORT jdouble JNICALL -Java_edu_wpi_first_hal_sim_mockdata_AccelerometerDataJNI_getZ(JNIEnv*, jclass, - jint index) { +Java_edu_wpi_first_hal_sim_mockdata_AccelerometerDataJNI_getZ + (JNIEnv*, jclass, jint index) +{ return HALSIM_GetAccelerometerZ(index); } +/* + * Class: edu_wpi_first_hal_sim_mockdata_AccelerometerDataJNI + * Method: setZ + * Signature: (ID)V + */ JNIEXPORT void JNICALL -Java_edu_wpi_first_hal_sim_mockdata_AccelerometerDataJNI_setZ(JNIEnv*, jclass, - jint index, - jdouble value) { +Java_edu_wpi_first_hal_sim_mockdata_AccelerometerDataJNI_setZ + (JNIEnv*, jclass, jint index, jdouble value) +{ HALSIM_SetAccelerometerZ(index, value); } +/* + * Class: edu_wpi_first_hal_sim_mockdata_AccelerometerDataJNI + * Method: resetData + * Signature: (I)V + */ JNIEXPORT void JNICALL -Java_edu_wpi_first_hal_sim_mockdata_AccelerometerDataJNI_resetData(JNIEnv*, - jclass, - jint index) { +Java_edu_wpi_first_hal_sim_mockdata_AccelerometerDataJNI_resetData + (JNIEnv*, jclass, jint index) +{ HALSIM_ResetAccelerometerData(index); } diff --git a/hal/src/main/native/sim/jni/AnalogGyroDataJNI.cpp b/hal/src/main/native/sim/jni/AnalogGyroDataJNI.cpp index c21b4733ce..51d6ab99d2 100644 --- a/hal/src/main/native/sim/jni/AnalogGyroDataJNI.cpp +++ b/hal/src/main/native/sim/jni/AnalogGyroDataJNI.cpp @@ -13,89 +13,165 @@ extern "C" { +/* + * Class: edu_wpi_first_hal_sim_mockdata_AnalogGyroDataJNI + * Method: registerAngleCallback + * Signature: (ILjava/lang/Object;Z)I + */ JNIEXPORT jint JNICALL -Java_edu_wpi_first_hal_sim_mockdata_AnalogGyroDataJNI_registerAngleCallback( - JNIEnv* env, jclass, jint index, jobject callback, jboolean initialNotify) { +Java_edu_wpi_first_hal_sim_mockdata_AnalogGyroDataJNI_registerAngleCallback + (JNIEnv* env, jclass, jint index, jobject callback, jboolean initialNotify) +{ return sim::AllocateCallback(env, index, callback, initialNotify, &HALSIM_RegisterAnalogGyroAngleCallback); } +/* + * Class: edu_wpi_first_hal_sim_mockdata_AnalogGyroDataJNI + * Method: cancelAngleCallback + * Signature: (II)V + */ JNIEXPORT void JNICALL -Java_edu_wpi_first_hal_sim_mockdata_AnalogGyroDataJNI_cancelAngleCallback( - JNIEnv* env, jclass, jint index, jint handle) { +Java_edu_wpi_first_hal_sim_mockdata_AnalogGyroDataJNI_cancelAngleCallback + (JNIEnv* env, jclass, jint index, jint handle) +{ return sim::FreeCallback(env, handle, index, &HALSIM_CancelAnalogGyroAngleCallback); } +/* + * Class: edu_wpi_first_hal_sim_mockdata_AnalogGyroDataJNI + * Method: getAngle + * Signature: (I)D + */ JNIEXPORT jdouble JNICALL -Java_edu_wpi_first_hal_sim_mockdata_AnalogGyroDataJNI_getAngle(JNIEnv*, jclass, - jint index) { +Java_edu_wpi_first_hal_sim_mockdata_AnalogGyroDataJNI_getAngle + (JNIEnv*, jclass, jint index) +{ return HALSIM_GetAnalogGyroAngle(index); } +/* + * Class: edu_wpi_first_hal_sim_mockdata_AnalogGyroDataJNI + * Method: setAngle + * Signature: (ID)V + */ JNIEXPORT void JNICALL -Java_edu_wpi_first_hal_sim_mockdata_AnalogGyroDataJNI_setAngle(JNIEnv*, jclass, - jint index, - jdouble value) { +Java_edu_wpi_first_hal_sim_mockdata_AnalogGyroDataJNI_setAngle + (JNIEnv*, jclass, jint index, jdouble value) +{ HALSIM_SetAnalogGyroAngle(index, value); } +/* + * Class: edu_wpi_first_hal_sim_mockdata_AnalogGyroDataJNI + * Method: registerRateCallback + * Signature: (ILjava/lang/Object;Z)I + */ JNIEXPORT jint JNICALL -Java_edu_wpi_first_hal_sim_mockdata_AnalogGyroDataJNI_registerRateCallback( - JNIEnv* env, jclass, jint index, jobject callback, jboolean initialNotify) { +Java_edu_wpi_first_hal_sim_mockdata_AnalogGyroDataJNI_registerRateCallback + (JNIEnv* env, jclass, jint index, jobject callback, jboolean initialNotify) +{ return sim::AllocateCallback(env, index, callback, initialNotify, &HALSIM_RegisterAnalogGyroRateCallback); } +/* + * Class: edu_wpi_first_hal_sim_mockdata_AnalogGyroDataJNI + * Method: cancelRateCallback + * Signature: (II)V + */ JNIEXPORT void JNICALL -Java_edu_wpi_first_hal_sim_mockdata_AnalogGyroDataJNI_cancelRateCallback( - JNIEnv* env, jclass, jint index, jint handle) { +Java_edu_wpi_first_hal_sim_mockdata_AnalogGyroDataJNI_cancelRateCallback + (JNIEnv* env, jclass, jint index, jint handle) +{ return sim::FreeCallback(env, handle, index, &HALSIM_CancelAnalogGyroRateCallback); } +/* + * Class: edu_wpi_first_hal_sim_mockdata_AnalogGyroDataJNI + * Method: getRate + * Signature: (I)D + */ JNIEXPORT jdouble JNICALL -Java_edu_wpi_first_hal_sim_mockdata_AnalogGyroDataJNI_getRate(JNIEnv*, jclass, - jint index) { +Java_edu_wpi_first_hal_sim_mockdata_AnalogGyroDataJNI_getRate + (JNIEnv*, jclass, jint index) +{ return HALSIM_GetAnalogGyroRate(index); } +/* + * Class: edu_wpi_first_hal_sim_mockdata_AnalogGyroDataJNI + * Method: setRate + * Signature: (ID)V + */ JNIEXPORT void JNICALL -Java_edu_wpi_first_hal_sim_mockdata_AnalogGyroDataJNI_setRate(JNIEnv*, jclass, - jint index, - jdouble value) { +Java_edu_wpi_first_hal_sim_mockdata_AnalogGyroDataJNI_setRate + (JNIEnv*, jclass, jint index, jdouble value) +{ HALSIM_SetAnalogGyroRate(index, value); } +/* + * Class: edu_wpi_first_hal_sim_mockdata_AnalogGyroDataJNI + * Method: registerInitializedCallback + * Signature: (ILjava/lang/Object;Z)I + */ JNIEXPORT jint JNICALL -Java_edu_wpi_first_hal_sim_mockdata_AnalogGyroDataJNI_registerInitializedCallback( - JNIEnv* env, jclass, jint index, jobject callback, jboolean initialNotify) { +Java_edu_wpi_first_hal_sim_mockdata_AnalogGyroDataJNI_registerInitializedCallback + (JNIEnv* env, jclass, jint index, jobject callback, jboolean initialNotify) +{ return sim::AllocateCallback(env, index, callback, initialNotify, &HALSIM_RegisterAnalogGyroInitializedCallback); } +/* + * Class: edu_wpi_first_hal_sim_mockdata_AnalogGyroDataJNI + * Method: cancelInitializedCallback + * Signature: (II)V + */ JNIEXPORT void JNICALL -Java_edu_wpi_first_hal_sim_mockdata_AnalogGyroDataJNI_cancelInitializedCallback( - JNIEnv* env, jclass, jint index, jint handle) { +Java_edu_wpi_first_hal_sim_mockdata_AnalogGyroDataJNI_cancelInitializedCallback + (JNIEnv* env, jclass, jint index, jint handle) +{ return sim::FreeCallback(env, handle, index, &HALSIM_CancelAnalogGyroInitializedCallback); } +/* + * Class: edu_wpi_first_hal_sim_mockdata_AnalogGyroDataJNI + * Method: getInitialized + * Signature: (I)Z + */ JNIEXPORT jboolean JNICALL -Java_edu_wpi_first_hal_sim_mockdata_AnalogGyroDataJNI_getInitialized( - JNIEnv*, jclass, jint index) { +Java_edu_wpi_first_hal_sim_mockdata_AnalogGyroDataJNI_getInitialized + (JNIEnv*, jclass, jint index) +{ return HALSIM_GetAnalogGyroInitialized(index); } +/* + * Class: edu_wpi_first_hal_sim_mockdata_AnalogGyroDataJNI + * Method: setInitialized + * Signature: (IZ)V + */ JNIEXPORT void JNICALL -Java_edu_wpi_first_hal_sim_mockdata_AnalogGyroDataJNI_setInitialized( - JNIEnv*, jclass, jint index, jboolean value) { +Java_edu_wpi_first_hal_sim_mockdata_AnalogGyroDataJNI_setInitialized + (JNIEnv*, jclass, jint index, jboolean value) +{ HALSIM_SetAnalogGyroInitialized(index, value); } +/* + * Class: edu_wpi_first_hal_sim_mockdata_AnalogGyroDataJNI + * Method: resetData + * Signature: (I)V + */ JNIEXPORT void JNICALL -Java_edu_wpi_first_hal_sim_mockdata_AnalogGyroDataJNI_resetData(JNIEnv*, jclass, - jint index) { +Java_edu_wpi_first_hal_sim_mockdata_AnalogGyroDataJNI_resetData + (JNIEnv*, jclass, jint index) +{ HALSIM_ResetAnalogGyroData(index); } diff --git a/hal/src/main/native/sim/jni/AnalogInDataJNI.cpp b/hal/src/main/native/sim/jni/AnalogInDataJNI.cpp index a7df17ddec..ebab507285 100644 --- a/hal/src/main/native/sim/jni/AnalogInDataJNI.cpp +++ b/hal/src/main/native/sim/jni/AnalogInDataJNI.cpp @@ -13,253 +13,470 @@ extern "C" { +/* + * Class: edu_wpi_first_hal_sim_mockdata_AnalogInDataJNI + * Method: registerInitializedCallback + * Signature: (ILjava/lang/Object;Z)I + */ JNIEXPORT jint JNICALL -Java_edu_wpi_first_hal_sim_mockdata_AnalogInDataJNI_registerInitializedCallback( - JNIEnv* env, jclass, jint index, jobject callback, jboolean initialNotify) { +Java_edu_wpi_first_hal_sim_mockdata_AnalogInDataJNI_registerInitializedCallback + (JNIEnv* env, jclass, jint index, jobject callback, jboolean initialNotify) +{ return sim::AllocateCallback(env, index, callback, initialNotify, &HALSIM_RegisterAnalogInInitializedCallback); } +/* + * Class: edu_wpi_first_hal_sim_mockdata_AnalogInDataJNI + * Method: cancelInitializedCallback + * Signature: (II)V + */ JNIEXPORT void JNICALL -Java_edu_wpi_first_hal_sim_mockdata_AnalogInDataJNI_cancelInitializedCallback( - JNIEnv* env, jclass, jint index, jint handle) { +Java_edu_wpi_first_hal_sim_mockdata_AnalogInDataJNI_cancelInitializedCallback + (JNIEnv* env, jclass, jint index, jint handle) +{ return sim::FreeCallback(env, handle, index, &HALSIM_CancelAnalogInInitializedCallback); } +/* + * Class: edu_wpi_first_hal_sim_mockdata_AnalogInDataJNI + * Method: getInitialized + * Signature: (I)Z + */ JNIEXPORT jboolean JNICALL -Java_edu_wpi_first_hal_sim_mockdata_AnalogInDataJNI_getInitialized(JNIEnv*, - jclass, - jint index) { +Java_edu_wpi_first_hal_sim_mockdata_AnalogInDataJNI_getInitialized + (JNIEnv*, jclass, jint index) +{ return HALSIM_GetAnalogInInitialized(index); } +/* + * Class: edu_wpi_first_hal_sim_mockdata_AnalogInDataJNI + * Method: setInitialized + * Signature: (IZ)V + */ JNIEXPORT void JNICALL -Java_edu_wpi_first_hal_sim_mockdata_AnalogInDataJNI_setInitialized( - JNIEnv*, jclass, jint index, jboolean value) { +Java_edu_wpi_first_hal_sim_mockdata_AnalogInDataJNI_setInitialized + (JNIEnv*, jclass, jint index, jboolean value) +{ HALSIM_SetAnalogInInitialized(index, value); } +/* + * Class: edu_wpi_first_hal_sim_mockdata_AnalogInDataJNI + * Method: registerAverageBitsCallback + * Signature: (ILjava/lang/Object;Z)I + */ JNIEXPORT jint JNICALL -Java_edu_wpi_first_hal_sim_mockdata_AnalogInDataJNI_registerAverageBitsCallback( - JNIEnv* env, jclass, jint index, jobject callback, jboolean initialNotify) { +Java_edu_wpi_first_hal_sim_mockdata_AnalogInDataJNI_registerAverageBitsCallback + (JNIEnv* env, jclass, jint index, jobject callback, jboolean initialNotify) +{ return sim::AllocateCallback(env, index, callback, initialNotify, &HALSIM_RegisterAnalogInAverageBitsCallback); } +/* + * Class: edu_wpi_first_hal_sim_mockdata_AnalogInDataJNI + * Method: cancelAverageBitsCallback + * Signature: (II)V + */ JNIEXPORT void JNICALL -Java_edu_wpi_first_hal_sim_mockdata_AnalogInDataJNI_cancelAverageBitsCallback( - JNIEnv* env, jclass, jint index, jint handle) { +Java_edu_wpi_first_hal_sim_mockdata_AnalogInDataJNI_cancelAverageBitsCallback + (JNIEnv* env, jclass, jint index, jint handle) +{ return sim::FreeCallback(env, handle, index, &HALSIM_CancelAnalogInAverageBitsCallback); } +/* + * Class: edu_wpi_first_hal_sim_mockdata_AnalogInDataJNI + * Method: getAverageBits + * Signature: (I)I + */ JNIEXPORT jint JNICALL -Java_edu_wpi_first_hal_sim_mockdata_AnalogInDataJNI_getAverageBits(JNIEnv*, - jclass, - jint index) { +Java_edu_wpi_first_hal_sim_mockdata_AnalogInDataJNI_getAverageBits + (JNIEnv*, jclass, jint index) +{ return HALSIM_GetAnalogInAverageBits(index); } +/* + * Class: edu_wpi_first_hal_sim_mockdata_AnalogInDataJNI + * Method: setAverageBits + * Signature: (II)V + */ JNIEXPORT void JNICALL -Java_edu_wpi_first_hal_sim_mockdata_AnalogInDataJNI_setAverageBits(JNIEnv*, - jclass, - jint index, - jint value) { +Java_edu_wpi_first_hal_sim_mockdata_AnalogInDataJNI_setAverageBits + (JNIEnv*, jclass, jint index, jint value) +{ HALSIM_SetAnalogInAverageBits(index, value); } +/* + * Class: edu_wpi_first_hal_sim_mockdata_AnalogInDataJNI + * Method: registerOversampleBitsCallback + * Signature: (ILjava/lang/Object;Z)I + */ JNIEXPORT jint JNICALL -Java_edu_wpi_first_hal_sim_mockdata_AnalogInDataJNI_registerOversampleBitsCallback( - JNIEnv* env, jclass, jint index, jobject callback, jboolean initialNotify) { +Java_edu_wpi_first_hal_sim_mockdata_AnalogInDataJNI_registerOversampleBitsCallback + (JNIEnv* env, jclass, jint index, jobject callback, jboolean initialNotify) +{ return sim::AllocateCallback(env, index, callback, initialNotify, &HALSIM_RegisterAnalogInOversampleBitsCallback); } +/* + * Class: edu_wpi_first_hal_sim_mockdata_AnalogInDataJNI + * Method: cancelOversampleBitsCallback + * Signature: (II)V + */ JNIEXPORT void JNICALL -Java_edu_wpi_first_hal_sim_mockdata_AnalogInDataJNI_cancelOversampleBitsCallback( - JNIEnv* env, jclass, jint index, jint handle) { +Java_edu_wpi_first_hal_sim_mockdata_AnalogInDataJNI_cancelOversampleBitsCallback + (JNIEnv* env, jclass, jint index, jint handle) +{ return sim::FreeCallback(env, handle, index, &HALSIM_CancelAnalogInOversampleBitsCallback); } +/* + * Class: edu_wpi_first_hal_sim_mockdata_AnalogInDataJNI + * Method: getOversampleBits + * Signature: (I)I + */ JNIEXPORT jint JNICALL -Java_edu_wpi_first_hal_sim_mockdata_AnalogInDataJNI_getOversampleBits( - JNIEnv*, jclass, jint index) { +Java_edu_wpi_first_hal_sim_mockdata_AnalogInDataJNI_getOversampleBits + (JNIEnv*, jclass, jint index) +{ return HALSIM_GetAnalogInOversampleBits(index); } +/* + * Class: edu_wpi_first_hal_sim_mockdata_AnalogInDataJNI + * Method: setOversampleBits + * Signature: (II)V + */ JNIEXPORT void JNICALL -Java_edu_wpi_first_hal_sim_mockdata_AnalogInDataJNI_setOversampleBits( - JNIEnv*, jclass, jint index, jint value) { +Java_edu_wpi_first_hal_sim_mockdata_AnalogInDataJNI_setOversampleBits + (JNIEnv*, jclass, jint index, jint value) +{ HALSIM_SetAnalogInOversampleBits(index, value); } +/* + * Class: edu_wpi_first_hal_sim_mockdata_AnalogInDataJNI + * Method: registerVoltageCallback + * Signature: (ILjava/lang/Object;Z)I + */ JNIEXPORT jint JNICALL -Java_edu_wpi_first_hal_sim_mockdata_AnalogInDataJNI_registerVoltageCallback( - JNIEnv* env, jclass, jint index, jobject callback, jboolean initialNotify) { +Java_edu_wpi_first_hal_sim_mockdata_AnalogInDataJNI_registerVoltageCallback + (JNIEnv* env, jclass, jint index, jobject callback, jboolean initialNotify) +{ return sim::AllocateCallback(env, index, callback, initialNotify, &HALSIM_RegisterAnalogInVoltageCallback); } +/* + * Class: edu_wpi_first_hal_sim_mockdata_AnalogInDataJNI + * Method: cancelVoltageCallback + * Signature: (II)V + */ JNIEXPORT void JNICALL -Java_edu_wpi_first_hal_sim_mockdata_AnalogInDataJNI_cancelVoltageCallback( - JNIEnv* env, jclass, jint index, jint handle) { +Java_edu_wpi_first_hal_sim_mockdata_AnalogInDataJNI_cancelVoltageCallback + (JNIEnv* env, jclass, jint index, jint handle) +{ return sim::FreeCallback(env, handle, index, &HALSIM_CancelAnalogInVoltageCallback); } +/* + * Class: edu_wpi_first_hal_sim_mockdata_AnalogInDataJNI + * Method: getVoltage + * Signature: (I)D + */ JNIEXPORT jdouble JNICALL -Java_edu_wpi_first_hal_sim_mockdata_AnalogInDataJNI_getVoltage(JNIEnv*, jclass, - jint index) { +Java_edu_wpi_first_hal_sim_mockdata_AnalogInDataJNI_getVoltage + (JNIEnv*, jclass, jint index) +{ return HALSIM_GetAnalogInVoltage(index); } +/* + * Class: edu_wpi_first_hal_sim_mockdata_AnalogInDataJNI + * Method: setVoltage + * Signature: (ID)V + */ JNIEXPORT void JNICALL -Java_edu_wpi_first_hal_sim_mockdata_AnalogInDataJNI_setVoltage(JNIEnv*, jclass, - jint index, - jdouble value) { +Java_edu_wpi_first_hal_sim_mockdata_AnalogInDataJNI_setVoltage + (JNIEnv*, jclass, jint index, jdouble value) +{ HALSIM_SetAnalogInVoltage(index, value); } +/* + * Class: edu_wpi_first_hal_sim_mockdata_AnalogInDataJNI + * Method: registerAccumulatorInitializedCallback + * Signature: (ILjava/lang/Object;Z)I + */ JNIEXPORT jint JNICALL -Java_edu_wpi_first_hal_sim_mockdata_AnalogInDataJNI_registerAccumulatorInitializedCallback( - JNIEnv* env, jclass, jint index, jobject callback, jboolean initialNotify) { +Java_edu_wpi_first_hal_sim_mockdata_AnalogInDataJNI_registerAccumulatorInitializedCallback + (JNIEnv* env, jclass, jint index, jobject callback, jboolean initialNotify) +{ return sim::AllocateCallback( env, index, callback, initialNotify, &HALSIM_RegisterAnalogInAccumulatorInitializedCallback); } +/* + * Class: edu_wpi_first_hal_sim_mockdata_AnalogInDataJNI + * Method: cancelAccumulatorInitializedCallback + * Signature: (II)V + */ JNIEXPORT void JNICALL -Java_edu_wpi_first_hal_sim_mockdata_AnalogInDataJNI_cancelAccumulatorInitializedCallback( - JNIEnv* env, jclass, jint index, jint handle) { +Java_edu_wpi_first_hal_sim_mockdata_AnalogInDataJNI_cancelAccumulatorInitializedCallback + (JNIEnv* env, jclass, jint index, jint handle) +{ return sim::FreeCallback( env, handle, index, &HALSIM_CancelAnalogInAccumulatorInitializedCallback); } +/* + * Class: edu_wpi_first_hal_sim_mockdata_AnalogInDataJNI + * Method: getAccumulatorInitialized + * Signature: (I)Z + */ JNIEXPORT jboolean JNICALL -Java_edu_wpi_first_hal_sim_mockdata_AnalogInDataJNI_getAccumulatorInitialized( - JNIEnv*, jclass, jint index) { +Java_edu_wpi_first_hal_sim_mockdata_AnalogInDataJNI_getAccumulatorInitialized + (JNIEnv*, jclass, jint index) +{ return HALSIM_GetAnalogInAccumulatorInitialized(index); } +/* + * Class: edu_wpi_first_hal_sim_mockdata_AnalogInDataJNI + * Method: setAccumulatorInitialized + * Signature: (IZ)V + */ JNIEXPORT void JNICALL -Java_edu_wpi_first_hal_sim_mockdata_AnalogInDataJNI_setAccumulatorInitialized( - JNIEnv*, jclass, jint index, jboolean value) { +Java_edu_wpi_first_hal_sim_mockdata_AnalogInDataJNI_setAccumulatorInitialized + (JNIEnv*, jclass, jint index, jboolean value) +{ HALSIM_SetAnalogInAccumulatorInitialized(index, value); } +/* + * Class: edu_wpi_first_hal_sim_mockdata_AnalogInDataJNI + * Method: registerAccumulatorValueCallback + * Signature: (ILjava/lang/Object;Z)I + */ JNIEXPORT jint JNICALL -Java_edu_wpi_first_hal_sim_mockdata_AnalogInDataJNI_registerAccumulatorValueCallback( - JNIEnv* env, jclass, jint index, jobject callback, jboolean initialNotify) { +Java_edu_wpi_first_hal_sim_mockdata_AnalogInDataJNI_registerAccumulatorValueCallback + (JNIEnv* env, jclass, jint index, jobject callback, jboolean initialNotify) +{ return sim::AllocateCallback( env, index, callback, initialNotify, &HALSIM_RegisterAnalogInAccumulatorValueCallback); } +/* + * Class: edu_wpi_first_hal_sim_mockdata_AnalogInDataJNI + * Method: cancelAccumulatorValueCallback + * Signature: (II)V + */ JNIEXPORT void JNICALL -Java_edu_wpi_first_hal_sim_mockdata_AnalogInDataJNI_cancelAccumulatorValueCallback( - JNIEnv* env, jclass, jint index, jint handle) { +Java_edu_wpi_first_hal_sim_mockdata_AnalogInDataJNI_cancelAccumulatorValueCallback + (JNIEnv* env, jclass, jint index, jint handle) +{ return sim::FreeCallback(env, handle, index, &HALSIM_CancelAnalogInAccumulatorValueCallback); } +/* + * Class: edu_wpi_first_hal_sim_mockdata_AnalogInDataJNI + * Method: getAccumulatorValue + * Signature: (I)J + */ JNIEXPORT jlong JNICALL -Java_edu_wpi_first_hal_sim_mockdata_AnalogInDataJNI_getAccumulatorValue( - JNIEnv*, jclass, jint index) { +Java_edu_wpi_first_hal_sim_mockdata_AnalogInDataJNI_getAccumulatorValue + (JNIEnv*, jclass, jint index) +{ return HALSIM_GetAnalogInAccumulatorValue(index); } +/* + * Class: edu_wpi_first_hal_sim_mockdata_AnalogInDataJNI + * Method: setAccumulatorValue + * Signature: (IJ)V + */ JNIEXPORT void JNICALL -Java_edu_wpi_first_hal_sim_mockdata_AnalogInDataJNI_setAccumulatorValue( - JNIEnv*, jclass, jint index, jlong value) { +Java_edu_wpi_first_hal_sim_mockdata_AnalogInDataJNI_setAccumulatorValue + (JNIEnv*, jclass, jint index, jlong value) +{ HALSIM_SetAnalogInAccumulatorValue(index, value); } +/* + * Class: edu_wpi_first_hal_sim_mockdata_AnalogInDataJNI + * Method: registerAccumulatorCountCallback + * Signature: (ILjava/lang/Object;Z)I + */ JNIEXPORT jint JNICALL -Java_edu_wpi_first_hal_sim_mockdata_AnalogInDataJNI_registerAccumulatorCountCallback( - JNIEnv* env, jclass, jint index, jobject callback, jboolean initialNotify) { +Java_edu_wpi_first_hal_sim_mockdata_AnalogInDataJNI_registerAccumulatorCountCallback + (JNIEnv* env, jclass, jint index, jobject callback, jboolean initialNotify) +{ return sim::AllocateCallback( env, index, callback, initialNotify, &HALSIM_RegisterAnalogInAccumulatorCountCallback); } +/* + * Class: edu_wpi_first_hal_sim_mockdata_AnalogInDataJNI + * Method: cancelAccumulatorCountCallback + * Signature: (II)V + */ JNIEXPORT void JNICALL -Java_edu_wpi_first_hal_sim_mockdata_AnalogInDataJNI_cancelAccumulatorCountCallback( - JNIEnv* env, jclass, jint index, jint handle) { +Java_edu_wpi_first_hal_sim_mockdata_AnalogInDataJNI_cancelAccumulatorCountCallback + (JNIEnv* env, jclass, jint index, jint handle) +{ return sim::FreeCallback(env, handle, index, &HALSIM_CancelAnalogInAccumulatorCountCallback); } +/* + * Class: edu_wpi_first_hal_sim_mockdata_AnalogInDataJNI + * Method: getAccumulatorCount + * Signature: (I)J + */ JNIEXPORT jlong JNICALL -Java_edu_wpi_first_hal_sim_mockdata_AnalogInDataJNI_getAccumulatorCount( - JNIEnv*, jclass, jint index) { +Java_edu_wpi_first_hal_sim_mockdata_AnalogInDataJNI_getAccumulatorCount + (JNIEnv*, jclass, jint index) +{ return HALSIM_GetAnalogInAccumulatorCount(index); } +/* + * Class: edu_wpi_first_hal_sim_mockdata_AnalogInDataJNI + * Method: setAccumulatorCount + * Signature: (IJ)V + */ JNIEXPORT void JNICALL -Java_edu_wpi_first_hal_sim_mockdata_AnalogInDataJNI_setAccumulatorCount( - JNIEnv*, jclass, jint index, jlong value) { +Java_edu_wpi_first_hal_sim_mockdata_AnalogInDataJNI_setAccumulatorCount + (JNIEnv*, jclass, jint index, jlong value) +{ HALSIM_SetAnalogInAccumulatorCount(index, value); } +/* + * Class: edu_wpi_first_hal_sim_mockdata_AnalogInDataJNI + * Method: registerAccumulatorCenterCallback + * Signature: (ILjava/lang/Object;Z)I + */ JNIEXPORT jint JNICALL -Java_edu_wpi_first_hal_sim_mockdata_AnalogInDataJNI_registerAccumulatorCenterCallback( - JNIEnv* env, jclass, jint index, jobject callback, jboolean initialNotify) { +Java_edu_wpi_first_hal_sim_mockdata_AnalogInDataJNI_registerAccumulatorCenterCallback + (JNIEnv* env, jclass, jint index, jobject callback, jboolean initialNotify) +{ return sim::AllocateCallback( env, index, callback, initialNotify, &HALSIM_RegisterAnalogInAccumulatorCenterCallback); } +/* + * Class: edu_wpi_first_hal_sim_mockdata_AnalogInDataJNI + * Method: cancelAccumulatorCenterCallback + * Signature: (II)V + */ JNIEXPORT void JNICALL -Java_edu_wpi_first_hal_sim_mockdata_AnalogInDataJNI_cancelAccumulatorCenterCallback( - JNIEnv* env, jclass, jint index, jint handle) { +Java_edu_wpi_first_hal_sim_mockdata_AnalogInDataJNI_cancelAccumulatorCenterCallback + (JNIEnv* env, jclass, jint index, jint handle) +{ return sim::FreeCallback(env, handle, index, &HALSIM_CancelAnalogInAccumulatorCenterCallback); } +/* + * Class: edu_wpi_first_hal_sim_mockdata_AnalogInDataJNI + * Method: getAccumulatorCenter + * Signature: (I)I + */ JNIEXPORT jint JNICALL -Java_edu_wpi_first_hal_sim_mockdata_AnalogInDataJNI_getAccumulatorCenter( - JNIEnv*, jclass, jint index) { +Java_edu_wpi_first_hal_sim_mockdata_AnalogInDataJNI_getAccumulatorCenter + (JNIEnv*, jclass, jint index) +{ return HALSIM_GetAnalogInAccumulatorCenter(index); } +/* + * Class: edu_wpi_first_hal_sim_mockdata_AnalogInDataJNI + * Method: setAccumulatorCenter + * Signature: (II)V + */ JNIEXPORT void JNICALL -Java_edu_wpi_first_hal_sim_mockdata_AnalogInDataJNI_setAccumulatorCenter( - JNIEnv*, jclass, jint index, jint value) { +Java_edu_wpi_first_hal_sim_mockdata_AnalogInDataJNI_setAccumulatorCenter + (JNIEnv*, jclass, jint index, jint value) +{ HALSIM_SetAnalogInAccumulatorCenter(index, value); } +/* + * Class: edu_wpi_first_hal_sim_mockdata_AnalogInDataJNI + * Method: registerAccumulatorDeadbandCallback + * Signature: (ILjava/lang/Object;Z)I + */ JNIEXPORT jint JNICALL -Java_edu_wpi_first_hal_sim_mockdata_AnalogInDataJNI_registerAccumulatorDeadbandCallback( - JNIEnv* env, jclass, jint index, jobject callback, jboolean initialNotify) { +Java_edu_wpi_first_hal_sim_mockdata_AnalogInDataJNI_registerAccumulatorDeadbandCallback + (JNIEnv* env, jclass, jint index, jobject callback, jboolean initialNotify) +{ return sim::AllocateCallback( env, index, callback, initialNotify, &HALSIM_RegisterAnalogInAccumulatorDeadbandCallback); } +/* + * Class: edu_wpi_first_hal_sim_mockdata_AnalogInDataJNI + * Method: cancelAccumulatorDeadbandCallback + * Signature: (II)V + */ JNIEXPORT void JNICALL -Java_edu_wpi_first_hal_sim_mockdata_AnalogInDataJNI_cancelAccumulatorDeadbandCallback( - JNIEnv* env, jclass, jint index, jint handle) { +Java_edu_wpi_first_hal_sim_mockdata_AnalogInDataJNI_cancelAccumulatorDeadbandCallback + (JNIEnv* env, jclass, jint index, jint handle) +{ return sim::FreeCallback(env, handle, index, &HALSIM_CancelAnalogInAccumulatorDeadbandCallback); } +/* + * Class: edu_wpi_first_hal_sim_mockdata_AnalogInDataJNI + * Method: getAccumulatorDeadband + * Signature: (I)I + */ JNIEXPORT jint JNICALL -Java_edu_wpi_first_hal_sim_mockdata_AnalogInDataJNI_getAccumulatorDeadband( - JNIEnv*, jclass, jint index) { +Java_edu_wpi_first_hal_sim_mockdata_AnalogInDataJNI_getAccumulatorDeadband + (JNIEnv*, jclass, jint index) +{ return HALSIM_GetAnalogInAccumulatorDeadband(index); } +/* + * Class: edu_wpi_first_hal_sim_mockdata_AnalogInDataJNI + * Method: setAccumulatorDeadband + * Signature: (II)V + */ JNIEXPORT void JNICALL -Java_edu_wpi_first_hal_sim_mockdata_AnalogInDataJNI_setAccumulatorDeadband( - JNIEnv*, jclass, jint index, jint value) { +Java_edu_wpi_first_hal_sim_mockdata_AnalogInDataJNI_setAccumulatorDeadband + (JNIEnv*, jclass, jint index, jint value) +{ HALSIM_SetAnalogInAccumulatorDeadband(index, value); } +/* + * Class: edu_wpi_first_hal_sim_mockdata_AnalogInDataJNI + * Method: resetData + * Signature: (I)V + */ JNIEXPORT void JNICALL -Java_edu_wpi_first_hal_sim_mockdata_AnalogInDataJNI_resetData(JNIEnv*, jclass, - jint index) { +Java_edu_wpi_first_hal_sim_mockdata_AnalogInDataJNI_resetData + (JNIEnv*, jclass, jint index) +{ HALSIM_ResetAnalogInData(index); } diff --git a/hal/src/main/native/sim/jni/AnalogOutDataJNI.cpp b/hal/src/main/native/sim/jni/AnalogOutDataJNI.cpp index d63bf6da01..3cfca65258 100644 --- a/hal/src/main/native/sim/jni/AnalogOutDataJNI.cpp +++ b/hal/src/main/native/sim/jni/AnalogOutDataJNI.cpp @@ -13,62 +13,115 @@ extern "C" { +/* + * Class: edu_wpi_first_hal_sim_mockdata_AnalogOutDataJNI + * Method: registerVoltageCallback + * Signature: (ILjava/lang/Object;Z)I + */ JNIEXPORT jint JNICALL -Java_edu_wpi_first_hal_sim_mockdata_AnalogOutDataJNI_registerVoltageCallback( - JNIEnv* env, jclass, jint index, jobject callback, jboolean initialNotify) { +Java_edu_wpi_first_hal_sim_mockdata_AnalogOutDataJNI_registerVoltageCallback + (JNIEnv* env, jclass, jint index, jobject callback, jboolean initialNotify) +{ return sim::AllocateCallback(env, index, callback, initialNotify, &HALSIM_RegisterAnalogOutVoltageCallback); } +/* + * Class: edu_wpi_first_hal_sim_mockdata_AnalogOutDataJNI + * Method: cancelVoltageCallback + * Signature: (II)V + */ JNIEXPORT void JNICALL -Java_edu_wpi_first_hal_sim_mockdata_AnalogOutDataJNI_cancelVoltageCallback( - JNIEnv* env, jclass, jint index, jint handle) { +Java_edu_wpi_first_hal_sim_mockdata_AnalogOutDataJNI_cancelVoltageCallback + (JNIEnv* env, jclass, jint index, jint handle) +{ return sim::FreeCallback(env, handle, index, &HALSIM_CancelAnalogOutVoltageCallback); } +/* + * Class: edu_wpi_first_hal_sim_mockdata_AnalogOutDataJNI + * Method: getVoltage + * Signature: (I)D + */ JNIEXPORT jdouble JNICALL -Java_edu_wpi_first_hal_sim_mockdata_AnalogOutDataJNI_getVoltage(JNIEnv*, jclass, - jint index) { +Java_edu_wpi_first_hal_sim_mockdata_AnalogOutDataJNI_getVoltage + (JNIEnv*, jclass, jint index) +{ return HALSIM_GetAnalogOutVoltage(index); } +/* + * Class: edu_wpi_first_hal_sim_mockdata_AnalogOutDataJNI + * Method: setVoltage + * Signature: (ID)V + */ JNIEXPORT void JNICALL -Java_edu_wpi_first_hal_sim_mockdata_AnalogOutDataJNI_setVoltage(JNIEnv*, jclass, - jint index, - jdouble value) { +Java_edu_wpi_first_hal_sim_mockdata_AnalogOutDataJNI_setVoltage + (JNIEnv*, jclass, jint index, jdouble value) +{ HALSIM_SetAnalogOutVoltage(index, value); } +/* + * Class: edu_wpi_first_hal_sim_mockdata_AnalogOutDataJNI + * Method: registerInitializedCallback + * Signature: (ILjava/lang/Object;Z)I + */ JNIEXPORT jint JNICALL -Java_edu_wpi_first_hal_sim_mockdata_AnalogOutDataJNI_registerInitializedCallback( - JNIEnv* env, jclass, jint index, jobject callback, jboolean initialNotify) { +Java_edu_wpi_first_hal_sim_mockdata_AnalogOutDataJNI_registerInitializedCallback + (JNIEnv* env, jclass, jint index, jobject callback, jboolean initialNotify) +{ return sim::AllocateCallback(env, index, callback, initialNotify, &HALSIM_RegisterAnalogOutInitializedCallback); } +/* + * Class: edu_wpi_first_hal_sim_mockdata_AnalogOutDataJNI + * Method: cancelInitializedCallback + * Signature: (II)V + */ JNIEXPORT void JNICALL -Java_edu_wpi_first_hal_sim_mockdata_AnalogOutDataJNI_cancelInitializedCallback( - JNIEnv* env, jclass, jint index, jint handle) { +Java_edu_wpi_first_hal_sim_mockdata_AnalogOutDataJNI_cancelInitializedCallback + (JNIEnv* env, jclass, jint index, jint handle) +{ return sim::FreeCallback(env, handle, index, &HALSIM_CancelAnalogOutInitializedCallback); } +/* + * Class: edu_wpi_first_hal_sim_mockdata_AnalogOutDataJNI + * Method: getInitialized + * Signature: (I)Z + */ JNIEXPORT jboolean JNICALL -Java_edu_wpi_first_hal_sim_mockdata_AnalogOutDataJNI_getInitialized( - JNIEnv*, jclass, jint index) { +Java_edu_wpi_first_hal_sim_mockdata_AnalogOutDataJNI_getInitialized + (JNIEnv*, jclass, jint index) +{ return HALSIM_GetAnalogOutInitialized(index); } +/* + * Class: edu_wpi_first_hal_sim_mockdata_AnalogOutDataJNI + * Method: setInitialized + * Signature: (IZ)V + */ JNIEXPORT void JNICALL -Java_edu_wpi_first_hal_sim_mockdata_AnalogOutDataJNI_setInitialized( - JNIEnv*, jclass, jint index, jboolean value) { +Java_edu_wpi_first_hal_sim_mockdata_AnalogOutDataJNI_setInitialized + (JNIEnv*, jclass, jint index, jboolean value) +{ HALSIM_SetAnalogOutInitialized(index, value); } +/* + * Class: edu_wpi_first_hal_sim_mockdata_AnalogOutDataJNI + * Method: resetData + * Signature: (I)V + */ JNIEXPORT void JNICALL -Java_edu_wpi_first_hal_sim_mockdata_AnalogOutDataJNI_resetData(JNIEnv*, jclass, - jint index) { +Java_edu_wpi_first_hal_sim_mockdata_AnalogOutDataJNI_resetData + (JNIEnv*, jclass, jint index) +{ HALSIM_ResetAnalogOutData(index); } diff --git a/hal/src/main/native/sim/jni/AnalogTriggerDataJNI.cpp b/hal/src/main/native/sim/jni/AnalogTriggerDataJNI.cpp index 842beb3957..116be9bf89 100644 --- a/hal/src/main/native/sim/jni/AnalogTriggerDataJNI.cpp +++ b/hal/src/main/native/sim/jni/AnalogTriggerDataJNI.cpp @@ -13,91 +13,168 @@ extern "C" { +/* + * Class: edu_wpi_first_hal_sim_mockdata_AnalogTriggerDataJNI + * Method: registerInitializedCallback + * Signature: (ILjava/lang/Object;Z)I + */ JNIEXPORT jint JNICALL -Java_edu_wpi_first_hal_sim_mockdata_AnalogTriggerDataJNI_registerInitializedCallback( - JNIEnv* env, jclass, jint index, jobject callback, jboolean initialNotify) { +Java_edu_wpi_first_hal_sim_mockdata_AnalogTriggerDataJNI_registerInitializedCallback + (JNIEnv* env, jclass, jint index, jobject callback, jboolean initialNotify) +{ return sim::AllocateCallback( env, index, callback, initialNotify, &HALSIM_RegisterAnalogTriggerInitializedCallback); } +/* + * Class: edu_wpi_first_hal_sim_mockdata_AnalogTriggerDataJNI + * Method: cancelInitializedCallback + * Signature: (II)V + */ JNIEXPORT void JNICALL -Java_edu_wpi_first_hal_sim_mockdata_AnalogTriggerDataJNI_cancelInitializedCallback( - JNIEnv* env, jclass, jint index, jint handle) { +Java_edu_wpi_first_hal_sim_mockdata_AnalogTriggerDataJNI_cancelInitializedCallback + (JNIEnv* env, jclass, jint index, jint handle) +{ return sim::FreeCallback(env, handle, index, &HALSIM_CancelAnalogTriggerInitializedCallback); } +/* + * Class: edu_wpi_first_hal_sim_mockdata_AnalogTriggerDataJNI + * Method: getInitialized + * Signature: (I)Z + */ JNIEXPORT jboolean JNICALL -Java_edu_wpi_first_hal_sim_mockdata_AnalogTriggerDataJNI_getInitialized( - JNIEnv*, jclass, jint index) { +Java_edu_wpi_first_hal_sim_mockdata_AnalogTriggerDataJNI_getInitialized + (JNIEnv*, jclass, jint index) +{ return HALSIM_GetAnalogTriggerInitialized(index); } +/* + * Class: edu_wpi_first_hal_sim_mockdata_AnalogTriggerDataJNI + * Method: setInitialized + * Signature: (IZ)V + */ JNIEXPORT void JNICALL -Java_edu_wpi_first_hal_sim_mockdata_AnalogTriggerDataJNI_setInitialized( - JNIEnv*, jclass, jint index, jboolean value) { +Java_edu_wpi_first_hal_sim_mockdata_AnalogTriggerDataJNI_setInitialized + (JNIEnv*, jclass, jint index, jboolean value) +{ HALSIM_SetAnalogTriggerInitialized(index, value); } +/* + * Class: edu_wpi_first_hal_sim_mockdata_AnalogTriggerDataJNI + * Method: registerTriggerLowerBoundCallback + * Signature: (ILjava/lang/Object;Z)I + */ JNIEXPORT jint JNICALL -Java_edu_wpi_first_hal_sim_mockdata_AnalogTriggerDataJNI_registerTriggerLowerBoundCallback( - JNIEnv* env, jclass, jint index, jobject callback, jboolean initialNotify) { +Java_edu_wpi_first_hal_sim_mockdata_AnalogTriggerDataJNI_registerTriggerLowerBoundCallback + (JNIEnv* env, jclass, jint index, jobject callback, jboolean initialNotify) +{ return sim::AllocateCallback( env, index, callback, initialNotify, &HALSIM_RegisterAnalogTriggerTriggerLowerBoundCallback); } +/* + * Class: edu_wpi_first_hal_sim_mockdata_AnalogTriggerDataJNI + * Method: cancelTriggerLowerBoundCallback + * Signature: (II)V + */ JNIEXPORT void JNICALL -Java_edu_wpi_first_hal_sim_mockdata_AnalogTriggerDataJNI_cancelTriggerLowerBoundCallback( - JNIEnv* env, jclass, jint index, jint handle) { +Java_edu_wpi_first_hal_sim_mockdata_AnalogTriggerDataJNI_cancelTriggerLowerBoundCallback + (JNIEnv* env, jclass, jint index, jint handle) +{ return sim::FreeCallback( env, handle, index, &HALSIM_CancelAnalogTriggerTriggerLowerBoundCallback); } +/* + * Class: edu_wpi_first_hal_sim_mockdata_AnalogTriggerDataJNI + * Method: getTriggerLowerBound + * Signature: (I)D + */ JNIEXPORT jdouble JNICALL -Java_edu_wpi_first_hal_sim_mockdata_AnalogTriggerDataJNI_getTriggerLowerBound( - JNIEnv*, jclass, jint index) { +Java_edu_wpi_first_hal_sim_mockdata_AnalogTriggerDataJNI_getTriggerLowerBound + (JNIEnv*, jclass, jint index) +{ return HALSIM_GetAnalogTriggerTriggerLowerBound(index); } +/* + * Class: edu_wpi_first_hal_sim_mockdata_AnalogTriggerDataJNI + * Method: setTriggerLowerBound + * Signature: (ID)V + */ JNIEXPORT void JNICALL -Java_edu_wpi_first_hal_sim_mockdata_AnalogTriggerDataJNI_setTriggerLowerBound( - JNIEnv*, jclass, jint index, jdouble value) { +Java_edu_wpi_first_hal_sim_mockdata_AnalogTriggerDataJNI_setTriggerLowerBound + (JNIEnv*, jclass, jint index, jdouble value) +{ HALSIM_SetAnalogTriggerTriggerLowerBound(index, value); } +/* + * Class: edu_wpi_first_hal_sim_mockdata_AnalogTriggerDataJNI + * Method: registerTriggerUpperBoundCallback + * Signature: (ILjava/lang/Object;Z)I + */ JNIEXPORT jint JNICALL -Java_edu_wpi_first_hal_sim_mockdata_AnalogTriggerDataJNI_registerTriggerUpperBoundCallback( - JNIEnv* env, jclass, jint index, jobject callback, jboolean initialNotify) { +Java_edu_wpi_first_hal_sim_mockdata_AnalogTriggerDataJNI_registerTriggerUpperBoundCallback + (JNIEnv* env, jclass, jint index, jobject callback, jboolean initialNotify) +{ return sim::AllocateCallback( env, index, callback, initialNotify, &HALSIM_RegisterAnalogTriggerTriggerUpperBoundCallback); } +/* + * Class: edu_wpi_first_hal_sim_mockdata_AnalogTriggerDataJNI + * Method: cancelTriggerUpperBoundCallback + * Signature: (II)V + */ JNIEXPORT void JNICALL -Java_edu_wpi_first_hal_sim_mockdata_AnalogTriggerDataJNI_cancelTriggerUpperBoundCallback( - JNIEnv* env, jclass, jint index, jint handle) { +Java_edu_wpi_first_hal_sim_mockdata_AnalogTriggerDataJNI_cancelTriggerUpperBoundCallback + (JNIEnv* env, jclass, jint index, jint handle) +{ return sim::FreeCallback( env, handle, index, &HALSIM_CancelAnalogTriggerTriggerUpperBoundCallback); } +/* + * Class: edu_wpi_first_hal_sim_mockdata_AnalogTriggerDataJNI + * Method: getTriggerUpperBound + * Signature: (I)D + */ JNIEXPORT jdouble JNICALL -Java_edu_wpi_first_hal_sim_mockdata_AnalogTriggerDataJNI_getTriggerUpperBound( - JNIEnv*, jclass, jint index) { +Java_edu_wpi_first_hal_sim_mockdata_AnalogTriggerDataJNI_getTriggerUpperBound + (JNIEnv*, jclass, jint index) +{ return HALSIM_GetAnalogTriggerTriggerUpperBound(index); } +/* + * Class: edu_wpi_first_hal_sim_mockdata_AnalogTriggerDataJNI + * Method: setTriggerUpperBound + * Signature: (ID)V + */ JNIEXPORT void JNICALL -Java_edu_wpi_first_hal_sim_mockdata_AnalogTriggerDataJNI_setTriggerUpperBound( - JNIEnv*, jclass, jint index, jdouble value) { +Java_edu_wpi_first_hal_sim_mockdata_AnalogTriggerDataJNI_setTriggerUpperBound + (JNIEnv*, jclass, jint index, jdouble value) +{ HALSIM_SetAnalogTriggerTriggerUpperBound(index, value); } +/* + * Class: edu_wpi_first_hal_sim_mockdata_AnalogTriggerDataJNI + * Method: resetData + * Signature: (I)V + */ JNIEXPORT void JNICALL -Java_edu_wpi_first_hal_sim_mockdata_AnalogTriggerDataJNI_resetData(JNIEnv*, - jclass, - jint index) { +Java_edu_wpi_first_hal_sim_mockdata_AnalogTriggerDataJNI_resetData + (JNIEnv*, jclass, jint index) +{ HALSIM_ResetAnalogTriggerData(index); } diff --git a/hal/src/main/native/sim/jni/BufferCallbackStore.cpp b/hal/src/main/native/sim/jni/BufferCallbackStore.cpp index 917dac56a4..37318011c5 100644 --- a/hal/src/main/native/sim/jni/BufferCallbackStore.cpp +++ b/hal/src/main/native/sim/jni/BufferCallbackStore.cpp @@ -8,6 +8,7 @@ #include "BufferCallbackStore.h" #include + #include #include "HAL/Types.h" diff --git a/hal/src/main/native/sim/jni/BufferCallbackStore.h b/hal/src/main/native/sim/jni/BufferCallbackStore.h index 41b451de0b..d3108fa58b 100644 --- a/hal/src/main/native/sim/jni/BufferCallbackStore.h +++ b/hal/src/main/native/sim/jni/BufferCallbackStore.h @@ -8,6 +8,7 @@ #pragma once #include + #include #include "HAL/Types.h" diff --git a/hal/src/main/native/sim/jni/CallbackStore.cpp b/hal/src/main/native/sim/jni/CallbackStore.cpp index 1e51c0b0d9..788449f9cb 100644 --- a/hal/src/main/native/sim/jni/CallbackStore.cpp +++ b/hal/src/main/native/sim/jni/CallbackStore.cpp @@ -8,6 +8,7 @@ #include "CallbackStore.h" #include + #include #include "HAL/Types.h" diff --git a/hal/src/main/native/sim/jni/CallbackStore.h b/hal/src/main/native/sim/jni/CallbackStore.h index 80cfc88caf..a0c547d161 100644 --- a/hal/src/main/native/sim/jni/CallbackStore.h +++ b/hal/src/main/native/sim/jni/CallbackStore.h @@ -8,6 +8,7 @@ #pragma once #include + #include #include "HAL/Types.h" diff --git a/hal/src/main/native/sim/jni/ConstBufferCallbackStore.cpp b/hal/src/main/native/sim/jni/ConstBufferCallbackStore.cpp index f3d47cf798..677276971e 100644 --- a/hal/src/main/native/sim/jni/ConstBufferCallbackStore.cpp +++ b/hal/src/main/native/sim/jni/ConstBufferCallbackStore.cpp @@ -8,6 +8,7 @@ #include "ConstBufferCallbackStore.h" #include + #include #include "HAL/Types.h" diff --git a/hal/src/main/native/sim/jni/ConstBufferCallbackStore.h b/hal/src/main/native/sim/jni/ConstBufferCallbackStore.h index e41ba33012..340e280f3c 100644 --- a/hal/src/main/native/sim/jni/ConstBufferCallbackStore.h +++ b/hal/src/main/native/sim/jni/ConstBufferCallbackStore.h @@ -8,6 +8,7 @@ #pragma once #include + #include #include "HAL/Types.h" diff --git a/hal/src/main/native/sim/jni/DIODataJNI.cpp b/hal/src/main/native/sim/jni/DIODataJNI.cpp index 5f198e5f0a..b9e6c0ac6e 100644 --- a/hal/src/main/native/sim/jni/DIODataJNI.cpp +++ b/hal/src/main/native/sim/jni/DIODataJNI.cpp @@ -13,140 +13,264 @@ extern "C" { +/* + * Class: edu_wpi_first_hal_sim_mockdata_DIODataJNI + * Method: registerInitializedCallback + * Signature: (ILjava/lang/Object;Z)I + */ JNIEXPORT jint JNICALL -Java_edu_wpi_first_hal_sim_mockdata_DIODataJNI_registerInitializedCallback( - JNIEnv* env, jclass, jint index, jobject callback, jboolean initialNotify) { +Java_edu_wpi_first_hal_sim_mockdata_DIODataJNI_registerInitializedCallback + (JNIEnv* env, jclass, jint index, jobject callback, jboolean initialNotify) +{ return sim::AllocateCallback(env, index, callback, initialNotify, &HALSIM_RegisterDIOInitializedCallback); } +/* + * Class: edu_wpi_first_hal_sim_mockdata_DIODataJNI + * Method: cancelInitializedCallback + * Signature: (II)V + */ JNIEXPORT void JNICALL -Java_edu_wpi_first_hal_sim_mockdata_DIODataJNI_cancelInitializedCallback( - JNIEnv* env, jclass, jint index, jint handle) { +Java_edu_wpi_first_hal_sim_mockdata_DIODataJNI_cancelInitializedCallback + (JNIEnv* env, jclass, jint index, jint handle) +{ return sim::FreeCallback(env, handle, index, &HALSIM_CancelDIOInitializedCallback); } +/* + * Class: edu_wpi_first_hal_sim_mockdata_DIODataJNI + * Method: getInitialized + * Signature: (I)Z + */ JNIEXPORT jboolean JNICALL -Java_edu_wpi_first_hal_sim_mockdata_DIODataJNI_getInitialized(JNIEnv*, jclass, - jint index) { +Java_edu_wpi_first_hal_sim_mockdata_DIODataJNI_getInitialized + (JNIEnv*, jclass, jint index) +{ return HALSIM_GetDIOInitialized(index); } +/* + * Class: edu_wpi_first_hal_sim_mockdata_DIODataJNI + * Method: setInitialized + * Signature: (IZ)V + */ JNIEXPORT void JNICALL -Java_edu_wpi_first_hal_sim_mockdata_DIODataJNI_setInitialized(JNIEnv*, jclass, - jint index, - jboolean value) { +Java_edu_wpi_first_hal_sim_mockdata_DIODataJNI_setInitialized + (JNIEnv*, jclass, jint index, jboolean value) +{ HALSIM_SetDIOInitialized(index, value); } +/* + * Class: edu_wpi_first_hal_sim_mockdata_DIODataJNI + * Method: registerValueCallback + * Signature: (ILjava/lang/Object;Z)I + */ JNIEXPORT jint JNICALL -Java_edu_wpi_first_hal_sim_mockdata_DIODataJNI_registerValueCallback( - JNIEnv* env, jclass, jint index, jobject callback, jboolean initialNotify) { +Java_edu_wpi_first_hal_sim_mockdata_DIODataJNI_registerValueCallback + (JNIEnv* env, jclass, jint index, jobject callback, jboolean initialNotify) +{ return sim::AllocateCallback(env, index, callback, initialNotify, &HALSIM_RegisterDIOValueCallback); } +/* + * Class: edu_wpi_first_hal_sim_mockdata_DIODataJNI + * Method: cancelValueCallback + * Signature: (II)V + */ JNIEXPORT void JNICALL -Java_edu_wpi_first_hal_sim_mockdata_DIODataJNI_cancelValueCallback( - JNIEnv* env, jclass, jint index, jint handle) { +Java_edu_wpi_first_hal_sim_mockdata_DIODataJNI_cancelValueCallback + (JNIEnv* env, jclass, jint index, jint handle) +{ return sim::FreeCallback(env, handle, index, &HALSIM_CancelDIOValueCallback); } +/* + * Class: edu_wpi_first_hal_sim_mockdata_DIODataJNI + * Method: getValue + * Signature: (I)Z + */ JNIEXPORT jboolean JNICALL -Java_edu_wpi_first_hal_sim_mockdata_DIODataJNI_getValue(JNIEnv*, jclass, - jint index) { +Java_edu_wpi_first_hal_sim_mockdata_DIODataJNI_getValue + (JNIEnv*, jclass, jint index) +{ return HALSIM_GetDIOValue(index); } -JNIEXPORT void JNICALL Java_edu_wpi_first_hal_sim_mockdata_DIODataJNI_setValue( - JNIEnv*, jclass, jint index, jboolean value) { +/* + * Class: edu_wpi_first_hal_sim_mockdata_DIODataJNI + * Method: setValue + * Signature: (IZ)V + */ +JNIEXPORT void JNICALL +Java_edu_wpi_first_hal_sim_mockdata_DIODataJNI_setValue + (JNIEnv*, jclass, jint index, jboolean value) +{ HALSIM_SetDIOValue(index, value); } +/* + * Class: edu_wpi_first_hal_sim_mockdata_DIODataJNI + * Method: registerPulseLengthCallback + * Signature: (ILjava/lang/Object;Z)I + */ JNIEXPORT jint JNICALL -Java_edu_wpi_first_hal_sim_mockdata_DIODataJNI_registerPulseLengthCallback( - JNIEnv* env, jclass, jint index, jobject callback, jboolean initialNotify) { +Java_edu_wpi_first_hal_sim_mockdata_DIODataJNI_registerPulseLengthCallback + (JNIEnv* env, jclass, jint index, jobject callback, jboolean initialNotify) +{ return sim::AllocateCallback(env, index, callback, initialNotify, &HALSIM_RegisterDIOPulseLengthCallback); } +/* + * Class: edu_wpi_first_hal_sim_mockdata_DIODataJNI + * Method: cancelPulseLengthCallback + * Signature: (II)V + */ JNIEXPORT void JNICALL -Java_edu_wpi_first_hal_sim_mockdata_DIODataJNI_cancelPulseLengthCallback( - JNIEnv* env, jclass, jint index, jint handle) { +Java_edu_wpi_first_hal_sim_mockdata_DIODataJNI_cancelPulseLengthCallback + (JNIEnv* env, jclass, jint index, jint handle) +{ return sim::FreeCallback(env, handle, index, &HALSIM_CancelDIOPulseLengthCallback); } +/* + * Class: edu_wpi_first_hal_sim_mockdata_DIODataJNI + * Method: getPulseLength + * Signature: (I)D + */ JNIEXPORT jdouble JNICALL -Java_edu_wpi_first_hal_sim_mockdata_DIODataJNI_getPulseLength(JNIEnv*, jclass, - jint index) { +Java_edu_wpi_first_hal_sim_mockdata_DIODataJNI_getPulseLength + (JNIEnv*, jclass, jint index) +{ return HALSIM_GetDIOPulseLength(index); } +/* + * Class: edu_wpi_first_hal_sim_mockdata_DIODataJNI + * Method: setPulseLength + * Signature: (ID)V + */ JNIEXPORT void JNICALL -Java_edu_wpi_first_hal_sim_mockdata_DIODataJNI_setPulseLength(JNIEnv*, jclass, - jint index, - jdouble value) { +Java_edu_wpi_first_hal_sim_mockdata_DIODataJNI_setPulseLength + (JNIEnv*, jclass, jint index, jdouble value) +{ HALSIM_SetDIOPulseLength(index, value); } +/* + * Class: edu_wpi_first_hal_sim_mockdata_DIODataJNI + * Method: registerIsInputCallback + * Signature: (ILjava/lang/Object;Z)I + */ JNIEXPORT jint JNICALL -Java_edu_wpi_first_hal_sim_mockdata_DIODataJNI_registerIsInputCallback( - JNIEnv* env, jclass, jint index, jobject callback, jboolean initialNotify) { +Java_edu_wpi_first_hal_sim_mockdata_DIODataJNI_registerIsInputCallback + (JNIEnv* env, jclass, jint index, jobject callback, jboolean initialNotify) +{ return sim::AllocateCallback(env, index, callback, initialNotify, &HALSIM_RegisterDIOIsInputCallback); } +/* + * Class: edu_wpi_first_hal_sim_mockdata_DIODataJNI + * Method: cancelIsInputCallback + * Signature: (II)V + */ JNIEXPORT void JNICALL -Java_edu_wpi_first_hal_sim_mockdata_DIODataJNI_cancelIsInputCallback( - JNIEnv* env, jclass, jint index, jint handle) { +Java_edu_wpi_first_hal_sim_mockdata_DIODataJNI_cancelIsInputCallback + (JNIEnv* env, jclass, jint index, jint handle) +{ return sim::FreeCallback(env, handle, index, &HALSIM_CancelDIOIsInputCallback); } +/* + * Class: edu_wpi_first_hal_sim_mockdata_DIODataJNI + * Method: getIsInput + * Signature: (I)Z + */ JNIEXPORT jboolean JNICALL -Java_edu_wpi_first_hal_sim_mockdata_DIODataJNI_getIsInput(JNIEnv*, jclass, - jint index) { +Java_edu_wpi_first_hal_sim_mockdata_DIODataJNI_getIsInput + (JNIEnv*, jclass, jint index) +{ return HALSIM_GetDIOIsInput(index); } +/* + * Class: edu_wpi_first_hal_sim_mockdata_DIODataJNI + * Method: setIsInput + * Signature: (IZ)V + */ JNIEXPORT void JNICALL -Java_edu_wpi_first_hal_sim_mockdata_DIODataJNI_setIsInput(JNIEnv*, jclass, - jint index, - jboolean value) { +Java_edu_wpi_first_hal_sim_mockdata_DIODataJNI_setIsInput + (JNIEnv*, jclass, jint index, jboolean value) +{ HALSIM_SetDIOIsInput(index, value); } +/* + * Class: edu_wpi_first_hal_sim_mockdata_DIODataJNI + * Method: registerFilterIndexCallback + * Signature: (ILjava/lang/Object;Z)I + */ JNIEXPORT jint JNICALL -Java_edu_wpi_first_hal_sim_mockdata_DIODataJNI_registerFilterIndexCallback( - JNIEnv* env, jclass, jint index, jobject callback, jboolean initialNotify) { +Java_edu_wpi_first_hal_sim_mockdata_DIODataJNI_registerFilterIndexCallback + (JNIEnv* env, jclass, jint index, jobject callback, jboolean initialNotify) +{ return sim::AllocateCallback(env, index, callback, initialNotify, &HALSIM_RegisterDIOFilterIndexCallback); } +/* + * Class: edu_wpi_first_hal_sim_mockdata_DIODataJNI + * Method: cancelFilterIndexCallback + * Signature: (II)V + */ JNIEXPORT void JNICALL -Java_edu_wpi_first_hal_sim_mockdata_DIODataJNI_cancelFilterIndexCallback( - JNIEnv* env, jclass, jint index, jint handle) { +Java_edu_wpi_first_hal_sim_mockdata_DIODataJNI_cancelFilterIndexCallback + (JNIEnv* env, jclass, jint index, jint handle) +{ return sim::FreeCallback(env, handle, index, &HALSIM_CancelDIOFilterIndexCallback); } +/* + * Class: edu_wpi_first_hal_sim_mockdata_DIODataJNI + * Method: getFilterIndex + * Signature: (I)I + */ JNIEXPORT jint JNICALL -Java_edu_wpi_first_hal_sim_mockdata_DIODataJNI_getFilterIndex(JNIEnv*, jclass, - jint index) { +Java_edu_wpi_first_hal_sim_mockdata_DIODataJNI_getFilterIndex + (JNIEnv*, jclass, jint index) +{ return HALSIM_GetDIOFilterIndex(index); } +/* + * Class: edu_wpi_first_hal_sim_mockdata_DIODataJNI + * Method: setFilterIndex + * Signature: (II)V + */ JNIEXPORT void JNICALL -Java_edu_wpi_first_hal_sim_mockdata_DIODataJNI_setFilterIndex(JNIEnv*, jclass, - jint index, - jint value) { +Java_edu_wpi_first_hal_sim_mockdata_DIODataJNI_setFilterIndex + (JNIEnv*, jclass, jint index, jint value) +{ HALSIM_SetDIOFilterIndex(index, value); } -JNIEXPORT void JNICALL Java_edu_wpi_first_hal_sim_mockdata_DIODataJNI_resetData( - JNIEnv*, jclass, jint index) { +/* + * Class: edu_wpi_first_hal_sim_mockdata_DIODataJNI + * Method: resetData + * Signature: (I)V + */ +JNIEXPORT void JNICALL +Java_edu_wpi_first_hal_sim_mockdata_DIODataJNI_resetData + (JNIEnv*, jclass, jint index) +{ HALSIM_ResetDIOData(index); } diff --git a/hal/src/main/native/sim/jni/DigitalPWMDataJNI.cpp b/hal/src/main/native/sim/jni/DigitalPWMDataJNI.cpp index 6903e12981..ade607355c 100644 --- a/hal/src/main/native/sim/jni/DigitalPWMDataJNI.cpp +++ b/hal/src/main/native/sim/jni/DigitalPWMDataJNI.cpp @@ -13,89 +13,165 @@ extern "C" { +/* + * Class: edu_wpi_first_hal_sim_mockdata_DigitalPWMDataJNI + * Method: registerInitializedCallback + * Signature: (ILjava/lang/Object;Z)I + */ JNIEXPORT jint JNICALL -Java_edu_wpi_first_hal_sim_mockdata_DigitalPWMDataJNI_registerInitializedCallback( - JNIEnv* env, jclass, jint index, jobject callback, jboolean initialNotify) { +Java_edu_wpi_first_hal_sim_mockdata_DigitalPWMDataJNI_registerInitializedCallback + (JNIEnv* env, jclass, jint index, jobject callback, jboolean initialNotify) +{ return sim::AllocateCallback(env, index, callback, initialNotify, &HALSIM_RegisterDigitalPWMInitializedCallback); } +/* + * Class: edu_wpi_first_hal_sim_mockdata_DigitalPWMDataJNI + * Method: cancelInitializedCallback + * Signature: (II)V + */ JNIEXPORT void JNICALL -Java_edu_wpi_first_hal_sim_mockdata_DigitalPWMDataJNI_cancelInitializedCallback( - JNIEnv* env, jclass, jint index, jint handle) { +Java_edu_wpi_first_hal_sim_mockdata_DigitalPWMDataJNI_cancelInitializedCallback + (JNIEnv* env, jclass, jint index, jint handle) +{ return sim::FreeCallback(env, handle, index, &HALSIM_CancelDigitalPWMInitializedCallback); } +/* + * Class: edu_wpi_first_hal_sim_mockdata_DigitalPWMDataJNI + * Method: getInitialized + * Signature: (I)Z + */ JNIEXPORT jboolean JNICALL -Java_edu_wpi_first_hal_sim_mockdata_DigitalPWMDataJNI_getInitialized( - JNIEnv*, jclass, jint index) { +Java_edu_wpi_first_hal_sim_mockdata_DigitalPWMDataJNI_getInitialized + (JNIEnv*, jclass, jint index) +{ return HALSIM_GetDigitalPWMInitialized(index); } +/* + * Class: edu_wpi_first_hal_sim_mockdata_DigitalPWMDataJNI + * Method: setInitialized + * Signature: (IZ)V + */ JNIEXPORT void JNICALL -Java_edu_wpi_first_hal_sim_mockdata_DigitalPWMDataJNI_setInitialized( - JNIEnv*, jclass, jint index, jboolean value) { +Java_edu_wpi_first_hal_sim_mockdata_DigitalPWMDataJNI_setInitialized + (JNIEnv*, jclass, jint index, jboolean value) +{ HALSIM_SetDigitalPWMInitialized(index, value); } +/* + * Class: edu_wpi_first_hal_sim_mockdata_DigitalPWMDataJNI + * Method: registerDutyCycleCallback + * Signature: (ILjava/lang/Object;Z)I + */ JNIEXPORT jint JNICALL -Java_edu_wpi_first_hal_sim_mockdata_DigitalPWMDataJNI_registerDutyCycleCallback( - JNIEnv* env, jclass, jint index, jobject callback, jboolean initialNotify) { +Java_edu_wpi_first_hal_sim_mockdata_DigitalPWMDataJNI_registerDutyCycleCallback + (JNIEnv* env, jclass, jint index, jobject callback, jboolean initialNotify) +{ return sim::AllocateCallback(env, index, callback, initialNotify, &HALSIM_RegisterDigitalPWMDutyCycleCallback); } +/* + * Class: edu_wpi_first_hal_sim_mockdata_DigitalPWMDataJNI + * Method: cancelDutyCycleCallback + * Signature: (II)V + */ JNIEXPORT void JNICALL -Java_edu_wpi_first_hal_sim_mockdata_DigitalPWMDataJNI_cancelDutyCycleCallback( - JNIEnv* env, jclass, jint index, jint handle) { +Java_edu_wpi_first_hal_sim_mockdata_DigitalPWMDataJNI_cancelDutyCycleCallback + (JNIEnv* env, jclass, jint index, jint handle) +{ return sim::FreeCallback(env, handle, index, &HALSIM_CancelDigitalPWMDutyCycleCallback); } +/* + * Class: edu_wpi_first_hal_sim_mockdata_DigitalPWMDataJNI + * Method: getDutyCycle + * Signature: (I)D + */ JNIEXPORT jdouble JNICALL -Java_edu_wpi_first_hal_sim_mockdata_DigitalPWMDataJNI_getDutyCycle(JNIEnv*, - jclass, - jint index) { +Java_edu_wpi_first_hal_sim_mockdata_DigitalPWMDataJNI_getDutyCycle + (JNIEnv*, jclass, jint index) +{ return HALSIM_GetDigitalPWMDutyCycle(index); } +/* + * Class: edu_wpi_first_hal_sim_mockdata_DigitalPWMDataJNI + * Method: setDutyCycle + * Signature: (ID)V + */ JNIEXPORT void JNICALL -Java_edu_wpi_first_hal_sim_mockdata_DigitalPWMDataJNI_setDutyCycle( - JNIEnv*, jclass, jint index, jdouble value) { +Java_edu_wpi_first_hal_sim_mockdata_DigitalPWMDataJNI_setDutyCycle + (JNIEnv*, jclass, jint index, jdouble value) +{ HALSIM_SetDigitalPWMDutyCycle(index, value); } +/* + * Class: edu_wpi_first_hal_sim_mockdata_DigitalPWMDataJNI + * Method: registerPinCallback + * Signature: (ILjava/lang/Object;Z)I + */ JNIEXPORT jint JNICALL -Java_edu_wpi_first_hal_sim_mockdata_DigitalPWMDataJNI_registerPinCallback( - JNIEnv* env, jclass, jint index, jobject callback, jboolean initialNotify) { +Java_edu_wpi_first_hal_sim_mockdata_DigitalPWMDataJNI_registerPinCallback + (JNIEnv* env, jclass, jint index, jobject callback, jboolean initialNotify) +{ return sim::AllocateCallback(env, index, callback, initialNotify, &HALSIM_RegisterDigitalPWMPinCallback); } +/* + * Class: edu_wpi_first_hal_sim_mockdata_DigitalPWMDataJNI + * Method: cancelPinCallback + * Signature: (II)V + */ JNIEXPORT void JNICALL -Java_edu_wpi_first_hal_sim_mockdata_DigitalPWMDataJNI_cancelPinCallback( - JNIEnv* env, jclass, jint index, jint handle) { +Java_edu_wpi_first_hal_sim_mockdata_DigitalPWMDataJNI_cancelPinCallback + (JNIEnv* env, jclass, jint index, jint handle) +{ return sim::FreeCallback(env, handle, index, &HALSIM_CancelDigitalPWMPinCallback); } +/* + * Class: edu_wpi_first_hal_sim_mockdata_DigitalPWMDataJNI + * Method: getPin + * Signature: (I)I + */ JNIEXPORT jint JNICALL -Java_edu_wpi_first_hal_sim_mockdata_DigitalPWMDataJNI_getPin(JNIEnv*, jclass, - jint index) { +Java_edu_wpi_first_hal_sim_mockdata_DigitalPWMDataJNI_getPin + (JNIEnv*, jclass, jint index) +{ return HALSIM_GetDigitalPWMPin(index); } +/* + * Class: edu_wpi_first_hal_sim_mockdata_DigitalPWMDataJNI + * Method: setPin + * Signature: (II)V + */ JNIEXPORT void JNICALL -Java_edu_wpi_first_hal_sim_mockdata_DigitalPWMDataJNI_setPin(JNIEnv*, jclass, - jint index, - jint value) { +Java_edu_wpi_first_hal_sim_mockdata_DigitalPWMDataJNI_setPin + (JNIEnv*, jclass, jint index, jint value) +{ HALSIM_SetDigitalPWMPin(index, value); } +/* + * Class: edu_wpi_first_hal_sim_mockdata_DigitalPWMDataJNI + * Method: resetData + * Signature: (I)V + */ JNIEXPORT void JNICALL -Java_edu_wpi_first_hal_sim_mockdata_DigitalPWMDataJNI_resetData(JNIEnv*, jclass, - jint index) { +Java_edu_wpi_first_hal_sim_mockdata_DigitalPWMDataJNI_resetData + (JNIEnv*, jclass, jint index) +{ HALSIM_ResetDigitalPWMData(index); } diff --git a/hal/src/main/native/sim/jni/DriverStationDataJNI.cpp b/hal/src/main/native/sim/jni/DriverStationDataJNI.cpp index 90a5cf9abd..12292e7b14 100644 --- a/hal/src/main/native/sim/jni/DriverStationDataJNI.cpp +++ b/hal/src/main/native/sim/jni/DriverStationDataJNI.cpp @@ -13,174 +13,319 @@ extern "C" { +/* + * Class: edu_wpi_first_hal_sim_mockdata_DriverStationDataJNI + * Method: registerEnabledCallback + * Signature: (Ljava/lang/Object;Z)I + */ JNIEXPORT jint JNICALL -Java_edu_wpi_first_hal_sim_mockdata_DriverStationDataJNI_registerEnabledCallback( - JNIEnv* env, jclass, jobject callback, jboolean initialNotify) { +Java_edu_wpi_first_hal_sim_mockdata_DriverStationDataJNI_registerEnabledCallback + (JNIEnv* env, jclass, jobject callback, jboolean initialNotify) +{ return sim::AllocateCallbackNoIndex( env, callback, initialNotify, &HALSIM_RegisterDriverStationEnabledCallback); } +/* + * Class: edu_wpi_first_hal_sim_mockdata_DriverStationDataJNI + * Method: cancelEnabledCallback + * Signature: (I)V + */ JNIEXPORT void JNICALL -Java_edu_wpi_first_hal_sim_mockdata_DriverStationDataJNI_cancelEnabledCallback( - JNIEnv* env, jclass, jint handle) { +Java_edu_wpi_first_hal_sim_mockdata_DriverStationDataJNI_cancelEnabledCallback + (JNIEnv* env, jclass, jint handle) +{ return sim::FreeCallbackNoIndex(env, handle, &HALSIM_CancelDriverStationEnabledCallback); } +/* + * Class: edu_wpi_first_hal_sim_mockdata_DriverStationDataJNI + * Method: getEnabled + * Signature: ()Z + */ JNIEXPORT jboolean JNICALL -Java_edu_wpi_first_hal_sim_mockdata_DriverStationDataJNI_getEnabled(JNIEnv*, - jclass) { +Java_edu_wpi_first_hal_sim_mockdata_DriverStationDataJNI_getEnabled + (JNIEnv*, jclass) +{ return HALSIM_GetDriverStationEnabled(); } +/* + * Class: edu_wpi_first_hal_sim_mockdata_DriverStationDataJNI + * Method: setEnabled + * Signature: (Z)V + */ JNIEXPORT void JNICALL -Java_edu_wpi_first_hal_sim_mockdata_DriverStationDataJNI_setEnabled( - JNIEnv*, jclass, jboolean value) { +Java_edu_wpi_first_hal_sim_mockdata_DriverStationDataJNI_setEnabled + (JNIEnv*, jclass, jboolean value) +{ HALSIM_SetDriverStationEnabled(value); } +/* + * Class: edu_wpi_first_hal_sim_mockdata_DriverStationDataJNI + * Method: registerAutonomousCallback + * Signature: (Ljava/lang/Object;Z)I + */ JNIEXPORT jint JNICALL -Java_edu_wpi_first_hal_sim_mockdata_DriverStationDataJNI_registerAutonomousCallback( - JNIEnv* env, jclass, jobject callback, jboolean initialNotify) { +Java_edu_wpi_first_hal_sim_mockdata_DriverStationDataJNI_registerAutonomousCallback + (JNIEnv* env, jclass, jobject callback, jboolean initialNotify) +{ return sim::AllocateCallbackNoIndex( env, callback, initialNotify, &HALSIM_RegisterDriverStationAutonomousCallback); } +/* + * Class: edu_wpi_first_hal_sim_mockdata_DriverStationDataJNI + * Method: cancelAutonomousCallback + * Signature: (I)V + */ JNIEXPORT void JNICALL -Java_edu_wpi_first_hal_sim_mockdata_DriverStationDataJNI_cancelAutonomousCallback( - JNIEnv* env, jclass, jint handle) { +Java_edu_wpi_first_hal_sim_mockdata_DriverStationDataJNI_cancelAutonomousCallback + (JNIEnv* env, jclass, jint handle) +{ return sim::FreeCallbackNoIndex( env, handle, &HALSIM_CancelDriverStationAutonomousCallback); } +/* + * Class: edu_wpi_first_hal_sim_mockdata_DriverStationDataJNI + * Method: getAutonomous + * Signature: ()Z + */ JNIEXPORT jboolean JNICALL -Java_edu_wpi_first_hal_sim_mockdata_DriverStationDataJNI_getAutonomous(JNIEnv*, - jclass) { +Java_edu_wpi_first_hal_sim_mockdata_DriverStationDataJNI_getAutonomous + (JNIEnv*, jclass) +{ return HALSIM_GetDriverStationAutonomous(); } +/* + * Class: edu_wpi_first_hal_sim_mockdata_DriverStationDataJNI + * Method: setAutonomous + * Signature: (Z)V + */ JNIEXPORT void JNICALL -Java_edu_wpi_first_hal_sim_mockdata_DriverStationDataJNI_setAutonomous( - JNIEnv*, jclass, jboolean value) { +Java_edu_wpi_first_hal_sim_mockdata_DriverStationDataJNI_setAutonomous + (JNIEnv*, jclass, jboolean value) +{ HALSIM_SetDriverStationAutonomous(value); } +/* + * Class: edu_wpi_first_hal_sim_mockdata_DriverStationDataJNI + * Method: registerTestCallback + * Signature: (Ljava/lang/Object;Z)I + */ JNIEXPORT jint JNICALL -Java_edu_wpi_first_hal_sim_mockdata_DriverStationDataJNI_registerTestCallback( - JNIEnv* env, jclass, jobject callback, jboolean initialNotify) { +Java_edu_wpi_first_hal_sim_mockdata_DriverStationDataJNI_registerTestCallback + (JNIEnv* env, jclass, jobject callback, jboolean initialNotify) +{ return sim::AllocateCallbackNoIndex( env, callback, initialNotify, &HALSIM_RegisterDriverStationTestCallback); } +/* + * Class: edu_wpi_first_hal_sim_mockdata_DriverStationDataJNI + * Method: cancelTestCallback + * Signature: (I)V + */ JNIEXPORT void JNICALL -Java_edu_wpi_first_hal_sim_mockdata_DriverStationDataJNI_cancelTestCallback( - JNIEnv* env, jclass, jint handle) { +Java_edu_wpi_first_hal_sim_mockdata_DriverStationDataJNI_cancelTestCallback + (JNIEnv* env, jclass, jint handle) +{ return sim::FreeCallbackNoIndex(env, handle, &HALSIM_CancelDriverStationTestCallback); } +/* + * Class: edu_wpi_first_hal_sim_mockdata_DriverStationDataJNI + * Method: getTest + * Signature: ()Z + */ JNIEXPORT jboolean JNICALL -Java_edu_wpi_first_hal_sim_mockdata_DriverStationDataJNI_getTest(JNIEnv*, - jclass) { +Java_edu_wpi_first_hal_sim_mockdata_DriverStationDataJNI_getTest + (JNIEnv*, jclass) +{ return HALSIM_GetDriverStationTest(); } +/* + * Class: edu_wpi_first_hal_sim_mockdata_DriverStationDataJNI + * Method: setTest + * Signature: (Z)V + */ JNIEXPORT void JNICALL -Java_edu_wpi_first_hal_sim_mockdata_DriverStationDataJNI_setTest( - JNIEnv*, jclass, jboolean value) { +Java_edu_wpi_first_hal_sim_mockdata_DriverStationDataJNI_setTest + (JNIEnv*, jclass, jboolean value) +{ HALSIM_SetDriverStationTest(value); } +/* + * Class: edu_wpi_first_hal_sim_mockdata_DriverStationDataJNI + * Method: registerEStopCallback + * Signature: (Ljava/lang/Object;Z)I + */ JNIEXPORT jint JNICALL -Java_edu_wpi_first_hal_sim_mockdata_DriverStationDataJNI_registerEStopCallback( - JNIEnv* env, jclass, jobject callback, jboolean initialNotify) { +Java_edu_wpi_first_hal_sim_mockdata_DriverStationDataJNI_registerEStopCallback + (JNIEnv* env, jclass, jobject callback, jboolean initialNotify) +{ return sim::AllocateCallbackNoIndex( env, callback, initialNotify, &HALSIM_RegisterDriverStationEStopCallback); } +/* + * Class: edu_wpi_first_hal_sim_mockdata_DriverStationDataJNI + * Method: cancelEStopCallback + * Signature: (I)V + */ JNIEXPORT void JNICALL -Java_edu_wpi_first_hal_sim_mockdata_DriverStationDataJNI_cancelEStopCallback( - JNIEnv* env, jclass, jint handle) { +Java_edu_wpi_first_hal_sim_mockdata_DriverStationDataJNI_cancelEStopCallback + (JNIEnv* env, jclass, jint handle) +{ return sim::FreeCallbackNoIndex(env, handle, &HALSIM_CancelDriverStationEStopCallback); } +/* + * Class: edu_wpi_first_hal_sim_mockdata_DriverStationDataJNI + * Method: getEStop + * Signature: ()Z + */ JNIEXPORT jboolean JNICALL -Java_edu_wpi_first_hal_sim_mockdata_DriverStationDataJNI_getEStop(JNIEnv*, - jclass) { +Java_edu_wpi_first_hal_sim_mockdata_DriverStationDataJNI_getEStop + (JNIEnv*, jclass) +{ return HALSIM_GetDriverStationEStop(); } +/* + * Class: edu_wpi_first_hal_sim_mockdata_DriverStationDataJNI + * Method: setEStop + * Signature: (Z)V + */ JNIEXPORT void JNICALL -Java_edu_wpi_first_hal_sim_mockdata_DriverStationDataJNI_setEStop( - JNIEnv*, jclass, jboolean value) { +Java_edu_wpi_first_hal_sim_mockdata_DriverStationDataJNI_setEStop + (JNIEnv*, jclass, jboolean value) +{ HALSIM_SetDriverStationEStop(value); } +/* + * Class: edu_wpi_first_hal_sim_mockdata_DriverStationDataJNI + * Method: registerFmsAttachedCallback + * Signature: (Ljava/lang/Object;Z)I + */ JNIEXPORT jint JNICALL -Java_edu_wpi_first_hal_sim_mockdata_DriverStationDataJNI_registerFmsAttachedCallback( - JNIEnv* env, jclass, jobject callback, jboolean initialNotify) { +Java_edu_wpi_first_hal_sim_mockdata_DriverStationDataJNI_registerFmsAttachedCallback + (JNIEnv* env, jclass, jobject callback, jboolean initialNotify) +{ return sim::AllocateCallbackNoIndex( env, callback, initialNotify, &HALSIM_RegisterDriverStationFmsAttachedCallback); } +/* + * Class: edu_wpi_first_hal_sim_mockdata_DriverStationDataJNI + * Method: cancelFmsAttachedCallback + * Signature: (I)V + */ JNIEXPORT void JNICALL -Java_edu_wpi_first_hal_sim_mockdata_DriverStationDataJNI_cancelFmsAttachedCallback( - JNIEnv* env, jclass, jint handle) { +Java_edu_wpi_first_hal_sim_mockdata_DriverStationDataJNI_cancelFmsAttachedCallback + (JNIEnv* env, jclass, jint handle) +{ return sim::FreeCallbackNoIndex( env, handle, &HALSIM_CancelDriverStationFmsAttachedCallback); } +/* + * Class: edu_wpi_first_hal_sim_mockdata_DriverStationDataJNI + * Method: getFmsAttached + * Signature: ()Z + */ JNIEXPORT jboolean JNICALL -Java_edu_wpi_first_hal_sim_mockdata_DriverStationDataJNI_getFmsAttached( - JNIEnv*, jclass) { +Java_edu_wpi_first_hal_sim_mockdata_DriverStationDataJNI_getFmsAttached + (JNIEnv*, jclass) +{ return HALSIM_GetDriverStationFmsAttached(); } +/* + * Class: edu_wpi_first_hal_sim_mockdata_DriverStationDataJNI + * Method: setFmsAttached + * Signature: (Z)V + */ JNIEXPORT void JNICALL -Java_edu_wpi_first_hal_sim_mockdata_DriverStationDataJNI_setFmsAttached( - JNIEnv*, jclass, jboolean value) { +Java_edu_wpi_first_hal_sim_mockdata_DriverStationDataJNI_setFmsAttached + (JNIEnv*, jclass, jboolean value) +{ HALSIM_SetDriverStationFmsAttached(value); } +/* + * Class: edu_wpi_first_hal_sim_mockdata_DriverStationDataJNI + * Method: registerDsAttachedCallback + * Signature: (Ljava/lang/Object;Z)I + */ JNIEXPORT jint JNICALL -Java_edu_wpi_first_hal_sim_mockdata_DriverStationDataJNI_registerDsAttachedCallback( - JNIEnv* env, jclass, jobject callback, jboolean initialNotify) { +Java_edu_wpi_first_hal_sim_mockdata_DriverStationDataJNI_registerDsAttachedCallback + (JNIEnv* env, jclass, jobject callback, jboolean initialNotify) +{ return sim::AllocateCallbackNoIndex( env, callback, initialNotify, &HALSIM_RegisterDriverStationDsAttachedCallback); } +/* + * Class: edu_wpi_first_hal_sim_mockdata_DriverStationDataJNI + * Method: cancelDsAttachedCallback + * Signature: (I)V + */ JNIEXPORT void JNICALL -Java_edu_wpi_first_hal_sim_mockdata_DriverStationDataJNI_cancelDsAttachedCallback( - JNIEnv* env, jclass, jint handle) { +Java_edu_wpi_first_hal_sim_mockdata_DriverStationDataJNI_cancelDsAttachedCallback + (JNIEnv* env, jclass, jint handle) +{ return sim::FreeCallbackNoIndex( env, handle, &HALSIM_CancelDriverStationDsAttachedCallback); } +/* + * Class: edu_wpi_first_hal_sim_mockdata_DriverStationDataJNI + * Method: getDsAttached + * Signature: ()Z + */ JNIEXPORT jboolean JNICALL -Java_edu_wpi_first_hal_sim_mockdata_DriverStationDataJNI_getDsAttached(JNIEnv*, - jclass) { +Java_edu_wpi_first_hal_sim_mockdata_DriverStationDataJNI_getDsAttached + (JNIEnv*, jclass) +{ return HALSIM_GetDriverStationDsAttached(); } +/* + * Class: edu_wpi_first_hal_sim_mockdata_DriverStationDataJNI + * Method: setDsAttached + * Signature: (Z)V + */ JNIEXPORT void JNICALL -Java_edu_wpi_first_hal_sim_mockdata_DriverStationDataJNI_setDsAttached( - JNIEnv*, jclass, jboolean value) { +Java_edu_wpi_first_hal_sim_mockdata_DriverStationDataJNI_setDsAttached + (JNIEnv*, jclass, jboolean value) +{ HALSIM_SetDriverStationDsAttached(value); } /* - * Class: edu_wpi_first_hal_sim_mockdata_DriverStationSim + * Class: edu_wpi_first_hal_sim_mockdata_DriverStationDataJNI * Method: setJoystickAxes * Signature: (B[F)V */ JNIEXPORT void JNICALL -Java_edu_wpi_first_hal_sim_mockdata_DriverStationDataJNI_setJoystickAxes( - JNIEnv* env, jclass, jbyte joystickNum, jfloatArray axesArray) { +Java_edu_wpi_first_hal_sim_mockdata_DriverStationDataJNI_setJoystickAxes + (JNIEnv* env, jclass, jbyte joystickNum, jfloatArray axesArray) +{ HAL_JoystickAxes axes; { wpi::java::JFloatArrayRef jArrayRef(env, axesArray); @@ -198,13 +343,14 @@ Java_edu_wpi_first_hal_sim_mockdata_DriverStationDataJNI_setJoystickAxes( } /* - * Class: edu_wpi_first_hal_sim_mockdata_DriverStationSim + * Class: edu_wpi_first_hal_sim_mockdata_DriverStationDataJNI * Method: setJoystickPOVs * Signature: (B[S)V */ JNIEXPORT void JNICALL -Java_edu_wpi_first_hal_sim_mockdata_DriverStationDataJNI_setJoystickPOVs( - JNIEnv* env, jclass, jbyte joystickNum, jshortArray povsArray) { +Java_edu_wpi_first_hal_sim_mockdata_DriverStationDataJNI_setJoystickPOVs + (JNIEnv* env, jclass, jbyte joystickNum, jshortArray povsArray) +{ HAL_JoystickPOVs povs; { wpi::java::JShortArrayRef jArrayRef(env, povsArray); @@ -222,13 +368,14 @@ Java_edu_wpi_first_hal_sim_mockdata_DriverStationDataJNI_setJoystickPOVs( } /* - * Class: edu_wpi_first_hal_sim_mockdata_DriverStationSim + * Class: edu_wpi_first_hal_sim_mockdata_DriverStationDataJNI * Method: setJoystickButtons * Signature: (BII)V */ JNIEXPORT void JNICALL -Java_edu_wpi_first_hal_sim_mockdata_DriverStationDataJNI_setJoystickButtons( - JNIEnv* env, jclass, jbyte joystickNum, jint buttons, jint count) { +Java_edu_wpi_first_hal_sim_mockdata_DriverStationDataJNI_setJoystickButtons + (JNIEnv* env, jclass, jbyte joystickNum, jint buttons, jint count) +{ if (count > 32) { count = 32; } @@ -239,22 +386,24 @@ Java_edu_wpi_first_hal_sim_mockdata_DriverStationDataJNI_setJoystickButtons( } /* - * Class: edu_wpi_first_hal_sim_mockdata_DriverStationSim + * Class: edu_wpi_first_hal_sim_mockdata_DriverStationDataJNI * Method: setMatchInfo - * Signature: (Ledu/wpi/first/wpilibj/hal/MatchInfoData;)V + * Signature: (Ljava/lang/Object;)V */ JNIEXPORT void JNICALL -Java_edu_wpi_first_hal_sim_mockdata_DriverStationDataJNI_setMatchInfo( - JNIEnv* env, jclass, jobject info) {} +Java_edu_wpi_first_hal_sim_mockdata_DriverStationDataJNI_setMatchInfo + (JNIEnv* env, jclass, jobject info) +{} /* - * Class: edu_wpi_first_hal_sim_mockdata_DriverStationSim + * Class: edu_wpi_first_hal_sim_mockdata_DriverStationDataJNI * Method: registerAllCallbacks - * Signature: (Ledu/wpi/first/hal/sim/NotifyCallback;Z)V + * Signature: (Ljava/lang/Object;Z)V */ JNIEXPORT void JNICALL -Java_edu_wpi_first_hal_sim_mockdata_DriverStationDataJNI_registerAllCallbacks( - JNIEnv* env, jclass, jobject callback, jboolean initialNotify) { +Java_edu_wpi_first_hal_sim_mockdata_DriverStationDataJNI_registerAllCallbacks + (JNIEnv* env, jclass, jobject callback, jboolean initialNotify) +{ sim::AllocateCallbackNoIndex( env, callback, initialNotify, [](HAL_NotifyCallback cb, void* param, HAL_Bool in) { @@ -264,19 +413,26 @@ Java_edu_wpi_first_hal_sim_mockdata_DriverStationDataJNI_registerAllCallbacks( } /* - * Class: edu_wpi_first_hal_sim_mockdata_DriverStationSim + * Class: edu_wpi_first_hal_sim_mockdata_DriverStationDataJNI * Method: notifyNewData * Signature: ()V */ JNIEXPORT void JNICALL -Java_edu_wpi_first_hal_sim_mockdata_DriverStationDataJNI_notifyNewData(JNIEnv*, - jclass) { +Java_edu_wpi_first_hal_sim_mockdata_DriverStationDataJNI_notifyNewData + (JNIEnv*, jclass) +{ HALSIM_NotifyDriverStationNewData(); } +/* + * Class: edu_wpi_first_hal_sim_mockdata_DriverStationDataJNI + * Method: resetData + * Signature: ()V + */ JNIEXPORT void JNICALL -Java_edu_wpi_first_hal_sim_mockdata_DriverStationDataJNI_resetData(JNIEnv*, - jclass) { +Java_edu_wpi_first_hal_sim_mockdata_DriverStationDataJNI_resetData + (JNIEnv*, jclass) +{ HALSIM_ResetDriverStationData(); } diff --git a/hal/src/main/native/sim/jni/EncoderDataJNI.cpp b/hal/src/main/native/sim/jni/EncoderDataJNI.cpp index 269c3f000d..0048489cf6 100644 --- a/hal/src/main/native/sim/jni/EncoderDataJNI.cpp +++ b/hal/src/main/native/sim/jni/EncoderDataJNI.cpp @@ -13,222 +13,415 @@ extern "C" { +/* + * Class: edu_wpi_first_hal_sim_mockdata_EncoderDataJNI + * Method: registerInitializedCallback + * Signature: (ILjava/lang/Object;Z)I + */ JNIEXPORT jint JNICALL -Java_edu_wpi_first_hal_sim_mockdata_EncoderDataJNI_registerInitializedCallback( - JNIEnv* env, jclass, jint index, jobject callback, jboolean initialNotify) { +Java_edu_wpi_first_hal_sim_mockdata_EncoderDataJNI_registerInitializedCallback + (JNIEnv* env, jclass, jint index, jobject callback, jboolean initialNotify) +{ return sim::AllocateCallback(env, index, callback, initialNotify, &HALSIM_RegisterEncoderInitializedCallback); } +/* + * Class: edu_wpi_first_hal_sim_mockdata_EncoderDataJNI + * Method: cancelInitializedCallback + * Signature: (II)V + */ JNIEXPORT void JNICALL -Java_edu_wpi_first_hal_sim_mockdata_EncoderDataJNI_cancelInitializedCallback( - JNIEnv* env, jclass, jint index, jint handle) { +Java_edu_wpi_first_hal_sim_mockdata_EncoderDataJNI_cancelInitializedCallback + (JNIEnv* env, jclass, jint index, jint handle) +{ return sim::FreeCallback(env, handle, index, &HALSIM_CancelEncoderInitializedCallback); } +/* + * Class: edu_wpi_first_hal_sim_mockdata_EncoderDataJNI + * Method: getInitialized + * Signature: (I)Z + */ JNIEXPORT jboolean JNICALL -Java_edu_wpi_first_hal_sim_mockdata_EncoderDataJNI_getInitialized(JNIEnv*, - jclass, - jint index) { +Java_edu_wpi_first_hal_sim_mockdata_EncoderDataJNI_getInitialized + (JNIEnv*, jclass, jint index) +{ return HALSIM_GetEncoderInitialized(index); } +/* + * Class: edu_wpi_first_hal_sim_mockdata_EncoderDataJNI + * Method: setInitialized + * Signature: (IZ)V + */ JNIEXPORT void JNICALL -Java_edu_wpi_first_hal_sim_mockdata_EncoderDataJNI_setInitialized( - JNIEnv*, jclass, jint index, jboolean value) { +Java_edu_wpi_first_hal_sim_mockdata_EncoderDataJNI_setInitialized + (JNIEnv*, jclass, jint index, jboolean value) +{ HALSIM_SetEncoderInitialized(index, value); } +/* + * Class: edu_wpi_first_hal_sim_mockdata_EncoderDataJNI + * Method: registerCountCallback + * Signature: (ILjava/lang/Object;Z)I + */ JNIEXPORT jint JNICALL -Java_edu_wpi_first_hal_sim_mockdata_EncoderDataJNI_registerCountCallback( - JNIEnv* env, jclass, jint index, jobject callback, jboolean initialNotify) { +Java_edu_wpi_first_hal_sim_mockdata_EncoderDataJNI_registerCountCallback + (JNIEnv* env, jclass, jint index, jobject callback, jboolean initialNotify) +{ return sim::AllocateCallback(env, index, callback, initialNotify, &HALSIM_RegisterEncoderCountCallback); } +/* + * Class: edu_wpi_first_hal_sim_mockdata_EncoderDataJNI + * Method: cancelCountCallback + * Signature: (II)V + */ JNIEXPORT void JNICALL -Java_edu_wpi_first_hal_sim_mockdata_EncoderDataJNI_cancelCountCallback( - JNIEnv* env, jclass, jint index, jint handle) { +Java_edu_wpi_first_hal_sim_mockdata_EncoderDataJNI_cancelCountCallback + (JNIEnv* env, jclass, jint index, jint handle) +{ return sim::FreeCallback(env, handle, index, &HALSIM_CancelEncoderCountCallback); } +/* + * Class: edu_wpi_first_hal_sim_mockdata_EncoderDataJNI + * Method: getCount + * Signature: (I)I + */ JNIEXPORT jint JNICALL -Java_edu_wpi_first_hal_sim_mockdata_EncoderDataJNI_getCount(JNIEnv*, jclass, - jint index) { +Java_edu_wpi_first_hal_sim_mockdata_EncoderDataJNI_getCount + (JNIEnv*, jclass, jint index) +{ return HALSIM_GetEncoderCount(index); } +/* + * Class: edu_wpi_first_hal_sim_mockdata_EncoderDataJNI + * Method: setCount + * Signature: (II)V + */ JNIEXPORT void JNICALL -Java_edu_wpi_first_hal_sim_mockdata_EncoderDataJNI_setCount(JNIEnv*, jclass, - jint index, - jint value) { +Java_edu_wpi_first_hal_sim_mockdata_EncoderDataJNI_setCount + (JNIEnv*, jclass, jint index, jint value) +{ HALSIM_SetEncoderCount(index, value); } +/* + * Class: edu_wpi_first_hal_sim_mockdata_EncoderDataJNI + * Method: registerPeriodCallback + * Signature: (ILjava/lang/Object;Z)I + */ JNIEXPORT jint JNICALL -Java_edu_wpi_first_hal_sim_mockdata_EncoderDataJNI_registerPeriodCallback( - JNIEnv* env, jclass, jint index, jobject callback, jboolean initialNotify) { +Java_edu_wpi_first_hal_sim_mockdata_EncoderDataJNI_registerPeriodCallback + (JNIEnv* env, jclass, jint index, jobject callback, jboolean initialNotify) +{ return sim::AllocateCallback(env, index, callback, initialNotify, &HALSIM_RegisterEncoderPeriodCallback); } +/* + * Class: edu_wpi_first_hal_sim_mockdata_EncoderDataJNI + * Method: cancelPeriodCallback + * Signature: (II)V + */ JNIEXPORT void JNICALL -Java_edu_wpi_first_hal_sim_mockdata_EncoderDataJNI_cancelPeriodCallback( - JNIEnv* env, jclass, jint index, jint handle) { +Java_edu_wpi_first_hal_sim_mockdata_EncoderDataJNI_cancelPeriodCallback + (JNIEnv* env, jclass, jint index, jint handle) +{ return sim::FreeCallback(env, handle, index, &HALSIM_CancelEncoderPeriodCallback); } +/* + * Class: edu_wpi_first_hal_sim_mockdata_EncoderDataJNI + * Method: getPeriod + * Signature: (I)D + */ JNIEXPORT jdouble JNICALL -Java_edu_wpi_first_hal_sim_mockdata_EncoderDataJNI_getPeriod(JNIEnv*, jclass, - jint index) { +Java_edu_wpi_first_hal_sim_mockdata_EncoderDataJNI_getPeriod + (JNIEnv*, jclass, jint index) +{ return HALSIM_GetEncoderPeriod(index); } +/* + * Class: edu_wpi_first_hal_sim_mockdata_EncoderDataJNI + * Method: setPeriod + * Signature: (ID)V + */ JNIEXPORT void JNICALL -Java_edu_wpi_first_hal_sim_mockdata_EncoderDataJNI_setPeriod(JNIEnv*, jclass, - jint index, - jdouble value) { +Java_edu_wpi_first_hal_sim_mockdata_EncoderDataJNI_setPeriod + (JNIEnv*, jclass, jint index, jdouble value) +{ HALSIM_SetEncoderPeriod(index, value); } +/* + * Class: edu_wpi_first_hal_sim_mockdata_EncoderDataJNI + * Method: registerResetCallback + * Signature: (ILjava/lang/Object;Z)I + */ JNIEXPORT jint JNICALL -Java_edu_wpi_first_hal_sim_mockdata_EncoderDataJNI_registerResetCallback( - JNIEnv* env, jclass, jint index, jobject callback, jboolean initialNotify) { +Java_edu_wpi_first_hal_sim_mockdata_EncoderDataJNI_registerResetCallback + (JNIEnv* env, jclass, jint index, jobject callback, jboolean initialNotify) +{ return sim::AllocateCallback(env, index, callback, initialNotify, &HALSIM_RegisterEncoderResetCallback); } +/* + * Class: edu_wpi_first_hal_sim_mockdata_EncoderDataJNI + * Method: cancelResetCallback + * Signature: (II)V + */ JNIEXPORT void JNICALL -Java_edu_wpi_first_hal_sim_mockdata_EncoderDataJNI_cancelResetCallback( - JNIEnv* env, jclass, jint index, jint handle) { +Java_edu_wpi_first_hal_sim_mockdata_EncoderDataJNI_cancelResetCallback + (JNIEnv* env, jclass, jint index, jint handle) +{ return sim::FreeCallback(env, handle, index, &HALSIM_CancelEncoderResetCallback); } +/* + * Class: edu_wpi_first_hal_sim_mockdata_EncoderDataJNI + * Method: getReset + * Signature: (I)Z + */ JNIEXPORT jboolean JNICALL -Java_edu_wpi_first_hal_sim_mockdata_EncoderDataJNI_getReset(JNIEnv*, jclass, - jint index) { +Java_edu_wpi_first_hal_sim_mockdata_EncoderDataJNI_getReset + (JNIEnv*, jclass, jint index) +{ return HALSIM_GetEncoderReset(index); } +/* + * Class: edu_wpi_first_hal_sim_mockdata_EncoderDataJNI + * Method: setReset + * Signature: (IZ)V + */ JNIEXPORT void JNICALL -Java_edu_wpi_first_hal_sim_mockdata_EncoderDataJNI_setReset(JNIEnv*, jclass, - jint index, - jboolean value) { +Java_edu_wpi_first_hal_sim_mockdata_EncoderDataJNI_setReset + (JNIEnv*, jclass, jint index, jboolean value) +{ HALSIM_SetEncoderReset(index, value); } +/* + * Class: edu_wpi_first_hal_sim_mockdata_EncoderDataJNI + * Method: registerMaxPeriodCallback + * Signature: (ILjava/lang/Object;Z)I + */ JNIEXPORT jint JNICALL -Java_edu_wpi_first_hal_sim_mockdata_EncoderDataJNI_registerMaxPeriodCallback( - JNIEnv* env, jclass, jint index, jobject callback, jboolean initialNotify) { +Java_edu_wpi_first_hal_sim_mockdata_EncoderDataJNI_registerMaxPeriodCallback + (JNIEnv* env, jclass, jint index, jobject callback, jboolean initialNotify) +{ return sim::AllocateCallback(env, index, callback, initialNotify, &HALSIM_RegisterEncoderMaxPeriodCallback); } +/* + * Class: edu_wpi_first_hal_sim_mockdata_EncoderDataJNI + * Method: cancelMaxPeriodCallback + * Signature: (II)V + */ JNIEXPORT void JNICALL -Java_edu_wpi_first_hal_sim_mockdata_EncoderDataJNI_cancelMaxPeriodCallback( - JNIEnv* env, jclass, jint index, jint handle) { +Java_edu_wpi_first_hal_sim_mockdata_EncoderDataJNI_cancelMaxPeriodCallback + (JNIEnv* env, jclass, jint index, jint handle) +{ return sim::FreeCallback(env, handle, index, &HALSIM_CancelEncoderMaxPeriodCallback); } +/* + * Class: edu_wpi_first_hal_sim_mockdata_EncoderDataJNI + * Method: getMaxPeriod + * Signature: (I)D + */ JNIEXPORT jdouble JNICALL -Java_edu_wpi_first_hal_sim_mockdata_EncoderDataJNI_getMaxPeriod(JNIEnv*, jclass, - jint index) { +Java_edu_wpi_first_hal_sim_mockdata_EncoderDataJNI_getMaxPeriod + (JNIEnv*, jclass, jint index) +{ return HALSIM_GetEncoderMaxPeriod(index); } +/* + * Class: edu_wpi_first_hal_sim_mockdata_EncoderDataJNI + * Method: setMaxPeriod + * Signature: (ID)V + */ JNIEXPORT void JNICALL -Java_edu_wpi_first_hal_sim_mockdata_EncoderDataJNI_setMaxPeriod(JNIEnv*, jclass, - jint index, - jdouble value) { +Java_edu_wpi_first_hal_sim_mockdata_EncoderDataJNI_setMaxPeriod + (JNIEnv*, jclass, jint index, jdouble value) +{ HALSIM_SetEncoderMaxPeriod(index, value); } +/* + * Class: edu_wpi_first_hal_sim_mockdata_EncoderDataJNI + * Method: registerDirectionCallback + * Signature: (ILjava/lang/Object;Z)I + */ JNIEXPORT jint JNICALL -Java_edu_wpi_first_hal_sim_mockdata_EncoderDataJNI_registerDirectionCallback( - JNIEnv* env, jclass, jint index, jobject callback, jboolean initialNotify) { +Java_edu_wpi_first_hal_sim_mockdata_EncoderDataJNI_registerDirectionCallback + (JNIEnv* env, jclass, jint index, jobject callback, jboolean initialNotify) +{ return sim::AllocateCallback(env, index, callback, initialNotify, &HALSIM_RegisterEncoderDirectionCallback); } +/* + * Class: edu_wpi_first_hal_sim_mockdata_EncoderDataJNI + * Method: cancelDirectionCallback + * Signature: (II)V + */ JNIEXPORT void JNICALL -Java_edu_wpi_first_hal_sim_mockdata_EncoderDataJNI_cancelDirectionCallback( - JNIEnv* env, jclass, jint index, jint handle) { +Java_edu_wpi_first_hal_sim_mockdata_EncoderDataJNI_cancelDirectionCallback + (JNIEnv* env, jclass, jint index, jint handle) +{ return sim::FreeCallback(env, handle, index, &HALSIM_CancelEncoderDirectionCallback); } +/* + * Class: edu_wpi_first_hal_sim_mockdata_EncoderDataJNI + * Method: getDirection + * Signature: (I)Z + */ JNIEXPORT jboolean JNICALL -Java_edu_wpi_first_hal_sim_mockdata_EncoderDataJNI_getDirection(JNIEnv*, jclass, - jint index) { +Java_edu_wpi_first_hal_sim_mockdata_EncoderDataJNI_getDirection + (JNIEnv*, jclass, jint index) +{ return HALSIM_GetEncoderDirection(index); } +/* + * Class: edu_wpi_first_hal_sim_mockdata_EncoderDataJNI + * Method: setDirection + * Signature: (IZ)V + */ JNIEXPORT void JNICALL -Java_edu_wpi_first_hal_sim_mockdata_EncoderDataJNI_setDirection( - JNIEnv*, jclass, jint index, jboolean value) { +Java_edu_wpi_first_hal_sim_mockdata_EncoderDataJNI_setDirection + (JNIEnv*, jclass, jint index, jboolean value) +{ HALSIM_SetEncoderDirection(index, value); } +/* + * Class: edu_wpi_first_hal_sim_mockdata_EncoderDataJNI + * Method: registerReverseDirectionCallback + * Signature: (ILjava/lang/Object;Z)I + */ JNIEXPORT jint JNICALL -Java_edu_wpi_first_hal_sim_mockdata_EncoderDataJNI_registerReverseDirectionCallback( - JNIEnv* env, jclass, jint index, jobject callback, jboolean initialNotify) { +Java_edu_wpi_first_hal_sim_mockdata_EncoderDataJNI_registerReverseDirectionCallback + (JNIEnv* env, jclass, jint index, jobject callback, jboolean initialNotify) +{ return sim::AllocateCallback(env, index, callback, initialNotify, &HALSIM_RegisterEncoderReverseDirectionCallback); } +/* + * Class: edu_wpi_first_hal_sim_mockdata_EncoderDataJNI + * Method: cancelReverseDirectionCallback + * Signature: (II)V + */ JNIEXPORT void JNICALL -Java_edu_wpi_first_hal_sim_mockdata_EncoderDataJNI_cancelReverseDirectionCallback( - JNIEnv* env, jclass, jint index, jint handle) { +Java_edu_wpi_first_hal_sim_mockdata_EncoderDataJNI_cancelReverseDirectionCallback + (JNIEnv* env, jclass, jint index, jint handle) +{ return sim::FreeCallback(env, handle, index, &HALSIM_CancelEncoderReverseDirectionCallback); } +/* + * Class: edu_wpi_first_hal_sim_mockdata_EncoderDataJNI + * Method: getReverseDirection + * Signature: (I)Z + */ JNIEXPORT jboolean JNICALL -Java_edu_wpi_first_hal_sim_mockdata_EncoderDataJNI_getReverseDirection( - JNIEnv*, jclass, jint index) { +Java_edu_wpi_first_hal_sim_mockdata_EncoderDataJNI_getReverseDirection + (JNIEnv*, jclass, jint index) +{ return HALSIM_GetEncoderReverseDirection(index); } +/* + * Class: edu_wpi_first_hal_sim_mockdata_EncoderDataJNI + * Method: setReverseDirection + * Signature: (IZ)V + */ JNIEXPORT void JNICALL -Java_edu_wpi_first_hal_sim_mockdata_EncoderDataJNI_setReverseDirection( - JNIEnv*, jclass, jint index, jboolean value) { +Java_edu_wpi_first_hal_sim_mockdata_EncoderDataJNI_setReverseDirection + (JNIEnv*, jclass, jint index, jboolean value) +{ HALSIM_SetEncoderReverseDirection(index, value); } +/* + * Class: edu_wpi_first_hal_sim_mockdata_EncoderDataJNI + * Method: registerSamplesToAverageCallback + * Signature: (ILjava/lang/Object;Z)I + */ JNIEXPORT jint JNICALL -Java_edu_wpi_first_hal_sim_mockdata_EncoderDataJNI_registerSamplesToAverageCallback( - JNIEnv* env, jclass, jint index, jobject callback, jboolean initialNotify) { +Java_edu_wpi_first_hal_sim_mockdata_EncoderDataJNI_registerSamplesToAverageCallback + (JNIEnv* env, jclass, jint index, jobject callback, jboolean initialNotify) +{ return sim::AllocateCallback(env, index, callback, initialNotify, &HALSIM_RegisterEncoderSamplesToAverageCallback); } +/* + * Class: edu_wpi_first_hal_sim_mockdata_EncoderDataJNI + * Method: cancelSamplesToAverageCallback + * Signature: (II)V + */ JNIEXPORT void JNICALL -Java_edu_wpi_first_hal_sim_mockdata_EncoderDataJNI_cancelSamplesToAverageCallback( - JNIEnv* env, jclass, jint index, jint handle) { +Java_edu_wpi_first_hal_sim_mockdata_EncoderDataJNI_cancelSamplesToAverageCallback + (JNIEnv* env, jclass, jint index, jint handle) +{ return sim::FreeCallback(env, handle, index, &HALSIM_CancelEncoderSamplesToAverageCallback); } +/* + * Class: edu_wpi_first_hal_sim_mockdata_EncoderDataJNI + * Method: getSamplesToAverage + * Signature: (I)I + */ JNIEXPORT jint JNICALL -Java_edu_wpi_first_hal_sim_mockdata_EncoderDataJNI_getSamplesToAverage( - JNIEnv*, jclass, jint index) { +Java_edu_wpi_first_hal_sim_mockdata_EncoderDataJNI_getSamplesToAverage + (JNIEnv*, jclass, jint index) +{ return HALSIM_GetEncoderSamplesToAverage(index); } +/* + * Class: edu_wpi_first_hal_sim_mockdata_EncoderDataJNI + * Method: setSamplesToAverage + * Signature: (II)V + */ JNIEXPORT void JNICALL -Java_edu_wpi_first_hal_sim_mockdata_EncoderDataJNI_setSamplesToAverage( - JNIEnv*, jclass, jint index, jint value) { +Java_edu_wpi_first_hal_sim_mockdata_EncoderDataJNI_setSamplesToAverage + (JNIEnv*, jclass, jint index, jint value) +{ HALSIM_SetEncoderSamplesToAverage(index, value); } +/* + * Class: edu_wpi_first_hal_sim_mockdata_EncoderDataJNI + * Method: resetData + * Signature: (I)V + */ JNIEXPORT void JNICALL -Java_edu_wpi_first_hal_sim_mockdata_EncoderDataJNI_resetData(JNIEnv*, jclass, - jint index) { +Java_edu_wpi_first_hal_sim_mockdata_EncoderDataJNI_resetData + (JNIEnv*, jclass, jint index) +{ HALSIM_ResetEncoderData(index); } diff --git a/hal/src/main/native/sim/jni/I2CDataJNI.cpp b/hal/src/main/native/sim/jni/I2CDataJNI.cpp index 3531cdd7fa..d988c48f34 100644 --- a/hal/src/main/native/sim/jni/I2CDataJNI.cpp +++ b/hal/src/main/native/sim/jni/I2CDataJNI.cpp @@ -16,108 +16,115 @@ extern "C" { /* - * Class: edu_wpi_first_hal_sim_mockdata_I2CSim + * Class: edu_wpi_first_hal_sim_mockdata_I2CDataJNI * Method: registerInitializedCallback - * Signature: (ILedu/wpi/first/hal/sim/NotifyCallback;Z)I + * Signature: (ILjava/lang/Object;Z)I */ JNIEXPORT jint JNICALL -Java_edu_wpi_first_hal_sim_mockdata_I2CDataJNI_registerInitializedCallback( - JNIEnv* env, jclass, jint index, jobject callback, jboolean initialNotify) { +Java_edu_wpi_first_hal_sim_mockdata_I2CDataJNI_registerInitializedCallback + (JNIEnv* env, jclass, jint index, jobject callback, jboolean initialNotify) +{ return sim::AllocateCallback(env, index, callback, initialNotify, &HALSIM_RegisterI2CInitializedCallback); } /* - * Class: edu_wpi_first_hal_sim_mockdata_I2CSim + * Class: edu_wpi_first_hal_sim_mockdata_I2CDataJNI * Method: cancelInitializedCallback * Signature: (II)V */ JNIEXPORT void JNICALL -Java_edu_wpi_first_hal_sim_mockdata_I2CDataJNI_cancelInitializedCallback( - JNIEnv* env, jclass, jint index, jint handle) { +Java_edu_wpi_first_hal_sim_mockdata_I2CDataJNI_cancelInitializedCallback + (JNIEnv* env, jclass, jint index, jint handle) +{ return sim::FreeCallback(env, handle, index, &HALSIM_CancelI2CInitializedCallback); } /* - * Class: edu_wpi_first_hal_sim_mockdata_I2CSim + * Class: edu_wpi_first_hal_sim_mockdata_I2CDataJNI * Method: getInitialized * Signature: (I)Z */ JNIEXPORT jboolean JNICALL -Java_edu_wpi_first_hal_sim_mockdata_I2CDataJNI_getInitialized(JNIEnv*, jclass, - jint index) { +Java_edu_wpi_first_hal_sim_mockdata_I2CDataJNI_getInitialized + (JNIEnv*, jclass, jint index) +{ return HALSIM_GetI2CInitialized(index); } /* - * Class: edu_wpi_first_hal_sim_mockdata_I2CSim + * Class: edu_wpi_first_hal_sim_mockdata_I2CDataJNI * Method: setInitialized * Signature: (IZ)V */ JNIEXPORT void JNICALL -Java_edu_wpi_first_hal_sim_mockdata_I2CDataJNI_setInitialized(JNIEnv*, jclass, - jint index, - jboolean value) { +Java_edu_wpi_first_hal_sim_mockdata_I2CDataJNI_setInitialized + (JNIEnv*, jclass, jint index, jboolean value) +{ HALSIM_SetI2CInitialized(index, value); } /* - * Class: edu_wpi_first_hal_sim_mockdata_I2CSim + * Class: edu_wpi_first_hal_sim_mockdata_I2CDataJNI * Method: registerReadCallback - * Signature: (ILedu/wpi/first/hal/sim/BufferCallback;)I + * Signature: (ILjava/lang/Object;)I */ JNIEXPORT jint JNICALL -Java_edu_wpi_first_hal_sim_mockdata_I2CDataJNI_registerReadCallback( - JNIEnv* env, jclass, jint index, jobject callback) { +Java_edu_wpi_first_hal_sim_mockdata_I2CDataJNI_registerReadCallback + (JNIEnv* env, jclass, jint index, jobject callback) +{ return sim::AllocateBufferCallback(env, index, callback, &HALSIM_RegisterI2CReadCallback); } /* - * Class: edu_wpi_first_hal_sim_mockdata_I2CSim + * Class: edu_wpi_first_hal_sim_mockdata_I2CDataJNI * Method: cancelReadCallback * Signature: (II)V */ JNIEXPORT void JNICALL -Java_edu_wpi_first_hal_sim_mockdata_I2CDataJNI_cancelReadCallback(JNIEnv* env, - jclass, - jint index, - jint handle) { +Java_edu_wpi_first_hal_sim_mockdata_I2CDataJNI_cancelReadCallback + (JNIEnv* env, jclass, jint index, jint handle) +{ sim::FreeBufferCallback(env, handle, index, &HALSIM_CancelI2CReadCallback); } /* - * Class: edu_wpi_first_hal_sim_mockdata_I2CSim + * Class: edu_wpi_first_hal_sim_mockdata_I2CDataJNI * Method: registerWriteCallback - * Signature: (ILedu/wpi/first/hal/sim/ConstBufferCallback;)I + * Signature: (ILjava/lang/Object;)I */ JNIEXPORT jint JNICALL -Java_edu_wpi_first_hal_sim_mockdata_I2CDataJNI_registerWriteCallback( - JNIEnv* env, jclass, jint index, jobject callback) { +Java_edu_wpi_first_hal_sim_mockdata_I2CDataJNI_registerWriteCallback + (JNIEnv* env, jclass, jint index, jobject callback) +{ return sim::AllocateConstBufferCallback(env, index, callback, &HALSIM_RegisterI2CWriteCallback); } /* - * Class: edu_wpi_first_hal_sim_mockdata_I2CSim + * Class: edu_wpi_first_hal_sim_mockdata_I2CDataJNI * Method: cancelWriteCallback * Signature: (II)V */ JNIEXPORT void JNICALL -Java_edu_wpi_first_hal_sim_mockdata_I2CDataJNI_cancelWriteCallback( - JNIEnv* env, jclass, jint index, jint handle) { +Java_edu_wpi_first_hal_sim_mockdata_I2CDataJNI_cancelWriteCallback + (JNIEnv* env, jclass, jint index, jint handle) +{ sim::FreeConstBufferCallback(env, handle, index, &HALSIM_CancelI2CWriteCallback); } /* - * Class: edu_wpi_first_hal_sim_mockdata_I2CSim + * Class: edu_wpi_first_hal_sim_mockdata_I2CDataJNI * Method: resetData * Signature: (I)V */ -JNIEXPORT void JNICALL Java_edu_wpi_first_hal_sim_mockdata_I2CDataJNI_resetData( - JNIEnv*, jclass, jint index) { +JNIEXPORT void JNICALL +Java_edu_wpi_first_hal_sim_mockdata_I2CDataJNI_resetData + (JNIEnv*, jclass, jint index) +{ HALSIM_ResetI2CData(index); } diff --git a/hal/src/main/native/sim/jni/PCMDataJNI.cpp b/hal/src/main/native/sim/jni/PCMDataJNI.cpp index 29f5570b3e..21723f7e61 100644 --- a/hal/src/main/native/sim/jni/PCMDataJNI.cpp +++ b/hal/src/main/native/sim/jni/PCMDataJNI.cpp @@ -13,205 +13,370 @@ extern "C" { +/* + * Class: edu_wpi_first_hal_sim_mockdata_PCMDataJNI + * Method: registerSolenoidInitializedCallback + * Signature: (IILjava/lang/Object;Z)I + */ JNIEXPORT jint JNICALL -Java_edu_wpi_first_hal_sim_mockdata_PCMDataJNI_registerSolenoidInitializedCallback( - JNIEnv* env, jclass, jint index, jint channel, jobject callback, - jboolean initialNotify) { +Java_edu_wpi_first_hal_sim_mockdata_PCMDataJNI_registerSolenoidInitializedCallback + (JNIEnv* env, jclass, jint index, jint channel, jobject callback, + jboolean initialNotify) +{ return sim::AllocateChannelCallback( env, index, channel, callback, initialNotify, &HALSIM_RegisterPCMSolenoidInitializedCallback); } +/* + * Class: edu_wpi_first_hal_sim_mockdata_PCMDataJNI + * Method: cancelSolenoidInitializedCallback + * Signature: (III)V + */ JNIEXPORT void JNICALL -Java_edu_wpi_first_hal_sim_mockdata_PCMDataJNI_cancelSolenoidInitializedCallback( - JNIEnv* env, jclass, jint index, jint channel, jint handle) { +Java_edu_wpi_first_hal_sim_mockdata_PCMDataJNI_cancelSolenoidInitializedCallback + (JNIEnv* env, jclass, jint index, jint channel, jint handle) +{ return sim::FreeChannelCallback(env, handle, index, channel, &HALSIM_CancelPCMSolenoidInitializedCallback); } +/* + * Class: edu_wpi_first_hal_sim_mockdata_PCMDataJNI + * Method: getSolenoidInitialized + * Signature: (II)Z + */ JNIEXPORT jboolean JNICALL -Java_edu_wpi_first_hal_sim_mockdata_PCMDataJNI_getSolenoidInitialized( - JNIEnv*, jclass, jint index, jint channel) { +Java_edu_wpi_first_hal_sim_mockdata_PCMDataJNI_getSolenoidInitialized + (JNIEnv*, jclass, jint index, jint channel) +{ return HALSIM_GetPCMSolenoidInitialized(index, channel); } +/* + * Class: edu_wpi_first_hal_sim_mockdata_PCMDataJNI + * Method: setSolenoidInitialized + * Signature: (IIZ)V + */ JNIEXPORT void JNICALL -Java_edu_wpi_first_hal_sim_mockdata_PCMDataJNI_setSolenoidInitialized( - JNIEnv*, jclass, jint index, jint channel, jboolean value) { +Java_edu_wpi_first_hal_sim_mockdata_PCMDataJNI_setSolenoidInitialized + (JNIEnv*, jclass, jint index, jint channel, jboolean value) +{ HALSIM_SetPCMSolenoidInitialized(index, channel, value); } +/* + * Class: edu_wpi_first_hal_sim_mockdata_PCMDataJNI + * Method: registerSolenoidOutputCallback + * Signature: (IILjava/lang/Object;Z)I + */ JNIEXPORT jint JNICALL -Java_edu_wpi_first_hal_sim_mockdata_PCMDataJNI_registerSolenoidOutputCallback( - JNIEnv* env, jclass, jint index, jint channel, jobject callback, - jboolean initialNotify) { +Java_edu_wpi_first_hal_sim_mockdata_PCMDataJNI_registerSolenoidOutputCallback + (JNIEnv* env, jclass, jint index, jint channel, jobject callback, + jboolean initialNotify) +{ return sim::AllocateChannelCallback( env, index, channel, callback, initialNotify, &HALSIM_RegisterPCMSolenoidOutputCallback); } +/* + * Class: edu_wpi_first_hal_sim_mockdata_PCMDataJNI + * Method: cancelSolenoidOutputCallback + * Signature: (III)V + */ JNIEXPORT void JNICALL -Java_edu_wpi_first_hal_sim_mockdata_PCMDataJNI_cancelSolenoidOutputCallback( - JNIEnv* env, jclass, jint index, jint channel, jint handle) { +Java_edu_wpi_first_hal_sim_mockdata_PCMDataJNI_cancelSolenoidOutputCallback + (JNIEnv* env, jclass, jint index, jint channel, jint handle) +{ return sim::FreeChannelCallback(env, handle, index, channel, &HALSIM_CancelPCMSolenoidOutputCallback); } +/* + * Class: edu_wpi_first_hal_sim_mockdata_PCMDataJNI + * Method: getSolenoidOutput + * Signature: (II)Z + */ JNIEXPORT jboolean JNICALL -Java_edu_wpi_first_hal_sim_mockdata_PCMDataJNI_getSolenoidOutput(JNIEnv*, - jclass, - jint index, - jint channel) { +Java_edu_wpi_first_hal_sim_mockdata_PCMDataJNI_getSolenoidOutput + (JNIEnv*, jclass, jint index, jint channel) +{ return HALSIM_GetPCMSolenoidOutput(index, channel); } +/* + * Class: edu_wpi_first_hal_sim_mockdata_PCMDataJNI + * Method: setSolenoidOutput + * Signature: (IIZ)V + */ JNIEXPORT void JNICALL -Java_edu_wpi_first_hal_sim_mockdata_PCMDataJNI_setSolenoidOutput( - JNIEnv*, jclass, jint index, jint channel, jboolean value) { +Java_edu_wpi_first_hal_sim_mockdata_PCMDataJNI_setSolenoidOutput + (JNIEnv*, jclass, jint index, jint channel, jboolean value) +{ HALSIM_SetPCMSolenoidOutput(index, channel, value); } +/* + * Class: edu_wpi_first_hal_sim_mockdata_PCMDataJNI + * Method: registerCompressorInitializedCallback + * Signature: (ILjava/lang/Object;Z)I + */ JNIEXPORT jint JNICALL -Java_edu_wpi_first_hal_sim_mockdata_PCMDataJNI_registerCompressorInitializedCallback( - JNIEnv* env, jclass, jint index, jobject callback, jboolean initialNotify) { +Java_edu_wpi_first_hal_sim_mockdata_PCMDataJNI_registerCompressorInitializedCallback + (JNIEnv* env, jclass, jint index, jobject callback, jboolean initialNotify) +{ return sim::AllocateCallback( env, index, callback, initialNotify, &HALSIM_RegisterPCMCompressorInitializedCallback); } +/* + * Class: edu_wpi_first_hal_sim_mockdata_PCMDataJNI + * Method: cancelCompressorInitializedCallback + * Signature: (II)V + */ JNIEXPORT void JNICALL -Java_edu_wpi_first_hal_sim_mockdata_PCMDataJNI_cancelCompressorInitializedCallback( - JNIEnv* env, jclass, jint index, jint handle) { +Java_edu_wpi_first_hal_sim_mockdata_PCMDataJNI_cancelCompressorInitializedCallback + (JNIEnv* env, jclass, jint index, jint handle) +{ return sim::FreeCallback(env, handle, index, &HALSIM_CancelPCMCompressorInitializedCallback); } +/* + * Class: edu_wpi_first_hal_sim_mockdata_PCMDataJNI + * Method: getCompressorInitialized + * Signature: (I)Z + */ JNIEXPORT jboolean JNICALL -Java_edu_wpi_first_hal_sim_mockdata_PCMDataJNI_getCompressorInitialized( - JNIEnv*, jclass, jint index) { +Java_edu_wpi_first_hal_sim_mockdata_PCMDataJNI_getCompressorInitialized + (JNIEnv*, jclass, jint index) +{ return HALSIM_GetPCMCompressorInitialized(index); } +/* + * Class: edu_wpi_first_hal_sim_mockdata_PCMDataJNI + * Method: setCompressorInitialized + * Signature: (IZ)V + */ JNIEXPORT void JNICALL -Java_edu_wpi_first_hal_sim_mockdata_PCMDataJNI_setCompressorInitialized( - JNIEnv*, jclass, jint index, jboolean value) { +Java_edu_wpi_first_hal_sim_mockdata_PCMDataJNI_setCompressorInitialized + (JNIEnv*, jclass, jint index, jboolean value) +{ HALSIM_SetPCMCompressorInitialized(index, value); } +/* + * Class: edu_wpi_first_hal_sim_mockdata_PCMDataJNI + * Method: registerCompressorOnCallback + * Signature: (ILjava/lang/Object;Z)I + */ JNIEXPORT jint JNICALL -Java_edu_wpi_first_hal_sim_mockdata_PCMDataJNI_registerCompressorOnCallback( - JNIEnv* env, jclass, jint index, jobject callback, jboolean initialNotify) { +Java_edu_wpi_first_hal_sim_mockdata_PCMDataJNI_registerCompressorOnCallback + (JNIEnv* env, jclass, jint index, jobject callback, jboolean initialNotify) +{ return sim::AllocateCallback(env, index, callback, initialNotify, &HALSIM_RegisterPCMCompressorOnCallback); } +/* + * Class: edu_wpi_first_hal_sim_mockdata_PCMDataJNI + * Method: cancelCompressorOnCallback + * Signature: (II)V + */ JNIEXPORT void JNICALL -Java_edu_wpi_first_hal_sim_mockdata_PCMDataJNI_cancelCompressorOnCallback( - JNIEnv* env, jclass, jint index, jint handle) { +Java_edu_wpi_first_hal_sim_mockdata_PCMDataJNI_cancelCompressorOnCallback + (JNIEnv* env, jclass, jint index, jint handle) +{ return sim::FreeCallback(env, handle, index, &HALSIM_CancelPCMCompressorOnCallback); } +/* + * Class: edu_wpi_first_hal_sim_mockdata_PCMDataJNI + * Method: getCompressorOn + * Signature: (I)Z + */ JNIEXPORT jboolean JNICALL -Java_edu_wpi_first_hal_sim_mockdata_PCMDataJNI_getCompressorOn(JNIEnv*, jclass, - jint index) { +Java_edu_wpi_first_hal_sim_mockdata_PCMDataJNI_getCompressorOn + (JNIEnv*, jclass, jint index) +{ return HALSIM_GetPCMCompressorOn(index); } +/* + * Class: edu_wpi_first_hal_sim_mockdata_PCMDataJNI + * Method: setCompressorOn + * Signature: (IZ)V + */ JNIEXPORT void JNICALL -Java_edu_wpi_first_hal_sim_mockdata_PCMDataJNI_setCompressorOn(JNIEnv*, jclass, - jint index, - jboolean value) { +Java_edu_wpi_first_hal_sim_mockdata_PCMDataJNI_setCompressorOn + (JNIEnv*, jclass, jint index, jboolean value) +{ HALSIM_SetPCMCompressorOn(index, value); } +/* + * Class: edu_wpi_first_hal_sim_mockdata_PCMDataJNI + * Method: registerClosedLoopEnabledCallback + * Signature: (ILjava/lang/Object;Z)I + */ JNIEXPORT jint JNICALL -Java_edu_wpi_first_hal_sim_mockdata_PCMDataJNI_registerClosedLoopEnabledCallback( - JNIEnv* env, jclass, jint index, jobject callback, jboolean initialNotify) { +Java_edu_wpi_first_hal_sim_mockdata_PCMDataJNI_registerClosedLoopEnabledCallback + (JNIEnv* env, jclass, jint index, jobject callback, jboolean initialNotify) +{ return sim::AllocateCallback(env, index, callback, initialNotify, &HALSIM_RegisterPCMClosedLoopEnabledCallback); } +/* + * Class: edu_wpi_first_hal_sim_mockdata_PCMDataJNI + * Method: cancelClosedLoopEnabledCallback + * Signature: (II)V + */ JNIEXPORT void JNICALL -Java_edu_wpi_first_hal_sim_mockdata_PCMDataJNI_cancelClosedLoopEnabledCallback( - JNIEnv* env, jclass, jint index, jint handle) { +Java_edu_wpi_first_hal_sim_mockdata_PCMDataJNI_cancelClosedLoopEnabledCallback + (JNIEnv* env, jclass, jint index, jint handle) +{ return sim::FreeCallback(env, handle, index, &HALSIM_CancelPCMClosedLoopEnabledCallback); } +/* + * Class: edu_wpi_first_hal_sim_mockdata_PCMDataJNI + * Method: getClosedLoopEnabled + * Signature: (I)Z + */ JNIEXPORT jboolean JNICALL -Java_edu_wpi_first_hal_sim_mockdata_PCMDataJNI_getClosedLoopEnabled( - JNIEnv*, jclass, jint index) { +Java_edu_wpi_first_hal_sim_mockdata_PCMDataJNI_getClosedLoopEnabled + (JNIEnv*, jclass, jint index) +{ return HALSIM_GetPCMClosedLoopEnabled(index); } +/* + * Class: edu_wpi_first_hal_sim_mockdata_PCMDataJNI + * Method: setClosedLoopEnabled + * Signature: (IZ)V + */ JNIEXPORT void JNICALL -Java_edu_wpi_first_hal_sim_mockdata_PCMDataJNI_setClosedLoopEnabled( - JNIEnv*, jclass, jint index, jboolean value) { +Java_edu_wpi_first_hal_sim_mockdata_PCMDataJNI_setClosedLoopEnabled + (JNIEnv*, jclass, jint index, jboolean value) +{ HALSIM_SetPCMClosedLoopEnabled(index, value); } +/* + * Class: edu_wpi_first_hal_sim_mockdata_PCMDataJNI + * Method: registerPressureSwitchCallback + * Signature: (ILjava/lang/Object;Z)I + */ JNIEXPORT jint JNICALL -Java_edu_wpi_first_hal_sim_mockdata_PCMDataJNI_registerPressureSwitchCallback( - JNIEnv* env, jclass, jint index, jobject callback, jboolean initialNotify) { +Java_edu_wpi_first_hal_sim_mockdata_PCMDataJNI_registerPressureSwitchCallback + (JNIEnv* env, jclass, jint index, jobject callback, jboolean initialNotify) +{ return sim::AllocateCallback(env, index, callback, initialNotify, &HALSIM_RegisterPCMPressureSwitchCallback); } +/* + * Class: edu_wpi_first_hal_sim_mockdata_PCMDataJNI + * Method: cancelPressureSwitchCallback + * Signature: (II)V + */ JNIEXPORT void JNICALL -Java_edu_wpi_first_hal_sim_mockdata_PCMDataJNI_cancelPressureSwitchCallback( - JNIEnv* env, jclass, jint index, jint handle) { +Java_edu_wpi_first_hal_sim_mockdata_PCMDataJNI_cancelPressureSwitchCallback + (JNIEnv* env, jclass, jint index, jint handle) +{ return sim::FreeCallback(env, handle, index, &HALSIM_CancelPCMPressureSwitchCallback); } +/* + * Class: edu_wpi_first_hal_sim_mockdata_PCMDataJNI + * Method: getPressureSwitch + * Signature: (I)Z + */ JNIEXPORT jboolean JNICALL -Java_edu_wpi_first_hal_sim_mockdata_PCMDataJNI_getPressureSwitch(JNIEnv*, - jclass, - jint index) { +Java_edu_wpi_first_hal_sim_mockdata_PCMDataJNI_getPressureSwitch + (JNIEnv*, jclass, jint index) +{ return HALSIM_GetPCMPressureSwitch(index); } +/* + * Class: edu_wpi_first_hal_sim_mockdata_PCMDataJNI + * Method: setPressureSwitch + * Signature: (IZ)V + */ JNIEXPORT void JNICALL -Java_edu_wpi_first_hal_sim_mockdata_PCMDataJNI_setPressureSwitch( - JNIEnv*, jclass, jint index, jboolean value) { +Java_edu_wpi_first_hal_sim_mockdata_PCMDataJNI_setPressureSwitch + (JNIEnv*, jclass, jint index, jboolean value) +{ HALSIM_SetPCMPressureSwitch(index, value); } +/* + * Class: edu_wpi_first_hal_sim_mockdata_PCMDataJNI + * Method: registerCompressorCurrentCallback + * Signature: (ILjava/lang/Object;Z)I + */ JNIEXPORT jint JNICALL -Java_edu_wpi_first_hal_sim_mockdata_PCMDataJNI_registerCompressorCurrentCallback( - JNIEnv* env, jclass, jint index, jobject callback, jboolean initialNotify) { +Java_edu_wpi_first_hal_sim_mockdata_PCMDataJNI_registerCompressorCurrentCallback + (JNIEnv* env, jclass, jint index, jobject callback, jboolean initialNotify) +{ return sim::AllocateCallback(env, index, callback, initialNotify, &HALSIM_RegisterPCMCompressorCurrentCallback); } +/* + * Class: edu_wpi_first_hal_sim_mockdata_PCMDataJNI + * Method: cancelCompressorCurrentCallback + * Signature: (II)V + */ JNIEXPORT void JNICALL -Java_edu_wpi_first_hal_sim_mockdata_PCMDataJNI_cancelCompressorCurrentCallback( - JNIEnv* env, jclass, jint index, jint handle) { +Java_edu_wpi_first_hal_sim_mockdata_PCMDataJNI_cancelCompressorCurrentCallback + (JNIEnv* env, jclass, jint index, jint handle) +{ return sim::FreeCallback(env, handle, index, &HALSIM_CancelPCMCompressorCurrentCallback); } +/* + * Class: edu_wpi_first_hal_sim_mockdata_PCMDataJNI + * Method: getCompressorCurrent + * Signature: (I)D + */ JNIEXPORT jdouble JNICALL -Java_edu_wpi_first_hal_sim_mockdata_PCMDataJNI_getCompressorCurrent( - JNIEnv*, jclass, jint index) { +Java_edu_wpi_first_hal_sim_mockdata_PCMDataJNI_getCompressorCurrent + (JNIEnv*, jclass, jint index) +{ return HALSIM_GetPCMCompressorCurrent(index); } +/* + * Class: edu_wpi_first_hal_sim_mockdata_PCMDataJNI + * Method: setCompressorCurrent + * Signature: (ID)V + */ JNIEXPORT void JNICALL -Java_edu_wpi_first_hal_sim_mockdata_PCMDataJNI_setCompressorCurrent( - JNIEnv*, jclass, jint index, jdouble value) { +Java_edu_wpi_first_hal_sim_mockdata_PCMDataJNI_setCompressorCurrent + (JNIEnv*, jclass, jint index, jdouble value) +{ HALSIM_SetPCMCompressorCurrent(index, value); } /* - * Class: edu_wpi_first_hal_sim_mockdata_PCMSim + * Class: edu_wpi_first_hal_sim_mockdata_PCMDataJNI * Method: registerAllNonSolenoidCallbacks - * Signature: (ILedu/wpi/first/hal/sim/NotifyCallback;Z)V + * Signature: (ILjava/lang/Object;Z)V */ JNIEXPORT void JNICALL -Java_edu_wpi_first_hal_sim_mockdata_PCMDataJNI_registerAllNonSolenoidCallbacks( - JNIEnv* env, jclass, jint index, jobject callback, jboolean initialNotify) { +Java_edu_wpi_first_hal_sim_mockdata_PCMDataJNI_registerAllNonSolenoidCallbacks + (JNIEnv* env, jclass, jint index, jobject callback, jboolean initialNotify) +{ sim::AllocateCallback( env, index, callback, initialNotify, [](int32_t index, HAL_NotifyCallback cb, void* param, HAL_Bool in) { @@ -221,14 +386,15 @@ Java_edu_wpi_first_hal_sim_mockdata_PCMDataJNI_registerAllNonSolenoidCallbacks( } /* - * Class: edu_wpi_first_hal_sim_mockdata_PCMSim + * Class: edu_wpi_first_hal_sim_mockdata_PCMDataJNI * Method: registerAllSolenoidCallbacks - * Signature: (IILedu/wpi/first/hal/sim/NotifyCallback;Z)V + * Signature: (IILjava/lang/Object;Z)V */ JNIEXPORT void JNICALL -Java_edu_wpi_first_hal_sim_mockdata_PCMDataJNI_registerAllSolenoidCallbacks( - JNIEnv* env, jclass, jint index, jint channel, jobject callback, - jboolean initialNotify) { +Java_edu_wpi_first_hal_sim_mockdata_PCMDataJNI_registerAllSolenoidCallbacks + (JNIEnv* env, jclass, jint index, jint channel, jobject callback, + jboolean initialNotify) +{ sim::AllocateChannelCallback( env, index, channel, callback, initialNotify, [](int32_t index, int32_t channel, HAL_NotifyCallback cb, void* param, @@ -238,8 +404,15 @@ Java_edu_wpi_first_hal_sim_mockdata_PCMDataJNI_registerAllSolenoidCallbacks( }); } -JNIEXPORT void JNICALL Java_edu_wpi_first_hal_sim_mockdata_PCMDataJNI_resetData( - JNIEnv*, jclass, jint index) { +/* + * Class: edu_wpi_first_hal_sim_mockdata_PCMDataJNI + * Method: resetData + * Signature: (I)V + */ +JNIEXPORT void JNICALL +Java_edu_wpi_first_hal_sim_mockdata_PCMDataJNI_resetData + (JNIEnv*, jclass, jint index) +{ HALSIM_ResetPCMData(index); } diff --git a/hal/src/main/native/sim/jni/PDPDataJNI.cpp b/hal/src/main/native/sim/jni/PDPDataJNI.cpp index 43c3ed40db..5a9a7ff9ec 100644 --- a/hal/src/main/native/sim/jni/PDPDataJNI.cpp +++ b/hal/src/main/native/sim/jni/PDPDataJNI.cpp @@ -13,120 +13,217 @@ extern "C" { +/* + * Class: edu_wpi_first_hal_sim_mockdata_PDPDataJNI + * Method: registerInitializedCallback + * Signature: (ILjava/lang/Object;Z)I + */ JNIEXPORT jint JNICALL -Java_edu_wpi_first_hal_sim_mockdata_PDPDataJNI_registerInitializedCallback( - JNIEnv* env, jclass, jint index, jobject callback, jboolean initialNotify) { +Java_edu_wpi_first_hal_sim_mockdata_PDPDataJNI_registerInitializedCallback + (JNIEnv* env, jclass, jint index, jobject callback, jboolean initialNotify) +{ return sim::AllocateCallback(env, index, callback, initialNotify, &HALSIM_RegisterPDPInitializedCallback); } +/* + * Class: edu_wpi_first_hal_sim_mockdata_PDPDataJNI + * Method: cancelInitializedCallback + * Signature: (II)V + */ JNIEXPORT void JNICALL -Java_edu_wpi_first_hal_sim_mockdata_PDPDataJNI_cancelInitializedCallback( - JNIEnv* env, jclass, jint index, jint handle) { +Java_edu_wpi_first_hal_sim_mockdata_PDPDataJNI_cancelInitializedCallback + (JNIEnv* env, jclass, jint index, jint handle) +{ return sim::FreeCallback(env, handle, index, &HALSIM_CancelPDPInitializedCallback); } +/* + * Class: edu_wpi_first_hal_sim_mockdata_PDPDataJNI + * Method: getInitialized + * Signature: (I)Z + */ JNIEXPORT jboolean JNICALL -Java_edu_wpi_first_hal_sim_mockdata_PDPDataJNI_getInitialized(JNIEnv*, jclass, - jint index) { +Java_edu_wpi_first_hal_sim_mockdata_PDPDataJNI_getInitialized + (JNIEnv*, jclass, jint index) +{ return HALSIM_GetPDPInitialized(index); } +/* + * Class: edu_wpi_first_hal_sim_mockdata_PDPDataJNI + * Method: setInitialized + * Signature: (IZ)V + */ JNIEXPORT void JNICALL -Java_edu_wpi_first_hal_sim_mockdata_PDPDataJNI_setInitialized(JNIEnv*, jclass, - jint index, - jboolean value) { +Java_edu_wpi_first_hal_sim_mockdata_PDPDataJNI_setInitialized + (JNIEnv*, jclass, jint index, jboolean value) +{ HALSIM_SetPDPInitialized(index, value); } +/* + * Class: edu_wpi_first_hal_sim_mockdata_PDPDataJNI + * Method: registerTemperatureCallback + * Signature: (ILjava/lang/Object;Z)I + */ JNIEXPORT jint JNICALL -Java_edu_wpi_first_hal_sim_mockdata_PDPDataJNI_registerTemperatureCallback( - JNIEnv* env, jclass, jint index, jobject callback, jboolean initialNotify) { +Java_edu_wpi_first_hal_sim_mockdata_PDPDataJNI_registerTemperatureCallback + (JNIEnv* env, jclass, jint index, jobject callback, jboolean initialNotify) +{ return sim::AllocateCallback(env, index, callback, initialNotify, &HALSIM_RegisterPDPTemperatureCallback); } +/* + * Class: edu_wpi_first_hal_sim_mockdata_PDPDataJNI + * Method: cancelTemperatureCallback + * Signature: (II)V + */ JNIEXPORT void JNICALL -Java_edu_wpi_first_hal_sim_mockdata_PDPDataJNI_cancelTemperatureCallback( - JNIEnv* env, jclass, jint index, jint handle) { +Java_edu_wpi_first_hal_sim_mockdata_PDPDataJNI_cancelTemperatureCallback + (JNIEnv* env, jclass, jint index, jint handle) +{ return sim::FreeCallback(env, handle, index, &HALSIM_CancelPDPTemperatureCallback); } +/* + * Class: edu_wpi_first_hal_sim_mockdata_PDPDataJNI + * Method: getTemperature + * Signature: (I)D + */ JNIEXPORT jdouble JNICALL -Java_edu_wpi_first_hal_sim_mockdata_PDPDataJNI_getTemperature(JNIEnv*, jclass, - jint index) { +Java_edu_wpi_first_hal_sim_mockdata_PDPDataJNI_getTemperature + (JNIEnv*, jclass, jint index) +{ return HALSIM_GetPDPTemperature(index); } +/* + * Class: edu_wpi_first_hal_sim_mockdata_PDPDataJNI + * Method: setTemperature + * Signature: (ID)V + */ JNIEXPORT void JNICALL -Java_edu_wpi_first_hal_sim_mockdata_PDPDataJNI_setTemperature(JNIEnv*, jclass, - jint index, - jdouble value) { +Java_edu_wpi_first_hal_sim_mockdata_PDPDataJNI_setTemperature + (JNIEnv*, jclass, jint index, jdouble value) +{ HALSIM_SetPDPTemperature(index, value); } +/* + * Class: edu_wpi_first_hal_sim_mockdata_PDPDataJNI + * Method: registerVoltageCallback + * Signature: (ILjava/lang/Object;Z)I + */ JNIEXPORT jint JNICALL -Java_edu_wpi_first_hal_sim_mockdata_PDPDataJNI_registerVoltageCallback( - JNIEnv* env, jclass, jint index, jobject callback, jboolean initialNotify) { +Java_edu_wpi_first_hal_sim_mockdata_PDPDataJNI_registerVoltageCallback + (JNIEnv* env, jclass, jint index, jobject callback, jboolean initialNotify) +{ return sim::AllocateCallback(env, index, callback, initialNotify, &HALSIM_RegisterPDPVoltageCallback); } +/* + * Class: edu_wpi_first_hal_sim_mockdata_PDPDataJNI + * Method: cancelVoltageCallback + * Signature: (II)V + */ JNIEXPORT void JNICALL -Java_edu_wpi_first_hal_sim_mockdata_PDPDataJNI_cancelVoltageCallback( - JNIEnv* env, jclass, jint index, jint handle) { +Java_edu_wpi_first_hal_sim_mockdata_PDPDataJNI_cancelVoltageCallback + (JNIEnv* env, jclass, jint index, jint handle) +{ return sim::FreeCallback(env, handle, index, &HALSIM_CancelPDPVoltageCallback); } +/* + * Class: edu_wpi_first_hal_sim_mockdata_PDPDataJNI + * Method: getVoltage + * Signature: (I)D + */ JNIEXPORT jdouble JNICALL -Java_edu_wpi_first_hal_sim_mockdata_PDPDataJNI_getVoltage(JNIEnv*, jclass, - jint index) { +Java_edu_wpi_first_hal_sim_mockdata_PDPDataJNI_getVoltage + (JNIEnv*, jclass, jint index) +{ return HALSIM_GetPDPVoltage(index); } +/* + * Class: edu_wpi_first_hal_sim_mockdata_PDPDataJNI + * Method: setVoltage + * Signature: (ID)V + */ JNIEXPORT void JNICALL -Java_edu_wpi_first_hal_sim_mockdata_PDPDataJNI_setVoltage(JNIEnv*, jclass, - jint index, - jdouble value) { +Java_edu_wpi_first_hal_sim_mockdata_PDPDataJNI_setVoltage + (JNIEnv*, jclass, jint index, jdouble value) +{ HALSIM_SetPDPVoltage(index, value); } +/* + * Class: edu_wpi_first_hal_sim_mockdata_PDPDataJNI + * Method: registerCurrentCallback + * Signature: (IILjava/lang/Object;Z)I + */ JNIEXPORT jint JNICALL -Java_edu_wpi_first_hal_sim_mockdata_PDPDataJNI_registerCurrentCallback( - JNIEnv* env, jclass, jint index, jint channel, jobject callback, - jboolean initialNotify) { +Java_edu_wpi_first_hal_sim_mockdata_PDPDataJNI_registerCurrentCallback + (JNIEnv* env, jclass, jint index, jint channel, jobject callback, + jboolean initialNotify) +{ return sim::AllocateChannelCallback(env, index, channel, callback, initialNotify, &HALSIM_RegisterPDPCurrentCallback); } +/* + * Class: edu_wpi_first_hal_sim_mockdata_PDPDataJNI + * Method: cancelCurrentCallback + * Signature: (III)V + */ JNIEXPORT void JNICALL -Java_edu_wpi_first_hal_sim_mockdata_PDPDataJNI_cancelCurrentCallback( - JNIEnv* env, jclass, jint index, jint channel, jint handle) { +Java_edu_wpi_first_hal_sim_mockdata_PDPDataJNI_cancelCurrentCallback + (JNIEnv* env, jclass, jint index, jint channel, jint handle) +{ return sim::FreeChannelCallback(env, handle, index, channel, &HALSIM_CancelPDPCurrentCallback); } +/* + * Class: edu_wpi_first_hal_sim_mockdata_PDPDataJNI + * Method: getCurrent + * Signature: (II)D + */ JNIEXPORT jdouble JNICALL -Java_edu_wpi_first_hal_sim_mockdata_PDPDataJNI_getCurrent(JNIEnv*, jclass, - jint index, - jint channel) { +Java_edu_wpi_first_hal_sim_mockdata_PDPDataJNI_getCurrent + (JNIEnv*, jclass, jint index, jint channel) +{ return HALSIM_GetPDPCurrent(index, channel); } +/* + * Class: edu_wpi_first_hal_sim_mockdata_PDPDataJNI + * Method: setCurrent + * Signature: (IID)V + */ JNIEXPORT void JNICALL -Java_edu_wpi_first_hal_sim_mockdata_PDPDataJNI_setCurrent(JNIEnv*, jclass, - jint index, - jint channel, - jdouble value) { +Java_edu_wpi_first_hal_sim_mockdata_PDPDataJNI_setCurrent + (JNIEnv*, jclass, jint index, jint channel, jdouble value) +{ HALSIM_SetPDPCurrent(index, channel, value); } -JNIEXPORT void JNICALL Java_edu_wpi_first_hal_sim_mockdata_PDPDataJNI_resetData( - JNIEnv*, jclass, jint index) { +/* + * Class: edu_wpi_first_hal_sim_mockdata_PDPDataJNI + * Method: resetData + * Signature: (I)V + */ +JNIEXPORT void JNICALL +Java_edu_wpi_first_hal_sim_mockdata_PDPDataJNI_resetData + (JNIEnv*, jclass, jint index) +{ HALSIM_ResetPDPData(index); } diff --git a/hal/src/main/native/sim/jni/PWMDataJNI.cpp b/hal/src/main/native/sim/jni/PWMDataJNI.cpp index 2c4d261333..4f52308845 100644 --- a/hal/src/main/native/sim/jni/PWMDataJNI.cpp +++ b/hal/src/main/native/sim/jni/PWMDataJNI.cpp @@ -13,167 +13,314 @@ extern "C" { +/* + * Class: edu_wpi_first_hal_sim_mockdata_PWMDataJNI + * Method: registerInitializedCallback + * Signature: (ILjava/lang/Object;Z)I + */ JNIEXPORT jint JNICALL -Java_edu_wpi_first_hal_sim_mockdata_PWMDataJNI_registerInitializedCallback( - JNIEnv* env, jclass, jint index, jobject callback, jboolean initialNotify) { +Java_edu_wpi_first_hal_sim_mockdata_PWMDataJNI_registerInitializedCallback + (JNIEnv* env, jclass, jint index, jobject callback, jboolean initialNotify) +{ return sim::AllocateCallback(env, index, callback, initialNotify, &HALSIM_RegisterPWMInitializedCallback); } +/* + * Class: edu_wpi_first_hal_sim_mockdata_PWMDataJNI + * Method: cancelInitializedCallback + * Signature: (II)V + */ JNIEXPORT void JNICALL -Java_edu_wpi_first_hal_sim_mockdata_PWMDataJNI_cancelInitializedCallback( - JNIEnv* env, jclass, jint index, jint handle) { +Java_edu_wpi_first_hal_sim_mockdata_PWMDataJNI_cancelInitializedCallback + (JNIEnv* env, jclass, jint index, jint handle) +{ return sim::FreeCallback(env, handle, index, &HALSIM_CancelPWMInitializedCallback); } +/* + * Class: edu_wpi_first_hal_sim_mockdata_PWMDataJNI + * Method: getInitialized + * Signature: (I)Z + */ JNIEXPORT jboolean JNICALL -Java_edu_wpi_first_hal_sim_mockdata_PWMDataJNI_getInitialized(JNIEnv*, jclass, - jint index) { +Java_edu_wpi_first_hal_sim_mockdata_PWMDataJNI_getInitialized + (JNIEnv*, jclass, jint index) +{ return HALSIM_GetPWMInitialized(index); } +/* + * Class: edu_wpi_first_hal_sim_mockdata_PWMDataJNI + * Method: setInitialized + * Signature: (IZ)V + */ JNIEXPORT void JNICALL -Java_edu_wpi_first_hal_sim_mockdata_PWMDataJNI_setInitialized(JNIEnv*, jclass, - jint index, - jboolean value) { +Java_edu_wpi_first_hal_sim_mockdata_PWMDataJNI_setInitialized + (JNIEnv*, jclass, jint index, jboolean value) +{ HALSIM_SetPWMInitialized(index, value); } +/* + * Class: edu_wpi_first_hal_sim_mockdata_PWMDataJNI + * Method: registerRawValueCallback + * Signature: (ILjava/lang/Object;Z)I + */ JNIEXPORT jint JNICALL -Java_edu_wpi_first_hal_sim_mockdata_PWMDataJNI_registerRawValueCallback( - JNIEnv* env, jclass, jint index, jobject callback, jboolean initialNotify) { +Java_edu_wpi_first_hal_sim_mockdata_PWMDataJNI_registerRawValueCallback + (JNIEnv* env, jclass, jint index, jobject callback, jboolean initialNotify) +{ return sim::AllocateCallback(env, index, callback, initialNotify, &HALSIM_RegisterPWMRawValueCallback); } +/* + * Class: edu_wpi_first_hal_sim_mockdata_PWMDataJNI + * Method: cancelRawValueCallback + * Signature: (II)V + */ JNIEXPORT void JNICALL -Java_edu_wpi_first_hal_sim_mockdata_PWMDataJNI_cancelRawValueCallback( - JNIEnv* env, jclass, jint index, jint handle) { +Java_edu_wpi_first_hal_sim_mockdata_PWMDataJNI_cancelRawValueCallback + (JNIEnv* env, jclass, jint index, jint handle) +{ return sim::FreeCallback(env, handle, index, &HALSIM_CancelPWMRawValueCallback); } +/* + * Class: edu_wpi_first_hal_sim_mockdata_PWMDataJNI + * Method: getRawValue + * Signature: (I)I + */ JNIEXPORT jint JNICALL -Java_edu_wpi_first_hal_sim_mockdata_PWMDataJNI_getRawValue(JNIEnv*, jclass, - jint index) { +Java_edu_wpi_first_hal_sim_mockdata_PWMDataJNI_getRawValue + (JNIEnv*, jclass, jint index) +{ return HALSIM_GetPWMRawValue(index); } +/* + * Class: edu_wpi_first_hal_sim_mockdata_PWMDataJNI + * Method: setRawValue + * Signature: (II)V + */ JNIEXPORT void JNICALL -Java_edu_wpi_first_hal_sim_mockdata_PWMDataJNI_setRawValue(JNIEnv*, jclass, - jint index, - jint value) { +Java_edu_wpi_first_hal_sim_mockdata_PWMDataJNI_setRawValue + (JNIEnv*, jclass, jint index, jint value) +{ HALSIM_SetPWMRawValue(index, value); } +/* + * Class: edu_wpi_first_hal_sim_mockdata_PWMDataJNI + * Method: registerSpeedCallback + * Signature: (ILjava/lang/Object;Z)I + */ JNIEXPORT jint JNICALL -Java_edu_wpi_first_hal_sim_mockdata_PWMDataJNI_registerSpeedCallback( - JNIEnv* env, jclass, jint index, jobject callback, jboolean initialNotify) { +Java_edu_wpi_first_hal_sim_mockdata_PWMDataJNI_registerSpeedCallback + (JNIEnv* env, jclass, jint index, jobject callback, jboolean initialNotify) +{ return sim::AllocateCallback(env, index, callback, initialNotify, &HALSIM_RegisterPWMSpeedCallback); } +/* + * Class: edu_wpi_first_hal_sim_mockdata_PWMDataJNI + * Method: cancelSpeedCallback + * Signature: (II)V + */ JNIEXPORT void JNICALL -Java_edu_wpi_first_hal_sim_mockdata_PWMDataJNI_cancelSpeedCallback( - JNIEnv* env, jclass, jint index, jint handle) { +Java_edu_wpi_first_hal_sim_mockdata_PWMDataJNI_cancelSpeedCallback + (JNIEnv* env, jclass, jint index, jint handle) +{ return sim::FreeCallback(env, handle, index, &HALSIM_CancelPWMSpeedCallback); } +/* + * Class: edu_wpi_first_hal_sim_mockdata_PWMDataJNI + * Method: getSpeed + * Signature: (I)D + */ JNIEXPORT jdouble JNICALL -Java_edu_wpi_first_hal_sim_mockdata_PWMDataJNI_getSpeed(JNIEnv*, jclass, - jint index) { +Java_edu_wpi_first_hal_sim_mockdata_PWMDataJNI_getSpeed + (JNIEnv*, jclass, jint index) +{ return HALSIM_GetPWMSpeed(index); } -JNIEXPORT void JNICALL Java_edu_wpi_first_hal_sim_mockdata_PWMDataJNI_setSpeed( - JNIEnv*, jclass, jint index, jdouble value) { +/* + * Class: edu_wpi_first_hal_sim_mockdata_PWMDataJNI + * Method: setSpeed + * Signature: (ID)V + */ +JNIEXPORT void JNICALL +Java_edu_wpi_first_hal_sim_mockdata_PWMDataJNI_setSpeed + (JNIEnv*, jclass, jint index, jdouble value) +{ HALSIM_SetPWMSpeed(index, value); } +/* + * Class: edu_wpi_first_hal_sim_mockdata_PWMDataJNI + * Method: registerPositionCallback + * Signature: (ILjava/lang/Object;Z)I + */ JNIEXPORT jint JNICALL -Java_edu_wpi_first_hal_sim_mockdata_PWMDataJNI_registerPositionCallback( - JNIEnv* env, jclass, jint index, jobject callback, jboolean initialNotify) { +Java_edu_wpi_first_hal_sim_mockdata_PWMDataJNI_registerPositionCallback + (JNIEnv* env, jclass, jint index, jobject callback, jboolean initialNotify) +{ return sim::AllocateCallback(env, index, callback, initialNotify, &HALSIM_RegisterPWMPositionCallback); } +/* + * Class: edu_wpi_first_hal_sim_mockdata_PWMDataJNI + * Method: cancelPositionCallback + * Signature: (II)V + */ JNIEXPORT void JNICALL -Java_edu_wpi_first_hal_sim_mockdata_PWMDataJNI_cancelPositionCallback( - JNIEnv* env, jclass, jint index, jint handle) { +Java_edu_wpi_first_hal_sim_mockdata_PWMDataJNI_cancelPositionCallback + (JNIEnv* env, jclass, jint index, jint handle) +{ return sim::FreeCallback(env, handle, index, &HALSIM_CancelPWMPositionCallback); } +/* + * Class: edu_wpi_first_hal_sim_mockdata_PWMDataJNI + * Method: getPosition + * Signature: (I)D + */ JNIEXPORT jdouble JNICALL -Java_edu_wpi_first_hal_sim_mockdata_PWMDataJNI_getPosition(JNIEnv*, jclass, - jint index) { +Java_edu_wpi_first_hal_sim_mockdata_PWMDataJNI_getPosition + (JNIEnv*, jclass, jint index) +{ return HALSIM_GetPWMPosition(index); } +/* + * Class: edu_wpi_first_hal_sim_mockdata_PWMDataJNI + * Method: setPosition + * Signature: (ID)V + */ JNIEXPORT void JNICALL -Java_edu_wpi_first_hal_sim_mockdata_PWMDataJNI_setPosition(JNIEnv*, jclass, - jint index, - jdouble value) { +Java_edu_wpi_first_hal_sim_mockdata_PWMDataJNI_setPosition + (JNIEnv*, jclass, jint index, jdouble value) +{ HALSIM_SetPWMPosition(index, value); } +/* + * Class: edu_wpi_first_hal_sim_mockdata_PWMDataJNI + * Method: registerPeriodScaleCallback + * Signature: (ILjava/lang/Object;Z)I + */ JNIEXPORT jint JNICALL -Java_edu_wpi_first_hal_sim_mockdata_PWMDataJNI_registerPeriodScaleCallback( - JNIEnv* env, jclass, jint index, jobject callback, jboolean initialNotify) { +Java_edu_wpi_first_hal_sim_mockdata_PWMDataJNI_registerPeriodScaleCallback + (JNIEnv* env, jclass, jint index, jobject callback, jboolean initialNotify) +{ return sim::AllocateCallback(env, index, callback, initialNotify, &HALSIM_RegisterPWMPeriodScaleCallback); } +/* + * Class: edu_wpi_first_hal_sim_mockdata_PWMDataJNI + * Method: cancelPeriodScaleCallback + * Signature: (II)V + */ JNIEXPORT void JNICALL -Java_edu_wpi_first_hal_sim_mockdata_PWMDataJNI_cancelPeriodScaleCallback( - JNIEnv* env, jclass, jint index, jint handle) { +Java_edu_wpi_first_hal_sim_mockdata_PWMDataJNI_cancelPeriodScaleCallback + (JNIEnv* env, jclass, jint index, jint handle) +{ return sim::FreeCallback(env, handle, index, &HALSIM_CancelPWMPeriodScaleCallback); } +/* + * Class: edu_wpi_first_hal_sim_mockdata_PWMDataJNI + * Method: getPeriodScale + * Signature: (I)I + */ JNIEXPORT jint JNICALL -Java_edu_wpi_first_hal_sim_mockdata_PWMDataJNI_getPeriodScale(JNIEnv*, jclass, - jint index) { +Java_edu_wpi_first_hal_sim_mockdata_PWMDataJNI_getPeriodScale + (JNIEnv*, jclass, jint index) +{ return HALSIM_GetPWMPeriodScale(index); } +/* + * Class: edu_wpi_first_hal_sim_mockdata_PWMDataJNI + * Method: setPeriodScale + * Signature: (II)V + */ JNIEXPORT void JNICALL -Java_edu_wpi_first_hal_sim_mockdata_PWMDataJNI_setPeriodScale(JNIEnv*, jclass, - jint index, - jint value) { +Java_edu_wpi_first_hal_sim_mockdata_PWMDataJNI_setPeriodScale + (JNIEnv*, jclass, jint index, jint value) +{ HALSIM_SetPWMPeriodScale(index, value); } +/* + * Class: edu_wpi_first_hal_sim_mockdata_PWMDataJNI + * Method: registerZeroLatchCallback + * Signature: (ILjava/lang/Object;Z)I + */ JNIEXPORT jint JNICALL -Java_edu_wpi_first_hal_sim_mockdata_PWMDataJNI_registerZeroLatchCallback( - JNIEnv* env, jclass, jint index, jobject callback, jboolean initialNotify) { +Java_edu_wpi_first_hal_sim_mockdata_PWMDataJNI_registerZeroLatchCallback + (JNIEnv* env, jclass, jint index, jobject callback, jboolean initialNotify) +{ return sim::AllocateCallback(env, index, callback, initialNotify, &HALSIM_RegisterPWMZeroLatchCallback); } +/* + * Class: edu_wpi_first_hal_sim_mockdata_PWMDataJNI + * Method: cancelZeroLatchCallback + * Signature: (II)V + */ JNIEXPORT void JNICALL -Java_edu_wpi_first_hal_sim_mockdata_PWMDataJNI_cancelZeroLatchCallback( - JNIEnv* env, jclass, jint index, jint handle) { +Java_edu_wpi_first_hal_sim_mockdata_PWMDataJNI_cancelZeroLatchCallback + (JNIEnv* env, jclass, jint index, jint handle) +{ return sim::FreeCallback(env, handle, index, &HALSIM_CancelPWMZeroLatchCallback); } +/* + * Class: edu_wpi_first_hal_sim_mockdata_PWMDataJNI + * Method: getZeroLatch + * Signature: (I)Z + */ JNIEXPORT jboolean JNICALL -Java_edu_wpi_first_hal_sim_mockdata_PWMDataJNI_getZeroLatch(JNIEnv*, jclass, - jint index) { +Java_edu_wpi_first_hal_sim_mockdata_PWMDataJNI_getZeroLatch + (JNIEnv*, jclass, jint index) +{ return HALSIM_GetPWMZeroLatch(index); } +/* + * Class: edu_wpi_first_hal_sim_mockdata_PWMDataJNI + * Method: setZeroLatch + * Signature: (IZ)V + */ JNIEXPORT void JNICALL -Java_edu_wpi_first_hal_sim_mockdata_PWMDataJNI_setZeroLatch(JNIEnv*, jclass, - jint index, - jboolean value) { +Java_edu_wpi_first_hal_sim_mockdata_PWMDataJNI_setZeroLatch + (JNIEnv*, jclass, jint index, jboolean value) +{ HALSIM_SetPWMZeroLatch(index, value); } -JNIEXPORT void JNICALL Java_edu_wpi_first_hal_sim_mockdata_PWMDataJNI_resetData( - JNIEnv*, jclass, jint index) { +/* + * Class: edu_wpi_first_hal_sim_mockdata_PWMDataJNI + * Method: resetData + * Signature: (I)V + */ +JNIEXPORT void JNICALL +Java_edu_wpi_first_hal_sim_mockdata_PWMDataJNI_resetData + (JNIEnv*, jclass, jint index) +{ HALSIM_ResetPWMData(index); } diff --git a/hal/src/main/native/sim/jni/RelayDataJNI.cpp b/hal/src/main/native/sim/jni/RelayDataJNI.cpp index d6de1efdac..72c5732e40 100644 --- a/hal/src/main/native/sim/jni/RelayDataJNI.cpp +++ b/hal/src/main/native/sim/jni/RelayDataJNI.cpp @@ -13,115 +13,215 @@ extern "C" { +/* + * Class: edu_wpi_first_hal_sim_mockdata_RelayDataJNI + * Method: registerInitializedForwardCallback + * Signature: (ILjava/lang/Object;Z)I + */ JNIEXPORT jint JNICALL -Java_edu_wpi_first_hal_sim_mockdata_RelayDataJNI_registerInitializedForwardCallback( - JNIEnv* env, jclass, jint index, jobject callback, jboolean initialNotify) { +Java_edu_wpi_first_hal_sim_mockdata_RelayDataJNI_registerInitializedForwardCallback + (JNIEnv* env, jclass, jint index, jobject callback, jboolean initialNotify) +{ return sim::AllocateCallback(env, index, callback, initialNotify, &HALSIM_RegisterRelayInitializedForwardCallback); } +/* + * Class: edu_wpi_first_hal_sim_mockdata_RelayDataJNI + * Method: cancelInitializedForwardCallback + * Signature: (II)V + */ JNIEXPORT void JNICALL -Java_edu_wpi_first_hal_sim_mockdata_RelayDataJNI_cancelInitializedForwardCallback( - JNIEnv* env, jclass, jint index, jint handle) { +Java_edu_wpi_first_hal_sim_mockdata_RelayDataJNI_cancelInitializedForwardCallback + (JNIEnv* env, jclass, jint index, jint handle) +{ return sim::FreeCallback(env, handle, index, &HALSIM_CancelRelayInitializedForwardCallback); } +/* + * Class: edu_wpi_first_hal_sim_mockdata_RelayDataJNI + * Method: getInitializedForward + * Signature: (I)Z + */ JNIEXPORT jboolean JNICALL -Java_edu_wpi_first_hal_sim_mockdata_RelayDataJNI_getInitializedForward( - JNIEnv*, jclass, jint index) { +Java_edu_wpi_first_hal_sim_mockdata_RelayDataJNI_getInitializedForward + (JNIEnv*, jclass, jint index) +{ return HALSIM_GetRelayInitializedForward(index); } +/* + * Class: edu_wpi_first_hal_sim_mockdata_RelayDataJNI + * Method: setInitializedForward + * Signature: (IZ)V + */ JNIEXPORT void JNICALL -Java_edu_wpi_first_hal_sim_mockdata_RelayDataJNI_setInitializedForward( - JNIEnv*, jclass, jint index, jboolean value) { +Java_edu_wpi_first_hal_sim_mockdata_RelayDataJNI_setInitializedForward + (JNIEnv*, jclass, jint index, jboolean value) +{ HALSIM_SetRelayInitializedForward(index, value); } +/* + * Class: edu_wpi_first_hal_sim_mockdata_RelayDataJNI + * Method: registerInitializedReverseCallback + * Signature: (ILjava/lang/Object;Z)I + */ JNIEXPORT jint JNICALL -Java_edu_wpi_first_hal_sim_mockdata_RelayDataJNI_registerInitializedReverseCallback( - JNIEnv* env, jclass, jint index, jobject callback, jboolean initialNotify) { +Java_edu_wpi_first_hal_sim_mockdata_RelayDataJNI_registerInitializedReverseCallback + (JNIEnv* env, jclass, jint index, jobject callback, jboolean initialNotify) +{ return sim::AllocateCallback(env, index, callback, initialNotify, &HALSIM_RegisterRelayInitializedReverseCallback); } +/* + * Class: edu_wpi_first_hal_sim_mockdata_RelayDataJNI + * Method: cancelInitializedReverseCallback + * Signature: (II)V + */ JNIEXPORT void JNICALL -Java_edu_wpi_first_hal_sim_mockdata_RelayDataJNI_cancelInitializedReverseCallback( - JNIEnv* env, jclass, jint index, jint handle) { +Java_edu_wpi_first_hal_sim_mockdata_RelayDataJNI_cancelInitializedReverseCallback + (JNIEnv* env, jclass, jint index, jint handle) +{ return sim::FreeCallback(env, handle, index, &HALSIM_CancelRelayInitializedReverseCallback); } +/* + * Class: edu_wpi_first_hal_sim_mockdata_RelayDataJNI + * Method: getInitializedReverse + * Signature: (I)Z + */ JNIEXPORT jboolean JNICALL -Java_edu_wpi_first_hal_sim_mockdata_RelayDataJNI_getInitializedReverse( - JNIEnv*, jclass, jint index) { +Java_edu_wpi_first_hal_sim_mockdata_RelayDataJNI_getInitializedReverse + (JNIEnv*, jclass, jint index) +{ return HALSIM_GetRelayInitializedReverse(index); } +/* + * Class: edu_wpi_first_hal_sim_mockdata_RelayDataJNI + * Method: setInitializedReverse + * Signature: (IZ)V + */ JNIEXPORT void JNICALL -Java_edu_wpi_first_hal_sim_mockdata_RelayDataJNI_setInitializedReverse( - JNIEnv*, jclass, jint index, jboolean value) { +Java_edu_wpi_first_hal_sim_mockdata_RelayDataJNI_setInitializedReverse + (JNIEnv*, jclass, jint index, jboolean value) +{ HALSIM_SetRelayInitializedReverse(index, value); } +/* + * Class: edu_wpi_first_hal_sim_mockdata_RelayDataJNI + * Method: registerForwardCallback + * Signature: (ILjava/lang/Object;Z)I + */ JNIEXPORT jint JNICALL -Java_edu_wpi_first_hal_sim_mockdata_RelayDataJNI_registerForwardCallback( - JNIEnv* env, jclass, jint index, jobject callback, jboolean initialNotify) { +Java_edu_wpi_first_hal_sim_mockdata_RelayDataJNI_registerForwardCallback + (JNIEnv* env, jclass, jint index, jobject callback, jboolean initialNotify) +{ return sim::AllocateCallback(env, index, callback, initialNotify, &HALSIM_RegisterRelayForwardCallback); } +/* + * Class: edu_wpi_first_hal_sim_mockdata_RelayDataJNI + * Method: cancelForwardCallback + * Signature: (II)V + */ JNIEXPORT void JNICALL -Java_edu_wpi_first_hal_sim_mockdata_RelayDataJNI_cancelForwardCallback( - JNIEnv* env, jclass, jint index, jint handle) { +Java_edu_wpi_first_hal_sim_mockdata_RelayDataJNI_cancelForwardCallback + (JNIEnv* env, jclass, jint index, jint handle) +{ return sim::FreeCallback(env, handle, index, &HALSIM_CancelRelayForwardCallback); } +/* + * Class: edu_wpi_first_hal_sim_mockdata_RelayDataJNI + * Method: getForward + * Signature: (I)Z + */ JNIEXPORT jboolean JNICALL -Java_edu_wpi_first_hal_sim_mockdata_RelayDataJNI_getForward(JNIEnv*, jclass, - jint index) { +Java_edu_wpi_first_hal_sim_mockdata_RelayDataJNI_getForward + (JNIEnv*, jclass, jint index) +{ return HALSIM_GetRelayForward(index); } +/* + * Class: edu_wpi_first_hal_sim_mockdata_RelayDataJNI + * Method: setForward + * Signature: (IZ)V + */ JNIEXPORT void JNICALL -Java_edu_wpi_first_hal_sim_mockdata_RelayDataJNI_setForward(JNIEnv*, jclass, - jint index, - jboolean value) { +Java_edu_wpi_first_hal_sim_mockdata_RelayDataJNI_setForward + (JNIEnv*, jclass, jint index, jboolean value) +{ HALSIM_SetRelayForward(index, value); } +/* + * Class: edu_wpi_first_hal_sim_mockdata_RelayDataJNI + * Method: registerReverseCallback + * Signature: (ILjava/lang/Object;Z)I + */ JNIEXPORT jint JNICALL -Java_edu_wpi_first_hal_sim_mockdata_RelayDataJNI_registerReverseCallback( - JNIEnv* env, jclass, jint index, jobject callback, jboolean initialNotify) { +Java_edu_wpi_first_hal_sim_mockdata_RelayDataJNI_registerReverseCallback + (JNIEnv* env, jclass, jint index, jobject callback, jboolean initialNotify) +{ return sim::AllocateCallback(env, index, callback, initialNotify, &HALSIM_RegisterRelayReverseCallback); } +/* + * Class: edu_wpi_first_hal_sim_mockdata_RelayDataJNI + * Method: cancelReverseCallback + * Signature: (II)V + */ JNIEXPORT void JNICALL -Java_edu_wpi_first_hal_sim_mockdata_RelayDataJNI_cancelReverseCallback( - JNIEnv* env, jclass, jint index, jint handle) { +Java_edu_wpi_first_hal_sim_mockdata_RelayDataJNI_cancelReverseCallback + (JNIEnv* env, jclass, jint index, jint handle) +{ return sim::FreeCallback(env, handle, index, &HALSIM_CancelRelayReverseCallback); } +/* + * Class: edu_wpi_first_hal_sim_mockdata_RelayDataJNI + * Method: getReverse + * Signature: (I)Z + */ JNIEXPORT jboolean JNICALL -Java_edu_wpi_first_hal_sim_mockdata_RelayDataJNI_getReverse(JNIEnv*, jclass, - jint index) { +Java_edu_wpi_first_hal_sim_mockdata_RelayDataJNI_getReverse + (JNIEnv*, jclass, jint index) +{ return HALSIM_GetRelayReverse(index); } +/* + * Class: edu_wpi_first_hal_sim_mockdata_RelayDataJNI + * Method: setReverse + * Signature: (IZ)V + */ JNIEXPORT void JNICALL -Java_edu_wpi_first_hal_sim_mockdata_RelayDataJNI_setReverse(JNIEnv*, jclass, - jint index, - jboolean value) { +Java_edu_wpi_first_hal_sim_mockdata_RelayDataJNI_setReverse + (JNIEnv*, jclass, jint index, jboolean value) +{ HALSIM_SetRelayReverse(index, value); } +/* + * Class: edu_wpi_first_hal_sim_mockdata_RelayDataJNI + * Method: resetData + * Signature: (I)V + */ JNIEXPORT void JNICALL -Java_edu_wpi_first_hal_sim_mockdata_RelayDataJNI_resetData(JNIEnv*, jclass, - jint index) { +Java_edu_wpi_first_hal_sim_mockdata_RelayDataJNI_resetData + (JNIEnv*, jclass, jint index) +{ HALSIM_ResetRelayData(index); } diff --git a/hal/src/main/native/sim/jni/RoboRioDataJNI.cpp b/hal/src/main/native/sim/jni/RoboRioDataJNI.cpp index a22c315b5e..eb0430d25e 100644 --- a/hal/src/main/native/sim/jni/RoboRioDataJNI.cpp +++ b/hal/src/main/native/sim/jni/RoboRioDataJNI.cpp @@ -13,410 +13,765 @@ extern "C" { +/* + * Class: edu_wpi_first_hal_sim_mockdata_RoboRioDataJNI + * Method: registerFPGAButtonCallback + * Signature: (ILjava/lang/Object;Z)I + */ JNIEXPORT jint JNICALL -Java_edu_wpi_first_hal_sim_mockdata_RoboRioDataJNI_registerFPGAButtonCallback( - JNIEnv* env, jclass, jint index, jobject callback, jboolean initialNotify) { +Java_edu_wpi_first_hal_sim_mockdata_RoboRioDataJNI_registerFPGAButtonCallback + (JNIEnv* env, jclass, jint index, jobject callback, jboolean initialNotify) +{ return sim::AllocateCallback(env, index, callback, initialNotify, &HALSIM_RegisterRoboRioFPGAButtonCallback); } +/* + * Class: edu_wpi_first_hal_sim_mockdata_RoboRioDataJNI + * Method: cancelFPGAButtonCallback + * Signature: (II)V + */ JNIEXPORT void JNICALL -Java_edu_wpi_first_hal_sim_mockdata_RoboRioDataJNI_cancelFPGAButtonCallback( - JNIEnv* env, jclass, jint index, jint handle) { +Java_edu_wpi_first_hal_sim_mockdata_RoboRioDataJNI_cancelFPGAButtonCallback + (JNIEnv* env, jclass, jint index, jint handle) +{ return sim::FreeCallback(env, handle, index, &HALSIM_CancelRoboRioFPGAButtonCallback); } +/* + * Class: edu_wpi_first_hal_sim_mockdata_RoboRioDataJNI + * Method: getFPGAButton + * Signature: (I)Z + */ JNIEXPORT jboolean JNICALL -Java_edu_wpi_first_hal_sim_mockdata_RoboRioDataJNI_getFPGAButton(JNIEnv*, - jclass, - jint index) { +Java_edu_wpi_first_hal_sim_mockdata_RoboRioDataJNI_getFPGAButton + (JNIEnv*, jclass, jint index) +{ return HALSIM_GetRoboRioFPGAButton(index); } +/* + * Class: edu_wpi_first_hal_sim_mockdata_RoboRioDataJNI + * Method: setFPGAButton + * Signature: (IZ)V + */ JNIEXPORT void JNICALL -Java_edu_wpi_first_hal_sim_mockdata_RoboRioDataJNI_setFPGAButton( - JNIEnv*, jclass, jint index, jboolean value) { +Java_edu_wpi_first_hal_sim_mockdata_RoboRioDataJNI_setFPGAButton + (JNIEnv*, jclass, jint index, jboolean value) +{ HALSIM_SetRoboRioFPGAButton(index, value); } +/* + * Class: edu_wpi_first_hal_sim_mockdata_RoboRioDataJNI + * Method: registerVInVoltageCallback + * Signature: (ILjava/lang/Object;Z)I + */ JNIEXPORT jint JNICALL -Java_edu_wpi_first_hal_sim_mockdata_RoboRioDataJNI_registerVInVoltageCallback( - JNIEnv* env, jclass, jint index, jobject callback, jboolean initialNotify) { +Java_edu_wpi_first_hal_sim_mockdata_RoboRioDataJNI_registerVInVoltageCallback + (JNIEnv* env, jclass, jint index, jobject callback, jboolean initialNotify) +{ return sim::AllocateCallback(env, index, callback, initialNotify, &HALSIM_RegisterRoboRioVInVoltageCallback); } +/* + * Class: edu_wpi_first_hal_sim_mockdata_RoboRioDataJNI + * Method: cancelVInVoltageCallback + * Signature: (II)V + */ JNIEXPORT void JNICALL -Java_edu_wpi_first_hal_sim_mockdata_RoboRioDataJNI_cancelVInVoltageCallback( - JNIEnv* env, jclass, jint index, jint handle) { +Java_edu_wpi_first_hal_sim_mockdata_RoboRioDataJNI_cancelVInVoltageCallback + (JNIEnv* env, jclass, jint index, jint handle) +{ return sim::FreeCallback(env, handle, index, &HALSIM_CancelRoboRioVInVoltageCallback); } +/* + * Class: edu_wpi_first_hal_sim_mockdata_RoboRioDataJNI + * Method: getVInVoltage + * Signature: (I)D + */ JNIEXPORT jdouble JNICALL -Java_edu_wpi_first_hal_sim_mockdata_RoboRioDataJNI_getVInVoltage(JNIEnv*, - jclass, - jint index) { +Java_edu_wpi_first_hal_sim_mockdata_RoboRioDataJNI_getVInVoltage + (JNIEnv*, jclass, jint index) +{ return HALSIM_GetRoboRioVInVoltage(index); } +/* + * Class: edu_wpi_first_hal_sim_mockdata_RoboRioDataJNI + * Method: setVInVoltage + * Signature: (ID)V + */ JNIEXPORT void JNICALL -Java_edu_wpi_first_hal_sim_mockdata_RoboRioDataJNI_setVInVoltage( - JNIEnv*, jclass, jint index, jdouble value) { +Java_edu_wpi_first_hal_sim_mockdata_RoboRioDataJNI_setVInVoltage + (JNIEnv*, jclass, jint index, jdouble value) +{ HALSIM_SetRoboRioVInVoltage(index, value); } +/* + * Class: edu_wpi_first_hal_sim_mockdata_RoboRioDataJNI + * Method: registerVInCurrentCallback + * Signature: (ILjava/lang/Object;Z)I + */ JNIEXPORT jint JNICALL -Java_edu_wpi_first_hal_sim_mockdata_RoboRioDataJNI_registerVInCurrentCallback( - JNIEnv* env, jclass, jint index, jobject callback, jboolean initialNotify) { +Java_edu_wpi_first_hal_sim_mockdata_RoboRioDataJNI_registerVInCurrentCallback + (JNIEnv* env, jclass, jint index, jobject callback, jboolean initialNotify) +{ return sim::AllocateCallback(env, index, callback, initialNotify, &HALSIM_RegisterRoboRioVInCurrentCallback); } +/* + * Class: edu_wpi_first_hal_sim_mockdata_RoboRioDataJNI + * Method: cancelVInCurrentCallback + * Signature: (II)V + */ JNIEXPORT void JNICALL -Java_edu_wpi_first_hal_sim_mockdata_RoboRioDataJNI_cancelVInCurrentCallback( - JNIEnv* env, jclass, jint index, jint handle) { +Java_edu_wpi_first_hal_sim_mockdata_RoboRioDataJNI_cancelVInCurrentCallback + (JNIEnv* env, jclass, jint index, jint handle) +{ return sim::FreeCallback(env, handle, index, &HALSIM_CancelRoboRioVInCurrentCallback); } +/* + * Class: edu_wpi_first_hal_sim_mockdata_RoboRioDataJNI + * Method: getVInCurrent + * Signature: (I)D + */ JNIEXPORT jdouble JNICALL -Java_edu_wpi_first_hal_sim_mockdata_RoboRioDataJNI_getVInCurrent(JNIEnv*, - jclass, - jint index) { +Java_edu_wpi_first_hal_sim_mockdata_RoboRioDataJNI_getVInCurrent + (JNIEnv*, jclass, jint index) +{ return HALSIM_GetRoboRioVInCurrent(index); } +/* + * Class: edu_wpi_first_hal_sim_mockdata_RoboRioDataJNI + * Method: setVInCurrent + * Signature: (ID)V + */ JNIEXPORT void JNICALL -Java_edu_wpi_first_hal_sim_mockdata_RoboRioDataJNI_setVInCurrent( - JNIEnv*, jclass, jint index, jdouble value) { +Java_edu_wpi_first_hal_sim_mockdata_RoboRioDataJNI_setVInCurrent + (JNIEnv*, jclass, jint index, jdouble value) +{ HALSIM_SetRoboRioVInCurrent(index, value); } +/* + * Class: edu_wpi_first_hal_sim_mockdata_RoboRioDataJNI + * Method: registerUserVoltage6VCallback + * Signature: (ILjava/lang/Object;Z)I + */ JNIEXPORT jint JNICALL -Java_edu_wpi_first_hal_sim_mockdata_RoboRioDataJNI_registerUserVoltage6VCallback( - JNIEnv* env, jclass, jint index, jobject callback, jboolean initialNotify) { +Java_edu_wpi_first_hal_sim_mockdata_RoboRioDataJNI_registerUserVoltage6VCallback + (JNIEnv* env, jclass, jint index, jobject callback, jboolean initialNotify) +{ return sim::AllocateCallback(env, index, callback, initialNotify, &HALSIM_RegisterRoboRioUserVoltage6VCallback); } +/* + * Class: edu_wpi_first_hal_sim_mockdata_RoboRioDataJNI + * Method: cancelUserVoltage6VCallback + * Signature: (II)V + */ JNIEXPORT void JNICALL -Java_edu_wpi_first_hal_sim_mockdata_RoboRioDataJNI_cancelUserVoltage6VCallback( - JNIEnv* env, jclass, jint index, jint handle) { +Java_edu_wpi_first_hal_sim_mockdata_RoboRioDataJNI_cancelUserVoltage6VCallback + (JNIEnv* env, jclass, jint index, jint handle) +{ return sim::FreeCallback(env, handle, index, &HALSIM_CancelRoboRioUserVoltage6VCallback); } +/* + * Class: edu_wpi_first_hal_sim_mockdata_RoboRioDataJNI + * Method: getUserVoltage6V + * Signature: (I)D + */ JNIEXPORT jdouble JNICALL -Java_edu_wpi_first_hal_sim_mockdata_RoboRioDataJNI_getUserVoltage6V( - JNIEnv*, jclass, jint index) { +Java_edu_wpi_first_hal_sim_mockdata_RoboRioDataJNI_getUserVoltage6V + (JNIEnv*, jclass, jint index) +{ return HALSIM_GetRoboRioUserVoltage6V(index); } +/* + * Class: edu_wpi_first_hal_sim_mockdata_RoboRioDataJNI + * Method: setUserVoltage6V + * Signature: (ID)V + */ JNIEXPORT void JNICALL -Java_edu_wpi_first_hal_sim_mockdata_RoboRioDataJNI_setUserVoltage6V( - JNIEnv*, jclass, jint index, jdouble value) { +Java_edu_wpi_first_hal_sim_mockdata_RoboRioDataJNI_setUserVoltage6V + (JNIEnv*, jclass, jint index, jdouble value) +{ HALSIM_SetRoboRioUserVoltage6V(index, value); } +/* + * Class: edu_wpi_first_hal_sim_mockdata_RoboRioDataJNI + * Method: registerUserCurrent6VCallback + * Signature: (ILjava/lang/Object;Z)I + */ JNIEXPORT jint JNICALL -Java_edu_wpi_first_hal_sim_mockdata_RoboRioDataJNI_registerUserCurrent6VCallback( - JNIEnv* env, jclass, jint index, jobject callback, jboolean initialNotify) { +Java_edu_wpi_first_hal_sim_mockdata_RoboRioDataJNI_registerUserCurrent6VCallback + (JNIEnv* env, jclass, jint index, jobject callback, jboolean initialNotify) +{ return sim::AllocateCallback(env, index, callback, initialNotify, &HALSIM_RegisterRoboRioUserCurrent6VCallback); } +/* + * Class: edu_wpi_first_hal_sim_mockdata_RoboRioDataJNI + * Method: cancelUserCurrent6VCallback + * Signature: (II)V + */ JNIEXPORT void JNICALL -Java_edu_wpi_first_hal_sim_mockdata_RoboRioDataJNI_cancelUserCurrent6VCallback( - JNIEnv* env, jclass, jint index, jint handle) { +Java_edu_wpi_first_hal_sim_mockdata_RoboRioDataJNI_cancelUserCurrent6VCallback + (JNIEnv* env, jclass, jint index, jint handle) +{ return sim::FreeCallback(env, handle, index, &HALSIM_CancelRoboRioUserCurrent6VCallback); } +/* + * Class: edu_wpi_first_hal_sim_mockdata_RoboRioDataJNI + * Method: getUserCurrent6V + * Signature: (I)D + */ JNIEXPORT jdouble JNICALL -Java_edu_wpi_first_hal_sim_mockdata_RoboRioDataJNI_getUserCurrent6V( - JNIEnv*, jclass, jint index) { +Java_edu_wpi_first_hal_sim_mockdata_RoboRioDataJNI_getUserCurrent6V + (JNIEnv*, jclass, jint index) +{ return HALSIM_GetRoboRioUserCurrent6V(index); } +/* + * Class: edu_wpi_first_hal_sim_mockdata_RoboRioDataJNI + * Method: setUserCurrent6V + * Signature: (ID)V + */ JNIEXPORT void JNICALL -Java_edu_wpi_first_hal_sim_mockdata_RoboRioDataJNI_setUserCurrent6V( - JNIEnv*, jclass, jint index, jdouble value) { +Java_edu_wpi_first_hal_sim_mockdata_RoboRioDataJNI_setUserCurrent6V + (JNIEnv*, jclass, jint index, jdouble value) +{ HALSIM_SetRoboRioUserCurrent6V(index, value); } +/* + * Class: edu_wpi_first_hal_sim_mockdata_RoboRioDataJNI + * Method: registerUserActive6VCallback + * Signature: (ILjava/lang/Object;Z)I + */ JNIEXPORT jint JNICALL -Java_edu_wpi_first_hal_sim_mockdata_RoboRioDataJNI_registerUserActive6VCallback( - JNIEnv* env, jclass, jint index, jobject callback, jboolean initialNotify) { +Java_edu_wpi_first_hal_sim_mockdata_RoboRioDataJNI_registerUserActive6VCallback + (JNIEnv* env, jclass, jint index, jobject callback, jboolean initialNotify) +{ return sim::AllocateCallback(env, index, callback, initialNotify, &HALSIM_RegisterRoboRioUserActive6VCallback); } +/* + * Class: edu_wpi_first_hal_sim_mockdata_RoboRioDataJNI + * Method: cancelUserActive6VCallback + * Signature: (II)V + */ JNIEXPORT void JNICALL -Java_edu_wpi_first_hal_sim_mockdata_RoboRioDataJNI_cancelUserActive6VCallback( - JNIEnv* env, jclass, jint index, jint handle) { +Java_edu_wpi_first_hal_sim_mockdata_RoboRioDataJNI_cancelUserActive6VCallback + (JNIEnv* env, jclass, jint index, jint handle) +{ return sim::FreeCallback(env, handle, index, &HALSIM_CancelRoboRioUserActive6VCallback); } +/* + * Class: edu_wpi_first_hal_sim_mockdata_RoboRioDataJNI + * Method: getUserActive6V + * Signature: (I)Z + */ JNIEXPORT jboolean JNICALL -Java_edu_wpi_first_hal_sim_mockdata_RoboRioDataJNI_getUserActive6V(JNIEnv*, - jclass, - jint index) { +Java_edu_wpi_first_hal_sim_mockdata_RoboRioDataJNI_getUserActive6V + (JNIEnv*, jclass, jint index) +{ return HALSIM_GetRoboRioUserActive6V(index); } +/* + * Class: edu_wpi_first_hal_sim_mockdata_RoboRioDataJNI + * Method: setUserActive6V + * Signature: (IZ)V + */ JNIEXPORT void JNICALL -Java_edu_wpi_first_hal_sim_mockdata_RoboRioDataJNI_setUserActive6V( - JNIEnv*, jclass, jint index, jboolean value) { +Java_edu_wpi_first_hal_sim_mockdata_RoboRioDataJNI_setUserActive6V + (JNIEnv*, jclass, jint index, jboolean value) +{ HALSIM_SetRoboRioUserActive6V(index, value); } +/* + * Class: edu_wpi_first_hal_sim_mockdata_RoboRioDataJNI + * Method: registerUserVoltage5VCallback + * Signature: (ILjava/lang/Object;Z)I + */ JNIEXPORT jint JNICALL -Java_edu_wpi_first_hal_sim_mockdata_RoboRioDataJNI_registerUserVoltage5VCallback( - JNIEnv* env, jclass, jint index, jobject callback, jboolean initialNotify) { +Java_edu_wpi_first_hal_sim_mockdata_RoboRioDataJNI_registerUserVoltage5VCallback + (JNIEnv* env, jclass, jint index, jobject callback, jboolean initialNotify) +{ return sim::AllocateCallback(env, index, callback, initialNotify, &HALSIM_RegisterRoboRioUserVoltage5VCallback); } +/* + * Class: edu_wpi_first_hal_sim_mockdata_RoboRioDataJNI + * Method: cancelUserVoltage5VCallback + * Signature: (II)V + */ JNIEXPORT void JNICALL -Java_edu_wpi_first_hal_sim_mockdata_RoboRioDataJNI_cancelUserVoltage5VCallback( - JNIEnv* env, jclass, jint index, jint handle) { +Java_edu_wpi_first_hal_sim_mockdata_RoboRioDataJNI_cancelUserVoltage5VCallback + (JNIEnv* env, jclass, jint index, jint handle) +{ return sim::FreeCallback(env, handle, index, &HALSIM_CancelRoboRioUserVoltage5VCallback); } +/* + * Class: edu_wpi_first_hal_sim_mockdata_RoboRioDataJNI + * Method: getUserVoltage5V + * Signature: (I)D + */ JNIEXPORT jdouble JNICALL -Java_edu_wpi_first_hal_sim_mockdata_RoboRioDataJNI_getUserVoltage5V( - JNIEnv*, jclass, jint index) { +Java_edu_wpi_first_hal_sim_mockdata_RoboRioDataJNI_getUserVoltage5V + (JNIEnv*, jclass, jint index) +{ return HALSIM_GetRoboRioUserVoltage5V(index); } +/* + * Class: edu_wpi_first_hal_sim_mockdata_RoboRioDataJNI + * Method: setUserVoltage5V + * Signature: (ID)V + */ JNIEXPORT void JNICALL -Java_edu_wpi_first_hal_sim_mockdata_RoboRioDataJNI_setUserVoltage5V( - JNIEnv*, jclass, jint index, jdouble value) { +Java_edu_wpi_first_hal_sim_mockdata_RoboRioDataJNI_setUserVoltage5V + (JNIEnv*, jclass, jint index, jdouble value) +{ HALSIM_SetRoboRioUserVoltage5V(index, value); } +/* + * Class: edu_wpi_first_hal_sim_mockdata_RoboRioDataJNI + * Method: registerUserCurrent5VCallback + * Signature: (ILjava/lang/Object;Z)I + */ JNIEXPORT jint JNICALL -Java_edu_wpi_first_hal_sim_mockdata_RoboRioDataJNI_registerUserCurrent5VCallback( - JNIEnv* env, jclass, jint index, jobject callback, jboolean initialNotify) { +Java_edu_wpi_first_hal_sim_mockdata_RoboRioDataJNI_registerUserCurrent5VCallback + (JNIEnv* env, jclass, jint index, jobject callback, jboolean initialNotify) +{ return sim::AllocateCallback(env, index, callback, initialNotify, &HALSIM_RegisterRoboRioUserCurrent5VCallback); } +/* + * Class: edu_wpi_first_hal_sim_mockdata_RoboRioDataJNI + * Method: cancelUserCurrent5VCallback + * Signature: (II)V + */ JNIEXPORT void JNICALL -Java_edu_wpi_first_hal_sim_mockdata_RoboRioDataJNI_cancelUserCurrent5VCallback( - JNIEnv* env, jclass, jint index, jint handle) { +Java_edu_wpi_first_hal_sim_mockdata_RoboRioDataJNI_cancelUserCurrent5VCallback + (JNIEnv* env, jclass, jint index, jint handle) +{ return sim::FreeCallback(env, handle, index, &HALSIM_CancelRoboRioUserCurrent5VCallback); } +/* + * Class: edu_wpi_first_hal_sim_mockdata_RoboRioDataJNI + * Method: getUserCurrent5V + * Signature: (I)D + */ JNIEXPORT jdouble JNICALL -Java_edu_wpi_first_hal_sim_mockdata_RoboRioDataJNI_getUserCurrent5V( - JNIEnv*, jclass, jint index) { +Java_edu_wpi_first_hal_sim_mockdata_RoboRioDataJNI_getUserCurrent5V + (JNIEnv*, jclass, jint index) +{ return HALSIM_GetRoboRioUserCurrent5V(index); } +/* + * Class: edu_wpi_first_hal_sim_mockdata_RoboRioDataJNI + * Method: setUserCurrent5V + * Signature: (ID)V + */ JNIEXPORT void JNICALL -Java_edu_wpi_first_hal_sim_mockdata_RoboRioDataJNI_setUserCurrent5V( - JNIEnv*, jclass, jint index, jdouble value) { +Java_edu_wpi_first_hal_sim_mockdata_RoboRioDataJNI_setUserCurrent5V + (JNIEnv*, jclass, jint index, jdouble value) +{ HALSIM_SetRoboRioUserCurrent5V(index, value); } +/* + * Class: edu_wpi_first_hal_sim_mockdata_RoboRioDataJNI + * Method: registerUserActive5VCallback + * Signature: (ILjava/lang/Object;Z)I + */ JNIEXPORT jint JNICALL -Java_edu_wpi_first_hal_sim_mockdata_RoboRioDataJNI_registerUserActive5VCallback( - JNIEnv* env, jclass, jint index, jobject callback, jboolean initialNotify) { +Java_edu_wpi_first_hal_sim_mockdata_RoboRioDataJNI_registerUserActive5VCallback + (JNIEnv* env, jclass, jint index, jobject callback, jboolean initialNotify) +{ return sim::AllocateCallback(env, index, callback, initialNotify, &HALSIM_RegisterRoboRioUserActive5VCallback); } +/* + * Class: edu_wpi_first_hal_sim_mockdata_RoboRioDataJNI + * Method: cancelUserActive5VCallback + * Signature: (II)V + */ JNIEXPORT void JNICALL -Java_edu_wpi_first_hal_sim_mockdata_RoboRioDataJNI_cancelUserActive5VCallback( - JNIEnv* env, jclass, jint index, jint handle) { +Java_edu_wpi_first_hal_sim_mockdata_RoboRioDataJNI_cancelUserActive5VCallback + (JNIEnv* env, jclass, jint index, jint handle) +{ return sim::FreeCallback(env, handle, index, &HALSIM_CancelRoboRioUserActive5VCallback); } +/* + * Class: edu_wpi_first_hal_sim_mockdata_RoboRioDataJNI + * Method: getUserActive5V + * Signature: (I)Z + */ JNIEXPORT jboolean JNICALL -Java_edu_wpi_first_hal_sim_mockdata_RoboRioDataJNI_getUserActive5V(JNIEnv*, - jclass, - jint index) { +Java_edu_wpi_first_hal_sim_mockdata_RoboRioDataJNI_getUserActive5V + (JNIEnv*, jclass, jint index) +{ return HALSIM_GetRoboRioUserActive5V(index); } +/* + * Class: edu_wpi_first_hal_sim_mockdata_RoboRioDataJNI + * Method: setUserActive5V + * Signature: (IZ)V + */ JNIEXPORT void JNICALL -Java_edu_wpi_first_hal_sim_mockdata_RoboRioDataJNI_setUserActive5V( - JNIEnv*, jclass, jint index, jboolean value) { +Java_edu_wpi_first_hal_sim_mockdata_RoboRioDataJNI_setUserActive5V + (JNIEnv*, jclass, jint index, jboolean value) +{ HALSIM_SetRoboRioUserActive5V(index, value); } +/* + * Class: edu_wpi_first_hal_sim_mockdata_RoboRioDataJNI + * Method: registerUserVoltage3V3Callback + * Signature: (ILjava/lang/Object;Z)I + */ JNIEXPORT jint JNICALL -Java_edu_wpi_first_hal_sim_mockdata_RoboRioDataJNI_registerUserVoltage3V3Callback( - JNIEnv* env, jclass, jint index, jobject callback, jboolean initialNotify) { +Java_edu_wpi_first_hal_sim_mockdata_RoboRioDataJNI_registerUserVoltage3V3Callback + (JNIEnv* env, jclass, jint index, jobject callback, jboolean initialNotify) +{ return sim::AllocateCallback(env, index, callback, initialNotify, &HALSIM_RegisterRoboRioUserVoltage3V3Callback); } +/* + * Class: edu_wpi_first_hal_sim_mockdata_RoboRioDataJNI + * Method: cancelUserVoltage3V3Callback + * Signature: (II)V + */ JNIEXPORT void JNICALL -Java_edu_wpi_first_hal_sim_mockdata_RoboRioDataJNI_cancelUserVoltage3V3Callback( - JNIEnv* env, jclass, jint index, jint handle) { +Java_edu_wpi_first_hal_sim_mockdata_RoboRioDataJNI_cancelUserVoltage3V3Callback + (JNIEnv* env, jclass, jint index, jint handle) +{ return sim::FreeCallback(env, handle, index, &HALSIM_CancelRoboRioUserVoltage3V3Callback); } +/* + * Class: edu_wpi_first_hal_sim_mockdata_RoboRioDataJNI + * Method: getUserVoltage3V3 + * Signature: (I)D + */ JNIEXPORT jdouble JNICALL -Java_edu_wpi_first_hal_sim_mockdata_RoboRioDataJNI_getUserVoltage3V3( - JNIEnv*, jclass, jint index) { +Java_edu_wpi_first_hal_sim_mockdata_RoboRioDataJNI_getUserVoltage3V3 + (JNIEnv*, jclass, jint index) +{ return HALSIM_GetRoboRioUserVoltage3V3(index); } +/* + * Class: edu_wpi_first_hal_sim_mockdata_RoboRioDataJNI + * Method: setUserVoltage3V3 + * Signature: (ID)V + */ JNIEXPORT void JNICALL -Java_edu_wpi_first_hal_sim_mockdata_RoboRioDataJNI_setUserVoltage3V3( - JNIEnv*, jclass, jint index, jdouble value) { +Java_edu_wpi_first_hal_sim_mockdata_RoboRioDataJNI_setUserVoltage3V3 + (JNIEnv*, jclass, jint index, jdouble value) +{ HALSIM_SetRoboRioUserVoltage3V3(index, value); } +/* + * Class: edu_wpi_first_hal_sim_mockdata_RoboRioDataJNI + * Method: registerUserCurrent3V3Callback + * Signature: (ILjava/lang/Object;Z)I + */ JNIEXPORT jint JNICALL -Java_edu_wpi_first_hal_sim_mockdata_RoboRioDataJNI_registerUserCurrent3V3Callback( - JNIEnv* env, jclass, jint index, jobject callback, jboolean initialNotify) { +Java_edu_wpi_first_hal_sim_mockdata_RoboRioDataJNI_registerUserCurrent3V3Callback + (JNIEnv* env, jclass, jint index, jobject callback, jboolean initialNotify) +{ return sim::AllocateCallback(env, index, callback, initialNotify, &HALSIM_RegisterRoboRioUserCurrent3V3Callback); } +/* + * Class: edu_wpi_first_hal_sim_mockdata_RoboRioDataJNI + * Method: cancelUserCurrent3V3Callback + * Signature: (II)V + */ JNIEXPORT void JNICALL -Java_edu_wpi_first_hal_sim_mockdata_RoboRioDataJNI_cancelUserCurrent3V3Callback( - JNIEnv* env, jclass, jint index, jint handle) { +Java_edu_wpi_first_hal_sim_mockdata_RoboRioDataJNI_cancelUserCurrent3V3Callback + (JNIEnv* env, jclass, jint index, jint handle) +{ return sim::FreeCallback(env, handle, index, &HALSIM_CancelRoboRioUserCurrent3V3Callback); } +/* + * Class: edu_wpi_first_hal_sim_mockdata_RoboRioDataJNI + * Method: getUserCurrent3V3 + * Signature: (I)D + */ JNIEXPORT jdouble JNICALL -Java_edu_wpi_first_hal_sim_mockdata_RoboRioDataJNI_getUserCurrent3V3( - JNIEnv*, jclass, jint index) { +Java_edu_wpi_first_hal_sim_mockdata_RoboRioDataJNI_getUserCurrent3V3 + (JNIEnv*, jclass, jint index) +{ return HALSIM_GetRoboRioUserCurrent3V3(index); } +/* + * Class: edu_wpi_first_hal_sim_mockdata_RoboRioDataJNI + * Method: setUserCurrent3V3 + * Signature: (ID)V + */ JNIEXPORT void JNICALL -Java_edu_wpi_first_hal_sim_mockdata_RoboRioDataJNI_setUserCurrent3V3( - JNIEnv*, jclass, jint index, jdouble value) { +Java_edu_wpi_first_hal_sim_mockdata_RoboRioDataJNI_setUserCurrent3V3 + (JNIEnv*, jclass, jint index, jdouble value) +{ HALSIM_SetRoboRioUserCurrent3V3(index, value); } +/* + * Class: edu_wpi_first_hal_sim_mockdata_RoboRioDataJNI + * Method: registerUserActive3V3Callback + * Signature: (ILjava/lang/Object;Z)I + */ JNIEXPORT jint JNICALL -Java_edu_wpi_first_hal_sim_mockdata_RoboRioDataJNI_registerUserActive3V3Callback( - JNIEnv* env, jclass, jint index, jobject callback, jboolean initialNotify) { +Java_edu_wpi_first_hal_sim_mockdata_RoboRioDataJNI_registerUserActive3V3Callback + (JNIEnv* env, jclass, jint index, jobject callback, jboolean initialNotify) +{ return sim::AllocateCallback(env, index, callback, initialNotify, &HALSIM_RegisterRoboRioUserActive3V3Callback); } +/* + * Class: edu_wpi_first_hal_sim_mockdata_RoboRioDataJNI + * Method: cancelUserActive3V3Callback + * Signature: (II)V + */ JNIEXPORT void JNICALL -Java_edu_wpi_first_hal_sim_mockdata_RoboRioDataJNI_cancelUserActive3V3Callback( - JNIEnv* env, jclass, jint index, jint handle) { +Java_edu_wpi_first_hal_sim_mockdata_RoboRioDataJNI_cancelUserActive3V3Callback + (JNIEnv* env, jclass, jint index, jint handle) +{ return sim::FreeCallback(env, handle, index, &HALSIM_CancelRoboRioUserActive3V3Callback); } +/* + * Class: edu_wpi_first_hal_sim_mockdata_RoboRioDataJNI + * Method: getUserActive3V3 + * Signature: (I)Z + */ JNIEXPORT jboolean JNICALL -Java_edu_wpi_first_hal_sim_mockdata_RoboRioDataJNI_getUserActive3V3( - JNIEnv*, jclass, jint index) { +Java_edu_wpi_first_hal_sim_mockdata_RoboRioDataJNI_getUserActive3V3 + (JNIEnv*, jclass, jint index) +{ return HALSIM_GetRoboRioUserActive3V3(index); } +/* + * Class: edu_wpi_first_hal_sim_mockdata_RoboRioDataJNI + * Method: setUserActive3V3 + * Signature: (IZ)V + */ JNIEXPORT void JNICALL -Java_edu_wpi_first_hal_sim_mockdata_RoboRioDataJNI_setUserActive3V3( - JNIEnv*, jclass, jint index, jboolean value) { +Java_edu_wpi_first_hal_sim_mockdata_RoboRioDataJNI_setUserActive3V3 + (JNIEnv*, jclass, jint index, jboolean value) +{ HALSIM_SetRoboRioUserActive3V3(index, value); } +/* + * Class: edu_wpi_first_hal_sim_mockdata_RoboRioDataJNI + * Method: registerUserFaults6VCallback + * Signature: (ILjava/lang/Object;Z)I + */ JNIEXPORT jint JNICALL -Java_edu_wpi_first_hal_sim_mockdata_RoboRioDataJNI_registerUserFaults6VCallback( - JNIEnv* env, jclass, jint index, jobject callback, jboolean initialNotify) { +Java_edu_wpi_first_hal_sim_mockdata_RoboRioDataJNI_registerUserFaults6VCallback + (JNIEnv* env, jclass, jint index, jobject callback, jboolean initialNotify) +{ return sim::AllocateCallback(env, index, callback, initialNotify, &HALSIM_RegisterRoboRioUserFaults6VCallback); } +/* + * Class: edu_wpi_first_hal_sim_mockdata_RoboRioDataJNI + * Method: cancelUserFaults6VCallback + * Signature: (II)V + */ JNIEXPORT void JNICALL -Java_edu_wpi_first_hal_sim_mockdata_RoboRioDataJNI_cancelUserFaults6VCallback( - JNIEnv* env, jclass, jint index, jint handle) { +Java_edu_wpi_first_hal_sim_mockdata_RoboRioDataJNI_cancelUserFaults6VCallback + (JNIEnv* env, jclass, jint index, jint handle) +{ return sim::FreeCallback(env, handle, index, &HALSIM_CancelRoboRioUserFaults6VCallback); } +/* + * Class: edu_wpi_first_hal_sim_mockdata_RoboRioDataJNI + * Method: getUserFaults6V + * Signature: (I)I + */ JNIEXPORT jint JNICALL -Java_edu_wpi_first_hal_sim_mockdata_RoboRioDataJNI_getUserFaults6V(JNIEnv*, - jclass, - jint index) { +Java_edu_wpi_first_hal_sim_mockdata_RoboRioDataJNI_getUserFaults6V + (JNIEnv*, jclass, jint index) +{ return HALSIM_GetRoboRioUserFaults6V(index); } +/* + * Class: edu_wpi_first_hal_sim_mockdata_RoboRioDataJNI + * Method: setUserFaults6V + * Signature: (II)V + */ JNIEXPORT void JNICALL -Java_edu_wpi_first_hal_sim_mockdata_RoboRioDataJNI_setUserFaults6V(JNIEnv*, - jclass, - jint index, - jint value) { +Java_edu_wpi_first_hal_sim_mockdata_RoboRioDataJNI_setUserFaults6V + (JNIEnv*, jclass, jint index, jint value) +{ HALSIM_SetRoboRioUserFaults6V(index, value); } +/* + * Class: edu_wpi_first_hal_sim_mockdata_RoboRioDataJNI + * Method: registerUserFaults5VCallback + * Signature: (ILjava/lang/Object;Z)I + */ JNIEXPORT jint JNICALL -Java_edu_wpi_first_hal_sim_mockdata_RoboRioDataJNI_registerUserFaults5VCallback( - JNIEnv* env, jclass, jint index, jobject callback, jboolean initialNotify) { +Java_edu_wpi_first_hal_sim_mockdata_RoboRioDataJNI_registerUserFaults5VCallback + (JNIEnv* env, jclass, jint index, jobject callback, jboolean initialNotify) +{ return sim::AllocateCallback(env, index, callback, initialNotify, &HALSIM_RegisterRoboRioUserFaults5VCallback); } +/* + * Class: edu_wpi_first_hal_sim_mockdata_RoboRioDataJNI + * Method: cancelUserFaults5VCallback + * Signature: (II)V + */ JNIEXPORT void JNICALL -Java_edu_wpi_first_hal_sim_mockdata_RoboRioDataJNI_cancelUserFaults5VCallback( - JNIEnv* env, jclass, jint index, jint handle) { +Java_edu_wpi_first_hal_sim_mockdata_RoboRioDataJNI_cancelUserFaults5VCallback + (JNIEnv* env, jclass, jint index, jint handle) +{ return sim::FreeCallback(env, handle, index, &HALSIM_CancelRoboRioUserFaults5VCallback); } +/* + * Class: edu_wpi_first_hal_sim_mockdata_RoboRioDataJNI + * Method: getUserFaults5V + * Signature: (I)I + */ JNIEXPORT jint JNICALL -Java_edu_wpi_first_hal_sim_mockdata_RoboRioDataJNI_getUserFaults5V(JNIEnv*, - jclass, - jint index) { +Java_edu_wpi_first_hal_sim_mockdata_RoboRioDataJNI_getUserFaults5V + (JNIEnv*, jclass, jint index) +{ return HALSIM_GetRoboRioUserFaults5V(index); } +/* + * Class: edu_wpi_first_hal_sim_mockdata_RoboRioDataJNI + * Method: setUserFaults5V + * Signature: (II)V + */ JNIEXPORT void JNICALL -Java_edu_wpi_first_hal_sim_mockdata_RoboRioDataJNI_setUserFaults5V(JNIEnv*, - jclass, - jint index, - jint value) { +Java_edu_wpi_first_hal_sim_mockdata_RoboRioDataJNI_setUserFaults5V + (JNIEnv*, jclass, jint index, jint value) +{ HALSIM_SetRoboRioUserFaults5V(index, value); } +/* + * Class: edu_wpi_first_hal_sim_mockdata_RoboRioDataJNI + * Method: registerUserFaults3V3Callback + * Signature: (ILjava/lang/Object;Z)I + */ JNIEXPORT jint JNICALL -Java_edu_wpi_first_hal_sim_mockdata_RoboRioDataJNI_registerUserFaults3V3Callback( - JNIEnv* env, jclass, jint index, jobject callback, jboolean initialNotify) { +Java_edu_wpi_first_hal_sim_mockdata_RoboRioDataJNI_registerUserFaults3V3Callback + (JNIEnv* env, jclass, jint index, jobject callback, jboolean initialNotify) +{ return sim::AllocateCallback(env, index, callback, initialNotify, &HALSIM_RegisterRoboRioUserFaults3V3Callback); } +/* + * Class: edu_wpi_first_hal_sim_mockdata_RoboRioDataJNI + * Method: cancelUserFaults3V3Callback + * Signature: (II)V + */ JNIEXPORT void JNICALL -Java_edu_wpi_first_hal_sim_mockdata_RoboRioDataJNI_cancelUserFaults3V3Callback( - JNIEnv* env, jclass, jint index, jint handle) { +Java_edu_wpi_first_hal_sim_mockdata_RoboRioDataJNI_cancelUserFaults3V3Callback + (JNIEnv* env, jclass, jint index, jint handle) +{ return sim::FreeCallback(env, handle, index, &HALSIM_CancelRoboRioUserFaults3V3Callback); } +/* + * Class: edu_wpi_first_hal_sim_mockdata_RoboRioDataJNI + * Method: getUserFaults3V3 + * Signature: (I)I + */ JNIEXPORT jint JNICALL -Java_edu_wpi_first_hal_sim_mockdata_RoboRioDataJNI_getUserFaults3V3( - JNIEnv*, jclass, jint index) { +Java_edu_wpi_first_hal_sim_mockdata_RoboRioDataJNI_getUserFaults3V3 + (JNIEnv*, jclass, jint index) +{ return HALSIM_GetRoboRioUserFaults3V3(index); } +/* + * Class: edu_wpi_first_hal_sim_mockdata_RoboRioDataJNI + * Method: setUserFaults3V3 + * Signature: (II)V + */ JNIEXPORT void JNICALL -Java_edu_wpi_first_hal_sim_mockdata_RoboRioDataJNI_setUserFaults3V3( - JNIEnv*, jclass, jint index, jint value) { +Java_edu_wpi_first_hal_sim_mockdata_RoboRioDataJNI_setUserFaults3V3 + (JNIEnv*, jclass, jint index, jint value) +{ HALSIM_SetRoboRioUserFaults3V3(index, value); } +/* + * Class: edu_wpi_first_hal_sim_mockdata_RoboRioDataJNI + * Method: resetData + * Signature: (I)V + */ JNIEXPORT void JNICALL -Java_edu_wpi_first_hal_sim_mockdata_RoboRioDataJNI_resetData(JNIEnv*, jclass, - jint index) { +Java_edu_wpi_first_hal_sim_mockdata_RoboRioDataJNI_resetData + (JNIEnv*, jclass, jint index) +{ HALSIM_ResetRoboRioData(index); } diff --git a/hal/src/main/native/sim/jni/SPIAccelerometerDataJNI.cpp b/hal/src/main/native/sim/jni/SPIAccelerometerDataJNI.cpp index 64e3702968..25af62223c 100644 --- a/hal/src/main/native/sim/jni/SPIAccelerometerDataJNI.cpp +++ b/hal/src/main/native/sim/jni/SPIAccelerometerDataJNI.cpp @@ -13,142 +13,265 @@ extern "C" { +/* + * Class: edu_wpi_first_hal_sim_mockdata_SPIAccelerometerDataJNI + * Method: registerActiveCallback + * Signature: (ILjava/lang/Object;Z)I + */ JNIEXPORT jint JNICALL -Java_edu_wpi_first_hal_sim_mockdata_SPIAccelerometerDataJNI_registerActiveCallback( - JNIEnv* env, jclass, jint index, jobject callback, jboolean initialNotify) { +Java_edu_wpi_first_hal_sim_mockdata_SPIAccelerometerDataJNI_registerActiveCallback + (JNIEnv* env, jclass, jint index, jobject callback, jboolean initialNotify) +{ return sim::AllocateCallback(env, index, callback, initialNotify, &HALSIM_RegisterSPIAccelerometerActiveCallback); } +/* + * Class: edu_wpi_first_hal_sim_mockdata_SPIAccelerometerDataJNI + * Method: cancelActiveCallback + * Signature: (II)V + */ JNIEXPORT void JNICALL -Java_edu_wpi_first_hal_sim_mockdata_SPIAccelerometerDataJNI_cancelActiveCallback( - JNIEnv* env, jclass, jint index, jint handle) { +Java_edu_wpi_first_hal_sim_mockdata_SPIAccelerometerDataJNI_cancelActiveCallback + (JNIEnv* env, jclass, jint index, jint handle) +{ return sim::FreeCallback(env, handle, index, &HALSIM_CancelSPIAccelerometerActiveCallback); } +/* + * Class: edu_wpi_first_hal_sim_mockdata_SPIAccelerometerDataJNI + * Method: getActive + * Signature: (I)Z + */ JNIEXPORT jboolean JNICALL -Java_edu_wpi_first_hal_sim_mockdata_SPIAccelerometerDataJNI_getActive( - JNIEnv*, jclass, jint index) { +Java_edu_wpi_first_hal_sim_mockdata_SPIAccelerometerDataJNI_getActive + (JNIEnv*, jclass, jint index) +{ return HALSIM_GetSPIAccelerometerActive(index); } +/* + * Class: edu_wpi_first_hal_sim_mockdata_SPIAccelerometerDataJNI + * Method: setActive + * Signature: (IZ)V + */ JNIEXPORT void JNICALL -Java_edu_wpi_first_hal_sim_mockdata_SPIAccelerometerDataJNI_setActive( - JNIEnv*, jclass, jint index, jboolean value) { +Java_edu_wpi_first_hal_sim_mockdata_SPIAccelerometerDataJNI_setActive + (JNIEnv*, jclass, jint index, jboolean value) +{ HALSIM_SetSPIAccelerometerActive(index, value); } +/* + * Class: edu_wpi_first_hal_sim_mockdata_SPIAccelerometerDataJNI + * Method: registerRangeCallback + * Signature: (ILjava/lang/Object;Z)I + */ JNIEXPORT jint JNICALL -Java_edu_wpi_first_hal_sim_mockdata_SPIAccelerometerDataJNI_registerRangeCallback( - JNIEnv* env, jclass, jint index, jobject callback, jboolean initialNotify) { +Java_edu_wpi_first_hal_sim_mockdata_SPIAccelerometerDataJNI_registerRangeCallback + (JNIEnv* env, jclass, jint index, jobject callback, jboolean initialNotify) +{ return sim::AllocateCallback(env, index, callback, initialNotify, &HALSIM_RegisterSPIAccelerometerRangeCallback); } +/* + * Class: edu_wpi_first_hal_sim_mockdata_SPIAccelerometerDataJNI + * Method: cancelRangeCallback + * Signature: (II)V + */ JNIEXPORT void JNICALL -Java_edu_wpi_first_hal_sim_mockdata_SPIAccelerometerDataJNI_cancelRangeCallback( - JNIEnv* env, jclass, jint index, jint handle) { +Java_edu_wpi_first_hal_sim_mockdata_SPIAccelerometerDataJNI_cancelRangeCallback + (JNIEnv* env, jclass, jint index, jint handle) +{ return sim::FreeCallback(env, handle, index, &HALSIM_CancelSPIAccelerometerRangeCallback); } +/* + * Class: edu_wpi_first_hal_sim_mockdata_SPIAccelerometerDataJNI + * Method: getRange + * Signature: (I)I + */ JNIEXPORT jint JNICALL -Java_edu_wpi_first_hal_sim_mockdata_SPIAccelerometerDataJNI_getRange( - JNIEnv*, jclass, jint index) { +Java_edu_wpi_first_hal_sim_mockdata_SPIAccelerometerDataJNI_getRange + (JNIEnv*, jclass, jint index) +{ return HALSIM_GetSPIAccelerometerRange(index); } +/* + * Class: edu_wpi_first_hal_sim_mockdata_SPIAccelerometerDataJNI + * Method: setRange + * Signature: (II)V + */ JNIEXPORT void JNICALL -Java_edu_wpi_first_hal_sim_mockdata_SPIAccelerometerDataJNI_setRange( - JNIEnv*, jclass, jint index, jint value) { +Java_edu_wpi_first_hal_sim_mockdata_SPIAccelerometerDataJNI_setRange + (JNIEnv*, jclass, jint index, jint value) +{ HALSIM_SetSPIAccelerometerRange(index, value); } +/* + * Class: edu_wpi_first_hal_sim_mockdata_SPIAccelerometerDataJNI + * Method: registerXCallback + * Signature: (ILjava/lang/Object;Z)I + */ JNIEXPORT jint JNICALL -Java_edu_wpi_first_hal_sim_mockdata_SPIAccelerometerDataJNI_registerXCallback( - JNIEnv* env, jclass, jint index, jobject callback, jboolean initialNotify) { +Java_edu_wpi_first_hal_sim_mockdata_SPIAccelerometerDataJNI_registerXCallback + (JNIEnv* env, jclass, jint index, jobject callback, jboolean initialNotify) +{ return sim::AllocateCallback(env, index, callback, initialNotify, &HALSIM_RegisterSPIAccelerometerXCallback); } +/* + * Class: edu_wpi_first_hal_sim_mockdata_SPIAccelerometerDataJNI + * Method: cancelXCallback + * Signature: (II)V + */ JNIEXPORT void JNICALL -Java_edu_wpi_first_hal_sim_mockdata_SPIAccelerometerDataJNI_cancelXCallback( - JNIEnv* env, jclass, jint index, jint handle) { +Java_edu_wpi_first_hal_sim_mockdata_SPIAccelerometerDataJNI_cancelXCallback + (JNIEnv* env, jclass, jint index, jint handle) +{ return sim::FreeCallback(env, handle, index, &HALSIM_CancelSPIAccelerometerXCallback); } +/* + * Class: edu_wpi_first_hal_sim_mockdata_SPIAccelerometerDataJNI + * Method: getX + * Signature: (I)D + */ JNIEXPORT jdouble JNICALL -Java_edu_wpi_first_hal_sim_mockdata_SPIAccelerometerDataJNI_getX(JNIEnv*, - jclass, - jint index) { +Java_edu_wpi_first_hal_sim_mockdata_SPIAccelerometerDataJNI_getX + (JNIEnv*, jclass, jint index) +{ return HALSIM_GetSPIAccelerometerX(index); } +/* + * Class: edu_wpi_first_hal_sim_mockdata_SPIAccelerometerDataJNI + * Method: setX + * Signature: (ID)V + */ JNIEXPORT void JNICALL -Java_edu_wpi_first_hal_sim_mockdata_SPIAccelerometerDataJNI_setX( - JNIEnv*, jclass, jint index, jdouble value) { +Java_edu_wpi_first_hal_sim_mockdata_SPIAccelerometerDataJNI_setX + (JNIEnv*, jclass, jint index, jdouble value) +{ HALSIM_SetSPIAccelerometerX(index, value); } +/* + * Class: edu_wpi_first_hal_sim_mockdata_SPIAccelerometerDataJNI + * Method: registerYCallback + * Signature: (ILjava/lang/Object;Z)I + */ JNIEXPORT jint JNICALL -Java_edu_wpi_first_hal_sim_mockdata_SPIAccelerometerDataJNI_registerYCallback( - JNIEnv* env, jclass, jint index, jobject callback, jboolean initialNotify) { +Java_edu_wpi_first_hal_sim_mockdata_SPIAccelerometerDataJNI_registerYCallback + (JNIEnv* env, jclass, jint index, jobject callback, jboolean initialNotify) +{ return sim::AllocateCallback(env, index, callback, initialNotify, &HALSIM_RegisterSPIAccelerometerYCallback); } +/* + * Class: edu_wpi_first_hal_sim_mockdata_SPIAccelerometerDataJNI + * Method: cancelYCallback + * Signature: (II)V + */ JNIEXPORT void JNICALL -Java_edu_wpi_first_hal_sim_mockdata_SPIAccelerometerDataJNI_cancelYCallback( - JNIEnv* env, jclass, jint index, jint handle) { +Java_edu_wpi_first_hal_sim_mockdata_SPIAccelerometerDataJNI_cancelYCallback + (JNIEnv* env, jclass, jint index, jint handle) +{ return sim::FreeCallback(env, handle, index, &HALSIM_CancelSPIAccelerometerYCallback); } +/* + * Class: edu_wpi_first_hal_sim_mockdata_SPIAccelerometerDataJNI + * Method: getY + * Signature: (I)D + */ JNIEXPORT jdouble JNICALL -Java_edu_wpi_first_hal_sim_mockdata_SPIAccelerometerDataJNI_getY(JNIEnv*, - jclass, - jint index) { +Java_edu_wpi_first_hal_sim_mockdata_SPIAccelerometerDataJNI_getY + (JNIEnv*, jclass, jint index) +{ return HALSIM_GetSPIAccelerometerY(index); } +/* + * Class: edu_wpi_first_hal_sim_mockdata_SPIAccelerometerDataJNI + * Method: setY + * Signature: (ID)V + */ JNIEXPORT void JNICALL -Java_edu_wpi_first_hal_sim_mockdata_SPIAccelerometerDataJNI_setY( - JNIEnv*, jclass, jint index, jdouble value) { +Java_edu_wpi_first_hal_sim_mockdata_SPIAccelerometerDataJNI_setY + (JNIEnv*, jclass, jint index, jdouble value) +{ HALSIM_SetSPIAccelerometerY(index, value); } +/* + * Class: edu_wpi_first_hal_sim_mockdata_SPIAccelerometerDataJNI + * Method: registerZCallback + * Signature: (ILjava/lang/Object;Z)I + */ JNIEXPORT jint JNICALL -Java_edu_wpi_first_hal_sim_mockdata_SPIAccelerometerDataJNI_registerZCallback( - JNIEnv* env, jclass, jint index, jobject callback, jboolean initialNotify) { +Java_edu_wpi_first_hal_sim_mockdata_SPIAccelerometerDataJNI_registerZCallback + (JNIEnv* env, jclass, jint index, jobject callback, jboolean initialNotify) +{ return sim::AllocateCallback(env, index, callback, initialNotify, &HALSIM_RegisterSPIAccelerometerZCallback); } +/* + * Class: edu_wpi_first_hal_sim_mockdata_SPIAccelerometerDataJNI + * Method: cancelZCallback + * Signature: (II)V + */ JNIEXPORT void JNICALL -Java_edu_wpi_first_hal_sim_mockdata_SPIAccelerometerDataJNI_cancelZCallback( - JNIEnv* env, jclass, jint index, jint handle) { +Java_edu_wpi_first_hal_sim_mockdata_SPIAccelerometerDataJNI_cancelZCallback + (JNIEnv* env, jclass, jint index, jint handle) +{ return sim::FreeCallback(env, handle, index, &HALSIM_CancelSPIAccelerometerZCallback); } +/* + * Class: edu_wpi_first_hal_sim_mockdata_SPIAccelerometerDataJNI + * Method: getZ + * Signature: (I)D + */ JNIEXPORT jdouble JNICALL -Java_edu_wpi_first_hal_sim_mockdata_SPIAccelerometerDataJNI_getZ(JNIEnv*, - jclass, - jint index) { +Java_edu_wpi_first_hal_sim_mockdata_SPIAccelerometerDataJNI_getZ + (JNIEnv*, jclass, jint index) +{ return HALSIM_GetSPIAccelerometerZ(index); } +/* + * Class: edu_wpi_first_hal_sim_mockdata_SPIAccelerometerDataJNI + * Method: setZ + * Signature: (ID)V + */ JNIEXPORT void JNICALL -Java_edu_wpi_first_hal_sim_mockdata_SPIAccelerometerDataJNI_setZ( - JNIEnv*, jclass, jint index, jdouble value) { +Java_edu_wpi_first_hal_sim_mockdata_SPIAccelerometerDataJNI_setZ + (JNIEnv*, jclass, jint index, jdouble value) +{ HALSIM_SetSPIAccelerometerZ(index, value); } +/* + * Class: edu_wpi_first_hal_sim_mockdata_SPIAccelerometerDataJNI + * Method: resetData + * Signature: (I)V + */ JNIEXPORT void JNICALL -Java_edu_wpi_first_hal_sim_mockdata_SPIAccelerometerDataJNI_resetData( - JNIEnv*, jclass, jint index) { +Java_edu_wpi_first_hal_sim_mockdata_SPIAccelerometerDataJNI_resetData + (JNIEnv*, jclass, jint index) +{ HALSIM_ResetSPIAccelerometerData(index); } diff --git a/hal/src/main/native/sim/jni/SPIDataJNI.cpp b/hal/src/main/native/sim/jni/SPIDataJNI.cpp index b5aa91175b..f8bf85901d 100644 --- a/hal/src/main/native/sim/jni/SPIDataJNI.cpp +++ b/hal/src/main/native/sim/jni/SPIDataJNI.cpp @@ -17,132 +17,141 @@ extern "C" { /* - * Class: edu_wpi_first_hal_sim_mockdata_SPISim + * Class: edu_wpi_first_hal_sim_mockdata_SPIDataJNI * Method: registerInitializedCallback - * Signature: (ILedu/wpi/first/hal/sim/NotifyCallback;Z)I + * Signature: (ILjava/lang/Object;Z)I */ JNIEXPORT jint JNICALL -Java_edu_wpi_first_hal_sim_mockdata_SPIDataJNI_registerInitializedCallback( - JNIEnv* env, jclass, jint index, jobject callback, jboolean initialNotify) { +Java_edu_wpi_first_hal_sim_mockdata_SPIDataJNI_registerInitializedCallback + (JNIEnv* env, jclass, jint index, jobject callback, jboolean initialNotify) +{ return sim::AllocateCallback(env, index, callback, initialNotify, &HALSIM_RegisterSPIInitializedCallback); } /* - * Class: edu_wpi_first_hal_sim_mockdata_SPISim + * Class: edu_wpi_first_hal_sim_mockdata_SPIDataJNI * Method: cancelInitializedCallback * Signature: (II)V */ JNIEXPORT void JNICALL -Java_edu_wpi_first_hal_sim_mockdata_SPIDataJNI_cancelInitializedCallback( - JNIEnv* env, jclass, jint index, jint handle) { +Java_edu_wpi_first_hal_sim_mockdata_SPIDataJNI_cancelInitializedCallback + (JNIEnv* env, jclass, jint index, jint handle) +{ return sim::FreeCallback(env, handle, index, &HALSIM_CancelSPIInitializedCallback); } /* - * Class: edu_wpi_first_hal_sim_mockdata_SPISim + * Class: edu_wpi_first_hal_sim_mockdata_SPIDataJNI * Method: getInitialized * Signature: (I)Z */ JNIEXPORT jboolean JNICALL -Java_edu_wpi_first_hal_sim_mockdata_SPIDataJNI_getInitialized(JNIEnv*, jclass, - jint index) { +Java_edu_wpi_first_hal_sim_mockdata_SPIDataJNI_getInitialized + (JNIEnv*, jclass, jint index) +{ return HALSIM_GetSPIInitialized(index); } /* - * Class: edu_wpi_first_hal_sim_mockdata_SPISim + * Class: edu_wpi_first_hal_sim_mockdata_SPIDataJNI * Method: setInitialized * Signature: (IZ)V */ JNIEXPORT void JNICALL -Java_edu_wpi_first_hal_sim_mockdata_SPIDataJNI_setInitialized(JNIEnv*, jclass, - jint index, - jboolean value) { +Java_edu_wpi_first_hal_sim_mockdata_SPIDataJNI_setInitialized + (JNIEnv*, jclass, jint index, jboolean value) +{ HALSIM_SetSPIInitialized(index, value); } /* - * Class: edu_wpi_first_hal_sim_mockdata_SPISim + * Class: edu_wpi_first_hal_sim_mockdata_SPIDataJNI * Method: registerReadCallback - * Signature: (ILedu/wpi/first/hal/sim/BufferCallback;)I + * Signature: (ILjava/lang/Object;)I */ JNIEXPORT jint JNICALL -Java_edu_wpi_first_hal_sim_mockdata_SPIDataJNI_registerReadCallback( - JNIEnv* env, jclass, jint index, jobject callback) { +Java_edu_wpi_first_hal_sim_mockdata_SPIDataJNI_registerReadCallback + (JNIEnv* env, jclass, jint index, jobject callback) +{ return sim::AllocateBufferCallback(env, index, callback, &HALSIM_RegisterSPIReadCallback); } /* - * Class: edu_wpi_first_hal_sim_mockdata_SPISim + * Class: edu_wpi_first_hal_sim_mockdata_SPIDataJNI * Method: cancelReadCallback * Signature: (II)V */ JNIEXPORT void JNICALL -Java_edu_wpi_first_hal_sim_mockdata_SPIDataJNI_cancelReadCallback(JNIEnv* env, - jclass, - jint index, - jint handle) { +Java_edu_wpi_first_hal_sim_mockdata_SPIDataJNI_cancelReadCallback + (JNIEnv* env, jclass, jint index, jint handle) +{ sim::FreeBufferCallback(env, handle, index, &HALSIM_CancelSPIReadCallback); } /* - * Class: edu_wpi_first_hal_sim_mockdata_SPISim + * Class: edu_wpi_first_hal_sim_mockdata_SPIDataJNI * Method: registerWriteCallback - * Signature: (ILedu/wpi/first/hal/sim/ConstBufferCallback;)I + * Signature: (ILjava/lang/Object;)I */ JNIEXPORT jint JNICALL -Java_edu_wpi_first_hal_sim_mockdata_SPIDataJNI_registerWriteCallback( - JNIEnv* env, jclass, jint index, jobject callback) { +Java_edu_wpi_first_hal_sim_mockdata_SPIDataJNI_registerWriteCallback + (JNIEnv* env, jclass, jint index, jobject callback) +{ return sim::AllocateConstBufferCallback(env, index, callback, &HALSIM_RegisterSPIWriteCallback); } /* - * Class: edu_wpi_first_hal_sim_mockdata_SPISim + * Class: edu_wpi_first_hal_sim_mockdata_SPIDataJNI * Method: cancelWriteCallback * Signature: (II)V */ JNIEXPORT void JNICALL -Java_edu_wpi_first_hal_sim_mockdata_SPIDataJNI_cancelWriteCallback( - JNIEnv* env, jclass, jint index, jint handle) { +Java_edu_wpi_first_hal_sim_mockdata_SPIDataJNI_cancelWriteCallback + (JNIEnv* env, jclass, jint index, jint handle) +{ sim::FreeConstBufferCallback(env, handle, index, &HALSIM_CancelSPIWriteCallback); } /* - * Class: edu_wpi_first_hal_sim_mockdata_SPISim + * Class: edu_wpi_first_hal_sim_mockdata_SPIDataJNI * Method: registerReadAutoReceiveBufferCallback - * Signature: (ILedu/wpi/first/hal/sim/SpiReadAutoReceiveBufferCallback;)I + * Signature: (ILjava/lang/Object;)I */ JNIEXPORT jint JNICALL -Java_edu_wpi_first_hal_sim_mockdata_SPIDataJNI_registerReadAutoReceiveBufferCallback( - JNIEnv* env, jclass, jint index, jobject callback) { +Java_edu_wpi_first_hal_sim_mockdata_SPIDataJNI_registerReadAutoReceiveBufferCallback + (JNIEnv* env, jclass, jint index, jobject callback) +{ return sim::AllocateSpiBufferCallback( env, index, callback, &HALSIM_RegisterSPIReadAutoReceivedDataCallback); } /* - * Class: edu_wpi_first_hal_sim_mockdata_SPISim + * Class: edu_wpi_first_hal_sim_mockdata_SPIDataJNI * Method: cancelReadAutoReceiveBufferCallback * Signature: (II)V */ JNIEXPORT void JNICALL -Java_edu_wpi_first_hal_sim_mockdata_SPIDataJNI_cancelReadAutoReceiveBufferCallback( - JNIEnv* env, jclass, jint index, jint handle) { +Java_edu_wpi_first_hal_sim_mockdata_SPIDataJNI_cancelReadAutoReceiveBufferCallback + (JNIEnv* env, jclass, jint index, jint handle) +{ sim::FreeSpiBufferCallback(env, handle, index, &HALSIM_CancelSPIReadAutoReceivedDataCallback); } /* - * Class: edu_wpi_first_hal_sim_mockdata_SPISim + * Class: edu_wpi_first_hal_sim_mockdata_SPIDataJNI * Method: resetData * Signature: (I)V */ -JNIEXPORT void JNICALL Java_edu_wpi_first_hal_sim_mockdata_SPIDataJNI_resetData( - JNIEnv*, jclass, jint index) { +JNIEXPORT void JNICALL +Java_edu_wpi_first_hal_sim_mockdata_SPIDataJNI_resetData + (JNIEnv*, jclass, jint index) +{ HALSIM_ResetSPIData(index); } diff --git a/hal/src/main/native/sim/jni/SimulatorJNI.cpp b/hal/src/main/native/sim/jni/SimulatorJNI.cpp index 3b34b5ad0f..dfdc6a0acc 100644 --- a/hal/src/main/native/sim/jni/SimulatorJNI.cpp +++ b/hal/src/main/native/sim/jni/SimulatorJNI.cpp @@ -5,6 +5,8 @@ /* the project. */ /*----------------------------------------------------------------------------*/ +#include "SimulatorJNI.h" + #include "BufferCallbackStore.h" #include "CallbackStore.h" #include "ConstBufferCallbackStore.h" @@ -12,7 +14,6 @@ #include "HAL/cpp/Log.h" #include "HAL/handles/HandlesInternal.h" #include "MockData/MockHooks.h" -#include "SimulatorJNI.h" #include "SpiReadAutoReceiveBufferCallbackStore.h" #include "edu_wpi_first_hal_sim_mockdata_SimulatorJNI.h" @@ -112,8 +113,9 @@ extern "C" { * Signature: ()V */ JNIEXPORT void JNICALL -Java_edu_wpi_first_hal_sim_mockdata_SimulatorJNI_waitForProgramStart(JNIEnv*, - jclass) { +Java_edu_wpi_first_hal_sim_mockdata_SimulatorJNI_waitForProgramStart + (JNIEnv*, jclass) +{ HALSIM_WaitForProgramStart(); } @@ -123,8 +125,9 @@ Java_edu_wpi_first_hal_sim_mockdata_SimulatorJNI_waitForProgramStart(JNIEnv*, * Signature: ()V */ JNIEXPORT void JNICALL -Java_edu_wpi_first_hal_sim_mockdata_SimulatorJNI_setProgramStarted(JNIEnv*, - jclass) { +Java_edu_wpi_first_hal_sim_mockdata_SimulatorJNI_setProgramStarted + (JNIEnv*, jclass) +{ HALSIM_SetProgramStarted(); } @@ -134,8 +137,9 @@ Java_edu_wpi_first_hal_sim_mockdata_SimulatorJNI_setProgramStarted(JNIEnv*, * Signature: ()V */ JNIEXPORT void JNICALL -Java_edu_wpi_first_hal_sim_mockdata_SimulatorJNI_restartTiming(JNIEnv*, - jclass) { +Java_edu_wpi_first_hal_sim_mockdata_SimulatorJNI_restartTiming + (JNIEnv*, jclass) +{ HALSIM_RestartTiming(); } @@ -145,7 +149,9 @@ Java_edu_wpi_first_hal_sim_mockdata_SimulatorJNI_restartTiming(JNIEnv*, * Signature: ()V */ JNIEXPORT void JNICALL -Java_edu_wpi_first_hal_sim_mockdata_SimulatorJNI_resetHandles(JNIEnv*, jclass) { +Java_edu_wpi_first_hal_sim_mockdata_SimulatorJNI_resetHandles + (JNIEnv*, jclass) +{ hal::HandleBase::ResetGlobalHandles(); } } // extern "C" diff --git a/hal/src/main/native/sim/jni/SpiReadAutoReceiveBufferCallbackStore.cpp b/hal/src/main/native/sim/jni/SpiReadAutoReceiveBufferCallbackStore.cpp index 7b5d994318..552dbe1bab 100644 --- a/hal/src/main/native/sim/jni/SpiReadAutoReceiveBufferCallbackStore.cpp +++ b/hal/src/main/native/sim/jni/SpiReadAutoReceiveBufferCallbackStore.cpp @@ -8,6 +8,7 @@ #include "SpiReadAutoReceiveBufferCallbackStore.h" #include + #include #include "HAL/Types.h" diff --git a/hal/src/main/native/sim/jni/SpiReadAutoReceiveBufferCallbackStore.h b/hal/src/main/native/sim/jni/SpiReadAutoReceiveBufferCallbackStore.h index 9a98faa51c..2d6a4a89fe 100644 --- a/hal/src/main/native/sim/jni/SpiReadAutoReceiveBufferCallbackStore.h +++ b/hal/src/main/native/sim/jni/SpiReadAutoReceiveBufferCallbackStore.h @@ -8,6 +8,7 @@ #pragma once #include + #include #include "HAL/Types.h" diff --git a/ntcore/.styleguide b/ntcore/.styleguide new file mode 100644 index 0000000000..4c00fa9af9 --- /dev/null +++ b/ntcore/.styleguide @@ -0,0 +1,31 @@ +cHeaderFileInclude { + _c\.h$ +} + +cppHeaderFileInclude { + (? callback, unsigned int local_id, unsigned int flags) = 0; - virtual unsigned int AddPolled(unsigned int poller_uid, - wpi::StringRef prefix, + virtual unsigned int AddPolled(unsigned int poller_uid, wpi::StringRef prefix, unsigned int flags) = 0; virtual unsigned int AddPolled(unsigned int poller_uid, unsigned int local_id, unsigned int flags) = 0; diff --git a/ntcore/src/main/native/cpp/INetworkConnection.h b/ntcore/src/main/native/cpp/INetworkConnection.h index a3a68bacf8..0387cc938f 100644 --- a/ntcore/src/main/native/cpp/INetworkConnection.h +++ b/ntcore/src/main/native/cpp/INetworkConnection.h @@ -1,5 +1,5 @@ /*----------------------------------------------------------------------------*/ -/* Copyright (c) FIRST 2017-2018. All Rights Reserved. */ +/* Copyright (c) 2017-2018 FIRST. 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. */ diff --git a/ntcore/src/main/native/cpp/IRpcServer.h b/ntcore/src/main/native/cpp/IRpcServer.h index f846ab25db..dc8b0a6699 100644 --- a/ntcore/src/main/native/cpp/IRpcServer.h +++ b/ntcore/src/main/native/cpp/IRpcServer.h @@ -1,5 +1,5 @@ /*----------------------------------------------------------------------------*/ -/* Copyright (c) FIRST 2017-2018. All Rights Reserved. */ +/* Copyright (c) 2017-2018 FIRST. 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. */ diff --git a/ntcore/src/main/native/cpp/IStorage.h b/ntcore/src/main/native/cpp/IStorage.h index 1cbb2cdab1..0fb3a0b0ae 100644 --- a/ntcore/src/main/native/cpp/IStorage.h +++ b/ntcore/src/main/native/cpp/IStorage.h @@ -1,5 +1,5 @@ /*----------------------------------------------------------------------------*/ -/* Copyright (c) FIRST 2015-2018. All Rights Reserved. */ +/* Copyright (c) 2015-2018 FIRST. 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. */ diff --git a/ntcore/src/main/native/cpp/InstanceImpl.cpp b/ntcore/src/main/native/cpp/InstanceImpl.cpp index 780362c105..66bb56a446 100644 --- a/ntcore/src/main/native/cpp/InstanceImpl.cpp +++ b/ntcore/src/main/native/cpp/InstanceImpl.cpp @@ -1,5 +1,5 @@ /*----------------------------------------------------------------------------*/ -/* Copyright (c) FIRST 2015-2018. All Rights Reserved. */ +/* Copyright (c) 2015-2018 FIRST. 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. */ diff --git a/ntcore/src/main/native/cpp/InstanceImpl.h b/ntcore/src/main/native/cpp/InstanceImpl.h index 7b3cc9aade..32a7aac8e6 100644 --- a/ntcore/src/main/native/cpp/InstanceImpl.h +++ b/ntcore/src/main/native/cpp/InstanceImpl.h @@ -1,5 +1,5 @@ /*----------------------------------------------------------------------------*/ -/* Copyright (c) FIRST 2016-2018. All Rights Reserved. */ +/* Copyright (c) 2016-2018 FIRST. 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. */ diff --git a/ntcore/src/main/native/cpp/Log.h b/ntcore/src/main/native/cpp/Log.h index 9af3b60db8..b8a3daf79e 100644 --- a/ntcore/src/main/native/cpp/Log.h +++ b/ntcore/src/main/native/cpp/Log.h @@ -1,5 +1,5 @@ /*----------------------------------------------------------------------------*/ -/* Copyright (c) FIRST 2015-2018. All Rights Reserved. */ +/* Copyright (c) 2015-2018 FIRST. 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. */ diff --git a/ntcore/src/main/native/cpp/LoggerImpl.cpp b/ntcore/src/main/native/cpp/LoggerImpl.cpp index 7706cff40a..b2c6786fac 100644 --- a/ntcore/src/main/native/cpp/LoggerImpl.cpp +++ b/ntcore/src/main/native/cpp/LoggerImpl.cpp @@ -1,5 +1,5 @@ /*----------------------------------------------------------------------------*/ -/* Copyright (c) FIRST 2015-2018. All Rights Reserved. */ +/* Copyright (c) 2015-2018 FIRST. 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. */ diff --git a/ntcore/src/main/native/cpp/LoggerImpl.h b/ntcore/src/main/native/cpp/LoggerImpl.h index 85c6b1e53e..3ac0295c7c 100644 --- a/ntcore/src/main/native/cpp/LoggerImpl.h +++ b/ntcore/src/main/native/cpp/LoggerImpl.h @@ -1,5 +1,5 @@ /*----------------------------------------------------------------------------*/ -/* Copyright (c) FIRST 2015-2018. All Rights Reserved. */ +/* Copyright (c) 2015-2018 FIRST. 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. */ diff --git a/ntcore/src/main/native/cpp/Message.cpp b/ntcore/src/main/native/cpp/Message.cpp index b3474d4f19..576e44475d 100644 --- a/ntcore/src/main/native/cpp/Message.cpp +++ b/ntcore/src/main/native/cpp/Message.cpp @@ -1,5 +1,5 @@ /*----------------------------------------------------------------------------*/ -/* Copyright (c) FIRST 2015-2018. All Rights Reserved. */ +/* Copyright (c) 2015-2018 FIRST. 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. */ diff --git a/ntcore/src/main/native/cpp/Message.h b/ntcore/src/main/native/cpp/Message.h index 592ae73a60..9b25abf8ba 100644 --- a/ntcore/src/main/native/cpp/Message.h +++ b/ntcore/src/main/native/cpp/Message.h @@ -1,5 +1,5 @@ /*----------------------------------------------------------------------------*/ -/* Copyright (c) FIRST 2015-2018. All Rights Reserved. */ +/* Copyright (c) 2015-2018 FIRST. 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. */ diff --git a/ntcore/src/main/native/cpp/NetworkConnection.cpp b/ntcore/src/main/native/cpp/NetworkConnection.cpp index db7b3f7496..cb1e333e56 100644 --- a/ntcore/src/main/native/cpp/NetworkConnection.cpp +++ b/ntcore/src/main/native/cpp/NetworkConnection.cpp @@ -1,5 +1,5 @@ /*----------------------------------------------------------------------------*/ -/* Copyright (c) FIRST 2015-2018. All Rights Reserved. */ +/* Copyright (c) 2015-2018 FIRST. 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. */ diff --git a/ntcore/src/main/native/cpp/NetworkConnection.h b/ntcore/src/main/native/cpp/NetworkConnection.h index 05ce7a97e8..91ad64e51c 100644 --- a/ntcore/src/main/native/cpp/NetworkConnection.h +++ b/ntcore/src/main/native/cpp/NetworkConnection.h @@ -1,5 +1,5 @@ /*----------------------------------------------------------------------------*/ -/* Copyright (c) FIRST 2015-2018. All Rights Reserved. */ +/* Copyright (c) 2015-2018 FIRST. 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. */ diff --git a/ntcore/src/main/native/cpp/RpcServer.cpp b/ntcore/src/main/native/cpp/RpcServer.cpp index f70648e459..d9f7f7bc76 100644 --- a/ntcore/src/main/native/cpp/RpcServer.cpp +++ b/ntcore/src/main/native/cpp/RpcServer.cpp @@ -1,5 +1,5 @@ /*----------------------------------------------------------------------------*/ -/* Copyright (c) FIRST 2015-2018. All Rights Reserved. */ +/* Copyright (c) 2015-2018 FIRST. 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. */ diff --git a/ntcore/src/main/native/cpp/RpcServer.h b/ntcore/src/main/native/cpp/RpcServer.h index 6a38c07f97..8b39ad0ab8 100644 --- a/ntcore/src/main/native/cpp/RpcServer.h +++ b/ntcore/src/main/native/cpp/RpcServer.h @@ -1,5 +1,5 @@ /*----------------------------------------------------------------------------*/ -/* Copyright (c) FIRST 2015-2018. All Rights Reserved. */ +/* Copyright (c) 2015-2018 FIRST. 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. */ diff --git a/ntcore/src/main/native/cpp/SequenceNumber.cpp b/ntcore/src/main/native/cpp/SequenceNumber.cpp index 54a7d5fffe..6d61331e7f 100644 --- a/ntcore/src/main/native/cpp/SequenceNumber.cpp +++ b/ntcore/src/main/native/cpp/SequenceNumber.cpp @@ -1,5 +1,5 @@ /*----------------------------------------------------------------------------*/ -/* Copyright (c) FIRST 2015-2018. All Rights Reserved. */ +/* Copyright (c) 2015-2018 FIRST. 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. */ diff --git a/ntcore/src/main/native/cpp/SequenceNumber.h b/ntcore/src/main/native/cpp/SequenceNumber.h index 04b07b4ac3..11d9953ce9 100644 --- a/ntcore/src/main/native/cpp/SequenceNumber.h +++ b/ntcore/src/main/native/cpp/SequenceNumber.h @@ -1,5 +1,5 @@ /*----------------------------------------------------------------------------*/ -/* Copyright (c) FIRST 2015-2018. All Rights Reserved. */ +/* Copyright (c) 2015-2018 FIRST. 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. */ diff --git a/ntcore/src/main/native/cpp/Storage.cpp b/ntcore/src/main/native/cpp/Storage.cpp index a7d8ba127b..840f25a78c 100644 --- a/ntcore/src/main/native/cpp/Storage.cpp +++ b/ntcore/src/main/native/cpp/Storage.cpp @@ -1,5 +1,5 @@ /*----------------------------------------------------------------------------*/ -/* Copyright (c) FIRST 2015-2018. All Rights Reserved. */ +/* Copyright (c) 2015-2018 FIRST. 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. */ diff --git a/ntcore/src/main/native/cpp/Storage.h b/ntcore/src/main/native/cpp/Storage.h index 002b83d06c..fa9b2bfa2b 100644 --- a/ntcore/src/main/native/cpp/Storage.h +++ b/ntcore/src/main/native/cpp/Storage.h @@ -1,5 +1,5 @@ /*----------------------------------------------------------------------------*/ -/* Copyright (c) FIRST 2015-2018. All Rights Reserved. */ +/* Copyright (c) 2015-2018 FIRST. 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. */ diff --git a/ntcore/src/main/native/cpp/Storage_load.cpp b/ntcore/src/main/native/cpp/Storage_load.cpp index 84d0c3e6c3..efbfbeea50 100644 --- a/ntcore/src/main/native/cpp/Storage_load.cpp +++ b/ntcore/src/main/native/cpp/Storage_load.cpp @@ -1,5 +1,5 @@ /*----------------------------------------------------------------------------*/ -/* Copyright (c) FIRST 2015-2018. All Rights Reserved. */ +/* Copyright (c) 2015-2018 FIRST. 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. */ @@ -99,7 +99,7 @@ static int fromxdigit(char ch) { } static wpi::StringRef UnescapeString(wpi::StringRef source, - wpi::SmallVectorImpl& buf) { + wpi::SmallVectorImpl& buf) { assert(source.size() >= 2 && source.front() == '"' && source.back() == '"'); buf.clear(); buf.reserve(source.size() - 2); diff --git a/ntcore/src/main/native/cpp/Storage_save.cpp b/ntcore/src/main/native/cpp/Storage_save.cpp index d10bb88d33..a8a3b0a90f 100644 --- a/ntcore/src/main/native/cpp/Storage_save.cpp +++ b/ntcore/src/main/native/cpp/Storage_save.cpp @@ -1,5 +1,5 @@ /*----------------------------------------------------------------------------*/ -/* Copyright (c) FIRST 2015-2018. All Rights Reserved. */ +/* Copyright (c) 2015-2018 FIRST. 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. */ diff --git a/ntcore/src/main/native/cpp/Value.cpp b/ntcore/src/main/native/cpp/Value.cpp index 6cd60cdb40..f4ae61e86b 100644 --- a/ntcore/src/main/native/cpp/Value.cpp +++ b/ntcore/src/main/native/cpp/Value.cpp @@ -1,5 +1,5 @@ /*----------------------------------------------------------------------------*/ -/* Copyright (c) FIRST 2015-2018. All Rights Reserved. */ +/* Copyright (c) 2015-2018 FIRST. 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. */ diff --git a/ntcore/src/main/native/cpp/Value_internal.h b/ntcore/src/main/native/cpp/Value_internal.h index d06d58c8df..ea25777132 100644 --- a/ntcore/src/main/native/cpp/Value_internal.h +++ b/ntcore/src/main/native/cpp/Value_internal.h @@ -1,5 +1,5 @@ /*----------------------------------------------------------------------------*/ -/* Copyright (c) FIRST 2015-2018. All Rights Reserved. */ +/* Copyright (c) 2015-2018 FIRST. 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. */ diff --git a/ntcore/src/main/native/cpp/WireDecoder.cpp b/ntcore/src/main/native/cpp/WireDecoder.cpp index 347f13ee71..132e8a2a04 100644 --- a/ntcore/src/main/native/cpp/WireDecoder.cpp +++ b/ntcore/src/main/native/cpp/WireDecoder.cpp @@ -1,5 +1,5 @@ /*----------------------------------------------------------------------------*/ -/* Copyright (c) FIRST 2015-2018. All Rights Reserved. */ +/* Copyright (c) 2015-2018 FIRST. 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. */ diff --git a/ntcore/src/main/native/cpp/WireDecoder.h b/ntcore/src/main/native/cpp/WireDecoder.h index a8b724fae2..6b4483bbe3 100644 --- a/ntcore/src/main/native/cpp/WireDecoder.h +++ b/ntcore/src/main/native/cpp/WireDecoder.h @@ -1,5 +1,5 @@ /*----------------------------------------------------------------------------*/ -/* Copyright (c) FIRST 2015-2018. All Rights Reserved. */ +/* Copyright (c) 2015-2018 FIRST. 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. */ diff --git a/ntcore/src/main/native/cpp/WireEncoder.cpp b/ntcore/src/main/native/cpp/WireEncoder.cpp index ba0c79ff1c..653834966a 100644 --- a/ntcore/src/main/native/cpp/WireEncoder.cpp +++ b/ntcore/src/main/native/cpp/WireEncoder.cpp @@ -1,5 +1,5 @@ /*----------------------------------------------------------------------------*/ -/* Copyright (c) FIRST 2015-2018. All Rights Reserved. */ +/* Copyright (c) 2015-2018 FIRST. 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. */ diff --git a/ntcore/src/main/native/cpp/WireEncoder.h b/ntcore/src/main/native/cpp/WireEncoder.h index a787306b16..c4f769cc47 100644 --- a/ntcore/src/main/native/cpp/WireEncoder.h +++ b/ntcore/src/main/native/cpp/WireEncoder.h @@ -1,5 +1,5 @@ /*----------------------------------------------------------------------------*/ -/* Copyright (c) FIRST 2015-2018. All Rights Reserved. */ +/* Copyright (c) 2015-2018 FIRST. 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. */ diff --git a/ntcore/src/main/native/cpp/jni/NetworkTablesJNI.cpp b/ntcore/src/main/native/cpp/jni/NetworkTablesJNI.cpp index 6b068837f4..96134fe7b2 100644 --- a/ntcore/src/main/native/cpp/jni/NetworkTablesJNI.cpp +++ b/ntcore/src/main/native/cpp/jni/NetworkTablesJNI.cpp @@ -1,12 +1,21 @@ +/*----------------------------------------------------------------------------*/ +/* Copyright (c) 2018 FIRST. 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. */ +/*----------------------------------------------------------------------------*/ + #include + #include +#include +#include +#include +#include + #include "edu_wpi_first_networktables_NetworkTablesJNI.h" #include "ntcore.h" -#include "wpi/ConvertUTF.h" -#include "wpi/SmallString.h" -#include "wpi/jni_util.h" -#include "wpi/raw_ostream.h" using namespace wpi::java; @@ -19,7 +28,7 @@ using namespace wpi::java; // // Used for callback. -static JavaVM *jvm = nullptr; +static JavaVM* jvm = nullptr; static JClass booleanCls; static JClass connectionInfoCls; static JClass connectionNotificationCls; @@ -36,22 +45,22 @@ static JException persistentEx; extern "C" { -JNIEXPORT jint JNICALL JNI_OnLoad(JavaVM *vm, void *reserved) { +JNIEXPORT jint JNICALL JNI_OnLoad(JavaVM* vm, void* reserved) { jvm = vm; - JNIEnv *env; - if (vm->GetEnv(reinterpret_cast(&env), JNI_VERSION_1_6) != JNI_OK) + JNIEnv* env; + if (vm->GetEnv(reinterpret_cast(&env), JNI_VERSION_1_6) != JNI_OK) return JNI_ERR; // Cache references to classes booleanCls = JClass(env, "java/lang/Boolean"); if (!booleanCls) return JNI_ERR; - connectionInfoCls = - JClass(env, "edu/wpi/first/networktables/ConnectionInfo"); + connectionInfoCls = JClass(env, "edu/wpi/first/networktables/ConnectionInfo"); if (!connectionInfoCls) return JNI_ERR; - connectionNotificationCls = JClass(env, "edu/wpi/first/networktables/ConnectionNotification"); + connectionNotificationCls = + JClass(env, "edu/wpi/first/networktables/ConnectionNotification"); if (!connectionNotificationCls) return JNI_ERR; doubleCls = JClass(env, "java/lang/Double"); @@ -60,7 +69,8 @@ JNIEXPORT jint JNICALL JNI_OnLoad(JavaVM *vm, void *reserved) { entryInfoCls = JClass(env, "edu/wpi/first/networktables/EntryInfo"); if (!entryInfoCls) return JNI_ERR; - entryNotificationCls = JClass(env, "edu/wpi/first/networktables/EntryNotification"); + entryNotificationCls = + JClass(env, "edu/wpi/first/networktables/EntryNotification"); if (!entryNotificationCls) return JNI_ERR; logMessageCls = JClass(env, "edu/wpi/first/networktables/LogMessage"); @@ -69,8 +79,7 @@ JNIEXPORT jint JNICALL JNI_OnLoad(JavaVM *vm, void *reserved) { rpcAnswerCls = JClass(env, "edu/wpi/first/networktables/RpcAnswer"); if (!rpcAnswerCls) return JNI_ERR; - valueCls = - JClass(env, "edu/wpi/first/networktables/NetworkTableValue"); + valueCls = JClass(env, "edu/wpi/first/networktables/NetworkTableValue"); if (!valueCls) return JNI_ERR; illegalArgEx = JException(env, "java/lang/IllegalArgumentException"); @@ -82,16 +91,16 @@ JNIEXPORT jint JNICALL JNI_OnLoad(JavaVM *vm, void *reserved) { nullPointerEx = JException(env, "java/lang/NullPointerException"); if (!nullPointerEx) return JNI_ERR; - persistentEx = JException( - env, "edu/wpi/first/networktables/PersistentException"); + persistentEx = + JException(env, "edu/wpi/first/networktables/PersistentException"); if (!persistentEx) return JNI_ERR; return JNI_VERSION_1_6; } -JNIEXPORT void JNICALL JNI_OnUnload(JavaVM *vm, void *reserved) { - JNIEnv *env; - if (vm->GetEnv(reinterpret_cast(&env), JNI_VERSION_1_6) != JNI_OK) +JNIEXPORT void JNICALL JNI_OnUnload(JavaVM* vm, void* reserved) { + JNIEnv* env; + if (vm->GetEnv(reinterpret_cast(&env), JNI_VERSION_1_6) != JNI_OK) return; // Delete global references booleanCls.free(env); @@ -116,7 +125,7 @@ JNIEXPORT void JNICALL JNI_OnUnload(JavaVM *vm, void *reserved) { // Conversions from Java objects to C++ // -inline std::shared_ptr FromJavaRaw(JNIEnv *env, jbyteArray jarr, +inline std::shared_ptr FromJavaRaw(JNIEnv* env, jbyteArray jarr, jlong time) { CriticalJByteArrayRef ref{env, jarr}; if (!ref) return nullptr; @@ -130,7 +139,7 @@ inline std::shared_ptr FromJavaRawBB(JNIEnv* env, jobject jbb, return nt::Value::MakeRaw(ref.str(), time); } -inline std::shared_ptr FromJavaRpc(JNIEnv *env, jbyteArray jarr, +inline std::shared_ptr FromJavaRpc(JNIEnv* env, jbyteArray jarr, jlong time) { CriticalJByteArrayRef ref{env, jarr}; if (!ref) return nullptr; @@ -174,7 +183,7 @@ std::shared_ptr FromJavaStringArray(JNIEnv* env, jobjectArray jarr, // Conversions from C++ to Java objects // -static jobject MakeJObject(JNIEnv *env, const nt::Value& value) { +static jobject MakeJObject(JNIEnv* env, const nt::Value& value) { static jmethodID booleanConstructor = nullptr; static jmethodID doubleConstructor = nullptr; if (!booleanConstructor) @@ -206,7 +215,7 @@ static jobject MakeJObject(JNIEnv *env, const nt::Value& value) { } } -static jobject MakeJValue(JNIEnv *env, const nt::Value* value) { +static jobject MakeJValue(JNIEnv* env, const nt::Value* value) { static jmethodID constructor = env->GetMethodID(valueCls, "", "(ILjava/lang/Object;J)V"); if (!value) @@ -216,7 +225,7 @@ static jobject MakeJValue(JNIEnv *env, const nt::Value* value) { MakeJObject(env, *value), (jlong)value->time()); } -static jobject MakeJObject(JNIEnv *env, const nt::ConnectionInfo &info) { +static jobject MakeJObject(JNIEnv* env, const nt::ConnectionInfo& info) { static jmethodID constructor = env->GetMethodID(connectionInfoCls, "", "(Ljava/lang/String;Ljava/lang/String;IJI)V"); @@ -227,32 +236,36 @@ static jobject MakeJObject(JNIEnv *env, const nt::ConnectionInfo &info) { (jlong)info.last_update, (jint)info.protocol_version); } -static jobject MakeJObject(JNIEnv *env, jobject inst, - const nt::ConnectionNotification ¬ification) { - static jmethodID constructor = - env->GetMethodID(connectionNotificationCls, "", - "(Ledu/wpi/first/networktables/NetworkTableInstance;IZLedu/wpi/first/networktables/ConnectionInfo;)V"); +static jobject MakeJObject(JNIEnv* env, jobject inst, + const nt::ConnectionNotification& notification) { + static jmethodID constructor = env->GetMethodID( + connectionNotificationCls, "", + "(Ledu/wpi/first/networktables/NetworkTableInstance;IZLedu/wpi/first/" + "networktables/ConnectionInfo;)V"); JLocal conn{env, MakeJObject(env, notification.conn)}; return env->NewObject(connectionNotificationCls, constructor, inst, (jint)notification.listener, (jboolean)notification.connected, conn.obj()); } -static jobject MakeJObject(JNIEnv *env, jobject inst, - const nt::EntryInfo &info) { +static jobject MakeJObject(JNIEnv* env, jobject inst, + const nt::EntryInfo& info) { static jmethodID constructor = - env->GetMethodID(entryInfoCls, "", "(Ledu/wpi/first/networktables/NetworkTableInstance;ILjava/lang/String;IIJ)V"); + env->GetMethodID(entryInfoCls, "", + "(Ledu/wpi/first/networktables/" + "NetworkTableInstance;ILjava/lang/String;IIJ)V"); JLocal name{env, MakeJString(env, info.name)}; return env->NewObject(entryInfoCls, constructor, inst, (jint)info.entry, name.obj(), (jint)info.type, (jint)info.flags, (jlong)info.last_change); } -static jobject MakeJObject(JNIEnv *env, jobject inst, - const nt::EntryNotification ¬ification) { - static jmethodID constructor = - env->GetMethodID(entryNotificationCls, "", - "(Ledu/wpi/first/networktables/NetworkTableInstance;IILjava/lang/String;Ledu/wpi/first/networktables/NetworkTableValue;I)V"); +static jobject MakeJObject(JNIEnv* env, jobject inst, + const nt::EntryNotification& notification) { + static jmethodID constructor = env->GetMethodID( + entryNotificationCls, "", + "(Ledu/wpi/first/networktables/NetworkTableInstance;IILjava/lang/" + "String;Ledu/wpi/first/networktables/NetworkTableValue;I)V"); JLocal name{env, MakeJString(env, notification.name)}; JLocal value{env, MakeJValue(env, notification.value.get())}; return env->NewObject(entryNotificationCls, constructor, inst, @@ -260,11 +273,12 @@ static jobject MakeJObject(JNIEnv *env, jobject inst, name.obj(), value.obj(), (jint)notification.flags); } -static jobject MakeJObject(JNIEnv *env, jobject inst, - const nt::LogMessage &msg) { - static jmethodID constructor = - env->GetMethodID(logMessageCls, "", - "(Ledu/wpi/first/networktables/NetworkTableInstance;IILjava/lang/String;ILjava/lang/String;)V"); +static jobject MakeJObject(JNIEnv* env, jobject inst, + const nt::LogMessage& msg) { + static jmethodID constructor = env->GetMethodID( + logMessageCls, "", + "(Ledu/wpi/first/networktables/NetworkTableInstance;IILjava/lang/" + "String;ILjava/lang/String;)V"); JLocal filename{env, MakeJString(env, msg.filename)}; JLocal message{env, MakeJString(env, msg.message)}; return env->NewObject(logMessageCls, constructor, inst, (jint)msg.logger, @@ -272,11 +286,13 @@ static jobject MakeJObject(JNIEnv *env, jobject inst, message.obj()); } -static jobject MakeJObject(JNIEnv *env, jobject inst, - const nt::RpcAnswer &answer) { +static jobject MakeJObject(JNIEnv* env, jobject inst, + const nt::RpcAnswer& answer) { static jmethodID constructor = env->GetMethodID(rpcAnswerCls, "", - "(Ledu/wpi/first/networktables/NetworkTableInstance;IILjava/lang/String;Ljava/lang/String;Ledu/wpi/first/networktables/ConnectionInfo;)V"); + "(Ledu/wpi/first/networktables/" + "NetworkTableInstance;IILjava/lang/String;Ljava/lang/" + "String;Ledu/wpi/first/networktables/ConnectionInfo;)V"); JLocal name{env, MakeJString(env, answer.name)}; JLocal params{env, MakeJString(env, answer.params)}; JLocal conn{env, MakeJObject(env, answer.conn)}; @@ -285,9 +301,10 @@ static jobject MakeJObject(JNIEnv *env, jobject inst, conn.obj()); } -static jobjectArray MakeJObject(JNIEnv *env, jobject inst, +static jobjectArray MakeJObject(JNIEnv* env, jobject inst, wpi::ArrayRef arr) { - jobjectArray jarr = env->NewObjectArray(arr.size(), connectionNotificationCls, nullptr); + jobjectArray jarr = + env->NewObjectArray(arr.size(), connectionNotificationCls, nullptr); if (!jarr) return nullptr; for (size_t i = 0; i < arr.size(); ++i) { JLocal elem{env, MakeJObject(env, inst, arr[i])}; @@ -296,9 +313,10 @@ static jobjectArray MakeJObject(JNIEnv *env, jobject inst, return jarr; } -static jobjectArray MakeJObject(JNIEnv *env, jobject inst, +static jobjectArray MakeJObject(JNIEnv* env, jobject inst, wpi::ArrayRef arr) { - jobjectArray jarr = env->NewObjectArray(arr.size(), entryNotificationCls, nullptr); + jobjectArray jarr = + env->NewObjectArray(arr.size(), entryNotificationCls, nullptr); if (!jarr) return nullptr; for (size_t i = 0; i < arr.size(); ++i) { JLocal elem{env, MakeJObject(env, inst, arr[i])}; @@ -307,7 +325,7 @@ static jobjectArray MakeJObject(JNIEnv *env, jobject inst, return jarr; } -static jobjectArray MakeJObject(JNIEnv *env, jobject inst, +static jobjectArray MakeJObject(JNIEnv* env, jobject inst, wpi::ArrayRef arr) { jobjectArray jarr = env->NewObjectArray(arr.size(), logMessageCls, nullptr); if (!jarr) return nullptr; @@ -318,7 +336,7 @@ static jobjectArray MakeJObject(JNIEnv *env, jobject inst, return jarr; } -static jobjectArray MakeJObject(JNIEnv *env, jobject inst, +static jobjectArray MakeJObject(JNIEnv* env, jobject inst, wpi::ArrayRef arr) { jobjectArray jarr = env->NewObjectArray(arr.size(), rpcAnswerCls, nullptr); if (!jarr) return nullptr; @@ -336,8 +354,9 @@ extern "C" { * Method: getDefaultInstance * Signature: ()I */ -JNIEXPORT jint JNICALL Java_edu_wpi_first_networktables_NetworkTablesJNI_getDefaultInstance - (JNIEnv *, jclass) +JNIEXPORT jint JNICALL +Java_edu_wpi_first_networktables_NetworkTablesJNI_getDefaultInstance + (JNIEnv*, jclass) { return nt::GetDefaultInstance(); } @@ -347,8 +366,9 @@ JNIEXPORT jint JNICALL Java_edu_wpi_first_networktables_NetworkTablesJNI_getDefa * Method: createInstance * Signature: ()I */ -JNIEXPORT jint JNICALL Java_edu_wpi_first_networktables_NetworkTablesJNI_createInstance - (JNIEnv *, jclass) +JNIEXPORT jint JNICALL +Java_edu_wpi_first_networktables_NetworkTablesJNI_createInstance + (JNIEnv*, jclass) { return nt::CreateInstance(); } @@ -358,8 +378,9 @@ JNIEXPORT jint JNICALL Java_edu_wpi_first_networktables_NetworkTablesJNI_createI * Method: destroyInstance * Signature: (I)V */ -JNIEXPORT void JNICALL Java_edu_wpi_first_networktables_NetworkTablesJNI_destroyInstance - (JNIEnv *, jclass, jint inst) +JNIEXPORT void JNICALL +Java_edu_wpi_first_networktables_NetworkTablesJNI_destroyInstance + (JNIEnv*, jclass, jint inst) { nt::DestroyInstance(inst); } @@ -369,8 +390,9 @@ JNIEXPORT void JNICALL Java_edu_wpi_first_networktables_NetworkTablesJNI_destroy * Method: getInstanceFromHandle * Signature: (I)I */ -JNIEXPORT jint JNICALL Java_edu_wpi_first_networktables_NetworkTablesJNI_getInstanceFromHandle - (JNIEnv *, jclass, jint handle) +JNIEXPORT jint JNICALL +Java_edu_wpi_first_networktables_NetworkTablesJNI_getInstanceFromHandle + (JNIEnv*, jclass, jint handle) { return nt::GetInstanceFromHandle(handle); } @@ -380,8 +402,9 @@ JNIEXPORT jint JNICALL Java_edu_wpi_first_networktables_NetworkTablesJNI_getInst * Method: getEntry * Signature: (ILjava/lang/String;)I */ -JNIEXPORT jint JNICALL Java_edu_wpi_first_networktables_NetworkTablesJNI_getEntry - (JNIEnv *env, jclass, jint inst, jstring key) +JNIEXPORT jint JNICALL +Java_edu_wpi_first_networktables_NetworkTablesJNI_getEntry + (JNIEnv* env, jclass, jint inst, jstring key) { if (!key) { nullPointerEx.Throw(env, "key cannot be null"); @@ -395,8 +418,9 @@ JNIEXPORT jint JNICALL Java_edu_wpi_first_networktables_NetworkTablesJNI_getEntr * Method: getEntries * Signature: (ILjava/lang/String;I)[I */ -JNIEXPORT jintArray JNICALL Java_edu_wpi_first_networktables_NetworkTablesJNI_getEntries - (JNIEnv *env, jclass, jint inst, jstring prefix, jint types) +JNIEXPORT jintArray JNICALL +Java_edu_wpi_first_networktables_NetworkTablesJNI_getEntries + (JNIEnv* env, jclass, jint inst, jstring prefix, jint types) { if (!prefix) { nullPointerEx.Throw(env, "prefix cannot be null"); @@ -411,8 +435,9 @@ JNIEXPORT jintArray JNICALL Java_edu_wpi_first_networktables_NetworkTablesJNI_ge * Method: getEntryName * Signature: (I)Ljava/lang/String; */ -JNIEXPORT jstring JNICALL Java_edu_wpi_first_networktables_NetworkTablesJNI_getEntryName - (JNIEnv *env, jclass, jint entry) +JNIEXPORT jstring JNICALL +Java_edu_wpi_first_networktables_NetworkTablesJNI_getEntryName + (JNIEnv* env, jclass, jint entry) { return MakeJString(env, nt::GetEntryName(entry)); } @@ -422,8 +447,9 @@ JNIEXPORT jstring JNICALL Java_edu_wpi_first_networktables_NetworkTablesJNI_getE * Method: getEntryLastChange * Signature: (I)J */ -JNIEXPORT jlong JNICALL Java_edu_wpi_first_networktables_NetworkTablesJNI_getEntryLastChange - (JNIEnv *, jclass, jint entry) +JNIEXPORT jlong JNICALL +Java_edu_wpi_first_networktables_NetworkTablesJNI_getEntryLastChange + (JNIEnv*, jclass, jint entry) { return nt::GetEntryLastChange(entry); } @@ -433,8 +459,9 @@ JNIEXPORT jlong JNICALL Java_edu_wpi_first_networktables_NetworkTablesJNI_getEnt * Method: getType * Signature: (I)I */ -JNIEXPORT jint JNICALL Java_edu_wpi_first_networktables_NetworkTablesJNI_getType - (JNIEnv *, jclass, jint entry) +JNIEXPORT jint JNICALL +Java_edu_wpi_first_networktables_NetworkTablesJNI_getType + (JNIEnv*, jclass, jint entry) { return nt::GetEntryType(entry); } @@ -444,8 +471,9 @@ JNIEXPORT jint JNICALL Java_edu_wpi_first_networktables_NetworkTablesJNI_getType * Method: setBoolean * Signature: (IJZZ)Z */ -JNIEXPORT jboolean JNICALL Java_edu_wpi_first_networktables_NetworkTablesJNI_setBoolean - (JNIEnv *, jclass, jint entry, jlong time, jboolean value, jboolean force) +JNIEXPORT jboolean JNICALL +Java_edu_wpi_first_networktables_NetworkTablesJNI_setBoolean + (JNIEnv*, jclass, jint entry, jlong time, jboolean value, jboolean force) { if (force) { nt::SetEntryTypeValue(entry, @@ -461,8 +489,9 @@ JNIEXPORT jboolean JNICALL Java_edu_wpi_first_networktables_NetworkTablesJNI_set * Method: setDouble * Signature: (IJDZ)Z */ -JNIEXPORT jboolean JNICALL Java_edu_wpi_first_networktables_NetworkTablesJNI_setDouble - (JNIEnv *, jclass, jint entry, jlong time, jdouble value, jboolean force) +JNIEXPORT jboolean JNICALL +Java_edu_wpi_first_networktables_NetworkTablesJNI_setDouble + (JNIEnv*, jclass, jint entry, jlong time, jdouble value, jboolean force) { if (force) { nt::SetEntryTypeValue(entry, nt::Value::MakeDouble(value, time)); @@ -476,8 +505,9 @@ JNIEXPORT jboolean JNICALL Java_edu_wpi_first_networktables_NetworkTablesJNI_set * Method: setString * Signature: (IJLjava/lang/String;Z)Z */ -JNIEXPORT jboolean JNICALL Java_edu_wpi_first_networktables_NetworkTablesJNI_setString - (JNIEnv *env, jclass, jint entry, jlong time, jstring value, jboolean force) +JNIEXPORT jboolean JNICALL +Java_edu_wpi_first_networktables_NetworkTablesJNI_setString + (JNIEnv* env, jclass, jint entry, jlong time, jstring value, jboolean force) { if (!value) { nullPointerEx.Throw(env, "value cannot be null"); @@ -497,8 +527,10 @@ JNIEXPORT jboolean JNICALL Java_edu_wpi_first_networktables_NetworkTablesJNI_set * Method: setRaw * Signature: (IJ[BZ)Z */ -JNIEXPORT jboolean JNICALL Java_edu_wpi_first_networktables_NetworkTablesJNI_setRaw__IJ_3BZ - (JNIEnv *env, jclass, jint entry, jlong time, jbyteArray value, jboolean force) +JNIEXPORT jboolean JNICALL +Java_edu_wpi_first_networktables_NetworkTablesJNI_setRaw__IJ_3BZ + (JNIEnv* env, jclass, jint entry, jlong time, jbyteArray value, + jboolean force) { if (!value) { nullPointerEx.Throw(env, "value cannot be null"); @@ -516,10 +548,12 @@ JNIEXPORT jboolean JNICALL Java_edu_wpi_first_networktables_NetworkTablesJNI_set /* * Class: edu_wpi_first_networktables_NetworkTablesJNI * Method: setRaw - * Signature: (IJLjava/nio/ByteBuffer;IZ)Z + * Signature: (IJLjava/lang/Object;IZ)Z */ -JNIEXPORT jboolean JNICALL Java_edu_wpi_first_networktables_NetworkTablesJNI_setRaw__IJLjava_nio_ByteBuffer_2IZ - (JNIEnv *env, jclass, jint entry, jlong time, jobject value, jint len, jboolean force) +JNIEXPORT jboolean JNICALL +Java_edu_wpi_first_networktables_NetworkTablesJNI_setRaw__IJLjava_nio_ByteBuffer_2IZ + (JNIEnv* env, jclass, jint entry, jlong time, jobject value, jint len, + jboolean force) { if (!value) { nullPointerEx.Throw(env, "value cannot be null"); @@ -537,10 +571,12 @@ JNIEXPORT jboolean JNICALL Java_edu_wpi_first_networktables_NetworkTablesJNI_set /* * Class: edu_wpi_first_networktables_NetworkTablesJNI * Method: setBooleanArray - * Signature: (IJ[Z)Z + * Signature: (IJ[ZZ)Z */ -JNIEXPORT jboolean JNICALL Java_edu_wpi_first_networktables_NetworkTablesJNI_setBooleanArray - (JNIEnv *env, jclass, jint entry, jlong time, jbooleanArray value, jboolean force) +JNIEXPORT jboolean JNICALL +Java_edu_wpi_first_networktables_NetworkTablesJNI_setBooleanArray + (JNIEnv* env, jclass, jint entry, jlong time, jbooleanArray value, + jboolean force) { if (!value) { nullPointerEx.Throw(env, "value cannot be null"); @@ -560,8 +596,10 @@ JNIEXPORT jboolean JNICALL Java_edu_wpi_first_networktables_NetworkTablesJNI_set * Method: setDoubleArray * Signature: (IJ[DZ)Z */ -JNIEXPORT jboolean JNICALL Java_edu_wpi_first_networktables_NetworkTablesJNI_setDoubleArray - (JNIEnv *env, jclass, jint entry, jlong time, jdoubleArray value, jboolean force) +JNIEXPORT jboolean JNICALL +Java_edu_wpi_first_networktables_NetworkTablesJNI_setDoubleArray + (JNIEnv* env, jclass, jint entry, jlong time, jdoubleArray value, + jboolean force) { if (!value) { nullPointerEx.Throw(env, "value cannot be null"); @@ -579,10 +617,12 @@ JNIEXPORT jboolean JNICALL Java_edu_wpi_first_networktables_NetworkTablesJNI_set /* * Class: edu_wpi_first_networktables_NetworkTablesJNI * Method: setStringArray - * Signature: (IJ[Ljava/lang/String;Z)Z + * Signature: (IJ[Ljava/lang/Object;Z)Z */ -JNIEXPORT jboolean JNICALL Java_edu_wpi_first_networktables_NetworkTablesJNI_setStringArray - (JNIEnv *env, jclass, jint entry, jlong time, jobjectArray value, jboolean force) +JNIEXPORT jboolean JNICALL +Java_edu_wpi_first_networktables_NetworkTablesJNI_setStringArray + (JNIEnv* env, jclass, jint entry, jlong time, jobjectArray value, + jboolean force) { if (!value) { nullPointerEx.Throw(env, "value cannot be null"); @@ -600,10 +640,11 @@ JNIEXPORT jboolean JNICALL Java_edu_wpi_first_networktables_NetworkTablesJNI_set /* * Class: edu_wpi_first_networktables_NetworkTablesJNI * Method: getValue - * Signature: (I)Ledu/wpi/first/networktables/NetworkTableValue; + * Signature: (I)Ljava/lang/Object; */ -JNIEXPORT jobject JNICALL Java_edu_wpi_first_networktables_NetworkTablesJNI_getValue - (JNIEnv *env, jclass, jint entry) +JNIEXPORT jobject JNICALL +Java_edu_wpi_first_networktables_NetworkTablesJNI_getValue + (JNIEnv* env, jclass, jint entry) { auto val = nt::GetEntryValue(entry); return MakeJValue(env, val.get()); @@ -614,8 +655,9 @@ JNIEXPORT jobject JNICALL Java_edu_wpi_first_networktables_NetworkTablesJNI_getV * Method: getBoolean * Signature: (IZ)Z */ -JNIEXPORT jboolean JNICALL Java_edu_wpi_first_networktables_NetworkTablesJNI_getBoolean - (JNIEnv *, jclass, jint entry, jboolean defaultValue) +JNIEXPORT jboolean JNICALL +Java_edu_wpi_first_networktables_NetworkTablesJNI_getBoolean + (JNIEnv*, jclass, jint entry, jboolean defaultValue) { auto val = nt::GetEntryValue(entry); if (!val || !val->IsBoolean()) return defaultValue; @@ -627,8 +669,9 @@ JNIEXPORT jboolean JNICALL Java_edu_wpi_first_networktables_NetworkTablesJNI_get * Method: getDouble * Signature: (ID)D */ -JNIEXPORT jdouble JNICALL Java_edu_wpi_first_networktables_NetworkTablesJNI_getDouble - (JNIEnv *, jclass, jint entry, jdouble defaultValue) +JNIEXPORT jdouble JNICALL +Java_edu_wpi_first_networktables_NetworkTablesJNI_getDouble + (JNIEnv*, jclass, jint entry, jdouble defaultValue) { auto val = nt::GetEntryValue(entry); if (!val || !val->IsDouble()) return defaultValue; @@ -640,8 +683,9 @@ JNIEXPORT jdouble JNICALL Java_edu_wpi_first_networktables_NetworkTablesJNI_getD * Method: getString * Signature: (ILjava/lang/String;)Ljava/lang/String; */ -JNIEXPORT jstring JNICALL Java_edu_wpi_first_networktables_NetworkTablesJNI_getString - (JNIEnv *env, jclass, jint entry, jstring defaultValue) +JNIEXPORT jstring JNICALL +Java_edu_wpi_first_networktables_NetworkTablesJNI_getString + (JNIEnv* env, jclass, jint entry, jstring defaultValue) { auto val = nt::GetEntryValue(entry); if (!val || !val->IsString()) return defaultValue; @@ -653,8 +697,9 @@ JNIEXPORT jstring JNICALL Java_edu_wpi_first_networktables_NetworkTablesJNI_getS * Method: getRaw * Signature: (I[B)[B */ -JNIEXPORT jbyteArray JNICALL Java_edu_wpi_first_networktables_NetworkTablesJNI_getRaw - (JNIEnv *env, jclass, jint entry, jbyteArray defaultValue) +JNIEXPORT jbyteArray JNICALL +Java_edu_wpi_first_networktables_NetworkTablesJNI_getRaw + (JNIEnv* env, jclass, jint entry, jbyteArray defaultValue) { auto val = nt::GetEntryValue(entry); if (!val || !val->IsRaw()) return defaultValue; @@ -666,8 +711,9 @@ JNIEXPORT jbyteArray JNICALL Java_edu_wpi_first_networktables_NetworkTablesJNI_g * Method: getBooleanArray * Signature: (I[Z)[Z */ -JNIEXPORT jbooleanArray JNICALL Java_edu_wpi_first_networktables_NetworkTablesJNI_getBooleanArray - (JNIEnv *env, jclass, jint entry, jbooleanArray defaultValue) +JNIEXPORT jbooleanArray JNICALL +Java_edu_wpi_first_networktables_NetworkTablesJNI_getBooleanArray + (JNIEnv* env, jclass, jint entry, jbooleanArray defaultValue) { auto val = nt::GetEntryValue(entry); if (!val || !val->IsBooleanArray()) return defaultValue; @@ -679,8 +725,9 @@ JNIEXPORT jbooleanArray JNICALL Java_edu_wpi_first_networktables_NetworkTablesJN * Method: getDoubleArray * Signature: (I[D)[D */ -JNIEXPORT jdoubleArray JNICALL Java_edu_wpi_first_networktables_NetworkTablesJNI_getDoubleArray - (JNIEnv *env, jclass, jint entry, jdoubleArray defaultValue) +JNIEXPORT jdoubleArray JNICALL +Java_edu_wpi_first_networktables_NetworkTablesJNI_getDoubleArray + (JNIEnv* env, jclass, jint entry, jdoubleArray defaultValue) { auto val = nt::GetEntryValue(entry); if (!val || !val->IsDoubleArray()) return defaultValue; @@ -690,10 +737,11 @@ JNIEXPORT jdoubleArray JNICALL Java_edu_wpi_first_networktables_NetworkTablesJNI /* * Class: edu_wpi_first_networktables_NetworkTablesJNI * Method: getStringArray - * Signature: (I[Ljava/lang/String;)[Ljava/lang/String; + * Signature: (I[Ljava/lang/Object;)[Ljava/lang/Object; */ -JNIEXPORT jobjectArray JNICALL Java_edu_wpi_first_networktables_NetworkTablesJNI_getStringArray - (JNIEnv *env, jclass, jint entry, jobjectArray defaultValue) +JNIEXPORT jobjectArray JNICALL +Java_edu_wpi_first_networktables_NetworkTablesJNI_getStringArray + (JNIEnv* env, jclass, jint entry, jobjectArray defaultValue) { auto val = nt::GetEntryValue(entry); if (!val || !val->IsStringArray()) return defaultValue; @@ -705,8 +753,9 @@ JNIEXPORT jobjectArray JNICALL Java_edu_wpi_first_networktables_NetworkTablesJNI * Method: setDefaultBoolean * Signature: (IJZ)Z */ -JNIEXPORT jboolean JNICALL Java_edu_wpi_first_networktables_NetworkTablesJNI_setDefaultBoolean - (JNIEnv *, jclass, jint entry, jlong time, jboolean defaultValue) +JNIEXPORT jboolean JNICALL +Java_edu_wpi_first_networktables_NetworkTablesJNI_setDefaultBoolean + (JNIEnv*, jclass, jint entry, jlong time, jboolean defaultValue) { return nt::SetDefaultEntryValue( entry, nt::Value::MakeBoolean(defaultValue != JNI_FALSE, time)); @@ -717,8 +766,9 @@ JNIEXPORT jboolean JNICALL Java_edu_wpi_first_networktables_NetworkTablesJNI_set * Method: setDefaultDouble * Signature: (IJD)Z */ -JNIEXPORT jboolean JNICALL Java_edu_wpi_first_networktables_NetworkTablesJNI_setDefaultDouble - (JNIEnv *, jclass, jint entry, jlong time, jdouble defaultValue) +JNIEXPORT jboolean JNICALL +Java_edu_wpi_first_networktables_NetworkTablesJNI_setDefaultDouble + (JNIEnv*, jclass, jint entry, jlong time, jdouble defaultValue) { return nt::SetDefaultEntryValue(entry, nt::Value::MakeDouble(defaultValue, time)); @@ -729,8 +779,9 @@ JNIEXPORT jboolean JNICALL Java_edu_wpi_first_networktables_NetworkTablesJNI_set * Method: setDefaultString * Signature: (IJLjava/lang/String;)Z */ -JNIEXPORT jboolean JNICALL Java_edu_wpi_first_networktables_NetworkTablesJNI_setDefaultString - (JNIEnv *env, jclass, jint entry, jlong time, jstring defaultValue) +JNIEXPORT jboolean JNICALL +Java_edu_wpi_first_networktables_NetworkTablesJNI_setDefaultString + (JNIEnv* env, jclass, jint entry, jlong time, jstring defaultValue) { if (!defaultValue) { nullPointerEx.Throw(env, "defaultValue cannot be null"); @@ -745,8 +796,9 @@ JNIEXPORT jboolean JNICALL Java_edu_wpi_first_networktables_NetworkTablesJNI_set * Method: setDefaultRaw * Signature: (IJ[B)Z */ -JNIEXPORT jboolean JNICALL Java_edu_wpi_first_networktables_NetworkTablesJNI_setDefaultRaw - (JNIEnv *env, jclass, jint entry, jlong time, jbyteArray defaultValue) +JNIEXPORT jboolean JNICALL +Java_edu_wpi_first_networktables_NetworkTablesJNI_setDefaultRaw + (JNIEnv* env, jclass, jint entry, jlong time, jbyteArray defaultValue) { if (!defaultValue) { nullPointerEx.Throw(env, "defaultValue cannot be null"); @@ -761,8 +813,9 @@ JNIEXPORT jboolean JNICALL Java_edu_wpi_first_networktables_NetworkTablesJNI_set * Method: setDefaultBooleanArray * Signature: (IJ[Z)Z */ -JNIEXPORT jboolean JNICALL Java_edu_wpi_first_networktables_NetworkTablesJNI_setDefaultBooleanArray - (JNIEnv *env, jclass, jint entry, jlong time, jbooleanArray defaultValue) +JNIEXPORT jboolean JNICALL +Java_edu_wpi_first_networktables_NetworkTablesJNI_setDefaultBooleanArray + (JNIEnv* env, jclass, jint entry, jlong time, jbooleanArray defaultValue) { if (!defaultValue) { nullPointerEx.Throw(env, "defaultValue cannot be null"); @@ -777,8 +830,9 @@ JNIEXPORT jboolean JNICALL Java_edu_wpi_first_networktables_NetworkTablesJNI_set * Method: setDefaultDoubleArray * Signature: (IJ[D)Z */ -JNIEXPORT jboolean JNICALL Java_edu_wpi_first_networktables_NetworkTablesJNI_setDefaultDoubleArray - (JNIEnv *env, jclass, jint entry, jlong time, jdoubleArray defaultValue) +JNIEXPORT jboolean JNICALL +Java_edu_wpi_first_networktables_NetworkTablesJNI_setDefaultDoubleArray + (JNIEnv* env, jclass, jint entry, jlong time, jdoubleArray defaultValue) { if (!defaultValue) { nullPointerEx.Throw(env, "defaultValue cannot be null"); @@ -791,10 +845,11 @@ JNIEXPORT jboolean JNICALL Java_edu_wpi_first_networktables_NetworkTablesJNI_set /* * Class: edu_wpi_first_networktables_NetworkTablesJNI * Method: setDefaultStringArray - * Signature: (IJ[Ljava/lang/String;)Z + * Signature: (IJ[Ljava/lang/Object;)Z */ -JNIEXPORT jboolean JNICALL Java_edu_wpi_first_networktables_NetworkTablesJNI_setDefaultStringArray - (JNIEnv *env, jclass, jint entry, jlong time, jobjectArray defaultValue) +JNIEXPORT jboolean JNICALL +Java_edu_wpi_first_networktables_NetworkTablesJNI_setDefaultStringArray + (JNIEnv* env, jclass, jint entry, jlong time, jobjectArray defaultValue) { if (!defaultValue) { nullPointerEx.Throw(env, "defaultValue cannot be null"); @@ -809,8 +864,9 @@ JNIEXPORT jboolean JNICALL Java_edu_wpi_first_networktables_NetworkTablesJNI_set * Method: setEntryFlags * Signature: (II)V */ -JNIEXPORT void JNICALL Java_edu_wpi_first_networktables_NetworkTablesJNI_setEntryFlags - (JNIEnv *, jclass, jint entry, jint flags) +JNIEXPORT void JNICALL +Java_edu_wpi_first_networktables_NetworkTablesJNI_setEntryFlags + (JNIEnv*, jclass, jint entry, jint flags) { nt::SetEntryFlags(entry, flags); } @@ -820,8 +876,9 @@ JNIEXPORT void JNICALL Java_edu_wpi_first_networktables_NetworkTablesJNI_setEntr * Method: getEntryFlags * Signature: (I)I */ -JNIEXPORT jint JNICALL Java_edu_wpi_first_networktables_NetworkTablesJNI_getEntryFlags - (JNIEnv *, jclass, jint entry) +JNIEXPORT jint JNICALL +Java_edu_wpi_first_networktables_NetworkTablesJNI_getEntryFlags + (JNIEnv*, jclass, jint entry) { return nt::GetEntryFlags(entry); } @@ -831,8 +888,9 @@ JNIEXPORT jint JNICALL Java_edu_wpi_first_networktables_NetworkTablesJNI_getEntr * Method: deleteEntry * Signature: (I)V */ -JNIEXPORT void JNICALL Java_edu_wpi_first_networktables_NetworkTablesJNI_deleteEntry - (JNIEnv *, jclass, jint entry) +JNIEXPORT void JNICALL +Java_edu_wpi_first_networktables_NetworkTablesJNI_deleteEntry + (JNIEnv*, jclass, jint entry) { nt::DeleteEntry(entry); } @@ -842,8 +900,9 @@ JNIEXPORT void JNICALL Java_edu_wpi_first_networktables_NetworkTablesJNI_deleteE * Method: deleteAllEntries * Signature: (I)V */ -JNIEXPORT void JNICALL Java_edu_wpi_first_networktables_NetworkTablesJNI_deleteAllEntries - (JNIEnv *, jclass, jint inst) +JNIEXPORT void JNICALL +Java_edu_wpi_first_networktables_NetworkTablesJNI_deleteAllEntries + (JNIEnv*, jclass, jint inst) { nt::DeleteAllEntries(inst); } @@ -851,10 +910,11 @@ JNIEXPORT void JNICALL Java_edu_wpi_first_networktables_NetworkTablesJNI_deleteA /* * Class: edu_wpi_first_networktables_NetworkTablesJNI * Method: getEntryInfoHandle - * Signature: (Ledu/wpi/first/networktables/NetworkTableInstance;I)Ledu/wpi/first/networktables/EntryInfo; + * Signature: (Ljava/lang/Object;I)Ljava/lang/Object; */ -JNIEXPORT jobject JNICALL Java_edu_wpi_first_networktables_NetworkTablesJNI_getEntryInfoHandle - (JNIEnv *env, jclass, jobject inst, jint entry) +JNIEXPORT jobject JNICALL +Java_edu_wpi_first_networktables_NetworkTablesJNI_getEntryInfoHandle + (JNIEnv* env, jclass, jobject inst, jint entry) { return MakeJObject(env, inst, nt::GetEntryInfo(entry)); } @@ -862,10 +922,12 @@ JNIEXPORT jobject JNICALL Java_edu_wpi_first_networktables_NetworkTablesJNI_getE /* * Class: edu_wpi_first_networktables_NetworkTablesJNI * Method: getEntryInfo - * Signature: (Ledu/wpi/first/networktables/NetworkTableInstance;ILjava/lang/String;I)[Ledu/wpi/first/networktables/EntryInfo; + * Signature: (Ljava/lang/Object;ILjava/lang/String;I)[Ljava/lang/Object; */ -JNIEXPORT jobjectArray JNICALL Java_edu_wpi_first_networktables_NetworkTablesJNI_getEntryInfo - (JNIEnv *env, jclass, jobject instObject, jint inst, jstring prefix, jint types) +JNIEXPORT jobjectArray JNICALL +Java_edu_wpi_first_networktables_NetworkTablesJNI_getEntryInfo + (JNIEnv* env, jclass, jobject instObject, jint inst, jstring prefix, + jint types) { if (!prefix) { nullPointerEx.Throw(env, "prefix cannot be null"); @@ -886,8 +948,9 @@ JNIEXPORT jobjectArray JNICALL Java_edu_wpi_first_networktables_NetworkTablesJNI * Method: createEntryListenerPoller * Signature: (I)I */ -JNIEXPORT jint JNICALL Java_edu_wpi_first_networktables_NetworkTablesJNI_createEntryListenerPoller - (JNIEnv *, jclass, jint inst) +JNIEXPORT jint JNICALL +Java_edu_wpi_first_networktables_NetworkTablesJNI_createEntryListenerPoller + (JNIEnv*, jclass, jint inst) { return nt::CreateEntryListenerPoller(inst); } @@ -897,8 +960,9 @@ JNIEXPORT jint JNICALL Java_edu_wpi_first_networktables_NetworkTablesJNI_createE * Method: destroyEntryListenerPoller * Signature: (I)V */ -JNIEXPORT void JNICALL Java_edu_wpi_first_networktables_NetworkTablesJNI_destroyEntryListenerPoller - (JNIEnv *, jclass, jint poller) +JNIEXPORT void JNICALL +Java_edu_wpi_first_networktables_NetworkTablesJNI_destroyEntryListenerPoller + (JNIEnv*, jclass, jint poller) { nt::DestroyEntryListenerPoller(poller); } @@ -908,8 +972,9 @@ JNIEXPORT void JNICALL Java_edu_wpi_first_networktables_NetworkTablesJNI_destroy * Method: addPolledEntryListener * Signature: (ILjava/lang/String;I)I */ -JNIEXPORT jint JNICALL Java_edu_wpi_first_networktables_NetworkTablesJNI_addPolledEntryListener__ILjava_lang_String_2I - (JNIEnv *env, jclass, jint poller, jstring prefix, jint flags) +JNIEXPORT jint JNICALL +Java_edu_wpi_first_networktables_NetworkTablesJNI_addPolledEntryListener__ILjava_lang_String_2I + (JNIEnv* env, jclass, jint poller, jstring prefix, jint flags) { if (!prefix) { nullPointerEx.Throw(env, "prefix cannot be null"); @@ -922,10 +987,11 @@ JNIEXPORT jint JNICALL Java_edu_wpi_first_networktables_NetworkTablesJNI_addPoll /* * Class: edu_wpi_first_networktables_NetworkTablesJNI * Method: addPolledEntryListener - * Signature: (II)I + * Signature: (III)I */ -JNIEXPORT jint JNICALL Java_edu_wpi_first_networktables_NetworkTablesJNI_addPolledEntryListener__III - (JNIEnv *env, jclass, jint poller, jint entry, jint flags) +JNIEXPORT jint JNICALL +Java_edu_wpi_first_networktables_NetworkTablesJNI_addPolledEntryListener__III + (JNIEnv* env, jclass, jint poller, jint entry, jint flags) { return nt::AddPolledEntryListener(poller, entry, flags); } @@ -933,10 +999,11 @@ JNIEXPORT jint JNICALL Java_edu_wpi_first_networktables_NetworkTablesJNI_addPoll /* * Class: edu_wpi_first_networktables_NetworkTablesJNI * Method: pollEntryListener - * Signature: (Ledu/wpi/first/networktables/NetworkTableInstance;I)[Ledu/wpi/first/networktables/EntryNotification; + * Signature: (Ljava/lang/Object;I)[Ljava/lang/Object; */ -JNIEXPORT jobjectArray JNICALL Java_edu_wpi_first_networktables_NetworkTablesJNI_pollEntryListener - (JNIEnv *env, jclass, jobject inst, jint poller) +JNIEXPORT jobjectArray JNICALL +Java_edu_wpi_first_networktables_NetworkTablesJNI_pollEntryListener + (JNIEnv* env, jclass, jobject inst, jint poller) { auto events = nt::PollEntryListener(poller); if (events.empty()) { @@ -949,10 +1016,11 @@ JNIEXPORT jobjectArray JNICALL Java_edu_wpi_first_networktables_NetworkTablesJNI /* * Class: edu_wpi_first_networktables_NetworkTablesJNI * Method: pollEntryListenerTimeout - * Signature: (Ledu/wpi/first/networktables/NetworkTableInstance;ID)[Ledu/wpi/first/networktables/EntryNotification; + * Signature: (Ljava/lang/Object;ID)[Ljava/lang/Object; */ -JNIEXPORT jobjectArray JNICALL Java_edu_wpi_first_networktables_NetworkTablesJNI_pollEntryListenerTimeout - (JNIEnv *env, jclass, jobject inst, jint poller, jdouble timeout) +JNIEXPORT jobjectArray JNICALL +Java_edu_wpi_first_networktables_NetworkTablesJNI_pollEntryListenerTimeout + (JNIEnv* env, jclass, jobject inst, jint poller, jdouble timeout) { bool timed_out = false; auto events = nt::PollEntryListener(poller, timeout, &timed_out); @@ -968,8 +1036,9 @@ JNIEXPORT jobjectArray JNICALL Java_edu_wpi_first_networktables_NetworkTablesJNI * Method: cancelPollEntryListener * Signature: (I)V */ -JNIEXPORT void JNICALL Java_edu_wpi_first_networktables_NetworkTablesJNI_cancelPollEntryListener - (JNIEnv *, jclass, jint poller) +JNIEXPORT void JNICALL +Java_edu_wpi_first_networktables_NetworkTablesJNI_cancelPollEntryListener + (JNIEnv*, jclass, jint poller) { nt::CancelPollEntryListener(poller); } @@ -979,8 +1048,9 @@ JNIEXPORT void JNICALL Java_edu_wpi_first_networktables_NetworkTablesJNI_cancelP * Method: removeEntryListener * Signature: (I)V */ -JNIEXPORT void JNICALL Java_edu_wpi_first_networktables_NetworkTablesJNI_removeEntryListener - (JNIEnv *, jclass, jint entryListenerUid) +JNIEXPORT void JNICALL +Java_edu_wpi_first_networktables_NetworkTablesJNI_removeEntryListener + (JNIEnv*, jclass, jint entryListenerUid) { nt::RemoveEntryListener(entryListenerUid); } @@ -990,8 +1060,9 @@ JNIEXPORT void JNICALL Java_edu_wpi_first_networktables_NetworkTablesJNI_removeE * Method: waitForEntryListenerQueue * Signature: (ID)Z */ -JNIEXPORT jboolean JNICALL Java_edu_wpi_first_networktables_NetworkTablesJNI_waitForEntryListenerQueue - (JNIEnv *, jclass, jint inst, jdouble timeout) +JNIEXPORT jboolean JNICALL +Java_edu_wpi_first_networktables_NetworkTablesJNI_waitForEntryListenerQueue + (JNIEnv*, jclass, jint inst, jdouble timeout) { return nt::WaitForEntryListenerQueue(inst, timeout); } @@ -1001,8 +1072,9 @@ JNIEXPORT jboolean JNICALL Java_edu_wpi_first_networktables_NetworkTablesJNI_wai * Method: createConnectionListenerPoller * Signature: (I)I */ -JNIEXPORT jint JNICALL Java_edu_wpi_first_networktables_NetworkTablesJNI_createConnectionListenerPoller - (JNIEnv *, jclass, jint inst) +JNIEXPORT jint JNICALL +Java_edu_wpi_first_networktables_NetworkTablesJNI_createConnectionListenerPoller + (JNIEnv*, jclass, jint inst) { return nt::CreateConnectionListenerPoller(inst); } @@ -1012,8 +1084,9 @@ JNIEXPORT jint JNICALL Java_edu_wpi_first_networktables_NetworkTablesJNI_createC * Method: destroyConnectionListenerPoller * Signature: (I)V */ -JNIEXPORT void JNICALL Java_edu_wpi_first_networktables_NetworkTablesJNI_destroyConnectionListenerPoller - (JNIEnv *, jclass, jint poller) +JNIEXPORT void JNICALL +Java_edu_wpi_first_networktables_NetworkTablesJNI_destroyConnectionListenerPoller + (JNIEnv*, jclass, jint poller) { nt::DestroyConnectionListenerPoller(poller); } @@ -1021,10 +1094,11 @@ JNIEXPORT void JNICALL Java_edu_wpi_first_networktables_NetworkTablesJNI_destroy /* * Class: edu_wpi_first_networktables_NetworkTablesJNI * Method: addPolledConnectionListener - * Signature: (I)I + * Signature: (IZ)I */ -JNIEXPORT jint JNICALL Java_edu_wpi_first_networktables_NetworkTablesJNI_addPolledConnectionListener - (JNIEnv *env, jclass, jint poller, jboolean immediateNotify) +JNIEXPORT jint JNICALL +Java_edu_wpi_first_networktables_NetworkTablesJNI_addPolledConnectionListener + (JNIEnv* env, jclass, jint poller, jboolean immediateNotify) { return nt::AddPolledConnectionListener(poller, immediateNotify); } @@ -1032,10 +1106,11 @@ JNIEXPORT jint JNICALL Java_edu_wpi_first_networktables_NetworkTablesJNI_addPoll /* * Class: edu_wpi_first_networktables_NetworkTablesJNI * Method: pollConnectionListener - * Signature: (Ledu/wpi/first/networktables/NetworkTableInstance;I)[Ledu/wpi/first/networktables/ConnectionNotification; + * Signature: (Ljava/lang/Object;I)[Ljava/lang/Object; */ -JNIEXPORT jobjectArray JNICALL Java_edu_wpi_first_networktables_NetworkTablesJNI_pollConnectionListener - (JNIEnv *env, jclass, jobject inst, jint poller) +JNIEXPORT jobjectArray JNICALL +Java_edu_wpi_first_networktables_NetworkTablesJNI_pollConnectionListener + (JNIEnv* env, jclass, jobject inst, jint poller) { auto events = nt::PollConnectionListener(poller); if (events.empty()) { @@ -1048,10 +1123,11 @@ JNIEXPORT jobjectArray JNICALL Java_edu_wpi_first_networktables_NetworkTablesJNI /* * Class: edu_wpi_first_networktables_NetworkTablesJNI * Method: pollConnectionListenerTimeout - * Signature: (Ledu/wpi/first/networktables/NetworkTableInstance;ID)[Ledu/wpi/first/networktables/ConnectionNotification; + * Signature: (Ljava/lang/Object;ID)[Ljava/lang/Object; */ -JNIEXPORT jobjectArray JNICALL Java_edu_wpi_first_networktables_NetworkTablesJNI_pollConnectionListenerTimeout - (JNIEnv *env, jclass, jobject inst, jint poller, jdouble timeout) +JNIEXPORT jobjectArray JNICALL +Java_edu_wpi_first_networktables_NetworkTablesJNI_pollConnectionListenerTimeout + (JNIEnv* env, jclass, jobject inst, jint poller, jdouble timeout) { bool timed_out = false; auto events = nt::PollConnectionListener(poller, timeout, &timed_out); @@ -1067,8 +1143,9 @@ JNIEXPORT jobjectArray JNICALL Java_edu_wpi_first_networktables_NetworkTablesJNI * Method: cancelPollConnectionListener * Signature: (I)V */ -JNIEXPORT void JNICALL Java_edu_wpi_first_networktables_NetworkTablesJNI_cancelPollConnectionListener - (JNIEnv *, jclass, jint poller) +JNIEXPORT void JNICALL +Java_edu_wpi_first_networktables_NetworkTablesJNI_cancelPollConnectionListener + (JNIEnv*, jclass, jint poller) { nt::CancelPollConnectionListener(poller); } @@ -1078,8 +1155,9 @@ JNIEXPORT void JNICALL Java_edu_wpi_first_networktables_NetworkTablesJNI_cancelP * Method: removeConnectionListener * Signature: (I)V */ -JNIEXPORT void JNICALL Java_edu_wpi_first_networktables_NetworkTablesJNI_removeConnectionListener - (JNIEnv *, jclass, jint connListenerUid) +JNIEXPORT void JNICALL +Java_edu_wpi_first_networktables_NetworkTablesJNI_removeConnectionListener + (JNIEnv*, jclass, jint connListenerUid) { nt::RemoveConnectionListener(connListenerUid); } @@ -1089,8 +1167,9 @@ JNIEXPORT void JNICALL Java_edu_wpi_first_networktables_NetworkTablesJNI_removeC * Method: waitForConnectionListenerQueue * Signature: (ID)Z */ -JNIEXPORT jboolean JNICALL Java_edu_wpi_first_networktables_NetworkTablesJNI_waitForConnectionListenerQueue - (JNIEnv *, jclass, jint inst, jdouble timeout) +JNIEXPORT jboolean JNICALL +Java_edu_wpi_first_networktables_NetworkTablesJNI_waitForConnectionListenerQueue + (JNIEnv*, jclass, jint inst, jdouble timeout) { return nt::WaitForConnectionListenerQueue(inst, timeout); } @@ -1100,8 +1179,9 @@ JNIEXPORT jboolean JNICALL Java_edu_wpi_first_networktables_NetworkTablesJNI_wai * Method: createRpcCallPoller * Signature: (I)I */ -JNIEXPORT jint JNICALL Java_edu_wpi_first_networktables_NetworkTablesJNI_createRpcCallPoller - (JNIEnv *, jclass, jint inst) +JNIEXPORT jint JNICALL +Java_edu_wpi_first_networktables_NetworkTablesJNI_createRpcCallPoller + (JNIEnv*, jclass, jint inst) { return nt::CreateRpcCallPoller(inst); } @@ -1111,8 +1191,9 @@ JNIEXPORT jint JNICALL Java_edu_wpi_first_networktables_NetworkTablesJNI_createR * Method: destroyRpcCallPoller * Signature: (I)V */ -JNIEXPORT void JNICALL Java_edu_wpi_first_networktables_NetworkTablesJNI_destroyRpcCallPoller - (JNIEnv *, jclass, jint poller) +JNIEXPORT void JNICALL +Java_edu_wpi_first_networktables_NetworkTablesJNI_destroyRpcCallPoller + (JNIEnv*, jclass, jint poller) { nt::DestroyRpcCallPoller(poller); } @@ -1122,8 +1203,9 @@ JNIEXPORT void JNICALL Java_edu_wpi_first_networktables_NetworkTablesJNI_destroy * Method: createPolledRpc * Signature: (I[BI)V */ -JNIEXPORT void JNICALL Java_edu_wpi_first_networktables_NetworkTablesJNI_createPolledRpc - (JNIEnv *env, jclass, jint entry, jbyteArray def, jint poller) +JNIEXPORT void JNICALL +Java_edu_wpi_first_networktables_NetworkTablesJNI_createPolledRpc + (JNIEnv* env, jclass, jint entry, jbyteArray def, jint poller) { if (!def) { nullPointerEx.Throw(env, "def cannot be null"); @@ -1135,10 +1217,11 @@ JNIEXPORT void JNICALL Java_edu_wpi_first_networktables_NetworkTablesJNI_createP /* * Class: edu_wpi_first_networktables_NetworkTablesJNI * Method: pollRpc - * Signature: (Ledu/wpi/first/networktables/NetworkTableInstance;I)[Ledu/wpi/first/networktables/RpcAnswer; + * Signature: (Ljava/lang/Object;I)[Ljava/lang/Object; */ -JNIEXPORT jobjectArray JNICALL Java_edu_wpi_first_networktables_NetworkTablesJNI_pollRpc - (JNIEnv *env, jclass, jobject inst, jint poller) +JNIEXPORT jobjectArray JNICALL +Java_edu_wpi_first_networktables_NetworkTablesJNI_pollRpc + (JNIEnv* env, jclass, jobject inst, jint poller) { auto infos = nt::PollRpc(poller); if (infos.empty()) { @@ -1151,10 +1234,11 @@ JNIEXPORT jobjectArray JNICALL Java_edu_wpi_first_networktables_NetworkTablesJNI /* * Class: edu_wpi_first_networktables_NetworkTablesJNI * Method: pollRpcTimeout - * Signature: (Ledu/wpi/first/networktables/NetworkTableInstance;ID)[Ledu/wpi/first/networktables/RpcAnswer; + * Signature: (Ljava/lang/Object;ID)[Ljava/lang/Object; */ -JNIEXPORT jobjectArray JNICALL Java_edu_wpi_first_networktables_NetworkTablesJNI_pollRpcTimeout - (JNIEnv *env, jclass, jobject inst, jint poller, jdouble timeout) +JNIEXPORT jobjectArray JNICALL +Java_edu_wpi_first_networktables_NetworkTablesJNI_pollRpcTimeout + (JNIEnv* env, jclass, jobject inst, jint poller, jdouble timeout) { bool timed_out = false; auto infos = nt::PollRpc(poller, timeout, &timed_out); @@ -1170,8 +1254,9 @@ JNIEXPORT jobjectArray JNICALL Java_edu_wpi_first_networktables_NetworkTablesJNI * Method: cancelPollRpc * Signature: (I)V */ -JNIEXPORT void JNICALL Java_edu_wpi_first_networktables_NetworkTablesJNI_cancelPollRpc - (JNIEnv *, jclass, jint poller) +JNIEXPORT void JNICALL +Java_edu_wpi_first_networktables_NetworkTablesJNI_cancelPollRpc + (JNIEnv*, jclass, jint poller) { nt::CancelPollRpc(poller); } @@ -1181,8 +1266,9 @@ JNIEXPORT void JNICALL Java_edu_wpi_first_networktables_NetworkTablesJNI_cancelP * Method: waitForRpcCallQueue * Signature: (ID)Z */ -JNIEXPORT jboolean JNICALL Java_edu_wpi_first_networktables_NetworkTablesJNI_waitForRpcCallQueue - (JNIEnv *, jclass, jint inst, jdouble timeout) +JNIEXPORT jboolean JNICALL +Java_edu_wpi_first_networktables_NetworkTablesJNI_waitForRpcCallQueue + (JNIEnv*, jclass, jint inst, jdouble timeout) { return nt::WaitForRpcCallQueue(inst, timeout); } @@ -1192,8 +1278,9 @@ JNIEXPORT jboolean JNICALL Java_edu_wpi_first_networktables_NetworkTablesJNI_wai * Method: postRpcResponse * Signature: (II[B)V */ -JNIEXPORT void JNICALL Java_edu_wpi_first_networktables_NetworkTablesJNI_postRpcResponse - (JNIEnv *env, jclass, jint entry, jint call, jbyteArray result) +JNIEXPORT void JNICALL +Java_edu_wpi_first_networktables_NetworkTablesJNI_postRpcResponse + (JNIEnv* env, jclass, jint entry, jint call, jbyteArray result) { if (!result) { nullPointerEx.Throw(env, "result cannot be null"); @@ -1207,8 +1294,9 @@ JNIEXPORT void JNICALL Java_edu_wpi_first_networktables_NetworkTablesJNI_postRpc * Method: callRpc * Signature: (I[B)I */ -JNIEXPORT jint JNICALL Java_edu_wpi_first_networktables_NetworkTablesJNI_callRpc - (JNIEnv *env, jclass, jint entry, jbyteArray params) +JNIEXPORT jint JNICALL +Java_edu_wpi_first_networktables_NetworkTablesJNI_callRpc + (JNIEnv* env, jclass, jint entry, jbyteArray params) { if (!params) { nullPointerEx.Throw(env, "params cannot be null"); @@ -1222,8 +1310,9 @@ JNIEXPORT jint JNICALL Java_edu_wpi_first_networktables_NetworkTablesJNI_callRpc * Method: getRpcResult * Signature: (II)[B */ -JNIEXPORT jbyteArray JNICALL Java_edu_wpi_first_networktables_NetworkTablesJNI_getRpcResult__II - (JNIEnv *env, jclass, jint entry, jint call) +JNIEXPORT jbyteArray JNICALL +Java_edu_wpi_first_networktables_NetworkTablesJNI_getRpcResult__II + (JNIEnv* env, jclass, jint entry, jint call) { std::string result; if (!nt::GetRpcResult(entry, call, &result)) return nullptr; @@ -1235,8 +1324,9 @@ JNIEXPORT jbyteArray JNICALL Java_edu_wpi_first_networktables_NetworkTablesJNI_g * Method: getRpcResult * Signature: (IID)[B */ -JNIEXPORT jbyteArray JNICALL Java_edu_wpi_first_networktables_NetworkTablesJNI_getRpcResult__IID - (JNIEnv *env, jclass, jint entry, jint call, jdouble timeout) +JNIEXPORT jbyteArray JNICALL +Java_edu_wpi_first_networktables_NetworkTablesJNI_getRpcResult__IID + (JNIEnv* env, jclass, jint entry, jint call, jdouble timeout) { std::string result; bool timed_out = false; @@ -1250,8 +1340,9 @@ JNIEXPORT jbyteArray JNICALL Java_edu_wpi_first_networktables_NetworkTablesJNI_g * Method: cancelRpcResult * Signature: (II)V */ -JNIEXPORT void JNICALL Java_edu_wpi_first_networktables_NetworkTablesJNI_cancelRpcResult - (JNIEnv *, jclass, jint entry, jint call) +JNIEXPORT void JNICALL +Java_edu_wpi_first_networktables_NetworkTablesJNI_cancelRpcResult + (JNIEnv*, jclass, jint entry, jint call) { nt::CancelRpcResult(entry, call); } @@ -1261,8 +1352,9 @@ JNIEXPORT void JNICALL Java_edu_wpi_first_networktables_NetworkTablesJNI_cancelR * Method: getRpc * Signature: (I[B)[B */ -JNIEXPORT jbyteArray JNICALL Java_edu_wpi_first_networktables_NetworkTablesJNI_getRpc - (JNIEnv *env, jclass, jint entry, jbyteArray defaultValue) +JNIEXPORT jbyteArray JNICALL +Java_edu_wpi_first_networktables_NetworkTablesJNI_getRpc + (JNIEnv* env, jclass, jint entry, jbyteArray defaultValue) { auto val = nt::GetEntryValue(entry); if (!val || !val->IsRpc()) return defaultValue; @@ -1274,8 +1366,9 @@ JNIEXPORT jbyteArray JNICALL Java_edu_wpi_first_networktables_NetworkTablesJNI_g * Method: setNetworkIdentity * Signature: (ILjava/lang/String;)V */ -JNIEXPORT void JNICALL Java_edu_wpi_first_networktables_NetworkTablesJNI_setNetworkIdentity - (JNIEnv *env, jclass, jint inst, jstring name) +JNIEXPORT void JNICALL +Java_edu_wpi_first_networktables_NetworkTablesJNI_setNetworkIdentity + (JNIEnv* env, jclass, jint inst, jstring name) { if (!name) { nullPointerEx.Throw(env, "name cannot be null"); @@ -1289,8 +1382,9 @@ JNIEXPORT void JNICALL Java_edu_wpi_first_networktables_NetworkTablesJNI_setNetw * Method: getNetworkMode * Signature: (I)I */ -JNIEXPORT jint JNICALL Java_edu_wpi_first_networktables_NetworkTablesJNI_getNetworkMode - (JNIEnv *, jclass, jint inst) +JNIEXPORT jint JNICALL +Java_edu_wpi_first_networktables_NetworkTablesJNI_getNetworkMode + (JNIEnv*, jclass, jint inst) { return nt::GetNetworkMode(inst); } @@ -1300,8 +1394,10 @@ JNIEXPORT jint JNICALL Java_edu_wpi_first_networktables_NetworkTablesJNI_getNetw * Method: startServer * Signature: (ILjava/lang/String;Ljava/lang/String;I)V */ -JNIEXPORT void JNICALL Java_edu_wpi_first_networktables_NetworkTablesJNI_startServer - (JNIEnv *env, jclass, jint inst, jstring persistFilename, jstring listenAddress, jint port) +JNIEXPORT void JNICALL +Java_edu_wpi_first_networktables_NetworkTablesJNI_startServer + (JNIEnv* env, jclass, jint inst, jstring persistFilename, + jstring listenAddress, jint port) { if (!persistFilename) { nullPointerEx.Throw(env, "persistFilename cannot be null"); @@ -1320,8 +1416,9 @@ JNIEXPORT void JNICALL Java_edu_wpi_first_networktables_NetworkTablesJNI_startSe * Method: stopServer * Signature: (I)V */ -JNIEXPORT void JNICALL Java_edu_wpi_first_networktables_NetworkTablesJNI_stopServer - (JNIEnv *, jclass, jint inst) +JNIEXPORT void JNICALL +Java_edu_wpi_first_networktables_NetworkTablesJNI_stopServer + (JNIEnv*, jclass, jint inst) { nt::StopServer(inst); } @@ -1331,8 +1428,9 @@ JNIEXPORT void JNICALL Java_edu_wpi_first_networktables_NetworkTablesJNI_stopSer * Method: startClient * Signature: (I)V */ -JNIEXPORT void JNICALL Java_edu_wpi_first_networktables_NetworkTablesJNI_startClient__I - (JNIEnv *, jclass, jint inst) +JNIEXPORT void JNICALL +Java_edu_wpi_first_networktables_NetworkTablesJNI_startClient__I + (JNIEnv*, jclass, jint inst) { nt::StartClient(inst); } @@ -1342,8 +1440,9 @@ JNIEXPORT void JNICALL Java_edu_wpi_first_networktables_NetworkTablesJNI_startCl * Method: startClient * Signature: (ILjava/lang/String;I)V */ -JNIEXPORT void JNICALL Java_edu_wpi_first_networktables_NetworkTablesJNI_startClient__ILjava_lang_String_2I - (JNIEnv *env, jclass, jint inst, jstring serverName, jint port) +JNIEXPORT void JNICALL +Java_edu_wpi_first_networktables_NetworkTablesJNI_startClient__ILjava_lang_String_2I + (JNIEnv* env, jclass, jint inst, jstring serverName, jint port) { if (!serverName) { nullPointerEx.Throw(env, "serverName cannot be null"); @@ -1355,10 +1454,11 @@ JNIEXPORT void JNICALL Java_edu_wpi_first_networktables_NetworkTablesJNI_startCl /* * Class: edu_wpi_first_networktables_NetworkTablesJNI * Method: startClient - * Signature: (I[Ljava/lang/String;[I)V + * Signature: (I[Ljava/lang/Object;[I)V */ -JNIEXPORT void JNICALL Java_edu_wpi_first_networktables_NetworkTablesJNI_startClient__I_3Ljava_lang_String_2_3I - (JNIEnv *env, jclass, jint inst, jobjectArray serverNames, jintArray ports) +JNIEXPORT void JNICALL +Java_edu_wpi_first_networktables_NetworkTablesJNI_startClient__I_3Ljava_lang_String_2_3I + (JNIEnv* env, jclass, jint inst, jobjectArray serverNames, jintArray ports) { if (!serverNames) { nullPointerEx.Throw(env, "serverNames cannot be null"); @@ -1389,8 +1489,8 @@ JNIEXPORT void JNICALL Java_edu_wpi_first_networktables_NetworkTablesJNI_startCl return; } names.emplace_back(JStringRef{env, elem}.str()); - servers.emplace_back(std::make_pair(nt::StringRef(names.back()), - portInts[i])); + servers.emplace_back( + std::make_pair(nt::StringRef(names.back()), portInts[i])); } env->ReleaseIntArrayElements(ports, portInts, JNI_ABORT); nt::StartClient(inst, servers); @@ -1401,8 +1501,9 @@ JNIEXPORT void JNICALL Java_edu_wpi_first_networktables_NetworkTablesJNI_startCl * Method: startClientTeam * Signature: (III)V */ -JNIEXPORT void JNICALL Java_edu_wpi_first_networktables_NetworkTablesJNI_startClientTeam - (JNIEnv *env, jclass cls, jint inst, jint team, jint port) +JNIEXPORT void JNICALL +Java_edu_wpi_first_networktables_NetworkTablesJNI_startClientTeam + (JNIEnv* env, jclass cls, jint inst, jint team, jint port) { nt::StartClientTeam(inst, team, port); } @@ -1412,8 +1513,9 @@ JNIEXPORT void JNICALL Java_edu_wpi_first_networktables_NetworkTablesJNI_startCl * Method: stopClient * Signature: (I)V */ -JNIEXPORT void JNICALL Java_edu_wpi_first_networktables_NetworkTablesJNI_stopClient - (JNIEnv *, jclass, jint inst) +JNIEXPORT void JNICALL +Java_edu_wpi_first_networktables_NetworkTablesJNI_stopClient + (JNIEnv*, jclass, jint inst) { nt::StopClient(inst); } @@ -1423,8 +1525,9 @@ JNIEXPORT void JNICALL Java_edu_wpi_first_networktables_NetworkTablesJNI_stopCli * Method: setServer * Signature: (ILjava/lang/String;I)V */ -JNIEXPORT void JNICALL Java_edu_wpi_first_networktables_NetworkTablesJNI_setServer__ILjava_lang_String_2I - (JNIEnv *env, jclass, jint inst, jstring serverName, jint port) +JNIEXPORT void JNICALL +Java_edu_wpi_first_networktables_NetworkTablesJNI_setServer__ILjava_lang_String_2I + (JNIEnv* env, jclass, jint inst, jstring serverName, jint port) { if (!serverName) { nullPointerEx.Throw(env, "serverName cannot be null"); @@ -1436,10 +1539,11 @@ JNIEXPORT void JNICALL Java_edu_wpi_first_networktables_NetworkTablesJNI_setServ /* * Class: edu_wpi_first_networktables_NetworkTablesJNI * Method: setServer - * Signature: (I[Ljava/lang/String;[I)V + * Signature: (I[Ljava/lang/Object;[I)V */ -JNIEXPORT void JNICALL Java_edu_wpi_first_networktables_NetworkTablesJNI_setServer__I_3Ljava_lang_String_2_3I - (JNIEnv *env, jclass, jint inst, jobjectArray serverNames, jintArray ports) +JNIEXPORT void JNICALL +Java_edu_wpi_first_networktables_NetworkTablesJNI_setServer__I_3Ljava_lang_String_2_3I + (JNIEnv* env, jclass, jint inst, jobjectArray serverNames, jintArray ports) { if (!serverNames) { nullPointerEx.Throw(env, "serverNames cannot be null"); @@ -1470,8 +1574,8 @@ JNIEXPORT void JNICALL Java_edu_wpi_first_networktables_NetworkTablesJNI_setServ return; } names.emplace_back(JStringRef{env, elem}.str()); - servers.emplace_back(std::make_pair(nt::StringRef(names.back()), - portInts[i])); + servers.emplace_back( + std::make_pair(nt::StringRef(names.back()), portInts[i])); } env->ReleaseIntArrayElements(ports, portInts, JNI_ABORT); nt::SetServer(inst, servers); @@ -1482,8 +1586,9 @@ JNIEXPORT void JNICALL Java_edu_wpi_first_networktables_NetworkTablesJNI_setServ * Method: setServerTeam * Signature: (III)V */ -JNIEXPORT void JNICALL Java_edu_wpi_first_networktables_NetworkTablesJNI_setServerTeam - (JNIEnv *env, jclass, jint inst, jint team, jint port) +JNIEXPORT void JNICALL +Java_edu_wpi_first_networktables_NetworkTablesJNI_setServerTeam + (JNIEnv* env, jclass, jint inst, jint team, jint port) { nt::SetServerTeam(inst, team, port); } @@ -1493,8 +1598,9 @@ JNIEXPORT void JNICALL Java_edu_wpi_first_networktables_NetworkTablesJNI_setServ * Method: startDSClient * Signature: (II)V */ -JNIEXPORT void JNICALL Java_edu_wpi_first_networktables_NetworkTablesJNI_startDSClient - (JNIEnv *, jclass, jint inst, jint port) +JNIEXPORT void JNICALL +Java_edu_wpi_first_networktables_NetworkTablesJNI_startDSClient + (JNIEnv*, jclass, jint inst, jint port) { nt::StartDSClient(inst, port); } @@ -1504,8 +1610,9 @@ JNIEXPORT void JNICALL Java_edu_wpi_first_networktables_NetworkTablesJNI_startDS * Method: stopDSClient * Signature: (I)V */ -JNIEXPORT void JNICALL Java_edu_wpi_first_networktables_NetworkTablesJNI_stopDSClient - (JNIEnv *, jclass, jint inst) +JNIEXPORT void JNICALL +Java_edu_wpi_first_networktables_NetworkTablesJNI_stopDSClient + (JNIEnv*, jclass, jint inst) { nt::StopDSClient(inst); } @@ -1515,8 +1622,9 @@ JNIEXPORT void JNICALL Java_edu_wpi_first_networktables_NetworkTablesJNI_stopDSC * Method: setUpdateRate * Signature: (ID)V */ -JNIEXPORT void JNICALL Java_edu_wpi_first_networktables_NetworkTablesJNI_setUpdateRate - (JNIEnv *, jclass, jint inst, jdouble interval) +JNIEXPORT void JNICALL +Java_edu_wpi_first_networktables_NetworkTablesJNI_setUpdateRate + (JNIEnv*, jclass, jint inst, jdouble interval) { nt::SetUpdateRate(inst, interval); } @@ -1526,8 +1634,9 @@ JNIEXPORT void JNICALL Java_edu_wpi_first_networktables_NetworkTablesJNI_setUpda * Method: flush * Signature: (I)V */ -JNIEXPORT void JNICALL Java_edu_wpi_first_networktables_NetworkTablesJNI_flush - (JNIEnv *, jclass, jint inst) +JNIEXPORT void JNICALL +Java_edu_wpi_first_networktables_NetworkTablesJNI_flush + (JNIEnv*, jclass, jint inst) { nt::Flush(inst); } @@ -1535,10 +1644,11 @@ JNIEXPORT void JNICALL Java_edu_wpi_first_networktables_NetworkTablesJNI_flush /* * Class: edu_wpi_first_networktables_NetworkTablesJNI * Method: getConnections - * Signature: (I)[Ledu/wpi/first/networktables/ConnectionInfo; + * Signature: (I)[Ljava/lang/Object; */ -JNIEXPORT jobjectArray JNICALL Java_edu_wpi_first_networktables_NetworkTablesJNI_getConnections - (JNIEnv *env, jclass, jint inst) +JNIEXPORT jobjectArray JNICALL +Java_edu_wpi_first_networktables_NetworkTablesJNI_getConnections + (JNIEnv* env, jclass, jint inst) { auto arr = nt::GetConnections(inst); jobjectArray jarr = @@ -1556,8 +1666,9 @@ JNIEXPORT jobjectArray JNICALL Java_edu_wpi_first_networktables_NetworkTablesJNI * Method: isConnected * Signature: (I)Z */ -JNIEXPORT jboolean JNICALL Java_edu_wpi_first_networktables_NetworkTablesJNI_isConnected - (JNIEnv *, jclass, jint inst) +JNIEXPORT jboolean JNICALL +Java_edu_wpi_first_networktables_NetworkTablesJNI_isConnected + (JNIEnv*, jclass, jint inst) { return nt::IsConnected(inst); } @@ -1567,24 +1678,26 @@ JNIEXPORT jboolean JNICALL Java_edu_wpi_first_networktables_NetworkTablesJNI_isC * Method: savePersistent * Signature: (ILjava/lang/String;)V */ -JNIEXPORT void JNICALL Java_edu_wpi_first_networktables_NetworkTablesJNI_savePersistent - (JNIEnv *env, jclass, jint inst, jstring filename) +JNIEXPORT void JNICALL +Java_edu_wpi_first_networktables_NetworkTablesJNI_savePersistent + (JNIEnv* env, jclass, jint inst, jstring filename) { if (!filename) { nullPointerEx.Throw(env, "filename cannot be null"); return; } - const char *err = nt::SavePersistent(inst, JStringRef{env, filename}.str()); + const char* err = nt::SavePersistent(inst, JStringRef{env, filename}.str()); if (err) persistentEx.Throw(env, err); } /* * Class: edu_wpi_first_networktables_NetworkTablesJNI * Method: loadPersistent - * Signature: (ILjava/lang/String;)[Ljava/lang/String; + * Signature: (ILjava/lang/String;)[Ljava/lang/Object; */ -JNIEXPORT jobjectArray JNICALL Java_edu_wpi_first_networktables_NetworkTablesJNI_loadPersistent - (JNIEnv *env, jclass, jint inst, jstring filename) +JNIEXPORT jobjectArray JNICALL +Java_edu_wpi_first_networktables_NetworkTablesJNI_loadPersistent + (JNIEnv* env, jclass, jint inst, jstring filename) { if (!filename) { nullPointerEx.Throw(env, "filename cannot be null"); @@ -1610,8 +1723,9 @@ JNIEXPORT jobjectArray JNICALL Java_edu_wpi_first_networktables_NetworkTablesJNI * Method: saveEntries * Signature: (ILjava/lang/String;Ljava/lang/String;)V */ -JNIEXPORT void JNICALL Java_edu_wpi_first_networktables_NetworkTablesJNI_saveEntries - (JNIEnv *env, jclass, jint inst, jstring filename, jstring prefix) +JNIEXPORT void JNICALL +Java_edu_wpi_first_networktables_NetworkTablesJNI_saveEntries + (JNIEnv* env, jclass, jint inst, jstring filename, jstring prefix) { if (!filename) { nullPointerEx.Throw(env, "filename cannot be null"); @@ -1629,10 +1743,11 @@ JNIEXPORT void JNICALL Java_edu_wpi_first_networktables_NetworkTablesJNI_saveEnt /* * Class: edu_wpi_first_networktables_NetworkTablesJNI * Method: loadEntries - * Signature: (ILjava/lang/String;Ljava/lang/String;)[Ljava/lang/String; + * Signature: (ILjava/lang/String;Ljava/lang/String;)[Ljava/lang/Object; */ -JNIEXPORT jobjectArray JNICALL Java_edu_wpi_first_networktables_NetworkTablesJNI_loadEntries - (JNIEnv *env, jclass, jint inst, jstring filename, jstring prefix) +JNIEXPORT jobjectArray JNICALL +Java_edu_wpi_first_networktables_NetworkTablesJNI_loadEntries + (JNIEnv* env, jclass, jint inst, jstring filename, jstring prefix) { if (!filename) { nullPointerEx.Throw(env, "filename cannot be null"); @@ -1663,8 +1778,9 @@ JNIEXPORT jobjectArray JNICALL Java_edu_wpi_first_networktables_NetworkTablesJNI * Method: now * Signature: ()J */ -JNIEXPORT jlong JNICALL Java_edu_wpi_first_networktables_NetworkTablesJNI_now - (JNIEnv *, jclass) +JNIEXPORT jlong JNICALL +Java_edu_wpi_first_networktables_NetworkTablesJNI_now + (JNIEnv*, jclass) { return nt::Now(); } @@ -1674,8 +1790,9 @@ JNIEXPORT jlong JNICALL Java_edu_wpi_first_networktables_NetworkTablesJNI_now * Method: createLoggerPoller * Signature: (I)I */ -JNIEXPORT jint JNICALL Java_edu_wpi_first_networktables_NetworkTablesJNI_createLoggerPoller - (JNIEnv *, jclass, jint inst) +JNIEXPORT jint JNICALL +Java_edu_wpi_first_networktables_NetworkTablesJNI_createLoggerPoller + (JNIEnv*, jclass, jint inst) { return nt::CreateLoggerPoller(inst); } @@ -1685,8 +1802,9 @@ JNIEXPORT jint JNICALL Java_edu_wpi_first_networktables_NetworkTablesJNI_createL * Method: destroyLoggerPoller * Signature: (I)V */ -JNIEXPORT void JNICALL Java_edu_wpi_first_networktables_NetworkTablesJNI_destroyLoggerPoller - (JNIEnv *, jclass, jint poller) +JNIEXPORT void JNICALL +Java_edu_wpi_first_networktables_NetworkTablesJNI_destroyLoggerPoller + (JNIEnv*, jclass, jint poller) { nt::DestroyLoggerPoller(poller); } @@ -1696,8 +1814,9 @@ JNIEXPORT void JNICALL Java_edu_wpi_first_networktables_NetworkTablesJNI_destroy * Method: addPolledLogger * Signature: (III)I */ -JNIEXPORT jint JNICALL Java_edu_wpi_first_networktables_NetworkTablesJNI_addPolledLogger - (JNIEnv *, jclass, jint poller, jint minLevel, jint maxLevel) +JNIEXPORT jint JNICALL +Java_edu_wpi_first_networktables_NetworkTablesJNI_addPolledLogger + (JNIEnv*, jclass, jint poller, jint minLevel, jint maxLevel) { return nt::AddPolledLogger(poller, minLevel, maxLevel); } @@ -1705,10 +1824,11 @@ JNIEXPORT jint JNICALL Java_edu_wpi_first_networktables_NetworkTablesJNI_addPoll /* * Class: edu_wpi_first_networktables_NetworkTablesJNI * Method: pollLogger - * Signature: (Ledu/wpi/first/networktables/NetworkTableInstance;I)[Ledu/wpi/first/networktables/LogMessage; + * Signature: (Ljava/lang/Object;I)[Ljava/lang/Object; */ -JNIEXPORT jobjectArray JNICALL Java_edu_wpi_first_networktables_NetworkTablesJNI_pollLogger - (JNIEnv *env, jclass, jobject inst, jint poller) +JNIEXPORT jobjectArray JNICALL +Java_edu_wpi_first_networktables_NetworkTablesJNI_pollLogger + (JNIEnv* env, jclass, jobject inst, jint poller) { auto events = nt::PollLogger(poller); if (events.empty()) { @@ -1720,11 +1840,12 @@ JNIEXPORT jobjectArray JNICALL Java_edu_wpi_first_networktables_NetworkTablesJNI /* * Class: edu_wpi_first_networktables_NetworkTablesJNI - * Method: pollLogger - * Signature: (Ledu/wpi/first/networktables/NetworkTableInstance;ID)[Ledu/wpi/first/networktables/LogMessage; + * Method: pollLoggerTimeout + * Signature: (Ljava/lang/Object;ID)[Ljava/lang/Object; */ -JNIEXPORT jobjectArray JNICALL Java_edu_wpi_first_networktables_NetworkTablesJNI_pollLoggerTimeout - (JNIEnv *env, jclass, jobject inst, jint poller, jdouble timeout) +JNIEXPORT jobjectArray JNICALL +Java_edu_wpi_first_networktables_NetworkTablesJNI_pollLoggerTimeout + (JNIEnv* env, jclass, jobject inst, jint poller, jdouble timeout) { bool timed_out = false; auto events = nt::PollLogger(poller, timeout, &timed_out); @@ -1740,8 +1861,9 @@ JNIEXPORT jobjectArray JNICALL Java_edu_wpi_first_networktables_NetworkTablesJNI * Method: cancelPollLogger * Signature: (I)V */ -JNIEXPORT void JNICALL Java_edu_wpi_first_networktables_NetworkTablesJNI_cancelPollLogger - (JNIEnv *, jclass, jint poller) +JNIEXPORT void JNICALL +Java_edu_wpi_first_networktables_NetworkTablesJNI_cancelPollLogger + (JNIEnv*, jclass, jint poller) { nt::CancelPollLogger(poller); } @@ -1751,8 +1873,9 @@ JNIEXPORT void JNICALL Java_edu_wpi_first_networktables_NetworkTablesJNI_cancelP * Method: removeLogger * Signature: (I)V */ -JNIEXPORT void JNICALL Java_edu_wpi_first_networktables_NetworkTablesJNI_removeLogger - (JNIEnv *, jclass, jint logger) +JNIEXPORT void JNICALL +Java_edu_wpi_first_networktables_NetworkTablesJNI_removeLogger + (JNIEnv*, jclass, jint logger) { nt::RemoveLogger(logger); } @@ -1762,8 +1885,9 @@ JNIEXPORT void JNICALL Java_edu_wpi_first_networktables_NetworkTablesJNI_removeL * Method: waitForLoggerQueue * Signature: (ID)Z */ -JNIEXPORT jboolean JNICALL Java_edu_wpi_first_networktables_NetworkTablesJNI_waitForLoggerQueue - (JNIEnv *, jclass, jint inst, jdouble timeout) +JNIEXPORT jboolean JNICALL +Java_edu_wpi_first_networktables_NetworkTablesJNI_waitForLoggerQueue + (JNIEnv*, jclass, jint inst, jdouble timeout) { return nt::WaitForLoggerQueue(inst, timeout); } diff --git a/ntcore/src/main/native/cpp/networktables/NetworkTable.cpp b/ntcore/src/main/native/cpp/networktables/NetworkTable.cpp index b685d4fe0f..d3b73f7016 100644 --- a/ntcore/src/main/native/cpp/networktables/NetworkTable.cpp +++ b/ntcore/src/main/native/cpp/networktables/NetworkTable.cpp @@ -1,5 +1,5 @@ /*----------------------------------------------------------------------------*/ -/* Copyright (c) FIRST 2017-2018. All Rights Reserved. */ +/* Copyright (c) 2017-2018 FIRST. 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. */ diff --git a/ntcore/src/main/native/cpp/networktables/NetworkTableEntry.cpp b/ntcore/src/main/native/cpp/networktables/NetworkTableEntry.cpp index 424d512d42..5507ac0181 100644 --- a/ntcore/src/main/native/cpp/networktables/NetworkTableEntry.cpp +++ b/ntcore/src/main/native/cpp/networktables/NetworkTableEntry.cpp @@ -1,5 +1,5 @@ /*----------------------------------------------------------------------------*/ -/* Copyright (c) FIRST 2017-2018. All Rights Reserved. */ +/* Copyright (c) 2017-2018 FIRST. 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. */ diff --git a/ntcore/src/main/native/cpp/networktables/NetworkTableInstance.cpp b/ntcore/src/main/native/cpp/networktables/NetworkTableInstance.cpp index 47762285c5..018572e1fb 100644 --- a/ntcore/src/main/native/cpp/networktables/NetworkTableInstance.cpp +++ b/ntcore/src/main/native/cpp/networktables/NetworkTableInstance.cpp @@ -1,5 +1,5 @@ /*----------------------------------------------------------------------------*/ -/* Copyright (c) FIRST 2017-2018. All Rights Reserved. */ +/* Copyright (c) 2017-2018 FIRST. 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. */ diff --git a/ntcore/src/main/native/cpp/networktables/RpcCall.cpp b/ntcore/src/main/native/cpp/networktables/RpcCall.cpp index 88c74fda92..114968125e 100644 --- a/ntcore/src/main/native/cpp/networktables/RpcCall.cpp +++ b/ntcore/src/main/native/cpp/networktables/RpcCall.cpp @@ -1,5 +1,5 @@ /*----------------------------------------------------------------------------*/ -/* Copyright (c) FIRST 2017-2018. All Rights Reserved. */ +/* Copyright (c) 2017-2018 FIRST. 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. */ diff --git a/ntcore/src/main/native/cpp/ntcore_c.cpp b/ntcore/src/main/native/cpp/ntcore_c.cpp index 16e83d19dc..f0a64b013f 100644 --- a/ntcore/src/main/native/cpp/ntcore_c.cpp +++ b/ntcore/src/main/native/cpp/ntcore_c.cpp @@ -1,5 +1,5 @@ /*----------------------------------------------------------------------------*/ -/* Copyright (c) FIRST 2015-2018. All Rights Reserved. */ +/* Copyright (c) 2015-2018 FIRST. 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. */ diff --git a/ntcore/src/main/native/cpp/ntcore_cpp.cpp b/ntcore/src/main/native/cpp/ntcore_cpp.cpp index 3146f16c1f..d950323c9d 100644 --- a/ntcore/src/main/native/cpp/ntcore_cpp.cpp +++ b/ntcore/src/main/native/cpp/ntcore_cpp.cpp @@ -1,5 +1,5 @@ /*----------------------------------------------------------------------------*/ -/* Copyright (c) FIRST 2015-2018. All Rights Reserved. */ +/* Copyright (c) 2015-2018 FIRST. 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. */ diff --git a/ntcore/src/main/native/cpp/ntcore_test.cpp b/ntcore/src/main/native/cpp/ntcore_test.cpp index 982b9f9d80..f74172ee97 100644 --- a/ntcore/src/main/native/cpp/ntcore_test.cpp +++ b/ntcore/src/main/native/cpp/ntcore_test.cpp @@ -1,5 +1,5 @@ /*----------------------------------------------------------------------------*/ -/* Copyright (c) FIRST 2016-2018. All Rights Reserved. */ +/* Copyright (c) 2016-2018 FIRST. 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. */ diff --git a/ntcore/src/main/native/cpp/tables/ITableListener.cpp b/ntcore/src/main/native/cpp/tables/ITableListener.cpp index b334959388..6abd3bb4bd 100644 --- a/ntcore/src/main/native/cpp/tables/ITableListener.cpp +++ b/ntcore/src/main/native/cpp/tables/ITableListener.cpp @@ -1,5 +1,5 @@ /*----------------------------------------------------------------------------*/ -/* Copyright (c) FIRST 2017-2018. All Rights Reserved. */ +/* Copyright (c) 2017-2018 FIRST. 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. */ diff --git a/ntcore/src/main/native/include/networktables/EntryListenerFlags.h b/ntcore/src/main/native/include/networktables/EntryListenerFlags.h index e6b68423c8..b43f133ec1 100644 --- a/ntcore/src/main/native/include/networktables/EntryListenerFlags.h +++ b/ntcore/src/main/native/include/networktables/EntryListenerFlags.h @@ -1,5 +1,5 @@ /*----------------------------------------------------------------------------*/ -/* Copyright (c) FIRST 2017-2018. All Rights Reserved. */ +/* Copyright (c) 2017-2018 FIRST. 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. */ diff --git a/ntcore/src/main/native/include/networktables/NetworkTable.h b/ntcore/src/main/native/include/networktables/NetworkTable.h index c29b9f0265..0b609b4049 100644 --- a/ntcore/src/main/native/include/networktables/NetworkTable.h +++ b/ntcore/src/main/native/include/networktables/NetworkTable.h @@ -1,5 +1,5 @@ /*----------------------------------------------------------------------------*/ -/* Copyright (c) FIRST 2015-2018. All Rights Reserved. */ +/* Copyright (c) 2015-2018 FIRST. 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. */ diff --git a/ntcore/src/main/native/include/networktables/NetworkTableEntry.h b/ntcore/src/main/native/include/networktables/NetworkTableEntry.h index 5a1c7da402..4e2684ec5a 100644 --- a/ntcore/src/main/native/include/networktables/NetworkTableEntry.h +++ b/ntcore/src/main/native/include/networktables/NetworkTableEntry.h @@ -1,5 +1,5 @@ /*----------------------------------------------------------------------------*/ -/* Copyright (c) FIRST 2017-2018. All Rights Reserved. */ +/* Copyright (c) 2017-2018 FIRST. 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. */ diff --git a/ntcore/src/main/native/include/networktables/NetworkTableInstance.h b/ntcore/src/main/native/include/networktables/NetworkTableInstance.h index c713d06f23..0b79e180f4 100644 --- a/ntcore/src/main/native/include/networktables/NetworkTableInstance.h +++ b/ntcore/src/main/native/include/networktables/NetworkTableInstance.h @@ -1,5 +1,5 @@ /*----------------------------------------------------------------------------*/ -/* Copyright (c) FIRST 2017-2018. All Rights Reserved. */ +/* Copyright (c) 2017-2018 FIRST. 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. */ diff --git a/ntcore/src/main/native/include/networktables/NetworkTableType.h b/ntcore/src/main/native/include/networktables/NetworkTableType.h index 8b648ea258..0d7cb06823 100644 --- a/ntcore/src/main/native/include/networktables/NetworkTableType.h +++ b/ntcore/src/main/native/include/networktables/NetworkTableType.h @@ -1,5 +1,5 @@ /*----------------------------------------------------------------------------*/ -/* Copyright (c) FIRST 2017-2018. All Rights Reserved. */ +/* Copyright (c) 2017-2018 FIRST. 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. */ diff --git a/ntcore/src/main/native/include/networktables/NetworkTableValue.h b/ntcore/src/main/native/include/networktables/NetworkTableValue.h index c6877ead3c..1523791fd8 100644 --- a/ntcore/src/main/native/include/networktables/NetworkTableValue.h +++ b/ntcore/src/main/native/include/networktables/NetworkTableValue.h @@ -1,5 +1,5 @@ /*----------------------------------------------------------------------------*/ -/* Copyright (c) FIRST 2015-2018. All Rights Reserved. */ +/* Copyright (c) 2015-2018 FIRST. 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. */ diff --git a/ntcore/src/main/native/include/networktables/RpcCall.h b/ntcore/src/main/native/include/networktables/RpcCall.h index 6c2acc7b87..6872d9f049 100644 --- a/ntcore/src/main/native/include/networktables/RpcCall.h +++ b/ntcore/src/main/native/include/networktables/RpcCall.h @@ -1,5 +1,5 @@ /*----------------------------------------------------------------------------*/ -/* Copyright (c) FIRST 2017-2018. All Rights Reserved. */ +/* Copyright (c) 2017-2018 FIRST. 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. */ diff --git a/ntcore/src/main/native/include/networktables/TableEntryListener.h b/ntcore/src/main/native/include/networktables/TableEntryListener.h index e2c2ee990c..dca144c359 100644 --- a/ntcore/src/main/native/include/networktables/TableEntryListener.h +++ b/ntcore/src/main/native/include/networktables/TableEntryListener.h @@ -1,5 +1,5 @@ /*----------------------------------------------------------------------------*/ -/* Copyright (c) FIRST 2017-2018. All Rights Reserved. */ +/* Copyright (c) 2017-2018 FIRST. 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. */ diff --git a/ntcore/src/main/native/include/networktables/TableListener.h b/ntcore/src/main/native/include/networktables/TableListener.h index f30606a148..8284d00526 100644 --- a/ntcore/src/main/native/include/networktables/TableListener.h +++ b/ntcore/src/main/native/include/networktables/TableListener.h @@ -1,5 +1,5 @@ /*----------------------------------------------------------------------------*/ -/* Copyright (c) FIRST 2017-2018. All Rights Reserved. */ +/* Copyright (c) 2017-2018 FIRST. 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. */ diff --git a/ntcore/src/main/native/include/ntcore.h b/ntcore/src/main/native/include/ntcore.h index ce1f2adce8..ff0511a925 100644 --- a/ntcore/src/main/native/include/ntcore.h +++ b/ntcore/src/main/native/include/ntcore.h @@ -1,5 +1,5 @@ /*----------------------------------------------------------------------------*/ -/* Copyright (c) FIRST 2015-2018. All Rights Reserved. */ +/* Copyright (c) 2015-2018 FIRST. 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. */ diff --git a/ntcore/src/main/native/include/ntcore_c.h b/ntcore/src/main/native/include/ntcore_c.h index 363a4dd223..c30296fb48 100644 --- a/ntcore/src/main/native/include/ntcore_c.h +++ b/ntcore/src/main/native/include/ntcore_c.h @@ -1,5 +1,5 @@ /*----------------------------------------------------------------------------*/ -/* Copyright (c) FIRST 2015-2018. All Rights Reserved. */ +/* Copyright (c) 2015-2018 FIRST. 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. */ @@ -10,18 +10,18 @@ #include -#ifdef __cplusplus -#include -#else -#include -#endif - #include #ifdef __cplusplus extern "C" { #endif +#ifdef __cplusplus +#include +#else +#include +#endif + /** Typedefs */ typedef int NT_Bool; @@ -488,8 +488,8 @@ NT_Bool NT_GetEntryInfoHandle(NT_Entry entry, struct NT_EntryInfo* info); * @param data data pointer provided to callback creation function * @param event event information */ -typedef void (*NT_EntryListenerCallback)(void* data, - const struct NT_EntryNotification* event); +typedef void (*NT_EntryListenerCallback)( + void* data, const struct NT_EntryNotification* event); /** * Add a listener for all entries starting with a certain prefix. @@ -938,7 +938,8 @@ char* NT_PackRpcValues(const struct NT_Value** values, size_t values_len, * @return Array of NT_Value's. */ struct NT_Value** NT_UnpackRpcValues(const char* packed, size_t packed_len, - const enum NT_Type* types, size_t types_len); + const enum NT_Type* types, + size_t types_len); /** @} */ @@ -1628,7 +1629,8 @@ double* NT_GetValueDoubleArray(const struct NT_Value* value, * function will free all the NT_Strings. */ struct NT_String* NT_GetValueStringArray(const struct NT_Value* value, - uint64_t* last_change, size_t* arr_size); + uint64_t* last_change, + size_t* arr_size); /** * Returns the boolean currently assigned to the entry name. diff --git a/ntcore/src/main/native/include/ntcore_cpp.h b/ntcore/src/main/native/include/ntcore_cpp.h index d5139ff2c6..291b5adfee 100644 --- a/ntcore/src/main/native/include/ntcore_cpp.h +++ b/ntcore/src/main/native/include/ntcore_cpp.h @@ -1,5 +1,5 @@ /*----------------------------------------------------------------------------*/ -/* Copyright (c) FIRST 2015-2018. All Rights Reserved. */ +/* Copyright (c) 2015-2018 FIRST. 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. */ diff --git a/ntcore/src/main/native/include/ntcore_test.h b/ntcore/src/main/native/include/ntcore_test.h index bb736a5dff..920fd68d00 100644 --- a/ntcore/src/main/native/include/ntcore_test.h +++ b/ntcore/src/main/native/include/ntcore_test.h @@ -1,5 +1,5 @@ /*----------------------------------------------------------------------------*/ -/* Copyright (c) FIRST 2016-2018. All Rights Reserved. */ +/* Copyright (c) 2016-2018 FIRST. 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. */ diff --git a/ntcore/src/main/native/include/tables/ITable.h b/ntcore/src/main/native/include/tables/ITable.h index a769032504..d03aaa71ac 100644 --- a/ntcore/src/main/native/include/tables/ITable.h +++ b/ntcore/src/main/native/include/tables/ITable.h @@ -1,5 +1,5 @@ /*----------------------------------------------------------------------------*/ -/* Copyright (c) FIRST 2015-2018. All Rights Reserved. */ +/* Copyright (c) 2015-2018 FIRST. 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. */ diff --git a/ntcore/src/main/native/include/tables/ITableListener.h b/ntcore/src/main/native/include/tables/ITableListener.h index 0ac7c6f15c..e836b515a7 100644 --- a/ntcore/src/main/native/include/tables/ITableListener.h +++ b/ntcore/src/main/native/include/tables/ITableListener.h @@ -1,5 +1,5 @@ /*----------------------------------------------------------------------------*/ -/* Copyright (c) FIRST 2017-2018. All Rights Reserved. */ +/* Copyright (c) 2017-2018 FIRST. 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. */ diff --git a/ntcore/src/test/java/edu/wpi/first/networktables/ConnectionListenerTest.java b/ntcore/src/test/java/edu/wpi/first/networktables/ConnectionListenerTest.java index 98012e65f2..08f3aa798a 100644 --- a/ntcore/src/test/java/edu/wpi/first/networktables/ConnectionListenerTest.java +++ b/ntcore/src/test/java/edu/wpi/first/networktables/ConnectionListenerTest.java @@ -1,5 +1,5 @@ /*----------------------------------------------------------------------------*/ -/* Copyright (c) FIRST 2017-2018. All Rights Reserved. */ +/* Copyright (c) 2017-2018 FIRST. 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. */ diff --git a/ntcore/src/test/java/edu/wpi/first/networktables/EntryListenerTest.java b/ntcore/src/test/java/edu/wpi/first/networktables/EntryListenerTest.java index 72e530a471..141ce1b6fd 100644 --- a/ntcore/src/test/java/edu/wpi/first/networktables/EntryListenerTest.java +++ b/ntcore/src/test/java/edu/wpi/first/networktables/EntryListenerTest.java @@ -1,5 +1,5 @@ /*----------------------------------------------------------------------------*/ -/* Copyright (c) FIRST 2017-2018. All Rights Reserved. */ +/* Copyright (c) 2017-2018 FIRST. 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. */ diff --git a/ntcore/src/test/java/edu/wpi/first/networktables/JNITest.java b/ntcore/src/test/java/edu/wpi/first/networktables/JNITest.java index 3b9339affd..d71d10434c 100644 --- a/ntcore/src/test/java/edu/wpi/first/networktables/JNITest.java +++ b/ntcore/src/test/java/edu/wpi/first/networktables/JNITest.java @@ -1,5 +1,5 @@ /*----------------------------------------------------------------------------*/ -/* Copyright (c) FIRST 2017-2018. All Rights Reserved. */ +/* Copyright (c) 2017-2018 FIRST. 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. */ diff --git a/ntcore/src/test/java/edu/wpi/first/networktables/LoggerTest.java b/ntcore/src/test/java/edu/wpi/first/networktables/LoggerTest.java index 3b73858113..d67a18350d 100644 --- a/ntcore/src/test/java/edu/wpi/first/networktables/LoggerTest.java +++ b/ntcore/src/test/java/edu/wpi/first/networktables/LoggerTest.java @@ -1,5 +1,5 @@ /*----------------------------------------------------------------------------*/ -/* Copyright (c) FIRST 2017-2018. All Rights Reserved. */ +/* Copyright (c) 2017-2018 FIRST. 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. */ diff --git a/ntcore/src/test/java/edu/wpi/first/networktables/NetworkTableTest.java b/ntcore/src/test/java/edu/wpi/first/networktables/NetworkTableTest.java index 7c4a651f89..ba6f14a103 100644 --- a/ntcore/src/test/java/edu/wpi/first/networktables/NetworkTableTest.java +++ b/ntcore/src/test/java/edu/wpi/first/networktables/NetworkTableTest.java @@ -1,5 +1,5 @@ /*----------------------------------------------------------------------------*/ -/* Copyright (c) FIRST 2017-2018. All Rights Reserved. */ +/* Copyright (c) 2017-2018 FIRST. 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. */ diff --git a/ntcore/src/test/native/cpp/ConnectionListenerTest.cpp b/ntcore/src/test/native/cpp/ConnectionListenerTest.cpp index 1732c74e8a..a56e45cb9d 100644 --- a/ntcore/src/test/native/cpp/ConnectionListenerTest.cpp +++ b/ntcore/src/test/native/cpp/ConnectionListenerTest.cpp @@ -1,5 +1,5 @@ /*----------------------------------------------------------------------------*/ -/* Copyright (c) FIRST 2017-2018. All Rights Reserved. */ +/* Copyright (c) 2017-2018 FIRST. 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. */ diff --git a/ntcore/src/test/native/cpp/EntryListenerTest.cpp b/ntcore/src/test/native/cpp/EntryListenerTest.cpp index 38b5aea675..bdbf118e32 100644 --- a/ntcore/src/test/native/cpp/EntryListenerTest.cpp +++ b/ntcore/src/test/native/cpp/EntryListenerTest.cpp @@ -1,5 +1,5 @@ /*----------------------------------------------------------------------------*/ -/* Copyright (c) FIRST 2017-2018. All Rights Reserved. */ +/* Copyright (c) 2017-2018 FIRST. 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. */ diff --git a/ntcore/src/test/native/cpp/EntryNotifierTest.cpp b/ntcore/src/test/native/cpp/EntryNotifierTest.cpp index 8ef299d946..4f1df77564 100644 --- a/ntcore/src/test/native/cpp/EntryNotifierTest.cpp +++ b/ntcore/src/test/native/cpp/EntryNotifierTest.cpp @@ -1,5 +1,5 @@ /*----------------------------------------------------------------------------*/ -/* Copyright (c) FIRST 2017-2018. All Rights Reserved. */ +/* Copyright (c) 2017-2018 FIRST. 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. */ diff --git a/ntcore/src/test/native/cpp/MessageMatcher.cpp b/ntcore/src/test/native/cpp/MessageMatcher.cpp index de8719d3df..35d4f8b38e 100644 --- a/ntcore/src/test/native/cpp/MessageMatcher.cpp +++ b/ntcore/src/test/native/cpp/MessageMatcher.cpp @@ -1,5 +1,5 @@ /*----------------------------------------------------------------------------*/ -/* Copyright (c) FIRST 2017-2018. All Rights Reserved. */ +/* Copyright (c) 2017-2018 FIRST. 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. */ diff --git a/ntcore/src/test/native/cpp/MessageMatcher.h b/ntcore/src/test/native/cpp/MessageMatcher.h index d498cf0b47..5b143343c7 100644 --- a/ntcore/src/test/native/cpp/MessageMatcher.h +++ b/ntcore/src/test/native/cpp/MessageMatcher.h @@ -1,5 +1,5 @@ /*----------------------------------------------------------------------------*/ -/* Copyright (c) FIRST 2017-2018. All Rights Reserved. */ +/* Copyright (c) 2017-2018 FIRST. 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. */ diff --git a/ntcore/src/test/native/cpp/MockConnectionNotifier.h b/ntcore/src/test/native/cpp/MockConnectionNotifier.h index 12d98b8a8c..ddf8b2e100 100644 --- a/ntcore/src/test/native/cpp/MockConnectionNotifier.h +++ b/ntcore/src/test/native/cpp/MockConnectionNotifier.h @@ -1,5 +1,5 @@ /*----------------------------------------------------------------------------*/ -/* Copyright (c) FIRST 2017-2018. All Rights Reserved. */ +/* Copyright (c) 2017-2018 FIRST. 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. */ diff --git a/ntcore/src/test/native/cpp/MockDispatcher.h b/ntcore/src/test/native/cpp/MockDispatcher.h index 081ed6d498..10af839e88 100644 --- a/ntcore/src/test/native/cpp/MockDispatcher.h +++ b/ntcore/src/test/native/cpp/MockDispatcher.h @@ -1,5 +1,5 @@ /*----------------------------------------------------------------------------*/ -/* Copyright (c) FIRST 2017-2018. All Rights Reserved. */ +/* Copyright (c) 2017-2018 FIRST. 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. */ diff --git a/ntcore/src/test/native/cpp/MockEntryNotifier.h b/ntcore/src/test/native/cpp/MockEntryNotifier.h index 2608a75d86..2f078cbb30 100644 --- a/ntcore/src/test/native/cpp/MockEntryNotifier.h +++ b/ntcore/src/test/native/cpp/MockEntryNotifier.h @@ -1,5 +1,5 @@ /*----------------------------------------------------------------------------*/ -/* Copyright (c) FIRST 2017-2018. All Rights Reserved. */ +/* Copyright (c) 2017-2018 FIRST. 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. */ diff --git a/ntcore/src/test/native/cpp/MockNetworkConnection.h b/ntcore/src/test/native/cpp/MockNetworkConnection.h index 1d697d7ffb..52c917db4f 100644 --- a/ntcore/src/test/native/cpp/MockNetworkConnection.h +++ b/ntcore/src/test/native/cpp/MockNetworkConnection.h @@ -1,5 +1,5 @@ /*----------------------------------------------------------------------------*/ -/* Copyright (c) FIRST 2017-2018. All Rights Reserved. */ +/* Copyright (c) 2017-2018 FIRST. 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. */ diff --git a/ntcore/src/test/native/cpp/MockRpcServer.h b/ntcore/src/test/native/cpp/MockRpcServer.h index 1a58dfeeb1..6e9d970b78 100644 --- a/ntcore/src/test/native/cpp/MockRpcServer.h +++ b/ntcore/src/test/native/cpp/MockRpcServer.h @@ -1,5 +1,5 @@ /*----------------------------------------------------------------------------*/ -/* Copyright (c) FIRST 2017-2018. All Rights Reserved. */ +/* Copyright (c) 2017-2018 FIRST. 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. */ diff --git a/ntcore/src/test/native/cpp/NetworkTableTest.cpp b/ntcore/src/test/native/cpp/NetworkTableTest.cpp index d16a9e1237..d9a2743204 100644 --- a/ntcore/src/test/native/cpp/NetworkTableTest.cpp +++ b/ntcore/src/test/native/cpp/NetworkTableTest.cpp @@ -1,5 +1,5 @@ /*----------------------------------------------------------------------------*/ -/* Copyright (c) FIRST 2015-2018. All Rights Reserved. */ +/* Copyright (c) 2015-2018 FIRST. 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. */ diff --git a/ntcore/src/test/native/cpp/StorageTest.cpp b/ntcore/src/test/native/cpp/StorageTest.cpp index adfe61e0a3..b6c3a88e40 100644 --- a/ntcore/src/test/native/cpp/StorageTest.cpp +++ b/ntcore/src/test/native/cpp/StorageTest.cpp @@ -1,5 +1,5 @@ /*----------------------------------------------------------------------------*/ -/* Copyright (c) FIRST 2015-2018. All Rights Reserved. */ +/* Copyright (c) 2015-2018 FIRST. 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. */ diff --git a/ntcore/src/test/native/cpp/StorageTest.h b/ntcore/src/test/native/cpp/StorageTest.h index 559a98ca46..1bb8a8c737 100644 --- a/ntcore/src/test/native/cpp/StorageTest.h +++ b/ntcore/src/test/native/cpp/StorageTest.h @@ -1,5 +1,5 @@ /*----------------------------------------------------------------------------*/ -/* Copyright (c) FIRST 2015-2018. All Rights Reserved. */ +/* Copyright (c) 2015-2018 FIRST. 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. */ diff --git a/ntcore/src/test/native/cpp/TestPrinters.cpp b/ntcore/src/test/native/cpp/TestPrinters.cpp index d12a3e3593..3368b8c553 100644 --- a/ntcore/src/test/native/cpp/TestPrinters.cpp +++ b/ntcore/src/test/native/cpp/TestPrinters.cpp @@ -1,5 +1,5 @@ /*----------------------------------------------------------------------------*/ -/* Copyright (c) FIRST 2017-2018. All Rights Reserved. */ +/* Copyright (c) 2017-2018 FIRST. 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. */ diff --git a/ntcore/src/test/native/cpp/TestPrinters.h b/ntcore/src/test/native/cpp/TestPrinters.h index c2b4914d98..2976c1c1d4 100644 --- a/ntcore/src/test/native/cpp/TestPrinters.h +++ b/ntcore/src/test/native/cpp/TestPrinters.h @@ -1,5 +1,5 @@ /*----------------------------------------------------------------------------*/ -/* Copyright (c) FIRST 2017-2018. All Rights Reserved. */ +/* Copyright (c) 2017-2018 FIRST. 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. */ diff --git a/ntcore/src/test/native/cpp/ValueMatcher.cpp b/ntcore/src/test/native/cpp/ValueMatcher.cpp index b429305433..45b09edeaf 100644 --- a/ntcore/src/test/native/cpp/ValueMatcher.cpp +++ b/ntcore/src/test/native/cpp/ValueMatcher.cpp @@ -1,5 +1,5 @@ /*----------------------------------------------------------------------------*/ -/* Copyright (c) FIRST 2017-2018. All Rights Reserved. */ +/* Copyright (c) 2017-2018 FIRST. 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. */ diff --git a/ntcore/src/test/native/cpp/ValueMatcher.h b/ntcore/src/test/native/cpp/ValueMatcher.h index 99ecc84de3..5c417d712d 100644 --- a/ntcore/src/test/native/cpp/ValueMatcher.h +++ b/ntcore/src/test/native/cpp/ValueMatcher.h @@ -1,5 +1,5 @@ /*----------------------------------------------------------------------------*/ -/* Copyright (c) FIRST 2017-2018. All Rights Reserved. */ +/* Copyright (c) 2017-2018 FIRST. 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. */ diff --git a/ntcore/src/test/native/cpp/ValueTest.cpp b/ntcore/src/test/native/cpp/ValueTest.cpp index ffc3ee5202..a65f8f9997 100644 --- a/ntcore/src/test/native/cpp/ValueTest.cpp +++ b/ntcore/src/test/native/cpp/ValueTest.cpp @@ -1,5 +1,5 @@ /*----------------------------------------------------------------------------*/ -/* Copyright (c) FIRST 2015-2018. All Rights Reserved. */ +/* Copyright (c) 2015-2018 FIRST. 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. */ diff --git a/ntcore/src/test/native/cpp/WireDecoderTest.cpp b/ntcore/src/test/native/cpp/WireDecoderTest.cpp index 4826639e94..a13fa7a275 100644 --- a/ntcore/src/test/native/cpp/WireDecoderTest.cpp +++ b/ntcore/src/test/native/cpp/WireDecoderTest.cpp @@ -1,5 +1,5 @@ /*----------------------------------------------------------------------------*/ -/* Copyright (c) FIRST 2015-2018. All Rights Reserved. */ +/* Copyright (c) 2015-2018 FIRST. 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. */ diff --git a/ntcore/src/test/native/cpp/WireEncoderTest.cpp b/ntcore/src/test/native/cpp/WireEncoderTest.cpp index 7332cdabaa..664344fae9 100644 --- a/ntcore/src/test/native/cpp/WireEncoderTest.cpp +++ b/ntcore/src/test/native/cpp/WireEncoderTest.cpp @@ -1,5 +1,5 @@ /*----------------------------------------------------------------------------*/ -/* Copyright (c) FIRST 2015-2018. All Rights Reserved. */ +/* Copyright (c) 2015-2018 FIRST. 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. */ @@ -224,8 +224,7 @@ TEST_F(WireEncoderTest, WriteBooleanValue2) { e.WriteValue(*v_false); ASSERT_EQ(nullptr, e.error()); ASSERT_EQ(2u, e.size()); - ASSERT_EQ(wpi::StringRef("\x01\x00", 2), - wpi::StringRef(e.data(), e.size())); + ASSERT_EQ(wpi::StringRef("\x01\x00", 2), wpi::StringRef(e.data(), e.size())); } TEST_F(WireEncoderTest, WriteDoubleValue2) { @@ -336,8 +335,7 @@ TEST_F(WireEncoderTest, WriteBooleanValue3) { e.WriteValue(*v_false); ASSERT_EQ(nullptr, e.error()); ASSERT_EQ(2u, e.size()); - ASSERT_EQ(wpi::StringRef("\x01\x00", 2), - wpi::StringRef(e.data(), e.size())); + ASSERT_EQ(wpi::StringRef("\x01\x00", 2), wpi::StringRef(e.data(), e.size())); } TEST_F(WireEncoderTest, WriteDoubleValue3) { @@ -354,8 +352,7 @@ TEST_F(WireEncoderTest, WriteStringValue3) { e.WriteValue(*v_string); ASSERT_EQ(nullptr, e.error()); ASSERT_EQ(6u, e.size()); - ASSERT_EQ(wpi::StringRef("\x05hello", 6), - wpi::StringRef(e.data(), e.size())); + ASSERT_EQ(wpi::StringRef("\x05hello", 6), wpi::StringRef(e.data(), e.size())); } TEST_F(WireEncoderTest, WriteRawValue3) { @@ -363,8 +360,7 @@ TEST_F(WireEncoderTest, WriteRawValue3) { e.WriteValue(*v_raw); ASSERT_EQ(nullptr, e.error()); ASSERT_EQ(6u, e.size()); - ASSERT_EQ(wpi::StringRef("\x05hello", 6), - wpi::StringRef(e.data(), e.size())); + ASSERT_EQ(wpi::StringRef("\x05hello", 6), wpi::StringRef(e.data(), e.size())); } TEST_F(WireEncoderTest, WriteBooleanArrayValue3) { @@ -472,8 +468,7 @@ TEST_F(WireEncoderTest, WriteString3) { e.WriteString(s_normal); EXPECT_EQ(nullptr, e.error()); EXPECT_EQ(6u, e.size()); - EXPECT_EQ(wpi::StringRef("\x05hello", 6), - wpi::StringRef(e.data(), e.size())); + EXPECT_EQ(wpi::StringRef("\x05hello", 6), wpi::StringRef(e.data(), e.size())); e.Reset(); e.WriteString(s_long); diff --git a/ntcore/src/test/native/cpp/main.cpp b/ntcore/src/test/native/cpp/main.cpp index 146e217a53..d0b0e3c6fb 100644 --- a/ntcore/src/test/native/cpp/main.cpp +++ b/ntcore/src/test/native/cpp/main.cpp @@ -1,5 +1,5 @@ /*----------------------------------------------------------------------------*/ -/* Copyright (c) FIRST 2015-2018. All Rights Reserved. */ +/* Copyright (c) 2015-2018 FIRST. 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. */ diff --git a/styleguide/checkstyleEclipse.xml b/styleguide/checkstyleExamples.xml similarity index 92% rename from styleguide/checkstyleEclipse.xml rename to styleguide/checkstyleExamples.xml index ee6ca99e33..e2d1e6814f 100644 --- a/styleguide/checkstyleEclipse.xml +++ b/styleguide/checkstyleExamples.xml @@ -20,17 +20,23 @@ + + + + + + + + + + + + - - - - - - @@ -44,7 +50,7 @@ - + @@ -58,7 +64,7 @@ - + @@ -81,8 +87,13 @@ + + + + + @@ -191,6 +202,7 @@ + diff --git a/wpilibc/src/main/native/cpp/Commands/Command.cpp b/wpilibc/src/main/native/cpp/Commands/Command.cpp index 7185e8f152..4be65a74f5 100644 --- a/wpilibc/src/main/native/cpp/Commands/Command.cpp +++ b/wpilibc/src/main/native/cpp/Commands/Command.cpp @@ -50,8 +50,7 @@ Command::Command(double timeout) : Command("", timeout) {} * @param timeout the time (in seconds) before this command "times out" * @see IsTimedOut() */ -Command::Command(const wpi::Twine& name, double timeout) - : SendableBase(false) { +Command::Command(const wpi::Twine& name, double timeout) : SendableBase(false) { // We use -1.0 to indicate no timeout. if (timeout < 0.0 && timeout != -1.0) wpi_setWPIErrorWithContext(ParameterOutOfRange, "timeout < 0.0"); diff --git a/wpilibc/src/main/native/cpp/Commands/PIDSubsystem.cpp b/wpilibc/src/main/native/cpp/Commands/PIDSubsystem.cpp index 006a4e4f9e..80ad3d6b60 100644 --- a/wpilibc/src/main/native/cpp/Commands/PIDSubsystem.cpp +++ b/wpilibc/src/main/native/cpp/Commands/PIDSubsystem.cpp @@ -19,8 +19,7 @@ using namespace frc; * @param i the integral value * @param d the derivative value */ -PIDSubsystem::PIDSubsystem(const wpi::Twine& name, double p, double i, - double d) +PIDSubsystem::PIDSubsystem(const wpi::Twine& name, double p, double i, double d) : Subsystem(name) { m_controller = std::make_shared(p, i, d, this, this); AddChild("PIDController", m_controller); @@ -35,8 +34,8 @@ PIDSubsystem::PIDSubsystem(const wpi::Twine& name, double p, double i, * @param d the derivative value * @param f the feedforward value */ -PIDSubsystem::PIDSubsystem(const wpi::Twine& name, double p, double i, - double d, double f) +PIDSubsystem::PIDSubsystem(const wpi::Twine& name, double p, double i, double d, + double f) : Subsystem(name) { m_controller = std::make_shared(p, i, d, f, this, this); AddChild("PIDController", m_controller); @@ -55,8 +54,8 @@ PIDSubsystem::PIDSubsystem(const wpi::Twine& name, double p, double i, * @param f the feedfoward value * @param period the time (in seconds) between calculations */ -PIDSubsystem::PIDSubsystem(const wpi::Twine& name, double p, double i, - double d, double f, double period) +PIDSubsystem::PIDSubsystem(const wpi::Twine& name, double p, double i, double d, + double f, double period) : Subsystem(name) { m_controller = std::make_shared(p, i, d, f, this, this, period); diff --git a/wpilibc/src/main/native/cpp/DoubleSolenoid.cpp b/wpilibc/src/main/native/cpp/DoubleSolenoid.cpp index 82dc46833f..e7ece40103 100644 --- a/wpilibc/src/main/native/cpp/DoubleSolenoid.cpp +++ b/wpilibc/src/main/native/cpp/DoubleSolenoid.cpp @@ -42,9 +42,8 @@ DoubleSolenoid::DoubleSolenoid(int moduleNumber, int forwardChannel, m_forwardChannel(forwardChannel), m_reverseChannel(reverseChannel) { if (!SensorBase::CheckSolenoidModule(m_moduleNumber)) { - wpi_setWPIErrorWithContext( - ModuleIndexOutOfRange, - "Solenoid Module " + wpi::Twine(m_moduleNumber)); + wpi_setWPIErrorWithContext(ModuleIndexOutOfRange, + "Solenoid Module " + wpi::Twine(m_moduleNumber)); return; } if (!SensorBase::CheckSolenoidChannel(m_forwardChannel)) { diff --git a/wpilibc/src/main/native/cpp/Drive/RobotDriveBase.cpp b/wpilibc/src/main/native/cpp/Drive/RobotDriveBase.cpp index 3f04cb6b87..702ee1b395 100644 --- a/wpilibc/src/main/native/cpp/Drive/RobotDriveBase.cpp +++ b/wpilibc/src/main/native/cpp/Drive/RobotDriveBase.cpp @@ -41,7 +41,8 @@ void RobotDriveBase::SetDeadband(double deadband) { m_deadband = deadband; } void RobotDriveBase::SetMaxOutput(double maxOutput) { m_maxOutput = maxOutput; } /** - * Feed the motor safety object. Resets the timer that will stop the motors if it completes. + * Feed the motor safety object. Resets the timer that will stop the motors if + * it completes. * * @see MotorSafetyHelper::Feed() */ diff --git a/wpilibc/src/main/native/cpp/ErrorBase.cpp b/wpilibc/src/main/native/cpp/ErrorBase.cpp index 2373948d55..d965f57380 100644 --- a/wpilibc/src/main/native/cpp/ErrorBase.cpp +++ b/wpilibc/src/main/native/cpp/ErrorBase.cpp @@ -50,8 +50,8 @@ void ErrorBase::ClearError() const { m_error.Clear(); } * @param lineNumber Line number of the error source */ void ErrorBase::SetErrnoError(const wpi::Twine& contextMessage, - wpi::StringRef filename, - wpi::StringRef function, int lineNumber) const { + wpi::StringRef filename, wpi::StringRef function, + int lineNumber) const { wpi::SmallString<128> buf; wpi::raw_svector_ostream err(buf); int errNo = errno; @@ -141,8 +141,8 @@ void ErrorBase::SetError(Error::Code code, const wpi::Twine& contextMessage, void ErrorBase::SetErrorRange(Error::Code code, int32_t minRange, int32_t maxRange, int32_t requestedValue, const wpi::Twine& contextMessage, - wpi::StringRef filename, - wpi::StringRef function, int lineNumber) const { + wpi::StringRef filename, wpi::StringRef function, + int lineNumber) const { // If there was an error if (code != 0) { // Set the current error information for this object. @@ -197,8 +197,8 @@ bool ErrorBase::StatusIsFatal() const { return m_error.GetCode() < 0; } void ErrorBase::SetGlobalError(Error::Code code, const wpi::Twine& contextMessage, - wpi::StringRef filename, - wpi::StringRef function, int lineNumber) { + wpi::StringRef filename, wpi::StringRef function, + int lineNumber) { // If there was an error if (code != 0) { std::lock_guard mutex(_globalErrorMutex); diff --git a/wpilibc/src/main/native/cpp/LiveWindow/LiveWindow.cpp b/wpilibc/src/main/native/cpp/LiveWindow/LiveWindow.cpp index 1ca537ca8c..635f2302ef 100644 --- a/wpilibc/src/main/native/cpp/LiveWindow/LiveWindow.cpp +++ b/wpilibc/src/main/native/cpp/LiveWindow/LiveWindow.cpp @@ -115,8 +115,7 @@ void LiveWindow::SetEnabled(bool enabled) { * @brief Use a STL smart pointer to share ownership of component. * @deprecated Use Sendable::SetName() instead. */ -void LiveWindow::AddSensor(const wpi::Twine& subsystem, - const wpi::Twine& name, +void LiveWindow::AddSensor(const wpi::Twine& subsystem, const wpi::Twine& name, std::shared_ptr component) { Add(component); component->SetName(subsystem, name); @@ -126,8 +125,8 @@ void LiveWindow::AddSensor(const wpi::Twine& subsystem, * @brief Pass a reference to LiveWindow and retain ownership of the component. * @deprecated Use Sendable::SetName() instead. */ -void LiveWindow::AddSensor(const wpi::Twine& subsystem, - const wpi::Twine& name, Sendable& component) { +void LiveWindow::AddSensor(const wpi::Twine& subsystem, const wpi::Twine& name, + Sendable& component) { Add(&component); component.SetName(subsystem, name); } @@ -136,8 +135,8 @@ void LiveWindow::AddSensor(const wpi::Twine& subsystem, * @brief Use a raw pointer to the LiveWindow. * @deprecated Use Sendable::SetName() instead. */ -void LiveWindow::AddSensor(const wpi::Twine& subsystem, - const wpi::Twine& name, Sendable* component) { +void LiveWindow::AddSensor(const wpi::Twine& subsystem, const wpi::Twine& name, + Sendable* component) { Add(component); component->SetName(subsystem, name); } diff --git a/wpilibc/src/main/native/cpp/SPI.cpp b/wpilibc/src/main/native/cpp/SPI.cpp index 7d2cab8763..396d28892d 100644 --- a/wpilibc/src/main/native/cpp/SPI.cpp +++ b/wpilibc/src/main/native/cpp/SPI.cpp @@ -311,8 +311,7 @@ void SPI::FreeAuto() { * @param dataToSend data to send (maximum 16 bytes) * @param zeroSize number of zeros to send after the data */ -void SPI::SetAutoTransmitData(wpi::ArrayRef dataToSend, - int zeroSize) { +void SPI::SetAutoTransmitData(wpi::ArrayRef dataToSend, int zeroSize) { int32_t status = 0; HAL_SetSPIAutoTransmitData(m_port, dataToSend.data(), dataToSend.size(), zeroSize, &status); diff --git a/wpilibc/src/main/native/cpp/SmartDashboard/SendableBase.cpp b/wpilibc/src/main/native/cpp/SmartDashboard/SendableBase.cpp index dde39165ab..9eec2f71c7 100644 --- a/wpilibc/src/main/native/cpp/SmartDashboard/SendableBase.cpp +++ b/wpilibc/src/main/native/cpp/SmartDashboard/SendableBase.cpp @@ -71,8 +71,7 @@ void SendableBase::AddChild(void* child) { * @param channel The channel number the device is plugged into */ void SendableBase::SetName(const wpi::Twine& moduleType, int channel) { - SetName(moduleType + wpi::Twine('[') + wpi::Twine(channel) + - wpi::Twine(']')); + SetName(moduleType + wpi::Twine('[') + wpi::Twine(channel) + wpi::Twine(']')); } /** diff --git a/wpilibc/src/main/native/cpp/SmartDashboard/SmartDashboard.cpp b/wpilibc/src/main/native/cpp/SmartDashboard/SmartDashboard.cpp index 41a459d640..746e75e359 100644 --- a/wpilibc/src/main/native/cpp/SmartDashboard/SmartDashboard.cpp +++ b/wpilibc/src/main/native/cpp/SmartDashboard/SmartDashboard.cpp @@ -304,8 +304,7 @@ bool SmartDashboard::PutNumber(wpi::StringRef keyName, double value) { * @param defaultValue The default value to set if key doesn't exist. * @returns False if the table key exists with a different type */ -bool SmartDashboard::SetDefaultNumber(wpi::StringRef key, - double defaultValue) { +bool SmartDashboard::SetDefaultNumber(wpi::StringRef key, double defaultValue) { return Singleton::GetInstance().table->GetEntry(key).SetDefaultDouble( defaultValue); } @@ -435,8 +434,8 @@ bool SmartDashboard::PutNumberArray(wpi::StringRef key, * @param defaultValue The default value to set if key doesn't exist. * @returns False if the table key exists with a different type */ -bool SmartDashboard::SetDefaultNumberArray( - wpi::StringRef key, wpi::ArrayRef defaultValue) { +bool SmartDashboard::SetDefaultNumberArray(wpi::StringRef key, + wpi::ArrayRef defaultValue) { return Singleton::GetInstance().table->GetEntry(key).SetDefaultDoubleArray( defaultValue); } diff --git a/wpilibc/src/main/native/cpp/Solenoid.cpp b/wpilibc/src/main/native/cpp/Solenoid.cpp index 55a94f487c..31c9430847 100644 --- a/wpilibc/src/main/native/cpp/Solenoid.cpp +++ b/wpilibc/src/main/native/cpp/Solenoid.cpp @@ -34,9 +34,8 @@ Solenoid::Solenoid(int channel) Solenoid::Solenoid(int moduleNumber, int channel) : SolenoidBase(moduleNumber), m_channel(channel) { if (!SensorBase::CheckSolenoidModule(m_moduleNumber)) { - wpi_setWPIErrorWithContext( - ModuleIndexOutOfRange, - "Solenoid Module " + wpi::Twine(m_moduleNumber)); + wpi_setWPIErrorWithContext(ModuleIndexOutOfRange, + "Solenoid Module " + wpi::Twine(m_moduleNumber)); return; } if (!SensorBase::CheckSolenoidChannel(m_channel)) { diff --git a/wpilibc/src/main/native/cpp/Utility.cpp b/wpilibc/src/main/native/cpp/Utility.cpp index 8ff9eabc75..c68d7fe016 100644 --- a/wpilibc/src/main/native/cpp/Utility.cpp +++ b/wpilibc/src/main/native/cpp/Utility.cpp @@ -127,9 +127,8 @@ bool wpi_assertEqual_impl(int valueA, int valueB, bool wpi_assertNotEqual_impl(int valueA, int valueB, const wpi::Twine& valueAString, const wpi::Twine& valueBString, - const wpi::Twine& message, - wpi::StringRef fileName, int lineNumber, - wpi::StringRef funcName) { + const wpi::Twine& message, wpi::StringRef fileName, + int lineNumber, wpi::StringRef funcName) { if (!(valueA != valueB)) { wpi_assertEqual_common_impl(valueAString, valueBString, "!=", message, fileName, lineNumber, funcName); diff --git a/wpilibc/src/main/native/include/DriverStation.h b/wpilibc/src/main/native/include/DriverStation.h index 17f372fd78..e47f35629a 100644 --- a/wpilibc/src/main/native/include/DriverStation.h +++ b/wpilibc/src/main/native/include/DriverStation.h @@ -41,8 +41,7 @@ class DriverStation : public ErrorBase, public RobotStateInterface { static void ReportError(const wpi::Twine& error); static void ReportWarning(const wpi::Twine& error); static void ReportError(bool isError, int code, const wpi::Twine& error, - const wpi::Twine& location, - const wpi::Twine& stack); + const wpi::Twine& location, const wpi::Twine& stack); static constexpr int kJoystickPorts = 6; diff --git a/wpilibc/src/main/native/include/Error.h b/wpilibc/src/main/native/include/Error.h index 46c1501ca9..551b5c6a97 100644 --- a/wpilibc/src/main/native/include/Error.h +++ b/wpilibc/src/main/native/include/Error.h @@ -47,8 +47,8 @@ class Error { const ErrorBase* GetOriginatingObject() const; double GetTimestamp() const; void Clear(); - void Set(Code code, const wpi::Twine& contextMessage, - wpi::StringRef filename, wpi::StringRef function, int lineNumber, + void Set(Code code, const wpi::Twine& contextMessage, wpi::StringRef filename, + wpi::StringRef function, int lineNumber, const ErrorBase* originatingObject); private: diff --git a/wpilibc/src/main/native/include/ErrorBase.h b/wpilibc/src/main/native/include/ErrorBase.h index 4ed4fac928..8d1811504e 100644 --- a/wpilibc/src/main/native/include/ErrorBase.h +++ b/wpilibc/src/main/native/include/ErrorBase.h @@ -103,8 +103,7 @@ class ErrorBase { virtual void CloneError(const ErrorBase& rhs) const; virtual void ClearError() const; virtual bool StatusIsFatal() const; - static void SetGlobalError(Error::Code code, - const wpi::Twine& contextMessage, + static void SetGlobalError(Error::Code code, const wpi::Twine& contextMessage, wpi::StringRef filename, wpi::StringRef function, int lineNumber); static void SetGlobalWPIError(const wpi::Twine& errorMessage, diff --git a/wpilibc/src/main/native/include/Filters/LinearDigitalFilter.h b/wpilibc/src/main/native/include/Filters/LinearDigitalFilter.h index 089e840f99..69d83a8be0 100644 --- a/wpilibc/src/main/native/include/Filters/LinearDigitalFilter.h +++ b/wpilibc/src/main/native/include/Filters/LinearDigitalFilter.h @@ -23,16 +23,16 @@ namespace frc { * used types of filters. * * Filters are of the form:
- * y[n] = (b0 * x[n] + b1 * x[n-1] + … + bP * x[n-P]) - - * (a0 * y[n-1] + a2 * y[n-2] + … + aQ * y[n-Q]) + * y[n] = (b0 * x[n] + b1 * x[n-1] + … + bP * x[n-P]) - + * (a0 * y[n-1] + a2 * y[n-2] + … + aQ * y[n-Q]) * * Where:
* y[n] is the output at time "n"
* x[n] is the input at time "n"
* y[n-1] is the output from the LAST time step ("n-1")
* x[n-1] is the input from the LAST time step ("n-1")
- * b0 … bP are the "feedforward" (FIR) gains
- * a0 … aQ are the "feedback" (IIR) gains
+ * b0 … bP are the "feedforward" (FIR) gains
+ * a0 … aQ are the "feedback" (IIR) gains
* IMPORTANT! Note the "-" sign in front of the feedback term! This is a common * convention in signal processing. * diff --git a/wpilibc/src/main/native/include/HLUsageReporting.h b/wpilibc/src/main/native/include/HLUsageReporting.h index 74a70ac1bf..a078ab2d9e 100644 --- a/wpilibc/src/main/native/include/HLUsageReporting.h +++ b/wpilibc/src/main/native/include/HLUsageReporting.h @@ -1,5 +1,5 @@ /*----------------------------------------------------------------------------*/ -/* Copyright (c) 2008-2017 FIRST. All Rights Reserved. */ +/* Copyright (c) 2008-2018 FIRST. 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. */ diff --git a/wpilibc/src/main/native/include/SmartDashboard/SendableBuilder.h b/wpilibc/src/main/native/include/SmartDashboard/SendableBuilder.h index 8c65158e0a..c0821c15fa 100644 --- a/wpilibc/src/main/native/include/SmartDashboard/SendableBuilder.h +++ b/wpilibc/src/main/native/include/SmartDashboard/SendableBuilder.h @@ -144,8 +144,7 @@ class SendableBuilder { * @param setter setter function (sets new value) */ virtual void AddValueProperty( - const wpi::Twine& key, - std::function()> getter, + const wpi::Twine& key, std::function()> getter, std::function)> setter) = 0; /** @@ -169,8 +168,7 @@ class SendableBuilder { */ virtual void AddSmallBooleanArrayProperty( const wpi::Twine& key, - std::function(wpi::SmallVectorImpl& buf)> - getter, + std::function(wpi::SmallVectorImpl& buf)> getter, std::function)> setter) = 0; /** diff --git a/wpilibc/src/main/native/include/SmartDashboard/SendableBuilderImpl.h b/wpilibc/src/main/native/include/SmartDashboard/SendableBuilderImpl.h index 87e1eaa8f7..759eaffaab 100644 --- a/wpilibc/src/main/native/include/SmartDashboard/SendableBuilderImpl.h +++ b/wpilibc/src/main/native/include/SmartDashboard/SendableBuilderImpl.h @@ -105,8 +105,7 @@ class SendableBuilderImpl : public SendableBuilder { std::function setter) override; void AddValueProperty( - const wpi::Twine& key, - std::function()> getter, + const wpi::Twine& key, std::function()> getter, std::function)> setter) override; void AddSmallStringProperty( @@ -116,8 +115,7 @@ class SendableBuilderImpl : public SendableBuilder { void AddSmallBooleanArrayProperty( const wpi::Twine& key, - std::function(wpi::SmallVectorImpl& buf)> - getter, + std::function(wpi::SmallVectorImpl& buf)> getter, std::function)> setter) override; void AddSmallDoubleArrayProperty( diff --git a/wpilibc/src/main/native/include/SmartDashboard/SmartDashboard.h b/wpilibc/src/main/native/include/SmartDashboard/SmartDashboard.h index 2acf534fd8..d0f06665ea 100644 --- a/wpilibc/src/main/native/include/SmartDashboard/SmartDashboard.h +++ b/wpilibc/src/main/native/include/SmartDashboard/SmartDashboard.h @@ -50,8 +50,7 @@ class SmartDashboard : public SensorBase { static double GetNumber(wpi::StringRef keyName, double defaultValue); static bool PutString(wpi::StringRef keyName, wpi::StringRef value); - static bool SetDefaultString(wpi::StringRef key, - wpi::StringRef defaultValue); + static bool SetDefaultString(wpi::StringRef key, wpi::StringRef defaultValue); static std::string GetString(wpi::StringRef keyName, wpi::StringRef defaultValue); @@ -64,8 +63,8 @@ class SmartDashboard : public SensorBase { static bool PutNumberArray(wpi::StringRef key, wpi::ArrayRef value); static bool SetDefaultNumberArray(wpi::StringRef key, wpi::ArrayRef defaultValue); - static std::vector GetNumberArray( - wpi::StringRef key, wpi::ArrayRef defaultValue); + static std::vector GetNumberArray(wpi::StringRef key, + wpi::ArrayRef defaultValue); static bool PutStringArray(wpi::StringRef key, wpi::ArrayRef value); diff --git a/wpilibc/src/main/native/include/Utility.h b/wpilibc/src/main/native/include/Utility.h index cda2217823..079eed08c5 100644 --- a/wpilibc/src/main/native/include/Utility.h +++ b/wpilibc/src/main/native/include/Utility.h @@ -47,9 +47,8 @@ bool wpi_assertEqual_impl(int valueA, int valueB, bool wpi_assertNotEqual_impl(int valueA, int valueB, const wpi::Twine& valueAString, const wpi::Twine& valueBString, - const wpi::Twine& message, - wpi::StringRef fileName, int lineNumber, - wpi::StringRef funcName); + const wpi::Twine& message, wpi::StringRef fileName, + int lineNumber, wpi::StringRef funcName); void wpi_suspendOnAssertEnabled(bool enabled); diff --git a/wpilibcExamples/.clang-format b/wpilibcExamples/.clang-format deleted file mode 100644 index c9ea34122f..0000000000 --- a/wpilibcExamples/.clang-format +++ /dev/null @@ -1,76 +0,0 @@ ---- -Language: Cpp -AccessModifierOffset: -8 -AlignAfterOpenBracket: DontAlign -AlignConsecutiveAssignments: false -AlignConsecutiveDeclarations: false -AlignEscapedNewlinesLeft: true -AlignOperands: true -AlignTrailingComments: true -AllowAllParametersOfDeclarationOnNextLine: true -AllowShortBlocksOnASingleLine: false -AllowShortCaseLabelsOnASingleLine: false -AllowShortFunctionsOnASingleLine: Inline -AllowShortIfStatementsOnASingleLine: true -AllowShortLoopsOnASingleLine: true -AlwaysBreakAfterDefinitionReturnType: None -AlwaysBreakAfterReturnType: None -AlwaysBreakBeforeMultilineStrings: false -AlwaysBreakTemplateDeclarations: false -BinPackArguments: true -BinPackParameters: true -BraceWrapping: {AfterClass: false, AfterControlStatement: false, AfterEnum: false, - AfterFunction: true, AfterNamespace: false, AfterObjCDeclaration: false, AfterStruct: false, - AfterUnion: false, BeforeCatch: false, BeforeElse: false, IndentBraces: false} -BreakBeforeBinaryOperators: NonAssignment -BreakBeforeBraces: Attach -BreakBeforeTernaryOperators: false -BreakConstructorInitializersBeforeComma: true -ColumnLimit: 80 -CommentPragmas: '^ IWYU pragma:' -ConstructorInitializerAllOnOneLineOrOnePerLine: false -ConstructorInitializerIndentWidth: 4 -ContinuationIndentWidth: 16 -Cpp11BracedListStyle: true -DerivePointerAlignment: false -DisableFormat: false -ExperimentalAutoDetectBinPacking: true -ForEachMacros: [foreach, Q_FOREACH, BOOST_FOREACH] -IncludeCategories: - - {Priority: 2, Regex: ^"(llvm|llvm-c|clang|clang-c)/} - - {Priority: 3, Regex: ^(<|"(gtest|isl|json)/)} - - {Priority: 1, Regex: .*} -IndentCaseLabels: true -IndentWidth: 8 -IndentWrappedFunctionNames: true -KeepEmptyLinesAtTheStartOfBlocks: false -MacroBlockBegin: '' -MacroBlockEnd: '' -MaxEmptyLinesToKeep: 1 -NamespaceIndentation: Inner -ObjCBlockIndentWidth: 0 -ObjCSpaceAfterProperty: true -ObjCSpaceBeforeProtocolList: true -PenaltyBreakBeforeFirstCallParameter: 19 -PenaltyBreakComment: 345 -PenaltyBreakFirstLessLess: 150 -PenaltyBreakString: 618 -PenaltyExcessCharacter: 977572 -PenaltyReturnTypeOnItsOwnLine: 41 -PointerAlignment: Left -ReflowComments: true -SortIncludes: true -SpaceAfterCStyleCast: false -SpaceBeforeAssignmentOperators: true -SpaceBeforeParens: ControlStatements -SpaceInEmptyParentheses: false -SpacesBeforeTrailingComments: 2 -SpacesInAngles: false -SpacesInCStyleCastParentheses: true -SpacesInContainerLiterals: true -SpacesInParentheses: false -SpacesInSquareBrackets: false -Standard: Cpp03 -TabWidth: 8 -UseTab: Always -... diff --git a/wpilibcExamples/.styleguide b/wpilibcExamples/.styleguide deleted file mode 100644 index 2984d92e9a..0000000000 --- a/wpilibcExamples/.styleguide +++ /dev/null @@ -1,45 +0,0 @@ -cppHeaderFileInclude { - \.h$ - \.hpp$ - \.inc$ -} - -cppSrcFileInclude { - \.cpp$ -} - -generatedFileExclude { - gmock/ - ni-libraries/include/ - ni-libraries/lib/ - hal/src/main/native/athena/ctre/ - hal/src/main/native/athena/frccansae/ - hal/src/main/native/athena/visa/ - hal/src/main/native/include/ctre/ - UsageReporting\.h$ -} - -modifiableFileExclude { - wpilibj/src/arm-linux-jni/ - wpilibj/src/main/native/cpp/ - \.patch$ - \.png$ - \.py$ - \.so$ -} - -includeGuardRoots { - wpilibcExamples/src/main/cpp/examples/ - wpilibcExamples/src/main/cpp/templates/ -} - -includeOtherLibs { - ^HAL/ - ^llvm/ - ^opencv2/ - ^support/ -} - -includeProject { - ^ctre/ -} diff --git a/wpilibcExamples/src/main/cpp/examples/ArcadeDrive/src/Robot.cpp b/wpilibcExamples/src/main/cpp/examples/ArcadeDrive/src/Robot.cpp index 5632db375a..6478739230 100644 --- a/wpilibcExamples/src/main/cpp/examples/ArcadeDrive/src/Robot.cpp +++ b/wpilibcExamples/src/main/cpp/examples/ArcadeDrive/src/Robot.cpp @@ -15,16 +15,16 @@ * Runs the motors with arcade steering. */ class Robot : public frc::IterativeRobot { - frc::Spark m_leftMotor{0}; - frc::Spark m_rightMotor{1}; - frc::DifferentialDrive m_robotDrive{m_leftMotor, m_rightMotor}; - frc::Joystick m_stick{0}; + frc::Spark m_leftMotor{0}; + frc::Spark m_rightMotor{1}; + frc::DifferentialDrive m_robotDrive{m_leftMotor, m_rightMotor}; + frc::Joystick m_stick{0}; -public: - void TeleopPeriodic() { - // drive with arcade style - m_robotDrive.ArcadeDrive(m_stick.GetY(), m_stick.GetX()); - } + public: + void TeleopPeriodic() { + // Drive with arcade style + m_robotDrive.ArcadeDrive(m_stick.GetY(), m_stick.GetX()); + } }; START_ROBOT_CLASS(Robot) diff --git a/wpilibcExamples/src/main/cpp/examples/AxisCameraSample/src/Robot.cpp b/wpilibcExamples/src/main/cpp/examples/AxisCameraSample/src/Robot.cpp index cb23adc274..e395f8e558 100644 --- a/wpilibcExamples/src/main/cpp/examples/AxisCameraSample/src/Robot.cpp +++ b/wpilibcExamples/src/main/cpp/examples/AxisCameraSample/src/Robot.cpp @@ -14,55 +14,50 @@ /** * This is a demo program showing the use of OpenCV to do vision processing. The * image is acquired from the Axis camera, then a rectangle is put on the image - * and - * sent to the dashboard. OpenCV has many methods for different types of + * and sent to the dashboard. OpenCV has many methods for different types of * processing. */ class Robot : public frc::IterativeRobot { -private: - static void VisionThread() { - // Get the Axis camera from CameraServer - cs::AxisCamera camera = - CameraServer::GetInstance()->AddAxisCamera( - "axis-camera.local"); - // Set the resolution - camera.SetResolution(640, 480); + private: + static void VisionThread() { + // Get the Axis camera from CameraServer + cs::AxisCamera camera = + CameraServer::GetInstance()->AddAxisCamera("axis-camera.local"); + // Set the resolution + camera.SetResolution(640, 480); - // Get a CvSink. This will capture Mats from the Camera - cs::CvSink cvSink = CameraServer::GetInstance()->GetVideo(); - // Setup a CvSource. This will send images back to the Dashboard - cs::CvSource outputStream = - CameraServer::GetInstance()->PutVideo( - "Rectangle", 640, 480); + // Get a CvSink. This will capture Mats from the Camera + cs::CvSink cvSink = CameraServer::GetInstance()->GetVideo(); + // Setup a CvSource. This will send images back to the Dashboard + cs::CvSource outputStream = + CameraServer::GetInstance()->PutVideo("Rectangle", 640, 480); - // Mats are very memory expensive. Lets reuse this Mat. - cv::Mat mat; + // Mats are very memory expensive. Lets reuse this Mat. + cv::Mat mat; - while (true) { - // Tell the CvSink to grab a frame from the camera and - // put it - // in the source mat. If there is an error notify the - // output. - if (cvSink.GrabFrame(mat) == 0) { - // Send the output the error. - outputStream.NotifyError(cvSink.GetError()); - // skip the rest of the current iteration - continue; - } - // Put a rectangle on the image - rectangle(mat, cv::Point(100, 100), cv::Point(400, 400), - cv::Scalar(255, 255, 255), 5); - // Give the output stream a new image to display - outputStream.PutFrame(mat); - } - } + while (true) { + // Tell the CvSink to grab a frame from the camera and put it in the + // source mat. If there is an error notify the output. + if (cvSink.GrabFrame(mat) == 0) { + // Send the output the error. + outputStream.NotifyError(cvSink.GetError()); + // skip the rest of the current iteration + continue; + } + // Put a rectangle on the image + rectangle(mat, cv::Point(100, 100), cv::Point(400, 400), + cv::Scalar(255, 255, 255), 5); + // Give the output stream a new image to display + outputStream.PutFrame(mat); + } + } - void RobotInit() override { - // We need to run our vision program in a separate Thread. - // If not, our robot program will not run - std::thread visionThread(VisionThread); - visionThread.detach(); - } + void RobotInit() override { + // We need to run our vision program in a separate thread. If not, our robot + // program will not run. + std::thread visionThread(VisionThread); + visionThread.detach(); + } }; START_ROBOT_CLASS(Robot) diff --git a/wpilibcExamples/src/main/cpp/examples/CANPDP/src/Robot.cpp b/wpilibcExamples/src/main/cpp/examples/CANPDP/src/Robot.cpp index 07f01fb4b6..0d0a5b5963 100644 --- a/wpilibcExamples/src/main/cpp/examples/CANPDP/src/Robot.cpp +++ b/wpilibcExamples/src/main/cpp/examples/CANPDP/src/Robot.cpp @@ -15,29 +15,26 @@ * through the SmartDashboard. */ class Robot : public frc::IterativeRobot { -public: - void TeleopPeriodic() override { - /* Get the current going through channel 7, in Amperes. The PDP - * returns the current in increments of 0.125A. At low currents - * the - * current readings tend to be less accurate. - */ - frc::SmartDashboard::PutNumber( - "Current Channel 7", m_pdp.GetCurrent(7)); + public: + void TeleopPeriodic() override { + /* Get the current going through channel 7, in Amperes. The PDP returns the + * current in increments of 0.125A. At low currents the current readings + * tend to be less accurate. + */ + frc::SmartDashboard::PutNumber("Current Channel 7", m_pdp.GetCurrent(7)); - /* Get the voltage going into the PDP, in Volts. - * The PDP returns the voltage in increments of 0.05 Volts. - */ - frc::SmartDashboard::PutNumber("Voltage", m_pdp.GetVoltage()); + /* Get the voltage going into the PDP, in Volts. The PDP returns the voltage + * in increments of 0.05 Volts. + */ + frc::SmartDashboard::PutNumber("Voltage", m_pdp.GetVoltage()); - // Retrieves the temperature of the PDP, in degrees Celsius. - frc::SmartDashboard::PutNumber( - "Temperature", m_pdp.GetTemperature()); - } + // Retrieves the temperature of the PDP, in degrees Celsius. + frc::SmartDashboard::PutNumber("Temperature", m_pdp.GetTemperature()); + } -private: - // Object for dealing with the Power Distribution Panel (PDP). - frc::PowerDistributionPanel m_pdp; + private: + // Object for dealing with the Power Distribution Panel (PDP). + frc::PowerDistributionPanel m_pdp; }; START_ROBOT_CLASS(Robot) diff --git a/wpilibcExamples/src/main/cpp/examples/Encoder/src/Robot.cpp b/wpilibcExamples/src/main/cpp/examples/Encoder/src/Robot.cpp index f31942f123..982bb64792 100644 --- a/wpilibcExamples/src/main/cpp/examples/Encoder/src/Robot.cpp +++ b/wpilibcExamples/src/main/cpp/examples/Encoder/src/Robot.cpp @@ -11,84 +11,73 @@ /** * Sample program displaying the value of a quadrature encoder on the - * SmartDashboard. + * SmartDashboard. + * * Quadrature Encoders are digital sensors which can detect the amount the - * encoder has rotated since starting as well as the direction in which the - * encoder shaft is rotating. However, encoders can not tell you the absolute - * position of the encoder shaft (ie, it considers where it starts to be the - * zero position, no matter where it starts), and so can only tell you how - * much the encoder has rotated since starting. - * Depending on the precision of an encoder, it will have fewer or greater - * ticks per revolution; the number of ticks per revolution will affect the - * conversion between ticks and distance, as specified by DistancePerPulse. + * encoder has rotated since starting as well as the direction in which the + * encoder shaft is rotating. However, encoders can not tell you the absolute + * position of the encoder shaft (ie, it considers where it starts to be the + * zero position, no matter where it starts), and so can only tell you how much + * the encoder has rotated since starting. + * + * Depending on the precision of an encoder, it will have fewer or greater ticks + * per revolution; the number of ticks per revolution will affect the conversion + * between ticks and distance, as specified by DistancePerPulse. + * * One of the most common uses of encoders is in the drivetrain, so that the - * distance that the robot drives can be precisely controlled during the - * autonomous mode. + * distance that the robot drives can be precisely controlled during the + * autonomous mode. */ class Robot : public frc::IterativeRobot { -public: - Robot() { - /* Defines the number of samples to average when determining the - * rate. - * On a quadrature encoder, values range from 1-255; larger - * values - * result in smoother but potentially less accurate rates than - * lower - * values. - */ - m_encoder.SetSamplesToAverage(5); + public: + Robot() { + /* Defines the number of samples to average when determining the rate. + * On a quadrature encoder, values range from 1-255; larger values result in + * smoother but potentially less accurate rates than lower values. + */ + m_encoder.SetSamplesToAverage(5); - /* Defines how far the mechanism attached to the encoder moves - * per pulse. - * In this case, we assume that a 360 count encoder is directly - * attached - * to a 3 inch diameter (1.5inch radius) wheel, and that we want - * to - * measure distance in inches. - */ - m_encoder.SetDistancePerPulse(1.0 / 360.0 * 2.0 * 3.1415 * 1.5); + /* Defines how far the mechanism attached to the encoder moves per pulse. In + * this case, we assume that a 360 count encoder is directly attached to a 3 + * inch diameter (1.5inch radius) wheel, and that we want to measure + * distance in inches. + */ + m_encoder.SetDistancePerPulse(1.0 / 360.0 * 2.0 * 3.1415 * 1.5); - /* Defines the lowest rate at which the encoder will not be - * considered - * stopped, for the purposes of the GetStopped() method. - * Units are in distance / second, where distance refers to the - * units - * of distance that you are using, in this case inches. - */ - m_encoder.SetMinRate(1.0); - } + /* Defines the lowest rate at which the encoder will not be considered + * stopped, for the purposes of the GetStopped() method. Units are in + * distance / second, where distance refers to the units of distance that + * you are using, in this case inches. + */ + m_encoder.SetMinRate(1.0); + } - void TeleopPeriodic() override { - // Retrieve the net displacement of the Encoder since the last - // Reset. - frc::SmartDashboard::PutNumber( - "Encoder Distance", m_encoder.GetDistance()); + void TeleopPeriodic() override { + // Retrieve the net displacement of the Encoder since the last Reset. + frc::SmartDashboard::PutNumber("Encoder Distance", m_encoder.GetDistance()); - // Retrieve the current rate of the encoder. - frc::SmartDashboard::PutNumber( - "Encoder Rate", m_encoder.GetRate()); - } + // Retrieve the current rate of the encoder. + frc::SmartDashboard::PutNumber("Encoder Rate", m_encoder.GetRate()); + } -private: - /** - * The Encoder object is constructed with 4 parameters, the last two - * being - * optional. - * The first two parameters (1, 2 in this case) refer to the ports on - * the - * roboRIO which the encoder uses. Because a quadrature encoder has - * two signal wires, the signal from two DIO ports on the roboRIO are - * used. - * The third (optional) parameter is a boolean which defaults to false. - * If you set this parameter to true, the direction of the encoder - * will - * be reversed, in case it makes more sense mechanically. - * The final (optional) parameter specifies encoding rate (k1X, k2X, or - * k4X) - * and defaults to k4X. Faster (k4X) encoding gives greater positional - * precision but more noise in the rate. - */ - frc::Encoder m_encoder{1, 2, false, Encoder::k4X}; + private: + /** + * The Encoder object is constructed with 4 parameters, the last two being + * optional. + * + * The first two parameters (1, 2 in this case) refer to the ports on the + * roboRIO which the encoder uses. Because a quadrature encoder has two signal + * wires, the signal from two DIO ports on the roboRIO are used. + * + * The third (optional) parameter is a boolean which defaults to false. If you + * set this parameter to true, the direction of the encoder will be reversed, + * in case it makes more sense mechanically. + * + * The final (optional) parameter specifies encoding rate (k1X, k2X, or k4X) + * and defaults to k4X. Faster (k4X) encoding gives greater positional + * precision but more noise in the rate. + */ + frc::Encoder m_encoder{1, 2, false, Encoder::k4X}; }; START_ROBOT_CLASS(Robot) diff --git a/wpilibcExamples/src/main/cpp/examples/GearsBot/src/Commands/Autonomous.cpp b/wpilibcExamples/src/main/cpp/examples/GearsBot/src/Commands/Autonomous.cpp index c6ce3998e1..eba8555a8b 100644 --- a/wpilibcExamples/src/main/cpp/examples/GearsBot/src/Commands/Autonomous.cpp +++ b/wpilibcExamples/src/main/cpp/examples/GearsBot/src/Commands/Autonomous.cpp @@ -15,17 +15,16 @@ #include "SetDistanceToBox.h" #include "SetWristSetpoint.h" -Autonomous::Autonomous() - : frc::CommandGroup("Autonomous") { - AddSequential(new PrepareToPickup()); - AddSequential(new Pickup()); - AddSequential(new SetDistanceToBox(0.10)); - // AddSequential(new DriveStraight(4)); // Use Encoders if ultrasonic - // is broken - AddSequential(new Place()); - AddSequential(new SetDistanceToBox(0.60)); - // AddSequential(new DriveStraight(-2)); // Use Encoders if ultrasonic - // is broken - AddParallel(new SetWristSetpoint(-45)); - AddSequential(new CloseClaw()); +Autonomous::Autonomous() : frc::CommandGroup("Autonomous") { + AddSequential(new PrepareToPickup()); + AddSequential(new Pickup()); + AddSequential(new SetDistanceToBox(0.10)); + // AddSequential(new DriveStraight(4)); // Use Encoders if ultrasonic + // is broken + AddSequential(new Place()); + AddSequential(new SetDistanceToBox(0.60)); + // AddSequential(new DriveStraight(-2)); // Use Encoders if ultrasonic + // is broken + AddParallel(new SetWristSetpoint(-45)); + AddSequential(new CloseClaw()); } diff --git a/wpilibcExamples/src/main/cpp/examples/GearsBot/src/Commands/Autonomous.h b/wpilibcExamples/src/main/cpp/examples/GearsBot/src/Commands/Autonomous.h index 44bff14c1c..50a1dcdf44 100644 --- a/wpilibcExamples/src/main/cpp/examples/GearsBot/src/Commands/Autonomous.h +++ b/wpilibcExamples/src/main/cpp/examples/GearsBot/src/Commands/Autonomous.h @@ -13,6 +13,6 @@ * The main autonomous command to pickup and deliver the soda to the box. */ class Autonomous : public frc::CommandGroup { -public: - Autonomous(); + public: + Autonomous(); }; diff --git a/wpilibcExamples/src/main/cpp/examples/GearsBot/src/Commands/CloseClaw.cpp b/wpilibcExamples/src/main/cpp/examples/GearsBot/src/Commands/CloseClaw.cpp index 732fc80a9f..32f9dc956b 100644 --- a/wpilibcExamples/src/main/cpp/examples/GearsBot/src/Commands/CloseClaw.cpp +++ b/wpilibcExamples/src/main/cpp/examples/GearsBot/src/Commands/CloseClaw.cpp @@ -9,20 +9,13 @@ #include "../Robot.h" -CloseClaw::CloseClaw() - : frc::Command("CloseClaw") { - Requires(&Robot::claw); -} +CloseClaw::CloseClaw() : frc::Command("CloseClaw") { Requires(&Robot::claw); } // Called just before this Command runs the first time -void CloseClaw::Initialize() { - Robot::claw.Close(); -} +void CloseClaw::Initialize() { Robot::claw.Close(); } // Make this return true when this Command no longer needs to run execute() -bool CloseClaw::IsFinished() { - return Robot::claw.IsGripping(); -} +bool CloseClaw::IsFinished() { return Robot::claw.IsGripping(); } // Called once after isFinished returns true void CloseClaw::End() { @@ -30,6 +23,6 @@ void CloseClaw::End() { // fall out // + there is no need to worry about stalling the motor or crushing the can. #ifndef SIMULATION - Robot::claw.Stop(); + Robot::claw.Stop(); #endif } diff --git a/wpilibcExamples/src/main/cpp/examples/GearsBot/src/Commands/CloseClaw.h b/wpilibcExamples/src/main/cpp/examples/GearsBot/src/Commands/CloseClaw.h index 350ddb87cd..0d36509ae8 100644 --- a/wpilibcExamples/src/main/cpp/examples/GearsBot/src/Commands/CloseClaw.h +++ b/wpilibcExamples/src/main/cpp/examples/GearsBot/src/Commands/CloseClaw.h @@ -14,9 +14,9 @@ * motors is BAD! */ class CloseClaw : public frc::Command { -public: - CloseClaw(); - void Initialize() override; - bool IsFinished() override; - void End() override; + public: + CloseClaw(); + void Initialize() override; + bool IsFinished() override; + void End() override; }; diff --git a/wpilibcExamples/src/main/cpp/examples/GearsBot/src/Commands/DriveStraight.cpp b/wpilibcExamples/src/main/cpp/examples/GearsBot/src/Commands/DriveStraight.cpp index cb4ea730aa..fb93c3237c 100644 --- a/wpilibcExamples/src/main/cpp/examples/GearsBot/src/Commands/DriveStraight.cpp +++ b/wpilibcExamples/src/main/cpp/examples/GearsBot/src/Commands/DriveStraight.cpp @@ -10,35 +10,33 @@ #include "../Robot.h" DriveStraight::DriveStraight(double distance) { - Requires(&Robot::drivetrain); - m_pid.SetAbsoluteTolerance(0.01); - m_pid.SetSetpoint(distance); + Requires(&Robot::drivetrain); + m_pid.SetAbsoluteTolerance(0.01); + m_pid.SetSetpoint(distance); } // Called just before this Command runs the first time void DriveStraight::Initialize() { - // Get everything in a safe starting state. - Robot::drivetrain.Reset(); - m_pid.Reset(); - m_pid.Enable(); + // Get everything in a safe starting state. + Robot::drivetrain.Reset(); + m_pid.Reset(); + m_pid.Enable(); } // Make this return true when this Command no longer needs to run execute() -bool DriveStraight::IsFinished() { - return m_pid.OnTarget(); -} +bool DriveStraight::IsFinished() { return m_pid.OnTarget(); } // Called once after isFinished returns true void DriveStraight::End() { - // Stop PID and the wheels - m_pid.Disable(); - Robot::drivetrain.Drive(0, 0); + // Stop PID and the wheels + m_pid.Disable(); + Robot::drivetrain.Drive(0, 0); } double DriveStraight::DriveStraightPIDSource::PIDGet() { - return Robot::drivetrain.GetDistance(); + return Robot::drivetrain.GetDistance(); } void DriveStraight::DriveStraightPIDOutput::PIDWrite(double d) { - Robot::drivetrain.Drive(d, d); + Robot::drivetrain.Drive(d, d); } diff --git a/wpilibcExamples/src/main/cpp/examples/GearsBot/src/Commands/DriveStraight.h b/wpilibcExamples/src/main/cpp/examples/GearsBot/src/Commands/DriveStraight.h index 8cdfc8495e..f5548e19a9 100644 --- a/wpilibcExamples/src/main/cpp/examples/GearsBot/src/Commands/DriveStraight.h +++ b/wpilibcExamples/src/main/cpp/examples/GearsBot/src/Commands/DriveStraight.h @@ -19,26 +19,26 @@ * values of the left and right encoders. */ class DriveStraight : public frc::Command { -public: - explicit DriveStraight(double distance); - void Initialize() override; - bool IsFinished() override; - void End() override; + public: + explicit DriveStraight(double distance); + void Initialize() override; + bool IsFinished() override; + void End() override; - class DriveStraightPIDSource : public frc::PIDSource { - public: - virtual ~DriveStraightPIDSource() = default; - double PIDGet() override; - }; + class DriveStraightPIDSource : public frc::PIDSource { + public: + virtual ~DriveStraightPIDSource() = default; + double PIDGet() override; + }; - class DriveStraightPIDOutput : public frc::PIDOutput { - public: - virtual ~DriveStraightPIDOutput() = default; - void PIDWrite(double d) override; - }; + class DriveStraightPIDOutput : public frc::PIDOutput { + public: + virtual ~DriveStraightPIDOutput() = default; + void PIDWrite(double d) override; + }; -private: - DriveStraightPIDSource m_source; - DriveStraightPIDOutput m_output; - frc::PIDController m_pid{4, 0, 0, &m_source, &m_output}; + private: + DriveStraightPIDSource m_source; + DriveStraightPIDOutput m_output; + frc::PIDController m_pid{4, 0, 0, &m_source, &m_output}; }; diff --git a/wpilibcExamples/src/main/cpp/examples/GearsBot/src/Commands/OpenClaw.cpp b/wpilibcExamples/src/main/cpp/examples/GearsBot/src/Commands/OpenClaw.cpp index b5226402f9..788f24f807 100644 --- a/wpilibcExamples/src/main/cpp/examples/GearsBot/src/Commands/OpenClaw.cpp +++ b/wpilibcExamples/src/main/cpp/examples/GearsBot/src/Commands/OpenClaw.cpp @@ -9,23 +9,16 @@ #include "../Robot.h" -OpenClaw::OpenClaw() - : frc::Command("OpenClaw") { - Requires(&Robot::claw); - SetTimeout(1); +OpenClaw::OpenClaw() : frc::Command("OpenClaw") { + Requires(&Robot::claw); + SetTimeout(1); } // Called just before this Command runs the first time -void OpenClaw::Initialize() { - Robot::claw.Open(); -} +void OpenClaw::Initialize() { Robot::claw.Open(); } // Make this return true when this Command no longer needs to run execute() -bool OpenClaw::IsFinished() { - return IsTimedOut(); -} +bool OpenClaw::IsFinished() { return IsTimedOut(); } // Called once after isFinished returns true -void OpenClaw::End() { - Robot::claw.Stop(); -} +void OpenClaw::End() { Robot::claw.Stop(); } diff --git a/wpilibcExamples/src/main/cpp/examples/GearsBot/src/Commands/OpenClaw.h b/wpilibcExamples/src/main/cpp/examples/GearsBot/src/Commands/OpenClaw.h index 3e0aa2f095..501bd038dc 100644 --- a/wpilibcExamples/src/main/cpp/examples/GearsBot/src/Commands/OpenClaw.h +++ b/wpilibcExamples/src/main/cpp/examples/GearsBot/src/Commands/OpenClaw.h @@ -14,9 +14,9 @@ * motors is BAD! */ class OpenClaw : public frc::Command { -public: - OpenClaw(); - void Initialize() override; - bool IsFinished() override; - void End() override; + public: + OpenClaw(); + void Initialize() override; + bool IsFinished() override; + void End() override; }; diff --git a/wpilibcExamples/src/main/cpp/examples/GearsBot/src/Commands/Pickup.cpp b/wpilibcExamples/src/main/cpp/examples/GearsBot/src/Commands/Pickup.cpp index aef208fe83..252cd08071 100644 --- a/wpilibcExamples/src/main/cpp/examples/GearsBot/src/Commands/Pickup.cpp +++ b/wpilibcExamples/src/main/cpp/examples/GearsBot/src/Commands/Pickup.cpp @@ -11,9 +11,8 @@ #include "SetElevatorSetpoint.h" #include "SetWristSetpoint.h" -Pickup::Pickup() - : frc::CommandGroup("Pickup") { - AddSequential(new CloseClaw()); - AddParallel(new SetWristSetpoint(-45)); - AddSequential(new SetElevatorSetpoint(0.25)); +Pickup::Pickup() : frc::CommandGroup("Pickup") { + AddSequential(new CloseClaw()); + AddParallel(new SetWristSetpoint(-45)); + AddSequential(new SetElevatorSetpoint(0.25)); } diff --git a/wpilibcExamples/src/main/cpp/examples/GearsBot/src/Commands/Pickup.h b/wpilibcExamples/src/main/cpp/examples/GearsBot/src/Commands/Pickup.h index f407690886..05c9da7ed1 100644 --- a/wpilibcExamples/src/main/cpp/examples/GearsBot/src/Commands/Pickup.h +++ b/wpilibcExamples/src/main/cpp/examples/GearsBot/src/Commands/Pickup.h @@ -14,6 +14,6 @@ * get it in a safe state to drive around. */ class Pickup : public frc::CommandGroup { -public: - Pickup(); + public: + Pickup(); }; diff --git a/wpilibcExamples/src/main/cpp/examples/GearsBot/src/Commands/Place.cpp b/wpilibcExamples/src/main/cpp/examples/GearsBot/src/Commands/Place.cpp index d3dfedc49f..3ae443bbd2 100644 --- a/wpilibcExamples/src/main/cpp/examples/GearsBot/src/Commands/Place.cpp +++ b/wpilibcExamples/src/main/cpp/examples/GearsBot/src/Commands/Place.cpp @@ -11,9 +11,8 @@ #include "SetElevatorSetpoint.h" #include "SetWristSetpoint.h" -Place::Place() - : frc::CommandGroup("Place") { - AddSequential(new SetElevatorSetpoint(0.25)); - AddSequential(new SetWristSetpoint(0)); - AddSequential(new OpenClaw()); +Place::Place() : frc::CommandGroup("Place") { + AddSequential(new SetElevatorSetpoint(0.25)); + AddSequential(new SetWristSetpoint(0)); + AddSequential(new OpenClaw()); } diff --git a/wpilibcExamples/src/main/cpp/examples/GearsBot/src/Commands/Place.h b/wpilibcExamples/src/main/cpp/examples/GearsBot/src/Commands/Place.h index ceeb3e36e2..56e2d72609 100644 --- a/wpilibcExamples/src/main/cpp/examples/GearsBot/src/Commands/Place.h +++ b/wpilibcExamples/src/main/cpp/examples/GearsBot/src/Commands/Place.h @@ -13,6 +13,6 @@ * Place a held soda can onto the platform. */ class Place : public frc::CommandGroup { -public: - Place(); + public: + Place(); }; diff --git a/wpilibcExamples/src/main/cpp/examples/GearsBot/src/Commands/PrepareToPickup.cpp b/wpilibcExamples/src/main/cpp/examples/GearsBot/src/Commands/PrepareToPickup.cpp index c3d67811f7..edd081eaef 100644 --- a/wpilibcExamples/src/main/cpp/examples/GearsBot/src/Commands/PrepareToPickup.cpp +++ b/wpilibcExamples/src/main/cpp/examples/GearsBot/src/Commands/PrepareToPickup.cpp @@ -11,9 +11,8 @@ #include "SetElevatorSetpoint.h" #include "SetWristSetpoint.h" -PrepareToPickup::PrepareToPickup() - : frc::CommandGroup("PrepareToPickup") { - AddParallel(new OpenClaw()); - AddParallel(new SetWristSetpoint(0)); - AddSequential(new SetElevatorSetpoint(0)); +PrepareToPickup::PrepareToPickup() : frc::CommandGroup("PrepareToPickup") { + AddParallel(new OpenClaw()); + AddParallel(new SetWristSetpoint(0)); + AddSequential(new SetElevatorSetpoint(0)); } diff --git a/wpilibcExamples/src/main/cpp/examples/GearsBot/src/Commands/PrepareToPickup.h b/wpilibcExamples/src/main/cpp/examples/GearsBot/src/Commands/PrepareToPickup.h index 13ac8b416d..e59e7c8b51 100644 --- a/wpilibcExamples/src/main/cpp/examples/GearsBot/src/Commands/PrepareToPickup.h +++ b/wpilibcExamples/src/main/cpp/examples/GearsBot/src/Commands/PrepareToPickup.h @@ -13,6 +13,6 @@ * Make sure the robot is in a state to pickup soda cans. */ class PrepareToPickup : public frc::CommandGroup { -public: - PrepareToPickup(); + public: + PrepareToPickup(); }; diff --git a/wpilibcExamples/src/main/cpp/examples/GearsBot/src/Commands/SetDistanceToBox.cpp b/wpilibcExamples/src/main/cpp/examples/GearsBot/src/Commands/SetDistanceToBox.cpp index 7ce503dd57..ec608f2def 100644 --- a/wpilibcExamples/src/main/cpp/examples/GearsBot/src/Commands/SetDistanceToBox.cpp +++ b/wpilibcExamples/src/main/cpp/examples/GearsBot/src/Commands/SetDistanceToBox.cpp @@ -12,35 +12,33 @@ #include "../Robot.h" SetDistanceToBox::SetDistanceToBox(double distance) { - Requires(&Robot::drivetrain); - m_pid.SetAbsoluteTolerance(0.01); - m_pid.SetSetpoint(distance); + Requires(&Robot::drivetrain); + m_pid.SetAbsoluteTolerance(0.01); + m_pid.SetSetpoint(distance); } // Called just before this Command runs the first time void SetDistanceToBox::Initialize() { - // Get everything in a safe starting state. - Robot::drivetrain.Reset(); - m_pid.Reset(); - m_pid.Enable(); + // Get everything in a safe starting state. + Robot::drivetrain.Reset(); + m_pid.Reset(); + m_pid.Enable(); } // Make this return true when this Command no longer needs to run execute() -bool SetDistanceToBox::IsFinished() { - return m_pid.OnTarget(); -} +bool SetDistanceToBox::IsFinished() { return m_pid.OnTarget(); } // Called once after isFinished returns true void SetDistanceToBox::End() { - // Stop PID and the wheels - m_pid.Disable(); - Robot::drivetrain.Drive(0, 0); + // Stop PID and the wheels + m_pid.Disable(); + Robot::drivetrain.Drive(0, 0); } double SetDistanceToBox::SetDistanceToBoxPIDSource::PIDGet() { - return Robot::drivetrain.GetDistanceToObstacle(); + return Robot::drivetrain.GetDistanceToObstacle(); } void SetDistanceToBox::SetDistanceToBoxPIDOutput::PIDWrite(double d) { - Robot::drivetrain.Drive(d, d); + Robot::drivetrain.Drive(d, d); } diff --git a/wpilibcExamples/src/main/cpp/examples/GearsBot/src/Commands/SetDistanceToBox.h b/wpilibcExamples/src/main/cpp/examples/GearsBot/src/Commands/SetDistanceToBox.h index 7c0ce86528..e31416ed38 100644 --- a/wpilibcExamples/src/main/cpp/examples/GearsBot/src/Commands/SetDistanceToBox.h +++ b/wpilibcExamples/src/main/cpp/examples/GearsBot/src/Commands/SetDistanceToBox.h @@ -19,26 +19,26 @@ * encoders. */ class SetDistanceToBox : public frc::Command { -public: - explicit SetDistanceToBox(double distance); - void Initialize() override; - bool IsFinished() override; - void End() override; + public: + explicit SetDistanceToBox(double distance); + void Initialize() override; + bool IsFinished() override; + void End() override; - class SetDistanceToBoxPIDSource : public frc::PIDSource { - public: - virtual ~SetDistanceToBoxPIDSource() = default; - double PIDGet() override; - }; + class SetDistanceToBoxPIDSource : public frc::PIDSource { + public: + virtual ~SetDistanceToBoxPIDSource() = default; + double PIDGet() override; + }; - class SetDistanceToBoxPIDOutput : public frc::PIDOutput { - public: - virtual ~SetDistanceToBoxPIDOutput() = default; - void PIDWrite(double d) override; - }; + class SetDistanceToBoxPIDOutput : public frc::PIDOutput { + public: + virtual ~SetDistanceToBoxPIDOutput() = default; + void PIDWrite(double d) override; + }; -private: - SetDistanceToBoxPIDSource m_source; - SetDistanceToBoxPIDOutput m_output; - frc::PIDController m_pid{-2, 0, 0, &m_source, &m_output}; + private: + SetDistanceToBoxPIDSource m_source; + SetDistanceToBoxPIDOutput m_output; + frc::PIDController m_pid{-2, 0, 0, &m_source, &m_output}; }; diff --git a/wpilibcExamples/src/main/cpp/examples/GearsBot/src/Commands/SetElevatorSetpoint.cpp b/wpilibcExamples/src/main/cpp/examples/GearsBot/src/Commands/SetElevatorSetpoint.cpp index daef19c579..0d09cfdc22 100644 --- a/wpilibcExamples/src/main/cpp/examples/GearsBot/src/Commands/SetElevatorSetpoint.cpp +++ b/wpilibcExamples/src/main/cpp/examples/GearsBot/src/Commands/SetElevatorSetpoint.cpp @@ -13,17 +13,15 @@ SetElevatorSetpoint::SetElevatorSetpoint(double setpoint) : frc::Command("SetElevatorSetpoint") { - m_setpoint = setpoint; - Requires(&Robot::elevator); + m_setpoint = setpoint; + Requires(&Robot::elevator); } // Called just before this Command runs the first time void SetElevatorSetpoint::Initialize() { - Robot::elevator.SetSetpoint(m_setpoint); - Robot::elevator.Enable(); + Robot::elevator.SetSetpoint(m_setpoint); + Robot::elevator.Enable(); } // Make this return true when this Command no longer needs to run execute() -bool SetElevatorSetpoint::IsFinished() { - return Robot::elevator.OnTarget(); -} +bool SetElevatorSetpoint::IsFinished() { return Robot::elevator.OnTarget(); } diff --git a/wpilibcExamples/src/main/cpp/examples/GearsBot/src/Commands/SetElevatorSetpoint.h b/wpilibcExamples/src/main/cpp/examples/GearsBot/src/Commands/SetElevatorSetpoint.h index 494d1044b5..4a63944b23 100644 --- a/wpilibcExamples/src/main/cpp/examples/GearsBot/src/Commands/SetElevatorSetpoint.h +++ b/wpilibcExamples/src/main/cpp/examples/GearsBot/src/Commands/SetElevatorSetpoint.h @@ -17,11 +17,11 @@ * commands using the elevator should make sure they disable PID! */ class SetElevatorSetpoint : public frc::Command { -public: - explicit SetElevatorSetpoint(double setpoint); - void Initialize() override; - bool IsFinished() override; + public: + explicit SetElevatorSetpoint(double setpoint); + void Initialize() override; + bool IsFinished() override; -private: - double m_setpoint; + private: + double m_setpoint; }; diff --git a/wpilibcExamples/src/main/cpp/examples/GearsBot/src/Commands/SetWristSetpoint.cpp b/wpilibcExamples/src/main/cpp/examples/GearsBot/src/Commands/SetWristSetpoint.cpp index be8da58853..7e33268667 100644 --- a/wpilibcExamples/src/main/cpp/examples/GearsBot/src/Commands/SetWristSetpoint.cpp +++ b/wpilibcExamples/src/main/cpp/examples/GearsBot/src/Commands/SetWristSetpoint.cpp @@ -11,17 +11,15 @@ SetWristSetpoint::SetWristSetpoint(double setpoint) : frc::Command("SetWristSetpoint") { - m_setpoint = setpoint; - Requires(&Robot::wrist); + m_setpoint = setpoint; + Requires(&Robot::wrist); } // Called just before this Command runs the first time void SetWristSetpoint::Initialize() { - Robot::wrist.SetSetpoint(m_setpoint); - Robot::wrist.Enable(); + Robot::wrist.SetSetpoint(m_setpoint); + Robot::wrist.Enable(); } // Make this return true when this Command no longer needs to run execute() -bool SetWristSetpoint::IsFinished() { - return Robot::wrist.OnTarget(); -} +bool SetWristSetpoint::IsFinished() { return Robot::wrist.OnTarget(); } diff --git a/wpilibcExamples/src/main/cpp/examples/GearsBot/src/Commands/SetWristSetpoint.h b/wpilibcExamples/src/main/cpp/examples/GearsBot/src/Commands/SetWristSetpoint.h index ccc698aee0..7151dd5e07 100644 --- a/wpilibcExamples/src/main/cpp/examples/GearsBot/src/Commands/SetWristSetpoint.h +++ b/wpilibcExamples/src/main/cpp/examples/GearsBot/src/Commands/SetWristSetpoint.h @@ -15,11 +15,11 @@ * Other commands using the wrist should make sure they disable PID! */ class SetWristSetpoint : public frc::Command { -public: - explicit SetWristSetpoint(double setpoint); - void Initialize() override; - bool IsFinished() override; + public: + explicit SetWristSetpoint(double setpoint); + void Initialize() override; + bool IsFinished() override; -private: - double m_setpoint; + private: + double m_setpoint; }; diff --git a/wpilibcExamples/src/main/cpp/examples/GearsBot/src/Commands/TankDriveWithJoystick.cpp b/wpilibcExamples/src/main/cpp/examples/GearsBot/src/Commands/TankDriveWithJoystick.cpp index e0a22dc7c9..b31181aa5e 100644 --- a/wpilibcExamples/src/main/cpp/examples/GearsBot/src/Commands/TankDriveWithJoystick.cpp +++ b/wpilibcExamples/src/main/cpp/examples/GearsBot/src/Commands/TankDriveWithJoystick.cpp @@ -11,21 +11,17 @@ TankDriveWithJoystick::TankDriveWithJoystick() : frc::Command("TankDriveWithJoystick") { - Requires(&Robot::drivetrain); + Requires(&Robot::drivetrain); } // Called repeatedly when this Command is scheduled to run void TankDriveWithJoystick::Execute() { - auto& joystick = Robot::oi.GetJoystick(); - Robot::drivetrain.Drive(-joystick.GetY(), -joystick.GetRawAxis(4)); + auto& joystick = Robot::oi.GetJoystick(); + Robot::drivetrain.Drive(-joystick.GetY(), -joystick.GetRawAxis(4)); } // Make this return true when this Command no longer needs to run execute() -bool TankDriveWithJoystick::IsFinished() { - return false; -} +bool TankDriveWithJoystick::IsFinished() { return false; } // Called once after isFinished returns true -void TankDriveWithJoystick::End() { - Robot::drivetrain.Drive(0, 0); -} +void TankDriveWithJoystick::End() { Robot::drivetrain.Drive(0, 0); } diff --git a/wpilibcExamples/src/main/cpp/examples/GearsBot/src/Commands/TankDriveWithJoystick.h b/wpilibcExamples/src/main/cpp/examples/GearsBot/src/Commands/TankDriveWithJoystick.h index 4beae78bdf..5a0bd867db 100644 --- a/wpilibcExamples/src/main/cpp/examples/GearsBot/src/Commands/TankDriveWithJoystick.h +++ b/wpilibcExamples/src/main/cpp/examples/GearsBot/src/Commands/TankDriveWithJoystick.h @@ -13,9 +13,9 @@ * Have the robot drive tank style using the PS3 Joystick until interrupted. */ class TankDriveWithJoystick : public frc::Command { -public: - TankDriveWithJoystick(); - void Execute() override; - bool IsFinished() override; - void End() override; + public: + TankDriveWithJoystick(); + void Execute() override; + bool IsFinished() override; + void End() override; }; diff --git a/wpilibcExamples/src/main/cpp/examples/GearsBot/src/OI.cpp b/wpilibcExamples/src/main/cpp/examples/GearsBot/src/OI.cpp index 34906a8d8f..6b97aed9ed 100644 --- a/wpilibcExamples/src/main/cpp/examples/GearsBot/src/OI.cpp +++ b/wpilibcExamples/src/main/cpp/examples/GearsBot/src/OI.cpp @@ -18,21 +18,19 @@ #include "Commands/SetElevatorSetpoint.h" OI::OI() { - frc::SmartDashboard::PutData("Open Claw", new OpenClaw()); - frc::SmartDashboard::PutData("Close Claw", new CloseClaw()); + frc::SmartDashboard::PutData("Open Claw", new OpenClaw()); + frc::SmartDashboard::PutData("Close Claw", new CloseClaw()); - // Connect the buttons to commands - m_dUp.WhenPressed(new SetElevatorSetpoint(0.2)); - m_dDown.WhenPressed(new SetElevatorSetpoint(-0.2)); - m_dRight.WhenPressed(new CloseClaw()); - m_dLeft.WhenPressed(new OpenClaw()); + // Connect the buttons to commands + m_dUp.WhenPressed(new SetElevatorSetpoint(0.2)); + m_dDown.WhenPressed(new SetElevatorSetpoint(-0.2)); + m_dRight.WhenPressed(new CloseClaw()); + m_dLeft.WhenPressed(new OpenClaw()); - m_r1.WhenPressed(new PrepareToPickup()); - m_r2.WhenPressed(new Pickup()); - m_l1.WhenPressed(new Place()); - m_l2.WhenPressed(new Autonomous()); + m_r1.WhenPressed(new PrepareToPickup()); + m_r2.WhenPressed(new Pickup()); + m_l1.WhenPressed(new Place()); + m_l2.WhenPressed(new Autonomous()); } -frc::Joystick& OI::GetJoystick() { - return m_joy; -} +frc::Joystick& OI::GetJoystick() { return m_joy; } diff --git a/wpilibcExamples/src/main/cpp/examples/GearsBot/src/OI.h b/wpilibcExamples/src/main/cpp/examples/GearsBot/src/OI.h index a63e570b56..7bf4649ed2 100644 --- a/wpilibcExamples/src/main/cpp/examples/GearsBot/src/OI.h +++ b/wpilibcExamples/src/main/cpp/examples/GearsBot/src/OI.h @@ -11,20 +11,20 @@ #include class OI { -public: - OI(); - frc::Joystick& GetJoystick(); + public: + OI(); + frc::Joystick& GetJoystick(); -private: - frc::Joystick m_joy{0}; + private: + frc::Joystick m_joy{0}; - // Create some buttons - frc::JoystickButton m_dUp{&m_joy, 5}; - frc::JoystickButton m_dRight{&m_joy, 6}; - frc::JoystickButton m_dDown{&m_joy, 7}; - frc::JoystickButton m_dLeft{&m_joy, 8}; - frc::JoystickButton m_l2{&m_joy, 9}; - frc::JoystickButton m_r2{&m_joy, 10}; - frc::JoystickButton m_l1{&m_joy, 11}; - frc::JoystickButton m_r1{&m_joy, 12}; + // Create some buttons + frc::JoystickButton m_dUp{&m_joy, 5}; + frc::JoystickButton m_dRight{&m_joy, 6}; + frc::JoystickButton m_dDown{&m_joy, 7}; + frc::JoystickButton m_dLeft{&m_joy, 8}; + frc::JoystickButton m_l2{&m_joy, 9}; + frc::JoystickButton m_r2{&m_joy, 10}; + frc::JoystickButton m_l1{&m_joy, 11}; + frc::JoystickButton m_r1{&m_joy, 12}; }; diff --git a/wpilibcExamples/src/main/cpp/examples/GearsBot/src/Robot.cpp b/wpilibcExamples/src/main/cpp/examples/GearsBot/src/Robot.cpp index bce1f717ee..7b93208eb7 100644 --- a/wpilibcExamples/src/main/cpp/examples/GearsBot/src/Robot.cpp +++ b/wpilibcExamples/src/main/cpp/examples/GearsBot/src/Robot.cpp @@ -16,34 +16,29 @@ Claw Robot::claw; OI Robot::oi; void Robot::RobotInit() { - // Show what command your subsystem is running on the SmartDashboard - frc::SmartDashboard::PutData(&drivetrain); - frc::SmartDashboard::PutData(&elevator); - frc::SmartDashboard::PutData(&wrist); - frc::SmartDashboard::PutData(&claw); + // Show what command your subsystem is running on the SmartDashboard + frc::SmartDashboard::PutData(&drivetrain); + frc::SmartDashboard::PutData(&elevator); + frc::SmartDashboard::PutData(&wrist); + frc::SmartDashboard::PutData(&claw); } void Robot::AutonomousInit() { - m_autonomousCommand.Start(); - std::cout << "Starting Auto" << std::endl; + m_autonomousCommand.Start(); + std::cout << "Starting Auto" << std::endl; } -void Robot::AutonomousPeriodic() { - frc::Scheduler::GetInstance()->Run(); -} +void Robot::AutonomousPeriodic() { frc::Scheduler::GetInstance()->Run(); } void Robot::TeleopInit() { - // This makes sure that the autonomous stops running when - // teleop starts running. If you want the autonomous to - // continue until interrupted by another command, remove - // this line or comment it out. - m_autonomousCommand.Cancel(); - std::cout << "Starting Teleop" << std::endl; + // This makes sure that the autonomous stops running when teleop starts + // running. If you want the autonomous to continue until interrupted by + // another command, remove this line or comment it out. + m_autonomousCommand.Cancel(); + std::cout << "Starting Teleop" << std::endl; } -void Robot::TeleopPeriodic() { - frc::Scheduler::GetInstance()->Run(); -} +void Robot::TeleopPeriodic() { frc::Scheduler::GetInstance()->Run(); } void Robot::TestPeriodic() {} diff --git a/wpilibcExamples/src/main/cpp/examples/GearsBot/src/Robot.h b/wpilibcExamples/src/main/cpp/examples/GearsBot/src/Robot.h index 65fd2e8bfb..a00009fe2e 100644 --- a/wpilibcExamples/src/main/cpp/examples/GearsBot/src/Robot.h +++ b/wpilibcExamples/src/main/cpp/examples/GearsBot/src/Robot.h @@ -21,21 +21,21 @@ #include "Subsystems/Wrist.h" class Robot : public frc::IterativeRobot { -public: - static DriveTrain drivetrain; - static Elevator elevator; - static Wrist wrist; - static Claw claw; - static OI oi; + public: + static DriveTrain drivetrain; + static Elevator elevator; + static Wrist wrist; + static Claw claw; + static OI oi; -private: - Autonomous m_autonomousCommand; - frc::LiveWindow& m_lw = *frc::LiveWindow::GetInstance(); + private: + Autonomous m_autonomousCommand; + frc::LiveWindow& m_lw = *frc::LiveWindow::GetInstance(); - void RobotInit() override; - void AutonomousInit() override; - void AutonomousPeriodic() override; - void TeleopInit() override; - void TeleopPeriodic() override; - void TestPeriodic() override; + void RobotInit() override; + void AutonomousInit() override; + void AutonomousPeriodic() override; + void TeleopInit() override; + void TeleopPeriodic() override; + void TestPeriodic() override; }; diff --git a/wpilibcExamples/src/main/cpp/examples/GearsBot/src/Subsystems/Claw.cpp b/wpilibcExamples/src/main/cpp/examples/GearsBot/src/Subsystems/Claw.cpp index 768d0d34c8..e5bc8d0e5b 100644 --- a/wpilibcExamples/src/main/cpp/examples/GearsBot/src/Subsystems/Claw.cpp +++ b/wpilibcExamples/src/main/cpp/examples/GearsBot/src/Subsystems/Claw.cpp @@ -7,28 +7,19 @@ #include "Claw.h" -Claw::Claw() - : frc::Subsystem("Claw") { - // Let's show everything on the LiveWindow - AddChild("Motor", m_motor); +Claw::Claw() : frc::Subsystem("Claw") { + // Let's show everything on the LiveWindow + AddChild("Motor", m_motor); } void Claw::InitDefaultCommand() {} -void Claw::Open() { - m_motor.Set(-1); -} +void Claw::Open() { m_motor.Set(-1); } -void Claw::Close() { - m_motor.Set(1); -} +void Claw::Close() { m_motor.Set(1); } -void Claw::Stop() { - m_motor.Set(0); -} +void Claw::Stop() { m_motor.Set(0); } -bool Claw::IsGripping() { - return m_contact.Get(); -} +bool Claw::IsGripping() { return m_contact.Get(); } void Claw::Log() {} diff --git a/wpilibcExamples/src/main/cpp/examples/GearsBot/src/Subsystems/Claw.h b/wpilibcExamples/src/main/cpp/examples/GearsBot/src/Subsystems/Claw.h index 6d4b2647cb..6f0c10adb8 100644 --- a/wpilibcExamples/src/main/cpp/examples/GearsBot/src/Subsystems/Claw.h +++ b/wpilibcExamples/src/main/cpp/examples/GearsBot/src/Subsystems/Claw.h @@ -17,35 +17,35 @@ * motors don't stall. */ class Claw : public frc::Subsystem { -public: - Claw(); + public: + Claw(); - void InitDefaultCommand() override; + void InitDefaultCommand() override; - /** - * Set the claw motor to move in the open direction. - */ - void Open(); + /** + * Set the claw motor to move in the open direction. + */ + void Open(); - /** - * Set the claw motor to move in the close direction. - */ - void Close(); + /** + * Set the claw motor to move in the close direction. + */ + void Close(); - /** - * Stops the claw motor from moving. - */ - void Stop(); + /** + * Stops the claw motor from moving. + */ + void Stop(); - /** - * Return true when the robot is grabbing an object hard enough - * to trigger the limit switch. - */ - bool IsGripping(); + /** + * Return true when the robot is grabbing an object hard enough + * to trigger the limit switch. + */ + bool IsGripping(); - void Log(); + void Log(); -private: - frc::Spark m_motor{7}; - frc::DigitalInput m_contact{5}; + private: + frc::Spark m_motor{7}; + frc::DigitalInput m_contact{5}; }; diff --git a/wpilibcExamples/src/main/cpp/examples/GearsBot/src/Subsystems/DriveTrain.cpp b/wpilibcExamples/src/main/cpp/examples/GearsBot/src/Subsystems/DriveTrain.cpp index a732782c19..8968d692b7 100644 --- a/wpilibcExamples/src/main/cpp/examples/GearsBot/src/Subsystems/DriveTrain.cpp +++ b/wpilibcExamples/src/main/cpp/examples/GearsBot/src/Subsystems/DriveTrain.cpp @@ -12,33 +12,32 @@ #include "../Commands/TankDriveWithJoystick.h" -DriveTrain::DriveTrain() - : frc::Subsystem("DriveTrain") { +DriveTrain::DriveTrain() : frc::Subsystem("DriveTrain") { // Encoders may measure differently in the real world and in // simulation. In this example the robot moves 0.042 barleycorns // per tick in the real world, but the simulated encoders // simulate 360 tick encoders. This if statement allows for the // real robot to handle this difference in devices. #ifndef SIMULATION - m_leftEncoder.SetDistancePerPulse(0.042); - m_rightEncoder.SetDistancePerPulse(0.042); + m_leftEncoder.SetDistancePerPulse(0.042); + m_rightEncoder.SetDistancePerPulse(0.042); #else - // Circumference in ft = 4in/12(in/ft)*PI - m_leftEncoder.SetDistancePerPulse( - static_cast(4.0 / 12.0 * M_PI) / 360.0); - m_rightEncoder.SetDistancePerPulse( - static_cast(4.0 / 12.0 * M_PI) / 360.0); + // Circumference in ft = 4in/12(in/ft)*PI + m_leftEncoder.SetDistancePerPulse(static_cast(4.0 / 12.0 * M_PI) / + 360.0); + m_rightEncoder.SetDistancePerPulse(static_cast(4.0 / 12.0 * M_PI) / + 360.0); #endif - // Let's show everything on the LiveWindow - // AddChild("Front_Left Motor", m_frontLeft); - // AddChild("Rear Left Motor", m_rearLeft); - // AddChild("Front Right Motor", m_frontRight); - // AddChild("Rear Right Motor", m_rearRight); - AddChild("Left Encoder", m_leftEncoder); - AddChild("Right Encoder", m_rightEncoder); - AddChild("Rangefinder", m_rangefinder); - AddChild("Gyro", m_gyro); + // Let's show everything on the LiveWindow + // AddChild("Front_Left Motor", m_frontLeft); + // AddChild("Rear Left Motor", m_rearLeft); + // AddChild("Front Right Motor", m_frontRight); + // AddChild("Rear Right Motor", m_rearRight); + AddChild("Left Encoder", m_leftEncoder); + AddChild("Right Encoder", m_rightEncoder); + AddChild("Rangefinder", m_rangefinder); + AddChild("Gyro", m_gyro); } /** @@ -46,42 +45,38 @@ DriveTrain::DriveTrain() * using the PS3 joystick. */ void DriveTrain::InitDefaultCommand() { - SetDefaultCommand(new TankDriveWithJoystick()); + SetDefaultCommand(new TankDriveWithJoystick()); } /** * The log method puts interesting information to the SmartDashboard. */ void DriveTrain::Log() { - frc::SmartDashboard::PutNumber( - "Left Distance", m_leftEncoder.GetDistance()); - frc::SmartDashboard::PutNumber( - "Right Distance", m_rightEncoder.GetDistance()); - frc::SmartDashboard::PutNumber("Left Speed", m_leftEncoder.GetRate()); - frc::SmartDashboard::PutNumber("Right Speed", m_rightEncoder.GetRate()); - frc::SmartDashboard::PutNumber("Gyro", m_gyro.GetAngle()); + frc::SmartDashboard::PutNumber("Left Distance", m_leftEncoder.GetDistance()); + frc::SmartDashboard::PutNumber("Right Distance", + m_rightEncoder.GetDistance()); + frc::SmartDashboard::PutNumber("Left Speed", m_leftEncoder.GetRate()); + frc::SmartDashboard::PutNumber("Right Speed", m_rightEncoder.GetRate()); + frc::SmartDashboard::PutNumber("Gyro", m_gyro.GetAngle()); } void DriveTrain::Drive(double left, double right) { - m_robotDrive.TankDrive(left, right); + m_robotDrive.TankDrive(left, right); } -double DriveTrain::GetHeading() { - return m_gyro.GetAngle(); -} +double DriveTrain::GetHeading() { return m_gyro.GetAngle(); } void DriveTrain::Reset() { - m_gyro.Reset(); - m_leftEncoder.Reset(); - m_rightEncoder.Reset(); + m_gyro.Reset(); + m_leftEncoder.Reset(); + m_rightEncoder.Reset(); } double DriveTrain::GetDistance() { - return (m_leftEncoder.GetDistance() + m_rightEncoder.GetDistance()) - / 2.0; + return (m_leftEncoder.GetDistance() + m_rightEncoder.GetDistance()) / 2.0; } double DriveTrain::GetDistanceToObstacle() { - // Really meters in simulation since it's a rangefinder... - return m_rangefinder.GetAverageVoltage(); + // Really meters in simulation since it's a rangefinder... + return m_rangefinder.GetAverageVoltage(); } diff --git a/wpilibcExamples/src/main/cpp/examples/GearsBot/src/Subsystems/DriveTrain.h b/wpilibcExamples/src/main/cpp/examples/GearsBot/src/Subsystems/DriveTrain.h index 9b02849255..9dec032a7b 100644 --- a/wpilibcExamples/src/main/cpp/examples/GearsBot/src/Subsystems/DriveTrain.h +++ b/wpilibcExamples/src/main/cpp/examples/GearsBot/src/Subsystems/DriveTrain.h @@ -25,60 +25,60 @@ class Joystick; * and a gyro. */ class DriveTrain : public frc::Subsystem { -public: - DriveTrain(); + public: + DriveTrain(); - /** - * When no other command is running let the operator drive around - * using the PS3 joystick. - */ - void InitDefaultCommand() override; + /** + * When no other command is running let the operator drive around + * using the PS3 joystick. + */ + void InitDefaultCommand() override; - /** - * The log method puts interesting information to the SmartDashboard. - */ - void Log(); + /** + * The log method puts interesting information to the SmartDashboard. + */ + void Log(); - /** - * Tank style driving for the DriveTrain. - * @param left Speed in range [-1,1] - * @param right Speed in range [-1,1] - */ - void Drive(double left, double right); + /** + * Tank style driving for the DriveTrain. + * @param left Speed in range [-1,1] + * @param right Speed in range [-1,1] + */ + void Drive(double left, double right); - /** - * @return The robots heading in degrees. - */ - double GetHeading(); + /** + * @return The robots heading in degrees. + */ + double GetHeading(); - /** - * Reset the robots sensors to the zero states. - */ - void Reset(); + /** + * Reset the robots sensors to the zero states. + */ + void Reset(); - /** - * @return The distance driven (average of left and right encoders). - */ - double GetDistance(); + /** + * @return The distance driven (average of left and right encoders). + */ + double GetDistance(); - /** - * @return The distance to the obstacle detected by the rangefinder. - */ - double GetDistanceToObstacle(); + /** + * @return The distance to the obstacle detected by the rangefinder. + */ + double GetDistanceToObstacle(); -private: - frc::Spark m_frontLeft{1}; - frc::Spark m_rearLeft{2}; - frc::SpeedControllerGroup m_left{m_frontLeft, m_rearLeft}; + private: + frc::Spark m_frontLeft{1}; + frc::Spark m_rearLeft{2}; + frc::SpeedControllerGroup m_left{m_frontLeft, m_rearLeft}; - frc::Spark m_frontRight{3}; - frc::Spark m_rearRight{4}; - frc::SpeedControllerGroup m_right{m_frontRight, m_rearRight}; + frc::Spark m_frontRight{3}; + frc::Spark m_rearRight{4}; + frc::SpeedControllerGroup m_right{m_frontRight, m_rearRight}; - frc::DifferentialDrive m_robotDrive{m_left, m_right}; + frc::DifferentialDrive m_robotDrive{m_left, m_right}; - frc::Encoder m_leftEncoder{1, 2}; - frc::Encoder m_rightEncoder{3, 4}; - frc::AnalogInput m_rangefinder{6}; - frc::AnalogGyro m_gyro{1}; + frc::Encoder m_leftEncoder{1, 2}; + frc::Encoder m_rightEncoder{3, 4}; + frc::AnalogInput m_rangefinder{6}; + frc::AnalogGyro m_gyro{1}; }; diff --git a/wpilibcExamples/src/main/cpp/examples/GearsBot/src/Subsystems/Elevator.cpp b/wpilibcExamples/src/main/cpp/examples/GearsBot/src/Subsystems/Elevator.cpp index 4ff59e3339..c0b09c65cd 100644 --- a/wpilibcExamples/src/main/cpp/examples/GearsBot/src/Subsystems/Elevator.cpp +++ b/wpilibcExamples/src/main/cpp/examples/GearsBot/src/Subsystems/Elevator.cpp @@ -10,28 +10,23 @@ #include #include -Elevator::Elevator() - : frc::PIDSubsystem("Elevator", kP_real, kI_real, 0.0) { +Elevator::Elevator() : frc::PIDSubsystem("Elevator", kP_real, kI_real, 0.0) { #ifdef SIMULATION // Check for simulation and update PID values - GetPIDController()->SetPID(kP_simulation, kI_simulation, 0, 0); + GetPIDController()->SetPID(kP_simulation, kI_simulation, 0, 0); #endif - SetAbsoluteTolerance(0.005); + SetAbsoluteTolerance(0.005); - // Let's show everything on the LiveWindow - AddChild("Motor", m_motor); - AddChild("Pot", &m_pot); + // Let's show everything on the LiveWindow + AddChild("Motor", m_motor); + AddChild("Pot", &m_pot); } void Elevator::InitDefaultCommand() {} void Elevator::Log() { - // frc::SmartDashboard::PutData("Wrist Pot", &m_pot); + // frc::SmartDashboard::PutData("Wrist Pot", &m_pot); } -double Elevator::ReturnPIDInput() { - return m_pot.Get(); -} +double Elevator::ReturnPIDInput() { return m_pot.Get(); } -void Elevator::UsePIDOutput(double d) { - m_motor.Set(d); -} +void Elevator::UsePIDOutput(double d) { m_motor.Set(d); } diff --git a/wpilibcExamples/src/main/cpp/examples/GearsBot/src/Subsystems/Elevator.h b/wpilibcExamples/src/main/cpp/examples/GearsBot/src/Subsystems/Elevator.h index 17675cf539..b42d78364f 100644 --- a/wpilibcExamples/src/main/cpp/examples/GearsBot/src/Subsystems/Elevator.h +++ b/wpilibcExamples/src/main/cpp/examples/GearsBot/src/Subsystems/Elevator.h @@ -18,42 +18,42 @@ * minor differences. */ class Elevator : public frc::PIDSubsystem { -public: - Elevator(); + public: + Elevator(); - void InitDefaultCommand() override; + void InitDefaultCommand() override; - /** - * The log method puts interesting information to the SmartDashboard. - */ - void Log(); + /** + * The log method puts interesting information to the SmartDashboard. + */ + void Log(); - /** - * Use the potentiometer as the PID sensor. This method is automatically - * called by the subsystem. - */ - double ReturnPIDInput() override; + /** + * Use the potentiometer as the PID sensor. This method is automatically + * called by the subsystem. + */ + double ReturnPIDInput() override; - /** - * Use the motor as the PID output. This method is automatically called - * by - * the subsystem. - */ - void UsePIDOutput(double d) override; + /** + * Use the motor as the PID output. This method is automatically called + * by + * the subsystem. + */ + void UsePIDOutput(double d) override; -private: - frc::Spark m_motor{5}; + private: + frc::Spark m_motor{5}; // Conversion value of potentiometer varies between the real world and // simulation #ifndef SIMULATION - frc::AnalogPotentiometer m_pot{2, -2.0 / 5}; + frc::AnalogPotentiometer m_pot{2, -2.0 / 5}; #else - frc::AnalogPotentiometer m_pot{2}; // Defaults to meters + frc::AnalogPotentiometer m_pot{2}; // Defaults to meters #endif - static constexpr double kP_real = 4; - static constexpr double kI_real = 0.07; - static constexpr double kP_simulation = 18; - static constexpr double kI_simulation = 0.2; + static constexpr double kP_real = 4; + static constexpr double kI_real = 0.07; + static constexpr double kP_simulation = 18; + static constexpr double kI_simulation = 0.2; }; diff --git a/wpilibcExamples/src/main/cpp/examples/GearsBot/src/Subsystems/Wrist.cpp b/wpilibcExamples/src/main/cpp/examples/GearsBot/src/Subsystems/Wrist.cpp index b1be1dcfde..a364bc2220 100644 --- a/wpilibcExamples/src/main/cpp/examples/GearsBot/src/Subsystems/Wrist.cpp +++ b/wpilibcExamples/src/main/cpp/examples/GearsBot/src/Subsystems/Wrist.cpp @@ -9,28 +9,23 @@ #include -Wrist::Wrist() - : frc::PIDSubsystem("Wrist", kP_real, 0.0, 0.0) { +Wrist::Wrist() : frc::PIDSubsystem("Wrist", kP_real, 0.0, 0.0) { #ifdef SIMULATION // Check for simulation and update PID values - GetPIDController()->SetPID(kP_simulation, 0, 0, 0); + GetPIDController()->SetPID(kP_simulation, 0, 0, 0); #endif - SetAbsoluteTolerance(2.5); + SetAbsoluteTolerance(2.5); - // Let's show everything on the LiveWindow - AddChild("Motor", m_motor); - AddChild("Pot", m_pot); + // Let's show everything on the LiveWindow + AddChild("Motor", m_motor); + AddChild("Pot", m_pot); } void Wrist::InitDefaultCommand() {} void Wrist::Log() { - // frc::SmartDashboard::PutData("Wrist Angle", &m_pot); + // frc::SmartDashboard::PutData("Wrist Angle", &m_pot); } -double Wrist::ReturnPIDInput() { - return m_pot.Get(); -} +double Wrist::ReturnPIDInput() { return m_pot.Get(); } -void Wrist::UsePIDOutput(double d) { - m_motor.Set(d); -} +void Wrist::UsePIDOutput(double d) { m_motor.Set(d); } diff --git a/wpilibcExamples/src/main/cpp/examples/GearsBot/src/Subsystems/Wrist.h b/wpilibcExamples/src/main/cpp/examples/GearsBot/src/Subsystems/Wrist.h index 2cd5a64a88..5b65297f0d 100644 --- a/wpilibcExamples/src/main/cpp/examples/GearsBot/src/Subsystems/Wrist.h +++ b/wpilibcExamples/src/main/cpp/examples/GearsBot/src/Subsystems/Wrist.h @@ -16,40 +16,40 @@ * of a linear joint. */ class Wrist : public PIDSubsystem { -public: - Wrist(); + public: + Wrist(); - void InitDefaultCommand() override; + void InitDefaultCommand() override; - /** - * The log method puts interesting information to the SmartDashboard. - */ - void Log(); + /** + * The log method puts interesting information to the SmartDashboard. + */ + void Log(); - /** - * Use the potentiometer as the PID sensor. This method is automatically - * called by the subsystem. - */ - double ReturnPIDInput() override; + /** + * Use the potentiometer as the PID sensor. This method is automatically + * called by the subsystem. + */ + double ReturnPIDInput() override; - /** - * Use the motor as the PID output. This method is automatically called - * by - * the subsystem. - */ - void UsePIDOutput(double d) override; + /** + * Use the motor as the PID output. This method is automatically called + * by + * the subsystem. + */ + void UsePIDOutput(double d) override; -private: - frc::Spark m_motor{6}; + private: + frc::Spark m_motor{6}; // Conversion value of potentiometer varies between the real world and // simulation #ifndef SIMULATION - frc::AnalogPotentiometer m_pot{3, -270.0 / 5}; + frc::AnalogPotentiometer m_pot{3, -270.0 / 5}; #else - frc::AnalogPotentiometer m_pot{3}; // Defaults to degrees + frc::AnalogPotentiometer m_pot{3}; // Defaults to degrees #endif - static constexpr double kP_real = 1; - static constexpr double kP_simulation = 0.05; + static constexpr double kP_real = 1; + static constexpr double kP_simulation = 0.05; }; diff --git a/wpilibcExamples/src/main/cpp/examples/GettingStarted/src/Robot.cpp b/wpilibcExamples/src/main/cpp/examples/GettingStarted/src/Robot.cpp index e0bebe5a9a..1c519b64ab 100644 --- a/wpilibcExamples/src/main/cpp/examples/GettingStarted/src/Robot.cpp +++ b/wpilibcExamples/src/main/cpp/examples/GettingStarted/src/Robot.cpp @@ -13,46 +13,46 @@ #include class Robot : public frc::IterativeRobot { -public: - Robot() { - m_robotDrive.SetExpiration(0.1); - m_timer.Start(); - } + public: + Robot() { + m_robotDrive.SetExpiration(0.1); + m_timer.Start(); + } - void AutonomousInit() override { - m_timer.Reset(); - m_timer.Start(); - } + void AutonomousInit() override { + m_timer.Reset(); + m_timer.Start(); + } - void AutonomousPeriodic() override { - // Drive for 2 seconds - if (m_timer.Get() < 2.0) { - // Drive forwards half speed - m_robotDrive.ArcadeDrive(-0.5, 0.0); - } else { - // Stop robot - m_robotDrive.ArcadeDrive(0.0, 0.0); - } - } + void AutonomousPeriodic() override { + // Drive for 2 seconds + if (m_timer.Get() < 2.0) { + // Drive forwards half speed + m_robotDrive.ArcadeDrive(-0.5, 0.0); + } else { + // Stop robot + m_robotDrive.ArcadeDrive(0.0, 0.0); + } + } - void TeleopInit() override {} + void TeleopInit() override {} - void TeleopPeriodic() override { - // Drive with arcade style (use right stick) - m_robotDrive.ArcadeDrive(m_stick.GetY(), m_stick.GetX()); - } + void TeleopPeriodic() override { + // Drive with arcade style (use right stick) + m_robotDrive.ArcadeDrive(m_stick.GetY(), m_stick.GetX()); + } - void TestPeriodic() override {} + void TestPeriodic() override {} -private: - // Robot drive system - frc::Spark m_left{0}; - frc::Spark m_right{1}; - frc::DifferentialDrive m_robotDrive{m_left, m_right}; + private: + // Robot drive system + frc::Spark m_left{0}; + frc::Spark m_right{1}; + frc::DifferentialDrive m_robotDrive{m_left, m_right}; - frc::Joystick m_stick{0}; - frc::LiveWindow& m_lw = *frc::LiveWindow::GetInstance(); - frc::Timer m_timer; + frc::Joystick m_stick{0}; + frc::LiveWindow& m_lw = *frc::LiveWindow::GetInstance(); + frc::Timer m_timer; }; START_ROBOT_CLASS(Robot) diff --git a/wpilibcExamples/src/main/cpp/examples/Gyro/src/Robot.cpp b/wpilibcExamples/src/main/cpp/examples/Gyro/src/Robot.cpp index b67ea86f06..e417841af0 100644 --- a/wpilibcExamples/src/main/cpp/examples/Gyro/src/Robot.cpp +++ b/wpilibcExamples/src/main/cpp/examples/Gyro/src/Robot.cpp @@ -19,42 +19,40 @@ * backwards while the gyro is used for direction keeping. */ class Robot : public frc::IterativeRobot { -public: - void RobotInit() override { - m_gyro.SetSensitivity(kVoltsPerDegreePerSecond); - } + public: + void RobotInit() override { m_gyro.SetSensitivity(kVoltsPerDegreePerSecond); } - /** - * The motor speed is set from the joystick while the DifferentialDrive - * turning value is assigned from the error between the setpoint and the - * gyro angle. - */ - void TeleopPeriodic() override { - double turningValue = (kAngleSetpoint - m_gyro.GetAngle()) * kP; - // Invert the direction of the turn if we are going backwards - turningValue = std::copysign(turningValue, m_joystick.GetY()); - m_robotDrive.ArcadeDrive(m_joystick.GetY(), turningValue); - } + /** + * The motor speed is set from the joystick while the DifferentialDrive + * turning value is assigned from the error between the setpoint and the gyro + * angle. + */ + void TeleopPeriodic() override { + double turningValue = (kAngleSetpoint - m_gyro.GetAngle()) * kP; + // Invert the direction of the turn if we are going backwards + turningValue = std::copysign(turningValue, m_joystick.GetY()); + m_robotDrive.ArcadeDrive(m_joystick.GetY(), turningValue); + } -private: - static constexpr double kAngleSetpoint = 0.0; - static constexpr double kP = 0.005; // Proportional turning constant + private: + static constexpr double kAngleSetpoint = 0.0; + static constexpr double kP = 0.005; // Proportional turning constant - // Gyro calibration constant, may need to be adjusted - // Gyro value of 360 is set to correspond to one full revolution - static constexpr double kVoltsPerDegreePerSecond = 0.0128; + // Gyro calibration constant, may need to be adjusted. Gyro value of 360 is + // set to correspond to one full revolution. + static constexpr double kVoltsPerDegreePerSecond = 0.0128; - static constexpr int kLeftMotorPort = 0; - static constexpr int kRightMotorPort = 1; - static constexpr int kGyroPort = 0; - static constexpr int kJoystickPort = 0; + static constexpr int kLeftMotorPort = 0; + static constexpr int kRightMotorPort = 1; + static constexpr int kGyroPort = 0; + static constexpr int kJoystickPort = 0; - frc::Spark m_left{kLeftMotorPort}; - frc::Spark m_right{kRightMotorPort}; - frc::DifferentialDrive m_robotDrive{m_left, m_right}; + frc::Spark m_left{kLeftMotorPort}; + frc::Spark m_right{kRightMotorPort}; + frc::DifferentialDrive m_robotDrive{m_left, m_right}; - frc::AnalogGyro m_gyro{kGyroPort}; - frc::Joystick m_joystick{kJoystickPort}; + frc::AnalogGyro m_gyro{kGyroPort}; + frc::Joystick m_joystick{kJoystickPort}; }; START_ROBOT_CLASS(Robot) diff --git a/wpilibcExamples/src/main/cpp/examples/GyroMecanum/src/Robot.cpp b/wpilibcExamples/src/main/cpp/examples/GyroMecanum/src/Robot.cpp index 47ae63ade2..b19f768b37 100644 --- a/wpilibcExamples/src/main/cpp/examples/GyroMecanum/src/Robot.cpp +++ b/wpilibcExamples/src/main/cpp/examples/GyroMecanum/src/Robot.cpp @@ -17,46 +17,45 @@ * (field-oriented controls). */ class Robot : public frc::IterativeRobot { -public: - void RobotInit() override { - // invert the left side motors - // you may need to change or remove this to match your robot - m_frontLeft.SetInverted(true); - m_rearLeft.SetInverted(true); + public: + void RobotInit() override { + // Invert the left side motors. You may need to change or remove this to + // match your robot. + m_frontLeft.SetInverted(true); + m_rearLeft.SetInverted(true); - m_gyro.SetSensitivity(kVoltsPerDegreePerSecond); - } + m_gyro.SetSensitivity(kVoltsPerDegreePerSecond); + } - /** - * Mecanum drive is used with the gyro angle as an input. - */ - void TeleopPeriodic() override { - m_robotDrive.DriveCartesian(m_joystick.GetX(), - m_joystick.GetY(), m_joystick.GetZ(), - m_gyro.GetAngle()); - } + /** + * Mecanum drive is used with the gyro angle as an input. + */ + void TeleopPeriodic() override { + m_robotDrive.DriveCartesian(m_joystick.GetX(), m_joystick.GetY(), + m_joystick.GetZ(), m_gyro.GetAngle()); + } -private: - // Gyro calibration constant, may need to be adjusted - // Gyro value of 360 is set to correspond to one full revolution - static constexpr double kVoltsPerDegreePerSecond = 0.0128; + private: + // Gyro calibration constant, may need to be adjusted. Gyro value of 360 is + // set to correspond to one full revolution. + static constexpr double kVoltsPerDegreePerSecond = 0.0128; - static constexpr int kFrontLeftMotorPort = 0; - static constexpr int kRearLeftMotorPort = 1; - static constexpr int kFrontRightMotorPort = 2; - static constexpr int kRearRightMotorPort = 3; - static constexpr int kGyroPort = 0; - static constexpr int kJoystickPort = 0; + static constexpr int kFrontLeftMotorPort = 0; + static constexpr int kRearLeftMotorPort = 1; + static constexpr int kFrontRightMotorPort = 2; + static constexpr int kRearRightMotorPort = 3; + static constexpr int kGyroPort = 0; + static constexpr int kJoystickPort = 0; - frc::Spark m_frontLeft{kFrontLeftMotorPort}; - frc::Spark m_rearLeft{kRearLeftMotorPort}; - frc::Spark m_frontRight{kFrontRightMotorPort}; - frc::Spark m_rearRight{kRearRightMotorPort}; - frc::MecanumDrive m_robotDrive{ - m_frontLeft, m_rearLeft, m_frontRight, m_rearRight}; + frc::Spark m_frontLeft{kFrontLeftMotorPort}; + frc::Spark m_rearLeft{kRearLeftMotorPort}; + frc::Spark m_frontRight{kFrontRightMotorPort}; + frc::Spark m_rearRight{kRearRightMotorPort}; + frc::MecanumDrive m_robotDrive{m_frontLeft, m_rearLeft, m_frontRight, + m_rearRight}; - frc::AnalogGyro m_gyro{kGyroPort}; - frc::Joystick m_joystick{kJoystickPort}; + frc::AnalogGyro m_gyro{kGyroPort}; + frc::Joystick m_joystick{kJoystickPort}; }; START_ROBOT_CLASS(Robot) diff --git a/wpilibcExamples/src/main/cpp/examples/IntermediateVision/src/Robot.cpp b/wpilibcExamples/src/main/cpp/examples/IntermediateVision/src/Robot.cpp index 2e920568d0..13ac1511e2 100644 --- a/wpilibcExamples/src/main/cpp/examples/IntermediateVision/src/Robot.cpp +++ b/wpilibcExamples/src/main/cpp/examples/IntermediateVision/src/Robot.cpp @@ -17,62 +17,59 @@ /** * This is a demo program showing the use of OpenCV to do vision processing. The * image is acquired from the USB camera, then a rectangle is put on the image - * and - * sent to the dashboard. OpenCV has many methods for different types of + * and sent to the dashboard. OpenCV has many methods for different types of * processing. */ class Robot : public frc::IterativeRobot { #if defined(__linux__) -private: - static void VisionThread() { - // Get the USB camera from CameraServer - cs::UsbCamera camera = - CameraServer::GetInstance() - ->StartAutomaticCapture(); - // Set the resolution - camera.SetResolution(640, 480); - // Get a CvSink. This will capture Mats from the Camera - cs::CvSink cvSink = CameraServer::GetInstance()->GetVideo(); - // Setup a CvSource. This will send images back to the Dashboard - cs::CvSource outputStream = - CameraServer::GetInstance()->PutVideo( - "Rectangle", 640, 480); + private: + static void VisionThread() { + // Get the USB camera from CameraServer + cs::UsbCamera camera = CameraServer::GetInstance()->StartAutomaticCapture(); + // Set the resolution + camera.SetResolution(640, 480); - // Mats are very memory expensive. Lets reuse this Mat. - cv::Mat mat; + // Get a CvSink. This will capture Mats from the Camera + cs::CvSink cvSink = CameraServer::GetInstance()->GetVideo(); + // Setup a CvSource. This will send images back to the Dashboard + cs::CvSource outputStream = + CameraServer::GetInstance()->PutVideo("Rectangle", 640, 480); - while (true) { - // Tell the CvSink to grab a frame from the camera and - // put it - // in the source mat. If there is an error notify the - // output. - if (cvSink.GrabFrame(mat) == 0) { - // Send the output the error. - outputStream.NotifyError(cvSink.GetError()); - // skip the rest of the current iteration - continue; - } - // Put a rectangle on the image - rectangle(mat, cv::Point(100, 100), cv::Point(400, 400), - cv::Scalar(255, 255, 255), 5); - // Give the output stream a new image to display - outputStream.PutFrame(mat); - } - } + // Mats are very memory expensive. Lets reuse this Mat. + cv::Mat mat; + + while (true) { + // Tell the CvSink to grab a frame from the camera and + // put it + // in the source mat. If there is an error notify the + // output. + if (cvSink.GrabFrame(mat) == 0) { + // Send the output the error. + outputStream.NotifyError(cvSink.GetError()); + // skip the rest of the current iteration + continue; + } + // Put a rectangle on the image + rectangle(mat, cv::Point(100, 100), cv::Point(400, 400), + cv::Scalar(255, 255, 255), 5); + // Give the output stream a new image to display + outputStream.PutFrame(mat); + } + } #endif - void RobotInit() override { - // We need to run our vision program in a separate Thread. - // If not, our robot program will not run + void RobotInit() override { + // We need to run our vision program in a separate thread. If not, our robot + // program will not run. #if defined(__linux__) - std::thread visionThread(VisionThread); - visionThread.detach(); + std::thread visionThread(VisionThread); + visionThread.detach(); #else - wpi::errs() << "Vision only available on Linux.\n"; - wpi::errs().flush(); + wpi::errs() << "Vision only available on Linux.\n"; + wpi::errs().flush(); #endif - } + } }; START_ROBOT_CLASS(Robot) diff --git a/wpilibcExamples/src/main/cpp/examples/MecanumDrive/src/Robot.cpp b/wpilibcExamples/src/main/cpp/examples/MecanumDrive/src/Robot.cpp index b1e4b857c8..6d93ecdddc 100644 --- a/wpilibcExamples/src/main/cpp/examples/MecanumDrive/src/Robot.cpp +++ b/wpilibcExamples/src/main/cpp/examples/MecanumDrive/src/Robot.cpp @@ -15,39 +15,37 @@ * MecanumDrive class. */ class Robot : public frc::IterativeRobot { -public: - void RobotInit() override { - // Invert the left side motors - // You may need to change or remove this to match your robot - m_frontLeft.SetInverted(true); - m_rearLeft.SetInverted(true); - } + public: + void RobotInit() override { + // Invert the left side motors. You may need to change or remove this to + // match your robot. + m_frontLeft.SetInverted(true); + m_rearLeft.SetInverted(true); + } - void TeleopPeriodic() override { - /* Use the joystick X axis for lateral movement, Y axis for - * forward - * movement, and Z axis for rotation. - */ - m_robotDrive.DriveCartesian( - m_stick.GetX(), m_stick.GetY(), m_stick.GetZ()); - } + void TeleopPeriodic() override { + /* Use the joystick X axis for lateral movement, Y axis for forward + * movement, and Z axis for rotation. + */ + m_robotDrive.DriveCartesian(m_stick.GetX(), m_stick.GetY(), m_stick.GetZ()); + } -private: - static constexpr int kFrontLeftChannel = 0; - static constexpr int kRearLeftChannel = 1; - static constexpr int kFrontRightChannel = 2; - static constexpr int kRearRightChannel = 3; + private: + static constexpr int kFrontLeftChannel = 0; + static constexpr int kRearLeftChannel = 1; + static constexpr int kFrontRightChannel = 2; + static constexpr int kRearRightChannel = 3; - static constexpr int kJoystickChannel = 0; + static constexpr int kJoystickChannel = 0; - frc::Spark m_frontLeft{kFrontLeftChannel}; - frc::Spark m_rearLeft{kRearLeftChannel}; - frc::Spark m_frontRight{kFrontRightChannel}; - frc::Spark m_rearRight{kRearRightChannel}; - frc::MecanumDrive m_robotDrive{ - m_frontLeft, m_rearLeft, m_frontRight, m_rearRight}; + frc::Spark m_frontLeft{kFrontLeftChannel}; + frc::Spark m_rearLeft{kRearLeftChannel}; + frc::Spark m_frontRight{kFrontRightChannel}; + frc::Spark m_rearRight{kRearRightChannel}; + frc::MecanumDrive m_robotDrive{m_frontLeft, m_rearLeft, m_frontRight, + m_rearRight}; - frc::Joystick m_stick{kJoystickChannel}; + frc::Joystick m_stick{kJoystickChannel}; }; START_ROBOT_CLASS(Robot) diff --git a/wpilibcExamples/src/main/cpp/examples/MotorControl/src/Robot.cpp b/wpilibcExamples/src/main/cpp/examples/MotorControl/src/Robot.cpp index 7247fae89d..a376cef00a 100644 --- a/wpilibcExamples/src/main/cpp/examples/MotorControl/src/Robot.cpp +++ b/wpilibcExamples/src/main/cpp/examples/MotorControl/src/Robot.cpp @@ -18,12 +18,12 @@ * range from -1 to 1 making it easy to work together. */ class Robot : public frc::IterativeRobot { -public: - void TeleopPeriodic() override { m_motor.Set(m_stick.GetY()); } + public: + void TeleopPeriodic() override { m_motor.Set(m_stick.GetY()); } -private: - frc::Joystick m_stick{0}; - frc::Spark m_motor{0}; + private: + frc::Joystick m_stick{0}; + frc::Spark m_motor{0}; }; START_ROBOT_CLASS(Robot) diff --git a/wpilibcExamples/src/main/cpp/examples/PacGoat/src/Commands/CheckForHotGoal.cpp b/wpilibcExamples/src/main/cpp/examples/PacGoat/src/Commands/CheckForHotGoal.cpp index 54fd2492bf..d23a66f0c0 100644 --- a/wpilibcExamples/src/main/cpp/examples/PacGoat/src/Commands/CheckForHotGoal.cpp +++ b/wpilibcExamples/src/main/cpp/examples/PacGoat/src/Commands/CheckForHotGoal.cpp @@ -9,11 +9,9 @@ #include "../Robot.h" -CheckForHotGoal::CheckForHotGoal(double time) { - SetTimeout(time); -} +CheckForHotGoal::CheckForHotGoal(double time) { SetTimeout(time); } // Make this return true when this Command no longer needs to run execute() bool CheckForHotGoal::IsFinished() { - return IsTimedOut() || Robot::shooter.GoalIsHot(); + return IsTimedOut() || Robot::shooter.GoalIsHot(); } diff --git a/wpilibcExamples/src/main/cpp/examples/PacGoat/src/Commands/CheckForHotGoal.h b/wpilibcExamples/src/main/cpp/examples/PacGoat/src/Commands/CheckForHotGoal.h index 7f679906ee..2a663f6a78 100644 --- a/wpilibcExamples/src/main/cpp/examples/PacGoat/src/Commands/CheckForHotGoal.h +++ b/wpilibcExamples/src/main/cpp/examples/PacGoat/src/Commands/CheckForHotGoal.h @@ -16,7 +16,7 @@ * the hot goal is detected or until it is timed out. */ class CheckForHotGoal : public frc::Command { -public: - explicit CheckForHotGoal(double time); - bool IsFinished() override; + public: + explicit CheckForHotGoal(double time); + bool IsFinished() override; }; diff --git a/wpilibcExamples/src/main/cpp/examples/PacGoat/src/Commands/CloseClaw.cpp b/wpilibcExamples/src/main/cpp/examples/PacGoat/src/Commands/CloseClaw.cpp index 8305521f5a..256e3273d8 100644 --- a/wpilibcExamples/src/main/cpp/examples/PacGoat/src/Commands/CloseClaw.cpp +++ b/wpilibcExamples/src/main/cpp/examples/PacGoat/src/Commands/CloseClaw.cpp @@ -9,11 +9,7 @@ #include "../Robot.h" -CloseClaw::CloseClaw() { - Requires(&Robot::collector); -} +CloseClaw::CloseClaw() { Requires(&Robot::collector); } // Called just before this Command runs the first time -void CloseClaw::Initialize() { - Robot::collector.Close(); -} +void CloseClaw::Initialize() { Robot::collector.Close(); } diff --git a/wpilibcExamples/src/main/cpp/examples/PacGoat/src/Commands/CloseClaw.h b/wpilibcExamples/src/main/cpp/examples/PacGoat/src/Commands/CloseClaw.h index 0e3edace92..88c1fe3be0 100644 --- a/wpilibcExamples/src/main/cpp/examples/PacGoat/src/Commands/CloseClaw.h +++ b/wpilibcExamples/src/main/cpp/examples/PacGoat/src/Commands/CloseClaw.h @@ -16,7 +16,7 @@ * detect that. */ class CloseClaw : public frc::InstantCommand { -public: - CloseClaw(); - void Initialize() override; + public: + CloseClaw(); + void Initialize() override; }; diff --git a/wpilibcExamples/src/main/cpp/examples/PacGoat/src/Commands/Collect.cpp b/wpilibcExamples/src/main/cpp/examples/PacGoat/src/Commands/Collect.cpp index 1c22657a51..a8db134cd7 100644 --- a/wpilibcExamples/src/main/cpp/examples/PacGoat/src/Commands/Collect.cpp +++ b/wpilibcExamples/src/main/cpp/examples/PacGoat/src/Commands/Collect.cpp @@ -14,8 +14,8 @@ #include "WaitForBall.h" Collect::Collect() { - AddSequential(new SetCollectionSpeed(Collector::kForward)); - AddParallel(new CloseClaw()); - AddSequential(new SetPivotSetpoint(Pivot::kCollect)); - AddSequential(new WaitForBall()); + AddSequential(new SetCollectionSpeed(Collector::kForward)); + AddParallel(new CloseClaw()); + AddSequential(new SetPivotSetpoint(Pivot::kCollect)); + AddSequential(new WaitForBall()); } diff --git a/wpilibcExamples/src/main/cpp/examples/PacGoat/src/Commands/Collect.h b/wpilibcExamples/src/main/cpp/examples/PacGoat/src/Commands/Collect.h index 496a65fa36..f75b1df3b9 100644 --- a/wpilibcExamples/src/main/cpp/examples/PacGoat/src/Commands/Collect.h +++ b/wpilibcExamples/src/main/cpp/examples/PacGoat/src/Commands/Collect.h @@ -13,6 +13,6 @@ * Get the robot set to collect balls. */ class Collect : public frc::CommandGroup { -public: - Collect(); + public: + Collect(); }; diff --git a/wpilibcExamples/src/main/cpp/examples/PacGoat/src/Commands/DriveAndShootAutonomous.cpp b/wpilibcExamples/src/main/cpp/examples/PacGoat/src/Commands/DriveAndShootAutonomous.cpp index 2b9341b2b5..15edb0d983 100644 --- a/wpilibcExamples/src/main/cpp/examples/PacGoat/src/Commands/DriveAndShootAutonomous.cpp +++ b/wpilibcExamples/src/main/cpp/examples/PacGoat/src/Commands/DriveAndShootAutonomous.cpp @@ -16,13 +16,13 @@ #include "WaitForPressure.h" DriveAndShootAutonomous::DriveAndShootAutonomous() { - AddSequential(new CloseClaw()); - AddSequential(new WaitForPressure(), 2); + AddSequential(new CloseClaw()); + AddSequential(new WaitForPressure(), 2); #ifndef SIMULATION - // NOTE: Simulation doesn't currently have the concept of hot. - AddSequential(new CheckForHotGoal(2)); + // NOTE: Simulation doesn't currently have the concept of hot. + AddSequential(new CheckForHotGoal(2)); #endif - AddSequential(new SetPivotSetpoint(45)); - AddSequential(new DriveForward(8, 0.3)); - AddSequential(new Shoot()); + AddSequential(new SetPivotSetpoint(45)); + AddSequential(new DriveForward(8, 0.3)); + AddSequential(new Shoot()); } diff --git a/wpilibcExamples/src/main/cpp/examples/PacGoat/src/Commands/DriveAndShootAutonomous.h b/wpilibcExamples/src/main/cpp/examples/PacGoat/src/Commands/DriveAndShootAutonomous.h index 0df3975252..2d0adfd18d 100644 --- a/wpilibcExamples/src/main/cpp/examples/PacGoat/src/Commands/DriveAndShootAutonomous.h +++ b/wpilibcExamples/src/main/cpp/examples/PacGoat/src/Commands/DriveAndShootAutonomous.h @@ -14,6 +14,6 @@ * it will wait briefly. */ class DriveAndShootAutonomous : public frc::CommandGroup { -public: - DriveAndShootAutonomous(); + public: + DriveAndShootAutonomous(); }; diff --git a/wpilibcExamples/src/main/cpp/examples/PacGoat/src/Commands/DriveForward.cpp b/wpilibcExamples/src/main/cpp/examples/PacGoat/src/Commands/DriveForward.cpp index a0d4442d66..fbd520b618 100644 --- a/wpilibcExamples/src/main/cpp/examples/PacGoat/src/Commands/DriveForward.cpp +++ b/wpilibcExamples/src/main/cpp/examples/PacGoat/src/Commands/DriveForward.cpp @@ -12,48 +12,40 @@ #include "../Robot.h" void DriveForward::init(double dist, double maxSpeed) { - Requires(&Robot::drivetrain); - m_distance = dist; - m_driveForwardSpeed = maxSpeed; + Requires(&Robot::drivetrain); + m_distance = dist; + m_driveForwardSpeed = maxSpeed; } -DriveForward::DriveForward() { - init(10, 0.5); -} +DriveForward::DriveForward() { init(10, 0.5); } -DriveForward::DriveForward(double dist) { - init(dist, 0.5); -} +DriveForward::DriveForward(double dist) { init(dist, 0.5); } DriveForward::DriveForward(double dist, double maxSpeed) { - init(dist, maxSpeed); + init(dist, maxSpeed); } // Called just before this Command runs the first time void DriveForward::Initialize() { - Robot::drivetrain.GetRightEncoder().Reset(); - SetTimeout(2); + Robot::drivetrain.GetRightEncoder().Reset(); + SetTimeout(2); } // Called repeatedly when this Command is scheduled to run void DriveForward::Execute() { - m_error = (m_distance - - Robot::drivetrain.GetRightEncoder().GetDistance()); - if (m_driveForwardSpeed * kP * m_error >= m_driveForwardSpeed) { - Robot::drivetrain.TankDrive( - m_driveForwardSpeed, m_driveForwardSpeed); - } else { - Robot::drivetrain.TankDrive(m_driveForwardSpeed * kP * m_error, - m_driveForwardSpeed * kP * m_error); - } + m_error = (m_distance - Robot::drivetrain.GetRightEncoder().GetDistance()); + if (m_driveForwardSpeed * kP * m_error >= m_driveForwardSpeed) { + Robot::drivetrain.TankDrive(m_driveForwardSpeed, m_driveForwardSpeed); + } else { + Robot::drivetrain.TankDrive(m_driveForwardSpeed * kP * m_error, + m_driveForwardSpeed * kP * m_error); + } } // Make this return true when this Command no longer needs to run execute() bool DriveForward::IsFinished() { - return (std::fabs(m_error) <= kTolerance) || IsTimedOut(); + return (std::fabs(m_error) <= kTolerance) || IsTimedOut(); } // Called once after isFinished returns true -void DriveForward::End() { - Robot::drivetrain.Stop(); -} +void DriveForward::End() { Robot::drivetrain.Stop(); } diff --git a/wpilibcExamples/src/main/cpp/examples/PacGoat/src/Commands/DriveForward.h b/wpilibcExamples/src/main/cpp/examples/PacGoat/src/Commands/DriveForward.h index 248c8656fa..4e1830071b 100644 --- a/wpilibcExamples/src/main/cpp/examples/PacGoat/src/Commands/DriveForward.h +++ b/wpilibcExamples/src/main/cpp/examples/PacGoat/src/Commands/DriveForward.h @@ -14,21 +14,21 @@ * control This command will drive a given distance limiting to a maximum speed. */ class DriveForward : public frc::Command { -public: - DriveForward(); - explicit DriveForward(double dist); - DriveForward(double dist, double maxSpeed); - void Initialize() override; - void Execute() override; - bool IsFinished() override; - void End() override; + public: + DriveForward(); + explicit DriveForward(double dist); + DriveForward(double dist, double maxSpeed); + void Initialize() override; + void Execute() override; + bool IsFinished() override; + void End() override; -private: - double m_driveForwardSpeed; - double m_distance; - double m_error = 0; - static constexpr double kTolerance = 0.1; - static constexpr double kP = -1.0 / 5.0; + private: + double m_driveForwardSpeed; + double m_distance; + double m_error = 0; + static constexpr double kTolerance = 0.1; + static constexpr double kP = -1.0 / 5.0; - void init(double dist, double maxSpeed); + void init(double dist, double maxSpeed); }; diff --git a/wpilibcExamples/src/main/cpp/examples/PacGoat/src/Commands/DriveWithJoystick.cpp b/wpilibcExamples/src/main/cpp/examples/PacGoat/src/Commands/DriveWithJoystick.cpp index f07e129580..e0eb67182d 100644 --- a/wpilibcExamples/src/main/cpp/examples/PacGoat/src/Commands/DriveWithJoystick.cpp +++ b/wpilibcExamples/src/main/cpp/examples/PacGoat/src/Commands/DriveWithJoystick.cpp @@ -9,22 +9,16 @@ #include "../Robot.h" -DriveWithJoystick::DriveWithJoystick() { - Requires(&Robot::drivetrain); -} +DriveWithJoystick::DriveWithJoystick() { Requires(&Robot::drivetrain); } // Called repeatedly when this Command is scheduled to run void DriveWithJoystick::Execute() { - auto& joystick = Robot::oi.GetJoystick(); - Robot::drivetrain.TankDrive(joystick.GetY(), joystick.GetRawAxis(4)); + auto& joystick = Robot::oi.GetJoystick(); + Robot::drivetrain.TankDrive(joystick.GetY(), joystick.GetRawAxis(4)); } // Make this return true when this Command no longer needs to run execute() -bool DriveWithJoystick::IsFinished() { - return false; -} +bool DriveWithJoystick::IsFinished() { return false; } // Called once after isFinished returns true -void DriveWithJoystick::End() { - Robot::drivetrain.Stop(); -} +void DriveWithJoystick::End() { Robot::drivetrain.Stop(); } diff --git a/wpilibcExamples/src/main/cpp/examples/PacGoat/src/Commands/DriveWithJoystick.h b/wpilibcExamples/src/main/cpp/examples/PacGoat/src/Commands/DriveWithJoystick.h index 79ae75f829..4cd5e9a449 100644 --- a/wpilibcExamples/src/main/cpp/examples/PacGoat/src/Commands/DriveWithJoystick.h +++ b/wpilibcExamples/src/main/cpp/examples/PacGoat/src/Commands/DriveWithJoystick.h @@ -14,9 +14,9 @@ * except when interrupted by another command. */ class DriveWithJoystick : public frc::Command { -public: - DriveWithJoystick(); - void Execute() override; - bool IsFinished() override; - void End() override; + public: + DriveWithJoystick(); + void Execute() override; + bool IsFinished() override; + void End() override; }; diff --git a/wpilibcExamples/src/main/cpp/examples/PacGoat/src/Commands/ExtendShooter.cpp b/wpilibcExamples/src/main/cpp/examples/PacGoat/src/Commands/ExtendShooter.cpp index a2fe84317f..7b105f85bd 100644 --- a/wpilibcExamples/src/main/cpp/examples/PacGoat/src/Commands/ExtendShooter.cpp +++ b/wpilibcExamples/src/main/cpp/examples/PacGoat/src/Commands/ExtendShooter.cpp @@ -9,17 +9,12 @@ #include "../Robot.h" -ExtendShooter::ExtendShooter() - : frc::TimedCommand(1.0) { - Requires(&Robot::shooter); +ExtendShooter::ExtendShooter() : frc::TimedCommand(1.0) { + Requires(&Robot::shooter); } // Called just before this Command runs the first time -void ExtendShooter::Initialize() { - Robot::shooter.ExtendBoth(); -} +void ExtendShooter::Initialize() { Robot::shooter.ExtendBoth(); } // Called once after isFinished returns true -void ExtendShooter::End() { - Robot::shooter.RetractBoth(); -} +void ExtendShooter::End() { Robot::shooter.RetractBoth(); } diff --git a/wpilibcExamples/src/main/cpp/examples/PacGoat/src/Commands/ExtendShooter.h b/wpilibcExamples/src/main/cpp/examples/PacGoat/src/Commands/ExtendShooter.h index c129e6074d..28798726e7 100644 --- a/wpilibcExamples/src/main/cpp/examples/PacGoat/src/Commands/ExtendShooter.h +++ b/wpilibcExamples/src/main/cpp/examples/PacGoat/src/Commands/ExtendShooter.h @@ -13,8 +13,8 @@ * Extend the shooter and then retract it after a second. */ class ExtendShooter : public frc::TimedCommand { -public: - ExtendShooter(); - void Initialize() override; - void End() override; + public: + ExtendShooter(); + void Initialize() override; + void End() override; }; diff --git a/wpilibcExamples/src/main/cpp/examples/PacGoat/src/Commands/LowGoal.cpp b/wpilibcExamples/src/main/cpp/examples/PacGoat/src/Commands/LowGoal.cpp index ce9068c287..4106730e43 100644 --- a/wpilibcExamples/src/main/cpp/examples/PacGoat/src/Commands/LowGoal.cpp +++ b/wpilibcExamples/src/main/cpp/examples/PacGoat/src/Commands/LowGoal.cpp @@ -13,7 +13,7 @@ #include "SetPivotSetpoint.h" LowGoal::LowGoal() { - AddSequential(new SetPivotSetpoint(Pivot::kLowGoal)); - AddSequential(new SetCollectionSpeed(Collector::kReverse)); - AddSequential(new ExtendShooter()); + AddSequential(new SetPivotSetpoint(Pivot::kLowGoal)); + AddSequential(new SetCollectionSpeed(Collector::kReverse)); + AddSequential(new ExtendShooter()); } diff --git a/wpilibcExamples/src/main/cpp/examples/PacGoat/src/Commands/LowGoal.h b/wpilibcExamples/src/main/cpp/examples/PacGoat/src/Commands/LowGoal.h index 361e8eb0b8..b2fdf996c3 100644 --- a/wpilibcExamples/src/main/cpp/examples/PacGoat/src/Commands/LowGoal.h +++ b/wpilibcExamples/src/main/cpp/examples/PacGoat/src/Commands/LowGoal.h @@ -14,6 +14,6 @@ * it. */ class LowGoal : public frc::CommandGroup { -public: - LowGoal(); + public: + LowGoal(); }; diff --git a/wpilibcExamples/src/main/cpp/examples/PacGoat/src/Commands/OpenClaw.cpp b/wpilibcExamples/src/main/cpp/examples/PacGoat/src/Commands/OpenClaw.cpp index 5a36e58f44..316b9cae9c 100644 --- a/wpilibcExamples/src/main/cpp/examples/PacGoat/src/Commands/OpenClaw.cpp +++ b/wpilibcExamples/src/main/cpp/examples/PacGoat/src/Commands/OpenClaw.cpp @@ -9,16 +9,10 @@ #include "../Robot.h" -OpenClaw::OpenClaw() { - Requires(&Robot::collector); -} +OpenClaw::OpenClaw() { Requires(&Robot::collector); } // Called just before this Command runs the first time -void OpenClaw::Initialize() { - Robot::collector.Open(); -} +void OpenClaw::Initialize() { Robot::collector.Open(); } // Make this return true when this Command no longer needs to run execute() -bool OpenClaw::IsFinished() { - return Robot::collector.IsOpen(); -} +bool OpenClaw::IsFinished() { return Robot::collector.IsOpen(); } diff --git a/wpilibcExamples/src/main/cpp/examples/PacGoat/src/Commands/OpenClaw.h b/wpilibcExamples/src/main/cpp/examples/PacGoat/src/Commands/OpenClaw.h index 0485d3571a..a9ddeae987 100644 --- a/wpilibcExamples/src/main/cpp/examples/PacGoat/src/Commands/OpenClaw.h +++ b/wpilibcExamples/src/main/cpp/examples/PacGoat/src/Commands/OpenClaw.h @@ -13,8 +13,8 @@ * Opens the claw */ class OpenClaw : public frc::Command { -public: - OpenClaw(); - void Initialize() override; - bool IsFinished() override; + public: + OpenClaw(); + void Initialize() override; + bool IsFinished() override; }; diff --git a/wpilibcExamples/src/main/cpp/examples/PacGoat/src/Commands/SetCollectionSpeed.cpp b/wpilibcExamples/src/main/cpp/examples/PacGoat/src/Commands/SetCollectionSpeed.cpp index 1e26121161..620bf05eb8 100644 --- a/wpilibcExamples/src/main/cpp/examples/PacGoat/src/Commands/SetCollectionSpeed.cpp +++ b/wpilibcExamples/src/main/cpp/examples/PacGoat/src/Commands/SetCollectionSpeed.cpp @@ -10,11 +10,9 @@ #include "../Robot.h" SetCollectionSpeed::SetCollectionSpeed(double speed) { - Requires(&Robot::collector); - m_speed = speed; + Requires(&Robot::collector); + m_speed = speed; } // Called just before this Command runs the first time -void SetCollectionSpeed::Initialize() { - Robot::collector.SetSpeed(m_speed); -} +void SetCollectionSpeed::Initialize() { Robot::collector.SetSpeed(m_speed); } diff --git a/wpilibcExamples/src/main/cpp/examples/PacGoat/src/Commands/SetCollectionSpeed.h b/wpilibcExamples/src/main/cpp/examples/PacGoat/src/Commands/SetCollectionSpeed.h index 07de772ae5..d1ecb5ea97 100644 --- a/wpilibcExamples/src/main/cpp/examples/PacGoat/src/Commands/SetCollectionSpeed.h +++ b/wpilibcExamples/src/main/cpp/examples/PacGoat/src/Commands/SetCollectionSpeed.h @@ -15,10 +15,10 @@ * the spinners may still be adjusting their speed. */ class SetCollectionSpeed : public frc::InstantCommand { -public: - explicit SetCollectionSpeed(double speed); - void Initialize() override; + public: + explicit SetCollectionSpeed(double speed); + void Initialize() override; -private: - double m_speed; + private: + double m_speed; }; diff --git a/wpilibcExamples/src/main/cpp/examples/PacGoat/src/Commands/SetPivotSetpoint.cpp b/wpilibcExamples/src/main/cpp/examples/PacGoat/src/Commands/SetPivotSetpoint.cpp index ce305625b5..e365d06894 100644 --- a/wpilibcExamples/src/main/cpp/examples/PacGoat/src/Commands/SetPivotSetpoint.cpp +++ b/wpilibcExamples/src/main/cpp/examples/PacGoat/src/Commands/SetPivotSetpoint.cpp @@ -10,17 +10,15 @@ #include "../Robot.h" SetPivotSetpoint::SetPivotSetpoint(double setpoint) { - m_setpoint = setpoint; - Requires(&Robot::pivot); + m_setpoint = setpoint; + Requires(&Robot::pivot); } // Called just before this Command runs the first time void SetPivotSetpoint::Initialize() { - Robot::pivot.Enable(); - Robot::pivot.SetSetpoint(m_setpoint); + Robot::pivot.Enable(); + Robot::pivot.SetSetpoint(m_setpoint); } // Make this return true when this Command no longer needs to run execute() -bool SetPivotSetpoint::IsFinished() { - return Robot::pivot.OnTarget(); -} +bool SetPivotSetpoint::IsFinished() { return Robot::pivot.OnTarget(); } diff --git a/wpilibcExamples/src/main/cpp/examples/PacGoat/src/Commands/SetPivotSetpoint.h b/wpilibcExamples/src/main/cpp/examples/PacGoat/src/Commands/SetPivotSetpoint.h index 681417e7d0..23d8fb05e1 100644 --- a/wpilibcExamples/src/main/cpp/examples/PacGoat/src/Commands/SetPivotSetpoint.h +++ b/wpilibcExamples/src/main/cpp/examples/PacGoat/src/Commands/SetPivotSetpoint.h @@ -15,11 +15,11 @@ * Other commands using the pivot should make sure they disable PID! */ class SetPivotSetpoint : public frc::Command { -public: - explicit SetPivotSetpoint(double setpoint); - void Initialize() override; - bool IsFinished() override; + public: + explicit SetPivotSetpoint(double setpoint); + void Initialize() override; + bool IsFinished() override; -private: - double m_setpoint; + private: + double m_setpoint; }; diff --git a/wpilibcExamples/src/main/cpp/examples/PacGoat/src/Commands/Shoot.cpp b/wpilibcExamples/src/main/cpp/examples/PacGoat/src/Commands/Shoot.cpp index fa47d3607a..41e0ad940c 100644 --- a/wpilibcExamples/src/main/cpp/examples/PacGoat/src/Commands/Shoot.cpp +++ b/wpilibcExamples/src/main/cpp/examples/PacGoat/src/Commands/Shoot.cpp @@ -14,8 +14,8 @@ #include "WaitForPressure.h" Shoot::Shoot() { - AddSequential(new WaitForPressure()); - AddSequential(new SetCollectionSpeed(Collector::kStop)); - AddSequential(new OpenClaw()); - AddSequential(new ExtendShooter()); + AddSequential(new WaitForPressure()); + AddSequential(new SetCollectionSpeed(Collector::kStop)); + AddSequential(new OpenClaw()); + AddSequential(new ExtendShooter()); } diff --git a/wpilibcExamples/src/main/cpp/examples/PacGoat/src/Commands/Shoot.h b/wpilibcExamples/src/main/cpp/examples/PacGoat/src/Commands/Shoot.h index b652104ecf..fc414b318e 100644 --- a/wpilibcExamples/src/main/cpp/examples/PacGoat/src/Commands/Shoot.h +++ b/wpilibcExamples/src/main/cpp/examples/PacGoat/src/Commands/Shoot.h @@ -13,6 +13,6 @@ * Shoot the ball at the current angle. */ class Shoot : public frc::CommandGroup { -public: - Shoot(); + public: + Shoot(); }; diff --git a/wpilibcExamples/src/main/cpp/examples/PacGoat/src/Commands/WaitForBall.cpp b/wpilibcExamples/src/main/cpp/examples/PacGoat/src/Commands/WaitForBall.cpp index 9a5d83ccf1..adf4e04658 100644 --- a/wpilibcExamples/src/main/cpp/examples/PacGoat/src/Commands/WaitForBall.cpp +++ b/wpilibcExamples/src/main/cpp/examples/PacGoat/src/Commands/WaitForBall.cpp @@ -9,11 +9,7 @@ #include "../Robot.h" -WaitForBall::WaitForBall() { - Requires(&Robot::collector); -} +WaitForBall::WaitForBall() { Requires(&Robot::collector); } // Make this return true when this Command no longer needs to run execute() -bool WaitForBall::IsFinished() { - return Robot::collector.HasBall(); -} +bool WaitForBall::IsFinished() { return Robot::collector.HasBall(); } diff --git a/wpilibcExamples/src/main/cpp/examples/PacGoat/src/Commands/WaitForBall.h b/wpilibcExamples/src/main/cpp/examples/PacGoat/src/Commands/WaitForBall.h index 82017e1f4e..30fdd9c767 100644 --- a/wpilibcExamples/src/main/cpp/examples/PacGoat/src/Commands/WaitForBall.h +++ b/wpilibcExamples/src/main/cpp/examples/PacGoat/src/Commands/WaitForBall.h @@ -15,7 +15,7 @@ * condition. */ class WaitForBall : public frc::Command { -public: - WaitForBall(); - bool IsFinished() override; + public: + WaitForBall(); + bool IsFinished() override; }; diff --git a/wpilibcExamples/src/main/cpp/examples/PacGoat/src/Commands/WaitForPressure.cpp b/wpilibcExamples/src/main/cpp/examples/PacGoat/src/Commands/WaitForPressure.cpp index a3d60a02ab..106327f06a 100644 --- a/wpilibcExamples/src/main/cpp/examples/PacGoat/src/Commands/WaitForPressure.cpp +++ b/wpilibcExamples/src/main/cpp/examples/PacGoat/src/Commands/WaitForPressure.cpp @@ -9,11 +9,7 @@ #include "../Robot.h" -WaitForPressure::WaitForPressure() { - Requires(&Robot::pneumatics); -} +WaitForPressure::WaitForPressure() { Requires(&Robot::pneumatics); } // Make this return true when this Command no longer needs to run execute() -bool WaitForPressure::IsFinished() { - return Robot::pneumatics.IsPressurized(); -} +bool WaitForPressure::IsFinished() { return Robot::pneumatics.IsPressurized(); } diff --git a/wpilibcExamples/src/main/cpp/examples/PacGoat/src/Commands/WaitForPressure.h b/wpilibcExamples/src/main/cpp/examples/PacGoat/src/Commands/WaitForPressure.h index 95bdfe0402..959406a1e5 100644 --- a/wpilibcExamples/src/main/cpp/examples/PacGoat/src/Commands/WaitForPressure.h +++ b/wpilibcExamples/src/main/cpp/examples/PacGoat/src/Commands/WaitForPressure.h @@ -14,7 +14,7 @@ * and is intended to be used in command groups to wait for this condition. */ class WaitForPressure : public frc::Command { -public: - WaitForPressure(); - bool IsFinished() override; + public: + WaitForPressure(); + bool IsFinished() override; }; diff --git a/wpilibcExamples/src/main/cpp/examples/PacGoat/src/OI.cpp b/wpilibcExamples/src/main/cpp/examples/PacGoat/src/OI.cpp index d3d6f1a664..086d66cf85 100644 --- a/wpilibcExamples/src/main/cpp/examples/PacGoat/src/OI.cpp +++ b/wpilibcExamples/src/main/cpp/examples/PacGoat/src/OI.cpp @@ -18,25 +18,23 @@ #include "Subsystems/Pivot.h" OI::OI() { - m_r1.WhenPressed(new LowGoal()); - m_r2.WhenPressed(new Collect()); + m_r1.WhenPressed(new LowGoal()); + m_r2.WhenPressed(new Collect()); - m_l1.WhenPressed(new SetPivotSetpoint(Pivot::kShoot)); - m_l2.WhenPressed(new SetPivotSetpoint(Pivot::kShootNear)); + m_l1.WhenPressed(new SetPivotSetpoint(Pivot::kShoot)); + m_l2.WhenPressed(new SetPivotSetpoint(Pivot::kShootNear)); - m_sticks.WhenActive(new Shoot()); + m_sticks.WhenActive(new Shoot()); - // SmartDashboard Buttons - frc::SmartDashboard::PutData("Drive Forward", new DriveForward(2.25)); - frc::SmartDashboard::PutData("Drive Backward", new DriveForward(-2.25)); - frc::SmartDashboard::PutData("Start Rollers", - new SetCollectionSpeed(Collector::kForward)); - frc::SmartDashboard::PutData("Stop Rollers", - new SetCollectionSpeed(Collector::kStop)); - frc::SmartDashboard::PutData("Reverse Rollers", - new SetCollectionSpeed(Collector::kReverse)); + // SmartDashboard Buttons + frc::SmartDashboard::PutData("Drive Forward", new DriveForward(2.25)); + frc::SmartDashboard::PutData("Drive Backward", new DriveForward(-2.25)); + frc::SmartDashboard::PutData("Start Rollers", + new SetCollectionSpeed(Collector::kForward)); + frc::SmartDashboard::PutData("Stop Rollers", + new SetCollectionSpeed(Collector::kStop)); + frc::SmartDashboard::PutData("Reverse Rollers", + new SetCollectionSpeed(Collector::kReverse)); } -frc::Joystick& OI::GetJoystick() { - return m_joystick; -} +frc::Joystick& OI::GetJoystick() { return m_joystick; } diff --git a/wpilibcExamples/src/main/cpp/examples/PacGoat/src/OI.h b/wpilibcExamples/src/main/cpp/examples/PacGoat/src/OI.h index b3228aa717..aa98f268a7 100644 --- a/wpilibcExamples/src/main/cpp/examples/PacGoat/src/OI.h +++ b/wpilibcExamples/src/main/cpp/examples/PacGoat/src/OI.h @@ -13,17 +13,17 @@ #include "Triggers/DoubleButton.h" class OI { -public: - OI(); - frc::Joystick& GetJoystick(); + public: + OI(); + frc::Joystick& GetJoystick(); -private: - frc::Joystick m_joystick{0}; + private: + frc::Joystick m_joystick{0}; - frc::JoystickButton m_l1{&m_joystick, 11}; - frc::JoystickButton m_l2{&m_joystick, 9}; - frc::JoystickButton m_r1{&m_joystick, 12}; - frc::JoystickButton m_r2{&m_joystick, 10}; + frc::JoystickButton m_l1{&m_joystick, 11}; + frc::JoystickButton m_l2{&m_joystick, 9}; + frc::JoystickButton m_r1{&m_joystick, 12}; + frc::JoystickButton m_r2{&m_joystick, 10}; - DoubleButton m_sticks{&m_joystick, 2, 3}; + DoubleButton m_sticks{&m_joystick, 2, 3}; }; diff --git a/wpilibcExamples/src/main/cpp/examples/PacGoat/src/Robot.cpp b/wpilibcExamples/src/main/cpp/examples/PacGoat/src/Robot.cpp index fb9003747c..2365659d89 100644 --- a/wpilibcExamples/src/main/cpp/examples/PacGoat/src/Robot.cpp +++ b/wpilibcExamples/src/main/cpp/examples/PacGoat/src/Robot.cpp @@ -21,67 +21,63 @@ Pneumatics Robot::pneumatics; OI Robot::oi; void Robot::RobotInit() { - // Show what command your subsystem is running on the SmartDashboard - frc::SmartDashboard::PutData(&drivetrain); - frc::SmartDashboard::PutData(&pivot); - frc::SmartDashboard::PutData(&collector); - frc::SmartDashboard::PutData(&shooter); - frc::SmartDashboard::PutData(&pneumatics); + // Show what command your subsystem is running on the SmartDashboard + frc::SmartDashboard::PutData(&drivetrain); + frc::SmartDashboard::PutData(&pivot); + frc::SmartDashboard::PutData(&collector); + frc::SmartDashboard::PutData(&shooter); + frc::SmartDashboard::PutData(&pneumatics); - // instantiate the command used for the autonomous period - m_autoChooser.AddDefault("Drive and Shoot", &m_driveAndShootAuto); - m_autoChooser.AddObject("Drive Forward", &m_driveForwardAuto); - frc::SmartDashboard::PutData("Auto Mode", &m_autoChooser); + // instantiate the command used for the autonomous period + m_autoChooser.AddDefault("Drive and Shoot", &m_driveAndShootAuto); + m_autoChooser.AddObject("Drive Forward", &m_driveForwardAuto); + frc::SmartDashboard::PutData("Auto Mode", &m_autoChooser); - pneumatics.Start(); // Pressurize the pneumatics. + pneumatics.Start(); // Pressurize the pneumatics. } void Robot::AutonomousInit() { - m_autonomousCommand = m_autoChooser.GetSelected(); - m_autonomousCommand->Start(); + m_autonomousCommand = m_autoChooser.GetSelected(); + m_autonomousCommand->Start(); } void Robot::AutonomousPeriodic() { - frc::Scheduler::GetInstance()->Run(); - Log(); + frc::Scheduler::GetInstance()->Run(); + Log(); } void Robot::TeleopInit() { - // This makes sure that the autonomous stops running when - // teleop starts running. If you want the autonomous to - // continue until interrupted by another command, remove - // this line or comment it out. - if (m_autonomousCommand != nullptr) { - m_autonomousCommand->Cancel(); - } - std::cout << "Starting Teleop" << std::endl; + // This makes sure that the autonomous stops running when + // teleop starts running. If you want the autonomous to + // continue until interrupted by another command, remove + // this line or comment it out. + if (m_autonomousCommand != nullptr) { + m_autonomousCommand->Cancel(); + } + std::cout << "Starting Teleop" << std::endl; } void Robot::TeleopPeriodic() { - frc::Scheduler::GetInstance()->Run(); - Log(); + frc::Scheduler::GetInstance()->Run(); + Log(); } void Robot::TestPeriodic() {} -void Robot::DisabledInit() { - shooter.Unlatch(); -} +void Robot::DisabledInit() { shooter.Unlatch(); } -void Robot::DisabledPeriodic() { - Log(); -} +void Robot::DisabledPeriodic() { Log(); } /** * Log interesting values to the SmartDashboard. */ void Robot::Log() { - Robot::pneumatics.WritePressure(); - frc::SmartDashboard::PutNumber("Pivot Pot Value", pivot.GetAngle()); - frc::SmartDashboard::PutNumber("Left Distance", - drivetrain.GetLeftEncoder().GetDistance()); - frc::SmartDashboard::PutNumber("Right Distance", - drivetrain.GetRightEncoder().GetDistance()); + Robot::pneumatics.WritePressure(); + frc::SmartDashboard::PutNumber("Pivot Pot Value", pivot.GetAngle()); + frc::SmartDashboard::PutNumber("Left Distance", + drivetrain.GetLeftEncoder().GetDistance()); + frc::SmartDashboard::PutNumber("Right Distance", + drivetrain.GetRightEncoder().GetDistance()); } START_ROBOT_CLASS(Robot) diff --git a/wpilibcExamples/src/main/cpp/examples/PacGoat/src/Robot.h b/wpilibcExamples/src/main/cpp/examples/PacGoat/src/Robot.h index 33c3073bad..e41573a2ba 100644 --- a/wpilibcExamples/src/main/cpp/examples/PacGoat/src/Robot.h +++ b/wpilibcExamples/src/main/cpp/examples/PacGoat/src/Robot.h @@ -21,28 +21,28 @@ #include "Subsystems/Shooter.h" class Robot : public IterativeRobot { -public: - static DriveTrain drivetrain; - static Pivot pivot; - static Collector collector; - static Shooter shooter; - static Pneumatics pneumatics; - static OI oi; + public: + static DriveTrain drivetrain; + static Pivot pivot; + static Collector collector; + static Shooter shooter; + static Pneumatics pneumatics; + static OI oi; -private: - frc::Command* m_autonomousCommand = nullptr; - DriveAndShootAutonomous m_driveAndShootAuto; - DriveForward m_driveForwardAuto; - SendableChooser m_autoChooser; + private: + frc::Command* m_autonomousCommand = nullptr; + DriveAndShootAutonomous m_driveAndShootAuto; + DriveForward m_driveForwardAuto; + SendableChooser m_autoChooser; - void RobotInit() override; - void AutonomousInit() override; - void AutonomousPeriodic() override; - void TeleopInit() override; - void TeleopPeriodic() override; - void TestPeriodic() override; - void DisabledInit() override; - void DisabledPeriodic() override; + void RobotInit() override; + void AutonomousInit() override; + void AutonomousPeriodic() override; + void TeleopInit() override; + void TeleopPeriodic() override; + void TestPeriodic() override; + void DisabledInit() override; + void DisabledPeriodic() override; - void Log(); + void Log(); }; diff --git a/wpilibcExamples/src/main/cpp/examples/PacGoat/src/Subsystems/Collector.cpp b/wpilibcExamples/src/main/cpp/examples/PacGoat/src/Subsystems/Collector.cpp index fa81dc1168..1b36b26e17 100644 --- a/wpilibcExamples/src/main/cpp/examples/PacGoat/src/Subsystems/Collector.cpp +++ b/wpilibcExamples/src/main/cpp/examples/PacGoat/src/Subsystems/Collector.cpp @@ -9,37 +9,28 @@ #include -Collector::Collector() - : frc::Subsystem("Collector") { - // Put everything to the LiveWindow for testing. - AddChild("Roller Motor", m_rollerMotor); - AddChild("Ball Detector", m_ballDetector); - AddChild("Claw Open Detector", m_openDetector); - AddChild("Piston", m_piston); +Collector::Collector() : frc::Subsystem("Collector") { + // Put everything to the LiveWindow for testing. + AddChild("Roller Motor", m_rollerMotor); + AddChild("Ball Detector", m_ballDetector); + AddChild("Claw Open Detector", m_openDetector); + AddChild("Piston", m_piston); } bool Collector::HasBall() { - return m_ballDetector.Get(); // TODO: prepend ! to reflect real robot + return m_ballDetector.Get(); // TODO: prepend ! to reflect real robot } -void Collector::SetSpeed(double speed) { - m_rollerMotor.Set(-speed); -} +void Collector::SetSpeed(double speed) { m_rollerMotor.Set(-speed); } -void Collector::Stop() { - m_rollerMotor.Set(0); -} +void Collector::Stop() { m_rollerMotor.Set(0); } bool Collector::IsOpen() { - return m_openDetector.Get(); // TODO: prepend ! to reflect real robot + return m_openDetector.Get(); // TODO: prepend ! to reflect real robot } -void Collector::Open() { - m_piston.Set(true); -} +void Collector::Open() { m_piston.Set(true); } -void Collector::Close() { - m_piston.Set(false); -} +void Collector::Close() { m_piston.Set(false); } void Collector::InitDefaultCommand() {} diff --git a/wpilibcExamples/src/main/cpp/examples/PacGoat/src/Subsystems/Collector.h b/wpilibcExamples/src/main/cpp/examples/PacGoat/src/Subsystems/Collector.h index e6ad0e4d6d..430715008f 100644 --- a/wpilibcExamples/src/main/cpp/examples/PacGoat/src/Subsystems/Collector.h +++ b/wpilibcExamples/src/main/cpp/examples/PacGoat/src/Subsystems/Collector.h @@ -19,58 +19,58 @@ * check if the piston is open. */ class Collector : public frc::Subsystem { -public: - // Constants for some useful speeds - static constexpr double kForward = 1; - static constexpr double kStop = 0; - static constexpr double kReverse = -1; + public: + // Constants for some useful speeds + static constexpr double kForward = 1; + static constexpr double kStop = 0; + static constexpr double kReverse = -1; - Collector(); + Collector(); - /** - * NOTE: The current simulation model uses the the lower part of the - * claw - * since the limit switch wasn't exported. At some point, this will be - * updated. - * - * @return Whether or not the robot has the ball. - */ - bool HasBall(); + /** + * NOTE: The current simulation model uses the the lower part of the + * claw + * since the limit switch wasn't exported. At some point, this will be + * updated. + * + * @return Whether or not the robot has the ball. + */ + bool HasBall(); - /** - * @param speed The speed to spin the rollers. - */ - void SetSpeed(double speed); + /** + * @param speed The speed to spin the rollers. + */ + void SetSpeed(double speed); - /** - * Stop the rollers from spinning - */ - void Stop(); + /** + * Stop the rollers from spinning + */ + void Stop(); - /** - * @return Whether or not the claw is open. - */ - bool IsOpen(); + /** + * @return Whether or not the claw is open. + */ + bool IsOpen(); - /** - * Open the claw up. (For shooting) - */ - void Open(); + /** + * Open the claw up. (For shooting) + */ + void Open(); - /** - * Close the claw. (For collecting and driving) - */ - void Close(); + /** + * Close the claw. (For collecting and driving) + */ + void Close(); - /** - * No default command. - */ - void InitDefaultCommand() override; + /** + * No default command. + */ + void InitDefaultCommand() override; -private: - // Subsystem devices - frc::Spark m_rollerMotor{6}; - frc::DigitalInput m_ballDetector{10}; - frc::Solenoid m_piston{1}; - frc::DigitalInput m_openDetector{6}; + private: + // Subsystem devices + frc::Spark m_rollerMotor{6}; + frc::DigitalInput m_ballDetector{10}; + frc::Solenoid m_piston{1}; + frc::DigitalInput m_openDetector{6}; }; diff --git a/wpilibcExamples/src/main/cpp/examples/PacGoat/src/Subsystems/DriveTrain.cpp b/wpilibcExamples/src/main/cpp/examples/PacGoat/src/Subsystems/DriveTrain.cpp index f0ac65a4ec..48fe7ceab3 100644 --- a/wpilibcExamples/src/main/cpp/examples/PacGoat/src/Subsystems/DriveTrain.cpp +++ b/wpilibcExamples/src/main/cpp/examples/PacGoat/src/Subsystems/DriveTrain.cpp @@ -13,67 +13,58 @@ #include "../Commands/DriveWithJoystick.h" -DriveTrain::DriveTrain() - : frc::Subsystem("DriveTrain") { - // AddChild("Front Left CIM", m_frontLeftCIM); - // AddChild("Front Right CIM", m_frontRightCIM); - // AddChild("Back Left CIM", m_backLeftCIM); - // AddChild("Back Right CIM", m_backRightCIM); +DriveTrain::DriveTrain() : frc::Subsystem("DriveTrain") { + // AddChild("Front Left CIM", m_frontLeftCIM); + // AddChild("Front Right CIM", m_frontRightCIM); + // AddChild("Back Left CIM", m_backLeftCIM); + // AddChild("Back Right CIM", m_backRightCIM); - // Configure the DifferentialDrive to reflect the fact that all our - // motors are wired backwards and our drivers sensitivity preferences. - m_robotDrive.SetSafetyEnabled(false); - m_robotDrive.SetExpiration(0.1); - m_robotDrive.SetMaxOutput(1.0); - m_leftCIMs.SetInverted(true); - m_rightCIMs.SetInverted(true); + // Configure the DifferentialDrive to reflect the fact that all our + // motors are wired backwards and our drivers sensitivity preferences. + m_robotDrive.SetSafetyEnabled(false); + m_robotDrive.SetExpiration(0.1); + m_robotDrive.SetMaxOutput(1.0); + m_leftCIMs.SetInverted(true); + m_rightCIMs.SetInverted(true); - // Configure encoders - m_rightEncoder.SetPIDSourceType(PIDSourceType::kDisplacement); - m_leftEncoder.SetPIDSourceType(PIDSourceType::kDisplacement); + // Configure encoders + m_rightEncoder.SetPIDSourceType(PIDSourceType::kDisplacement); + m_leftEncoder.SetPIDSourceType(PIDSourceType::kDisplacement); #ifndef SIMULATION - // Converts to feet - m_rightEncoder.SetDistancePerPulse(0.0785398); - m_leftEncoder.SetDistancePerPulse(0.0785398); + // Converts to feet + m_rightEncoder.SetDistancePerPulse(0.0785398); + m_leftEncoder.SetDistancePerPulse(0.0785398); #else - // Convert to feet 4in diameter wheels with 360 tick simulated encoders - m_rightEncoder.SetDistancePerPulse( - (4.0 /*in*/ * M_PI) / (360.0 * 12.0 /*in/ft*/)); - m_leftEncoder.SetDistancePerPulse( - (4.0 /*in*/ * M_PI) / (360.0 * 12.0 /*in/ft*/)); + // Convert to feet 4in diameter wheels with 360 tick simulated encoders + m_rightEncoder.SetDistancePerPulse((4.0 /*in*/ * M_PI) / + (360.0 * 12.0 /*in/ft*/)); + m_leftEncoder.SetDistancePerPulse((4.0 /*in*/ * M_PI) / + (360.0 * 12.0 /*in/ft*/)); #endif - AddChild("Right Encoder", m_rightEncoder); - AddChild("Left Encoder", m_leftEncoder); + AddChild("Right Encoder", m_rightEncoder); + AddChild("Left Encoder", m_leftEncoder); // Configure gyro #ifndef SIMULATION - m_gyro.SetSensitivity(0.007); // TODO: Handle more gracefully? + m_gyro.SetSensitivity(0.007); // TODO: Handle more gracefully? #endif - AddChild("Gyro", m_gyro); + AddChild("Gyro", m_gyro); } void DriveTrain::InitDefaultCommand() { - SetDefaultCommand(new DriveWithJoystick()); + SetDefaultCommand(new DriveWithJoystick()); } void DriveTrain::TankDrive(double leftAxis, double rightAxis) { - m_robotDrive.TankDrive(leftAxis, rightAxis); + m_robotDrive.TankDrive(leftAxis, rightAxis); } -void DriveTrain::Stop() { - m_robotDrive.TankDrive(0.0, 0.0); -} +void DriveTrain::Stop() { m_robotDrive.TankDrive(0.0, 0.0); } -Encoder& DriveTrain::GetLeftEncoder() { - return m_leftEncoder; -} +Encoder& DriveTrain::GetLeftEncoder() { return m_leftEncoder; } -Encoder& DriveTrain::GetRightEncoder() { - return m_rightEncoder; -} +Encoder& DriveTrain::GetRightEncoder() { return m_rightEncoder; } -double DriveTrain::GetAngle() { - return m_gyro.GetAngle(); -} +double DriveTrain::GetAngle() { return m_gyro.GetAngle(); } diff --git a/wpilibcExamples/src/main/cpp/examples/PacGoat/src/Subsystems/DriveTrain.h b/wpilibcExamples/src/main/cpp/examples/PacGoat/src/Subsystems/DriveTrain.h index b0eb100fd1..98897dbefc 100644 --- a/wpilibcExamples/src/main/cpp/examples/PacGoat/src/Subsystems/DriveTrain.h +++ b/wpilibcExamples/src/main/cpp/examples/PacGoat/src/Subsystems/DriveTrain.h @@ -23,57 +23,57 @@ class Joystick; * information about it's speed and position. */ class DriveTrain : public frc::Subsystem { -public: - DriveTrain(); + public: + DriveTrain(); - /** - * When other commands aren't using the drivetrain, allow tank drive - * with - * the joystick. - */ - void InitDefaultCommand(); + /** + * When other commands aren't using the drivetrain, allow tank drive + * with + * the joystick. + */ + void InitDefaultCommand(); - /** - * @param leftAxis Left sides value - * @param rightAxis Right sides value - */ - void TankDrive(double leftAxis, double rightAxis); + /** + * @param leftAxis Left sides value + * @param rightAxis Right sides value + */ + void TankDrive(double leftAxis, double rightAxis); - /** - * Stop the drivetrain from moving. - */ - void Stop(); + /** + * Stop the drivetrain from moving. + */ + void Stop(); - /** - * @return The encoder getting the distance and speed of left side of - * the drivetrain. - */ - Encoder& GetLeftEncoder(); + /** + * @return The encoder getting the distance and speed of left side of + * the drivetrain. + */ + Encoder& GetLeftEncoder(); - /** - * @return The encoder getting the distance and speed of right side of - * the drivetrain. - */ - Encoder& GetRightEncoder(); + /** + * @return The encoder getting the distance and speed of right side of + * the drivetrain. + */ + Encoder& GetRightEncoder(); - /** - * @return The current angle of the drivetrain. - */ - double GetAngle(); + /** + * @return The current angle of the drivetrain. + */ + double GetAngle(); -private: - // Subsystem devices - frc::Spark m_frontLeftCIM{1}; - frc::Spark m_rearLeftCIM{2}; - frc::SpeedControllerGroup m_leftCIMs{m_frontLeftCIM, m_rearLeftCIM}; + private: + // Subsystem devices + frc::Spark m_frontLeftCIM{1}; + frc::Spark m_rearLeftCIM{2}; + frc::SpeedControllerGroup m_leftCIMs{m_frontLeftCIM, m_rearLeftCIM}; - frc::Spark m_frontRightCIM{3}; - frc::Spark m_rearRightCIM{4}; - frc::SpeedControllerGroup m_rightCIMs{m_frontRightCIM, m_rearRightCIM}; + frc::Spark m_frontRightCIM{3}; + frc::Spark m_rearRightCIM{4}; + frc::SpeedControllerGroup m_rightCIMs{m_frontRightCIM, m_rearRightCIM}; - frc::DifferentialDrive m_robotDrive{m_leftCIMs, m_rightCIMs}; + frc::DifferentialDrive m_robotDrive{m_leftCIMs, m_rightCIMs}; - frc::Encoder m_rightEncoder{1, 2, true, Encoder::k4X}; - frc::Encoder m_leftEncoder{3, 4, false, Encoder::k4X}; - frc::AnalogGyro m_gyro{0}; + frc::Encoder m_rightEncoder{1, 2, true, Encoder::k4X}; + frc::Encoder m_leftEncoder{3, 4, false, Encoder::k4X}; + frc::AnalogGyro m_gyro{0}; }; diff --git a/wpilibcExamples/src/main/cpp/examples/PacGoat/src/Subsystems/Pivot.cpp b/wpilibcExamples/src/main/cpp/examples/PacGoat/src/Subsystems/Pivot.cpp index 1c2a4d765e..f8d5028f23 100644 --- a/wpilibcExamples/src/main/cpp/examples/PacGoat/src/Subsystems/Pivot.cpp +++ b/wpilibcExamples/src/main/cpp/examples/PacGoat/src/Subsystems/Pivot.cpp @@ -7,43 +7,36 @@ #include "Pivot.h" -Pivot::Pivot() - : frc::PIDSubsystem("Pivot", 7.0, 0.0, 8.0) { - SetAbsoluteTolerance(0.005); - GetPIDController()->SetContinuous(false); +Pivot::Pivot() : frc::PIDSubsystem("Pivot", 7.0, 0.0, 8.0) { + SetAbsoluteTolerance(0.005); + GetPIDController()->SetContinuous(false); #ifdef SIMULATION - // PID is different in simulation. - GetPIDController()->SetPID(0.5, 0.001, 2); - SetAbsoluteTolerance(5); + // PID is different in simulation. + GetPIDController()->SetPID(0.5, 0.001, 2); + SetAbsoluteTolerance(5); #endif - // Put everything to the LiveWindow for testing. - AddChild("Upper Limit Switch", m_upperLimitSwitch); - AddChild("Lower Limit Switch", m_lowerLimitSwitch); - AddChild("Pot", m_pot); - AddChild("Motor", m_motor); + // Put everything to the LiveWindow for testing. + AddChild("Upper Limit Switch", m_upperLimitSwitch); + AddChild("Lower Limit Switch", m_lowerLimitSwitch); + AddChild("Pot", m_pot); + AddChild("Motor", m_motor); } void InitDefaultCommand() {} -double Pivot::ReturnPIDInput() { - return m_pot.Get(); -} +double Pivot::ReturnPIDInput() { return m_pot.Get(); } -void Pivot::UsePIDOutput(double output) { - m_motor.PIDWrite(output); -} +void Pivot::UsePIDOutput(double output) { m_motor.PIDWrite(output); } bool Pivot::IsAtUpperLimit() { - return m_upperLimitSwitch.Get(); // TODO: inverted from real robot - // (prefix with !) + return m_upperLimitSwitch.Get(); // TODO: inverted from real robot + // (prefix with !) } bool Pivot::IsAtLowerLimit() { - return m_lowerLimitSwitch.Get(); // TODO: inverted from real robot - // (prefix with !) + return m_lowerLimitSwitch.Get(); // TODO: inverted from real robot + // (prefix with !) } -double Pivot::GetAngle() { - return m_pot.Get(); -} +double Pivot::GetAngle() { return m_pot.Get(); } diff --git a/wpilibcExamples/src/main/cpp/examples/PacGoat/src/Subsystems/Pivot.h b/wpilibcExamples/src/main/cpp/examples/PacGoat/src/Subsystems/Pivot.h index b145caf9eb..ed979856d5 100644 --- a/wpilibcExamples/src/main/cpp/examples/PacGoat/src/Subsystems/Pivot.h +++ b/wpilibcExamples/src/main/cpp/examples/PacGoat/src/Subsystems/Pivot.h @@ -17,58 +17,58 @@ * of angle of the pivot and claw. */ class Pivot : public frc::PIDSubsystem { -public: - // Constants for some useful angles - static constexpr double kCollect = 105; - static constexpr double kLowGoal = 90; - static constexpr double kShoot = 45; - static constexpr double kShootNear = 30; + public: + // Constants for some useful angles + static constexpr double kCollect = 105; + static constexpr double kLowGoal = 90; + static constexpr double kShoot = 45; + static constexpr double kShootNear = 30; - Pivot(); + Pivot(); - /** - * No default command, if PID is enabled, the current setpoint will be - * maintained. - */ - void InitDefaultCommand() override {} + /** + * No default command, if PID is enabled, the current setpoint will be + * maintained. + */ + void InitDefaultCommand() override {} - /** - * @return The angle read in by the potentiometer - */ - double ReturnPIDInput() override; + /** + * @return The angle read in by the potentiometer + */ + double ReturnPIDInput() override; - /** - * Set the motor speed based off of the PID output - */ - void UsePIDOutput(double output) override; + /** + * Set the motor speed based off of the PID output + */ + void UsePIDOutput(double output) override; - /** - * @return If the pivot is at its upper limit. - */ - bool IsAtUpperLimit(); + /** + * @return If the pivot is at its upper limit. + */ + bool IsAtUpperLimit(); - /** - * @return If the pivot is at its lower limit. - */ - bool IsAtLowerLimit(); + /** + * @return If the pivot is at its lower limit. + */ + bool IsAtLowerLimit(); - /** - * @return The current angle of the pivot. - */ - double GetAngle(); + /** + * @return The current angle of the pivot. + */ + double GetAngle(); -private: - // Subsystem devices + private: + // Subsystem devices - // Sensors for measuring the position of the pivot - frc::DigitalInput m_upperLimitSwitch{13}; - frc::DigitalInput m_lowerLimitSwitch{12}; + // Sensors for measuring the position of the pivot + frc::DigitalInput m_upperLimitSwitch{13}; + frc::DigitalInput m_lowerLimitSwitch{12}; - /* 0 degrees is vertical facing up. - * Angle increases the more forward the pivot goes. - */ - frc::AnalogPotentiometer m_pot{1}; + /* 0 degrees is vertical facing up. + * Angle increases the more forward the pivot goes. + */ + frc::AnalogPotentiometer m_pot{1}; - // Motor to move the pivot - frc::Spark m_motor{5}; + // Motor to move the pivot + frc::Spark m_motor{5}; }; diff --git a/wpilibcExamples/src/main/cpp/examples/PacGoat/src/Subsystems/Pneumatics.cpp b/wpilibcExamples/src/main/cpp/examples/PacGoat/src/Subsystems/Pneumatics.cpp index 9128b0d916..c541a4da1c 100644 --- a/wpilibcExamples/src/main/cpp/examples/PacGoat/src/Subsystems/Pneumatics.cpp +++ b/wpilibcExamples/src/main/cpp/examples/PacGoat/src/Subsystems/Pneumatics.cpp @@ -9,9 +9,8 @@ #include -Pneumatics::Pneumatics() - : frc::Subsystem("Pneumatics") { - AddChild("Pressure Sensor", m_pressureSensor); +Pneumatics::Pneumatics() : frc::Subsystem("Pneumatics") { + AddChild("Pressure Sensor", m_pressureSensor); } /** @@ -25,7 +24,7 @@ void Pneumatics::InitDefaultCommand() {} */ void Pneumatics::Start() { #ifndef SIMULATION - m_compressor.Start(); + m_compressor.Start(); #endif } @@ -34,9 +33,9 @@ void Pneumatics::Start() { */ bool Pneumatics::IsPressurized() { #ifndef SIMULATION - return kMaxPressure <= m_pressureSensor.GetVoltage(); + return kMaxPressure <= m_pressureSensor.GetVoltage(); #else - return true; // NOTE: Simulation always has full pressure + return true; // NOTE: Simulation always has full pressure #endif } @@ -44,6 +43,5 @@ bool Pneumatics::IsPressurized() { * Puts the pressure on the SmartDashboard. */ void Pneumatics::WritePressure() { - frc::SmartDashboard::PutNumber( - "Pressure", m_pressureSensor.GetVoltage()); + frc::SmartDashboard::PutNumber("Pressure", m_pressureSensor.GetVoltage()); } diff --git a/wpilibcExamples/src/main/cpp/examples/PacGoat/src/Subsystems/Pneumatics.h b/wpilibcExamples/src/main/cpp/examples/PacGoat/src/Subsystems/Pneumatics.h index 4d8ba1dfd3..a867a10c7b 100644 --- a/wpilibcExamples/src/main/cpp/examples/PacGoat/src/Subsystems/Pneumatics.h +++ b/wpilibcExamples/src/main/cpp/examples/PacGoat/src/Subsystems/Pneumatics.h @@ -18,36 +18,36 @@ * sensors. */ class Pneumatics : public frc::Subsystem { -public: - Pneumatics(); + public: + Pneumatics(); - /** - * No default command - */ - void InitDefaultCommand() override; + /** + * No default command + */ + void InitDefaultCommand() override; - /** - * Start the compressor going. The compressor automatically starts and - * stops as it goes above and below maximum pressure. - */ - void Start(); + /** + * Start the compressor going. The compressor automatically starts and + * stops as it goes above and below maximum pressure. + */ + void Start(); - /** - * @return Whether or not the system is fully pressurized. - */ - bool IsPressurized(); + /** + * @return Whether or not the system is fully pressurized. + */ + bool IsPressurized(); - /** - * Puts the pressure on the SmartDashboard. - */ - void WritePressure(); + /** + * Puts the pressure on the SmartDashboard. + */ + void WritePressure(); -private: - frc::AnalogInput m_pressureSensor{3}; + private: + frc::AnalogInput m_pressureSensor{3}; #ifndef SIMULATION - frc::Compressor m_compressor{1}; // TODO: (1, 14, 1, 8); + frc::Compressor m_compressor{1}; // TODO: (1, 14, 1, 8); #endif - static constexpr double kMaxPressure = 2.55; + static constexpr double kMaxPressure = 2.55; }; diff --git a/wpilibcExamples/src/main/cpp/examples/PacGoat/src/Subsystems/Shooter.cpp b/wpilibcExamples/src/main/cpp/examples/PacGoat/src/Subsystems/Shooter.cpp index b1d87a99cc..d06b3e690d 100644 --- a/wpilibcExamples/src/main/cpp/examples/PacGoat/src/Subsystems/Shooter.cpp +++ b/wpilibcExamples/src/main/cpp/examples/PacGoat/src/Subsystems/Shooter.cpp @@ -7,79 +7,54 @@ #include "Shooter.h" -Shooter::Shooter() - : Subsystem("Shooter") { - // Put everything to the LiveWindow for testing. - AddChild("Hot Goal Sensor", m_hotGoalSensor); - AddChild("Piston1 Reed Switch Front ", m_piston1ReedSwitchFront); - AddChild("Piston1 Reed Switch Back ", m_piston1ReedSwitchBack); - AddChild("Latch Piston", m_latchPiston); +Shooter::Shooter() : Subsystem("Shooter") { + // Put everything to the LiveWindow for testing. + AddChild("Hot Goal Sensor", m_hotGoalSensor); + AddChild("Piston1 Reed Switch Front ", m_piston1ReedSwitchFront); + AddChild("Piston1 Reed Switch Back ", m_piston1ReedSwitchBack); + AddChild("Latch Piston", m_latchPiston); } void Shooter::InitDefaultCommand() { - // Set the default command for a subsystem here. - // SetDefaultCommand(new MySpecialCommand()); + // Set the default command for a subsystem here. + // SetDefaultCommand(new MySpecialCommand()); } void Shooter::ExtendBoth() { - m_piston1.Set(frc::DoubleSolenoid::kForward); - m_piston2.Set(frc::DoubleSolenoid::kForward); + m_piston1.Set(frc::DoubleSolenoid::kForward); + m_piston2.Set(frc::DoubleSolenoid::kForward); } void Shooter::RetractBoth() { - m_piston1.Set(frc::DoubleSolenoid::kReverse); - m_piston2.Set(frc::DoubleSolenoid::kReverse); + m_piston1.Set(frc::DoubleSolenoid::kReverse); + m_piston2.Set(frc::DoubleSolenoid::kReverse); } -void Shooter::Extend1() { - m_piston1.Set(frc::DoubleSolenoid::kForward); -} +void Shooter::Extend1() { m_piston1.Set(frc::DoubleSolenoid::kForward); } -void Shooter::Retract1() { - m_piston1.Set(frc::DoubleSolenoid::kReverse); -} +void Shooter::Retract1() { m_piston1.Set(frc::DoubleSolenoid::kReverse); } -void Shooter::Extend2() { - m_piston2.Set(frc::DoubleSolenoid::kReverse); -} +void Shooter::Extend2() { m_piston2.Set(frc::DoubleSolenoid::kReverse); } -void Shooter::Retract2() { - m_piston2.Set(frc::DoubleSolenoid::kForward); -} +void Shooter::Retract2() { m_piston2.Set(frc::DoubleSolenoid::kForward); } -void Shooter::Off1() { - m_piston1.Set(frc::DoubleSolenoid::kOff); -} +void Shooter::Off1() { m_piston1.Set(frc::DoubleSolenoid::kOff); } -void Shooter::Off2() { - m_piston2.Set(frc::DoubleSolenoid::kOff); -} +void Shooter::Off2() { m_piston2.Set(frc::DoubleSolenoid::kOff); } -void Shooter::Unlatch() { - m_latchPiston.Set(true); -} +void Shooter::Unlatch() { m_latchPiston.Set(true); } -void Shooter::Latch() { - m_latchPiston.Set(false); -} +void Shooter::Latch() { m_latchPiston.Set(false); } -void Shooter::ToggleLatchPosition() { - m_latchPiston.Set(!m_latchPiston.Get()); -} +void Shooter::ToggleLatchPosition() { m_latchPiston.Set(!m_latchPiston.Get()); } -bool Shooter::Piston1IsExtended() { - return !m_piston1ReedSwitchFront.Get(); -} +bool Shooter::Piston1IsExtended() { return !m_piston1ReedSwitchFront.Get(); } -bool Shooter::Piston1IsRetracted() { - return !m_piston1ReedSwitchBack.Get(); -} +bool Shooter::Piston1IsRetracted() { return !m_piston1ReedSwitchBack.Get(); } void Shooter::OffBoth() { - m_piston1.Set(frc::DoubleSolenoid::kOff); - m_piston2.Set(frc::DoubleSolenoid::kOff); + m_piston1.Set(frc::DoubleSolenoid::kOff); + m_piston2.Set(frc::DoubleSolenoid::kOff); } -bool Shooter::GoalIsHot() { - return m_hotGoalSensor.Get(); -} +bool Shooter::GoalIsHot() { return m_hotGoalSensor.Get(); } diff --git a/wpilibcExamples/src/main/cpp/examples/PacGoat/src/Subsystems/Shooter.h b/wpilibcExamples/src/main/cpp/examples/PacGoat/src/Subsystems/Shooter.h index c22c407c84..25d400d728 100644 --- a/wpilibcExamples/src/main/cpp/examples/PacGoat/src/Subsystems/Shooter.h +++ b/wpilibcExamples/src/main/cpp/examples/PacGoat/src/Subsystems/Shooter.h @@ -23,105 +23,105 @@ * and ignores the latch. */ class Shooter : public frc::Subsystem { -public: - Shooter(); - void InitDefaultCommand() override; + public: + Shooter(); + void InitDefaultCommand() override; - /** - * Extend both solenoids to shoot. - */ - void ExtendBoth(); + /** + * Extend both solenoids to shoot. + */ + void ExtendBoth(); - /** - * Retract both solenoids to prepare to shoot. - */ - void RetractBoth(); + /** + * Retract both solenoids to prepare to shoot. + */ + void RetractBoth(); - /** - * Extend solenoid 1 to shoot. - */ - void Extend1(); + /** + * Extend solenoid 1 to shoot. + */ + void Extend1(); - /** - * Retract solenoid 1 to prepare to shoot. - */ - void Retract1(); + /** + * Retract solenoid 1 to prepare to shoot. + */ + void Retract1(); - /** - * Extend solenoid 2 to shoot. - */ - void Extend2(); + /** + * Extend solenoid 2 to shoot. + */ + void Extend2(); - /** - * Retract solenoid 2 to prepare to shoot. - */ - void Retract2(); + /** + * Retract solenoid 2 to prepare to shoot. + */ + void Retract2(); - /** - * Turns off the piston1 double solenoid. This won't actuate anything - * because double solenoids preserve their state when turned off. This - * should be called in order to reduce the amount of time that the coils - * are - * powered. - */ - void Off1(); + /** + * Turns off the piston1 double solenoid. This won't actuate anything + * because double solenoids preserve their state when turned off. This + * should be called in order to reduce the amount of time that the coils + * are + * powered. + */ + void Off1(); - /** - * Turns off the piston1 double solenoid. This won't actuate anything - * because double solenoids preserve their state when turned off. This - * should be called in order to reduce the amount of time that the coils - * are - * powered. - */ - void Off2(); + /** + * Turns off the piston1 double solenoid. This won't actuate anything + * because double solenoids preserve their state when turned off. This + * should be called in order to reduce the amount of time that the coils + * are + * powered. + */ + void Off2(); - /** - * Release the latch so that we can shoot - */ - void Unlatch(); + /** + * Release the latch so that we can shoot + */ + void Unlatch(); - /** - * Latch so that pressure can build up and we aren't limited by air - * flow. - */ - void Latch(); + /** + * Latch so that pressure can build up and we aren't limited by air + * flow. + */ + void Latch(); - /** - * Toggles the latch postions - */ - void ToggleLatchPosition(); + /** + * Toggles the latch postions + */ + void ToggleLatchPosition(); - /** - * @return Whether or not piston 1 is fully extended. - */ - bool Piston1IsExtended(); + /** + * @return Whether or not piston 1 is fully extended. + */ + bool Piston1IsExtended(); - /** - * @return Whether or not piston 1 is fully retracted. - */ - bool Piston1IsRetracted(); + /** + * @return Whether or not piston 1 is fully retracted. + */ + bool Piston1IsRetracted(); - /** - * Turns off all double solenoids. Double solenoids hold their position - * when - * they are turned off. We should turn them off whenever possible to - * extend - * the life of the coils - */ - void OffBoth(); + /** + * Turns off all double solenoids. Double solenoids hold their position + * when + * they are turned off. We should turn them off whenever possible to + * extend + * the life of the coils + */ + void OffBoth(); - /** - * @return Whether or not the goal is hot as read by the banner sensor - */ - bool GoalIsHot(); + /** + * @return Whether or not the goal is hot as read by the banner sensor + */ + bool GoalIsHot(); -private: - // Devices - frc::DoubleSolenoid m_piston1{3, 4}; - frc::DoubleSolenoid m_piston2{5, 6}; - frc::Solenoid m_latchPiston{1, 2}; - frc::DigitalInput m_piston1ReedSwitchFront{9}; - frc::DigitalInput m_piston1ReedSwitchBack{11}; - frc::DigitalInput m_hotGoalSensor{ - 7}; // NOTE: Currently ignored in simulation + private: + // Devices + frc::DoubleSolenoid m_piston1{3, 4}; + frc::DoubleSolenoid m_piston2{5, 6}; + frc::Solenoid m_latchPiston{1, 2}; + frc::DigitalInput m_piston1ReedSwitchFront{9}; + frc::DigitalInput m_piston1ReedSwitchBack{11}; + frc::DigitalInput m_hotGoalSensor{ + 7}; // NOTE: Currently ignored in simulation }; diff --git a/wpilibcExamples/src/main/cpp/examples/PacGoat/src/Triggers/DoubleButton.cpp b/wpilibcExamples/src/main/cpp/examples/PacGoat/src/Triggers/DoubleButton.cpp index c8b485d871..4f53497531 100644 --- a/wpilibcExamples/src/main/cpp/examples/PacGoat/src/Triggers/DoubleButton.cpp +++ b/wpilibcExamples/src/main/cpp/examples/PacGoat/src/Triggers/DoubleButton.cpp @@ -11,10 +11,10 @@ DoubleButton::DoubleButton(frc::Joystick* joy, int button1, int button2) : m_joy(*joy) { - m_button1 = button1; - m_button2 = button2; + m_button1 = button1; + m_button2 = button2; } bool DoubleButton::Get() { - return m_joy.GetRawButton(m_button1) && m_joy.GetRawButton(m_button2); + return m_joy.GetRawButton(m_button1) && m_joy.GetRawButton(m_button2); } diff --git a/wpilibcExamples/src/main/cpp/examples/PacGoat/src/Triggers/DoubleButton.h b/wpilibcExamples/src/main/cpp/examples/PacGoat/src/Triggers/DoubleButton.h index a0b8f6748f..894a02981d 100644 --- a/wpilibcExamples/src/main/cpp/examples/PacGoat/src/Triggers/DoubleButton.h +++ b/wpilibcExamples/src/main/cpp/examples/PacGoat/src/Triggers/DoubleButton.h @@ -14,13 +14,13 @@ class Joystick; } // namespace frc class DoubleButton : public frc::Trigger { -public: - DoubleButton(frc::Joystick* joy, int button1, int button2); + public: + DoubleButton(frc::Joystick* joy, int button1, int button2); - bool Get(); + bool Get(); -private: - frc::Joystick& m_joy; - int m_button1; - int m_button2; + private: + frc::Joystick& m_joy; + int m_button1; + int m_button2; }; diff --git a/wpilibcExamples/src/main/cpp/examples/PotentiometerPID/src/Robot.cpp b/wpilibcExamples/src/main/cpp/examples/PotentiometerPID/src/Robot.cpp index 8dba7e5364..9cd415703d 100644 --- a/wpilibcExamples/src/main/cpp/examples/PotentiometerPID/src/Robot.cpp +++ b/wpilibcExamples/src/main/cpp/examples/PotentiometerPID/src/Robot.cpp @@ -19,62 +19,56 @@ * mechanism. */ class Robot : public frc::IterativeRobot { -public: - void RobotInit() override { m_pidController.SetInputRange(0, 5); } + public: + void RobotInit() override { m_pidController.SetInputRange(0, 5); } - void TeleopInit() override { m_pidController.Enable(); } + void TeleopInit() override { m_pidController.Enable(); } - void TeleopPeriodic() override { - // when the button is pressed once, the selected elevator - // setpoint - // is incremented - bool currentButtonValue = m_joystick.GetTrigger(); - if (currentButtonValue && !m_previousButtonValue) { - // index of the elevator setpoint wraps around. - m_index = (m_index + 1) % (sizeof(kSetPoints) / 8); - } - m_previousButtonValue = currentButtonValue; + void TeleopPeriodic() override { + // When the button is pressed once, the selected elevator setpoint is + // incremented. + bool currentButtonValue = m_joystick.GetTrigger(); + if (currentButtonValue && !m_previousButtonValue) { + // Index of the elevator setpoint wraps around + m_index = (m_index + 1) % (sizeof(kSetPoints) / 8); + } + m_previousButtonValue = currentButtonValue; - m_pidController.SetSetpoint(kSetPoints[m_index]); - } + m_pidController.SetSetpoint(kSetPoints[m_index]); + } -private: - static constexpr int kPotChannel = 1; - static constexpr int kMotorChannel = 7; - static constexpr int kJoystickChannel = 0; + private: + static constexpr int kPotChannel = 1; + static constexpr int kMotorChannel = 7; + static constexpr int kJoystickChannel = 0; - // Bottom, middle, and top elevator setpoints - static constexpr std::array kSetPoints = {{1.0, 2.6, 4.3}}; + // Bottom, middle, and top elevator setpoints + static constexpr std::array kSetPoints = {{1.0, 2.6, 4.3}}; - /* proportional, integral, and derivative speed constants; motor - * inverted - * DANGER: when tuning PID constants, high/inappropriate values for - * pGain, - * iGain, and dGain may cause dangerous, uncontrollable, or - * undesired behavior! - * - * These may need to be positive for a non-inverted motor - */ - static constexpr double kP = -5.0; - static constexpr double kI = -0.02; - static constexpr double kD = -2.0; + /* Proportional, integral, and derivative speed constants; motor inverted. + * + * DANGER: When tuning PID constants, high/inappropriate values for pGain, + * iGain, and dGain may cause dangerous, uncontrollable, or undesired + * behavior! + * + * These may need to be positive for a non-inverted motor. + */ + static constexpr double kP = -5.0; + static constexpr double kI = -0.02; + static constexpr double kD = -2.0; - int m_index = 0; - bool m_previousButtonValue = false; + int m_index = 0; + bool m_previousButtonValue = false; - frc::AnalogInput m_potentiometer{kPotChannel}; - frc::Joystick m_joystick{kJoystickChannel}; - frc::Spark m_elevatorMotor{kMotorChannel}; + frc::AnalogInput m_potentiometer{kPotChannel}; + frc::Joystick m_joystick{kJoystickChannel}; + frc::Spark m_elevatorMotor{kMotorChannel}; - /* potentiometer (AnalogInput) and elevatorMotor (Victor) can be used as - * a - * PIDSource and PIDOutput respectively. The PIDController takes - * pointers - * to the PIDSource and PIDOutput, so you must use &potentiometer and - * &elevatorMotor to get their pointers. - */ - frc::PIDController m_pidController{ - kP, kI, kD, &m_potentiometer, &m_elevatorMotor}; + /* Potentiometer (AnalogInput) and elevatorMotor (Victor) can be used as a + * PIDSource and PIDOutput respectively. + */ + frc::PIDController m_pidController{kP, kI, kD, m_potentiometer, + m_elevatorMotor}; }; constexpr std::array Robot::kSetPoints; diff --git a/wpilibcExamples/src/main/cpp/examples/QuickVision/src/Robot.cpp b/wpilibcExamples/src/main/cpp/examples/QuickVision/src/Robot.cpp index ec22c65b85..03a7924957 100644 --- a/wpilibcExamples/src/main/cpp/examples/QuickVision/src/Robot.cpp +++ b/wpilibcExamples/src/main/cpp/examples/QuickVision/src/Robot.cpp @@ -11,21 +11,20 @@ /** * Uses the CameraServer class to automatically capture video from a USB webcam - * and send it to the FRC dashboard without doing any vision processing. This - * is the easiest way to get camera images to the dashboard. Just add this to - * the + * and send it to the FRC dashboard without doing any vision processing. This is + * the easiest way to get camera images to the dashboard. Just add this to the * RobotInit() method in your program. */ class Robot : public frc::IterativeRobot { -public: - void RobotInit() override { + public: + void RobotInit() override { #if defined(__linux__) - CameraServer::GetInstance()->StartAutomaticCapture(); + CameraServer::GetInstance()->StartAutomaticCapture(); #else - wpi::errs() << "Vision only available on Linux.\n"; - wpi::errs().flush(); + wpi::errs() << "Vision only available on Linux.\n"; + wpi::errs().flush(); #endif - } + } }; START_ROBOT_CLASS(Robot) diff --git a/wpilibcExamples/src/main/cpp/examples/Relay/src/Robot.cpp b/wpilibcExamples/src/main/cpp/examples/Relay/src/Robot.cpp index 99c60ea6f7..a7c986a48b 100644 --- a/wpilibcExamples/src/main/cpp/examples/Relay/src/Robot.cpp +++ b/wpilibcExamples/src/main/cpp/examples/Relay/src/Robot.cpp @@ -11,45 +11,48 @@ /** * This is a sample program which uses joystick buttons to control a relay. + * * A Relay (generally a spike) has two outputs, each of which can be at either - * 0V or 12V and so can be used for actions such as turning a motor off, - * full forwards, or full reverse, and is generally used on the compressor. + * 0V or 12V and so can be used for actions such as turning a motor off, full + * forwards, or full reverse, and is generally used on the compressor. + * * This program uses two buttons on a joystick and each button corresponds to - * one output; pressing the button sets the output to 12V and releasing sets - * it to 0V. + * one output; pressing the button sets the output to 12V and releasing sets it + * to 0V. */ class Robot : public frc::IterativeRobot { -public: - void TeleopPeriodic() override { - /* Retrieve the button values. GetRawButton will return - * true if the button is pressed and false if not. - */ - bool forward = m_stick.GetRawButton(kRelayForwardButton); - bool reverse = m_stick.GetRawButton(kRelayReverseButton); + public: + void TeleopPeriodic() override { + /* Retrieve the button values. GetRawButton() will return true if the button + * is pressed and false if not. + */ + bool forward = m_stick.GetRawButton(kRelayForwardButton); + bool reverse = m_stick.GetRawButton(kRelayReverseButton); - /* Depending on the button values, we want to use one of - * kOn, kOff, kForward, or kReverse. - * kOn sets both outputs to 12V, kOff sets both to 0V, - * kForward sets forward to 12V and reverse to 0V, and - * kReverse sets reverse to 12V and forward to 0V. - */ - if (forward && reverse) { - m_relay.Set(Relay::kOn); - } else if (forward) { - m_relay.Set(Relay::kForward); - } else if (reverse) { - m_relay.Set(Relay::kReverse); - } else { - m_relay.Set(Relay::kOff); - } - } + /* Depending on the button values, we want to use one of kOn, kOff, + * kForward, or kReverse. + * + * kOn sets both outputs to 12V, kOff sets both to 0V. + * kForward sets forward to 12V and reverse to 0V. + * kReverse sets reverse to 12V and forward to 0V. + */ + if (forward && reverse) { + m_relay.Set(Relay::kOn); + } else if (forward) { + m_relay.Set(Relay::kForward); + } else if (reverse) { + m_relay.Set(Relay::kReverse); + } else { + m_relay.Set(Relay::kOff); + } + } -private: - frc::Joystick m_stick{0}; - frc::Relay m_relay{0}; + private: + frc::Joystick m_stick{0}; + frc::Relay m_relay{0}; - static constexpr int kRelayForwardButton = 1; - static constexpr int kRelayReverseButton = 2; + static constexpr int kRelayForwardButton = 1; + static constexpr int kRelayReverseButton = 2; }; START_ROBOT_CLASS(Robot) diff --git a/wpilibcExamples/src/main/cpp/examples/Solenoid/src/Robot.cpp b/wpilibcExamples/src/main/cpp/examples/Solenoid/src/Robot.cpp index f880075af5..0360f4c52a 100644 --- a/wpilibcExamples/src/main/cpp/examples/Solenoid/src/Robot.cpp +++ b/wpilibcExamples/src/main/cpp/examples/Solenoid/src/Robot.cpp @@ -12,56 +12,59 @@ /** * This is a sample program showing the use of the solenoid classes during - * operator control. - * Three buttons from a joystick will be used to control two solenoids: - * One button to control the position of a single solenoid and the other - * two buttons to control a double solenoid. + * operator control. + * + * Three buttons from a joystick will be used to control two solenoids: One + * button to control the position of a single solenoid and the other two buttons + * to control a double solenoid. + * * Single solenoids can either be on or off, such that the air diverted through - * them goes through either one channel or the other. + * them goes through either one channel or the other. + * * Double solenoids have three states: Off, Forward, and Reverse. Forward and - * Reverse divert the air through the two channels and correspond to the - * on and off of a single solenoid, but a double solenoid can also be "off", - * where both channels are diverted to exhaust such that there is no pressure - * in either channel. + * Reverse divert the air through the two channels and correspond to the on and + * off of a single solenoid, but a double solenoid can also be "off", where both + * channels are diverted to exhaust such that there is no pressure in either + * channel. + * * Additionally, double solenoids take up two channels on your PCM whereas - * single solenoids only take a single channel. + * single solenoids only take a single channel. */ class Robot : public frc::IterativeRobot { -public: - void TeleopPeriodic() override { - /* The output of GetRawButton is true/false depending on whether - * the button is pressed; Set takes a boolean for for whether to - * use the default (false) channel or the other (true). - */ - m_solenoid.Set(m_stick.GetRawButton(kSolenoidButton)); + public: + void TeleopPeriodic() override { + /* The output of GetRawButton is true/false depending on whether the button + * is pressed; Set takes a boolean for for whether to use the default + * (false) channel or the other (true). + */ + m_solenoid.Set(m_stick.GetRawButton(kSolenoidButton)); - /* In order to set the double solenoid, we will say that if - * neither - * button is pressed, it is off, if just one button is pressed, - * set the solenoid to correspond to that button, and if both - * are pressed, set the solenoid to Forwards. - */ - if (m_stick.GetRawButton(kDoubleSolenoidForward)) { - m_doubleSolenoid.Set(frc::DoubleSolenoid::kForward); - } else if (m_stick.GetRawButton(kDoubleSolenoidReverse)) { - m_doubleSolenoid.Set(frc::DoubleSolenoid::kReverse); - } else { - m_doubleSolenoid.Set(frc::DoubleSolenoid::kOff); - } - } + /* In order to set the double solenoid, we will say that if neither button + * is pressed, it is off, if just one button is pressed, set the solenoid to + * correspond to that button, and if both are pressed, set the solenoid to + * Forwards. + */ + if (m_stick.GetRawButton(kDoubleSolenoidForward)) { + m_doubleSolenoid.Set(frc::DoubleSolenoid::kForward); + } else if (m_stick.GetRawButton(kDoubleSolenoidReverse)) { + m_doubleSolenoid.Set(frc::DoubleSolenoid::kReverse); + } else { + m_doubleSolenoid.Set(frc::DoubleSolenoid::kOff); + } + } -private: - frc::Joystick m_stick{0}; + private: + frc::Joystick m_stick{0}; - // Solenoid corresponds to a single solenoid. - frc::Solenoid m_solenoid{0}; + // Solenoid corresponds to a single solenoid. + frc::Solenoid m_solenoid{0}; - // DoubleSolenoid corresponds to a double solenoid. - frc::DoubleSolenoid m_doubleSolenoid{1, 2}; + // DoubleSolenoid corresponds to a double solenoid. + frc::DoubleSolenoid m_doubleSolenoid{1, 2}; - static constexpr int kSolenoidButton = 1; - static constexpr int kDoubleSolenoidForward = 2; - static constexpr int kDoubleSolenoidReverse = 3; + static constexpr int kSolenoidButton = 1; + static constexpr int kDoubleSolenoidForward = 2; + static constexpr int kDoubleSolenoidReverse = 3; }; START_ROBOT_CLASS(Robot) diff --git a/wpilibcExamples/src/main/cpp/examples/Ultrasonic/src/Robot.cpp b/wpilibcExamples/src/main/cpp/examples/Ultrasonic/src/Robot.cpp index 080fd72432..2d4e0dc0a2 100644 --- a/wpilibcExamples/src/main/cpp/examples/Ultrasonic/src/Robot.cpp +++ b/wpilibcExamples/src/main/cpp/examples/Ultrasonic/src/Robot.cpp @@ -15,40 +15,39 @@ * proportional control to maintain a set distance from an object. */ class Robot : public frc::IterativeRobot { -public: - /** - * Tells the robot to drive to a set distance (in inches) from an object - * using proportional control. - */ - void TeleopPeriodic() override { - // sensor returns a value from 0-4095 that is scaled to inches - double currentDistance = - m_ultrasonic.GetValue() * kValueToInches; - // convert distance error to a motor speed - double currentSpeed = (kHoldDistance - currentDistance) * kP; - // drive robot - m_robotDrive.ArcadeDrive(currentSpeed, 0); - } + public: + /** + * Tells the robot to drive to a set distance (in inches) from an object using + * proportional control. + */ + void TeleopPeriodic() override { + // Sensor returns a value from 0-4095 that is scaled to inches + double currentDistance = m_ultrasonic.GetValue() * kValueToInches; + // Convert distance error to a motor speed + double currentSpeed = (kHoldDistance - currentDistance) * kP; + // Drive robot + m_robotDrive.ArcadeDrive(currentSpeed, 0); + } -private: - // Distance in inches the robot wants to stay from an object - static constexpr int kHoldDistance = 12; + private: + // Distance in inches the robot wants to stay from an object + static constexpr int kHoldDistance = 12; - // Factor to convert sensor values to a distance in inches - static constexpr double kValueToInches = 0.125; + // Factor to convert sensor values to a distance in inches + static constexpr double kValueToInches = 0.125; - // Proportional speed constant - static constexpr double kP = 0.05; + // Proportional speed constant + static constexpr double kP = 0.05; - static constexpr int kLeftMotorPort = 0; - static constexpr int kRightMotorPort = 1; - static constexpr int kUltrasonicPort = 0; + static constexpr int kLeftMotorPort = 0; + static constexpr int kRightMotorPort = 1; + static constexpr int kUltrasonicPort = 0; - frc::AnalogInput m_ultrasonic{kUltrasonicPort}; + frc::AnalogInput m_ultrasonic{kUltrasonicPort}; - frc::Spark m_left{kLeftMotorPort}; - frc::Spark m_right{kRightMotorPort}; - frc::DifferentialDrive m_robotDrive{m_left, m_right}; + frc::Spark m_left{kLeftMotorPort}; + frc::Spark m_right{kRightMotorPort}; + frc::DifferentialDrive m_robotDrive{m_left, m_right}; }; START_ROBOT_CLASS(Robot) diff --git a/wpilibcExamples/src/main/cpp/examples/UltrasonicPID/src/Robot.cpp b/wpilibcExamples/src/main/cpp/examples/UltrasonicPID/src/Robot.cpp index e0576af8fc..73488ffeb0 100644 --- a/wpilibcExamples/src/main/cpp/examples/UltrasonicPID/src/Robot.cpp +++ b/wpilibcExamples/src/main/cpp/examples/UltrasonicPID/src/Robot.cpp @@ -17,70 +17,67 @@ * proportional control to maintain a set distance from an object. */ class Robot : public frc::IterativeRobot { -public: - /** - * Drives the robot a set distance from an object using PID control and - * the - * ultrasonic sensor. - */ - void TeleopInit() override { - // Set expected range to 0-24 inches; e.g. at 24 inches from - // object go - // full forward, at 0 inches from object go full backward. - m_pidController.SetInputRange(0, 24 * kValueToInches); + public: + /** + * Drives the robot a set distance from an object using PID control and the + * ultrasonic sensor. + */ + void TeleopInit() override { + // Set expected range to 0-24 inches; e.g. at 24 inches from object go full + // forward, at 0 inches from object go full backward. + m_pidController.SetInputRange(0, 24 * kValueToInches); - // Set setpoint of the pidController - m_pidController.SetSetpoint(kHoldDistance * kValueToInches); + // Set setpoint of the PID Controller + m_pidController.SetSetpoint(kHoldDistance * kValueToInches); - // Begin PID control - m_pidController.Enable(); - } + // Begin PID control + m_pidController.Enable(); + } -private: - // Internal class to write to robot drive using a PIDOutput - class MyPIDOutput : public frc::PIDOutput { - public: - explicit MyPIDOutput(frc::DifferentialDrive& r) - : m_rd(r) { - m_rd.SetSafetyEnabled(false); - } + private: + // Internal class to write to robot drive using a PIDOutput + class MyPIDOutput : public frc::PIDOutput { + public: + explicit MyPIDOutput(frc::DifferentialDrive& r) : m_rd(r) { + m_rd.SetSafetyEnabled(false); + } - void PIDWrite(double output) override { - // Write to robot drive by reference - m_rd.ArcadeDrive(output, 0); - } + void PIDWrite(double output) override { + // Write to robot drive by reference + m_rd.ArcadeDrive(output, 0); + } - private: - frc::DifferentialDrive& m_rd; - }; + private: + frc::DifferentialDrive& m_rd; + }; - // Distance in inches the robot wants to stay from an object - static constexpr int kHoldDistance = 12; + // Distance in inches the robot wants to stay from an object + static constexpr int kHoldDistance = 12; - // Factor to convert sensor values to a distance in inches - static constexpr double kValueToInches = 0.125; + // Factor to convert sensor values to a distance in inches + static constexpr double kValueToInches = 0.125; - // proportional speed constant - static constexpr double kP = 7.0; + // proportional speed constant + static constexpr double kP = 7.0; - // integral speed constant - static constexpr double kI = 0.018; + // integral speed constant + static constexpr double kI = 0.018; - // derivative speed constant - static constexpr double kD = 1.5; + // derivative speed constant + static constexpr double kD = 1.5; - static constexpr int kLeftMotorPort = 0; - static constexpr int kRightMotorPort = 1; - static constexpr int kUltrasonicPort = 0; + static constexpr int kLeftMotorPort = 0; + static constexpr int kRightMotorPort = 1; + static constexpr int kUltrasonicPort = 0; - frc::AnalogInput m_ultrasonic{kUltrasonicPort}; + frc::AnalogInput m_ultrasonic{kUltrasonicPort}; - frc::Spark m_left{kLeftMotorPort}; - frc::Spark m_right{kRightMotorPort}; - frc::DifferentialDrive m_robotDrive{m_left, m_right}; + frc::Spark m_left{kLeftMotorPort}; + frc::Spark m_right{kRightMotorPort}; + frc::DifferentialDrive m_robotDrive{m_left, m_right}; + MyPIDOutput m_pidOutput{m_robotDrive}; - frc::PIDController m_pidController{kP, kI, kD, &m_ultrasonic, - new MyPIDOutput(m_robotDrive)}; + frc::PIDController m_pidController{kP, kI, kD, m_ultrasonic, m_pidOutput}; }; START_ROBOT_CLASS(Robot) diff --git a/wpilibcExamples/src/main/cpp/templates/commandbased/Commands/ExampleCommand.cpp b/wpilibcExamples/src/main/cpp/templates/commandbased/Commands/ExampleCommand.cpp index d0ca243eae..0986d1f4c1 100644 --- a/wpilibcExamples/src/main/cpp/templates/commandbased/Commands/ExampleCommand.cpp +++ b/wpilibcExamples/src/main/cpp/templates/commandbased/Commands/ExampleCommand.cpp @@ -10,8 +10,8 @@ #include "../Robot.h" ExampleCommand::ExampleCommand() { - // Use Requires() here to declare subsystem dependencies - Requires(&Robot::m_subsystem); + // Use Requires() here to declare subsystem dependencies + Requires(&Robot::m_subsystem); } // Called just before this Command runs the first time @@ -21,9 +21,7 @@ void ExampleCommand::Initialize() {} void ExampleCommand::Execute() {} // Make this return true when this Command no longer needs to run execute() -bool ExampleCommand::IsFinished() { - return false; -} +bool ExampleCommand::IsFinished() { return false; } // Called once after isFinished returns true void ExampleCommand::End() {} diff --git a/wpilibcExamples/src/main/cpp/templates/commandbased/Commands/ExampleCommand.h b/wpilibcExamples/src/main/cpp/templates/commandbased/Commands/ExampleCommand.h index 44a9e5c6c7..05f910a51e 100644 --- a/wpilibcExamples/src/main/cpp/templates/commandbased/Commands/ExampleCommand.h +++ b/wpilibcExamples/src/main/cpp/templates/commandbased/Commands/ExampleCommand.h @@ -10,11 +10,11 @@ #include class ExampleCommand : public frc::Command { -public: - ExampleCommand(); - void Initialize() override; - void Execute() override; - bool IsFinished() override; - void End() override; - void Interrupted() override; + public: + ExampleCommand(); + void Initialize() override; + void Execute() override; + bool IsFinished() override; + void End() override; + void Interrupted() override; }; diff --git a/wpilibcExamples/src/main/cpp/templates/commandbased/Commands/MyAutoCommand.cpp b/wpilibcExamples/src/main/cpp/templates/commandbased/Commands/MyAutoCommand.cpp index 210ead2209..1d03e7493b 100644 --- a/wpilibcExamples/src/main/cpp/templates/commandbased/Commands/MyAutoCommand.cpp +++ b/wpilibcExamples/src/main/cpp/templates/commandbased/Commands/MyAutoCommand.cpp @@ -10,8 +10,8 @@ #include "../Robot.h" MyAutoCommand::MyAutoCommand() { - // Use Requires() here to declare subsystem dependencies - Requires(&Robot::m_subsystem); + // Use Requires() here to declare subsystem dependencies + Requires(&Robot::m_subsystem); } // Called just before this Command runs the first time @@ -21,9 +21,7 @@ void MyAutoCommand::Initialize() {} void MyAutoCommand::Execute() {} // Make this return true when this Command no longer needs to run execute() -bool MyAutoCommand::IsFinished() { - return false; -} +bool MyAutoCommand::IsFinished() { return false; } // Called once after isFinished returns true void MyAutoCommand::End() {} diff --git a/wpilibcExamples/src/main/cpp/templates/commandbased/Commands/MyAutoCommand.h b/wpilibcExamples/src/main/cpp/templates/commandbased/Commands/MyAutoCommand.h index 452753bb0d..d3970e614d 100644 --- a/wpilibcExamples/src/main/cpp/templates/commandbased/Commands/MyAutoCommand.h +++ b/wpilibcExamples/src/main/cpp/templates/commandbased/Commands/MyAutoCommand.h @@ -10,11 +10,11 @@ #include class MyAutoCommand : public frc::Command { -public: - MyAutoCommand(); - void Initialize() override; - void Execute() override; - bool IsFinished() override; - void End() override; - void Interrupted() override; + public: + MyAutoCommand(); + void Initialize() override; + void Execute() override; + bool IsFinished() override; + void End() override; + void Interrupted() override; }; diff --git a/wpilibcExamples/src/main/cpp/templates/commandbased/OI.cpp b/wpilibcExamples/src/main/cpp/templates/commandbased/OI.cpp index bc51ff6dcb..a196ec266f 100644 --- a/wpilibcExamples/src/main/cpp/templates/commandbased/OI.cpp +++ b/wpilibcExamples/src/main/cpp/templates/commandbased/OI.cpp @@ -10,5 +10,5 @@ #include OI::OI() { - // Process operator interface input here. + // Process operator interface input here. } diff --git a/wpilibcExamples/src/main/cpp/templates/commandbased/OI.h b/wpilibcExamples/src/main/cpp/templates/commandbased/OI.h index 345b25aa48..0b7713ee42 100644 --- a/wpilibcExamples/src/main/cpp/templates/commandbased/OI.h +++ b/wpilibcExamples/src/main/cpp/templates/commandbased/OI.h @@ -8,6 +8,6 @@ #pragma once class OI { -public: - OI(); + public: + OI(); }; diff --git a/wpilibcExamples/src/main/cpp/templates/commandbased/Robot.cpp b/wpilibcExamples/src/main/cpp/templates/commandbased/Robot.cpp index 44bff4cb66..e47fa86653 100644 --- a/wpilibcExamples/src/main/cpp/templates/commandbased/Robot.cpp +++ b/wpilibcExamples/src/main/cpp/templates/commandbased/Robot.cpp @@ -14,9 +14,9 @@ ExampleSubsystem Robot::m_subsystem; OI Robot::m_oi; void Robot::RobotInit() { - m_chooser.AddDefault("Default Auto", &m_defaultAuto); - m_chooser.AddObject("My Auto", &m_myAuto); - frc::SmartDashboard::PutData("Auto Modes", &m_chooser); + m_chooser.AddDefault("Default Auto", &m_defaultAuto); + m_chooser.AddObject("My Auto", &m_myAuto); + frc::SmartDashboard::PutData("Auto Modes", &m_chooser); } /** @@ -26,9 +26,7 @@ void Robot::RobotInit() { */ void Robot::DisabledInit() {} -void Robot::DisabledPeriodic() { - frc::Scheduler::GetInstance()->Run(); -} +void Robot::DisabledPeriodic() { frc::Scheduler::GetInstance()->Run(); } /** * This autonomous (along with the chooser code above) shows how to select @@ -42,39 +40,35 @@ void Robot::DisabledPeriodic() { * the if-else structure below with additional strings & commands. */ void Robot::AutonomousInit() { - // std::string autoSelected = frc::SmartDashboard::GetString( - // "Auto Selector", "Default"); - // if (autoSelected == "My Auto") { - // m_autonomousCommand = &m_myAuto; - // } else { - // m_autonomousCommand = &m_defaultAuto; - // } + // std::string autoSelected = frc::SmartDashboard::GetString( + // "Auto Selector", "Default"); + // if (autoSelected == "My Auto") { + // m_autonomousCommand = &m_myAuto; + // } else { + // m_autonomousCommand = &m_defaultAuto; + // } - m_autonomousCommand = m_chooser.GetSelected(); + m_autonomousCommand = m_chooser.GetSelected(); - if (m_autonomousCommand != nullptr) { - m_autonomousCommand->Start(); - } + if (m_autonomousCommand != nullptr) { + m_autonomousCommand->Start(); + } } -void Robot::AutonomousPeriodic() { - frc::Scheduler::GetInstance()->Run(); -} +void Robot::AutonomousPeriodic() { frc::Scheduler::GetInstance()->Run(); } void Robot::TeleopInit() { - // This makes sure that the autonomous stops running when - // teleop starts running. If you want the autonomous to - // continue until interrupted by another command, remove - // this line or comment it out. - if (m_autonomousCommand != nullptr) { - m_autonomousCommand->Cancel(); - m_autonomousCommand = nullptr; - } + // This makes sure that the autonomous stops running when + // teleop starts running. If you want the autonomous to + // continue until interrupted by another command, remove + // this line or comment it out. + if (m_autonomousCommand != nullptr) { + m_autonomousCommand->Cancel(); + m_autonomousCommand = nullptr; + } } -void Robot::TeleopPeriodic() { - frc::Scheduler::GetInstance()->Run(); -} +void Robot::TeleopPeriodic() { frc::Scheduler::GetInstance()->Run(); } void Robot::TestPeriodic() {} diff --git a/wpilibcExamples/src/main/cpp/templates/commandbased/Robot.h b/wpilibcExamples/src/main/cpp/templates/commandbased/Robot.h index 8620415d9e..ee87a84933 100644 --- a/wpilibcExamples/src/main/cpp/templates/commandbased/Robot.h +++ b/wpilibcExamples/src/main/cpp/templates/commandbased/Robot.h @@ -17,24 +17,24 @@ #include "Subsystems/ExampleSubsystem.h" class Robot : public frc::TimedRobot { -public: - static ExampleSubsystem m_subsystem; - static OI m_oi; + public: + static ExampleSubsystem m_subsystem; + static OI m_oi; - void RobotInit() override; - void DisabledInit() override; - void DisabledPeriodic() override; - void AutonomousInit() override; - void AutonomousPeriodic() override; - void TeleopInit() override; - void TeleopPeriodic() override; - void TestPeriodic() override; + void RobotInit() override; + void DisabledInit() override; + void DisabledPeriodic() override; + void AutonomousInit() override; + void AutonomousPeriodic() override; + void TeleopInit() override; + void TeleopPeriodic() override; + void TestPeriodic() override; -private: - // Have it null by default so that if testing teleop it - // doesn't have undefined behavior and potentially crash. - frc::Command* m_autonomousCommand = nullptr; - ExampleCommand m_defaultAuto; - MyAutoCommand m_myAuto; - frc::SendableChooser m_chooser; + private: + // Have it null by default so that if testing teleop it + // doesn't have undefined behavior and potentially crash. + frc::Command* m_autonomousCommand = nullptr; + ExampleCommand m_defaultAuto; + MyAutoCommand m_myAuto; + frc::SendableChooser m_chooser; }; diff --git a/wpilibcExamples/src/main/cpp/templates/commandbased/Subsystems/ExampleSubsystem.cpp b/wpilibcExamples/src/main/cpp/templates/commandbased/Subsystems/ExampleSubsystem.cpp index da1312539b..7a12258638 100644 --- a/wpilibcExamples/src/main/cpp/templates/commandbased/Subsystems/ExampleSubsystem.cpp +++ b/wpilibcExamples/src/main/cpp/templates/commandbased/Subsystems/ExampleSubsystem.cpp @@ -9,12 +9,11 @@ #include "../RobotMap.h" -ExampleSubsystem::ExampleSubsystem() - : frc::Subsystem("ExampleSubsystem") {} +ExampleSubsystem::ExampleSubsystem() : frc::Subsystem("ExampleSubsystem") {} void ExampleSubsystem::InitDefaultCommand() { - // Set the default command for a subsystem here. - // SetDefaultCommand(new MySpecialCommand()); + // Set the default command for a subsystem here. + // SetDefaultCommand(new MySpecialCommand()); } // Put methods for controlling this subsystem diff --git a/wpilibcExamples/src/main/cpp/templates/commandbased/Subsystems/ExampleSubsystem.h b/wpilibcExamples/src/main/cpp/templates/commandbased/Subsystems/ExampleSubsystem.h index d64acb0ea6..219ed11bb0 100644 --- a/wpilibcExamples/src/main/cpp/templates/commandbased/Subsystems/ExampleSubsystem.h +++ b/wpilibcExamples/src/main/cpp/templates/commandbased/Subsystems/ExampleSubsystem.h @@ -10,11 +10,11 @@ #include class ExampleSubsystem : public frc::Subsystem { -public: - ExampleSubsystem(); - void InitDefaultCommand() override; + public: + ExampleSubsystem(); + void InitDefaultCommand() override; -private: - // It's desirable that everything possible under private except - // for methods that implement subsystem capabilities + private: + // It's desirable that everything possible under private except + // for methods that implement subsystem capabilities }; diff --git a/wpilibcExamples/src/main/cpp/templates/iterative/Robot.cpp b/wpilibcExamples/src/main/cpp/templates/iterative/Robot.cpp index 299576ae7d..dcea8e2c41 100644 --- a/wpilibcExamples/src/main/cpp/templates/iterative/Robot.cpp +++ b/wpilibcExamples/src/main/cpp/templates/iterative/Robot.cpp @@ -12,9 +12,9 @@ #include void Robot::RobotInit() { - m_chooser.AddDefault(kAutoNameDefault, kAutoNameDefault); - m_chooser.AddObject(kAutoNameCustom, kAutoNameCustom); - frc::SmartDashboard::PutData("Auto Modes", &m_chooser); + m_chooser.AddDefault(kAutoNameDefault, kAutoNameDefault); + m_chooser.AddObject(kAutoNameCustom, kAutoNameCustom); + frc::SmartDashboard::PutData("Auto Modes", &m_chooser); } /** @@ -29,24 +29,24 @@ void Robot::RobotInit() { * make sure to add them to the chooser code above as well. */ void Robot::AutonomousInit() { - m_autoSelected = m_chooser.GetSelected(); - // m_autoSelected = SmartDashboard::GetString( - // "Auto Selector", kAutoNameDefault); - std::cout << "Auto selected: " << m_autoSelected << std::endl; + m_autoSelected = m_chooser.GetSelected(); + // m_autoSelected = SmartDashboard::GetString( + // "Auto Selector", kAutoNameDefault); + std::cout << "Auto selected: " << m_autoSelected << std::endl; - if (m_autoSelected == kAutoNameCustom) { - // Custom Auto goes here - } else { - // Default Auto goes here - } + if (m_autoSelected == kAutoNameCustom) { + // Custom Auto goes here + } else { + // Default Auto goes here + } } void Robot::AutonomousPeriodic() { - if (m_autoSelected == kAutoNameCustom) { - // Custom Auto goes here - } else { - // Default Auto goes here - } + if (m_autoSelected == kAutoNameCustom) { + // Custom Auto goes here + } else { + // Default Auto goes here + } } void Robot::TeleopInit() {} diff --git a/wpilibcExamples/src/main/cpp/templates/iterative/Robot.h b/wpilibcExamples/src/main/cpp/templates/iterative/Robot.h index 0784af3fff..6d6302e168 100644 --- a/wpilibcExamples/src/main/cpp/templates/iterative/Robot.h +++ b/wpilibcExamples/src/main/cpp/templates/iterative/Robot.h @@ -13,17 +13,17 @@ #include class Robot : public frc::IterativeRobot { -public: - void RobotInit() override; - void AutonomousInit() override; - void AutonomousPeriodic() override; - void TeleopInit() override; - void TeleopPeriodic() override; - void TestPeriodic() override; + public: + void RobotInit() override; + void AutonomousInit() override; + void AutonomousPeriodic() override; + void TeleopInit() override; + void TeleopPeriodic() override; + void TestPeriodic() override; -private: - frc::SendableChooser m_chooser; - const std::string kAutoNameDefault = "Default"; - const std::string kAutoNameCustom = "My Auto"; - std::string m_autoSelected; + private: + frc::SendableChooser m_chooser; + const std::string kAutoNameDefault = "Default"; + const std::string kAutoNameCustom = "My Auto"; + std::string m_autoSelected; }; diff --git a/wpilibcExamples/src/main/cpp/templates/sample/Robot.cpp b/wpilibcExamples/src/main/cpp/templates/sample/Robot.cpp index b442bd99c6..9a6b2bde91 100644 --- a/wpilibcExamples/src/main/cpp/templates/sample/Robot.cpp +++ b/wpilibcExamples/src/main/cpp/templates/sample/Robot.cpp @@ -13,15 +13,15 @@ #include Robot::Robot() { - // Note SmartDashboard is not initialized here, wait until - // RobotInit to make SmartDashboard calls - m_robotDrive.SetExpiration(0.1); + // Note SmartDashboard is not initialized here, wait until RobotInit() to make + // SmartDashboard calls + m_robotDrive.SetExpiration(0.1); } void Robot::RobotInit() { - m_chooser.AddDefault(kAutoNameDefault, kAutoNameDefault); - m_chooser.AddObject(kAutoNameCustom, kAutoNameCustom); - frc::SmartDashboard::PutData("Auto Modes", &m_chooser); + m_chooser.AddDefault(kAutoNameDefault, kAutoNameDefault); + m_chooser.AddObject(kAutoNameCustom, kAutoNameCustom); + frc::SmartDashboard::PutData("Auto Modes", &m_chooser); } /** @@ -36,51 +36,50 @@ void Robot::RobotInit() { * make sure to add them to the chooser code above as well. */ void Robot::Autonomous() { - std::string autoSelected = m_chooser.GetSelected(); - // std::string autoSelected = frc::SmartDashboard::GetString( - // "Auto Selector", kAutoNameDefault); - std::cout << "Auto selected: " << autoSelected << std::endl; + std::string autoSelected = m_chooser.GetSelected(); + // std::string autoSelected = frc::SmartDashboard::GetString( + // "Auto Selector", kAutoNameDefault); + std::cout << "Auto selected: " << autoSelected << std::endl; - // MotorSafety improves safety when motors are updated in loops - // but is disabled here because motor updates are not looped in - // this autonomous mode. - m_robotDrive.SetSafetyEnabled(false); + // MotorSafety improves safety when motors are updated in loops but is + // disabled here because motor updates are not looped in this autonomous mode. + m_robotDrive.SetSafetyEnabled(false); - if (autoSelected == kAutoNameCustom) { - // Custom Auto goes here - std::cout << "Running custom Autonomous" << std::endl; + if (autoSelected == kAutoNameCustom) { + // Custom Auto goes here + std::cout << "Running custom Autonomous" << std::endl; - // Spin at half speed for two seconds - m_robotDrive.ArcadeDrive(0.0, 0.5); - frc::Wait(2.0); + // Spin at half speed for two seconds + m_robotDrive.ArcadeDrive(0.0, 0.5); + frc::Wait(2.0); - // Stop robot - m_robotDrive.ArcadeDrive(0.0, 0.0); - } else { - // Default Auto goes here - std::cout << "Running default Autonomous" << std::endl; + // Stop robot + m_robotDrive.ArcadeDrive(0.0, 0.0); + } else { + // Default Auto goes here + std::cout << "Running default Autonomous" << std::endl; - // Drive forwards at half speed for two seconds - m_robotDrive.ArcadeDrive(-0.5, 0.0); - frc::Wait(2.0); + // Drive forwards at half speed for two seconds + m_robotDrive.ArcadeDrive(-0.5, 0.0); + frc::Wait(2.0); - // Stop robot - m_robotDrive.ArcadeDrive(0.0, 0.0); - } + // Stop robot + m_robotDrive.ArcadeDrive(0.0, 0.0); + } } /** * Runs the motors with arcade steering. */ void Robot::OperatorControl() { - m_robotDrive.SetSafetyEnabled(true); - while (IsOperatorControl() && IsEnabled()) { - // Drive with arcade style (use right stick) - m_robotDrive.ArcadeDrive(-m_stick.GetY(), m_stick.GetX()); + m_robotDrive.SetSafetyEnabled(true); + while (IsOperatorControl() && IsEnabled()) { + // Drive with arcade style (use right stick) + m_robotDrive.ArcadeDrive(-m_stick.GetY(), m_stick.GetX()); - // The motors will be updated every 5ms - frc::Wait(0.005); - } + // The motors will be updated every 5ms + frc::Wait(0.005); + } } /** diff --git a/wpilibcExamples/src/main/cpp/templates/sample/Robot.h b/wpilibcExamples/src/main/cpp/templates/sample/Robot.h index d48b0f2b4f..0bc80c94b4 100644 --- a/wpilibcExamples/src/main/cpp/templates/sample/Robot.h +++ b/wpilibcExamples/src/main/cpp/templates/sample/Robot.h @@ -16,11 +16,10 @@ #include /** - * This is a demo program showing the use of the DifferentialDrive class. - * The SampleRobot class is the base of a robot application that will - * automatically call your Autonomous and OperatorControl methods at the right - * time as controlled by the switches on the driver station or the field - * controls. + * This is a demo program showing the use of the DifferentialDrive class. The + * SampleRobot class is the base of a robot application that will automatically + * call your Autonomous and OperatorControl methods at the right time as + * controlled by the switches on the driver station or the field controls. * * WARNING: While it may look like a good choice to use for your code if you're * inexperienced, don't. Unless you know what you are doing, complex code will @@ -28,23 +27,23 @@ * instead if you're new. */ class Robot : public frc::SampleRobot { -public: - Robot(); + public: + Robot(); - void RobotInit() override; - void Autonomous() override; - void OperatorControl() override; - void Test() override; + void RobotInit() override; + void Autonomous() override; + void OperatorControl() override; + void Test() override; -private: - // Robot drive system - frc::Spark m_leftMotor{0}; - frc::Spark m_rightMotor{1}; - frc::DifferentialDrive m_robotDrive{m_leftMotor, m_rightMotor}; + private: + // Robot drive system + frc::Spark m_leftMotor{0}; + frc::Spark m_rightMotor{1}; + frc::DifferentialDrive m_robotDrive{m_leftMotor, m_rightMotor}; - frc::Joystick m_stick{0}; + frc::Joystick m_stick{0}; - frc::SendableChooser m_chooser; - const std::string kAutoNameDefault = "Default"; - const std::string kAutoNameCustom = "My Auto"; + frc::SendableChooser m_chooser; + const std::string kAutoNameDefault = "Default"; + const std::string kAutoNameCustom = "My Auto"; }; diff --git a/wpilibcExamples/src/main/cpp/templates/timed/Robot.cpp b/wpilibcExamples/src/main/cpp/templates/timed/Robot.cpp index 885911dfc1..7a7421c7d5 100644 --- a/wpilibcExamples/src/main/cpp/templates/timed/Robot.cpp +++ b/wpilibcExamples/src/main/cpp/templates/timed/Robot.cpp @@ -12,9 +12,9 @@ #include void Robot::RobotInit() { - m_chooser.AddDefault(kAutoNameDefault, kAutoNameDefault); - m_chooser.AddObject(kAutoNameCustom, kAutoNameCustom); - frc::SmartDashboard::PutData("Auto Modes", &m_chooser); + m_chooser.AddDefault(kAutoNameDefault, kAutoNameDefault); + m_chooser.AddObject(kAutoNameCustom, kAutoNameCustom); + frc::SmartDashboard::PutData("Auto Modes", &m_chooser); } /** @@ -29,24 +29,24 @@ void Robot::RobotInit() { * make sure to add them to the chooser code above as well. */ void Robot::AutonomousInit() { - m_autoSelected = m_chooser.GetSelected(); - // m_autoSelected = SmartDashboard::GetString("Auto Selector", - // kAutoNameDefault); - std::cout << "Auto selected: " << m_autoSelected << std::endl; + m_autoSelected = m_chooser.GetSelected(); + // m_autoSelected = SmartDashboard::GetString("Auto Selector", + // kAutoNameDefault); + std::cout << "Auto selected: " << m_autoSelected << std::endl; - if (m_autoSelected == kAutoNameCustom) { - // Custom Auto goes here - } else { - // Default Auto goes here - } + if (m_autoSelected == kAutoNameCustom) { + // Custom Auto goes here + } else { + // Default Auto goes here + } } void Robot::AutonomousPeriodic() { - if (m_autoSelected == kAutoNameCustom) { - // Custom Auto goes here - } else { - // Default Auto goes here - } + if (m_autoSelected == kAutoNameCustom) { + // Custom Auto goes here + } else { + // Default Auto goes here + } } void Robot::TeleopInit() {} diff --git a/wpilibcExamples/src/main/cpp/templates/timed/Robot.h b/wpilibcExamples/src/main/cpp/templates/timed/Robot.h index 13581f78c3..6d63f312ce 100644 --- a/wpilibcExamples/src/main/cpp/templates/timed/Robot.h +++ b/wpilibcExamples/src/main/cpp/templates/timed/Robot.h @@ -13,17 +13,17 @@ #include class Robot : public frc::TimedRobot { -public: - void RobotInit() override; - void AutonomousInit() override; - void AutonomousPeriodic() override; - void TeleopInit() override; - void TeleopPeriodic() override; - void TestPeriodic() override; + public: + void RobotInit() override; + void AutonomousInit() override; + void AutonomousPeriodic() override; + void TeleopInit() override; + void TeleopPeriodic() override; + void TestPeriodic() override; -private: - frc::SendableChooser m_chooser; - const std::string kAutoNameDefault = "Default"; - const std::string kAutoNameCustom = "My Auto"; - std::string m_autoSelected; + private: + frc::SendableChooser m_chooser; + const std::string kAutoNameDefault = "Default"; + const std::string kAutoNameCustom = "My Auto"; + std::string m_autoSelected; }; diff --git a/wpilibcIntegrationTests/src/main/native/cpp/FilterNoiseTest.cpp b/wpilibcIntegrationTests/src/main/native/cpp/FilterNoiseTest.cpp index 2d44f9d4b6..bfa3ebfcf2 100644 --- a/wpilibcIntegrationTests/src/main/native/cpp/FilterNoiseTest.cpp +++ b/wpilibcIntegrationTests/src/main/native/cpp/FilterNoiseTest.cpp @@ -126,4 +126,4 @@ TEST_P(FilterNoiseTest, NoiseReduce) { } INSTANTIATE_TEST_CASE_P(Test, FilterNoiseTest, - testing::Values(TEST_SINGLE_POLE_IIR, TEST_MOVAVG),); + testing::Values(TEST_SINGLE_POLE_IIR, TEST_MOVAVG), ); diff --git a/wpilibcIntegrationTests/src/main/native/cpp/FilterOutputTest.cpp b/wpilibcIntegrationTests/src/main/native/cpp/FilterOutputTest.cpp index 11def2907c..45a23ce7ee 100644 --- a/wpilibcIntegrationTests/src/main/native/cpp/FilterOutputTest.cpp +++ b/wpilibcIntegrationTests/src/main/native/cpp/FilterOutputTest.cpp @@ -147,4 +147,4 @@ TEST_P(FilterOutputTest, FilterOutput) { INSTANTIATE_TEST_CASE_P(Test, FilterOutputTest, testing::Values(TEST_SINGLE_POLE_IIR, TEST_HIGH_PASS, - TEST_MOVAVG, TEST_PULSE),); + TEST_MOVAVG, TEST_PULSE), ); diff --git a/wpilibcIntegrationTests/src/main/native/cpp/MotorEncoderTest.cpp b/wpilibcIntegrationTests/src/main/native/cpp/MotorEncoderTest.cpp index ab7d3f424c..9908b2993f 100644 --- a/wpilibcIntegrationTests/src/main/native/cpp/MotorEncoderTest.cpp +++ b/wpilibcIntegrationTests/src/main/native/cpp/MotorEncoderTest.cpp @@ -190,4 +190,5 @@ TEST_P(MotorEncoderTest, Reset) { } INSTANTIATE_TEST_CASE_P(Test, MotorEncoderTest, - testing::Values(TEST_VICTOR, TEST_JAGUAR, TEST_TALON),); + testing::Values(TEST_VICTOR, TEST_JAGUAR, + TEST_TALON), ); diff --git a/wpilibcIntegrationTests/src/main/native/cpp/MotorInvertingTest.cpp b/wpilibcIntegrationTests/src/main/native/cpp/MotorInvertingTest.cpp index d233545a9e..1d66c1b84d 100644 --- a/wpilibcIntegrationTests/src/main/native/cpp/MotorInvertingTest.cpp +++ b/wpilibcIntegrationTests/src/main/native/cpp/MotorInvertingTest.cpp @@ -153,4 +153,5 @@ TEST_P(MotorInvertingTest, InvertingSwitchingNegToPos) { } INSTANTIATE_TEST_CASE_P(Test, MotorInvertingTest, - testing::Values(TEST_VICTOR, TEST_JAGUAR, TEST_TALON),); + testing::Values(TEST_VICTOR, TEST_JAGUAR, + TEST_TALON), ); diff --git a/wpilibcIntegrationTests/src/main/native/dt/main.cpp b/wpilibcIntegrationTests/src/main/native/dt/main.cpp index 237c8ce181..e324b44c88 100644 --- a/wpilibcIntegrationTests/src/main/native/dt/main.cpp +++ b/wpilibcIntegrationTests/src/main/native/dt/main.cpp @@ -1 +1,8 @@ +/*----------------------------------------------------------------------------*/ +/* Copyright (c) 2018 FIRST. 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. */ +/*----------------------------------------------------------------------------*/ + int main() {} diff --git a/wpilibjExamples/build.gradle b/wpilibjExamples/build.gradle index 474e70ef85..371346df3e 100644 --- a/wpilibjExamples/build.gradle +++ b/wpilibjExamples/build.gradle @@ -22,7 +22,7 @@ dependencies { } checkstyle { - configFile = new File(rootDir, "styleguide/checkstyleEclipse.xml") + configFile = new File(rootDir, "styleguide/checkstyleExamples.xml") } pmd { diff --git a/wpilibjExamples/src/main/java/edu/wpi/first/wpilibj/examples/axiscamera/Robot.java b/wpilibjExamples/src/main/java/edu/wpi/first/wpilibj/examples/axiscamera/Robot.java index 952823d391..0e98a2fec2 100644 --- a/wpilibjExamples/src/main/java/edu/wpi/first/wpilibj/examples/axiscamera/Robot.java +++ b/wpilibjExamples/src/main/java/edu/wpi/first/wpilibj/examples/axiscamera/Robot.java @@ -24,46 +24,46 @@ import org.opencv.imgproc.Imgproc; * processing. */ public class Robot extends IterativeRobot { - Thread m_visionThread; + Thread m_visionThread; - @Override - public void robotInit() { - m_visionThread = new Thread(() -> { - // Get the Axis camera from CameraServer - AxisCamera camera - = CameraServer.getInstance().addAxisCamera("axis-camera.local"); - // Set the resolution - camera.setResolution(640, 480); + @Override + public void robotInit() { + m_visionThread = new Thread(() -> { + // Get the Axis camera from CameraServer + AxisCamera camera + = CameraServer.getInstance().addAxisCamera("axis-camera.local"); + // Set the resolution + camera.setResolution(640, 480); - // Get a CvSink. This will capture Mats from the camera - CvSink cvSink = CameraServer.getInstance().getVideo(); - // Setup a CvSource. This will send images back to the Dashboard - CvSource outputStream - = CameraServer.getInstance().putVideo("Rectangle", 640, 480); + // Get a CvSink. This will capture Mats from the camera + CvSink cvSink = CameraServer.getInstance().getVideo(); + // Setup a CvSource. This will send images back to the Dashboard + CvSource outputStream + = CameraServer.getInstance().putVideo("Rectangle", 640, 480); - // Mats are very memory expensive. Lets reuse this Mat. - Mat mat = new Mat(); + // Mats are very memory expensive. Lets reuse this Mat. + Mat mat = new Mat(); - // This cannot be 'true'. The program will never exit if it is. This - // lets the robot stop this thread when restarting robot code or - // deploying. - while (!Thread.interrupted()) { - // Tell the CvSink to grab a frame from the camera and put it - // in the source mat. If there is an error notify the output. - if (cvSink.grabFrame(mat) == 0) { - // Send the output the error. - outputStream.notifyError(cvSink.getError()); - // skip the rest of the current iteration - continue; - } - // Put a rectangle on the image - Imgproc.rectangle(mat, new Point(100, 100), new Point(400, 400), - new Scalar(255, 255, 255), 5); - // Give the output stream a new image to display - outputStream.putFrame(mat); - } - }); - m_visionThread.setDaemon(true); - m_visionThread.start(); - } + // This cannot be 'true'. The program will never exit if it is. This + // lets the robot stop this thread when restarting robot code or + // deploying. + while (!Thread.interrupted()) { + // Tell the CvSink to grab a frame from the camera and put it + // in the source mat. If there is an error notify the output. + if (cvSink.grabFrame(mat) == 0) { + // Send the output the error. + outputStream.notifyError(cvSink.getError()); + // skip the rest of the current iteration + continue; + } + // Put a rectangle on the image + Imgproc.rectangle(mat, new Point(100, 100), new Point(400, 400), + new Scalar(255, 255, 255), 5); + // Give the output stream a new image to display + outputStream.putFrame(mat); + } + }); + m_visionThread.setDaemon(true); + m_visionThread.start(); + } } diff --git a/wpilibjExamples/src/main/java/edu/wpi/first/wpilibj/examples/gearsbot/OI.java b/wpilibjExamples/src/main/java/edu/wpi/first/wpilibj/examples/gearsbot/OI.java index 1f664fecf4..949a479094 100644 --- a/wpilibjExamples/src/main/java/edu/wpi/first/wpilibj/examples/gearsbot/OI.java +++ b/wpilibjExamples/src/main/java/edu/wpi/first/wpilibj/examples/gearsbot/OI.java @@ -24,45 +24,45 @@ import edu.wpi.first.wpilibj.smartdashboard.SmartDashboard; * interface to the commands and command groups that allow control of the robot. */ public class OI { - private Joystick m_joystick = new Joystick(0); + private Joystick m_joystick = new Joystick(0); - public OI() { - // Put Some buttons on the SmartDashboard - SmartDashboard.putData("Elevator Bottom", new SetElevatorSetpoint(0)); - SmartDashboard.putData("Elevator Platform", new SetElevatorSetpoint(0.2)); - SmartDashboard.putData("Elevator Top", new SetElevatorSetpoint(0.3)); + public OI() { + // Put Some buttons on the SmartDashboard + SmartDashboard.putData("Elevator Bottom", new SetElevatorSetpoint(0)); + SmartDashboard.putData("Elevator Platform", new SetElevatorSetpoint(0.2)); + SmartDashboard.putData("Elevator Top", new SetElevatorSetpoint(0.3)); - SmartDashboard.putData("Wrist Horizontal", new SetWristSetpoint(0)); - SmartDashboard.putData("Raise Wrist", new SetWristSetpoint(-45)); + SmartDashboard.putData("Wrist Horizontal", new SetWristSetpoint(0)); + SmartDashboard.putData("Raise Wrist", new SetWristSetpoint(-45)); - SmartDashboard.putData("Open Claw", new OpenClaw()); - SmartDashboard.putData("Close Claw", new CloseClaw()); + SmartDashboard.putData("Open Claw", new OpenClaw()); + SmartDashboard.putData("Close Claw", new CloseClaw()); - SmartDashboard.putData("Deliver Soda", new Autonomous()); + SmartDashboard.putData("Deliver Soda", new Autonomous()); - // Create some buttons - JoystickButton dpadUp = new JoystickButton(m_joystick, 5); - JoystickButton dpadRight = new JoystickButton(m_joystick, 6); - JoystickButton dpadDown = new JoystickButton(m_joystick, 7); - JoystickButton dpadLeft = new JoystickButton(m_joystick, 8); - JoystickButton l2 = new JoystickButton(m_joystick, 9); - JoystickButton r2 = new JoystickButton(m_joystick, 10); - JoystickButton l1 = new JoystickButton(m_joystick, 11); - JoystickButton r1 = new JoystickButton(m_joystick, 12); + // Create some buttons + JoystickButton dpadUp = new JoystickButton(m_joystick, 5); + JoystickButton dpadRight = new JoystickButton(m_joystick, 6); + JoystickButton dpadDown = new JoystickButton(m_joystick, 7); + JoystickButton dpadLeft = new JoystickButton(m_joystick, 8); + JoystickButton l2 = new JoystickButton(m_joystick, 9); + JoystickButton r2 = new JoystickButton(m_joystick, 10); + JoystickButton l1 = new JoystickButton(m_joystick, 11); + JoystickButton r1 = new JoystickButton(m_joystick, 12); - // Connect the buttons to commands - dpadUp.whenPressed(new SetElevatorSetpoint(0.2)); - dpadDown.whenPressed(new SetElevatorSetpoint(-0.2)); - dpadRight.whenPressed(new CloseClaw()); - dpadLeft.whenPressed(new OpenClaw()); + // Connect the buttons to commands + dpadUp.whenPressed(new SetElevatorSetpoint(0.2)); + dpadDown.whenPressed(new SetElevatorSetpoint(-0.2)); + dpadRight.whenPressed(new CloseClaw()); + dpadLeft.whenPressed(new OpenClaw()); - r1.whenPressed(new PrepareToPickup()); - r2.whenPressed(new Pickup()); - l1.whenPressed(new Place()); - l2.whenPressed(new Autonomous()); - } + r1.whenPressed(new PrepareToPickup()); + r2.whenPressed(new Pickup()); + l1.whenPressed(new Place()); + l2.whenPressed(new Autonomous()); + } - public Joystick getJoystick() { - return m_joystick; - } + public Joystick getJoystick() { + return m_joystick; + } } diff --git a/wpilibjExamples/src/main/java/edu/wpi/first/wpilibj/examples/gearsbot/Robot.java b/wpilibjExamples/src/main/java/edu/wpi/first/wpilibj/examples/gearsbot/Robot.java index 7ecc8081b4..5c6a47aed1 100644 --- a/wpilibjExamples/src/main/java/edu/wpi/first/wpilibj/examples/gearsbot/Robot.java +++ b/wpilibjExamples/src/main/java/edu/wpi/first/wpilibj/examples/gearsbot/Robot.java @@ -26,83 +26,83 @@ import edu.wpi.first.wpilibj.examples.gearsbot.subsystems.Wrist; * directory. */ public class Robot extends IterativeRobot { - Command m_autonomousCommand; + Command m_autonomousCommand; - public static DriveTrain m_drivetrain; - public static Elevator m_elevator; - public static Wrist m_wrist; - public static Claw m_claw; - public static OI m_oi; + public static DriveTrain m_drivetrain; + public static Elevator m_elevator; + public static Wrist m_wrist; + public static Claw m_claw; + public static OI m_oi; - /** - * This function is run when the robot is first started up and should be - * used for any initialization code. - */ - @Override - public void robotInit() { - // Initialize all subsystems - m_drivetrain = new DriveTrain(); - m_elevator = new Elevator(); - m_wrist = new Wrist(); - m_claw = new Claw(); - m_oi = new OI(); + /** + * This function is run when the robot is first started up and should be + * used for any initialization code. + */ + @Override + public void robotInit() { + // Initialize all subsystems + m_drivetrain = new DriveTrain(); + m_elevator = new Elevator(); + m_wrist = new Wrist(); + m_claw = new Claw(); + m_oi = new OI(); - // instantiate the command used for the autonomous period - m_autonomousCommand = new Autonomous(); + // instantiate the command used for the autonomous period + m_autonomousCommand = new Autonomous(); - // Show what command your subsystem is running on the SmartDashboard - SmartDashboard.putData(m_drivetrain); - SmartDashboard.putData(m_elevator); - SmartDashboard.putData(m_wrist); - SmartDashboard.putData(m_claw); - } + // Show what command your subsystem is running on the SmartDashboard + SmartDashboard.putData(m_drivetrain); + SmartDashboard.putData(m_elevator); + SmartDashboard.putData(m_wrist); + SmartDashboard.putData(m_claw); + } - @Override - public void autonomousInit() { - m_autonomousCommand.start(); // schedule the autonomous command (example) - } + @Override + public void autonomousInit() { + m_autonomousCommand.start(); // schedule the autonomous command (example) + } - /** - * This function is called periodically during autonomous. - */ - @Override - public void autonomousPeriodic() { - Scheduler.getInstance().run(); - log(); - } + /** + * This function is called periodically during autonomous. + */ + @Override + public void autonomousPeriodic() { + Scheduler.getInstance().run(); + log(); + } - @Override - public void teleopInit() { - // This makes sure that the autonomous stops running when - // teleop starts running. If you want the autonomous to - // continue until interrupted by another command, remove - // this line or comment it out. - m_autonomousCommand.cancel(); - } + @Override + public void teleopInit() { + // This makes sure that the autonomous stops running when + // teleop starts running. If you want the autonomous to + // continue until interrupted by another command, remove + // this line or comment it out. + m_autonomousCommand.cancel(); + } - /** - * This function is called periodically during teleoperated mode. - */ - @Override - public void teleopPeriodic() { - Scheduler.getInstance().run(); - log(); - } + /** + * This function is called periodically during teleoperated mode. + */ + @Override + public void teleopPeriodic() { + Scheduler.getInstance().run(); + log(); + } - /** - * This function is called periodically during test mode. - */ - @Override - public void testPeriodic() { - } + /** + * This function is called periodically during test mode. + */ + @Override + public void testPeriodic() { + } - /** - * The log method puts interesting information to the SmartDashboard. - */ - private void log() { - m_wrist.log(); - m_elevator.log(); - m_drivetrain.log(); - m_claw.log(); - } + /** + * The log method puts interesting information to the SmartDashboard. + */ + private void log() { + m_wrist.log(); + m_elevator.log(); + m_drivetrain.log(); + m_claw.log(); + } } diff --git a/wpilibjExamples/src/main/java/edu/wpi/first/wpilibj/examples/gearsbot/commands/Autonomous.java b/wpilibjExamples/src/main/java/edu/wpi/first/wpilibj/examples/gearsbot/commands/Autonomous.java index 5c3663c546..961cb2dcd4 100644 --- a/wpilibjExamples/src/main/java/edu/wpi/first/wpilibj/examples/gearsbot/commands/Autonomous.java +++ b/wpilibjExamples/src/main/java/edu/wpi/first/wpilibj/examples/gearsbot/commands/Autonomous.java @@ -13,17 +13,17 @@ import edu.wpi.first.wpilibj.command.CommandGroup; * The main autonomous command to pickup and deliver the soda to the box. */ public class Autonomous extends CommandGroup { - public Autonomous() { - addSequential(new PrepareToPickup()); - addSequential(new Pickup()); - addSequential(new SetDistanceToBox(0.10)); - // addSequential(new DriveStraight(4)); // Use Encoders if ultrasonic is - // broken - addSequential(new Place()); - addSequential(new SetDistanceToBox(0.60)); - // addSequential(new DriveStraight(-2)); // Use Encoders if ultrasonic - // is broken - addParallel(new SetWristSetpoint(-45)); - addSequential(new CloseClaw()); - } + public Autonomous() { + addSequential(new PrepareToPickup()); + addSequential(new Pickup()); + addSequential(new SetDistanceToBox(0.10)); + // addSequential(new DriveStraight(4)); // Use Encoders if ultrasonic is + // broken + addSequential(new Place()); + addSequential(new SetDistanceToBox(0.60)); + // addSequential(new DriveStraight(-2)); // Use Encoders if ultrasonic + // is broken + addParallel(new SetWristSetpoint(-45)); + addSequential(new CloseClaw()); + } } diff --git a/wpilibjExamples/src/main/java/edu/wpi/first/wpilibj/examples/gearsbot/commands/CloseClaw.java b/wpilibjExamples/src/main/java/edu/wpi/first/wpilibj/examples/gearsbot/commands/CloseClaw.java index 7b37c9e450..1deb59531c 100644 --- a/wpilibjExamples/src/main/java/edu/wpi/first/wpilibj/examples/gearsbot/commands/CloseClaw.java +++ b/wpilibjExamples/src/main/java/edu/wpi/first/wpilibj/examples/gearsbot/commands/CloseClaw.java @@ -15,31 +15,31 @@ import edu.wpi.first.wpilibj.examples.gearsbot.Robot; * motors is BAD! */ public class CloseClaw extends Command { - public CloseClaw() { - requires(Robot.m_claw); - } + public CloseClaw() { + requires(Robot.m_claw); + } - // Called just before this Command runs the first time - @Override - protected void initialize() { - Robot.m_claw.close(); - } + // Called just before this Command runs the first time + @Override + protected void initialize() { + Robot.m_claw.close(); + } - // Make this return true when this Command no longer needs to run execute() - @Override - protected boolean isFinished() { - return Robot.m_claw.isGrabbing(); - } + // Make this return true when this Command no longer needs to run execute() + @Override + protected boolean isFinished() { + return Robot.m_claw.isGrabbing(); + } - // Called once after isFinished returns true - @Override - protected void end() { - // NOTE: Doesn't stop in simulation due to lower friction causing the - // can to fall out - // + there is no need to worry about stalling the motor or crushing the - // can. - if (!Robot.isSimulation()) { - Robot.m_claw.stop(); - } - } + // Called once after isFinished returns true + @Override + protected void end() { + // NOTE: Doesn't stop in simulation due to lower friction causing the + // can to fall out + // + there is no need to worry about stalling the motor or crushing the + // can. + if (!Robot.isSimulation()) { + Robot.m_claw.stop(); + } + } } diff --git a/wpilibjExamples/src/main/java/edu/wpi/first/wpilibj/examples/gearsbot/commands/DriveStraight.java b/wpilibjExamples/src/main/java/edu/wpi/first/wpilibj/examples/gearsbot/commands/DriveStraight.java index 5f16990073..9bbbb4d8b0 100644 --- a/wpilibjExamples/src/main/java/edu/wpi/first/wpilibj/examples/gearsbot/commands/DriveStraight.java +++ b/wpilibjExamples/src/main/java/edu/wpi/first/wpilibj/examples/gearsbot/commands/DriveStraight.java @@ -20,53 +20,53 @@ import edu.wpi.first.wpilibj.examples.gearsbot.Robot; * encoders. */ public class DriveStraight extends Command { - private PIDController m_pid; + private PIDController m_pid; - public DriveStraight(double distance) { - requires(Robot.m_drivetrain); - m_pid = new PIDController(4, 0, 0, new PIDSource() { - PIDSourceType m_sourceType = PIDSourceType.kDisplacement; + public DriveStraight(double distance) { + requires(Robot.m_drivetrain); + m_pid = new PIDController(4, 0, 0, new PIDSource() { + PIDSourceType m_sourceType = PIDSourceType.kDisplacement; - @Override - public double pidGet() { - return Robot.m_drivetrain.getDistance(); - } + @Override + public double pidGet() { + return Robot.m_drivetrain.getDistance(); + } - @Override - public void setPIDSourceType(PIDSourceType pidSource) { - m_sourceType = pidSource; - } + @Override + public void setPIDSourceType(PIDSourceType pidSource) { + m_sourceType = pidSource; + } - @Override - public PIDSourceType getPIDSourceType() { - return m_sourceType; - } - }, d -> Robot.m_drivetrain.drive(d, d)); + @Override + public PIDSourceType getPIDSourceType() { + return m_sourceType; + } + }, d -> Robot.m_drivetrain.drive(d, d)); - m_pid.setAbsoluteTolerance(0.01); - m_pid.setSetpoint(distance); - } + m_pid.setAbsoluteTolerance(0.01); + m_pid.setSetpoint(distance); + } - // Called just before this Command runs the first time - @Override - protected void initialize() { - // Get everything in a safe starting state. - Robot.m_drivetrain.reset(); - m_pid.reset(); - m_pid.enable(); - } + // Called just before this Command runs the first time + @Override + protected void initialize() { + // Get everything in a safe starting state. + Robot.m_drivetrain.reset(); + m_pid.reset(); + m_pid.enable(); + } - // Make this return true when this Command no longer needs to run execute() - @Override - protected boolean isFinished() { - return m_pid.onTarget(); - } + // Make this return true when this Command no longer needs to run execute() + @Override + protected boolean isFinished() { + return m_pid.onTarget(); + } - // Called once after isFinished returns true - @Override - protected void end() { - // Stop PID and the wheels - m_pid.disable(); - Robot.m_drivetrain.drive(0, 0); - } + // Called once after isFinished returns true + @Override + protected void end() { + // Stop PID and the wheels + m_pid.disable(); + Robot.m_drivetrain.drive(0, 0); + } } diff --git a/wpilibjExamples/src/main/java/edu/wpi/first/wpilibj/examples/gearsbot/commands/OpenClaw.java b/wpilibjExamples/src/main/java/edu/wpi/first/wpilibj/examples/gearsbot/commands/OpenClaw.java index e2a6963a3a..fb9fe6e7b6 100644 --- a/wpilibjExamples/src/main/java/edu/wpi/first/wpilibj/examples/gearsbot/commands/OpenClaw.java +++ b/wpilibjExamples/src/main/java/edu/wpi/first/wpilibj/examples/gearsbot/commands/OpenClaw.java @@ -15,20 +15,20 @@ import edu.wpi.first.wpilibj.examples.gearsbot.Robot; * motors is BAD! */ public class OpenClaw extends TimedCommand { - public OpenClaw() { - super(1); - requires(Robot.m_claw); - } + public OpenClaw() { + super(1); + requires(Robot.m_claw); + } - // Called just before this Command runs the first time - @Override - protected void initialize() { - Robot.m_claw.open(); - } + // Called just before this Command runs the first time + @Override + protected void initialize() { + Robot.m_claw.open(); + } - // Called once after isFinished returns true - @Override - protected void end() { - Robot.m_claw.stop(); - } + // Called once after isFinished returns true + @Override + protected void end() { + Robot.m_claw.stop(); + } } diff --git a/wpilibjExamples/src/main/java/edu/wpi/first/wpilibj/examples/gearsbot/commands/Pickup.java b/wpilibjExamples/src/main/java/edu/wpi/first/wpilibj/examples/gearsbot/commands/Pickup.java index e017b20eb4..0babf048e3 100644 --- a/wpilibjExamples/src/main/java/edu/wpi/first/wpilibj/examples/gearsbot/commands/Pickup.java +++ b/wpilibjExamples/src/main/java/edu/wpi/first/wpilibj/examples/gearsbot/commands/Pickup.java @@ -14,9 +14,9 @@ import edu.wpi.first.wpilibj.command.CommandGroup; * state to drive around. */ public class Pickup extends CommandGroup { - public Pickup() { - addSequential(new CloseClaw()); - addParallel(new SetWristSetpoint(-45)); - addSequential(new SetElevatorSetpoint(0.25)); - } + public Pickup() { + addSequential(new CloseClaw()); + addParallel(new SetWristSetpoint(-45)); + addSequential(new SetElevatorSetpoint(0.25)); + } } diff --git a/wpilibjExamples/src/main/java/edu/wpi/first/wpilibj/examples/gearsbot/commands/Place.java b/wpilibjExamples/src/main/java/edu/wpi/first/wpilibj/examples/gearsbot/commands/Place.java index 0b4780c47b..28ae7e5d80 100644 --- a/wpilibjExamples/src/main/java/edu/wpi/first/wpilibj/examples/gearsbot/commands/Place.java +++ b/wpilibjExamples/src/main/java/edu/wpi/first/wpilibj/examples/gearsbot/commands/Place.java @@ -13,9 +13,9 @@ import edu.wpi.first.wpilibj.command.CommandGroup; * Place a held soda can onto the platform. */ public class Place extends CommandGroup { - public Place() { - addSequential(new SetElevatorSetpoint(0.25)); - addSequential(new SetWristSetpoint(0)); - addSequential(new OpenClaw()); - } + public Place() { + addSequential(new SetElevatorSetpoint(0.25)); + addSequential(new SetWristSetpoint(0)); + addSequential(new OpenClaw()); + } } diff --git a/wpilibjExamples/src/main/java/edu/wpi/first/wpilibj/examples/gearsbot/commands/PrepareToPickup.java b/wpilibjExamples/src/main/java/edu/wpi/first/wpilibj/examples/gearsbot/commands/PrepareToPickup.java index 94a8742892..91b4fdcfaf 100644 --- a/wpilibjExamples/src/main/java/edu/wpi/first/wpilibj/examples/gearsbot/commands/PrepareToPickup.java +++ b/wpilibjExamples/src/main/java/edu/wpi/first/wpilibj/examples/gearsbot/commands/PrepareToPickup.java @@ -13,9 +13,9 @@ import edu.wpi.first.wpilibj.command.CommandGroup; * Make sure the robot is in a state to pickup soda cans. */ public class PrepareToPickup extends CommandGroup { - public PrepareToPickup() { - addParallel(new OpenClaw()); - addParallel(new SetWristSetpoint(0)); - addSequential(new SetElevatorSetpoint(0)); - } + public PrepareToPickup() { + addParallel(new OpenClaw()); + addParallel(new SetWristSetpoint(0)); + addSequential(new SetElevatorSetpoint(0)); + } } diff --git a/wpilibjExamples/src/main/java/edu/wpi/first/wpilibj/examples/gearsbot/commands/SetDistanceToBox.java b/wpilibjExamples/src/main/java/edu/wpi/first/wpilibj/examples/gearsbot/commands/SetDistanceToBox.java index 944ea56928..8bd4f6cebc 100644 --- a/wpilibjExamples/src/main/java/edu/wpi/first/wpilibj/examples/gearsbot/commands/SetDistanceToBox.java +++ b/wpilibjExamples/src/main/java/edu/wpi/first/wpilibj/examples/gearsbot/commands/SetDistanceToBox.java @@ -20,53 +20,53 @@ import edu.wpi.first.wpilibj.examples.gearsbot.Robot; * encoders. */ public class SetDistanceToBox extends Command { - private PIDController m_pid; + private PIDController m_pid; - public SetDistanceToBox(double distance) { - requires(Robot.m_drivetrain); - m_pid = new PIDController(-2, 0, 0, new PIDSource() { - PIDSourceType m_sourceType = PIDSourceType.kDisplacement; + public SetDistanceToBox(double distance) { + requires(Robot.m_drivetrain); + m_pid = new PIDController(-2, 0, 0, new PIDSource() { + PIDSourceType m_sourceType = PIDSourceType.kDisplacement; - @Override - public double pidGet() { - return Robot.m_drivetrain.getDistanceToObstacle(); - } + @Override + public double pidGet() { + return Robot.m_drivetrain.getDistanceToObstacle(); + } - @Override - public void setPIDSourceType(PIDSourceType pidSource) { - m_sourceType = pidSource; - } + @Override + public void setPIDSourceType(PIDSourceType pidSource) { + m_sourceType = pidSource; + } - @Override - public PIDSourceType getPIDSourceType() { - return m_sourceType; - } - }, d -> Robot.m_drivetrain.drive(d, d)); + @Override + public PIDSourceType getPIDSourceType() { + return m_sourceType; + } + }, d -> Robot.m_drivetrain.drive(d, d)); - m_pid.setAbsoluteTolerance(0.01); - m_pid.setSetpoint(distance); - } + m_pid.setAbsoluteTolerance(0.01); + m_pid.setSetpoint(distance); + } - // Called just before this Command runs the first time - @Override - protected void initialize() { - // Get everything in a safe starting state. - Robot.m_drivetrain.reset(); - m_pid.reset(); - m_pid.enable(); - } + // Called just before this Command runs the first time + @Override + protected void initialize() { + // Get everything in a safe starting state. + Robot.m_drivetrain.reset(); + m_pid.reset(); + m_pid.enable(); + } - // Make this return true when this Command no longer needs to run execute() - @Override - protected boolean isFinished() { - return m_pid.onTarget(); - } + // Make this return true when this Command no longer needs to run execute() + @Override + protected boolean isFinished() { + return m_pid.onTarget(); + } - // Called once after isFinished returns true - @Override - protected void end() { - // Stop PID and the wheels - m_pid.disable(); - Robot.m_drivetrain.drive(0, 0); - } + // Called once after isFinished returns true + @Override + protected void end() { + // Stop PID and the wheels + m_pid.disable(); + Robot.m_drivetrain.drive(0, 0); + } } diff --git a/wpilibjExamples/src/main/java/edu/wpi/first/wpilibj/examples/gearsbot/commands/SetElevatorSetpoint.java b/wpilibjExamples/src/main/java/edu/wpi/first/wpilibj/examples/gearsbot/commands/SetElevatorSetpoint.java index 7de4ab135c..1491108113 100644 --- a/wpilibjExamples/src/main/java/edu/wpi/first/wpilibj/examples/gearsbot/commands/SetElevatorSetpoint.java +++ b/wpilibjExamples/src/main/java/edu/wpi/first/wpilibj/examples/gearsbot/commands/SetElevatorSetpoint.java @@ -17,23 +17,23 @@ import edu.wpi.first.wpilibj.examples.gearsbot.Robot; * PID! */ public class SetElevatorSetpoint extends Command { - private double m_setpoint; + private double m_setpoint; - public SetElevatorSetpoint(double setpoint) { - m_setpoint = setpoint; - requires(Robot.m_elevator); - } + public SetElevatorSetpoint(double setpoint) { + m_setpoint = setpoint; + requires(Robot.m_elevator); + } - // Called just before this Command runs the first time - @Override - protected void initialize() { - Robot.m_elevator.enable(); - Robot.m_elevator.setSetpoint(m_setpoint); - } + // Called just before this Command runs the first time + @Override + protected void initialize() { + Robot.m_elevator.enable(); + Robot.m_elevator.setSetpoint(m_setpoint); + } - // Make this return true when this Command no longer needs to run execute() - @Override - protected boolean isFinished() { - return Robot.m_elevator.onTarget(); - } + // Make this return true when this Command no longer needs to run execute() + @Override + protected boolean isFinished() { + return Robot.m_elevator.onTarget(); + } } diff --git a/wpilibjExamples/src/main/java/edu/wpi/first/wpilibj/examples/gearsbot/commands/SetWristSetpoint.java b/wpilibjExamples/src/main/java/edu/wpi/first/wpilibj/examples/gearsbot/commands/SetWristSetpoint.java index 7c8a744587..2f8511fad6 100644 --- a/wpilibjExamples/src/main/java/edu/wpi/first/wpilibj/examples/gearsbot/commands/SetWristSetpoint.java +++ b/wpilibjExamples/src/main/java/edu/wpi/first/wpilibj/examples/gearsbot/commands/SetWristSetpoint.java @@ -16,23 +16,23 @@ import edu.wpi.first.wpilibj.examples.gearsbot.Robot; * commands using the wrist should make sure they disable PID! */ public class SetWristSetpoint extends Command { - private double m_setpoint; + private double m_setpoint; - public SetWristSetpoint(double setpoint) { - m_setpoint = setpoint; - requires(Robot.m_wrist); - } + public SetWristSetpoint(double setpoint) { + m_setpoint = setpoint; + requires(Robot.m_wrist); + } - // Called just before this Command runs the first time - @Override - protected void initialize() { - Robot.m_wrist.enable(); - Robot.m_wrist.setSetpoint(m_setpoint); - } + // Called just before this Command runs the first time + @Override + protected void initialize() { + Robot.m_wrist.enable(); + Robot.m_wrist.setSetpoint(m_setpoint); + } - // Make this return true when this Command no longer needs to run execute() - @Override - protected boolean isFinished() { - return Robot.m_wrist.onTarget(); - } + // Make this return true when this Command no longer needs to run execute() + @Override + protected boolean isFinished() { + return Robot.m_wrist.onTarget(); + } } diff --git a/wpilibjExamples/src/main/java/edu/wpi/first/wpilibj/examples/gearsbot/commands/TankDriveWithJoystick.java b/wpilibjExamples/src/main/java/edu/wpi/first/wpilibj/examples/gearsbot/commands/TankDriveWithJoystick.java index 05d3bd5352..25bc2cc9a9 100644 --- a/wpilibjExamples/src/main/java/edu/wpi/first/wpilibj/examples/gearsbot/commands/TankDriveWithJoystick.java +++ b/wpilibjExamples/src/main/java/edu/wpi/first/wpilibj/examples/gearsbot/commands/TankDriveWithJoystick.java @@ -14,25 +14,25 @@ import edu.wpi.first.wpilibj.examples.gearsbot.Robot; * Have the robot drive tank style using the PS3 Joystick until interrupted. */ public class TankDriveWithJoystick extends Command { - public TankDriveWithJoystick() { - requires(Robot.m_drivetrain); - } + public TankDriveWithJoystick() { + requires(Robot.m_drivetrain); + } - // Called repeatedly when this Command is scheduled to run - @Override - protected void execute() { - Robot.m_drivetrain.drive(Robot.m_oi.getJoystick()); - } + // Called repeatedly when this Command is scheduled to run + @Override + protected void execute() { + Robot.m_drivetrain.drive(Robot.m_oi.getJoystick()); + } - // Make this return true when this Command no longer needs to run execute() - @Override - protected boolean isFinished() { - return false; // Runs until interrupted - } + // Make this return true when this Command no longer needs to run execute() + @Override + protected boolean isFinished() { + return false; // Runs until interrupted + } - // Called once after isFinished returns true - @Override - protected void end() { - Robot.m_drivetrain.drive(0, 0); - } + // Called once after isFinished returns true + @Override + protected void end() { + Robot.m_drivetrain.drive(0, 0); + } } diff --git a/wpilibjExamples/src/main/java/edu/wpi/first/wpilibj/examples/gearsbot/subsystems/Claw.java b/wpilibjExamples/src/main/java/edu/wpi/first/wpilibj/examples/gearsbot/subsystems/Claw.java index 1618016c3b..b97bbf8ff3 100644 --- a/wpilibjExamples/src/main/java/edu/wpi/first/wpilibj/examples/gearsbot/subsystems/Claw.java +++ b/wpilibjExamples/src/main/java/edu/wpi/first/wpilibj/examples/gearsbot/subsystems/Claw.java @@ -17,50 +17,50 @@ import edu.wpi.first.wpilibj.command.Subsystem; * don't stall. */ public class Claw extends Subsystem { - private Victor m_motor = new Victor(7); - private DigitalInput m_contact = new DigitalInput(5); + private Victor m_motor = new Victor(7); + private DigitalInput m_contact = new DigitalInput(5); - public Claw() { - super(); + public Claw() { + super(); - // Let's name everything on the LiveWindow - addChild("Motor", m_motor); - addChild("Limit Switch", m_contact); - } + // Let's name everything on the LiveWindow + addChild("Motor", m_motor); + addChild("Limit Switch", m_contact); + } - @Override - public void initDefaultCommand() { - } + @Override + public void initDefaultCommand() { + } - public void log() { - } + public void log() { + } - /** - * Set the claw motor to move in the open direction. - */ - public void open() { - m_motor.set(-1); - } + /** + * Set the claw motor to move in the open direction. + */ + public void open() { + m_motor.set(-1); + } - /** - * Set the claw motor to move in the close direction. - */ - public void close() { - m_motor.set(1); - } + /** + * Set the claw motor to move in the close direction. + */ + public void close() { + m_motor.set(1); + } - /** - * Stops the claw motor from moving. - */ - public void stop() { - m_motor.set(0); - } + /** + * Stops the claw motor from moving. + */ + public void stop() { + m_motor.set(0); + } - /** - * Return true when the robot is grabbing an object hard enough to trigger - * the limit switch. - */ - public boolean isGrabbing() { - return m_contact.get(); - } + /** + * Return true when the robot is grabbing an object hard enough to trigger + * the limit switch. + */ + public boolean isGrabbing() { + return m_contact.get(); + } } diff --git a/wpilibjExamples/src/main/java/edu/wpi/first/wpilibj/examples/gearsbot/subsystems/DriveTrain.java b/wpilibjExamples/src/main/java/edu/wpi/first/wpilibj/examples/gearsbot/subsystems/DriveTrain.java index 022b9404f3..f1c014592f 100644 --- a/wpilibjExamples/src/main/java/edu/wpi/first/wpilibj/examples/gearsbot/subsystems/DriveTrain.java +++ b/wpilibjExamples/src/main/java/edu/wpi/first/wpilibj/examples/gearsbot/subsystems/DriveTrain.java @@ -26,119 +26,119 @@ import edu.wpi.first.wpilibj.smartdashboard.SmartDashboard; * and a gyro. */ public class DriveTrain extends Subsystem { - private SpeedController m_leftMotor - = new SpeedControllerGroup(new Spark(0), new Spark(1)); - private SpeedController m_rightMotor - = new SpeedControllerGroup(new Spark(2), new Spark(3)); + private SpeedController m_leftMotor + = new SpeedControllerGroup(new Spark(0), new Spark(1)); + private SpeedController m_rightMotor + = new SpeedControllerGroup(new Spark(2), new Spark(3)); - private DifferentialDrive m_drive - = new DifferentialDrive(m_leftMotor, m_rightMotor); + private DifferentialDrive m_drive + = new DifferentialDrive(m_leftMotor, m_rightMotor); - private Encoder m_leftEncoder = new Encoder(1, 2); - private Encoder m_rightEncoder = new Encoder(3, 4); - private AnalogInput m_rangefinder = new AnalogInput(6); - private AnalogGyro m_gyro = new AnalogGyro(1); + private Encoder m_leftEncoder = new Encoder(1, 2); + private Encoder m_rightEncoder = new Encoder(3, 4); + private AnalogInput m_rangefinder = new AnalogInput(6); + private AnalogGyro m_gyro = new AnalogGyro(1); - public DriveTrain() { - super(); + public DriveTrain() { + super(); - // Encoders may measure differently in the real world and in - // simulation. In this example the robot moves 0.042 barleycorns - // per tick in the real world, but the simulated encoders - // simulate 360 tick encoders. This if statement allows for the - // real robot to handle this difference in devices. - if (Robot.isReal()) { - m_leftEncoder.setDistancePerPulse(0.042); - m_rightEncoder.setDistancePerPulse(0.042); - } else { - // Circumference in ft = 4in/12(in/ft)*PI - m_leftEncoder.setDistancePerPulse((4.0 / 12.0 * Math.PI) / 360.0); - m_rightEncoder.setDistancePerPulse((4.0 / 12.0 * Math.PI) / 360.0); - } + // Encoders may measure differently in the real world and in + // simulation. In this example the robot moves 0.042 barleycorns + // per tick in the real world, but the simulated encoders + // simulate 360 tick encoders. This if statement allows for the + // real robot to handle this difference in devices. + if (Robot.isReal()) { + m_leftEncoder.setDistancePerPulse(0.042); + m_rightEncoder.setDistancePerPulse(0.042); + } else { + // Circumference in ft = 4in/12(in/ft)*PI + m_leftEncoder.setDistancePerPulse((4.0 / 12.0 * Math.PI) / 360.0); + m_rightEncoder.setDistancePerPulse((4.0 / 12.0 * Math.PI) / 360.0); + } - // Let's name the sensors on the LiveWindow - addChild("Drive", m_drive); - addChild("Left Encoder", m_leftEncoder); - addChild("Right Encoder", m_rightEncoder); - addChild("Rangefinder", m_rangefinder); - addChild("Gyro", m_gyro); - } + // Let's name the sensors on the LiveWindow + addChild("Drive", m_drive); + addChild("Left Encoder", m_leftEncoder); + addChild("Right Encoder", m_rightEncoder); + addChild("Rangefinder", m_rangefinder); + addChild("Gyro", m_gyro); + } - /** - * When no other command is running let the operator drive around using the - * PS3 joystick. - */ - @Override - public void initDefaultCommand() { - setDefaultCommand(new TankDriveWithJoystick()); - } + /** + * When no other command is running let the operator drive around using the + * PS3 joystick. + */ + @Override + public void initDefaultCommand() { + setDefaultCommand(new TankDriveWithJoystick()); + } - /** - * The log method puts interesting information to the SmartDashboard. - */ - public void log() { - SmartDashboard.putNumber("Left Distance", m_leftEncoder.getDistance()); - SmartDashboard.putNumber("Right Distance", m_rightEncoder.getDistance()); - SmartDashboard.putNumber("Left Speed", m_leftEncoder.getRate()); - SmartDashboard.putNumber("Right Speed", m_rightEncoder.getRate()); - SmartDashboard.putNumber("Gyro", m_gyro.getAngle()); - } + /** + * The log method puts interesting information to the SmartDashboard. + */ + public void log() { + SmartDashboard.putNumber("Left Distance", m_leftEncoder.getDistance()); + SmartDashboard.putNumber("Right Distance", m_rightEncoder.getDistance()); + SmartDashboard.putNumber("Left Speed", m_leftEncoder.getRate()); + SmartDashboard.putNumber("Right Speed", m_rightEncoder.getRate()); + SmartDashboard.putNumber("Gyro", m_gyro.getAngle()); + } - /** - * Tank style driving for the DriveTrain. - * - * @param left - * Speed in range [-1,1] - * @param right - * Speed in range [-1,1] - */ - public void drive(double left, double right) { - m_drive.tankDrive(left, right); - } + /** + * Tank style driving for the DriveTrain. + * + * @param left + * Speed in range [-1,1] + * @param right + * Speed in range [-1,1] + */ + public void drive(double left, double right) { + m_drive.tankDrive(left, right); + } - /** - * Tank style driving for the DriveTrain. - * - * @param joy The ps3 style joystick to use to drive tank style. - */ - public void drive(Joystick joy) { - drive(-joy.getY(), -joy.getThrottle()); - } + /** + * Tank style driving for the DriveTrain. + * + * @param joy The ps3 style joystick to use to drive tank style. + */ + public void drive(Joystick joy) { + drive(-joy.getY(), -joy.getThrottle()); + } - /** - * Get the robot's heading. - * - * @return The robots heading in degrees. - */ - public double getHeading() { - return m_gyro.getAngle(); - } + /** + * Get the robot's heading. + * + * @return The robots heading in degrees. + */ + public double getHeading() { + return m_gyro.getAngle(); + } - /** - * Reset the robots sensors to the zero states. - */ - public void reset() { - m_gyro.reset(); - m_leftEncoder.reset(); - m_rightEncoder.reset(); - } + /** + * Reset the robots sensors to the zero states. + */ + public void reset() { + m_gyro.reset(); + m_leftEncoder.reset(); + m_rightEncoder.reset(); + } - /** - * Get the average distance of the encoders since the last reset. - * - * @return The distance driven (average of left and right encoders). - */ - public double getDistance() { - return (m_leftEncoder.getDistance() + m_rightEncoder.getDistance()) / 2; - } + /** + * Get the average distance of the encoders since the last reset. + * + * @return The distance driven (average of left and right encoders). + */ + public double getDistance() { + return (m_leftEncoder.getDistance() + m_rightEncoder.getDistance()) / 2; + } - /** - * Get the distance to the obstacle. - * - * @return The distance to the obstacle detected by the rangefinder. - */ - public double getDistanceToObstacle() { - // Really meters in simulation since it's a rangefinder... - return m_rangefinder.getAverageVoltage(); - } + /** + * Get the distance to the obstacle. + * + * @return The distance to the obstacle detected by the rangefinder. + */ + public double getDistanceToObstacle() { + // Really meters in simulation since it's a rangefinder... + return m_rangefinder.getAverageVoltage(); + } } diff --git a/wpilibjExamples/src/main/java/edu/wpi/first/wpilibj/examples/gearsbot/subsystems/Elevator.java b/wpilibjExamples/src/main/java/edu/wpi/first/wpilibj/examples/gearsbot/subsystems/Elevator.java index a262643108..12daddf08e 100644 --- a/wpilibjExamples/src/main/java/edu/wpi/first/wpilibj/examples/gearsbot/subsystems/Elevator.java +++ b/wpilibjExamples/src/main/java/edu/wpi/first/wpilibj/examples/gearsbot/subsystems/Elevator.java @@ -19,62 +19,62 @@ import edu.wpi.first.wpilibj.smartdashboard.SmartDashboard; * world do to minor differences. */ public class Elevator extends PIDSubsystem { - private Victor m_motor; - private AnalogPotentiometer m_pot; + private Victor m_motor; + private AnalogPotentiometer m_pot; - private static final double kP_real = 4; - private static final double kI_real = 0.07; - private static final double kP_simulation = 18; - private static final double kI_simulation = 0.2; + private static final double kP_real = 4; + private static final double kI_real = 0.07; + private static final double kP_simulation = 18; + private static final double kI_simulation = 0.2; - public Elevator() { - super(kP_real, kI_real, 0); - if (Robot.isSimulation()) { // Check for simulation and update PID values - getPIDController().setPID(kP_simulation, kI_simulation, 0, 0); - } - setAbsoluteTolerance(0.005); + public Elevator() { + super(kP_real, kI_real, 0); + if (Robot.isSimulation()) { // Check for simulation and update PID values + getPIDController().setPID(kP_simulation, kI_simulation, 0, 0); + } + setAbsoluteTolerance(0.005); - m_motor = new Victor(5); + m_motor = new Victor(5); - // Conversion value of potentiometer varies between the real world and - // simulation - if (Robot.isReal()) { - m_pot = new AnalogPotentiometer(2, -2.0 / 5); - } else { - m_pot = new AnalogPotentiometer(2); // Defaults to meters - } + // Conversion value of potentiometer varies between the real world and + // simulation + if (Robot.isReal()) { + m_pot = new AnalogPotentiometer(2, -2.0 / 5); + } else { + m_pot = new AnalogPotentiometer(2); // Defaults to meters + } - // Let's name everything on the LiveWindow - addChild("Motor", m_motor); - addChild("Pot", m_pot); - } + // Let's name everything on the LiveWindow + addChild("Motor", m_motor); + addChild("Pot", m_pot); + } - @Override - public void initDefaultCommand() { - } + @Override + public void initDefaultCommand() { + } - /** - * The log method puts interesting information to the SmartDashboard. - */ - public void log() { - SmartDashboard.putData("Elevator Pot", (AnalogPotentiometer) m_pot); - } + /** + * The log method puts interesting information to the SmartDashboard. + */ + public void log() { + SmartDashboard.putData("Elevator Pot", (AnalogPotentiometer) m_pot); + } - /** - * Use the potentiometer as the PID sensor. This method is automatically - * called by the subsystem. - */ - @Override - protected double returnPIDInput() { - return m_pot.get(); - } + /** + * Use the potentiometer as the PID sensor. This method is automatically + * called by the subsystem. + */ + @Override + protected double returnPIDInput() { + return m_pot.get(); + } - /** - * Use the motor as the PID output. This method is automatically called by - * the subsystem. - */ - @Override - protected void usePIDOutput(double power) { - m_motor.set(power); - } + /** + * Use the motor as the PID output. This method is automatically called by + * the subsystem. + */ + @Override + protected void usePIDOutput(double power) { + m_motor.set(power); + } } diff --git a/wpilibjExamples/src/main/java/edu/wpi/first/wpilibj/examples/gearsbot/subsystems/Wrist.java b/wpilibjExamples/src/main/java/edu/wpi/first/wpilibj/examples/gearsbot/subsystems/Wrist.java index 96cc5ed1e9..664c7db1fe 100644 --- a/wpilibjExamples/src/main/java/edu/wpi/first/wpilibj/examples/gearsbot/subsystems/Wrist.java +++ b/wpilibjExamples/src/main/java/edu/wpi/first/wpilibj/examples/gearsbot/subsystems/Wrist.java @@ -18,60 +18,60 @@ import edu.wpi.first.wpilibj.smartdashboard.SmartDashboard; * of a linear joint. */ public class Wrist extends PIDSubsystem { - private Victor m_motor; - private AnalogPotentiometer m_pot; + private Victor m_motor; + private AnalogPotentiometer m_pot; - private static final double kP_real = 1; - private static final double kP_simulation = 0.05; + private static final double kP_real = 1; + private static final double kP_simulation = 0.05; - public Wrist() { - super(kP_real, 0, 0); - if (Robot.isSimulation()) { // Check for simulation and update PID values - getPIDController().setPID(kP_simulation, 0, 0, 0); - } - setAbsoluteTolerance(2.5); + public Wrist() { + super(kP_real, 0, 0); + if (Robot.isSimulation()) { // Check for simulation and update PID values + getPIDController().setPID(kP_simulation, 0, 0, 0); + } + setAbsoluteTolerance(2.5); - m_motor = new Victor(6); + m_motor = new Victor(6); - // Conversion value of potentiometer varies between the real world and - // simulation - if (Robot.isReal()) { - m_pot = new AnalogPotentiometer(3, -270.0 / 5); - } else { - m_pot = new AnalogPotentiometer(3); // Defaults to degrees - } + // Conversion value of potentiometer varies between the real world and + // simulation + if (Robot.isReal()) { + m_pot = new AnalogPotentiometer(3, -270.0 / 5); + } else { + m_pot = new AnalogPotentiometer(3); // Defaults to degrees + } - // Let's name everything on the LiveWindow - addChild("Motor", m_motor); - addChild("Pot", m_pot); - } + // Let's name everything on the LiveWindow + addChild("Motor", m_motor); + addChild("Pot", m_pot); + } - @Override - public void initDefaultCommand() { - } + @Override + public void initDefaultCommand() { + } - /** - * The log method puts interesting information to the SmartDashboard. - */ - public void log() { - SmartDashboard.putData("Wrist Angle", (AnalogPotentiometer) m_pot); - } + /** + * The log method puts interesting information to the SmartDashboard. + */ + public void log() { + SmartDashboard.putData("Wrist Angle", (AnalogPotentiometer) m_pot); + } - /** - * Use the potentiometer as the PID sensor. This method is automatically - * called by the subsystem. - */ - @Override - protected double returnPIDInput() { - return m_pot.get(); - } + /** + * Use the potentiometer as the PID sensor. This method is automatically + * called by the subsystem. + */ + @Override + protected double returnPIDInput() { + return m_pot.get(); + } - /** - * Use the motor as the PID output. This method is automatically called by - * the subsystem. - */ - @Override - protected void usePIDOutput(double power) { - m_motor.set(power); - } + /** + * Use the motor as the PID output. This method is automatically called by + * the subsystem. + */ + @Override + protected void usePIDOutput(double power) { + m_motor.set(power); + } } diff --git a/wpilibjExamples/src/main/java/edu/wpi/first/wpilibj/examples/gettingstarted/Robot.java b/wpilibjExamples/src/main/java/edu/wpi/first/wpilibj/examples/gettingstarted/Robot.java index 3ddb6e578a..906cf25a51 100644 --- a/wpilibjExamples/src/main/java/edu/wpi/first/wpilibj/examples/gettingstarted/Robot.java +++ b/wpilibjExamples/src/main/java/edu/wpi/first/wpilibj/examples/gettingstarted/Robot.java @@ -21,60 +21,60 @@ import edu.wpi.first.wpilibj.drive.DifferentialDrive; * directory. */ public class Robot extends IterativeRobot { - private DifferentialDrive m_robotDrive - = new DifferentialDrive(new Spark(0), new Spark(1)); - private Joystick m_stick = new Joystick(0); - private Timer m_timer = new Timer(); + private DifferentialDrive m_robotDrive + = new DifferentialDrive(new Spark(0), new Spark(1)); + private Joystick m_stick = new Joystick(0); + private Timer m_timer = new Timer(); - /** - * This function is run when the robot is first started up and should be - * used for any initialization code. - */ - @Override - public void robotInit() { - } + /** + * This function is run when the robot is first started up and should be + * used for any initialization code. + */ + @Override + public void robotInit() { + } - /** - * This function is run once each time the robot enters autonomous mode. - */ - @Override - public void autonomousInit() { - m_timer.reset(); - m_timer.start(); - } + /** + * This function is run once each time the robot enters autonomous mode. + */ + @Override + public void autonomousInit() { + m_timer.reset(); + m_timer.start(); + } - /** - * This function is called periodically during autonomous. - */ - @Override - public void autonomousPeriodic() { - // Drive for 2 seconds - if (m_timer.get() < 2.0) { - m_robotDrive.arcadeDrive(0.5, 0.0); // drive forwards half speed - } else { - m_robotDrive.stopMotor(); // stop robot - } - } + /** + * This function is called periodically during autonomous. + */ + @Override + public void autonomousPeriodic() { + // Drive for 2 seconds + if (m_timer.get() < 2.0) { + m_robotDrive.arcadeDrive(0.5, 0.0); // drive forwards half speed + } else { + m_robotDrive.stopMotor(); // stop robot + } + } - /** - * This function is called once each time the robot enters teleoperated mode. - */ - @Override - public void teleopInit() { - } + /** + * This function is called once each time the robot enters teleoperated mode. + */ + @Override + public void teleopInit() { + } - /** - * This function is called periodically during teleoperated mode. - */ - @Override - public void teleopPeriodic() { - m_robotDrive.arcadeDrive(m_stick.getY(), m_stick.getX()); - } + /** + * This function is called periodically during teleoperated mode. + */ + @Override + public void teleopPeriodic() { + m_robotDrive.arcadeDrive(m_stick.getY(), m_stick.getX()); + } - /** - * This function is called periodically during test mode. - */ - @Override - public void testPeriodic() { - } + /** + * This function is called periodically during test mode. + */ + @Override + public void testPeriodic() { + } } diff --git a/wpilibjExamples/src/main/java/edu/wpi/first/wpilibj/examples/gyro/Robot.java b/wpilibjExamples/src/main/java/edu/wpi/first/wpilibj/examples/gyro/Robot.java index f22264b6f1..baa252ca06 100644 --- a/wpilibjExamples/src/main/java/edu/wpi/first/wpilibj/examples/gyro/Robot.java +++ b/wpilibjExamples/src/main/java/edu/wpi/first/wpilibj/examples/gyro/Robot.java @@ -19,38 +19,38 @@ import edu.wpi.first.wpilibj.drive.DifferentialDrive; * backwards while the gyro is used for direction keeping. */ public class Robot extends IterativeRobot { - private static final double kAngleSetpoint = 0.0; - private static final double kP = 0.005; // propotional turning constant + private static final double kAngleSetpoint = 0.0; + private static final double kP = 0.005; // propotional turning constant - // gyro calibration constant, may need to be adjusted; - // gyro value of 360 is set to correspond to one full revolution - private static final double kVoltsPerDegreePerSecond = 0.0128; + // gyro calibration constant, may need to be adjusted; + // gyro value of 360 is set to correspond to one full revolution + private static final double kVoltsPerDegreePerSecond = 0.0128; - private static final int kLeftMotorPort = 0; - private static final int kRightMotorPort = 1; - private static final int kGyroPort = 0; - private static final int kJoystickPort = 0; + private static final int kLeftMotorPort = 0; + private static final int kRightMotorPort = 1; + private static final int kGyroPort = 0; + private static final int kJoystickPort = 0; - private DifferentialDrive m_myRobot - = new DifferentialDrive(new Spark(kLeftMotorPort), - new Spark(kRightMotorPort)); - private AnalogGyro m_gyro = new AnalogGyro(kGyroPort); - private Joystick m_joystick = new Joystick(kJoystickPort); + private DifferentialDrive m_myRobot + = new DifferentialDrive(new Spark(kLeftMotorPort), + new Spark(kRightMotorPort)); + private AnalogGyro m_gyro = new AnalogGyro(kGyroPort); + private Joystick m_joystick = new Joystick(kJoystickPort); - @Override - public void robotInit() { - m_gyro.setSensitivity(kVoltsPerDegreePerSecond); - } + @Override + public void robotInit() { + m_gyro.setSensitivity(kVoltsPerDegreePerSecond); + } - /** - * The motor speed is set from the joystick while the RobotDrive turning - * value is assigned from the error between the setpoint and the gyro angle. - */ - @Override - public void teleopPeriodic() { - double turningValue = (kAngleSetpoint - m_gyro.getAngle()) * kP; - // Invert the direction of the turn if we are going backwards - turningValue = Math.copySign(turningValue, m_joystick.getY()); - m_myRobot.arcadeDrive(m_joystick.getY(), turningValue); - } + /** + * The motor speed is set from the joystick while the RobotDrive turning + * value is assigned from the error between the setpoint and the gyro angle. + */ + @Override + public void teleopPeriodic() { + double turningValue = (kAngleSetpoint - m_gyro.getAngle()) * kP; + // Invert the direction of the turn if we are going backwards + turningValue = Math.copySign(turningValue, m_joystick.getY()); + m_myRobot.arcadeDrive(m_joystick.getY(), turningValue); + } } diff --git a/wpilibjExamples/src/main/java/edu/wpi/first/wpilibj/examples/gyromecanum/Robot.java b/wpilibjExamples/src/main/java/edu/wpi/first/wpilibj/examples/gyromecanum/Robot.java index 7cc115f59f..0b7f8ef260 100644 --- a/wpilibjExamples/src/main/java/edu/wpi/first/wpilibj/examples/gyromecanum/Robot.java +++ b/wpilibjExamples/src/main/java/edu/wpi/first/wpilibj/examples/gyromecanum/Robot.java @@ -19,44 +19,44 @@ import edu.wpi.first.wpilibj.drive.MecanumDrive; * (field-oriented controls). */ public class Robot extends IterativeRobot { - // gyro calibration constant, may need to be adjusted; - // gyro value of 360 is set to correspond to one full revolution - private static final double kVoltsPerDegreePerSecond = 0.0128; + // gyro calibration constant, may need to be adjusted; + // gyro value of 360 is set to correspond to one full revolution + private static final double kVoltsPerDegreePerSecond = 0.0128; - private static final int kFrontLeftChannel = 0; - private static final int kRearLeftChannel = 1; - private static final int kFrontRightChannel = 2; - private static final int kRearRightChannel = 3; - private static final int kGyroPort = 0; - private static final int kJoystickPort = 0; + private static final int kFrontLeftChannel = 0; + private static final int kRearLeftChannel = 1; + private static final int kFrontRightChannel = 2; + private static final int kRearRightChannel = 3; + private static final int kGyroPort = 0; + private static final int kJoystickPort = 0; - private MecanumDrive m_robotDrive; - private AnalogGyro m_gyro = new AnalogGyro(kGyroPort); - private Joystick m_joystick = new Joystick(kJoystickPort); + private MecanumDrive m_robotDrive; + private AnalogGyro m_gyro = new AnalogGyro(kGyroPort); + private Joystick m_joystick = new Joystick(kJoystickPort); - @Override - public void robotInit() { - Spark frontLeft = new Spark(kFrontLeftChannel); - Spark rearLeft = new Spark(kRearLeftChannel); - Spark frontRight = new Spark(kFrontRightChannel); - Spark rearRight = new Spark(kRearRightChannel); + @Override + public void robotInit() { + Spark frontLeft = new Spark(kFrontLeftChannel); + Spark rearLeft = new Spark(kRearLeftChannel); + Spark frontRight = new Spark(kFrontRightChannel); + Spark rearRight = new Spark(kRearRightChannel); - // Invert the left side motors. - // You may need to change or remove this to match your robot. - frontLeft.setInverted(true); - rearLeft.setInverted(true); + // Invert the left side motors. + // You may need to change or remove this to match your robot. + frontLeft.setInverted(true); + rearLeft.setInverted(true); - m_robotDrive = new MecanumDrive(frontLeft, rearLeft, frontRight, rearRight); + m_robotDrive = new MecanumDrive(frontLeft, rearLeft, frontRight, rearRight); - m_gyro.setSensitivity(kVoltsPerDegreePerSecond); - } + m_gyro.setSensitivity(kVoltsPerDegreePerSecond); + } - /** - * Mecanum drive is used with the gyro angle as an input. - */ - @Override - public void teleopPeriodic() { - m_robotDrive.driveCartesian(m_joystick.getX(), m_joystick.getY(), - m_joystick.getZ(), m_gyro.getAngle()); - } + /** + * Mecanum drive is used with the gyro angle as an input. + */ + @Override + public void teleopPeriodic() { + m_robotDrive.driveCartesian(m_joystick.getX(), m_joystick.getY(), + m_joystick.getZ(), m_gyro.getAngle()); + } } diff --git a/wpilibjExamples/src/main/java/edu/wpi/first/wpilibj/examples/intermediatevision/Robot.java b/wpilibjExamples/src/main/java/edu/wpi/first/wpilibj/examples/intermediatevision/Robot.java index 738a3ea567..e1b3516e41 100644 --- a/wpilibjExamples/src/main/java/edu/wpi/first/wpilibj/examples/intermediatevision/Robot.java +++ b/wpilibjExamples/src/main/java/edu/wpi/first/wpilibj/examples/intermediatevision/Robot.java @@ -24,45 +24,45 @@ import org.opencv.imgproc.Imgproc; * processing. */ public class Robot extends IterativeRobot { - Thread m_visionThread; + Thread m_visionThread; - @Override - public void robotInit() { - m_visionThread = new Thread(() -> { - // Get the UsbCamera from CameraServer - UsbCamera camera = CameraServer.getInstance().startAutomaticCapture(); - // Set the resolution - camera.setResolution(640, 480); + @Override + public void robotInit() { + m_visionThread = new Thread(() -> { + // Get the UsbCamera from CameraServer + UsbCamera camera = CameraServer.getInstance().startAutomaticCapture(); + // Set the resolution + camera.setResolution(640, 480); - // Get a CvSink. This will capture Mats from the camera - CvSink cvSink = CameraServer.getInstance().getVideo(); - // Setup a CvSource. This will send images back to the Dashboard - CvSource outputStream - = CameraServer.getInstance().putVideo("Rectangle", 640, 480); + // Get a CvSink. This will capture Mats from the camera + CvSink cvSink = CameraServer.getInstance().getVideo(); + // Setup a CvSource. This will send images back to the Dashboard + CvSource outputStream + = CameraServer.getInstance().putVideo("Rectangle", 640, 480); - // Mats are very memory expensive. Lets reuse this Mat. - Mat mat = new Mat(); + // Mats are very memory expensive. Lets reuse this Mat. + Mat mat = new Mat(); - // This cannot be 'true'. The program will never exit if it is. This - // lets the robot stop this thread when restarting robot code or - // deploying. - while (!Thread.interrupted()) { - // Tell the CvSink to grab a frame from the camera and put it - // in the source mat. If there is an error notify the output. - if (cvSink.grabFrame(mat) == 0) { - // Send the output the error. - outputStream.notifyError(cvSink.getError()); - // skip the rest of the current iteration - continue; - } - // Put a rectangle on the image - Imgproc.rectangle(mat, new Point(100, 100), new Point(400, 400), - new Scalar(255, 255, 255), 5); - // Give the output stream a new image to display - outputStream.putFrame(mat); - } - }); - m_visionThread.setDaemon(true); - m_visionThread.start(); - } + // This cannot be 'true'. The program will never exit if it is. This + // lets the robot stop this thread when restarting robot code or + // deploying. + while (!Thread.interrupted()) { + // Tell the CvSink to grab a frame from the camera and put it + // in the source mat. If there is an error notify the output. + if (cvSink.grabFrame(mat) == 0) { + // Send the output the error. + outputStream.notifyError(cvSink.getError()); + // skip the rest of the current iteration + continue; + } + // Put a rectangle on the image + Imgproc.rectangle(mat, new Point(100, 100), new Point(400, 400), + new Scalar(255, 255, 255), 5); + // Give the output stream a new image to display + outputStream.putFrame(mat); + } + }); + m_visionThread.setDaemon(true); + m_visionThread.start(); + } } diff --git a/wpilibjExamples/src/main/java/edu/wpi/first/wpilibj/examples/mecanumdrive/Robot.java b/wpilibjExamples/src/main/java/edu/wpi/first/wpilibj/examples/mecanumdrive/Robot.java index 20076aee78..3a6aa0e1d0 100755 --- a/wpilibjExamples/src/main/java/edu/wpi/first/wpilibj/examples/mecanumdrive/Robot.java +++ b/wpilibjExamples/src/main/java/edu/wpi/first/wpilibj/examples/mecanumdrive/Robot.java @@ -17,38 +17,38 @@ import edu.wpi.first.wpilibj.drive.MecanumDrive; * class. */ public class Robot extends IterativeRobot { - private static final int kFrontLeftChannel = 2; - private static final int kRearLeftChannel = 3; - private static final int kFrontRightChannel = 1; - private static final int kRearRightChannel = 0; + private static final int kFrontLeftChannel = 2; + private static final int kRearLeftChannel = 3; + private static final int kFrontRightChannel = 1; + private static final int kRearRightChannel = 0; - private static final int kJoystickChannel = 0; + private static final int kJoystickChannel = 0; - private MecanumDrive m_robotDrive; - private Joystick m_stick; + private MecanumDrive m_robotDrive; + private Joystick m_stick; - @Override - public void robotInit() { - Spark frontLeft = new Spark(kFrontLeftChannel); - Spark rearLeft = new Spark(kRearLeftChannel); - Spark frontRight = new Spark(kFrontRightChannel); - Spark rearRight = new Spark(kRearRightChannel); + @Override + public void robotInit() { + Spark frontLeft = new Spark(kFrontLeftChannel); + Spark rearLeft = new Spark(kRearLeftChannel); + Spark frontRight = new Spark(kFrontRightChannel); + Spark rearRight = new Spark(kRearRightChannel); - // Invert the left side motors. - // You may need to change or remove this to match your robot. - frontLeft.setInverted(true); - rearLeft.setInverted(true); + // Invert the left side motors. + // You may need to change or remove this to match your robot. + frontLeft.setInverted(true); + rearLeft.setInverted(true); - m_robotDrive = new MecanumDrive(frontLeft, rearLeft, frontRight, rearRight); + m_robotDrive = new MecanumDrive(frontLeft, rearLeft, frontRight, rearRight); - m_stick = new Joystick(kJoystickChannel); - } + m_stick = new Joystick(kJoystickChannel); + } - @Override - public void teleopPeriodic() { - // Use the joystick X axis for lateral movement, Y axis for forward - // movement, and Z axis for rotation. - m_robotDrive.driveCartesian(m_stick.getX(), m_stick.getY(), - m_stick.getZ(), 0.0); - } + @Override + public void teleopPeriodic() { + // Use the joystick X axis for lateral movement, Y axis for forward + // movement, and Z axis for rotation. + m_robotDrive.driveCartesian(m_stick.getX(), m_stick.getY(), + m_stick.getZ(), 0.0); + } } diff --git a/wpilibjExamples/src/main/java/edu/wpi/first/wpilibj/examples/motorcontrol/Robot.java b/wpilibjExamples/src/main/java/edu/wpi/first/wpilibj/examples/motorcontrol/Robot.java index 9811eabdd7..307458e44c 100755 --- a/wpilibjExamples/src/main/java/edu/wpi/first/wpilibj/examples/motorcontrol/Robot.java +++ b/wpilibjExamples/src/main/java/edu/wpi/first/wpilibj/examples/motorcontrol/Robot.java @@ -21,20 +21,20 @@ import edu.wpi.first.wpilibj.Spark; * range from -1 to 1 making it easy to work together. */ public class Robot extends IterativeRobot { - private static final int kMotorPort = 0; - private static final int kJoystickPort = 0; + private static final int kMotorPort = 0; + private static final int kJoystickPort = 0; - private SpeedController m_motor; - private Joystick m_joystick; + private SpeedController m_motor; + private Joystick m_joystick; - @Override - public void robotInit() { - m_motor = new Spark(kMotorPort); - m_joystick = new Joystick(kJoystickPort); - } + @Override + public void robotInit() { + m_motor = new Spark(kMotorPort); + m_joystick = new Joystick(kJoystickPort); + } - @Override - public void teleopPeriodic() { - m_motor.set(m_joystick.getY()); - } + @Override + public void teleopPeriodic() { + m_motor.set(m_joystick.getY()); + } } diff --git a/wpilibjExamples/src/main/java/edu/wpi/first/wpilibj/examples/pacgoat/OI.java b/wpilibjExamples/src/main/java/edu/wpi/first/wpilibj/examples/pacgoat/OI.java index d66e012265..a7fe56a59c 100644 --- a/wpilibjExamples/src/main/java/edu/wpi/first/wpilibj/examples/pacgoat/OI.java +++ b/wpilibjExamples/src/main/java/edu/wpi/first/wpilibj/examples/pacgoat/OI.java @@ -27,31 +27,31 @@ import edu.wpi.first.wpilibj.smartdashboard.SmartDashboard; * functionality from the real robot is available. */ public class OI { - public Joystick m_joystick = new Joystick(0); + public Joystick m_joystick = new Joystick(0); - public OI() { - new JoystickButton(m_joystick, 12).whenPressed(new LowGoal()); - new JoystickButton(m_joystick, 10).whenPressed(new Collect()); + public OI() { + new JoystickButton(m_joystick, 12).whenPressed(new LowGoal()); + new JoystickButton(m_joystick, 10).whenPressed(new Collect()); - new JoystickButton(m_joystick, 11).whenPressed( - new SetPivotSetpoint(Pivot.kShoot)); - new JoystickButton(m_joystick, 9).whenPressed( - new SetPivotSetpoint(Pivot.kShootNear)); + new JoystickButton(m_joystick, 11).whenPressed( + new SetPivotSetpoint(Pivot.kShoot)); + new JoystickButton(m_joystick, 9).whenPressed( + new SetPivotSetpoint(Pivot.kShootNear)); - new DoubleButton(m_joystick, 2, 3).whenActive(new Shoot()); + new DoubleButton(m_joystick, 2, 3).whenActive(new Shoot()); - // SmartDashboard Buttons - SmartDashboard.putData("Drive Forward", new DriveForward(2.25)); - SmartDashboard.putData("Drive Backward", new DriveForward(-2.25)); - SmartDashboard.putData("Start Rollers", - new SetCollectionSpeed(Collector.kForward)); - SmartDashboard.putData("Stop Rollers", - new SetCollectionSpeed(Collector.kStop)); - SmartDashboard.putData("Reverse Rollers", - new SetCollectionSpeed(Collector.kReverse)); - } + // SmartDashboard Buttons + SmartDashboard.putData("Drive Forward", new DriveForward(2.25)); + SmartDashboard.putData("Drive Backward", new DriveForward(-2.25)); + SmartDashboard.putData("Start Rollers", + new SetCollectionSpeed(Collector.kForward)); + SmartDashboard.putData("Stop Rollers", + new SetCollectionSpeed(Collector.kStop)); + SmartDashboard.putData("Reverse Rollers", + new SetCollectionSpeed(Collector.kReverse)); + } - public Joystick getJoystick() { - return m_joystick; - } + public Joystick getJoystick() { + return m_joystick; + } } diff --git a/wpilibjExamples/src/main/java/edu/wpi/first/wpilibj/examples/pacgoat/Robot.java b/wpilibjExamples/src/main/java/edu/wpi/first/wpilibj/examples/pacgoat/Robot.java index 6de3eb3e6d..478a9cac0f 100644 --- a/wpilibjExamples/src/main/java/edu/wpi/first/wpilibj/examples/pacgoat/Robot.java +++ b/wpilibjExamples/src/main/java/edu/wpi/first/wpilibj/examples/pacgoat/Robot.java @@ -31,98 +31,98 @@ import edu.wpi.first.wpilibj.examples.pacgoat.subsystems.Shooter; * directory. */ public class Robot extends IterativeRobot { - Command m_autonomousCommand; - public static OI oi; + Command m_autonomousCommand; + public static OI oi; - // Initialize the subsystems - public static DriveTrain drivetrain = new DriveTrain(); - public static Collector collector = new Collector(); - public static Shooter shooter = new Shooter(); - public static Pneumatics pneumatics = new Pneumatics(); - public static Pivot pivot = new Pivot(); + // Initialize the subsystems + public static DriveTrain drivetrain = new DriveTrain(); + public static Collector collector = new Collector(); + public static Shooter shooter = new Shooter(); + public static Pneumatics pneumatics = new Pneumatics(); + public static Pivot pivot = new Pivot(); - public SendableChooser m_autoChooser; + public SendableChooser m_autoChooser; - // This function is run when the robot is first started up and should be - // used for any initialization code. - @Override - public void robotInit() { - SmartDashboard.putData(drivetrain); - SmartDashboard.putData(collector); - SmartDashboard.putData(shooter); - SmartDashboard.putData(pneumatics); - SmartDashboard.putData(pivot); + // This function is run when the robot is first started up and should be + // used for any initialization code. + @Override + public void robotInit() { + SmartDashboard.putData(drivetrain); + SmartDashboard.putData(collector); + SmartDashboard.putData(shooter); + SmartDashboard.putData(pneumatics); + SmartDashboard.putData(pivot); - // This MUST be here. If the OI creates Commands (which it very likely - // will), constructing it during the construction of CommandBase (from - // which commands extend), subsystems are not guaranteed to be - // yet. Thus, their requires() statements may grab null pointers. Bad - // news. Don't move it. - oi = new OI(); + // This MUST be here. If the OI creates Commands (which it very likely + // will), constructing it during the construction of CommandBase (from + // which commands extend), subsystems are not guaranteed to be + // yet. Thus, their requires() statements may grab null pointers. Bad + // news. Don't move it. + oi = new OI(); - // instantiate the command used for the autonomous period - m_autoChooser = new SendableChooser(); - m_autoChooser.addDefault("Drive and Shoot", new DriveAndShootAutonomous()); - m_autoChooser.addObject("Drive Forward", new DriveForward()); - SmartDashboard.putData("Auto Mode", m_autoChooser); - } + // instantiate the command used for the autonomous period + m_autoChooser = new SendableChooser(); + m_autoChooser.addDefault("Drive and Shoot", new DriveAndShootAutonomous()); + m_autoChooser.addObject("Drive Forward", new DriveForward()); + SmartDashboard.putData("Auto Mode", m_autoChooser); + } - @Override - public void autonomousInit() { - m_autonomousCommand = (Command) m_autoChooser.getSelected(); - m_autonomousCommand.start(); - } + @Override + public void autonomousInit() { + m_autonomousCommand = (Command) m_autoChooser.getSelected(); + m_autonomousCommand.start(); + } - // This function is called periodically during autonomous - @Override - public void autonomousPeriodic() { - Scheduler.getInstance().run(); - log(); - } + // This function is called periodically during autonomous + @Override + public void autonomousPeriodic() { + Scheduler.getInstance().run(); + log(); + } - @Override - public void teleopInit() { - // This makes sure that the autonomous stops running when - // teleop starts running. If you want the autonomous to - // continue until interrupted by another command, remove - // this line or comment it out. - if (m_autonomousCommand != null) { - m_autonomousCommand.cancel(); - } - } + @Override + public void teleopInit() { + // This makes sure that the autonomous stops running when + // teleop starts running. If you want the autonomous to + // continue until interrupted by another command, remove + // this line or comment it out. + if (m_autonomousCommand != null) { + m_autonomousCommand.cancel(); + } + } - // This function is called periodically during operator control - @Override - public void teleopPeriodic() { - Scheduler.getInstance().run(); - log(); - } + // This function is called periodically during operator control + @Override + public void teleopPeriodic() { + Scheduler.getInstance().run(); + log(); + } - // This function called periodically during test mode - @Override - public void testPeriodic() { - } + // This function called periodically during test mode + @Override + public void testPeriodic() { + } - @Override - public void disabledInit() { - Robot.shooter.unlatch(); - } + @Override + public void disabledInit() { + Robot.shooter.unlatch(); + } - // This function is called periodically while disabled - @Override - public void disabledPeriodic() { - log(); - } + // This function is called periodically while disabled + @Override + public void disabledPeriodic() { + log(); + } - /** - * Log interesting values to the SmartDashboard. - */ - private void log() { - Robot.pneumatics.writePressure(); - SmartDashboard.putNumber("Pivot Pot Value", Robot.pivot.getAngle()); - SmartDashboard.putNumber("Left Distance", - drivetrain.getLeftEncoder().getDistance()); - SmartDashboard.putNumber("Right Distance", - drivetrain.getRightEncoder().getDistance()); - } + /** + * Log interesting values to the SmartDashboard. + */ + private void log() { + Robot.pneumatics.writePressure(); + SmartDashboard.putNumber("Pivot Pot Value", Robot.pivot.getAngle()); + SmartDashboard.putNumber("Left Distance", + drivetrain.getLeftEncoder().getDistance()); + SmartDashboard.putNumber("Right Distance", + drivetrain.getRightEncoder().getDistance()); + } } diff --git a/wpilibjExamples/src/main/java/edu/wpi/first/wpilibj/examples/pacgoat/commands/CheckForHotGoal.java b/wpilibjExamples/src/main/java/edu/wpi/first/wpilibj/examples/pacgoat/commands/CheckForHotGoal.java index 16d4c8b399..4136ed14d8 100644 --- a/wpilibjExamples/src/main/java/edu/wpi/first/wpilibj/examples/pacgoat/commands/CheckForHotGoal.java +++ b/wpilibjExamples/src/main/java/edu/wpi/first/wpilibj/examples/pacgoat/commands/CheckForHotGoal.java @@ -18,13 +18,13 @@ import edu.wpi.first.wpilibj.examples.pacgoat.Robot; * the hot goal is detected or until it is timed out. */ public class CheckForHotGoal extends Command { - public CheckForHotGoal(double time) { - setTimeout(time); - } + public CheckForHotGoal(double time) { + setTimeout(time); + } - // Make this return true when this Command no longer needs to run execute() - @Override - protected boolean isFinished() { - return isTimedOut() || Robot.shooter.goalIsHot(); - } + // Make this return true when this Command no longer needs to run execute() + @Override + protected boolean isFinished() { + return isTimedOut() || Robot.shooter.goalIsHot(); + } } diff --git a/wpilibjExamples/src/main/java/edu/wpi/first/wpilibj/examples/pacgoat/commands/CloseClaw.java b/wpilibjExamples/src/main/java/edu/wpi/first/wpilibj/examples/pacgoat/commands/CloseClaw.java index 251e756039..e9c154aa34 100644 --- a/wpilibjExamples/src/main/java/edu/wpi/first/wpilibj/examples/pacgoat/commands/CloseClaw.java +++ b/wpilibjExamples/src/main/java/edu/wpi/first/wpilibj/examples/pacgoat/commands/CloseClaw.java @@ -18,13 +18,13 @@ import edu.wpi.first.wpilibj.examples.pacgoat.Robot; * detect that. */ public class CloseClaw extends InstantCommand { - public CloseClaw() { - requires(Robot.collector); - } + public CloseClaw() { + requires(Robot.collector); + } - // Called just before this Command runs the first time - @Override - protected void initialize() { - Robot.collector.close(); - } + // Called just before this Command runs the first time + @Override + protected void initialize() { + Robot.collector.close(); + } } diff --git a/wpilibjExamples/src/main/java/edu/wpi/first/wpilibj/examples/pacgoat/commands/Collect.java b/wpilibjExamples/src/main/java/edu/wpi/first/wpilibj/examples/pacgoat/commands/Collect.java index 21d9f358be..6d3763e96f 100644 --- a/wpilibjExamples/src/main/java/edu/wpi/first/wpilibj/examples/pacgoat/commands/Collect.java +++ b/wpilibjExamples/src/main/java/edu/wpi/first/wpilibj/examples/pacgoat/commands/Collect.java @@ -16,10 +16,10 @@ import edu.wpi.first.wpilibj.examples.pacgoat.subsystems.Pivot; * Get the robot set to collect balls. */ public class Collect extends CommandGroup { - public Collect() { - addSequential(new SetCollectionSpeed(Collector.kForward)); - addParallel(new CloseClaw()); - addSequential(new SetPivotSetpoint(Pivot.kCollect)); - addSequential(new WaitForBall()); - } + public Collect() { + addSequential(new SetCollectionSpeed(Collector.kForward)); + addParallel(new CloseClaw()); + addSequential(new SetPivotSetpoint(Pivot.kCollect)); + addSequential(new WaitForBall()); + } } diff --git a/wpilibjExamples/src/main/java/edu/wpi/first/wpilibj/examples/pacgoat/commands/DriveAndShootAutonomous.java b/wpilibjExamples/src/main/java/edu/wpi/first/wpilibj/examples/pacgoat/commands/DriveAndShootAutonomous.java index fcce7ed018..18d5b2bb64 100644 --- a/wpilibjExamples/src/main/java/edu/wpi/first/wpilibj/examples/pacgoat/commands/DriveAndShootAutonomous.java +++ b/wpilibjExamples/src/main/java/edu/wpi/first/wpilibj/examples/pacgoat/commands/DriveAndShootAutonomous.java @@ -16,15 +16,15 @@ import edu.wpi.first.wpilibj.examples.pacgoat.Robot; * it will wait briefly. */ public class DriveAndShootAutonomous extends CommandGroup { - public DriveAndShootAutonomous() { - addSequential(new CloseClaw()); - addSequential(new WaitForPressure(), 2); - if (Robot.isReal()) { - // NOTE: Simulation doesn't currently have the concept of hot. - addSequential(new CheckForHotGoal(2)); - } - addSequential(new SetPivotSetpoint(45)); - addSequential(new DriveForward(8, 0.3)); - addSequential(new Shoot()); - } + public DriveAndShootAutonomous() { + addSequential(new CloseClaw()); + addSequential(new WaitForPressure(), 2); + if (Robot.isReal()) { + // NOTE: Simulation doesn't currently have the concept of hot. + addSequential(new CheckForHotGoal(2)); + } + addSequential(new SetPivotSetpoint(45)); + addSequential(new DriveForward(8, 0.3)); + addSequential(new Shoot()); + } } diff --git a/wpilibjExamples/src/main/java/edu/wpi/first/wpilibj/examples/pacgoat/commands/DriveForward.java b/wpilibjExamples/src/main/java/edu/wpi/first/wpilibj/examples/pacgoat/commands/DriveForward.java index 85626071a9..90cb207923 100644 --- a/wpilibjExamples/src/main/java/edu/wpi/first/wpilibj/examples/pacgoat/commands/DriveForward.java +++ b/wpilibjExamples/src/main/java/edu/wpi/first/wpilibj/examples/pacgoat/commands/DriveForward.java @@ -16,50 +16,50 @@ import edu.wpi.first.wpilibj.examples.pacgoat.Robot; * control This command will drive a given distance limiting to a maximum speed. */ public class DriveForward extends Command { - private double m_driveForwardSpeed; - private double m_distance; - private double m_error; - private static final double kTolerance = 0.1; - private static final double kP = -1.0 / 5.0; + private double m_driveForwardSpeed; + private double m_distance; + private double m_error; + private static final double kTolerance = 0.1; + private static final double kP = -1.0 / 5.0; - public DriveForward() { - this(10, 0.5); - } + public DriveForward() { + this(10, 0.5); + } - public DriveForward(double dist) { - this(dist, 0.5); - } + public DriveForward(double dist) { + this(dist, 0.5); + } - public DriveForward(double dist, double maxSpeed) { - requires(Robot.drivetrain); - m_distance = dist; - m_driveForwardSpeed = maxSpeed; - } + public DriveForward(double dist, double maxSpeed) { + requires(Robot.drivetrain); + m_distance = dist; + m_driveForwardSpeed = maxSpeed; + } - @Override - protected void initialize() { - Robot.drivetrain.getRightEncoder().reset(); - setTimeout(2); - } + @Override + protected void initialize() { + Robot.drivetrain.getRightEncoder().reset(); + setTimeout(2); + } - @Override - protected void execute() { - m_error = m_distance - Robot.drivetrain.getRightEncoder().getDistance(); - if (m_driveForwardSpeed * kP * m_error >= m_driveForwardSpeed) { - Robot.drivetrain.tankDrive(m_driveForwardSpeed, m_driveForwardSpeed); - } else { - Robot.drivetrain.tankDrive(m_driveForwardSpeed * kP * m_error, - m_driveForwardSpeed * kP * m_error); - } - } + @Override + protected void execute() { + m_error = m_distance - Robot.drivetrain.getRightEncoder().getDistance(); + if (m_driveForwardSpeed * kP * m_error >= m_driveForwardSpeed) { + Robot.drivetrain.tankDrive(m_driveForwardSpeed, m_driveForwardSpeed); + } else { + Robot.drivetrain.tankDrive(m_driveForwardSpeed * kP * m_error, + m_driveForwardSpeed * kP * m_error); + } + } - @Override - protected boolean isFinished() { - return Math.abs(m_error) <= kTolerance || isTimedOut(); - } + @Override + protected boolean isFinished() { + return Math.abs(m_error) <= kTolerance || isTimedOut(); + } - @Override - protected void end() { - Robot.drivetrain.stop(); - } + @Override + protected void end() { + Robot.drivetrain.stop(); + } } diff --git a/wpilibjExamples/src/main/java/edu/wpi/first/wpilibj/examples/pacgoat/commands/DriveWithJoystick.java b/wpilibjExamples/src/main/java/edu/wpi/first/wpilibj/examples/pacgoat/commands/DriveWithJoystick.java index 580fc8abc3..883ff62eae 100644 --- a/wpilibjExamples/src/main/java/edu/wpi/first/wpilibj/examples/pacgoat/commands/DriveWithJoystick.java +++ b/wpilibjExamples/src/main/java/edu/wpi/first/wpilibj/examples/pacgoat/commands/DriveWithJoystick.java @@ -16,22 +16,22 @@ import edu.wpi.first.wpilibj.examples.pacgoat.Robot; * except when interrupted by another command. */ public class DriveWithJoystick extends Command { - public DriveWithJoystick() { - requires(Robot.drivetrain); - } + public DriveWithJoystick() { + requires(Robot.drivetrain); + } - @Override - protected void execute() { - Robot.drivetrain.tankDrive(Robot.oi.getJoystick()); - } + @Override + protected void execute() { + Robot.drivetrain.tankDrive(Robot.oi.getJoystick()); + } - @Override - protected boolean isFinished() { - return false; - } + @Override + protected boolean isFinished() { + return false; + } - @Override - protected void end() { - Robot.drivetrain.stop(); - } + @Override + protected void end() { + Robot.drivetrain.stop(); + } } diff --git a/wpilibjExamples/src/main/java/edu/wpi/first/wpilibj/examples/pacgoat/commands/ExtendShooter.java b/wpilibjExamples/src/main/java/edu/wpi/first/wpilibj/examples/pacgoat/commands/ExtendShooter.java index 07857cee31..cfad93d02b 100644 --- a/wpilibjExamples/src/main/java/edu/wpi/first/wpilibj/examples/pacgoat/commands/ExtendShooter.java +++ b/wpilibjExamples/src/main/java/edu/wpi/first/wpilibj/examples/pacgoat/commands/ExtendShooter.java @@ -15,20 +15,20 @@ import edu.wpi.first.wpilibj.examples.pacgoat.Robot; * Extend the shooter and then retract it after a second. */ public class ExtendShooter extends TimedCommand { - public ExtendShooter() { - super(1); - requires(Robot.shooter); - } + public ExtendShooter() { + super(1); + requires(Robot.shooter); + } - // Called just before this Command runs the first time - @Override - protected void initialize() { - Robot.shooter.extendBoth(); - } + // Called just before this Command runs the first time + @Override + protected void initialize() { + Robot.shooter.extendBoth(); + } - // Called once after isFinished returns true - @Override - protected void end() { - Robot.shooter.retractBoth(); - } + // Called once after isFinished returns true + @Override + protected void end() { + Robot.shooter.retractBoth(); + } } diff --git a/wpilibjExamples/src/main/java/edu/wpi/first/wpilibj/examples/pacgoat/commands/LowGoal.java b/wpilibjExamples/src/main/java/edu/wpi/first/wpilibj/examples/pacgoat/commands/LowGoal.java index bb5247cc7a..99f94b1a27 100644 --- a/wpilibjExamples/src/main/java/edu/wpi/first/wpilibj/examples/pacgoat/commands/LowGoal.java +++ b/wpilibjExamples/src/main/java/edu/wpi/first/wpilibj/examples/pacgoat/commands/LowGoal.java @@ -17,9 +17,9 @@ import edu.wpi.first.wpilibj.examples.pacgoat.subsystems.Pivot; * it. */ public class LowGoal extends CommandGroup { - public LowGoal() { - addSequential(new SetPivotSetpoint(Pivot.kLowGoal)); - addSequential(new SetCollectionSpeed(Collector.kReverse)); - addSequential(new ExtendShooter()); - } + public LowGoal() { + addSequential(new SetPivotSetpoint(Pivot.kLowGoal)); + addSequential(new SetCollectionSpeed(Collector.kReverse)); + addSequential(new ExtendShooter()); + } } diff --git a/wpilibjExamples/src/main/java/edu/wpi/first/wpilibj/examples/pacgoat/commands/OpenClaw.java b/wpilibjExamples/src/main/java/edu/wpi/first/wpilibj/examples/pacgoat/commands/OpenClaw.java index ef9e72a8fc..f59a6f6be2 100644 --- a/wpilibjExamples/src/main/java/edu/wpi/first/wpilibj/examples/pacgoat/commands/OpenClaw.java +++ b/wpilibjExamples/src/main/java/edu/wpi/first/wpilibj/examples/pacgoat/commands/OpenClaw.java @@ -15,19 +15,19 @@ import edu.wpi.first.wpilibj.examples.pacgoat.Robot; * Opens the claw. */ public class OpenClaw extends Command { - public OpenClaw() { - requires(Robot.collector); - } + public OpenClaw() { + requires(Robot.collector); + } - // Called just before this Command runs the first time - @Override - protected void initialize() { - Robot.collector.open(); - } + // Called just before this Command runs the first time + @Override + protected void initialize() { + Robot.collector.open(); + } - // Make this return true when this Command no longer needs to run execute() - @Override - protected boolean isFinished() { - return Robot.collector.isOpen(); - } + // Make this return true when this Command no longer needs to run execute() + @Override + protected boolean isFinished() { + return Robot.collector.isOpen(); + } } diff --git a/wpilibjExamples/src/main/java/edu/wpi/first/wpilibj/examples/pacgoat/commands/SetCollectionSpeed.java b/wpilibjExamples/src/main/java/edu/wpi/first/wpilibj/examples/pacgoat/commands/SetCollectionSpeed.java index 28a69867a2..4b9f8ac80b 100644 --- a/wpilibjExamples/src/main/java/edu/wpi/first/wpilibj/examples/pacgoat/commands/SetCollectionSpeed.java +++ b/wpilibjExamples/src/main/java/edu/wpi/first/wpilibj/examples/pacgoat/commands/SetCollectionSpeed.java @@ -17,16 +17,16 @@ import edu.wpi.first.wpilibj.examples.pacgoat.Robot; * the spinners may still be adjusting their speed. */ public class SetCollectionSpeed extends InstantCommand { - private double m_speed; + private double m_speed; - public SetCollectionSpeed(double speed) { - requires(Robot.collector); - this.m_speed = speed; - } + public SetCollectionSpeed(double speed) { + requires(Robot.collector); + this.m_speed = speed; + } - // Called just before this Command runs the first time - @Override - protected void initialize() { - Robot.collector.setSpeed(m_speed); - } + // Called just before this Command runs the first time + @Override + protected void initialize() { + Robot.collector.setSpeed(m_speed); + } } diff --git a/wpilibjExamples/src/main/java/edu/wpi/first/wpilibj/examples/pacgoat/commands/SetPivotSetpoint.java b/wpilibjExamples/src/main/java/edu/wpi/first/wpilibj/examples/pacgoat/commands/SetPivotSetpoint.java index 5873eb1610..088852c446 100644 --- a/wpilibjExamples/src/main/java/edu/wpi/first/wpilibj/examples/pacgoat/commands/SetPivotSetpoint.java +++ b/wpilibjExamples/src/main/java/edu/wpi/first/wpilibj/examples/pacgoat/commands/SetPivotSetpoint.java @@ -17,23 +17,23 @@ import edu.wpi.first.wpilibj.examples.pacgoat.Robot; * commands using the pivot should make sure they disable PID! */ public class SetPivotSetpoint extends Command { - private double m_setpoint; + private double m_setpoint; - public SetPivotSetpoint(double setpoint) { - this.m_setpoint = setpoint; - requires(Robot.pivot); - } + public SetPivotSetpoint(double setpoint) { + this.m_setpoint = setpoint; + requires(Robot.pivot); + } - // Called just before this Command runs the first time - @Override - protected void initialize() { - Robot.pivot.enable(); - Robot.pivot.setSetpoint(m_setpoint); - } + // Called just before this Command runs the first time + @Override + protected void initialize() { + Robot.pivot.enable(); + Robot.pivot.setSetpoint(m_setpoint); + } - // Make this return true when this Command no longer needs to run execute() - @Override - protected boolean isFinished() { - return Robot.pivot.onTarget(); - } + // Make this return true when this Command no longer needs to run execute() + @Override + protected boolean isFinished() { + return Robot.pivot.onTarget(); + } } diff --git a/wpilibjExamples/src/main/java/edu/wpi/first/wpilibj/examples/pacgoat/commands/Shoot.java b/wpilibjExamples/src/main/java/edu/wpi/first/wpilibj/examples/pacgoat/commands/Shoot.java index ba7477fc6b..af8f41d269 100644 --- a/wpilibjExamples/src/main/java/edu/wpi/first/wpilibj/examples/pacgoat/commands/Shoot.java +++ b/wpilibjExamples/src/main/java/edu/wpi/first/wpilibj/examples/pacgoat/commands/Shoot.java @@ -15,10 +15,10 @@ import edu.wpi.first.wpilibj.examples.pacgoat.subsystems.Collector; * Shoot the ball at the current angle. */ public class Shoot extends CommandGroup { - public Shoot() { - addSequential(new WaitForPressure()); - addSequential(new SetCollectionSpeed(Collector.kStop)); - addSequential(new OpenClaw()); - addSequential(new ExtendShooter()); - } + public Shoot() { + addSequential(new WaitForPressure()); + addSequential(new SetCollectionSpeed(Collector.kStop)); + addSequential(new OpenClaw()); + addSequential(new ExtendShooter()); + } } diff --git a/wpilibjExamples/src/main/java/edu/wpi/first/wpilibj/examples/pacgoat/commands/WaitForBall.java b/wpilibjExamples/src/main/java/edu/wpi/first/wpilibj/examples/pacgoat/commands/WaitForBall.java index 4a27abbcb5..bf1d506115 100644 --- a/wpilibjExamples/src/main/java/edu/wpi/first/wpilibj/examples/pacgoat/commands/WaitForBall.java +++ b/wpilibjExamples/src/main/java/edu/wpi/first/wpilibj/examples/pacgoat/commands/WaitForBall.java @@ -17,13 +17,13 @@ import edu.wpi.first.wpilibj.examples.pacgoat.Robot; * condition. */ public class WaitForBall extends Command { - public WaitForBall() { - requires(Robot.collector); - } + public WaitForBall() { + requires(Robot.collector); + } - // Make this return true when this Command no longer needs to run execute() - @Override - protected boolean isFinished() { - return Robot.collector.hasBall(); - } + // Make this return true when this Command no longer needs to run execute() + @Override + protected boolean isFinished() { + return Robot.collector.hasBall(); + } } diff --git a/wpilibjExamples/src/main/java/edu/wpi/first/wpilibj/examples/pacgoat/commands/WaitForPressure.java b/wpilibjExamples/src/main/java/edu/wpi/first/wpilibj/examples/pacgoat/commands/WaitForPressure.java index 14d03a4e74..39bac0ab53 100644 --- a/wpilibjExamples/src/main/java/edu/wpi/first/wpilibj/examples/pacgoat/commands/WaitForPressure.java +++ b/wpilibjExamples/src/main/java/edu/wpi/first/wpilibj/examples/pacgoat/commands/WaitForPressure.java @@ -16,13 +16,13 @@ import edu.wpi.first.wpilibj.examples.pacgoat.Robot; * and is intended to be used in command groups to wait for this condition. */ public class WaitForPressure extends Command { - public WaitForPressure() { - requires(Robot.pneumatics); - } + public WaitForPressure() { + requires(Robot.pneumatics); + } - // Make this return true when this Command no longer needs to run execute() - @Override - protected boolean isFinished() { - return Robot.pneumatics.isPressurized(); - } + // Make this return true when this Command no longer needs to run execute() + @Override + protected boolean isFinished() { + return Robot.pneumatics.isPressurized(); + } } diff --git a/wpilibjExamples/src/main/java/edu/wpi/first/wpilibj/examples/pacgoat/subsystems/Collector.java b/wpilibjExamples/src/main/java/edu/wpi/first/wpilibj/examples/pacgoat/subsystems/Collector.java index 70b2827465..d618f71fa1 100644 --- a/wpilibjExamples/src/main/java/edu/wpi/first/wpilibj/examples/pacgoat/subsystems/Collector.java +++ b/wpilibjExamples/src/main/java/edu/wpi/first/wpilibj/examples/pacgoat/subsystems/Collector.java @@ -19,81 +19,81 @@ import edu.wpi.first.wpilibj.command.Subsystem; * to check if the piston is open. */ public class Collector extends Subsystem { - // Constants for some useful speeds - public static final double kForward = 1; - public static final double kStop = 0; - public static final double kReverse = -1; + // Constants for some useful speeds + public static final double kForward = 1; + public static final double kStop = 0; + public static final double kReverse = -1; - // Subsystem devices - private SpeedController m_rollerMotor = new Victor(6); - private DigitalInput m_ballDetector = new DigitalInput(10); - private DigitalInput m_openDetector = new DigitalInput(6); - private Solenoid m_piston = new Solenoid(1, 1); + // Subsystem devices + private SpeedController m_rollerMotor = new Victor(6); + private DigitalInput m_ballDetector = new DigitalInput(10); + private DigitalInput m_openDetector = new DigitalInput(6); + private Solenoid m_piston = new Solenoid(1, 1); - public Collector() { - // Put everything to the LiveWindow for testing. - addChild("Roller Motor", (Victor) m_rollerMotor); - addChild("Ball Detector", m_ballDetector); - addChild("Claw Open Detector", m_openDetector); - addChild("Piston", m_piston); - } + public Collector() { + // Put everything to the LiveWindow for testing. + addChild("Roller Motor", (Victor) m_rollerMotor); + addChild("Ball Detector", m_ballDetector); + addChild("Claw Open Detector", m_openDetector); + addChild("Piston", m_piston); + } - /** - * Whether or not the robot has the ball. - * - *

NOTE: The current simulation model uses the the lower part of the claw - * since the limit switch wasn't exported. At some point, this will be - * updated. - * - * @return Whether or not the robot has the ball. - */ - public boolean hasBall() { - return m_ballDetector.get(); // TODO: prepend ! to reflect real robot - } + /** + * Whether or not the robot has the ball. + * + *

NOTE: The current simulation model uses the the lower part of the claw + * since the limit switch wasn't exported. At some point, this will be + * updated. + * + * @return Whether or not the robot has the ball. + */ + public boolean hasBall() { + return m_ballDetector.get(); // TODO: prepend ! to reflect real robot + } - /** - * Set the speed to spin the collector rollers. - * - * @param speed The speed to spin the rollers. - */ - public void setSpeed(double speed) { - m_rollerMotor.set(-speed); - } + /** + * Set the speed to spin the collector rollers. + * + * @param speed The speed to spin the rollers. + */ + public void setSpeed(double speed) { + m_rollerMotor.set(-speed); + } - /** - * Stop the rollers from spinning. - */ - public void stop() { - m_rollerMotor.set(0); - } + /** + * Stop the rollers from spinning. + */ + public void stop() { + m_rollerMotor.set(0); + } - /** - * Wether or not the claw is open. - * - * @return Whether or not the claw is open. - */ - public boolean isOpen() { - return m_openDetector.get(); // TODO: prepend ! to reflect real robot - } + /** + * Wether or not the claw is open. + * + * @return Whether or not the claw is open. + */ + public boolean isOpen() { + return m_openDetector.get(); // TODO: prepend ! to reflect real robot + } - /** - * Open the claw up (For shooting). - */ - public void open() { - m_piston.set(true); - } + /** + * Open the claw up (For shooting). + */ + public void open() { + m_piston.set(true); + } - /** - * Close the claw (For collecting and driving). - */ - public void close() { - m_piston.set(false); - } + /** + * Close the claw (For collecting and driving). + */ + public void close() { + m_piston.set(false); + } - /** - * No default command. - */ - @Override - protected void initDefaultCommand() { - } + /** + * No default command. + */ + @Override + protected void initDefaultCommand() { + } } diff --git a/wpilibjExamples/src/main/java/edu/wpi/first/wpilibj/examples/pacgoat/subsystems/DriveTrain.java b/wpilibjExamples/src/main/java/edu/wpi/first/wpilibj/examples/pacgoat/subsystems/DriveTrain.java index 9b34267eb9..1c219c265d 100644 --- a/wpilibjExamples/src/main/java/edu/wpi/first/wpilibj/examples/pacgoat/subsystems/DriveTrain.java +++ b/wpilibjExamples/src/main/java/edu/wpi/first/wpilibj/examples/pacgoat/subsystems/DriveTrain.java @@ -26,115 +26,115 @@ import edu.wpi.first.wpilibj.examples.pacgoat.commands.DriveWithJoystick; * information about it's speed and position. */ public class DriveTrain extends Subsystem { - // Subsystem devices - private SpeedController m_frontLeftCIM = new Victor(1); - private SpeedController m_frontRightCIM = new Victor(2); - private SpeedController m_rearLeftCIM = new Victor(3); - private SpeedController m_rearRightCIM = new Victor(4); - private SpeedControllerGroup m_leftCIMs = new SpeedControllerGroup( - m_frontLeftCIM, m_rearLeftCIM); - private SpeedControllerGroup m_rightCIMs = new SpeedControllerGroup( - m_frontRightCIM, m_rearRightCIM); - private DifferentialDrive m_drive; - private Encoder m_rightEncoder = new Encoder(1, 2, true, EncodingType.k4X); - private Encoder m_leftEncoder = new Encoder(3, 4, false, EncodingType.k4X); - private AnalogGyro m_gyro = new AnalogGyro(2); + // Subsystem devices + private SpeedController m_frontLeftCIM = new Victor(1); + private SpeedController m_frontRightCIM = new Victor(2); + private SpeedController m_rearLeftCIM = new Victor(3); + private SpeedController m_rearRightCIM = new Victor(4); + private SpeedControllerGroup m_leftCIMs = new SpeedControllerGroup( + m_frontLeftCIM, m_rearLeftCIM); + private SpeedControllerGroup m_rightCIMs = new SpeedControllerGroup( + m_frontRightCIM, m_rearRightCIM); + private DifferentialDrive m_drive; + private Encoder m_rightEncoder = new Encoder(1, 2, true, EncodingType.k4X); + private Encoder m_leftEncoder = new Encoder(3, 4, false, EncodingType.k4X); + private AnalogGyro m_gyro = new AnalogGyro(2); - public DriveTrain() { - // Configure drive motors - addChild("Front Left CIM", (Victor) m_frontLeftCIM); - addChild("Front Right CIM", (Victor) m_frontRightCIM); - addChild("Back Left CIM", (Victor) m_rearLeftCIM); - addChild("Back Right CIM", (Victor) m_rearRightCIM); + public DriveTrain() { + // Configure drive motors + addChild("Front Left CIM", (Victor) m_frontLeftCIM); + addChild("Front Right CIM", (Victor) m_frontRightCIM); + addChild("Back Left CIM", (Victor) m_rearLeftCIM); + addChild("Back Right CIM", (Victor) m_rearRightCIM); - // Configure the DifferentialDrive to reflect the fact that all motors - // are wired backwards (right is inverted in DifferentialDrive). - m_leftCIMs.setInverted(true); - m_drive = new DifferentialDrive(m_leftCIMs, m_rightCIMs); - m_drive.setSafetyEnabled(true); - m_drive.setExpiration(0.1); - m_drive.setMaxOutput(1.0); + // Configure the DifferentialDrive to reflect the fact that all motors + // are wired backwards (right is inverted in DifferentialDrive). + m_leftCIMs.setInverted(true); + m_drive = new DifferentialDrive(m_leftCIMs, m_rightCIMs); + m_drive.setSafetyEnabled(true); + m_drive.setExpiration(0.1); + m_drive.setMaxOutput(1.0); - // Configure encoders - m_rightEncoder.setPIDSourceType(PIDSourceType.kDisplacement); - m_leftEncoder.setPIDSourceType(PIDSourceType.kDisplacement); + // Configure encoders + m_rightEncoder.setPIDSourceType(PIDSourceType.kDisplacement); + m_leftEncoder.setPIDSourceType(PIDSourceType.kDisplacement); - if (Robot.isReal()) { // Converts to feet - m_rightEncoder.setDistancePerPulse(0.0785398); - m_leftEncoder.setDistancePerPulse(0.0785398); - } else { - // Convert to feet 4in diameter wheels with 360 tick sim encoders - m_rightEncoder.setDistancePerPulse( - (4.0/* in */ * Math.PI) / (360.0 * 12.0/* in/ft */)); - m_leftEncoder.setDistancePerPulse( - (4.0/* in */ * Math.PI) / (360.0 * 12.0/* in/ft */)); - } + if (Robot.isReal()) { // Converts to feet + m_rightEncoder.setDistancePerPulse(0.0785398); + m_leftEncoder.setDistancePerPulse(0.0785398); + } else { + // Convert to feet 4in diameter wheels with 360 tick sim encoders + m_rightEncoder.setDistancePerPulse( + (4.0/* in */ * Math.PI) / (360.0 * 12.0/* in/ft */)); + m_leftEncoder.setDistancePerPulse( + (4.0/* in */ * Math.PI) / (360.0 * 12.0/* in/ft */)); + } - addChild("Right Encoder", m_rightEncoder); - addChild("Left Encoder", m_leftEncoder); + addChild("Right Encoder", m_rightEncoder); + addChild("Left Encoder", m_leftEncoder); - // Configure gyro - if (Robot.isReal()) { - m_gyro.setSensitivity(0.007); // TODO: Handle more gracefully? - } - addChild("Gyro", m_gyro); - } + // Configure gyro + if (Robot.isReal()) { + m_gyro.setSensitivity(0.007); // TODO: Handle more gracefully? + } + addChild("Gyro", m_gyro); + } - /** - * When other commands aren't using the drivetrain, allow tank drive with - * the joystick. - */ - @Override - public void initDefaultCommand() { - setDefaultCommand(new DriveWithJoystick()); - } + /** + * When other commands aren't using the drivetrain, allow tank drive with + * the joystick. + */ + @Override + public void initDefaultCommand() { + setDefaultCommand(new DriveWithJoystick()); + } - /** - * Tank drive using a PS3 joystick. - * - * @param joy PS3 style joystick to use as the input for tank drive. - */ - public void tankDrive(Joystick joy) { - m_drive.tankDrive(joy.getY(), joy.getRawAxis(4)); - } + /** + * Tank drive using a PS3 joystick. + * + * @param joy PS3 style joystick to use as the input for tank drive. + */ + public void tankDrive(Joystick joy) { + m_drive.tankDrive(joy.getY(), joy.getRawAxis(4)); + } - /** - * Tank drive using individual joystick axes. - * - * @param leftAxis Left sides value - * @param rightAxis Right sides value - */ - public void tankDrive(double leftAxis, double rightAxis) { - m_drive.tankDrive(leftAxis, rightAxis); - } + /** + * Tank drive using individual joystick axes. + * + * @param leftAxis Left sides value + * @param rightAxis Right sides value + */ + public void tankDrive(double leftAxis, double rightAxis) { + m_drive.tankDrive(leftAxis, rightAxis); + } - /** - * Stop the drivetrain from moving. - */ - public void stop() { - m_drive.tankDrive(0, 0); - } + /** + * Stop the drivetrain from moving. + */ + public void stop() { + m_drive.tankDrive(0, 0); + } - /** - * The encoder getting the distance and speed of left side of the - * drivetrain. - */ - public Encoder getLeftEncoder() { - return m_leftEncoder; - } + /** + * The encoder getting the distance and speed of left side of the + * drivetrain. + */ + public Encoder getLeftEncoder() { + return m_leftEncoder; + } - /** - * The encoder getting the distance and speed of right side of the - * drivetrain. - */ - public Encoder getRightEncoder() { - return m_rightEncoder; - } + /** + * The encoder getting the distance and speed of right side of the + * drivetrain. + */ + public Encoder getRightEncoder() { + return m_rightEncoder; + } - /** - * The current angle of the drivetrain as measured by the Gyro. - */ - public double getAngle() { - return m_gyro.getAngle(); - } + /** + * The current angle of the drivetrain as measured by the Gyro. + */ + public double getAngle() { + return m_gyro.getAngle(); + } } diff --git a/wpilibjExamples/src/main/java/edu/wpi/first/wpilibj/examples/pacgoat/subsystems/Pivot.java b/wpilibjExamples/src/main/java/edu/wpi/first/wpilibj/examples/pacgoat/subsystems/Pivot.java index be2199db91..4cd6bf3b02 100644 --- a/wpilibjExamples/src/main/java/edu/wpi/first/wpilibj/examples/pacgoat/subsystems/Pivot.java +++ b/wpilibjExamples/src/main/java/edu/wpi/first/wpilibj/examples/pacgoat/subsystems/Pivot.java @@ -21,84 +21,84 @@ import edu.wpi.first.wpilibj.examples.pacgoat.Robot; * of angle of the pivot and claw. */ public class Pivot extends PIDSubsystem { - // Constants for some useful angles - public static final double kCollect = 105; - public static final double kLowGoal = 90; - public static final double kShoot = 45; - public static final double kShootNear = 30; + // Constants for some useful angles + public static final double kCollect = 105; + public static final double kLowGoal = 90; + public static final double kShoot = 45; + public static final double kShootNear = 30; - // Sensors for measuring the position of the pivot. - private DigitalInput m_upperLimitSwitch = new DigitalInput(13); - private DigitalInput m_lowerLimitSwitch = new DigitalInput(12); + // Sensors for measuring the position of the pivot. + private DigitalInput m_upperLimitSwitch = new DigitalInput(13); + private DigitalInput m_lowerLimitSwitch = new DigitalInput(12); - // 0 degrees is vertical facing up. - // Angle increases the more forward the pivot goes. - private Potentiometer m_pot = new AnalogPotentiometer(1); + // 0 degrees is vertical facing up. + // Angle increases the more forward the pivot goes. + private Potentiometer m_pot = new AnalogPotentiometer(1); - // Motor to move the pivot. - private SpeedController m_motor = new Victor(5); + // Motor to move the pivot. + private SpeedController m_motor = new Victor(5); - public Pivot() { - super("Pivot", 7.0, 0.0, 8.0); - setAbsoluteTolerance(0.005); - getPIDController().setContinuous(false); - if (Robot.isSimulation()) { // PID is different in simulation. - getPIDController().setPID(0.5, 0.001, 2); - setAbsoluteTolerance(5); - } + public Pivot() { + super("Pivot", 7.0, 0.0, 8.0); + setAbsoluteTolerance(0.005); + getPIDController().setContinuous(false); + if (Robot.isSimulation()) { // PID is different in simulation. + getPIDController().setPID(0.5, 0.001, 2); + setAbsoluteTolerance(5); + } - // Put everything to the LiveWindow for testing. - addChild("Upper Limit Switch", m_upperLimitSwitch); - addChild("Lower Limit Switch", m_lowerLimitSwitch); - addChild("Pot", (AnalogPotentiometer) m_pot); - addChild("Motor", (Victor) m_motor); - addChild("PIDSubsystem Controller", getPIDController()); - } + // Put everything to the LiveWindow for testing. + addChild("Upper Limit Switch", m_upperLimitSwitch); + addChild("Lower Limit Switch", m_lowerLimitSwitch); + addChild("Pot", (AnalogPotentiometer) m_pot); + addChild("Motor", (Victor) m_motor); + addChild("PIDSubsystem Controller", getPIDController()); + } - /** - * No default command, if PID is enabled, the current setpoint will be - * maintained. - */ - @Override - public void initDefaultCommand() { - } + /** + * No default command, if PID is enabled, the current setpoint will be + * maintained. + */ + @Override + public void initDefaultCommand() { + } - /** - * The angle read in by the potentiometer. - */ - @Override - protected double returnPIDInput() { - return m_pot.get(); - } + /** + * The angle read in by the potentiometer. + */ + @Override + protected double returnPIDInput() { + return m_pot.get(); + } - /** - * Set the motor speed based off of the PID output. - */ - @Override - protected void usePIDOutput(double output) { - m_motor.pidWrite(output); - } + /** + * Set the motor speed based off of the PID output. + */ + @Override + protected void usePIDOutput(double output) { + m_motor.pidWrite(output); + } - /** - * If the pivot is at its upper limit. - */ - public boolean isAtUpperLimit() { - // TODO: inverted from real robot (prefix with !) - return m_upperLimitSwitch.get(); - } + /** + * If the pivot is at its upper limit. + */ + public boolean isAtUpperLimit() { + // TODO: inverted from real robot (prefix with !) + return m_upperLimitSwitch.get(); + } - /** - * If the pivot is at its lower limit. - */ - public boolean isAtLowerLimit() { - // TODO: inverted from real robot (prefix with !) - return m_lowerLimitSwitch.get(); - } + /** + * If the pivot is at its lower limit. + */ + public boolean isAtLowerLimit() { + // TODO: inverted from real robot (prefix with !) + return m_lowerLimitSwitch.get(); + } - /** - * The current angle of the pivot. - */ - public double getAngle() { - return m_pot.get(); - } + /** + * The current angle of the pivot. + */ + public double getAngle() { + return m_pot.get(); + } } diff --git a/wpilibjExamples/src/main/java/edu/wpi/first/wpilibj/examples/pacgoat/subsystems/Pneumatics.java b/wpilibjExamples/src/main/java/edu/wpi/first/wpilibj/examples/pacgoat/subsystems/Pneumatics.java index 61fc15542f..88dc838df0 100644 --- a/wpilibjExamples/src/main/java/edu/wpi/first/wpilibj/examples/pacgoat/subsystems/Pneumatics.java +++ b/wpilibjExamples/src/main/java/edu/wpi/first/wpilibj/examples/pacgoat/subsystems/Pneumatics.java @@ -20,36 +20,36 @@ import edu.wpi.first.wpilibj.examples.pacgoat.Robot; * sensors. */ public class Pneumatics extends Subsystem { - AnalogInput m_pressureSensor = new AnalogInput(3); + AnalogInput m_pressureSensor = new AnalogInput(3); - private static final double kMaxPressure = 2.55; + private static final double kMaxPressure = 2.55; - public Pneumatics() { - addChild("Pressure Sensor", m_pressureSensor); - } + public Pneumatics() { + addChild("Pressure Sensor", m_pressureSensor); + } - /** - * No default command. - */ - @Override - public void initDefaultCommand() { - } + /** + * No default command. + */ + @Override + public void initDefaultCommand() { + } - /** - * Whether or not the system is fully pressurized. - */ - public boolean isPressurized() { - if (Robot.isReal()) { - return kMaxPressure <= m_pressureSensor.getVoltage(); - } else { - return true; // NOTE: Simulation always has full pressure - } - } + /** + * Whether or not the system is fully pressurized. + */ + public boolean isPressurized() { + if (Robot.isReal()) { + return kMaxPressure <= m_pressureSensor.getVoltage(); + } else { + return true; // NOTE: Simulation always has full pressure + } + } - /** - * Puts the pressure on the SmartDashboard. - */ - public void writePressure() { - SmartDashboard.putNumber("Pressure", m_pressureSensor.getVoltage()); - } + /** + * Puts the pressure on the SmartDashboard. + */ + public void writePressure() { + SmartDashboard.putNumber("Pressure", m_pressureSensor.getVoltage()); + } } diff --git a/wpilibjExamples/src/main/java/edu/wpi/first/wpilibj/examples/pacgoat/subsystems/Shooter.java b/wpilibjExamples/src/main/java/edu/wpi/first/wpilibj/examples/pacgoat/subsystems/Shooter.java index 57b5ab2103..1bb2a8d732 100644 --- a/wpilibjExamples/src/main/java/edu/wpi/first/wpilibj/examples/pacgoat/subsystems/Shooter.java +++ b/wpilibjExamples/src/main/java/edu/wpi/first/wpilibj/examples/pacgoat/subsystems/Shooter.java @@ -23,151 +23,151 @@ import edu.wpi.first.wpilibj.command.Subsystem; * cylinder and ignores the latch. */ public class Shooter extends Subsystem { - // Devices - DoubleSolenoid m_piston1 = new DoubleSolenoid(1, 3, 4); - DoubleSolenoid m_piston2 = new DoubleSolenoid(1, 5, 6); - Solenoid m_latchPiston = new Solenoid(1, 2); - DigitalInput m_piston1ReedSwitchFront = new DigitalInput(9); - DigitalInput m_piston1ReedSwitchBack = new DigitalInput(11); - //NOTE: currently ignored in simulation - DigitalInput m_hotGoalSensor = new DigitalInput(3); + // Devices + DoubleSolenoid m_piston1 = new DoubleSolenoid(1, 3, 4); + DoubleSolenoid m_piston2 = new DoubleSolenoid(1, 5, 6); + Solenoid m_latchPiston = new Solenoid(1, 2); + DigitalInput m_piston1ReedSwitchFront = new DigitalInput(9); + DigitalInput m_piston1ReedSwitchBack = new DigitalInput(11); + //NOTE: currently ignored in simulation + DigitalInput m_hotGoalSensor = new DigitalInput(3); - public Shooter() { - // Put everything to the LiveWindow for testing. - addChild("Hot Goal Sensor", m_hotGoalSensor); - addChild("Piston1 Reed Switch Front ", m_piston1ReedSwitchFront); - addChild("Piston1 Reed Switch Back ", m_piston1ReedSwitchBack); - addChild("Latch Piston", m_latchPiston); - } + public Shooter() { + // Put everything to the LiveWindow for testing. + addChild("Hot Goal Sensor", m_hotGoalSensor); + addChild("Piston1 Reed Switch Front ", m_piston1ReedSwitchFront); + addChild("Piston1 Reed Switch Back ", m_piston1ReedSwitchBack); + addChild("Latch Piston", m_latchPiston); + } - /** - * No default command. - */ - @Override - public void initDefaultCommand() { - } + /** + * No default command. + */ + @Override + public void initDefaultCommand() { + } - /** - * Extend both solenoids to shoot. - */ - public void extendBoth() { - m_piston1.set(DoubleSolenoid.Value.kForward); - m_piston2.set(DoubleSolenoid.Value.kForward); - } + /** + * Extend both solenoids to shoot. + */ + public void extendBoth() { + m_piston1.set(DoubleSolenoid.Value.kForward); + m_piston2.set(DoubleSolenoid.Value.kForward); + } - /** - * Retract both solenoids to prepare to shoot. - */ - public void retractBoth() { - m_piston1.set(DoubleSolenoid.Value.kReverse); - m_piston2.set(DoubleSolenoid.Value.kReverse); - } + /** + * Retract both solenoids to prepare to shoot. + */ + public void retractBoth() { + m_piston1.set(DoubleSolenoid.Value.kReverse); + m_piston2.set(DoubleSolenoid.Value.kReverse); + } - /** - * Extend solenoid 1 to shoot. - */ - public void extend1() { - m_piston1.set(DoubleSolenoid.Value.kForward); - } + /** + * Extend solenoid 1 to shoot. + */ + public void extend1() { + m_piston1.set(DoubleSolenoid.Value.kForward); + } - /** - * Retract solenoid 1 to prepare to shoot. - */ - public void retract1() { - m_piston1.set(DoubleSolenoid.Value.kReverse); - } + /** + * Retract solenoid 1 to prepare to shoot. + */ + public void retract1() { + m_piston1.set(DoubleSolenoid.Value.kReverse); + } - /** - * Extend solenoid 2 to shoot. - */ - public void extend2() { - m_piston2.set(DoubleSolenoid.Value.kReverse); - } + /** + * Extend solenoid 2 to shoot. + */ + public void extend2() { + m_piston2.set(DoubleSolenoid.Value.kReverse); + } - /** - * Retract solenoid 2 to prepare to shoot. - */ - public void retract2() { - m_piston2.set(DoubleSolenoid.Value.kForward); - } + /** + * Retract solenoid 2 to prepare to shoot. + */ + public void retract2() { + m_piston2.set(DoubleSolenoid.Value.kForward); + } - /** - * Turns off the piston1 double solenoid. This won't actuate anything - * because double solenoids preserve their state when turned off. This - * should be called in order to reduce the amount of time that the coils - * are powered. - */ - public void off1() { - m_piston1.set(DoubleSolenoid.Value.kOff); - } + /** + * Turns off the piston1 double solenoid. This won't actuate anything + * because double solenoids preserve their state when turned off. This + * should be called in order to reduce the amount of time that the coils + * are powered. + */ + public void off1() { + m_piston1.set(DoubleSolenoid.Value.kOff); + } - /** - * Turns off the piston2 double solenoid. This won't actuate anything - * because double solenoids preserve their state when turned off. This - * should be called in order to reduce the amount of time that the coils - * are powered. - */ - public void off2() { - m_piston2.set(DoubleSolenoid.Value.kOff); - } + /** + * Turns off the piston2 double solenoid. This won't actuate anything + * because double solenoids preserve their state when turned off. This + * should be called in order to reduce the amount of time that the coils + * are powered. + */ + public void off2() { + m_piston2.set(DoubleSolenoid.Value.kOff); + } - /** - * Release the latch so that we can shoot. - */ - public void unlatch() { - m_latchPiston.set(true); - } + /** + * Release the latch so that we can shoot. + */ + public void unlatch() { + m_latchPiston.set(true); + } - /** - * Latch so that pressure can build up and we aren't limited by air flow. - */ - public void latch() { - m_latchPiston.set(false); - } + /** + * Latch so that pressure can build up and we aren't limited by air flow. + */ + public void latch() { + m_latchPiston.set(false); + } - /** - * Toggles the latch postions. - */ - public void toggleLatchPosition() { - m_latchPiston.set(!m_latchPiston.get()); - } + /** + * Toggles the latch postions. + */ + public void toggleLatchPosition() { + m_latchPiston.set(!m_latchPiston.get()); + } - /** - * Is Piston 1 extended (after shooting). - * - * @return Whether or not piston 1 is fully extended. - */ - public boolean piston1IsExtended() { - return !m_piston1ReedSwitchFront.get(); - } + /** + * Is Piston 1 extended (after shooting). + * + * @return Whether or not piston 1 is fully extended. + */ + public boolean piston1IsExtended() { + return !m_piston1ReedSwitchFront.get(); + } - /** - * Is Piston 1 retracted (before shooting). - * - * @return Whether or not piston 1 is fully retracted. - */ - public boolean piston1IsRetracted() { - return !m_piston1ReedSwitchBack.get(); - } + /** + * Is Piston 1 retracted (before shooting). + * + * @return Whether or not piston 1 is fully retracted. + */ + public boolean piston1IsRetracted() { + return !m_piston1ReedSwitchBack.get(); + } - /** - * Turns off all double solenoids. Double solenoids hold their position when - * they are turned off. We should turn them off whenever possible to extend - * the life of the coils. - */ - public void offBoth() { - m_piston1.set(DoubleSolenoid.Value.kOff); - m_piston2.set(DoubleSolenoid.Value.kOff); - } + /** + * Turns off all double solenoids. Double solenoids hold their position when + * they are turned off. We should turn them off whenever possible to extend + * the life of the coils. + */ + public void offBoth() { + m_piston1.set(DoubleSolenoid.Value.kOff); + m_piston2.set(DoubleSolenoid.Value.kOff); + } - /** - * Return whether the goal is hot as read by the banner sensor. - * - *

NOTE: doesn't work in simulation. - * - * @return Whether or not the goal is hot - */ - public boolean goalIsHot() { - return m_hotGoalSensor.get(); - } + /** + * Return whether the goal is hot as read by the banner sensor. + * + *

NOTE: doesn't work in simulation. + * + * @return Whether or not the goal is hot + */ + public boolean goalIsHot() { + return m_hotGoalSensor.get(); + } } diff --git a/wpilibjExamples/src/main/java/edu/wpi/first/wpilibj/examples/pacgoat/triggers/DoubleButton.java b/wpilibjExamples/src/main/java/edu/wpi/first/wpilibj/examples/pacgoat/triggers/DoubleButton.java index c20cc4788b..0745e1ea55 100644 --- a/wpilibjExamples/src/main/java/edu/wpi/first/wpilibj/examples/pacgoat/triggers/DoubleButton.java +++ b/wpilibjExamples/src/main/java/edu/wpi/first/wpilibj/examples/pacgoat/triggers/DoubleButton.java @@ -15,18 +15,18 @@ import edu.wpi.first.wpilibj.buttons.Trigger; * simultaneously pressed. */ public class DoubleButton extends Trigger { - private Joystick m_joy; - private int m_button1; - private int m_button2; + private Joystick m_joy; + private int m_button1; + private int m_button2; - public DoubleButton(Joystick joy, int button1, int button2) { - this.m_joy = joy; - this.m_button1 = button1; - this.m_button2 = button2; - } + public DoubleButton(Joystick joy, int button1, int button2) { + this.m_joy = joy; + this.m_button1 = button1; + this.m_button2 = button2; + } - @Override - public boolean get() { - return m_joy.getRawButton(m_button1) && m_joy.getRawButton(m_button2); - } + @Override + public boolean get() { + return m_joy.getRawButton(m_button1) && m_joy.getRawButton(m_button2); + } } diff --git a/wpilibjExamples/src/main/java/edu/wpi/first/wpilibj/examples/potentiometerpid/Robot.java b/wpilibjExamples/src/main/java/edu/wpi/first/wpilibj/examples/potentiometerpid/Robot.java index 0af1885899..cb30a55f70 100644 --- a/wpilibjExamples/src/main/java/edu/wpi/first/wpilibj/examples/potentiometerpid/Robot.java +++ b/wpilibjExamples/src/main/java/edu/wpi/first/wpilibj/examples/potentiometerpid/Robot.java @@ -20,56 +20,56 @@ import edu.wpi.first.wpilibj.Joystick; * mechanism. */ public class Robot extends IterativeRobot { - private static final int kPotChannel = 1; - private static final int kMotorChannel = 7; - private static final int kJoystickChannel = 0; + private static final int kPotChannel = 1; + private static final int kMotorChannel = 7; + private static final int kJoystickChannel = 0; - // bottom, middle, and top elevator setpoints - private static final double[] kSetPoints = {1.0, 2.6, 4.3}; + // bottom, middle, and top elevator setpoints + private static final double[] kSetPoints = {1.0, 2.6, 4.3}; - // proportional, integral, and derivative speed constants; motor inverted - // DANGER: when tuning PID constants, high/inappropriate values for kP, kI, - // and kD may cause dangerous, uncontrollable, or undesired behavior! - // these may need to be positive for a non-inverted motor - private static final double kP = -5.0; - private static final double kI = -0.02; - private static final double kD = -2.0; + // proportional, integral, and derivative speed constants; motor inverted + // DANGER: when tuning PID constants, high/inappropriate values for kP, kI, + // and kD may cause dangerous, uncontrollable, or undesired behavior! + // these may need to be positive for a non-inverted motor + private static final double kP = -5.0; + private static final double kI = -0.02; + private static final double kD = -2.0; - private PIDController m_pidController; - private AnalogInput m_potentiometer; - private SpeedController m_elevatorMotor; - private Joystick m_joystick; + private PIDController m_pidController; + private AnalogInput m_potentiometer; + private SpeedController m_elevatorMotor; + private Joystick m_joystick; - private int m_index = 0; - private boolean m_previousButtonValue = false; + private int m_index = 0; + private boolean m_previousButtonValue = false; - @Override - public void robotInit() { - m_potentiometer = new AnalogInput(kPotChannel); - m_elevatorMotor = new Spark(kMotorChannel); - m_joystick = new Joystick(kJoystickChannel); + @Override + public void robotInit() { + m_potentiometer = new AnalogInput(kPotChannel); + m_elevatorMotor = new Spark(kMotorChannel); + m_joystick = new Joystick(kJoystickChannel); - m_pidController - = new PIDController(kP, kI, kD, m_potentiometer, m_elevatorMotor); - m_pidController.setInputRange(0, 5); - } + m_pidController + = new PIDController(kP, kI, kD, m_potentiometer, m_elevatorMotor); + m_pidController.setInputRange(0, 5); + } - @Override - public void teleopInit() { - m_pidController.enable(); - } + @Override + public void teleopInit() { + m_pidController.enable(); + } - @Override - public void teleopPeriodic() { - // when the button is pressed once, the selected elevator setpoint - // is incremented - boolean currentButtonValue = m_joystick.getTrigger(); - if (currentButtonValue && !m_previousButtonValue) { - // index of the elevator setpoint wraps around. - m_index = (m_index + 1) % kSetPoints.length; - } - m_previousButtonValue = currentButtonValue; + @Override + public void teleopPeriodic() { + // when the button is pressed once, the selected elevator setpoint + // is incremented + boolean currentButtonValue = m_joystick.getTrigger(); + if (currentButtonValue && !m_previousButtonValue) { + // index of the elevator setpoint wraps around. + m_index = (m_index + 1) % kSetPoints.length; + } + m_previousButtonValue = currentButtonValue; - m_pidController.setSetpoint(kSetPoints[m_index]); - } + m_pidController.setSetpoint(kSetPoints[m_index]); + } } diff --git a/wpilibjExamples/src/main/java/edu/wpi/first/wpilibj/examples/quickvision/Robot.java b/wpilibjExamples/src/main/java/edu/wpi/first/wpilibj/examples/quickvision/Robot.java index db649ec256..d9f2ac562a 100644 --- a/wpilibjExamples/src/main/java/edu/wpi/first/wpilibj/examples/quickvision/Robot.java +++ b/wpilibjExamples/src/main/java/edu/wpi/first/wpilibj/examples/quickvision/Robot.java @@ -17,9 +17,9 @@ import edu.wpi.first.wpilibj.IterativeRobot; * the robotInit() method in your program. */ public class Robot extends IterativeRobot { - @Override - public void robotInit() { - CameraServer.getInstance().startAutomaticCapture(); - } + @Override + public void robotInit() { + CameraServer.getInstance().startAutomaticCapture(); + } } diff --git a/wpilibjExamples/src/main/java/edu/wpi/first/wpilibj/examples/tankdrive/Robot.java b/wpilibjExamples/src/main/java/edu/wpi/first/wpilibj/examples/tankdrive/Robot.java index 9808992c36..314efb4f7d 100755 --- a/wpilibjExamples/src/main/java/edu/wpi/first/wpilibj/examples/tankdrive/Robot.java +++ b/wpilibjExamples/src/main/java/edu/wpi/first/wpilibj/examples/tankdrive/Robot.java @@ -17,19 +17,19 @@ import edu.wpi.first.wpilibj.drive.DifferentialDrive; * it contains the code necessary to operate a robot with tank drive. */ public class Robot extends IterativeRobot { - private DifferentialDrive m_myRobot; - private Joystick m_leftStick; - private Joystick m_rightStick; + private DifferentialDrive m_myRobot; + private Joystick m_leftStick; + private Joystick m_rightStick; - @Override - public void robotInit() { - m_myRobot = new DifferentialDrive(new Spark(0), new Spark(1)); - m_leftStick = new Joystick(0); - m_rightStick = new Joystick(1); - } + @Override + public void robotInit() { + m_myRobot = new DifferentialDrive(new Spark(0), new Spark(1)); + m_leftStick = new Joystick(0); + m_rightStick = new Joystick(1); + } - @Override - public void teleopPeriodic() { - m_myRobot.tankDrive(m_leftStick.getY(), m_rightStick.getY()); - } + @Override + public void teleopPeriodic() { + m_myRobot.tankDrive(m_leftStick.getY(), m_rightStick.getY()); + } } diff --git a/wpilibjExamples/src/main/java/edu/wpi/first/wpilibj/examples/ultrasonic/Robot.java b/wpilibjExamples/src/main/java/edu/wpi/first/wpilibj/examples/ultrasonic/Robot.java index 5ac6341e75..e2fe3a7e05 100644 --- a/wpilibjExamples/src/main/java/edu/wpi/first/wpilibj/examples/ultrasonic/Robot.java +++ b/wpilibjExamples/src/main/java/edu/wpi/first/wpilibj/examples/ultrasonic/Robot.java @@ -18,36 +18,36 @@ import edu.wpi.first.wpilibj.drive.DifferentialDrive; */ public class Robot extends IterativeRobot { - // distance in inches the robot wants to stay from an object - private static final double kHoldDistance = 12.0; + // distance in inches the robot wants to stay from an object + private static final double kHoldDistance = 12.0; - // factor to convert sensor values to a distance in inches - private static final double kValueToInches = 0.125; + // factor to convert sensor values to a distance in inches + private static final double kValueToInches = 0.125; - // proportional speed constant - private static final double kP = 0.05; + // proportional speed constant + private static final double kP = 0.05; - private static final int kLeftMotorPort = 0; - private static final int kRightMotorPort = 1; - private static final int kUltrasonicPort = 0; + private static final int kLeftMotorPort = 0; + private static final int kRightMotorPort = 1; + private static final int kUltrasonicPort = 0; - private AnalogInput m_ultrasonic = new AnalogInput(kUltrasonicPort); - private DifferentialDrive m_robotDrive - = new DifferentialDrive(new Spark(kLeftMotorPort), - new Spark(kRightMotorPort)); + private AnalogInput m_ultrasonic = new AnalogInput(kUltrasonicPort); + private DifferentialDrive m_robotDrive + = new DifferentialDrive(new Spark(kLeftMotorPort), + new Spark(kRightMotorPort)); - /** - * Tells the robot to drive to a set distance (in inches) from an object - * using proportional control. - */ - public void teleopPeriodic() { - // sensor returns a value from 0-4095 that is scaled to inches - double currentDistance = m_ultrasonic.getValue() * kValueToInches; + /** + * Tells the robot to drive to a set distance (in inches) from an object + * using proportional control. + */ + public void teleopPeriodic() { + // sensor returns a value from 0-4095 that is scaled to inches + double currentDistance = m_ultrasonic.getValue() * kValueToInches; - // convert distance error to a motor speed - double currentSpeed = (kHoldDistance - currentDistance) * kP; + // convert distance error to a motor speed + double currentSpeed = (kHoldDistance - currentDistance) * kP; - // drive robot - m_robotDrive.arcadeDrive(currentSpeed, 0); - } + // drive robot + m_robotDrive.arcadeDrive(currentSpeed, 0); + } } diff --git a/wpilibjExamples/src/main/java/edu/wpi/first/wpilibj/examples/ultrasonicpid/Robot.java b/wpilibjExamples/src/main/java/edu/wpi/first/wpilibj/examples/ultrasonicpid/Robot.java index 066150b88c..1f83606ebb 100644 --- a/wpilibjExamples/src/main/java/edu/wpi/first/wpilibj/examples/ultrasonicpid/Robot.java +++ b/wpilibjExamples/src/main/java/edu/wpi/first/wpilibj/examples/ultrasonicpid/Robot.java @@ -19,53 +19,53 @@ import edu.wpi.first.wpilibj.drive.DifferentialDrive; * ultrasonic sensor to reach and maintain a set distance from an object. */ public class Robot extends IterativeRobot { - // distance in inches the robot wants to stay from an object - private static final double kHoldDistance = 12.0; + // distance in inches the robot wants to stay from an object + private static final double kHoldDistance = 12.0; - // maximum distance in inches we expect the robot to see - private static final double kMaxDistance = 24.0; + // maximum distance in inches we expect the robot to see + private static final double kMaxDistance = 24.0; - // factor to convert sensor values to a distance in inches - private static final double kValueToInches = 0.125; + // factor to convert sensor values to a distance in inches + private static final double kValueToInches = 0.125; - // proportional speed constant - private static final double kP = 7.0; + // proportional speed constant + private static final double kP = 7.0; - // integral speed constant - private static final double kI = 0.018; + // integral speed constant + private static final double kI = 0.018; - // derivative speed constant - private static final double kD = 1.5; + // derivative speed constant + private static final double kD = 1.5; - private static final int kLeftMotorPort = 0; - private static final int kRightMotorPort = 1; - private static final int kUltrasonicPort = 0; + private static final int kLeftMotorPort = 0; + private static final int kRightMotorPort = 1; + private static final int kUltrasonicPort = 0; - private AnalogInput m_ultrasonic = new AnalogInput(kUltrasonicPort); - private DifferentialDrive m_robotDrive - = new DifferentialDrive(new Spark(kLeftMotorPort), - new Spark(kRightMotorPort)); - private PIDController m_pidController - = new PIDController(kP, kI, kD, m_ultrasonic, new MyPidOutput()); + private AnalogInput m_ultrasonic = new AnalogInput(kUltrasonicPort); + private DifferentialDrive m_robotDrive + = new DifferentialDrive(new Spark(kLeftMotorPort), + new Spark(kRightMotorPort)); + private PIDController m_pidController + = new PIDController(kP, kI, kD, m_ultrasonic, new MyPidOutput()); - /** - * Drives the robot a set distance from an object using PID control and the - * ultrasonic sensor. - */ - @Override - public void teleopInit() { - // Set expected range to 0-24 inches; e.g. at 24 inches from object go - // full forward, at 0 inches from object go full backward. - m_pidController.setInputRange(0, kMaxDistance * kValueToInches); - // Set setpoint of the pid controller - m_pidController.setSetpoint(kHoldDistance * kValueToInches); - m_pidController.enable(); // begin PID control - } + /** + * Drives the robot a set distance from an object using PID control and the + * ultrasonic sensor. + */ + @Override + public void teleopInit() { + // Set expected range to 0-24 inches; e.g. at 24 inches from object go + // full forward, at 0 inches from object go full backward. + m_pidController.setInputRange(0, kMaxDistance * kValueToInches); + // Set setpoint of the pid controller + m_pidController.setSetpoint(kHoldDistance * kValueToInches); + m_pidController.enable(); // begin PID control + } - private class MyPidOutput implements PIDOutput { - @Override - public void pidWrite(double output) { - m_robotDrive.arcadeDrive(output, 0); - } - } + private class MyPidOutput implements PIDOutput { + @Override + public void pidWrite(double output) { + m_robotDrive.arcadeDrive(output, 0); + } + } } diff --git a/wpilibjExamples/src/main/java/edu/wpi/first/wpilibj/templates/commandbased/OI.java b/wpilibjExamples/src/main/java/edu/wpi/first/wpilibj/templates/commandbased/OI.java index b1833f279a..990eb2a391 100644 --- a/wpilibjExamples/src/main/java/edu/wpi/first/wpilibj/templates/commandbased/OI.java +++ b/wpilibjExamples/src/main/java/edu/wpi/first/wpilibj/templates/commandbased/OI.java @@ -12,31 +12,31 @@ package edu.wpi.first.wpilibj.templates.commandbased; * interface to the commands and command groups that allow control of the robot. */ public class OI { - //// CREATING BUTTONS - // One type of button is a joystick button which is any button on a - //// joystick. - // You create one by telling it which joystick it's on and which button - // number it is. - // Joystick stick = new Joystick(port); - // Button button = new JoystickButton(stick, buttonNumber); + //// CREATING BUTTONS + // One type of button is a joystick button which is any button on a + //// joystick. + // You create one by telling it which joystick it's on and which button + // number it is. + // Joystick stick = new Joystick(port); + // Button button = new JoystickButton(stick, buttonNumber); - // There are a few additional built in buttons you can use. Additionally, - // by subclassing Button you can create custom triggers and bind those to - // commands the same as any other Button. + // There are a few additional built in buttons you can use. Additionally, + // by subclassing Button you can create custom triggers and bind those to + // commands the same as any other Button. - //// TRIGGERING COMMANDS WITH BUTTONS - // Once you have a button, it's trivial to bind it to a button in one of - // three ways: + //// TRIGGERING COMMANDS WITH BUTTONS + // Once you have a button, it's trivial to bind it to a button in one of + // three ways: - // Start the command when the button is pressed and let it run the command - // until it is finished as determined by it's isFinished method. - // button.whenPressed(new ExampleCommand()); + // Start the command when the button is pressed and let it run the command + // until it is finished as determined by it's isFinished method. + // button.whenPressed(new ExampleCommand()); - // Run the command while the button is being held down and interrupt it once - // the button is released. - // button.whileHeld(new ExampleCommand()); + // Run the command while the button is being held down and interrupt it once + // the button is released. + // button.whileHeld(new ExampleCommand()); - // Start the command when the button is released and let it run the command - // until it is finished as determined by it's isFinished method. - // button.whenReleased(new ExampleCommand()); + // Start the command when the button is released and let it run the command + // until it is finished as determined by it's isFinished method. + // button.whenReleased(new ExampleCommand()); } diff --git a/wpilibjExamples/src/main/java/edu/wpi/first/wpilibj/templates/commandbased/Robot.java b/wpilibjExamples/src/main/java/edu/wpi/first/wpilibj/templates/commandbased/Robot.java index d7e324f311..3474f526f1 100644 --- a/wpilibjExamples/src/main/java/edu/wpi/first/wpilibj/templates/commandbased/Robot.java +++ b/wpilibjExamples/src/main/java/edu/wpi/first/wpilibj/templates/commandbased/Robot.java @@ -23,98 +23,98 @@ import edu.wpi.first.wpilibj.templates.commandbased.subsystems.ExampleSubsystem; * project. */ public class Robot extends TimedRobot { - public static ExampleSubsystem m_subsystem = new ExampleSubsystem(); - public static OI m_oi; + public static ExampleSubsystem m_subsystem = new ExampleSubsystem(); + public static OI m_oi; - Command m_autonomousCommand; - SendableChooser m_chooser = new SendableChooser<>(); + Command m_autonomousCommand; + SendableChooser m_chooser = new SendableChooser<>(); - /** - * This function is run when the robot is first started up and should be - * used for any initialization code. - */ - @Override - public void robotInit() { - m_oi = new OI(); - m_chooser.addDefault("Default Auto", new ExampleCommand()); - // chooser.addObject("My Auto", new MyAutoCommand()); - SmartDashboard.putData("Auto mode", m_chooser); - } + /** + * This function is run when the robot is first started up and should be + * used for any initialization code. + */ + @Override + public void robotInit() { + m_oi = new OI(); + m_chooser.addDefault("Default Auto", new ExampleCommand()); + // chooser.addObject("My Auto", new MyAutoCommand()); + SmartDashboard.putData("Auto mode", m_chooser); + } - /** - * This function is called once each time the robot enters Disabled mode. - * You can use it to reset any subsystem information you want to clear when - * the robot is disabled. - */ - @Override - public void disabledInit() { + /** + * This function is called once each time the robot enters Disabled mode. + * You can use it to reset any subsystem information you want to clear when + * the robot is disabled. + */ + @Override + public void disabledInit() { - } + } - @Override - public void disabledPeriodic() { - Scheduler.getInstance().run(); - } + @Override + public void disabledPeriodic() { + Scheduler.getInstance().run(); + } - /** - * This autonomous (along with the chooser code above) shows how to select - * between different autonomous modes using the dashboard. The sendable - * chooser code works with the Java SmartDashboard. If you prefer the - * LabVIEW Dashboard, remove all of the chooser code and uncomment the - * getString code to get the auto name from the text box below the Gyro - * - *

You can add additional auto modes by adding additional commands to the - * chooser code above (like the commented example) or additional comparisons - * to the switch structure below with additional strings & commands. - */ - @Override - public void autonomousInit() { - m_autonomousCommand = m_chooser.getSelected(); + /** + * This autonomous (along with the chooser code above) shows how to select + * between different autonomous modes using the dashboard. The sendable + * chooser code works with the Java SmartDashboard. If you prefer the + * LabVIEW Dashboard, remove all of the chooser code and uncomment the + * getString code to get the auto name from the text box below the Gyro + * + *

You can add additional auto modes by adding additional commands to the + * chooser code above (like the commented example) or additional comparisons + * to the switch structure below with additional strings & commands. + */ + @Override + public void autonomousInit() { + m_autonomousCommand = m_chooser.getSelected(); - /* - * String autoSelected = SmartDashboard.getString("Auto Selector", - * "Default"); switch(autoSelected) { case "My Auto": autonomousCommand - * = new MyAutoCommand(); break; case "Default Auto": default: - * autonomousCommand = new ExampleCommand(); break; } - */ + /* + * String autoSelected = SmartDashboard.getString("Auto Selector", + * "Default"); switch(autoSelected) { case "My Auto": autonomousCommand + * = new MyAutoCommand(); break; case "Default Auto": default: + * autonomousCommand = new ExampleCommand(); break; } + */ - // schedule the autonomous command (example) - if (m_autonomousCommand != null) { - m_autonomousCommand.start(); - } - } + // schedule the autonomous command (example) + if (m_autonomousCommand != null) { + m_autonomousCommand.start(); + } + } - /** - * This function is called periodically during autonomous. - */ - @Override - public void autonomousPeriodic() { - Scheduler.getInstance().run(); - } + /** + * This function is called periodically during autonomous. + */ + @Override + public void autonomousPeriodic() { + Scheduler.getInstance().run(); + } - @Override - public void teleopInit() { - // This makes sure that the autonomous stops running when - // teleop starts running. If you want the autonomous to - // continue until interrupted by another command, remove - // this line or comment it out. - if (m_autonomousCommand != null) { - m_autonomousCommand.cancel(); - } - } + @Override + public void teleopInit() { + // This makes sure that the autonomous stops running when + // teleop starts running. If you want the autonomous to + // continue until interrupted by another command, remove + // this line or comment it out. + if (m_autonomousCommand != null) { + m_autonomousCommand.cancel(); + } + } - /** - * This function is called periodically during operator control. - */ - @Override - public void teleopPeriodic() { - Scheduler.getInstance().run(); - } + /** + * This function is called periodically during operator control. + */ + @Override + public void teleopPeriodic() { + Scheduler.getInstance().run(); + } - /** - * This function is called periodically during test mode. - */ - @Override - public void testPeriodic() { - } + /** + * This function is called periodically during test mode. + */ + @Override + public void testPeriodic() { + } } diff --git a/wpilibjExamples/src/main/java/edu/wpi/first/wpilibj/templates/commandbased/RobotMap.java b/wpilibjExamples/src/main/java/edu/wpi/first/wpilibj/templates/commandbased/RobotMap.java index 709e7b27e2..ef213c466d 100644 --- a/wpilibjExamples/src/main/java/edu/wpi/first/wpilibj/templates/commandbased/RobotMap.java +++ b/wpilibjExamples/src/main/java/edu/wpi/first/wpilibj/templates/commandbased/RobotMap.java @@ -14,13 +14,13 @@ package edu.wpi.first.wpilibj.templates.commandbased; * floating around. */ public class RobotMap { - // For example to map the left and right motors, you could define the - // following variables to use with your drivetrain subsystem. - // public static int leftMotor = 1; - // public static int rightMotor = 2; + // For example to map the left and right motors, you could define the + // following variables to use with your drivetrain subsystem. + // public static int leftMotor = 1; + // public static int rightMotor = 2; - // If you are using multiple modules, make sure to define both the port - // number and the module. For example you with a rangefinder: - // public static int rangefinderPort = 1; - // public static int rangefinderModule = 1; + // If you are using multiple modules, make sure to define both the port + // number and the module. For example you with a rangefinder: + // public static int rangefinderPort = 1; + // public static int rangefinderModule = 1; } diff --git a/wpilibjExamples/src/main/java/edu/wpi/first/wpilibj/templates/commandbased/commands/ExampleCommand.java b/wpilibjExamples/src/main/java/edu/wpi/first/wpilibj/templates/commandbased/commands/ExampleCommand.java index b74f2248f6..10ceb6e7ff 100644 --- a/wpilibjExamples/src/main/java/edu/wpi/first/wpilibj/templates/commandbased/commands/ExampleCommand.java +++ b/wpilibjExamples/src/main/java/edu/wpi/first/wpilibj/templates/commandbased/commands/ExampleCommand.java @@ -14,35 +14,35 @@ import edu.wpi.first.wpilibj.templates.commandbased.Robot; * An example command. You can replace me with your own command. */ public class ExampleCommand extends Command { - public ExampleCommand() { - // Use requires() here to declare subsystem dependencies - requires(Robot.m_subsystem); - } + public ExampleCommand() { + // Use requires() here to declare subsystem dependencies + requires(Robot.m_subsystem); + } - // Called just before this Command runs the first time - @Override - protected void initialize() { - } + // Called just before this Command runs the first time + @Override + protected void initialize() { + } - // Called repeatedly when this Command is scheduled to run - @Override - protected void execute() { - } + // Called repeatedly when this Command is scheduled to run + @Override + protected void execute() { + } - // Make this return true when this Command no longer needs to run execute() - @Override - protected boolean isFinished() { - return false; - } + // Make this return true when this Command no longer needs to run execute() + @Override + protected boolean isFinished() { + return false; + } - // Called once after isFinished returns true - @Override - protected void end() { - } + // Called once after isFinished returns true + @Override + protected void end() { + } - // Called when another command which requires one or more of the same - // subsystems is scheduled to run - @Override - protected void interrupted() { - } + // Called when another command which requires one or more of the same + // subsystems is scheduled to run + @Override + protected void interrupted() { + } } diff --git a/wpilibjExamples/src/main/java/edu/wpi/first/wpilibj/templates/commandbased/subsystems/ExampleSubsystem.java b/wpilibjExamples/src/main/java/edu/wpi/first/wpilibj/templates/commandbased/subsystems/ExampleSubsystem.java index 7dcafbe309..6a8035f925 100644 --- a/wpilibjExamples/src/main/java/edu/wpi/first/wpilibj/templates/commandbased/subsystems/ExampleSubsystem.java +++ b/wpilibjExamples/src/main/java/edu/wpi/first/wpilibj/templates/commandbased/subsystems/ExampleSubsystem.java @@ -13,11 +13,11 @@ import edu.wpi.first.wpilibj.command.Subsystem; * An example subsystem. You can replace me with your own Subsystem. */ public class ExampleSubsystem extends Subsystem { - // Put methods for controlling this subsystem - // here. Call these from Commands. + // Put methods for controlling this subsystem + // here. Call these from Commands. - public void initDefaultCommand() { - // Set the default command for a subsystem here. - // setDefaultCommand(new MySpecialCommand()); - } + public void initDefaultCommand() { + // Set the default command for a subsystem here. + // setDefaultCommand(new MySpecialCommand()); + } } diff --git a/wpilibjExamples/src/main/java/edu/wpi/first/wpilibj/templates/iterative/Robot.java b/wpilibjExamples/src/main/java/edu/wpi/first/wpilibj/templates/iterative/Robot.java index e6e1027a8b..f96fb2a212 100644 --- a/wpilibjExamples/src/main/java/edu/wpi/first/wpilibj/templates/iterative/Robot.java +++ b/wpilibjExamples/src/main/java/edu/wpi/first/wpilibj/templates/iterative/Robot.java @@ -19,68 +19,68 @@ import edu.wpi.first.wpilibj.smartdashboard.SmartDashboard; * project. */ public class Robot extends IterativeRobot { - private static final String kDefaultAuto = "Default"; - private static final String kCustomAuto = "My Auto"; - private String m_autoSelected; - private SendableChooser m_chooser = new SendableChooser<>(); + private static final String kDefaultAuto = "Default"; + private static final String kCustomAuto = "My Auto"; + private String m_autoSelected; + private SendableChooser m_chooser = new SendableChooser<>(); - /** - * This function is run when the robot is first started up and should be - * used for any initialization code. - */ - @Override - public void robotInit() { - m_chooser.addDefault("Default Auto", kDefaultAuto); - m_chooser.addObject("My Auto", kCustomAuto); - SmartDashboard.putData("Auto choices", m_chooser); - } + /** + * This function is run when the robot is first started up and should be + * used for any initialization code. + */ + @Override + public void robotInit() { + m_chooser.addDefault("Default Auto", kDefaultAuto); + m_chooser.addObject("My Auto", kCustomAuto); + SmartDashboard.putData("Auto choices", m_chooser); + } - /** - * This autonomous (along with the chooser code above) shows how to select - * between different autonomous modes using the dashboard. The sendable - * chooser code works with the Java SmartDashboard. If you prefer the - * LabVIEW Dashboard, remove all of the chooser code and uncomment the - * getString line to get the auto name from the text box below the Gyro - * - *

You can add additional auto modes by adding additional comparisons to - * the switch structure below with additional strings. If using the - * SendableChooser make sure to add them to the chooser code above as well. - */ - @Override - public void autonomousInit() { - m_autoSelected = m_chooser.getSelected(); - // autoSelected = SmartDashboard.getString("Auto Selector", - // defaultAuto); - System.out.println("Auto selected: " + m_autoSelected); - } + /** + * This autonomous (along with the chooser code above) shows how to select + * between different autonomous modes using the dashboard. The sendable + * chooser code works with the Java SmartDashboard. If you prefer the + * LabVIEW Dashboard, remove all of the chooser code and uncomment the + * getString line to get the auto name from the text box below the Gyro + * + *

You can add additional auto modes by adding additional comparisons to + * the switch structure below with additional strings. If using the + * SendableChooser make sure to add them to the chooser code above as well. + */ + @Override + public void autonomousInit() { + m_autoSelected = m_chooser.getSelected(); + // autoSelected = SmartDashboard.getString("Auto Selector", + // defaultAuto); + System.out.println("Auto selected: " + m_autoSelected); + } - /** - * This function is called periodically during autonomous. - */ - @Override - public void autonomousPeriodic() { - switch (m_autoSelected) { - case kCustomAuto: - // Put custom auto code here - break; - case kDefaultAuto: - default: - // Put default auto code here - break; - } - } + /** + * This function is called periodically during autonomous. + */ + @Override + public void autonomousPeriodic() { + switch (m_autoSelected) { + case kCustomAuto: + // Put custom auto code here + break; + case kDefaultAuto: + default: + // Put default auto code here + break; + } + } - /** - * This function is called periodically during operator control. - */ - @Override - public void teleopPeriodic() { - } + /** + * This function is called periodically during operator control. + */ + @Override + public void teleopPeriodic() { + } - /** - * This function is called periodically during test mode. - */ - @Override - public void testPeriodic() { - } + /** + * This function is called periodically during test mode. + */ + @Override + public void testPeriodic() { + } } diff --git a/wpilibjExamples/src/main/java/edu/wpi/first/wpilibj/templates/sample/Robot.java b/wpilibjExamples/src/main/java/edu/wpi/first/wpilibj/templates/sample/Robot.java index fc9f167cdd..664cc5ef4f 100644 --- a/wpilibjExamples/src/main/java/edu/wpi/first/wpilibj/templates/sample/Robot.java +++ b/wpilibjExamples/src/main/java/edu/wpi/first/wpilibj/templates/sample/Robot.java @@ -33,123 +33,123 @@ import edu.wpi.first.wpilibj.smartdashboard.SmartDashboard; * Command-Based instead if you're new. */ public class Robot extends SampleRobot { - private static final String kDefaultAuto = "Default"; - private static final String kCustomAuto = "My Auto"; + private static final String kDefaultAuto = "Default"; + private static final String kCustomAuto = "My Auto"; - private DifferentialDrive m_robotDrive - = new DifferentialDrive(new Spark(0), new Spark(1)); - private Joystick m_stick = new Joystick(0); - private SendableChooser m_chooser = new SendableChooser<>(); + private DifferentialDrive m_robotDrive + = new DifferentialDrive(new Spark(0), new Spark(1)); + private Joystick m_stick = new Joystick(0); + private SendableChooser m_chooser = new SendableChooser<>(); - public Robot() { - m_robotDrive.setExpiration(0.1); - } + public Robot() { + m_robotDrive.setExpiration(0.1); + } - @Override - public void robotInit() { - m_chooser.addDefault("Default Auto", kDefaultAuto); - m_chooser.addObject("My Auto", kCustomAuto); - SmartDashboard.putData("Auto modes", m_chooser); - } + @Override + public void robotInit() { + m_chooser.addDefault("Default Auto", kDefaultAuto); + m_chooser.addObject("My Auto", kCustomAuto); + SmartDashboard.putData("Auto modes", m_chooser); + } - /** - * This autonomous (along with the chooser code above) shows how to select - * between different autonomous modes using the dashboard. The sendable - * chooser code works with the Java SmartDashboard. If you prefer the - * LabVIEW Dashboard, remove all of the chooser code and uncomment the - * getString line to get the auto name from the text box below the Gyro - * - *

You can add additional auto modes by adding additional comparisons to - * the if-else structure below with additional strings. If using the - * SendableChooser make sure to add them to the chooser code above as well. - * - *

If you wanted to run a similar autonomous mode with an IterativeRobot - * you would write: - * - *

{@code
-	 * Timer timer = new Timer();
-	 *
-	 * // This function is run once each time the robot enters autonomous mode
-	 * public void autonomousInit() {
-	 *     timer.reset();
-	 *     timer.start();
-	 * }
-	 *
-	 * // This function is called periodically during autonomous
-	 * public void autonomousPeriodic() {
-	 * // Drive for 2 seconds
-	 *     if (timer.get() < 2.0) {
-	 *         myRobot.drive(-0.5, 0.0); // drive forwards half speed
-	 *     } else if (timer.get() < 5.0) {
-	 *         myRobot.drive(-1.0, 0.0); // drive forwards full speed
-	 *     } else {
-	 *         myRobot.drive(0.0, 0.0); // stop robot
-	 *     }
-	 * }
-	 * }
- */ - @Override - public void autonomous() { - String autoSelected = m_chooser.getSelected(); - // String autoSelected = SmartDashboard.getString("Auto Selector", - // defaultAuto); - System.out.println("Auto selected: " + autoSelected); + /** + * This autonomous (along with the chooser code above) shows how to select + * between different autonomous modes using the dashboard. The sendable + * chooser code works with the Java SmartDashboard. If you prefer the + * LabVIEW Dashboard, remove all of the chooser code and uncomment the + * getString line to get the auto name from the text box below the Gyro + * + *

You can add additional auto modes by adding additional comparisons to + * the if-else structure below with additional strings. If using the + * SendableChooser make sure to add them to the chooser code above as well. + * + *

If you wanted to run a similar autonomous mode with an IterativeRobot + * you would write: + * + *

{@code
+   * Timer timer = new Timer();
+   *
+   * // This function is run once each time the robot enters autonomous mode
+   * public void autonomousInit() {
+   *     timer.reset();
+   *     timer.start();
+   * }
+   *
+   * // This function is called periodically during autonomous
+   * public void autonomousPeriodic() {
+   * // Drive for 2 seconds
+   *     if (timer.get() < 2.0) {
+   *         myRobot.drive(-0.5, 0.0); // drive forwards half speed
+   *     } else if (timer.get() < 5.0) {
+   *         myRobot.drive(-1.0, 0.0); // drive forwards full speed
+   *     } else {
+   *         myRobot.drive(0.0, 0.0); // stop robot
+   *     }
+   * }
+   * }
+ */ + @Override + public void autonomous() { + String autoSelected = m_chooser.getSelected(); + // String autoSelected = SmartDashboard.getString("Auto Selector", + // defaultAuto); + System.out.println("Auto selected: " + autoSelected); - // MotorSafety improves safety when motors are updated in loops - // but is disabled here because motor updates are not looped in - // this autonomous mode. - m_robotDrive.setSafetyEnabled(false); + // MotorSafety improves safety when motors are updated in loops + // but is disabled here because motor updates are not looped in + // this autonomous mode. + m_robotDrive.setSafetyEnabled(false); - switch (autoSelected) { - case kCustomAuto: - // Spin at half speed for two seconds - m_robotDrive.arcadeDrive(0.0, 0.5); - Timer.delay(2.0); + switch (autoSelected) { + case kCustomAuto: + // Spin at half speed for two seconds + m_robotDrive.arcadeDrive(0.0, 0.5); + Timer.delay(2.0); - // Stop robot - m_robotDrive.arcadeDrive(0.0, 0.0); - break; - case kDefaultAuto: - default: - // Drive forwards for two seconds - m_robotDrive.arcadeDrive(-0.5, 0.0); - Timer.delay(2.0); + // Stop robot + m_robotDrive.arcadeDrive(0.0, 0.0); + break; + case kDefaultAuto: + default: + // Drive forwards for two seconds + m_robotDrive.arcadeDrive(-0.5, 0.0); + Timer.delay(2.0); - // Stop robot - m_robotDrive.arcadeDrive(0.0, 0.0); - break; - } - } + // Stop robot + m_robotDrive.arcadeDrive(0.0, 0.0); + break; + } + } - /** - * Runs the motors with arcade steering. - * - *

If you wanted to run a similar teleoperated mode with an IterativeRobot - * you would write: - * - *

{@code
-	 * // This function is called periodically during operator control
-	 * public void teleopPeriodic() {
-	 *     myRobot.arcadeDrive(stick);
-	 * }
-	 * }
- */ - @Override - public void operatorControl() { - m_robotDrive.setSafetyEnabled(true); - while (isOperatorControl() && isEnabled()) { - // Drive arcade style - m_robotDrive.arcadeDrive(-m_stick.getY(), m_stick.getX()); + /** + * Runs the motors with arcade steering. + * + *

If you wanted to run a similar teleoperated mode with an IterativeRobot + * you would write: + * + *

{@code
+   * // This function is called periodically during operator control
+   * public void teleopPeriodic() {
+   *     myRobot.arcadeDrive(stick);
+   * }
+   * }
+ */ + @Override + public void operatorControl() { + m_robotDrive.setSafetyEnabled(true); + while (isOperatorControl() && isEnabled()) { + // Drive arcade style + m_robotDrive.arcadeDrive(-m_stick.getY(), m_stick.getX()); - // The motors will be updated every 5ms - Timer.delay(0.005); - } - } + // The motors will be updated every 5ms + Timer.delay(0.005); + } + } - /** - * Runs during test mode. - */ - @Override - public void test() { - } + /** + * Runs during test mode. + */ + @Override + public void test() { + } } diff --git a/wpilibjExamples/src/main/java/edu/wpi/first/wpilibj/templates/timed/Robot.java b/wpilibjExamples/src/main/java/edu/wpi/first/wpilibj/templates/timed/Robot.java index ff869fd587..2cb96fcae6 100644 --- a/wpilibjExamples/src/main/java/edu/wpi/first/wpilibj/templates/timed/Robot.java +++ b/wpilibjExamples/src/main/java/edu/wpi/first/wpilibj/templates/timed/Robot.java @@ -19,68 +19,68 @@ import edu.wpi.first.wpilibj.smartdashboard.SmartDashboard; * project. */ public class Robot extends TimedRobot { - private static final String kDefaultAuto = "Default"; - private static final String kCustomAuto = "My Auto"; - private String m_autoSelected; - private SendableChooser m_chooser = new SendableChooser<>(); + private static final String kDefaultAuto = "Default"; + private static final String kCustomAuto = "My Auto"; + private String m_autoSelected; + private SendableChooser m_chooser = new SendableChooser<>(); - /** - * This function is run when the robot is first started up and should be - * used for any initialization code. - */ - @Override - public void robotInit() { - m_chooser.addDefault("Default Auto", kDefaultAuto); - m_chooser.addObject("My Auto", kCustomAuto); - SmartDashboard.putData("Auto choices", m_chooser); - } + /** + * This function is run when the robot is first started up and should be + * used for any initialization code. + */ + @Override + public void robotInit() { + m_chooser.addDefault("Default Auto", kDefaultAuto); + m_chooser.addObject("My Auto", kCustomAuto); + SmartDashboard.putData("Auto choices", m_chooser); + } - /** - * This autonomous (along with the chooser code above) shows how to select - * between different autonomous modes using the dashboard. The sendable - * chooser code works with the Java SmartDashboard. If you prefer the - * LabVIEW Dashboard, remove all of the chooser code and uncomment the - * getString line to get the auto name from the text box below the Gyro - * - *

You can add additional auto modes by adding additional comparisons to - * the switch structure below with additional strings. If using the - * SendableChooser make sure to add them to the chooser code above as well. - */ - @Override - public void autonomousInit() { - m_autoSelected = m_chooser.getSelected(); - // m_autoSelected = SmartDashboard.getString("Auto Selector", - // kDefaultAuto); - System.out.println("Auto selected: " + m_autoSelected); - } + /** + * This autonomous (along with the chooser code above) shows how to select + * between different autonomous modes using the dashboard. The sendable + * chooser code works with the Java SmartDashboard. If you prefer the + * LabVIEW Dashboard, remove all of the chooser code and uncomment the + * getString line to get the auto name from the text box below the Gyro + * + *

You can add additional auto modes by adding additional comparisons to + * the switch structure below with additional strings. If using the + * SendableChooser make sure to add them to the chooser code above as well. + */ + @Override + public void autonomousInit() { + m_autoSelected = m_chooser.getSelected(); + // m_autoSelected = SmartDashboard.getString("Auto Selector", + // kDefaultAuto); + System.out.println("Auto selected: " + m_autoSelected); + } - /** - * This function is called periodically during autonomous. - */ - @Override - public void autonomousPeriodic() { - switch (m_autoSelected) { - case kCustomAuto: - // Put custom auto code here - break; - case kDefaultAuto: - default: - // Put default auto code here - break; - } - } + /** + * This function is called periodically during autonomous. + */ + @Override + public void autonomousPeriodic() { + switch (m_autoSelected) { + case kCustomAuto: + // Put custom auto code here + break; + case kDefaultAuto: + default: + // Put default auto code here + break; + } + } - /** - * This function is called periodically during operator control. - */ - @Override - public void teleopPeriodic() { - } + /** + * This function is called periodically during operator control. + */ + @Override + public void teleopPeriodic() { + } - /** - * This function is called periodically during test mode. - */ - @Override - public void testPeriodic() { - } + /** + * This function is called periodically during test mode. + */ + @Override + public void testPeriodic() { + } } diff --git a/wpiutil/.styleguide b/wpiutil/.styleguide index cef0b77771..2ebcbac622 100644 --- a/wpiutil/.styleguide +++ b/wpiutil/.styleguide @@ -8,8 +8,8 @@ cppSrcFileInclude { } generatedFileExclude { - gmock/ src/main/native/cpp/llvm/ + src/main/native/include/llvm/ src/main/native/include/wpi/AlignOf\.h$ src/main/native/include/wpi/ArrayRef\.h$ src/main/native/include/wpi/Compiler\.h$ @@ -24,7 +24,7 @@ generatedFileExclude { src/main/native/include/wpi/MathExtras\.h$ src/main/native/include/wpi/None\.h$ src/main/native/include/wpi/Optional\.h$ - src/main/native/include/wpi/Path\.h $ + src/main/native/include/wpi/Path\.h$ src/main/native/include/wpi/PointerLikeTypeTraits\.h$ src/main/native/include/wpi/STLExtras\.h$ src/main/native/include/wpi/SmallPtrSet\.h$ @@ -52,12 +52,17 @@ licenseUpdateExclude { src/main/native/cpp/TCPConnector\.cpp$ src/main/native/cpp/TCPStream\.cpp$ src/main/native/include/wpi/ConcurrentQueue\.h$ + src/main/native/include/wpi/Path\.h$ src/main/native/include/wpi/sha1\.h$ src/main/native/include/wpi/TCPAcceptor\.h$ src/main/native/include/wpi/TCPConnector\.h$ src/main/native/include/wpi/TCPStream\.h$ } +repoRootNameOverride { + wpiutil +} + includeGuardRoots { wpiutil/src/main/native/cpp/ wpiutil/src/main/native/include/ diff --git a/wpiutil/src/main/native/include/llvm/AlignOf.h b/wpiutil/src/main/native/include/llvm/AlignOf.h index 0e7913f7b8..6ecb22c2a0 100644 --- a/wpiutil/src/main/native/include/llvm/AlignOf.h +++ b/wpiutil/src/main/native/include/llvm/AlignOf.h @@ -7,11 +7,13 @@ #pragma once +// clang-format off #ifdef _MSC_VER #pragma message "warning: llvm/AlignOf.h is deprecated; include wpi/AlignOf.h instead" #else #warning "llvm/AlignOf.h is deprecated; include wpi/AlignOf.h instead" #endif +// clang-format on #include "wpi/AlignOf.h" diff --git a/wpiutil/src/main/native/include/llvm/ArrayRef.h b/wpiutil/src/main/native/include/llvm/ArrayRef.h index 41dafc9d5b..9cf71a61f8 100644 --- a/wpiutil/src/main/native/include/llvm/ArrayRef.h +++ b/wpiutil/src/main/native/include/llvm/ArrayRef.h @@ -7,11 +7,13 @@ #pragma once +// clang-format off #ifdef _MSC_VER #pragma message "warning: llvm/ArrayRef.h is deprecated; include wpi/ArrayRef.h instead" #else #warning "llvm/ArrayRef.h is deprecated; include wpi/ArrayRef.h instead" #endif +// clang-format on #include "wpi/ArrayRef.h" diff --git a/wpiutil/src/main/native/include/llvm/Compiler.h b/wpiutil/src/main/native/include/llvm/Compiler.h index f086fef76e..658e7e03f2 100644 --- a/wpiutil/src/main/native/include/llvm/Compiler.h +++ b/wpiutil/src/main/native/include/llvm/Compiler.h @@ -7,11 +7,13 @@ #pragma once +// clang-format off #ifdef _MSC_VER #pragma message "warning: llvm/Compiler.h is deprecated; include wpi/Compiler.h instead" #else #warning "llvm/Compiler.h is deprecated; include wpi/Compiler.h instead" #endif +// clang-format on #include "wpi/Compiler.h" diff --git a/wpiutil/src/main/native/include/llvm/ConvertUTF.h b/wpiutil/src/main/native/include/llvm/ConvertUTF.h index a39a7757c8..18645f7b3f 100644 --- a/wpiutil/src/main/native/include/llvm/ConvertUTF.h +++ b/wpiutil/src/main/native/include/llvm/ConvertUTF.h @@ -7,11 +7,13 @@ #pragma once +// clang-format off #ifdef _MSC_VER #pragma message "warning: llvm/ConvertUTF.h is deprecated; include wpi/ConvertUTF.h instead" #else #warning "llvm/ConvertUTF.h is deprecated; include wpi/ConvertUTF.h instead" #endif +// clang-format on #include "wpi/ConvertUTF.h" diff --git a/wpiutil/src/main/native/include/llvm/DenseMap.h b/wpiutil/src/main/native/include/llvm/DenseMap.h index a17dabefab..cf609a9412 100644 --- a/wpiutil/src/main/native/include/llvm/DenseMap.h +++ b/wpiutil/src/main/native/include/llvm/DenseMap.h @@ -7,11 +7,13 @@ #pragma once +// clang-format off #ifdef _MSC_VER #pragma message "warning: llvm/DenseMap.h is deprecated; include wpi/DenseMap.h instead" #else #warning "llvm/DenseMap.h is deprecated; include wpi/DenseMap.h instead" #endif +// clang-format on #include "wpi/DenseMap.h" diff --git a/wpiutil/src/main/native/include/llvm/DenseMapInfo.h b/wpiutil/src/main/native/include/llvm/DenseMapInfo.h index 3d24dcf885..ab582fb326 100644 --- a/wpiutil/src/main/native/include/llvm/DenseMapInfo.h +++ b/wpiutil/src/main/native/include/llvm/DenseMapInfo.h @@ -7,11 +7,13 @@ #pragma once +// clang-format off #ifdef _MSC_VER #pragma message "warning: llvm/DenseMapInfo.h is deprecated; include wpi/DenseMapInfo.h instead" #else #warning "llvm/DenseMapInfo.h is deprecated; include wpi/DenseMapInfo.h instead" #endif +// clang-format on #include "wpi/DenseMapInfo.h" diff --git a/wpiutil/src/main/native/include/llvm/EpochTracker.h b/wpiutil/src/main/native/include/llvm/EpochTracker.h index bb30826473..b9351c400f 100644 --- a/wpiutil/src/main/native/include/llvm/EpochTracker.h +++ b/wpiutil/src/main/native/include/llvm/EpochTracker.h @@ -7,11 +7,13 @@ #pragma once +// clang-format off #ifdef _MSC_VER #pragma message "warning: llvm/EpochTracker.h is deprecated; include wpi/EpochTracker.h instead" #else #warning "llvm/EpochTracker.h is deprecated; include wpi/EpochTracker.h instead" #endif +// clang-format on #include "wpi/EpochTracker.h" diff --git a/wpiutil/src/main/native/include/llvm/FileSystem.h b/wpiutil/src/main/native/include/llvm/FileSystem.h index 0bb973a6a7..41a8a0f209 100644 --- a/wpiutil/src/main/native/include/llvm/FileSystem.h +++ b/wpiutil/src/main/native/include/llvm/FileSystem.h @@ -7,11 +7,13 @@ #pragma once +// clang-format off #ifdef _MSC_VER #pragma message "warning: llvm/FileSystem.h is deprecated; include wpi/FileSystem.h instead" #else #warning "llvm/FileSystem.h is deprecated; include wpi/FileSystem.h instead" #endif +// clang-format on #include "wpi/FileSystem.h" diff --git a/wpiutil/src/main/native/include/llvm/Format.h b/wpiutil/src/main/native/include/llvm/Format.h index e6be1d7299..74947225d9 100644 --- a/wpiutil/src/main/native/include/llvm/Format.h +++ b/wpiutil/src/main/native/include/llvm/Format.h @@ -7,11 +7,13 @@ #pragma once +// clang-format off #ifdef _MSC_VER #pragma message "warning: llvm/Format.h is deprecated; include wpi/Format.h instead" #else #warning "llvm/Format.h is deprecated; include wpi/Format.h instead" #endif +// clang-format on #include "wpi/Format.h" diff --git a/wpiutil/src/main/native/include/llvm/Hashing.h b/wpiutil/src/main/native/include/llvm/Hashing.h index 8b01b45ef0..3e9d46436d 100644 --- a/wpiutil/src/main/native/include/llvm/Hashing.h +++ b/wpiutil/src/main/native/include/llvm/Hashing.h @@ -7,11 +7,13 @@ #pragma once +// clang-format off #ifdef _MSC_VER #pragma message "warning: llvm/Hashing.h is deprecated; include wpi/Hashing.h instead" #else #warning "llvm/Hashing.h is deprecated; include wpi/Hashing.h instead" #endif +// clang-format on #include "wpi/Hashing.h" diff --git a/wpiutil/src/main/native/include/llvm/IntrusiveRefCntPtr.h b/wpiutil/src/main/native/include/llvm/IntrusiveRefCntPtr.h index c41bbd17c1..6a98483198 100644 --- a/wpiutil/src/main/native/include/llvm/IntrusiveRefCntPtr.h +++ b/wpiutil/src/main/native/include/llvm/IntrusiveRefCntPtr.h @@ -7,11 +7,13 @@ #pragma once +// clang-format off #ifdef _MSC_VER #pragma message "warning: llvm/IntrusiveRefCntPtr.h is deprecated; include wpi/IntrusiveRefCntPtr.h instead" #else #warning "llvm/IntrusiveRefCntPtr.h is deprecated; include wpi/IntrusiveRefCntPtr.h instead" #endif +// clang-format on #include "wpi/IntrusiveRefCntPtr.h" diff --git a/wpiutil/src/main/native/include/llvm/MathExtras.h b/wpiutil/src/main/native/include/llvm/MathExtras.h index 64782afb29..49b7419256 100644 --- a/wpiutil/src/main/native/include/llvm/MathExtras.h +++ b/wpiutil/src/main/native/include/llvm/MathExtras.h @@ -7,11 +7,13 @@ #pragma once +// clang-format off #ifdef _MSC_VER #pragma message "warning: llvm/MathExtras.h is deprecated; include wpi/MathExtras.h instead" #else #warning "llvm/MathExtras.h is deprecated; include wpi/MathExtras.h instead" #endif +// clang-format on #include "wpi/MathExtras.h" diff --git a/wpiutil/src/main/native/include/llvm/None.h b/wpiutil/src/main/native/include/llvm/None.h index 2346b5a3c2..5f4c1229da 100644 --- a/wpiutil/src/main/native/include/llvm/None.h +++ b/wpiutil/src/main/native/include/llvm/None.h @@ -7,11 +7,13 @@ #pragma once +// clang-format off #ifdef _MSC_VER #pragma message "warning: llvm/None.h is deprecated; include wpi/None.h instead" #else #warning "llvm/None.h is deprecated; include wpi/None.h instead" #endif +// clang-format on #include "wpi/None.h" diff --git a/wpiutil/src/main/native/include/llvm/Optional.h b/wpiutil/src/main/native/include/llvm/Optional.h index e5a0c20656..3d237f6662 100644 --- a/wpiutil/src/main/native/include/llvm/Optional.h +++ b/wpiutil/src/main/native/include/llvm/Optional.h @@ -7,11 +7,13 @@ #pragma once +// clang-format off #ifdef _MSC_VER #pragma message "warning: llvm/Optional.h is deprecated; include wpi/Optional.h instead" #else #warning "llvm/Optional.h is deprecated; include wpi/Optional.h instead" #endif +// clang-format on #include "wpi/Optional.h" diff --git a/wpiutil/src/main/native/include/llvm/Path.h b/wpiutil/src/main/native/include/llvm/Path.h index 0249ed8847..85aaf59950 100644 --- a/wpiutil/src/main/native/include/llvm/Path.h +++ b/wpiutil/src/main/native/include/llvm/Path.h @@ -7,11 +7,13 @@ #pragma once +// clang-format off #ifdef _MSC_VER #pragma message "warning: llvm/Path.h is deprecated; include wpi/Path.h instead" #else #warning "llvm/Path.h is deprecated; include wpi/Path.h instead" #endif +// clang-format on #include "wpi/Path.h" diff --git a/wpiutil/src/main/native/include/llvm/PointerLikeTypeTraits.h b/wpiutil/src/main/native/include/llvm/PointerLikeTypeTraits.h index bc6cc7ede9..b0f460af5e 100644 --- a/wpiutil/src/main/native/include/llvm/PointerLikeTypeTraits.h +++ b/wpiutil/src/main/native/include/llvm/PointerLikeTypeTraits.h @@ -7,11 +7,13 @@ #pragma once +// clang-format off #ifdef _MSC_VER #pragma message "warning: llvm/PointerLikeTypeTraits.h is deprecated; include wpi/PointerLikeTypeTraits.h instead" #else #warning "llvm/PointerLikeTypeTraits.h is deprecated; include wpi/PointerLikeTypeTraits.h instead" #endif +// clang-format on #include "wpi/PointerLikeTypeTraits.h" diff --git a/wpiutil/src/main/native/include/llvm/STLExtras.h b/wpiutil/src/main/native/include/llvm/STLExtras.h index 6a3c1761e8..87ea631169 100644 --- a/wpiutil/src/main/native/include/llvm/STLExtras.h +++ b/wpiutil/src/main/native/include/llvm/STLExtras.h @@ -7,11 +7,13 @@ #pragma once +// clang-format off #ifdef _MSC_VER #pragma message "warning: llvm/STLExtras.h is deprecated; include wpi/STLExtras.h instead" #else #warning "llvm/STLExtras.h is deprecated; include wpi/STLExtras.h instead" #endif +// clang-format on #include "wpi/STLExtras.h" diff --git a/wpiutil/src/main/native/include/llvm/SmallPtrSet.h b/wpiutil/src/main/native/include/llvm/SmallPtrSet.h index ff11423aae..546b04e25a 100644 --- a/wpiutil/src/main/native/include/llvm/SmallPtrSet.h +++ b/wpiutil/src/main/native/include/llvm/SmallPtrSet.h @@ -7,11 +7,13 @@ #pragma once +// clang-format off #ifdef _MSC_VER #pragma message "warning: llvm/SmallPtrSet.h is deprecated; include wpi/SmallPtrSet.h instead" #else #warning "llvm/SmallPtrSet.h is deprecated; include wpi/SmallPtrSet.h instead" #endif +// clang-format on #include "wpi/SmallPtrSet.h" diff --git a/wpiutil/src/main/native/include/llvm/SmallSet.h b/wpiutil/src/main/native/include/llvm/SmallSet.h index fc69fc6ddf..c431bd5134 100644 --- a/wpiutil/src/main/native/include/llvm/SmallSet.h +++ b/wpiutil/src/main/native/include/llvm/SmallSet.h @@ -7,11 +7,13 @@ #pragma once +// clang-format off #ifdef _MSC_VER #pragma message "warning: llvm/SmallSet.h is deprecated; include wpi/SmallSet.h instead" #else #warning "llvm/SmallSet.h is deprecated; include wpi/SmallSet.h instead" #endif +// clang-format on #include "wpi/SmallSet.h" diff --git a/wpiutil/src/main/native/include/llvm/SmallString.h b/wpiutil/src/main/native/include/llvm/SmallString.h index 2130c5af08..7679f6be6f 100644 --- a/wpiutil/src/main/native/include/llvm/SmallString.h +++ b/wpiutil/src/main/native/include/llvm/SmallString.h @@ -7,11 +7,13 @@ #pragma once +// clang-format off #ifdef _MSC_VER #pragma message "warning: llvm/SmallString.h is deprecated; include wpi/SmallString.h instead" #else #warning "llvm/SmallString.h is deprecated; include wpi/SmallString.h instead" #endif +// clang-format on #include "wpi/SmallString.h" diff --git a/wpiutil/src/main/native/include/llvm/SmallVector.h b/wpiutil/src/main/native/include/llvm/SmallVector.h index a60a354f50..9291933964 100644 --- a/wpiutil/src/main/native/include/llvm/SmallVector.h +++ b/wpiutil/src/main/native/include/llvm/SmallVector.h @@ -7,11 +7,13 @@ #pragma once +// clang-format off #ifdef _MSC_VER #pragma message "warning: llvm/SmallVector.h is deprecated; include wpi/SmallVector.h instead" #else #warning "llvm/SmallVector.h is deprecated; include wpi/SmallVector.h instead" #endif +// clang-format on #include "wpi/SmallVector.h" diff --git a/wpiutil/src/main/native/include/llvm/StringExtras.h b/wpiutil/src/main/native/include/llvm/StringExtras.h index 2e3b8ef9e8..4fcfdd6350 100644 --- a/wpiutil/src/main/native/include/llvm/StringExtras.h +++ b/wpiutil/src/main/native/include/llvm/StringExtras.h @@ -7,11 +7,13 @@ #pragma once +// clang-format off #ifdef _MSC_VER #pragma message "warning: llvm/StringExtras.h is deprecated; include wpi/StringExtras.h instead" #else #warning "llvm/StringExtras.h is deprecated; include wpi/StringExtras.h instead" #endif +// clang-format on #include "wpi/StringExtras.h" diff --git a/wpiutil/src/main/native/include/llvm/StringMap.h b/wpiutil/src/main/native/include/llvm/StringMap.h index 19e4e70e1c..4fd06aa8b7 100644 --- a/wpiutil/src/main/native/include/llvm/StringMap.h +++ b/wpiutil/src/main/native/include/llvm/StringMap.h @@ -7,11 +7,13 @@ #pragma once +// clang-format off #ifdef _MSC_VER #pragma message "warning: llvm/StringMap.h is deprecated; include wpi/StringMap.h instead" #else #warning "llvm/StringMap.h is deprecated; include wpi/StringMap.h instead" #endif +// clang-format on #include "wpi/StringMap.h" diff --git a/wpiutil/src/main/native/include/llvm/StringRef.h b/wpiutil/src/main/native/include/llvm/StringRef.h index 7fbc7da35e..74f44b5ebc 100644 --- a/wpiutil/src/main/native/include/llvm/StringRef.h +++ b/wpiutil/src/main/native/include/llvm/StringRef.h @@ -7,11 +7,13 @@ #pragma once +// clang-format off #ifdef _MSC_VER #pragma message "warning: llvm/StringRef.h is deprecated; include wpi/StringRef.h instead" #else #warning "llvm/StringRef.h is deprecated; include wpi/StringRef.h instead" #endif +// clang-format on #include "wpi/StringRef.h" diff --git a/wpiutil/src/main/native/include/llvm/Twine.h b/wpiutil/src/main/native/include/llvm/Twine.h index 6c39d17dd2..ddd40a40cc 100644 --- a/wpiutil/src/main/native/include/llvm/Twine.h +++ b/wpiutil/src/main/native/include/llvm/Twine.h @@ -7,11 +7,13 @@ #pragma once +// clang-format off #ifdef _MSC_VER #pragma message "warning: llvm/Twine.h is deprecated; include wpi/Twine.h instead" #else #warning "llvm/Twine.h is deprecated; include wpi/Twine.h instead" #endif +// clang-format on #include "wpi/Twine.h" diff --git a/wpiutil/src/main/native/include/llvm/WindowsError.h b/wpiutil/src/main/native/include/llvm/WindowsError.h index e8312ca110..1f7c618ddd 100644 --- a/wpiutil/src/main/native/include/llvm/WindowsError.h +++ b/wpiutil/src/main/native/include/llvm/WindowsError.h @@ -7,11 +7,13 @@ #pragma once +// clang-format off #ifdef _MSC_VER #pragma message "warning: llvm/WindowsError.h is deprecated; include wpi/WindowsError.h instead" #else #warning "llvm/WindowsError.h is deprecated; include wpi/WindowsError.h instead" #endif +// clang-format on #include "wpi/WindowsError.h" diff --git a/wpiutil/src/main/native/include/llvm/iterator_range.h b/wpiutil/src/main/native/include/llvm/iterator_range.h index 9ffe84d7bd..acd9d7dc86 100644 --- a/wpiutil/src/main/native/include/llvm/iterator_range.h +++ b/wpiutil/src/main/native/include/llvm/iterator_range.h @@ -7,11 +7,13 @@ #pragma once +// clang-format off #ifdef _MSC_VER #pragma message "warning: llvm/iterator_range.h is deprecated; include wpi/iterator_range.h instead" #else #warning "llvm/iterator_range.h is deprecated; include wpi/iterator_range.h instead" #endif +// clang-format on #include "wpi/iterator_range.h" diff --git a/wpiutil/src/main/native/include/llvm/raw_os_ostream.h b/wpiutil/src/main/native/include/llvm/raw_os_ostream.h index 23bcfac749..b9e7fd6fae 100644 --- a/wpiutil/src/main/native/include/llvm/raw_os_ostream.h +++ b/wpiutil/src/main/native/include/llvm/raw_os_ostream.h @@ -7,11 +7,13 @@ #pragma once +// clang-format off #ifdef _MSC_VER #pragma message "warning: llvm/raw_os_ostream.h is deprecated; include wpi/raw_os_ostream.h instead" #else #warning "llvm/raw_os_ostream.h is deprecated; include wpi/raw_os_ostream.h instead" #endif +// clang-format on #include "wpi/raw_os_ostream.h" diff --git a/wpiutil/src/main/native/include/llvm/raw_ostream.h b/wpiutil/src/main/native/include/llvm/raw_ostream.h index 0e644ed0fe..3781bd7abc 100644 --- a/wpiutil/src/main/native/include/llvm/raw_ostream.h +++ b/wpiutil/src/main/native/include/llvm/raw_ostream.h @@ -7,11 +7,13 @@ #pragma once +// clang-format off #ifdef _MSC_VER #pragma message "warning: llvm/raw_ostream.h is deprecated; include wpi/raw_ostream.h instead" #else #warning "llvm/raw_ostream.h is deprecated; include wpi/raw_ostream.h instead" #endif +// clang-format on #include "wpi/raw_ostream.h" diff --git a/wpiutil/src/main/native/include/llvm/type_traits.h b/wpiutil/src/main/native/include/llvm/type_traits.h index 34b6b63b2a..e662e0e070 100644 --- a/wpiutil/src/main/native/include/llvm/type_traits.h +++ b/wpiutil/src/main/native/include/llvm/type_traits.h @@ -7,11 +7,13 @@ #pragma once +// clang-format off #ifdef _MSC_VER #pragma message "warning: llvm/type_traits.h is deprecated; include wpi/type_traits.h instead" #else #warning "llvm/type_traits.h is deprecated; include wpi/type_traits.h instead" #endif +// clang-format on #include "wpi/type_traits.h" diff --git a/wpiutil/src/main/native/include/support/Base64.h b/wpiutil/src/main/native/include/support/Base64.h index f4bcb762f4..54f6702529 100644 --- a/wpiutil/src/main/native/include/support/Base64.h +++ b/wpiutil/src/main/native/include/support/Base64.h @@ -7,10 +7,13 @@ #pragma once +// clang-format off #ifdef _MSC_VER #pragma message "warning: support/Base64.h is deprecated; include wpi/Base64.h instead" #else #warning "support/Base64.h is deprecated; include wpi/Base64.h instead" #endif +// clang-format on + #include "wpi/Base64.h" diff --git a/wpiutil/src/main/native/include/support/ConcurrentQueue.h b/wpiutil/src/main/native/include/support/ConcurrentQueue.h index 03d6355cab..77f5eba93e 100644 --- a/wpiutil/src/main/native/include/support/ConcurrentQueue.h +++ b/wpiutil/src/main/native/include/support/ConcurrentQueue.h @@ -7,10 +7,13 @@ #pragma once +// clang-format off #ifdef _MSC_VER #pragma message "warning: support/ConcurrentQueue.h is deprecated; include wpi/ConcurrentQueue.h instead" #else #warning "support/ConcurrentQueue.h is deprecated; include wpi/ConcurrentQueue.h instead" #endif +// clang-format on + #include "wpi/ConcurrentQueue.h" diff --git a/wpiutil/src/main/native/include/support/HttpUtil.h b/wpiutil/src/main/native/include/support/HttpUtil.h index e9554914b8..d8e2be0f49 100644 --- a/wpiutil/src/main/native/include/support/HttpUtil.h +++ b/wpiutil/src/main/native/include/support/HttpUtil.h @@ -7,10 +7,13 @@ #pragma once +// clang-format off #ifdef _MSC_VER #pragma message "warning: support/HttpUtil.h is deprecated; include wpi/HttpUtil.h instead" #else #warning "support/HttpUtil.h is deprecated; include wpi/HttpUtil.h instead" #endif +// clang-format on + #include "wpi/HttpUtil.h" diff --git a/wpiutil/src/main/native/include/support/HttpUtil.inl b/wpiutil/src/main/native/include/support/HttpUtil.inl index 1b17bd13c9..8210c2591a 100644 --- a/wpiutil/src/main/native/include/support/HttpUtil.inl +++ b/wpiutil/src/main/native/include/support/HttpUtil.inl @@ -7,10 +7,12 @@ #pragma once +// clang-format off #ifdef _MSC_VER #pragma message "warning: support/HttpUtil.inl is deprecated; include wpi/HttpUtil.inl instead" #else #warning "support/HttpUtil.inl is deprecated; include wpi/HttpUtil.inl instead" #endif +// clang-format on #include "wpi/HttpUtil.inl" diff --git a/wpiutil/src/main/native/include/support/Logger.h b/wpiutil/src/main/native/include/support/Logger.h index 7fe2deb27b..5bf2cdff23 100644 --- a/wpiutil/src/main/native/include/support/Logger.h +++ b/wpiutil/src/main/native/include/support/Logger.h @@ -7,10 +7,13 @@ #pragma once +// clang-format off #ifdef _MSC_VER #pragma message "warning: support/Logger.h is deprecated; include wpi/Logger.h instead" #else #warning "support/Logger.h is deprecated; include wpi/Logger.h instead" #endif +// clang-format on + #include "wpi/Logger.h" diff --git a/wpiutil/src/main/native/include/support/SafeThread.h b/wpiutil/src/main/native/include/support/SafeThread.h index 93390f11de..cceaf57db1 100644 --- a/wpiutil/src/main/native/include/support/SafeThread.h +++ b/wpiutil/src/main/native/include/support/SafeThread.h @@ -7,10 +7,13 @@ #pragma once +// clang-format off #ifdef _MSC_VER #pragma message "warning: support/SafeThread.h is deprecated; include wpi/SafeThread.h instead" #else #warning "support/SafeThread.h is deprecated; include wpi/SafeThread.h instead" #endif +// clang-format on + #include "wpi/SafeThread.h" diff --git a/wpiutil/src/main/native/include/support/UidVector.h b/wpiutil/src/main/native/include/support/UidVector.h index ba3afd2563..d5d480696f 100644 --- a/wpiutil/src/main/native/include/support/UidVector.h +++ b/wpiutil/src/main/native/include/support/UidVector.h @@ -7,10 +7,13 @@ #pragma once +// clang-format off #ifdef _MSC_VER #pragma message "warning: support/UidVector.h is deprecated; include wpi/UidVector.h instead" #else #warning "support/UidVector.h is deprecated; include wpi/UidVector.h instead" #endif +// clang-format on + #include "wpi/UidVector.h" diff --git a/wpiutil/src/main/native/include/support/atomic_static.h b/wpiutil/src/main/native/include/support/atomic_static.h index 253c25b59f..27ec4b1657 100644 --- a/wpiutil/src/main/native/include/support/atomic_static.h +++ b/wpiutil/src/main/native/include/support/atomic_static.h @@ -7,10 +7,13 @@ #pragma once +// clang-format off #ifdef _MSC_VER #pragma message "warning: support/atomic_static.h is deprecated; include wpi/atomic_static.h instead" #else #warning "support/atomic_static.h is deprecated; include wpi/atomic_static.h instead" #endif +// clang-format on + #include "wpi/atomic_static.h" diff --git a/wpiutil/src/main/native/include/support/condition_variable.h b/wpiutil/src/main/native/include/support/condition_variable.h index 33fc32339f..434f79717f 100644 --- a/wpiutil/src/main/native/include/support/condition_variable.h +++ b/wpiutil/src/main/native/include/support/condition_variable.h @@ -7,10 +7,13 @@ #pragma once +// clang-format off #ifdef _MSC_VER #pragma message "warning: support/condition_variable.h is deprecated; include wpi/condition_variable.h instead" #else #warning "support/condition_variable.h is deprecated; include wpi/condition_variable.h instead" #endif +// clang-format on + #include "wpi/condition_variable.h" diff --git a/wpiutil/src/main/native/include/support/deprecated.h b/wpiutil/src/main/native/include/support/deprecated.h index ac3eb5141c..c130df42ba 100644 --- a/wpiutil/src/main/native/include/support/deprecated.h +++ b/wpiutil/src/main/native/include/support/deprecated.h @@ -7,10 +7,13 @@ #pragma once +// clang-format off #ifdef _MSC_VER #pragma message "warning: support/deprecated.h is deprecated; include wpi/deprecated.h instead" #else #warning "support/deprecated.h is deprecated; include wpi/deprecated.h instead" #endif +// clang-format on + #include "wpi/deprecated.h" diff --git a/wpiutil/src/main/native/include/support/hostname.h b/wpiutil/src/main/native/include/support/hostname.h index fd446207b4..33160a161e 100644 --- a/wpiutil/src/main/native/include/support/hostname.h +++ b/wpiutil/src/main/native/include/support/hostname.h @@ -7,10 +7,13 @@ #pragma once +// clang-format off #ifdef _MSC_VER #pragma message "warning: support/hostname.h is deprecated; include wpi/hostname.h instead" #else #warning "support/hostname.h is deprecated; include wpi/hostname.h instead" #endif +// clang-format on + #include "wpi/hostname.h" diff --git a/wpiutil/src/main/native/include/support/jni_util.h b/wpiutil/src/main/native/include/support/jni_util.h index b8804e0b5f..e5f8633b9a 100644 --- a/wpiutil/src/main/native/include/support/jni_util.h +++ b/wpiutil/src/main/native/include/support/jni_util.h @@ -7,10 +7,13 @@ #pragma once +// clang-format off #ifdef _MSC_VER #pragma message "warning: support/jni_util.h is deprecated; include wpi/jni_util.h instead" #else #warning "support/jni_util.h is deprecated; include wpi/jni_util.h instead" #endif +// clang-format on + #include "wpi/jni_util.h" diff --git a/wpiutil/src/main/native/include/support/json.h b/wpiutil/src/main/native/include/support/json.h index 22bf5314ce..e98f04f7f4 100644 --- a/wpiutil/src/main/native/include/support/json.h +++ b/wpiutil/src/main/native/include/support/json.h @@ -7,10 +7,13 @@ #pragma once +// clang-format off #ifdef _MSC_VER #pragma message "warning: support/json.h is deprecated; include wpi/json.h instead" #else #warning "support/json.h is deprecated; include wpi/json.h instead" #endif +// clang-format on + #include "wpi/json.h" diff --git a/wpiutil/src/main/native/include/support/leb128.h b/wpiutil/src/main/native/include/support/leb128.h index c9ed28e540..ccf04225b9 100644 --- a/wpiutil/src/main/native/include/support/leb128.h +++ b/wpiutil/src/main/native/include/support/leb128.h @@ -7,10 +7,13 @@ #pragma once +// clang-format off #ifdef _MSC_VER #pragma message "warning: support/leb128.h is deprecated; include wpi/leb128.h instead" #else #warning "support/leb128.h is deprecated; include wpi/leb128.h instead" #endif +// clang-format on + #include "wpi/leb128.h" diff --git a/wpiutil/src/main/native/include/support/mutex.h b/wpiutil/src/main/native/include/support/mutex.h index f9fff344cf..cd6118b7e6 100644 --- a/wpiutil/src/main/native/include/support/mutex.h +++ b/wpiutil/src/main/native/include/support/mutex.h @@ -7,10 +7,13 @@ #pragma once +// clang-format off #ifdef _MSC_VER #pragma message "warning: support/mutex.h is deprecated; include wpi/mutex.h instead" #else #warning "support/mutex.h is deprecated; include wpi/mutex.h instead" #endif +// clang-format on + #include "wpi/mutex.h" diff --git a/wpiutil/src/main/native/include/support/priority_condition_variable.h b/wpiutil/src/main/native/include/support/priority_condition_variable.h index 760f0c0204..017f7456e4 100644 --- a/wpiutil/src/main/native/include/support/priority_condition_variable.h +++ b/wpiutil/src/main/native/include/support/priority_condition_variable.h @@ -7,10 +7,13 @@ #pragma once +// clang-format off #ifdef _MSC_VER #pragma message "warning: support/priority_condition_variable.h is deprecated; include wpi/priority_condition_variable.h instead" #else #warning "support/priority_condition_variable.h is deprecated; include wpi/priority_condition_variable.h instead" #endif +// clang-format on + #include "wpi/priority_condition_variable.h" diff --git a/wpiutil/src/main/native/include/support/priority_mutex.h b/wpiutil/src/main/native/include/support/priority_mutex.h index 230bc3c051..6b86e028e5 100644 --- a/wpiutil/src/main/native/include/support/priority_mutex.h +++ b/wpiutil/src/main/native/include/support/priority_mutex.h @@ -7,10 +7,13 @@ #pragma once +// clang-format off #ifdef _MSC_VER #pragma message "warning: support/priority_mutex.h is deprecated; include wpi/priority_mutex.h instead" #else #warning "support/priority_mutex.h is deprecated; include wpi/priority_mutex.h instead" #endif +// clang-format on + #include "wpi/priority_mutex.h" diff --git a/wpiutil/src/main/native/include/support/raw_istream.h b/wpiutil/src/main/native/include/support/raw_istream.h index 9f7ed5bd04..9451bafb32 100644 --- a/wpiutil/src/main/native/include/support/raw_istream.h +++ b/wpiutil/src/main/native/include/support/raw_istream.h @@ -7,10 +7,13 @@ #pragma once +// clang-format off #ifdef _MSC_VER #pragma message "warning: support/raw_istream.h is deprecated; include wpi/raw_istream.h instead" #else #warning "support/raw_istream.h is deprecated; include wpi/raw_istream.h instead" #endif +// clang-format on + #include "wpi/raw_istream.h" diff --git a/wpiutil/src/main/native/include/support/raw_socket_istream.h b/wpiutil/src/main/native/include/support/raw_socket_istream.h index 46fa608762..bf8ca02d5d 100644 --- a/wpiutil/src/main/native/include/support/raw_socket_istream.h +++ b/wpiutil/src/main/native/include/support/raw_socket_istream.h @@ -7,10 +7,13 @@ #pragma once +// clang-format off #ifdef _MSC_VER #pragma message "warning: support/raw_socket_istream.h is deprecated; include wpi/raw_socket_istream.h instead" #else #warning "support/raw_socket_istream.h is deprecated; include wpi/raw_socket_istream.h instead" #endif +// clang-format on + #include "wpi/raw_socket_istream.h" diff --git a/wpiutil/src/main/native/include/support/raw_socket_ostream.h b/wpiutil/src/main/native/include/support/raw_socket_ostream.h index 14e9809f8a..4070d555cb 100644 --- a/wpiutil/src/main/native/include/support/raw_socket_ostream.h +++ b/wpiutil/src/main/native/include/support/raw_socket_ostream.h @@ -7,10 +7,13 @@ #pragma once +// clang-format off #ifdef _MSC_VER #pragma message "warning: support/raw_socket_ostream.h is deprecated; include wpi/raw_socket_ostream.h instead" #else #warning "support/raw_socket_ostream.h is deprecated; include wpi/raw_socket_ostream.h instead" #endif +// clang-format on + #include "wpi/raw_socket_ostream.h" diff --git a/wpiutil/src/main/native/include/support/sha1.h b/wpiutil/src/main/native/include/support/sha1.h index 65c84f75bc..b755a4e464 100644 --- a/wpiutil/src/main/native/include/support/sha1.h +++ b/wpiutil/src/main/native/include/support/sha1.h @@ -7,10 +7,13 @@ #pragma once +// clang-format off #ifdef _MSC_VER #pragma message "warning: support/sha1.h is deprecated; include wpi/sha1.h instead" #else #warning "support/sha1.h is deprecated; include wpi/sha1.h instead" #endif +// clang-format on + #include "wpi/sha1.h" diff --git a/wpiutil/src/main/native/include/support/timestamp.h b/wpiutil/src/main/native/include/support/timestamp.h index aff3745945..0ae505a9bf 100644 --- a/wpiutil/src/main/native/include/support/timestamp.h +++ b/wpiutil/src/main/native/include/support/timestamp.h @@ -7,10 +7,13 @@ #pragma once +// clang-format off #ifdef _MSC_VER #pragma message "warning: support/timestamp.h is deprecated; include wpi/timestamp.h instead" #else #warning "support/timestamp.h is deprecated; include wpi/timestamp.h instead" #endif +// clang-format on + #include "wpi/timestamp.h" diff --git a/wpiutil/src/main/native/include/tcpsockets/NetworkAcceptor.h b/wpiutil/src/main/native/include/tcpsockets/NetworkAcceptor.h index 4976c3f5f2..8a87f7bb92 100644 --- a/wpiutil/src/main/native/include/tcpsockets/NetworkAcceptor.h +++ b/wpiutil/src/main/native/include/tcpsockets/NetworkAcceptor.h @@ -7,10 +7,13 @@ #pragma once +// clang-format off #ifdef _MSC_VER #pragma message "warning: tcpsockets/NetworkAcceptor.h is deprecated; include wpi/NetworkAcceptor.h instead" #else #warning "tcpsockets/NetworkAcceptor.h is deprecated; include wpi/NetworkAcceptor.h instead" #endif +// clang-format on + #include "wpi/NetworkAcceptor.h" diff --git a/wpiutil/src/main/native/include/tcpsockets/NetworkStream.h b/wpiutil/src/main/native/include/tcpsockets/NetworkStream.h index d840e6be26..3e9d306ab7 100644 --- a/wpiutil/src/main/native/include/tcpsockets/NetworkStream.h +++ b/wpiutil/src/main/native/include/tcpsockets/NetworkStream.h @@ -7,10 +7,13 @@ #pragma once +// clang-format off #ifdef _MSC_VER #pragma message "warning: tcpsockets/NetworkStream.h is deprecated; include wpi/NetworkStream.h instead" #else #warning "tcpsockets/NetworkStream.h is deprecated; include wpi/NetworkStream.h instead" #endif +// clang-format on + #include "wpi/NetworkStream.h" diff --git a/wpiutil/src/main/native/include/tcpsockets/SocketError.h b/wpiutil/src/main/native/include/tcpsockets/SocketError.h index 3a317bdf0c..0ffe322232 100644 --- a/wpiutil/src/main/native/include/tcpsockets/SocketError.h +++ b/wpiutil/src/main/native/include/tcpsockets/SocketError.h @@ -7,10 +7,13 @@ #pragma once +// clang-format off #ifdef _MSC_VER #pragma message "warning: tcpsockets/SocketError.h is deprecated; include wpi/SocketError.h instead" #else #warning "tcpsockets/SocketError.h is deprecated; include wpi/SocketError.h instead" #endif +// clang-format on + #include "wpi/SocketError.h" diff --git a/wpiutil/src/main/native/include/tcpsockets/TCPAcceptor.h b/wpiutil/src/main/native/include/tcpsockets/TCPAcceptor.h index 65a3c1ab7b..4544e04897 100644 --- a/wpiutil/src/main/native/include/tcpsockets/TCPAcceptor.h +++ b/wpiutil/src/main/native/include/tcpsockets/TCPAcceptor.h @@ -7,10 +7,13 @@ #pragma once +// clang-format off #ifdef _MSC_VER #pragma message "warning: tcpsockets/TCPAcceptor.h is deprecated; include wpi/TCPAcceptor.h instead" #else #warning "tcpsockets/TCPAcceptor.h is deprecated; include wpi/TCPAcceptor.h instead" #endif +// clang-format on + #include "wpi/TCPAcceptor.h" diff --git a/wpiutil/src/main/native/include/tcpsockets/TCPConnector.h b/wpiutil/src/main/native/include/tcpsockets/TCPConnector.h index 28402577de..a988872b95 100644 --- a/wpiutil/src/main/native/include/tcpsockets/TCPConnector.h +++ b/wpiutil/src/main/native/include/tcpsockets/TCPConnector.h @@ -7,10 +7,13 @@ #pragma once +// clang-format off #ifdef _MSC_VER #pragma message "warning: tcpsockets/TCPConnector.h is deprecated; include wpi/TCPConnector.h instead" #else #warning "tcpsockets/TCPConnector.h is deprecated; include wpi/TCPConnector.h instead" #endif +// clang-format on + #include "wpi/TCPConnector.h" diff --git a/wpiutil/src/main/native/include/tcpsockets/TCPStream.h b/wpiutil/src/main/native/include/tcpsockets/TCPStream.h index 5c7a1be9a3..74af7fad00 100644 --- a/wpiutil/src/main/native/include/tcpsockets/TCPStream.h +++ b/wpiutil/src/main/native/include/tcpsockets/TCPStream.h @@ -7,10 +7,13 @@ #pragma once +// clang-format off #ifdef _MSC_VER #pragma message "warning: tcpsockets/TCPStream.h is deprecated; include wpi/TCPStream.h instead" #else #warning "tcpsockets/TCPStream.h is deprecated; include wpi/TCPStream.h instead" #endif +// clang-format on + #include "wpi/TCPStream.h" diff --git a/wpiutil/src/main/native/include/udpsockets/UDPClient.h b/wpiutil/src/main/native/include/udpsockets/UDPClient.h index b25b2aab92..c70a13b7f5 100644 --- a/wpiutil/src/main/native/include/udpsockets/UDPClient.h +++ b/wpiutil/src/main/native/include/udpsockets/UDPClient.h @@ -7,10 +7,13 @@ #pragma once +// clang-format off #ifdef _MSC_VER #pragma message "warning: udpsockets/UDPClient.h is deprecated; include wpi/UDPClient.h instead" #else #warning "udpsockets/UDPClient.h is deprecated; include wpi/UDPClient.h instead" #endif +// clang-format on + #include "wpi/UDPClient.h" diff --git a/wpiutil/src/main/native/include/wpi/Base64.h b/wpiutil/src/main/native/include/wpi/Base64.h index 6d855138d5..cdbf611416 100644 --- a/wpiutil/src/main/native/include/wpi/Base64.h +++ b/wpiutil/src/main/native/include/wpi/Base64.h @@ -5,8 +5,8 @@ /* the project. */ /*----------------------------------------------------------------------------*/ -#ifndef WPIUTIL_SUPPORT_BASE64_H_ -#define WPIUTIL_SUPPORT_BASE64_H_ +#ifndef WPIUTIL_WPI_BASE64_H_ +#define WPIUTIL_WPI_BASE64_H_ #include #include @@ -33,4 +33,4 @@ StringRef Base64Encode(StringRef plain, SmallVectorImpl& buf); } // namespace wpi -#endif // WPIUTIL_SUPPORT_BASE64_H_ +#endif // WPIUTIL_WPI_BASE64_H_ diff --git a/wpiutil/src/main/native/include/wpi/ConcurrentQueue.h b/wpiutil/src/main/native/include/wpi/ConcurrentQueue.h index f1ea5efef1..ff47d60b68 100644 --- a/wpiutil/src/main/native/include/wpi/ConcurrentQueue.h +++ b/wpiutil/src/main/native/include/wpi/ConcurrentQueue.h @@ -4,8 +4,8 @@ // - see < http://opensource.org/licenses/BSD-2-Clause> // -#ifndef WPIUTIL_SUPPORT_CONCURRENTQUEUE_H_ -#define WPIUTIL_SUPPORT_CONCURRENTQUEUE_H_ +#ifndef WPIUTIL_WPI_CONCURRENTQUEUE_H_ +#define WPIUTIL_WPI_CONCURRENTQUEUE_H_ #include #include @@ -82,4 +82,4 @@ class ConcurrentQueue { } // namespace wpi -#endif // WPIUTIL_SUPPORT_CONCURRENTQUEUE_H_ +#endif // WPIUTIL_WPI_CONCURRENTQUEUE_H_ diff --git a/wpiutil/src/main/native/include/wpi/HttpUtil.h b/wpiutil/src/main/native/include/wpi/HttpUtil.h index 250684f5b8..50987054aa 100644 --- a/wpiutil/src/main/native/include/wpi/HttpUtil.h +++ b/wpiutil/src/main/native/include/wpi/HttpUtil.h @@ -5,8 +5,8 @@ /* the project. */ /*----------------------------------------------------------------------------*/ -#ifndef WPIUTIL_SUPPORT_HTTPUTIL_H_ -#define WPIUTIL_SUPPORT_HTTPUTIL_H_ +#ifndef WPIUTIL_WPI_HTTPUTIL_H_ +#define WPIUTIL_WPI_HTTPUTIL_H_ #include #include @@ -145,4 +145,4 @@ class HttpConnection { #include "HttpUtil.inl" -#endif // WPIUTIL_SUPPORT_HTTPUTIL_H_ +#endif // WPIUTIL_WPI_HTTPUTIL_H_ diff --git a/wpiutil/src/main/native/include/wpi/Logger.h b/wpiutil/src/main/native/include/wpi/Logger.h index 3002c2f5e1..8b08acac3f 100644 --- a/wpiutil/src/main/native/include/wpi/Logger.h +++ b/wpiutil/src/main/native/include/wpi/Logger.h @@ -5,8 +5,8 @@ /* the project. */ /*----------------------------------------------------------------------------*/ -#ifndef WPIUTIL_SUPPORT_LOGGER_H_ -#define WPIUTIL_SUPPORT_LOGGER_H_ +#ifndef WPIUTIL_WPI_LOGGER_H_ +#define WPIUTIL_WPI_LOGGER_H_ #include @@ -97,4 +97,4 @@ class Logger { } // namespace wpi -#endif // WPIUTIL_SUPPORT_LOGGER_H_ +#endif // WPIUTIL_WPI_LOGGER_H_ diff --git a/wpiutil/src/main/native/include/wpi/NetworkAcceptor.h b/wpiutil/src/main/native/include/wpi/NetworkAcceptor.h index 128aa5e78e..dd09e2d42f 100644 --- a/wpiutil/src/main/native/include/wpi/NetworkAcceptor.h +++ b/wpiutil/src/main/native/include/wpi/NetworkAcceptor.h @@ -5,8 +5,8 @@ /* the project. */ /*----------------------------------------------------------------------------*/ -#ifndef WPIUTIL_TCPSOCKETS_NETWORKACCEPTOR_H_ -#define WPIUTIL_TCPSOCKETS_NETWORKACCEPTOR_H_ +#ifndef WPIUTIL_WPI_NETWORKACCEPTOR_H_ +#define WPIUTIL_WPI_NETWORKACCEPTOR_H_ #include @@ -29,4 +29,4 @@ class NetworkAcceptor { } // namespace wpi -#endif // WPIUTIL_TCPSOCKETS_NETWORKACCEPTOR_H_ +#endif // WPIUTIL_WPI_NETWORKACCEPTOR_H_ diff --git a/wpiutil/src/main/native/include/wpi/NetworkStream.h b/wpiutil/src/main/native/include/wpi/NetworkStream.h index 0b8b23d949..1177167170 100644 --- a/wpiutil/src/main/native/include/wpi/NetworkStream.h +++ b/wpiutil/src/main/native/include/wpi/NetworkStream.h @@ -5,8 +5,8 @@ /* the project. */ /*----------------------------------------------------------------------------*/ -#ifndef WPIUTIL_TCPSOCKETS_NETWORKSTREAM_H_ -#define WPIUTIL_TCPSOCKETS_NETWORKSTREAM_H_ +#ifndef WPIUTIL_WPI_NETWORKSTREAM_H_ +#define WPIUTIL_WPI_NETWORKSTREAM_H_ #include @@ -45,4 +45,4 @@ class NetworkStream { } // namespace wpi -#endif // WPIUTIL_TCPSOCKETS_NETWORKSTREAM_H_ +#endif // WPIUTIL_WPI_NETWORKSTREAM_H_ diff --git a/wpiutil/src/main/native/include/wpi/Path.h b/wpiutil/src/main/native/include/wpi/Path.h index 5f392354d1..12ee92f654 100644 --- a/wpiutil/src/main/native/include/wpi/Path.h +++ b/wpiutil/src/main/native/include/wpi/Path.h @@ -13,14 +13,15 @@ // //===----------------------------------------------------------------------===// -#ifndef LLVM_SUPPORT_PATH_H -#define LLVM_SUPPORT_PATH_H - -#include "wpi/Twine.h" -#include +#ifndef WPIUTIL_WPI_PATH_H_ +#define WPIUTIL_WPI_PATH_H_ #include +#include + +#include "wpi/Twine.h" + namespace wpi { namespace sys { namespace path { @@ -51,7 +52,7 @@ class const_iterator : public std::iterator { StringRef Path; ///< The entire path. StringRef Component; ///< The current component. Not necessarily in Path. - size_t Position; ///< The iterators current position within Path. + size_t Position; ///< The iterators current position within Path. // An end iterator has Position = Path.size() + 1. friend const_iterator begin(StringRef path); @@ -60,7 +61,7 @@ class const_iterator public: reference operator*() const { return Component; } pointer operator->() const { return &Component; } - const_iterator &operator++(); // preincrement + const_iterator& operator++(); // preincrement bool operator==(const const_iterator &RHS) const; bool operator!=(const const_iterator &RHS) const { return !(*this == RHS); } @@ -77,7 +78,7 @@ class reverse_iterator : public std::iterator { StringRef Path; ///< The entire path. StringRef Component; ///< The current component. Not necessarily in Path. - size_t Position; ///< The iterators current position within Path. + size_t Position; ///< The iterators current position within Path. friend reverse_iterator rbegin(StringRef path); friend reverse_iterator rend(StringRef path); @@ -85,7 +86,7 @@ class reverse_iterator public: reference operator*() const { return Component; } pointer operator->() const { return &Component; } - reverse_iterator &operator++(); // preincrement + reverse_iterator& operator++(); // preincrement bool operator==(const reverse_iterator &RHS) const; bool operator!=(const reverse_iterator &RHS) const { return !(*this == RHS); } @@ -450,8 +451,8 @@ StringRef remove_leading_dotslash(StringRef path); /// @result True if path was changed bool remove_dots(SmallVectorImpl &path, bool remove_dot_dot = false); -} // end namespace path -} // end namespace sys -} // end namespace wpi +} // namespace path +} // namespace sys +} // namespace wpi -#endif +#endif // WPIUTIL_WPI_PATH_H_ diff --git a/wpiutil/src/main/native/include/wpi/SafeThread.h b/wpiutil/src/main/native/include/wpi/SafeThread.h index d1faa3dbb5..ff5d44c523 100644 --- a/wpiutil/src/main/native/include/wpi/SafeThread.h +++ b/wpiutil/src/main/native/include/wpi/SafeThread.h @@ -5,8 +5,8 @@ /* the project. */ /*----------------------------------------------------------------------------*/ -#ifndef WPIUTIL_SUPPORT_SAFETHREAD_H_ -#define WPIUTIL_SUPPORT_SAFETHREAD_H_ +#ifndef WPIUTIL_WPI_SAFETHREAD_H_ +#define WPIUTIL_WPI_SAFETHREAD_H_ #include #include @@ -130,4 +130,4 @@ class SafeThreadOwner : public detail::SafeThreadOwnerBase { } // namespace wpi -#endif // WPIUTIL_SUPPORT_SAFETHREAD_H_ +#endif // WPIUTIL_WPI_SAFETHREAD_H_ diff --git a/wpiutil/src/main/native/include/wpi/SocketError.h b/wpiutil/src/main/native/include/wpi/SocketError.h index c811dc95c6..d5f3ff0fb2 100644 --- a/wpiutil/src/main/native/include/wpi/SocketError.h +++ b/wpiutil/src/main/native/include/wpi/SocketError.h @@ -5,8 +5,8 @@ /* the project. */ /*----------------------------------------------------------------------------*/ -#ifndef WPIUTIL_TCPSOCKETS_SOCKETERROR_H_ -#define WPIUTIL_TCPSOCKETS_SOCKETERROR_H_ +#ifndef WPIUTIL_WPI_SOCKETERROR_H_ +#define WPIUTIL_WPI_SOCKETERROR_H_ #include @@ -22,4 +22,4 @@ static inline std::string SocketStrerror() { } // namespace wpi -#endif // WPIUTIL_TCPSOCKETS_SOCKETERROR_H_ +#endif // WPIUTIL_WPI_SOCKETERROR_H_ diff --git a/wpiutil/src/main/native/include/wpi/TCPAcceptor.h b/wpiutil/src/main/native/include/wpi/TCPAcceptor.h index bd1526d4c5..da82a8a309 100644 --- a/wpiutil/src/main/native/include/wpi/TCPAcceptor.h +++ b/wpiutil/src/main/native/include/wpi/TCPAcceptor.h @@ -21,8 +21,8 @@ limitations under the License. */ -#ifndef WPIUTIL_TCPSOCKETS_TCPACCEPTOR_H_ -#define WPIUTIL_TCPSOCKETS_TCPACCEPTOR_H_ +#ifndef WPIUTIL_WPI_TCPACCEPTOR_H_ +#define WPIUTIL_WPI_TCPACCEPTOR_H_ #include #include @@ -54,4 +54,4 @@ class TCPAcceptor : public NetworkAcceptor { } // namespace wpi -#endif // WPIUTIL_TCPSOCKETS_TCPACCEPTOR_H_ +#endif // WPIUTIL_WPI_TCPACCEPTOR_H_ diff --git a/wpiutil/src/main/native/include/wpi/TCPConnector.h b/wpiutil/src/main/native/include/wpi/TCPConnector.h index d383306a30..a05342ba39 100644 --- a/wpiutil/src/main/native/include/wpi/TCPConnector.h +++ b/wpiutil/src/main/native/include/wpi/TCPConnector.h @@ -21,8 +21,8 @@ limitations under the License */ -#ifndef WPIUTIL_TCPSOCKETS_TCPCONNECTOR_H_ -#define WPIUTIL_TCPSOCKETS_TCPCONNECTOR_H_ +#ifndef WPIUTIL_WPI_TCPCONNECTOR_H_ +#define WPIUTIL_WPI_TCPCONNECTOR_H_ #include #include @@ -46,4 +46,4 @@ class TCPConnector { } // namespace wpi -#endif // WPIUTIL_TCPSOCKETS_TCPCONNECTOR_H_ +#endif // WPIUTIL_WPI_TCPCONNECTOR_H_ diff --git a/wpiutil/src/main/native/include/wpi/TCPStream.h b/wpiutil/src/main/native/include/wpi/TCPStream.h index e40cca8913..6a38ffb411 100644 --- a/wpiutil/src/main/native/include/wpi/TCPStream.h +++ b/wpiutil/src/main/native/include/wpi/TCPStream.h @@ -21,8 +21,8 @@ limitations under the License. */ -#ifndef WPIUTIL_TCPSOCKETS_TCPSTREAM_H_ -#define WPIUTIL_TCPSOCKETS_TCPSTREAM_H_ +#ifndef WPIUTIL_WPI_TCPSTREAM_H_ +#define WPIUTIL_WPI_TCPSTREAM_H_ #include #include @@ -68,4 +68,4 @@ class TCPStream : public NetworkStream { } // namespace wpi -#endif // WPIUTIL_TCPSOCKETS_TCPSTREAM_H_ +#endif // WPIUTIL_WPI_TCPSTREAM_H_ diff --git a/wpiutil/src/main/native/include/wpi/UDPClient.h b/wpiutil/src/main/native/include/wpi/UDPClient.h index 5329ac7214..5b4e988093 100644 --- a/wpiutil/src/main/native/include/wpi/UDPClient.h +++ b/wpiutil/src/main/native/include/wpi/UDPClient.h @@ -5,8 +5,8 @@ /* the project. */ /*----------------------------------------------------------------------------*/ -#ifndef WPIUTIL_UDPSOCKETS_UDPCLIENT_H_ -#define WPIUTIL_UDPSOCKETS_UDPCLIENT_H_ +#ifndef WPIUTIL_WPI_UDPCLIENT_H_ +#define WPIUTIL_WPI_UDPCLIENT_H_ #include @@ -42,4 +42,4 @@ class UDPClient { } // namespace wpi -#endif // WPIUTIL_UDPSOCKETS_UDPCLIENT_H_ +#endif // WPIUTIL_WPI_UDPCLIENT_H_ diff --git a/wpiutil/src/main/native/include/wpi/UidVector.h b/wpiutil/src/main/native/include/wpi/UidVector.h index 3307086133..cf635094e3 100644 --- a/wpiutil/src/main/native/include/wpi/UidVector.h +++ b/wpiutil/src/main/native/include/wpi/UidVector.h @@ -5,8 +5,8 @@ /* the project. */ /*----------------------------------------------------------------------------*/ -#ifndef WPIUTIL_SUPPORT_UIDVECTOR_H_ -#define WPIUTIL_SUPPORT_UIDVECTOR_H_ +#ifndef WPIUTIL_WPI_UIDVECTOR_H_ +#define WPIUTIL_WPI_UIDVECTOR_H_ #include #include @@ -64,4 +64,4 @@ class UidVector { } // namespace wpi -#endif // WPIUTIL_SUPPORT_UIDVECTOR_H_ +#endif // WPIUTIL_WPI_UIDVECTOR_H_ diff --git a/wpiutil/src/main/native/include/wpi/deprecated.h b/wpiutil/src/main/native/include/wpi/deprecated.h index 58209f4fcd..51f2163c53 100644 --- a/wpiutil/src/main/native/include/wpi/deprecated.h +++ b/wpiutil/src/main/native/include/wpi/deprecated.h @@ -5,8 +5,8 @@ /* the project. */ /*----------------------------------------------------------------------------*/ -#ifndef WPIUTIL_SUPPORT_DEPRECATED_H_ -#define WPIUTIL_SUPPORT_DEPRECATED_H_ +#ifndef WPIUTIL_WPI_DEPRECATED_H_ +#define WPIUTIL_WPI_DEPRECATED_H_ // [[deprecated(msg)]] is a C++14 feature not supported by MSVC or GCC < 4.9. // We provide an equivalent warning implementation for those compilers here. @@ -30,4 +30,4 @@ #endif #endif -#endif // WPIUTIL_SUPPORT_DEPRECATED_H_ +#endif // WPIUTIL_WPI_DEPRECATED_H_ diff --git a/wpiutil/src/main/native/include/wpi/hostname.h b/wpiutil/src/main/native/include/wpi/hostname.h index 5da983b70c..b2f9f0c55b 100644 --- a/wpiutil/src/main/native/include/wpi/hostname.h +++ b/wpiutil/src/main/native/include/wpi/hostname.h @@ -5,8 +5,8 @@ /* the project. */ /*----------------------------------------------------------------------------*/ -#ifndef WPIUTIL_SUPPORT_HOSTNAME_H_ -#define WPIUTIL_SUPPORT_HOSTNAME_H_ +#ifndef WPIUTIL_WPI_HOSTNAME_H_ +#define WPIUTIL_WPI_HOSTNAME_H_ #include @@ -20,4 +20,4 @@ std::string GetHostname(); StringRef GetHostname(SmallVectorImpl& name); } // namespace wpi -#endif // WPIUTIL_SUPPORT_HOSTNAME_H_ +#endif // WPIUTIL_WPI_HOSTNAME_H_ diff --git a/wpiutil/src/main/native/include/wpi/jni_util.h b/wpiutil/src/main/native/include/wpi/jni_util.h index 2effd1d932..e86011bb63 100644 --- a/wpiutil/src/main/native/include/wpi/jni_util.h +++ b/wpiutil/src/main/native/include/wpi/jni_util.h @@ -5,8 +5,8 @@ /* the project. */ /*----------------------------------------------------------------------------*/ -#ifndef WPIUTIL_SUPPORT_JNI_UTIL_H_ -#define WPIUTIL_SUPPORT_JNI_UTIL_H_ +#ifndef WPIUTIL_WPI_JNI_UTIL_H_ +#define WPIUTIL_WPI_JNI_UTIL_H_ #include @@ -44,8 +44,6 @@ std::string GetJavaStackTrace(JNIEnv* env, std::string* func) { excludeFuncPrefix == nullptr ? StringRef() : excludeFuncPrefix); } - - // Finds a class and keep it as a global reference. // Use with caution, as the destructor does NOT call DeleteGlobalRef due // to potential shutdown issues with doing so. @@ -73,7 +71,7 @@ class JClass { jclass m_cls = nullptr; }; -template +template class JGlobal { public: JGlobal() = default; @@ -393,7 +391,7 @@ inline jbooleanArray MakeJBooleanArray(JNIEnv* env, ArrayRef arr) { return jarr; } -// Other MakeJ*Array conversions. + // Other MakeJ*Array conversions. #define WPI_JNI_MAKEJARRAY(T, F) \ inline T##Array MakeJ##F##Array(JNIEnv* env, ArrayRef arr) { \ @@ -623,4 +621,4 @@ class JException : public JClass { } // namespace java } // namespace wpi -#endif // WPIUTIL_SUPPORT_JNI_UTIL_H_ +#endif // WPIUTIL_WPI_JNI_UTIL_H_ diff --git a/wpiutil/src/main/native/include/wpi/leb128.h b/wpiutil/src/main/native/include/wpi/leb128.h index d9498a6b12..4f938519f4 100644 --- a/wpiutil/src/main/native/include/wpi/leb128.h +++ b/wpiutil/src/main/native/include/wpi/leb128.h @@ -5,8 +5,8 @@ /* the project. */ /*----------------------------------------------------------------------------*/ -#ifndef WPIUTIL_SUPPORT_LEB128_H_ -#define WPIUTIL_SUPPORT_LEB128_H_ +#ifndef WPIUTIL_WPI_LEB128_H_ +#define WPIUTIL_WPI_LEB128_H_ #include @@ -23,4 +23,4 @@ bool ReadUleb128(raw_istream& is, uint64_t* ret); } // namespace wpi -#endif // WPIUTIL_SUPPORT_LEB128_H_ +#endif // WPIUTIL_WPI_LEB128_H_ diff --git a/wpiutil/src/main/native/include/wpi/memory.h b/wpiutil/src/main/native/include/wpi/memory.h index de7e933dcf..389a8a8c96 100644 --- a/wpiutil/src/main/native/include/wpi/memory.h +++ b/wpiutil/src/main/native/include/wpi/memory.h @@ -5,8 +5,8 @@ /* the project. */ /*----------------------------------------------------------------------------*/ -#ifndef WPIUTIL_SUPPORT_MEMORY_H_ -#define WPIUTIL_SUPPORT_MEMORY_H_ +#ifndef WPIUTIL_WPI_MEMORY_H_ +#define WPIUTIL_WPI_MEMORY_H_ #include #include @@ -61,4 +61,4 @@ inline void* CheckedRealloc(void* ptr, size_t size) { } // namespace wpi -#endif // WPIUTIL_SUPPORT_MEMORY_H_ +#endif // WPIUTIL_WPI_MEMORY_H_ diff --git a/wpiutil/src/main/native/include/wpi/raw_istream.h b/wpiutil/src/main/native/include/wpi/raw_istream.h index 3e4353732b..2db724de6f 100644 --- a/wpiutil/src/main/native/include/wpi/raw_istream.h +++ b/wpiutil/src/main/native/include/wpi/raw_istream.h @@ -5,8 +5,8 @@ /* the project. */ /*----------------------------------------------------------------------------*/ -#ifndef WPIUTIL_SUPPORT_RAW_ISTREAM_H_ -#define WPIUTIL_SUPPORT_RAW_ISTREAM_H_ +#ifndef WPIUTIL_WPI_RAW_ISTREAM_H_ +#define WPIUTIL_WPI_RAW_ISTREAM_H_ #include #include @@ -112,4 +112,4 @@ class raw_fd_istream : public raw_istream { } // namespace wpi -#endif // WPIUTIL_SUPPORT_RAW_ISTREAM_H_ +#endif // WPIUTIL_WPI_RAW_ISTREAM_H_ diff --git a/wpiutil/src/main/native/include/wpi/raw_socket_istream.h b/wpiutil/src/main/native/include/wpi/raw_socket_istream.h index 8bd4e3b344..4ff8022d6b 100644 --- a/wpiutil/src/main/native/include/wpi/raw_socket_istream.h +++ b/wpiutil/src/main/native/include/wpi/raw_socket_istream.h @@ -5,8 +5,8 @@ /* the project. */ /*----------------------------------------------------------------------------*/ -#ifndef WPIUTIL_SUPPORT_RAW_SOCKET_ISTREAM_H_ -#define WPIUTIL_SUPPORT_RAW_SOCKET_ISTREAM_H_ +#ifndef WPIUTIL_WPI_RAW_SOCKET_ISTREAM_H_ +#define WPIUTIL_WPI_RAW_SOCKET_ISTREAM_H_ #include "wpi/raw_istream.h" @@ -31,4 +31,4 @@ class raw_socket_istream : public raw_istream { } // namespace wpi -#endif // WPIUTIL_SUPPORT_RAW_SOCKET_ISTREAM_H_ +#endif // WPIUTIL_WPI_RAW_SOCKET_ISTREAM_H_ diff --git a/wpiutil/src/main/native/include/wpi/raw_socket_ostream.h b/wpiutil/src/main/native/include/wpi/raw_socket_ostream.h index 977ba9bf0a..151af46a56 100644 --- a/wpiutil/src/main/native/include/wpi/raw_socket_ostream.h +++ b/wpiutil/src/main/native/include/wpi/raw_socket_ostream.h @@ -5,8 +5,8 @@ /* the project. */ /*----------------------------------------------------------------------------*/ -#ifndef WPIUTIL_SUPPORT_RAW_SOCKET_OSTREAM_H_ -#define WPIUTIL_SUPPORT_RAW_SOCKET_OSTREAM_H_ +#ifndef WPIUTIL_WPI_RAW_SOCKET_OSTREAM_H_ +#define WPIUTIL_WPI_RAW_SOCKET_OSTREAM_H_ #include "wpi/raw_ostream.h" @@ -39,4 +39,4 @@ class raw_socket_ostream : public raw_ostream { } // namespace wpi -#endif // WPIUTIL_SUPPORT_RAW_SOCKET_OSTREAM_H_ +#endif // WPIUTIL_WPI_RAW_SOCKET_OSTREAM_H_ diff --git a/wpiutil/src/main/native/include/wpi/sha1.h b/wpiutil/src/main/native/include/wpi/sha1.h index 8a883b5aac..0ec43f7cc9 100644 --- a/wpiutil/src/main/native/include/wpi/sha1.h +++ b/wpiutil/src/main/native/include/wpi/sha1.h @@ -17,8 +17,8 @@ -- Eugene Hopkinson */ -#ifndef WPIUTIL_SUPPORT_SHA1_H_ -#define WPIUTIL_SUPPORT_SHA1_H_ +#ifndef WPIUTIL_WPI_SHA1_H_ +#define WPIUTIL_WPI_SHA1_H_ #include @@ -49,4 +49,4 @@ class SHA1 { } // namespace wpi -#endif // WPIUTIL_SUPPORT_SHA1_H_ +#endif // WPIUTIL_WPI_SHA1_H_ diff --git a/wpiutil/src/main/native/include/wpi/timestamp.h b/wpiutil/src/main/native/include/wpi/timestamp.h index c1f833a6f5..aefcd56b58 100644 --- a/wpiutil/src/main/native/include/wpi/timestamp.h +++ b/wpiutil/src/main/native/include/wpi/timestamp.h @@ -5,8 +5,8 @@ /* the project. */ /*----------------------------------------------------------------------------*/ -#ifndef WPIUTIL_SUPPORT_TIMESTAMP_H_ -#define WPIUTIL_SUPPORT_TIMESTAMP_H_ +#ifndef WPIUTIL_WPI_TIMESTAMP_H_ +#define WPIUTIL_WPI_TIMESTAMP_H_ #include @@ -68,4 +68,4 @@ uint64_t Now(void); } // namespace wpi #endif -#endif // WPIUTIL_SUPPORT_TIMESTAMP_H_ +#endif // WPIUTIL_WPI_TIMESTAMP_H_