RobotCore
1.0
WPILib port to raspberry Pi
Toggle main menu visibility
Loading...
Searching...
No Matches
HAL.java
1
// TODO - RobotCore - Modified file
2
3
// Copyright (c) FIRST and other WPILib contributors.
4
// Open Source Software; you can modify and/or share it under the terms of
5
// the WPILib BSD license file in the root directory of this project.
6
7
package
org.wpilib.hardware.hal;
8
9
import
robotCore.RobotCore;
10
11
// import java.util.ArrayList;
12
// import java.util.List;
13
20
public
final
class
HAL
{
21
public
static
boolean
initialize() {
22
// System.out.println("HAL.initialize()");
23
// throw new UnsupportedOperationException("Unimplemented method 'initialize'");
24
return
true
;
// TODO - must review;
25
}
26
27
public
static
void
reportUsage(String resource, String data) {
28
// System.out.println(String.format("HAL.reportUsage(%s,%s)", resource, data));
29
// throw new UnsupportedOperationException("Unimplemented method 'reportUsage'");
30
// TODO - Must review
31
}
32
33
public
static
int
publishWpilibVersion(String version) {
34
// System.out.println(String.format("publishWpilibVersion(%s)", version));
35
// throw new UnsupportedOperationException("Unimplemented method 'publishWpilibVersion'");
36
return
0;
// TODO - Must review
37
}
38
39
public
static
boolean
hasMain() {
40
// System.out.println("hasMain");
41
// throw new UnsupportedOperationException("Unimplemented method 'hasMain'");
42
return
true
;
// TODO - Must review;
43
}
44
45
public
static
void
exitMain() {
46
throw
new
UnsupportedOperationException(
"Unimplemented method 'exitMain'"
);
47
// TODO - Must fix
48
}
49
50
public
static
void
runMain() {
51
// System.out.println("runMain");
52
// throw new UnsupportedOperationException("Unimplemented method 'runMain'");
53
// TODO - Must review
54
while
(
true
) { RobotCore.sleep(1000); }
55
}
56
57
public
static
void
terminate() {
58
throw
new
UnsupportedOperationException(
"Unimplemented method 'terminate'"
);
59
// TODO - Must fix
60
}
61
62
public
static
void
shutdown() {
63
throw
new
UnsupportedOperationException(
"Unimplemented method 'shutdown'"
);
64
// TODO - Must fix
65
}
66
67
public
static
void
simPeriodicBefore() {
68
throw
new
UnsupportedOperationException(
"Unimplemented method 'simPeriodicBefore'"
);
69
// TODO - Must fix
70
}
71
72
public
static
void
simPeriodicAfter() {
73
throw
new
UnsupportedOperationException(
"Unimplemented method 'simPeriodicAfter'"
);
74
// TODO - Must fix
75
}
76
77
public
static
boolean
getSystemActive() {
78
throw
new
UnsupportedOperationException(
"Unimplemented method 'getSystemActive'"
);
79
// return false; // TODO - Must fix
80
}
81
82
public
static
boolean
getBrownedOut() {
83
throw
new
UnsupportedOperationException(
"Unimplemented method 'getBrownedOut'"
);
84
// return false; // TODO - Must fix
85
}
86
87
public
static
int
getCommsDisableCount() {
88
throw
new
UnsupportedOperationException(
"Unimplemented method 'getComsDisableCount'"
);
89
// return 0; // TODO - Must fix
90
}
91
92
public
static
boolean
getRSLState() {
93
throw
new
UnsupportedOperationException(
"Unimplemented method 'getRLSState'"
);
94
// return false; // TODO - Must fix
95
}
96
97
public
static
boolean
getSystemTimeValid() {
98
throw
new
UnsupportedOperationException(
"Unimplemented method 'getSystemTimeValid'"
);
99
// return false; // TODO - Must fix
100
}
101
102
103
104
// /**
105
// * Call this to start up HAL. This is required for robot programs.
106
// *
107
// * <p>This must be called before any other HAL functions. Failure to do so will result in
108
// * undefined behavior, and likely segmentation faults. This means that any statically initialized
109
// * variables in a program MUST call this function in their constructors if they want to use other
110
// * HAL calls.
111
// *
112
// * @return true if initialization was successful, otherwise false.
113
// * @see "HAL_Initialize"
114
// */
115
// public static native boolean initialize();
116
117
// /**
118
// * Call this to shut down HAL.
119
// *
120
// * <p>This must be called at termination of the robot program to avoid potential segmentation
121
// * faults with simulation extensions at exit.
122
// *
123
// * @see "HAL_Shutdown"
124
// */
125
// public static native void shutdown();
126
127
// /**
128
// * Returns true if HAL_SetMain() has been called.
129
// *
130
// * @return True if HAL_SetMain() has been called, false otherwise.
131
// * @see "HAL_HasMain"
132
// */
133
// public static native boolean hasMain();
134
135
// /**
136
// * Runs the main function provided to HAL_SetMain().
137
// *
138
// * <p>If HAL_SetMain() has not been called, simply sleeps until exitMain() is called.
139
// *
140
// * @see "HAL_RunMain"
141
// */
142
// public static native void runMain();
143
144
// /**
145
// * Causes HAL_RunMain() to exit.
146
// *
147
// * <p>If HAL_SetMain() has been called, this calls the exit function provided to that function.
148
// *
149
// * @see "HAL_ExitMain"
150
// */
151
// public static native void exitMain();
152
153
// /** Terminates the executable (at the native level). Does nothing in simulation. */
154
// public static native void terminate();
155
156
// private static native void simPeriodicBeforeNative();
157
158
// private static final List<Runnable> s_simPeriodicBefore = new ArrayList<>();
159
160
// /** A callback to be run by IterativeRobotBase prior to the user's simulationPeriodic code. */
161
// public static final class SimPeriodicBeforeCallback implements AutoCloseable {
162
// private SimPeriodicBeforeCallback(Runnable r) {
163
// m_run = r;
164
// }
165
166
// @Override
167
// public void close() {
168
// synchronized (s_simPeriodicBefore) {
169
// s_simPeriodicBefore.remove(m_run);
170
// }
171
// }
172
173
// private final Runnable m_run;
174
// }
175
176
// /**
177
// * Registers a callback to be run by IterativeRobotBase prior to the user's simulationPeriodic
178
// * code.
179
// *
180
// * @param r runnable
181
// * @return Callback object (must be retained for callback to stay active).
182
// */
183
// public static SimPeriodicBeforeCallback registerSimPeriodicBeforeCallback(Runnable r) {
184
// synchronized (s_simPeriodicBefore) {
185
// s_simPeriodicBefore.add(r);
186
// }
187
// return new SimPeriodicBeforeCallback(r);
188
// }
189
190
// /**
191
// * Runs SimPeriodicBefore callbacks. IterativeRobotBase calls this prior to the user's
192
// * simulationPeriodic code.
193
// */
194
// public static void simPeriodicBefore() {
195
// simPeriodicBeforeNative();
196
// synchronized (s_simPeriodicBefore) {
197
// for (Runnable r : s_simPeriodicBefore) {
198
// r.run();
199
// }
200
// }
201
// }
202
203
// private static native void simPeriodicAfterNative();
204
205
// private static final List<Runnable> s_simPeriodicAfter = new ArrayList<>();
206
207
// /** A callback to be run by IterativeRobotBase after the user's simulationPeriodic code. */
208
// public static final class SimPeriodicAfterCallback implements AutoCloseable {
209
// private SimPeriodicAfterCallback(Runnable r) {
210
// m_run = r;
211
// }
212
213
// @Override
214
// public void close() {
215
// synchronized (s_simPeriodicAfter) {
216
// s_simPeriodicAfter.remove(m_run);
217
// }
218
// }
219
220
// private final Runnable m_run;
221
// }
222
223
// /**
224
// * Registers a callback to be run by IterativeRobotBase after the user's simulationPeriodic code.
225
// *
226
// * @param r runnable
227
// * @return Callback object (must be retained for callback to stay active).
228
// */
229
// public static SimPeriodicAfterCallback registerSimPeriodicAfterCallback(Runnable r) {
230
// synchronized (s_simPeriodicAfter) {
231
// s_simPeriodicAfter.add(r);
232
// }
233
// return new SimPeriodicAfterCallback(r);
234
// }
235
236
// /**
237
// * Runs SimPeriodicAfter callbacks. IterativeRobotBase calls this after the user's
238
// * simulationPeriodic code.
239
// */
240
// public static void simPeriodicAfter() {
241
// simPeriodicAfterNative();
242
// synchronized (s_simPeriodicAfter) {
243
// for (Runnable r : s_simPeriodicAfter) {
244
// r.run();
245
// }
246
// }
247
// }
248
249
// /**
250
// * Gets if the system is in a browned out state.
251
// *
252
// * @return true if the system is in a low voltage brown out, false otherwise
253
// * @see "HAL_GetBrownedOut"
254
// */
255
// public static native boolean getBrownedOut();
256
257
// /**
258
// * Gets if the system outputs are currently active.
259
// *
260
// * @return true if the system outputs are active, false if disabled
261
// * @see "HAL_GetSystemActive"
262
// */
263
// public static native boolean getSystemActive();
264
265
// /**
266
// * Gets the current state of the Robot Signal Light (RSL).
267
// *
268
// * @return The current state of the RSL- true if on, false if off
269
// * @see "HAL_GetRSLState"
270
// */
271
// public static native boolean getRSLState();
272
273
// /**
274
// * Gets the number of times the system has been disabled due to communication errors with the
275
// * Driver Station.
276
// *
277
// * @return number of disables due to communication errors.
278
// */
279
// public static native int getCommsDisableCount();
280
281
// /**
282
// * Gets if the system time is valid.
283
// *
284
// * @return True if the system time is valid, false otherwise
285
// * @see "HAL_GetSystemTimeValid"
286
// */
287
// public static native boolean getSystemTimeValid();
288
289
// /**
290
// * Reports usage of a resource of interest. Repeated calls for the same resource name replace the
291
// * previous report.
292
// *
293
// * @param resource the used resource name
294
// * @param data arbitrary associated data string
295
// */
296
// public static void reportUsage(String resource, String data) {
297
// UsageReportingJNI.report(resource, data);
298
// }
299
300
// /**
301
// * Reports usage of a resource of interest. Repeated calls for the same resource name replace the
302
// * previous report.
303
// *
304
// * @param resource the used resource name
305
// * @param instanceNumber an index that identifies the resource instance
306
// * @param data arbitrary associated data string
307
// */
308
// public static void reportUsage(String resource, int instanceNumber, String data) {
309
// reportUsage(resource + "[" + instanceNumber + "]", data);
310
// }
311
312
// /**
313
// * Publishes a version for a device on a CAN bus.
314
// *
315
// * @param busId bus containing the device
316
// * @param deviceId device identifier
317
// * @param name version name
318
// * @param version version string
319
// * @return status of the operation
320
// */
321
// public static int publishCanVersion(int busId, int deviceId, String name, String version) {
322
// return UsageReportingJNI.publishCanVersion(busId, deviceId, name, version);
323
// }
324
325
// /**
326
// * Publishes a version without a bus or device identifier.
327
// *
328
// * @param name version name
329
// * @param version version string
330
// * @return status of the operation
331
// */
332
// public static int publishVersion(String name, String version) {
333
// return UsageReportingJNI.publishVersion(name, version);
334
// }
335
336
// /**
337
// * Publishes the WPILib version.
338
// *
339
// * @param version WPILib version string
340
// * @return status of the operation
341
// */
342
// public static int publishWpilibVersion(String version) {
343
// return UsageReportingJNI.publishWpilibVersion(version);
344
// }
345
346
// private HAL() {}
347
}
org.wpilib.hardware.hal.HAL
Definition
HAL.java:20
org
wpilib
hardware
hal
HAL.java
Generated by
1.18.0