6 package com.google.appinventor.components.runtime;
27 @DesignerComponent(version = YaVersion.EV3_COMMANDS_COMPONENT_VERSION,
28 description =
"A component that provides a low-level interface to a LEGO MINDSTORMS EV3 " +
29 "robot, with functions to send system or direct commands to EV3 robots.",
30 category = ComponentCategory.LEGOMINDSTORMS,
32 iconName =
"images/legoMindstormsEv3.png")
34 @UsesPermissions(permissionNames =
"android.permission.INTERNET," +
35 "android.permission.WRITE_EXTERNAL_STORAGE," +
36 "android.permission.READ_EXTERNAL_STORAGE")
43 super(container,
"Ev3Commands");
49 @
SimpleFunction(description =
"Keep the EV3 brick from shutdown for a period of time.")
50 public
void KeepAlive(
int minutes) {
51 String functionName = Thread.currentThread().getStackTrace()[1].getMethodName();
53 if (minutes < 0 || minutes > 0xff) {
64 sendCommand(functionName, command,
false);
72 public
double GetBatteryVoltage() {
73 String functionName = Thread.currentThread().getStackTrace()[1].getMethodName();
81 byte[] reply = sendCommand(functionName, command,
true);
84 return (Float) values[0];
94 public
double GetBatteryCurrent() {
95 String functionName = Thread.currentThread().getStackTrace()[1].getMethodName();
103 byte[] reply = sendCommand(functionName, command,
true);
106 return (Float) values[0];
116 public String GetOSVersion() {
117 String functionName = Thread.currentThread().getStackTrace()[1].getMethodName();
126 byte[] reply = sendCommand(functionName, command,
true);
129 return String.valueOf(value[0]);
140 public String GetOSBuild() {
141 String functionName = Thread.currentThread().getStackTrace()[1].getMethodName();
150 byte[] reply = sendCommand(functionName, command,
true);
154 return String.valueOf(value[0]);
165 public String GetFirmwareVersion() {
166 String functionName = Thread.currentThread().getStackTrace()[1].getMethodName();
175 byte[] reply = sendCommand(functionName, command,
true);
179 return String.valueOf(value[0]);
190 public String GetFirmwareBuild() {
191 String functionName = Thread.currentThread().getStackTrace()[1].getMethodName();
199 byte[] reply = sendCommand(functionName, command,
true);
203 return String.valueOf(value[0]);
214 public String GetHardwareVersion() {
215 String functionName = Thread.currentThread().getStackTrace()[1].getMethodName();
224 byte[] reply = sendCommand(functionName, command,
true);
228 return String.valueOf(value[0]);