RobotCore 1.0
WPILib port to raspberry Pi
Loading...
Searching...
No Matches
HALUtil.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
7package org.wpilib.hardware.hal;
8
9import org.wpilib.system.RuntimeType;
10
16public final class HALUtil {
18 public static final int RUNTIME_SYSTEMCORE = 0;
19
21 public static final int RUNTIME_SIMULATION = 1;
22
23 public static long getMonotonicTime() {
24 return System.nanoTime();
25 }
26
27 public static long getMonotonicMilliseconds() {
28 return getMonotonicTime() / 1_000_000;
29 }
30
31 public static int getHALRuntimeType() {
32 // System.out.println("HALUtil.getHALRuntimeType");
33 // throw new UnsupportedOperationException("Unimplemented method
34 // 'getHALRuntimeType'");
35 return HALUtil.RUNTIME_SYSTEMCORE; // TODO - Must verify
36 }
37
38 public static String getSerialNumber() {
39 throw new UnsupportedOperationException("Unimplemented method 'getSerialNumber'");
40 // return null; // TODO - Must fix
41 }
42
43 public static String getComments() {
44 throw new UnsupportedOperationException("Unimplemented method 'getComments'");
45 // return null; // TODO - Must fix
46 }
47
48 public static int getTeamNumber() {
49 throw new UnsupportedOperationException("Unimplemented method 'getTeamNumber'");
50 // return 0; // TODO - Must fix
51 }
52
53 // /** A pointer parameter to a method is NULL. */
54 // public static final int NULL_PARAMETER = -1005;
55
56 // /** Voltage to convert to raw value is out of range [0; 5]. */
57 // public static final int VOLTAGE_OUT_OF_RANGE = 1002;
58
59 // /** The operation cannot be completed. */
60 // public static final int INCOMPATIBLE_STATE = 1015;
61
62 // /** No available resources to allocate. */
63 // public static final int NO_AVAILABLE_RESOURCES = -1004;
64
65 // /** A parameter is out of range. */
66 // public static final int PARAMETER_OUT_OF_RANGE = -1028;
67
68 // /** Systemcore runtime. */
69 // public static final int RUNTIME_SYSTEMCORE = 0;
70
71 // /** Simulation runtime. */
72 // public static final int RUNTIME_SIMULATION = 1;
73
74 // /**
75 // * Returns the Systemcore serial number.
76 // *
77 // * @return The Systemcore serial number.
78 // * @see "HAL_GetSerialNumber"
79 // */
80 // public static native String getSerialNumber();
81
82 // /**
83 // * Returns the comments from the Systemcore web interface.
84 // *
85 // * @return The comments string.
86 // * @see "HAL_GetComments"
87 // */
88 // public static native String getComments();
89
90 // /**
91 // * Returns the team number configured for the robot controller.
92 // *
93 // * @return team number, or 0 if not found.
94 // * @see "HAL_GetTeamNumber"
95 // */
96 // public static native int getTeamNumber();
97
98 // /**
99 // * Reads the nanosecond-resolution monotonic timer.
100 // *
101 // * @return The current monotonic time in nanoseconds.
102 // */
103 // public static native long getMonotonicTime();
104
105 // /**
106 // * Returns the runtime type of the HAL.
107 // *
108 // * @return HAL Runtime Type
109 // * @see #RUNTIME_SYSTEMCORE
110 // * @see #RUNTIME_SIMULATION
111 // * @see "HAL_GetRuntimeType"
112 // */
113 // public static native int getHALRuntimeType();
114
115 // /**
116 // * Gets the error message for a specific status code.
117 // *
118 // * @param code the status code
119 // * @return the error message for the code. This does not need to be freed.
120 // * @see "HAL_GetErrorMessage"
121 // */
122 // public static native String getHALErrorMessage(int code);
123
124 // /**
125 // * Get the last HAL error code.
126 // *
127 // * @return error code
128 // */
129 // public static native int getHALErrno();
130
131 // /**
132 // * Returns the textual description of the system error code.
133 // *
134 // * @param errno errno to get description of
135 // * @return description of errno
136 // * @see "std::strerror"
137 // */
138 // public static native String getHALstrerror(int errno);
139
140 // /**
141 // * Gets the error message for the last HAL error.
142 // *
143 // * @return the error message for the code.
144 // */
145 // public static String getHALstrerror() {
146 // return getHALstrerror(getHALErrno());
147 // }
148
149 // private HALUtil() {}
150}
static final int RUNTIME_SYSTEMCORE
Definition HALUtil.java:18
static final int RUNTIME_SIMULATION
Definition HALUtil.java:21