diff --git a/FtcRobotController/.idea/gradle.xml b/FtcRobotController/.idea/gradle.xml
index c49011e..4bd6cc3 100644
--- a/FtcRobotController/.idea/gradle.xml
+++ b/FtcRobotController/.idea/gradle.xml
@@ -5,12 +5,19 @@
-
+
diff --git a/FtcRobotController/.idea/modules.xml b/FtcRobotController/.idea/modules.xml
index 31c8126..77165fc 100644
--- a/FtcRobotController/.idea/modules.xml
+++ b/FtcRobotController/.idea/modules.xml
@@ -2,8 +2,15 @@
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/FtcRobotController/Analytics/.gitignore b/FtcRobotController/Analytics/.gitignore
new file mode 100644
index 0000000..796b96d
--- /dev/null
+++ b/FtcRobotController/Analytics/.gitignore
@@ -0,0 +1 @@
+/build
diff --git a/FtcRobotController/Analytics/Analytics.iml b/FtcRobotController/Analytics/Analytics.iml
new file mode 100644
index 0000000..0b669eb
--- /dev/null
+++ b/FtcRobotController/Analytics/Analytics.iml
@@ -0,0 +1,94 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ generateDebugAndroidTestSources
+ generateDebugSources
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/FtcRobotController/Analytics/build.gradle b/FtcRobotController/Analytics/build.gradle
new file mode 100644
index 0000000..f8bc75c
--- /dev/null
+++ b/FtcRobotController/Analytics/build.gradle
@@ -0,0 +1,29 @@
+apply plugin: 'com.android.library'
+
+android {
+ compileSdkVersion 22
+ buildToolsVersion '22.0.1'
+
+ defaultConfig {
+ minSdkVersion 19
+ targetSdkVersion 23
+ versionCode 1
+ versionName "1.0"
+ }
+ buildTypes {
+ release {
+ minifyEnabled false
+ proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
+ }
+ }
+ compileOptions {
+ sourceCompatibility JavaVersion.VERSION_1_7
+ targetCompatibility JavaVersion.VERSION_1_7
+ }
+}
+
+dependencies {
+ compile fileTree(include: ['*.jar'], dir: 'libs')
+ testCompile 'junit:junit:4.12'
+ compile project(':robotcore')
+}
diff --git a/FtcRobotController/Analytics/proguard-rules.pro b/FtcRobotController/Analytics/proguard-rules.pro
new file mode 100644
index 0000000..db73af4
--- /dev/null
+++ b/FtcRobotController/Analytics/proguard-rules.pro
@@ -0,0 +1,17 @@
+# Add project specific ProGuard rules here.
+# By default, the flags in this file are appended to flags specified
+# in C:\Users\Public\Android\sdk/tools/proguard/proguard-android.txt
+# You can edit the include path and order by changing the proguardFiles
+# directive in build.gradle.
+#
+# For more details, see
+# http://developer.android.com/guide/developing/tools/proguard.html
+
+# Add any project specific keep options here:
+
+# If your project uses WebView with JS, uncomment the following
+# and specify the fully qualified class name to the JavaScript interface
+# class:
+#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
+# public *;
+#}
diff --git a/FtcRobotController/Analytics/src/androidTest/java/com/qualcomm/analytics/ApplicationTest.java b/FtcRobotController/Analytics/src/androidTest/java/com/qualcomm/analytics/ApplicationTest.java
new file mode 100644
index 0000000..fd7fd3d
--- /dev/null
+++ b/FtcRobotController/Analytics/src/androidTest/java/com/qualcomm/analytics/ApplicationTest.java
@@ -0,0 +1,13 @@
+package com.qualcomm.analytics;
+
+import android.app.Application;
+import android.test.ApplicationTestCase;
+
+/**
+ * Testing Fundamentals
+ */
+public class ApplicationTest extends ApplicationTestCase {
+ public ApplicationTest() {
+ super(Application.class);
+ }
+}
\ No newline at end of file
diff --git a/FtcRobotController/Analytics/src/main/AndroidManifest.xml b/FtcRobotController/Analytics/src/main/AndroidManifest.xml
new file mode 100644
index 0000000..b67db6f
--- /dev/null
+++ b/FtcRobotController/Analytics/src/main/AndroidManifest.xml
@@ -0,0 +1,9 @@
+
+
+
+
+
+
+
diff --git a/FtcRobotController/app/src/main/java/com/qualcomm/analytics/Analytics.java b/FtcRobotController/Analytics/src/main/java/com/qualcomm/analytics/Analytics.java
similarity index 87%
rename from FtcRobotController/app/src/main/java/com/qualcomm/analytics/Analytics.java
rename to FtcRobotController/Analytics/src/main/java/com/qualcomm/analytics/Analytics.java
index 30c34a7..08e39fe 100644
--- a/FtcRobotController/app/src/main/java/com/qualcomm/analytics/Analytics.java
+++ b/FtcRobotController/Analytics/src/main/java/com/qualcomm/analytics/Analytics.java
@@ -1,568 +1,568 @@
-//
-// Source code recreated from a .class file by IntelliJ IDEA
-// (powered by Fernflower decompiler)
-//
-
-package com.qualcomm.analytics;
-
-import android.content.BroadcastReceiver;
-import android.content.Context;
-import android.content.Intent;
-import android.content.IntentFilter;
-import android.content.SharedPreferences;
-import android.content.SharedPreferences.Editor;
-import android.net.ConnectivityManager;
-import android.net.NetworkInfo;
-import android.net.NetworkInfo.State;
-import android.os.AsyncTask;
-import android.os.Build;
-import android.os.Bundle;
-import android.os.Environment;
-import android.preference.PreferenceManager;
-import com.qualcomm.robotcore.hardware.DcMotorController;
-import com.qualcomm.robotcore.hardware.HardwareMap;
-import com.qualcomm.robotcore.hardware.ServoController;
-import com.qualcomm.robotcore.util.RobotLog;
-import com.qualcomm.robotcore.util.Version;
-import java.io.BufferedReader;
-import java.io.BufferedWriter;
-import java.io.EOFException;
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.FileNotFoundException;
-import java.io.FileOutputStream;
-import java.io.FileReader;
-import java.io.IOException;
-import java.io.InputStreamReader;
-import java.io.ObjectInputStream;
-import java.io.ObjectOutputStream;
-import java.io.OutputStreamWriter;
-import java.io.Serializable;
-import java.io.UnsupportedEncodingException;
-import java.net.HttpURLConnection;
-import java.net.MalformedURLException;
-import java.net.URL;
-import java.net.URLEncoder;
-import java.nio.charset.Charset;
-import java.security.SecureRandom;
-import java.security.cert.CertificateException;
-import java.security.cert.X509Certificate;
-import java.text.SimpleDateFormat;
-import java.util.ArrayList;
-import java.util.Date;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.Locale;
-import java.util.UUID;
-import java.util.regex.Pattern;
-import javax.net.ssl.HostnameVerifier;
-import javax.net.ssl.HttpsURLConnection;
-import javax.net.ssl.KeyManager;
-import javax.net.ssl.SSLContext;
-import javax.net.ssl.SSLSession;
-import javax.net.ssl.TrustManager;
-import javax.net.ssl.X509TrustManager;
-
-public class Analytics extends BroadcastReceiver {
- public static final String UUID_PATH = ".analytics_id";
- public static final String DATA_COLLECTION_PATH = ".ftcdc";
- static String a = "https://ftcdc.qualcomm.com/DataApi";
- public static final String RC_COMMAND_STRING = "update_rc";
- public static final String DS_COMMAND_STRING = "update_ds";
- public static final String EXTERNAL_STORAGE_DIRECTORY_PATH = Environment.getExternalStorageDirectory() + "/";
- public static final String LAST_UPLOAD_DATE = "last_upload_date";
- public static final String MAX_DEVICES = "max_usb_devices";
- public static int MAX_ENTRIES_SIZE = 100;
- public static int TRIMMED_SIZE = 90;
- private static final Charset m = Charset.forName("UTF-8");
- static long b;
- static UUID c = null;
- static String d;
- String e;
- static String f = "";
- Context g;
- SharedPreferences h;
- boolean i = false;
- long j = 0L;
- int k = 0;
- static final HostnameVerifier l = new HostnameVerifier() {
- public boolean verify(String hostname, SSLSession session) {
- return true;
- }
- };
-
- public void onReceive(Context context, Intent intent) {
- Bundle var3 = intent.getExtras();
- if(var3 != null && var3.containsKey("networkInfo")) {
- NetworkInfo var4 = (NetworkInfo)var3.get("networkInfo");
- State var5 = var4.getState();
- if(var5.equals(State.CONNECTED)) {
- RobotLog.i("Analytics detected NetworkInfo.State.CONNECTED");
- this.communicateWithServer();
- }
- }
-
- }
-
- public void unregister() {
- this.g.unregisterReceiver(this);
- }
-
- public void register() {
- this.g.registerReceiver(this, new IntentFilter("android.net.wifi.STATE_CHANGE"));
- }
-
- public Analytics(Context context, String commandString, HardwareMap map) {
- this.g = context;
- this.e = commandString;
-
- try {
- try {
- this.h = PreferenceManager.getDefaultSharedPreferences(context);
- b = System.currentTimeMillis();
- f = Version.getLibraryVersion();
- this.handleUUID(".analytics_id");
- int var4 = this.calculateUsbDevices(map);
- int var5 = this.h.getInt("max_usb_devices", this.k);
- if(var5 < var4) {
- Editor var6 = this.h.edit();
- var6.putInt("max_usb_devices", var4);
- var6.apply();
- }
-
- setApplicationName(context.getApplicationInfo().loadLabel(context.getPackageManager()).toString());
- this.handleData();
- this.register();
- RobotLog.i("Analytics has completed initialization.");
- } catch (Exception var7) {
- this.i = true;
- }
-
- if(this.i) {
- this.a();
- this.i = false;
- }
- } catch (Exception var8) {
- RobotLog.i("Analytics encountered a problem during initialization");
- RobotLog.logStacktrace(var8);
- }
-
- }
-
- protected int calculateUsbDevices(HardwareMap map) {
- byte var2 = 0;
- int var7 = var2 + map.legacyModule.size();
- var7 += map.deviceInterfaceModule.size();
- Iterator var3 = map.servoController.iterator();
-
- String var5;
- Pattern var6;
- while(var3.hasNext()) {
- ServoController var4 = (ServoController)var3.next();
- var5 = var4.getDeviceName();
- var6 = Pattern.compile("(?i)usb");
- if(var6.matcher(var5).matches()) {
- ++var7;
- }
- }
-
- var3 = map.dcMotorController.iterator();
-
- while(var3.hasNext()) {
- DcMotorController var8 = (DcMotorController)var3.next();
- var5 = var8.getDeviceName();
- var6 = Pattern.compile("(?i)usb");
- if(var6.matcher(var5).matches()) {
- ++var7;
- }
- }
-
- return var7;
- }
-
- protected void handleData() throws IOException, ClassNotFoundException {
- String var1 = EXTERNAL_STORAGE_DIRECTORY_PATH + ".ftcdc";
- File var2 = new File(var1);
- if(!var2.exists()) {
- this.createInitialFile(var1);
- } else {
- ArrayList var3 = this.updateExistingFile(var1, getDateFromTime(b));
- if(var3.size() >= MAX_ENTRIES_SIZE) {
- this.trimEntries(var3);
- }
-
- this.writeObjectsToFile(var1, var3);
- }
-
- }
-
- protected void trimEntries(ArrayList dataInfoArrayList) {
- dataInfoArrayList.subList(TRIMMED_SIZE, dataInfoArrayList.size()).clear();
- }
-
- protected ArrayList updateExistingFile(String filepath, String date) throws ClassNotFoundException, IOException {
- ArrayList var3 = this.readObjectsFromFile(filepath);
- Analytics.DataInfo var4 = (Analytics.DataInfo)var3.get(var3.size() - 1);
- if(var4.a.equalsIgnoreCase(date)) {
- ++var4.numUsages;
- } else {
- Analytics.DataInfo var5 = new Analytics.DataInfo(date, 1);
- var3.add(var5);
- }
-
- return var3;
- }
-
- protected ArrayList readObjectsFromFile(String filepath) throws IOException, ClassNotFoundException {
- FileInputStream var2 = new FileInputStream(new File(filepath));
- ObjectInputStream var3 = new ObjectInputStream(var2);
- ArrayList var4 = new ArrayList();
- boolean var5 = true;
-
- while(var5) {
- try {
- Analytics.DataInfo var6 = (Analytics.DataInfo)var3.readObject();
- var4.add(var6);
- } catch (EOFException var7) {
- var5 = false;
- }
- }
-
- var3.close();
- return var4;
- }
-
- protected void createInitialFile(String filepath) throws IOException {
- Analytics.DataInfo var2 = new Analytics.DataInfo(getDateFromTime(b), 1);
- ArrayList var3 = new ArrayList();
- var3.add(var2);
- this.writeObjectsToFile(filepath, var3);
- }
-
- private void a() {
- RobotLog.i("Analytics is starting with a clean slate.");
- Editor var1 = this.h.edit();
- var1.putLong("last_upload_date", this.j);
- var1.apply();
- var1.putInt("max_usb_devices", 0);
- var1.apply();
- File var2 = new File(EXTERNAL_STORAGE_DIRECTORY_PATH + ".ftcdc");
- var2.delete();
- File var3 = new File(EXTERNAL_STORAGE_DIRECTORY_PATH + ".analytics_id");
- var3.delete();
- this.i = false;
- }
-
- public void communicateWithServer() {
- String[] var1 = new String[]{a};
- (new Analytics.a(null)).execute((Object[])var1);
- }
-
- public static void setApplicationName(String name) {
- d = name;
- }
-
- public void handleUUID(String filename) {
- File var2 = new File(EXTERNAL_STORAGE_DIRECTORY_PATH + filename);
- if(!var2.exists()) {
- c = UUID.randomUUID();
- this.handleCreateNewFile(EXTERNAL_STORAGE_DIRECTORY_PATH + filename, c.toString());
- }
-
- String var3 = this.readFromFile(var2);
-
- try {
- c = UUID.fromString(var3);
- } catch (IllegalArgumentException var5) {
- RobotLog.i("Analytics encountered an IllegalArgumentException");
- c = UUID.randomUUID();
- this.handleCreateNewFile(EXTERNAL_STORAGE_DIRECTORY_PATH + filename, c.toString());
- }
-
- }
-
- protected String readFromFile(File file) {
- try {
- char[] var2 = new char[4096];
- FileReader var3 = new FileReader(file);
- int var4 = var3.read(var2);
- var3.close();
- String var5 = new String(var2, 0, var4);
- return var5.trim();
- } catch (FileNotFoundException var6) {
- RobotLog.i("Analytics encountered a FileNotFoundException while trying to read a file.");
- } catch (IOException var7) {
- RobotLog.i("Analytics encountered an IOException while trying to read.");
- }
-
- return "";
- }
-
- protected void writeObjectsToFile(String filepath, ArrayList info) throws IOException {
- ObjectOutputStream var3 = new ObjectOutputStream(new FileOutputStream(filepath));
- Iterator var4 = info.iterator();
-
- while(var4.hasNext()) {
- Analytics.DataInfo var5 = (Analytics.DataInfo)var4.next();
- var3.writeObject(var5);
- }
-
- var3.close();
- }
-
- protected void handleCreateNewFile(String filepath, String data) {
- BufferedWriter var3 = null;
-
- try {
- File var4 = new File(filepath);
- FileOutputStream var5 = new FileOutputStream(var4);
- var3 = new BufferedWriter(new OutputStreamWriter(var5, "utf-8"));
- var3.write(data);
- } catch (IOException var14) {
- RobotLog.i("Analytics encountered an IOException: " + var14.toString());
- } finally {
- if(var3 != null) {
- try {
- var3.close();
- } catch (IOException var13) {
- ;
- }
- }
-
- }
-
- }
-
- public static String getDateFromTime(long time) {
- SimpleDateFormat var2 = new SimpleDateFormat("yyyy-MM-dd", Locale.US);
- String var3 = var2.format(new Date(time));
- return var3;
- }
-
- protected static UUID getUuid() {
- return c;
- }
-
- public String updateStats(String user, ArrayList dateInfo, String commandString) {
- int var4 = this.h.getInt("max_usb_devices", this.k);
- String var5 = this.a("cmd", "=", commandString) + "&" + this.a("uuid", "=", user) + "&" + this.a("device_hw", "=", Build.MANUFACTURER) + "&" + this.a("device_ver", "=", Build.MODEL) + "&" + this.a("chip_type", "=", this.b()) + "&" + this.a("sw_ver", "=", f) + "&" + this.a("max_dev", "=", String.valueOf(var4)) + "&";
- String var6 = "";
-
- for(int var7 = 0; var7 < dateInfo.size(); ++var7) {
- if(var7 > 0) {
- var6 = var6 + ",";
- }
-
- var6 = var6 + this.a(((Analytics.DataInfo)dateInfo.get(var7)).date(), ",", String.valueOf(((Analytics.DataInfo)dateInfo.get(var7)).numUsages()));
- }
-
- var5 = var5 + this.a("dc", "=", "");
- var5 = var5 + var6;
- return var5;
- }
-
- private String a(String var1, String var2, String var3) {
- String var4 = "";
-
- try {
- var4 = URLEncoder.encode(var1, m.name()) + var2 + URLEncoder.encode(var3, m.name());
- } catch (UnsupportedEncodingException var6) {
- RobotLog.i("Analytics caught an UnsupportedEncodingException");
- }
-
- return var4;
- }
-
- private String b() {
- String var1 = "UNKNOWN";
- String var2 = "/proc/cpuinfo";
- String[] var3 = new String[]{"CPU implementer", "Hardware"};
- HashMap var4 = new HashMap();
-
- try {
- BufferedReader var5 = new BufferedReader(new FileReader("/proc/cpuinfo"));
-
- for(String var6 = var5.readLine(); var6 != null; var6 = var5.readLine()) {
- var6 = var6.toLowerCase();
- String[] var7 = var6.split(":");
- if(var7.length >= 2) {
- var4.put(var7[0].trim(), var7[1].trim());
- }
- }
-
- var5.close();
- String var14 = "";
- String[] var8 = var3;
- int var9 = var3.length;
-
- for(int var10 = 0; var10 < var9; ++var10) {
- String var11 = var8[var10];
- var14 = var14 + (String)var4.get(var11.toLowerCase()) + " ";
- }
-
- var14 = var14.trim();
- if(var14.isEmpty()) {
- return var1;
- }
-
- return var14;
- } catch (FileNotFoundException var12) {
- RobotLog.i("Analytics encountered a FileNotFoundException while looking for CPU info");
- } catch (IOException var13) {
- RobotLog.i("Analytics encountered an IOException while looking for CPU info");
- }
-
- return var1;
- }
-
- public boolean isConnected() {
- ConnectivityManager var1 = (ConnectivityManager)this.g.getSystemService("connectivity");
- NetworkInfo var2 = var1.getActiveNetworkInfo();
- return var2 != null && var2.isConnected();
- }
-
- public static String ping(URL baseUrl, String data) {
- String var2 = call(baseUrl, data);
- return var2;
- }
-
- public static String call(URL url, String data) {
- String var4 = null;
- if(url != null && data != null) {
- try {
- long var2 = System.currentTimeMillis();
- Object var5 = null;
- if(url.getProtocol().toLowerCase().equals("https")) {
- c();
- HttpsURLConnection var6 = (HttpsURLConnection)url.openConnection();
- var6.setHostnameVerifier(l);
- var5 = var6;
- } else {
- var5 = (HttpURLConnection)url.openConnection();
- }
-
- ((HttpURLConnection)var5).setDoOutput(true);
- OutputStreamWriter var7 = new OutputStreamWriter(((HttpURLConnection)var5).getOutputStream());
- var7.write(data);
- var7.flush();
- var7.close();
- BufferedReader var10 = new BufferedReader(new InputStreamReader(((HttpURLConnection)var5).getInputStream()));
-
- String var8;
- for(var4 = new String(); (var8 = var10.readLine()) != null; var4 = var4 + var8) {
- ;
- }
-
- var10.close();
- RobotLog.i("Analytics took: " + (System.currentTimeMillis() - var2) + "ms");
- } catch (IOException var9) {
- RobotLog.i("Analytics Failed to process command.");
- }
- }
-
- return var4;
- }
-
- private static void c() {
- TrustManager[] var0 = new TrustManager[]{new X509TrustManager() {
- public X509Certificate[] getAcceptedIssuers() {
- return new X509Certificate[0];
- }
-
- public void checkClientTrusted(X509Certificate[] chain, String authType) throws CertificateException {
- }
-
- public void checkServerTrusted(X509Certificate[] chain, String authType) throws CertificateException {
- }
- }};
-
- try {
- SSLContext var1 = SSLContext.getInstance("TLS");
- var1.init((KeyManager[])null, var0, new SecureRandom());
- HttpsURLConnection.setDefaultSSLSocketFactory(var1.getSocketFactory());
- } catch (Exception var2) {
- var2.printStackTrace();
- }
-
- }
-
- private class a extends AsyncTask {
- private a() {
- }
-
- protected Object doInBackground(Object[] params) {
- if(Analytics.this.isConnected()) {
- try {
- URL var2 = null;
- var2 = new URL(Analytics.a);
- long var3 = Analytics.this.h.getLong("last_upload_date", Analytics.this.j);
- if(!Analytics.getDateFromTime(Analytics.b).equals(Analytics.getDateFromTime(var3))) {
- label53: {
- String var5 = Analytics.this.a("cmd", "=", "ping");
- String var6 = Analytics.ping(var2, var5);
- String var7 = "\"rc\": \"OK\"";
- if(var6 != null && var6.contains(var7)) {
- RobotLog.i("Analytics ping succeeded.");
- String var8 = Analytics.EXTERNAL_STORAGE_DIRECTORY_PATH + ".ftcdc";
- ArrayList var9 = Analytics.this.readObjectsFromFile(var8);
- if(var9.size() >= Analytics.MAX_ENTRIES_SIZE) {
- Analytics.this.trimEntries(var9);
- }
-
- String var10 = Analytics.this.updateStats(Analytics.c.toString(), var9, Analytics.this.e);
- String var11 = Analytics.call(var2, var10);
- if(var11 != null && var11.contains(var7)) {
- RobotLog.i("Analytics: Upload succeeded.");
- Editor var12 = Analytics.this.h.edit();
- var12.putLong("last_upload_date", Analytics.b);
- var12.apply();
- var12.putInt("max_usb_devices", 0);
- var12.apply();
- File var13 = new File(var8);
- boolean var14 = var13.delete();
- break label53;
- }
-
- RobotLog.e("Analytics: Upload failed.");
- return null;
- }
-
- RobotLog.e("Analytics: Ping failed.");
- return null;
- }
- }
- } catch (MalformedURLException var15) {
- RobotLog.e("Analytics encountered a malformed URL exception");
- } catch (Exception var16) {
- Analytics.this.i = true;
- }
-
- if(Analytics.this.i) {
- RobotLog.i("Analytics encountered a problem during communication");
- Analytics.this.a();
- Analytics.this.i = false;
- }
- }
-
- return null;
- }
- }
-
- public static class DataInfo implements Serializable {
- private final String a;
- protected int numUsages;
-
- public DataInfo(String adate, int numUsages) {
- this.a = adate;
- this.numUsages = numUsages;
- }
-
- public String date() {
- return this.a;
- }
-
- public int numUsages() {
- return this.numUsages;
- }
- }
-}
+//
+// Source code recreated from a .class file by IntelliJ IDEA
+// (powered by Fernflower decompiler)
+//
+
+package com.qualcomm.analytics;
+
+import android.content.BroadcastReceiver;
+import android.content.Context;
+import android.content.Intent;
+import android.content.IntentFilter;
+import android.content.SharedPreferences;
+import android.content.SharedPreferences.Editor;
+import android.net.ConnectivityManager;
+import android.net.NetworkInfo;
+import android.net.NetworkInfo.State;
+import android.os.AsyncTask;
+import android.os.Build;
+import android.os.Bundle;
+import android.os.Environment;
+import android.preference.PreferenceManager;
+
+import com.qualcomm.robotcore.hardware.DcMotorController;
+import com.qualcomm.robotcore.hardware.HardwareMap;
+import com.qualcomm.robotcore.hardware.ServoController;
+import com.qualcomm.robotcore.util.RobotLog;
+import com.qualcomm.robotcore.util.Version;
+
+import java.io.BufferedReader;
+import java.io.BufferedWriter;
+import java.io.EOFException;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileNotFoundException;
+import java.io.FileOutputStream;
+import java.io.FileReader;
+import java.io.IOException;
+import java.io.InputStreamReader;
+import java.io.ObjectInputStream;
+import java.io.ObjectOutputStream;
+import java.io.OutputStreamWriter;
+import java.io.Serializable;
+import java.io.UnsupportedEncodingException;
+import java.net.HttpURLConnection;
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.net.URLEncoder;
+import java.nio.charset.Charset;
+import java.security.SecureRandom;
+import java.security.cert.CertificateException;
+import java.security.cert.X509Certificate;
+import java.text.SimpleDateFormat;
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.Locale;
+import java.util.UUID;
+import java.util.regex.Pattern;
+
+import javax.net.ssl.HostnameVerifier;
+import javax.net.ssl.HttpsURLConnection;
+import javax.net.ssl.SSLContext;
+import javax.net.ssl.SSLSession;
+import javax.net.ssl.TrustManager;
+import javax.net.ssl.X509TrustManager;
+
+public class Analytics extends BroadcastReceiver {
+ public static final String UUID_PATH = ".analytics_id";
+ public static final String DATA_COLLECTION_PATH = ".ftcdc";
+ public static final String RC_COMMAND_STRING = "update_rc";
+ public static final String DS_COMMAND_STRING = "update_ds";
+ public static final String EXTERNAL_STORAGE_DIRECTORY_PATH = Environment.getExternalStorageDirectory() + "/";
+ public static final String LAST_UPLOAD_DATE = "last_upload_date";
+ public static final String MAX_DEVICES = "max_usb_devices";
+ static final HostnameVerifier l = new HostnameVerifier() {
+ public boolean verify(String hostname, SSLSession session) {
+ return true;
+ }
+ };
+ private static final Charset m = Charset.forName("UTF-8");
+ public static int MAX_ENTRIES_SIZE = 100;
+ public static int TRIMMED_SIZE = 90;
+ static String a = "https://ftcdc.qualcomm.com/DataApi";
+ static long b;
+ static UUID c = null;
+ static String d;
+ static String f = "";
+ String e;
+ Context g;
+ SharedPreferences h;
+ boolean i = false;
+ long j = 0L;
+ int k = 0;
+
+ public Analytics(Context context, String commandString, HardwareMap map) {
+ this.g = context;
+ this.e = commandString;
+
+ try {
+ try {
+ this.h = PreferenceManager.getDefaultSharedPreferences(context);
+ b = System.currentTimeMillis();
+ f = Version.getLibraryVersion();
+ this.handleUUID(".analytics_id");
+ int var4 = this.calculateUsbDevices(map);
+ int var5 = this.h.getInt("max_usb_devices", this.k);
+ if(var5 < var4) {
+ Editor var6 = this.h.edit();
+ var6.putInt("max_usb_devices", var4);
+ var6.apply();
+ }
+
+ setApplicationName(context.getApplicationInfo().loadLabel(context.getPackageManager()).toString());
+ this.handleData();
+ this.register();
+ RobotLog.i("Analytics has completed initialization.");
+ } catch (Exception var7) {
+ this.i = true;
+ }
+
+ if(this.i) {
+ this.a();
+ this.i = false;
+ }
+ } catch (Exception var8) {
+ RobotLog.i("Analytics encountered a problem during initialization");
+ RobotLog.logStacktrace(var8);
+ }
+
+ }
+
+ public static void setApplicationName(String name) {
+ d = name;
+ }
+
+ public static String getDateFromTime(long time) {
+ SimpleDateFormat var2 = new SimpleDateFormat("yyyy-MM-dd", Locale.US);
+ String var3 = var2.format(new Date(time));
+ return var3;
+ }
+
+ protected static UUID getUuid() {
+ return c;
+ }
+
+ public static String ping(URL baseUrl, String data) {
+ String var2 = call(baseUrl, data);
+ return var2;
+ }
+
+ public static String call(URL url, String data) {
+ String var4 = null;
+ if (url != null && data != null) {
+ try {
+ long var2 = System.currentTimeMillis();
+ Object var5 = null;
+ if (url.getProtocol().toLowerCase().equals("https")) {
+ c();
+ HttpsURLConnection var6 = (HttpsURLConnection) url.openConnection();
+ var6.setHostnameVerifier(l);
+ var5 = var6;
+ } else {
+ var5 = url.openConnection();
+ }
+
+ ((HttpURLConnection) var5).setDoOutput(true);
+ OutputStreamWriter var7 = new OutputStreamWriter(((HttpURLConnection) var5).getOutputStream());
+ var7.write(data);
+ var7.flush();
+ var7.close();
+ BufferedReader var10 = new BufferedReader(new InputStreamReader(((HttpURLConnection) var5).getInputStream()));
+
+ String var8;
+ for (var4 = new String(); (var8 = var10.readLine()) != null; var4 = var4 + var8) {
+ }
+
+ var10.close();
+ RobotLog.i("Analytics took: " + (System.currentTimeMillis() - var2) + "ms");
+ } catch (IOException var9) {
+ RobotLog.i("Analytics Failed to process command.");
+ }
+ }
+
+ return var4;
+ }
+
+ private static void c() {
+ TrustManager[] var0 = new TrustManager[]{new X509TrustManager() {
+ public X509Certificate[] getAcceptedIssuers() {
+ return new X509Certificate[0];
+ }
+
+ public void checkClientTrusted(X509Certificate[] chain, String authType) throws CertificateException {
+ }
+
+ public void checkServerTrusted(X509Certificate[] chain, String authType) throws CertificateException {
+ }
+ }};
+
+ try {
+ SSLContext var1 = SSLContext.getInstance("TLS");
+ var1.init(null, var0, new SecureRandom());
+ HttpsURLConnection.setDefaultSSLSocketFactory(var1.getSocketFactory());
+ } catch (Exception var2) {
+ var2.printStackTrace();
+ }
+
+ }
+
+ public void onReceive(Context context, Intent intent) {
+ Bundle var3 = intent.getExtras();
+ if (var3 != null && var3.containsKey("networkInfo")) {
+ NetworkInfo var4 = (NetworkInfo) var3.get("networkInfo");
+ State var5 = var4.getState();
+ if (var5.equals(State.CONNECTED)) {
+ RobotLog.i("Analytics detected NetworkInfo.State.CONNECTED");
+ this.communicateWithServer();
+ }
+ }
+
+ }
+
+ public void unregister() {
+ this.g.unregisterReceiver(this);
+ }
+
+ public void register() {
+ this.g.registerReceiver(this, new IntentFilter("android.net.wifi.STATE_CHANGE"));
+ }
+
+ protected int calculateUsbDevices(HardwareMap map) {
+ byte var2 = 0;
+ int var7 = var2 + map.legacyModule.size();
+ var7 += map.deviceInterfaceModule.size();
+ Iterator var3 = map.servoController.iterator();
+
+ String var5;
+ Pattern var6;
+ while(var3.hasNext()) {
+ ServoController var4 = (ServoController)var3.next();
+ var5 = var4.getDeviceName();
+ var6 = Pattern.compile("(?i)usb");
+ if(var6.matcher(var5).matches()) {
+ ++var7;
+ }
+ }
+
+ var3 = map.dcMotorController.iterator();
+
+ while(var3.hasNext()) {
+ DcMotorController var8 = (DcMotorController)var3.next();
+ var5 = var8.getDeviceName();
+ var6 = Pattern.compile("(?i)usb");
+ if(var6.matcher(var5).matches()) {
+ ++var7;
+ }
+ }
+
+ return var7;
+ }
+
+ protected void handleData() throws IOException, ClassNotFoundException {
+ String var1 = EXTERNAL_STORAGE_DIRECTORY_PATH + ".ftcdc";
+ File var2 = new File(var1);
+ if(!var2.exists()) {
+ this.createInitialFile(var1);
+ } else {
+ ArrayList var3 = this.updateExistingFile(var1, getDateFromTime(b));
+ if(var3.size() >= MAX_ENTRIES_SIZE) {
+ this.trimEntries(var3);
+ }
+
+ this.writeObjectsToFile(var1, var3);
+ }
+
+ }
+
+ protected void trimEntries(ArrayList dataInfoArrayList) {
+ dataInfoArrayList.subList(TRIMMED_SIZE, dataInfoArrayList.size()).clear();
+ }
+
+ protected ArrayList updateExistingFile(String filepath, String date) throws ClassNotFoundException, IOException {
+ ArrayList var3 = this.readObjectsFromFile(filepath);
+ DataInfo var4 = (DataInfo)var3.get(var3.size() - 1);
+ if(var4.a.equalsIgnoreCase(date)) {
+ ++var4.numUsages;
+ } else {
+ DataInfo var5 = new DataInfo(date, 1);
+ var3.add(var5);
+ }
+
+ return var3;
+ }
+
+ protected ArrayList readObjectsFromFile(String filepath) throws IOException, ClassNotFoundException {
+ FileInputStream var2 = new FileInputStream(new File(filepath));
+ ObjectInputStream var3 = new ObjectInputStream(var2);
+ ArrayList var4 = new ArrayList();
+ boolean var5 = true;
+
+ while(var5) {
+ try {
+ DataInfo var6 = (DataInfo)var3.readObject();
+ var4.add(var6);
+ } catch (EOFException var7) {
+ var5 = false;
+ }
+ }
+
+ var3.close();
+ return var4;
+ }
+
+ protected void createInitialFile(String filepath) throws IOException {
+ DataInfo var2 = new DataInfo(getDateFromTime(b), 1);
+ ArrayList var3 = new ArrayList();
+ var3.add(var2);
+ this.writeObjectsToFile(filepath, var3);
+ }
+
+ private void a() {
+ RobotLog.i("Analytics is starting with a clean slate.");
+ Editor var1 = this.h.edit();
+ var1.putLong("last_upload_date", this.j);
+ var1.apply();
+ var1.putInt("max_usb_devices", 0);
+ var1.apply();
+ File var2 = new File(EXTERNAL_STORAGE_DIRECTORY_PATH + ".ftcdc");
+ var2.delete();
+ File var3 = new File(EXTERNAL_STORAGE_DIRECTORY_PATH + ".analytics_id");
+ var3.delete();
+ this.i = false;
+ }
+
+ public void communicateWithServer() {
+ String[] var1 = new String[]{a};
+ (new a()).execute((Object[]) var1);
+ }
+
+ public void handleUUID(String filename) {
+ File var2 = new File(EXTERNAL_STORAGE_DIRECTORY_PATH + filename);
+ if(!var2.exists()) {
+ c = UUID.randomUUID();
+ this.handleCreateNewFile(EXTERNAL_STORAGE_DIRECTORY_PATH + filename, c.toString());
+ }
+
+ String var3 = this.readFromFile(var2);
+
+ try {
+ c = UUID.fromString(var3);
+ } catch (IllegalArgumentException var5) {
+ RobotLog.i("Analytics encountered an IllegalArgumentException");
+ c = UUID.randomUUID();
+ this.handleCreateNewFile(EXTERNAL_STORAGE_DIRECTORY_PATH + filename, c.toString());
+ }
+
+ }
+
+ protected String readFromFile(File file) {
+ try {
+ char[] var2 = new char[4096];
+ FileReader var3 = new FileReader(file);
+ int var4 = var3.read(var2);
+ var3.close();
+ String var5 = new String(var2, 0, var4);
+ return var5.trim();
+ } catch (FileNotFoundException var6) {
+ RobotLog.i("Analytics encountered a FileNotFoundException while trying to read a file.");
+ } catch (IOException var7) {
+ RobotLog.i("Analytics encountered an IOException while trying to read.");
+ }
+
+ return "";
+ }
+
+ protected void writeObjectsToFile(String filepath, ArrayList info) throws IOException {
+ ObjectOutputStream var3 = new ObjectOutputStream(new FileOutputStream(filepath));
+ Iterator var4 = info.iterator();
+
+ while(var4.hasNext()) {
+ DataInfo var5 = (DataInfo)var4.next();
+ var3.writeObject(var5);
+ }
+
+ var3.close();
+ }
+
+ protected void handleCreateNewFile(String filepath, String data) {
+ BufferedWriter var3 = null;
+
+ try {
+ File var4 = new File(filepath);
+ FileOutputStream var5 = new FileOutputStream(var4);
+ var3 = new BufferedWriter(new OutputStreamWriter(var5, "utf-8"));
+ var3.write(data);
+ } catch (IOException var14) {
+ RobotLog.i("Analytics encountered an IOException: " + var14.toString());
+ } finally {
+ if(var3 != null) {
+ try {
+ var3.close();
+ } catch (IOException var13) {
+ }
+ }
+
+ }
+
+ }
+
+ public String updateStats(String user, ArrayList dateInfo, String commandString) {
+ int var4 = this.h.getInt("max_usb_devices", this.k);
+ String var5 = this.a("cmd", "=", commandString) + "&" + this.a("uuid", "=", user) + "&" + this.a("device_hw", "=", Build.MANUFACTURER) + "&" + this.a("device_ver", "=", Build.MODEL) + "&" + this.a("chip_type", "=", this.b()) + "&" + this.a("sw_ver", "=", f) + "&" + this.a("max_dev", "=", String.valueOf(var4)) + "&";
+ String var6 = "";
+
+ for(int var7 = 0; var7 < dateInfo.size(); ++var7) {
+ if(var7 > 0) {
+ var6 = var6 + ",";
+ }
+
+ var6 = var6 + this.a(dateInfo.get(var7).date(), ",", String.valueOf(dateInfo.get(var7).numUsages()));
+ }
+
+ var5 = var5 + this.a("dc", "=", "");
+ var5 = var5 + var6;
+ return var5;
+ }
+
+ private String a(String var1, String var2, String var3) {
+ String var4 = "";
+
+ try {
+ var4 = URLEncoder.encode(var1, m.name()) + var2 + URLEncoder.encode(var3, m.name());
+ } catch (UnsupportedEncodingException var6) {
+ RobotLog.i("Analytics caught an UnsupportedEncodingException");
+ }
+
+ return var4;
+ }
+
+ private String b() {
+ String var1 = "UNKNOWN";
+ String var2 = "/proc/cpuinfo";
+ String[] var3 = new String[]{"CPU implementer", "Hardware"};
+ HashMap var4 = new HashMap();
+
+ try {
+ BufferedReader var5 = new BufferedReader(new FileReader("/proc/cpuinfo"));
+
+ for(String var6 = var5.readLine(); var6 != null; var6 = var5.readLine()) {
+ var6 = var6.toLowerCase();
+ String[] var7 = var6.split(":");
+ if(var7.length >= 2) {
+ var4.put(var7[0].trim(), var7[1].trim());
+ }
+ }
+
+ var5.close();
+ String var14 = "";
+ String[] var8 = var3;
+ int var9 = var3.length;
+
+ for(int var10 = 0; var10 < var9; ++var10) {
+ String var11 = var8[var10];
+ var14 = var14 + var4.get(var11.toLowerCase()) + " ";
+ }
+
+ var14 = var14.trim();
+ if(var14.isEmpty()) {
+ return var1;
+ }
+
+ return var14;
+ } catch (FileNotFoundException var12) {
+ RobotLog.i("Analytics encountered a FileNotFoundException while looking for CPU info");
+ } catch (IOException var13) {
+ RobotLog.i("Analytics encountered an IOException while looking for CPU info");
+ }
+
+ return var1;
+ }
+
+ public boolean isConnected() {
+ ConnectivityManager var1 = (ConnectivityManager)this.g.getSystemService("connectivity");
+ NetworkInfo var2 = var1.getActiveNetworkInfo();
+ return var2 != null && var2.isConnected();
+ }
+
+ public static class DataInfo implements Serializable {
+ private final String a;
+ protected int numUsages;
+
+ public DataInfo(String adate, int numUsages) {
+ this.a = adate;
+ this.numUsages = numUsages;
+ }
+
+ public String date() {
+ return this.a;
+ }
+
+ public int numUsages() {
+ return this.numUsages;
+ }
+ }
+
+ private class a extends AsyncTask {
+ private a() {
+ }
+
+ protected Object doInBackground(Object[] params) {
+ if(Analytics.this.isConnected()) {
+ try {
+ URL var2 = null;
+ var2 = new URL(Analytics.a);
+ long var3 = Analytics.this.h.getLong("last_upload_date", Analytics.this.j);
+ if(!Analytics.getDateFromTime(Analytics.b).equals(Analytics.getDateFromTime(var3))) {
+ label53: {
+ String var5 = Analytics.this.a("cmd", "=", "ping");
+ String var6 = Analytics.ping(var2, var5);
+ String var7 = "\"rc\": \"OK\"";
+ if(var6 != null && var6.contains(var7)) {
+ RobotLog.i("Analytics ping succeeded.");
+ String var8 = Analytics.EXTERNAL_STORAGE_DIRECTORY_PATH + ".ftcdc";
+ ArrayList var9 = Analytics.this.readObjectsFromFile(var8);
+ if(var9.size() >= Analytics.MAX_ENTRIES_SIZE) {
+ Analytics.this.trimEntries(var9);
+ }
+
+ String var10 = Analytics.this.updateStats(Analytics.c.toString(), var9, Analytics.this.e);
+ String var11 = Analytics.call(var2, var10);
+ if(var11 != null && var11.contains(var7)) {
+ RobotLog.i("Analytics: Upload succeeded.");
+ Editor var12 = Analytics.this.h.edit();
+ var12.putLong("last_upload_date", Analytics.b);
+ var12.apply();
+ var12.putInt("max_usb_devices", 0);
+ var12.apply();
+ File var13 = new File(var8);
+ boolean var14 = var13.delete();
+ break label53;
+ }
+
+ RobotLog.e("Analytics: Upload failed.");
+ return null;
+ }
+
+ RobotLog.e("Analytics: Ping failed.");
+ return null;
+ }
+ }
+ } catch (MalformedURLException var15) {
+ RobotLog.e("Analytics encountered a malformed URL exception");
+ } catch (Exception var16) {
+ Analytics.this.i = true;
+ }
+
+ if(Analytics.this.i) {
+ RobotLog.i("Analytics encountered a problem during communication");
+ Analytics.this.a();
+ Analytics.this.i = false;
+ }
+ }
+
+ return null;
+ }
+ }
+}
diff --git a/FtcRobotController/Analytics/src/main/res/values/strings.xml b/FtcRobotController/Analytics/src/main/res/values/strings.xml
new file mode 100644
index 0000000..eb97911
--- /dev/null
+++ b/FtcRobotController/Analytics/src/main/res/values/strings.xml
@@ -0,0 +1,3 @@
+
+ Analytics
+
diff --git a/FtcRobotController/Analytics/src/test/java/com/qualcomm/analytics/ExampleUnitTest.java b/FtcRobotController/Analytics/src/test/java/com/qualcomm/analytics/ExampleUnitTest.java
new file mode 100644
index 0000000..564a41e
--- /dev/null
+++ b/FtcRobotController/Analytics/src/test/java/com/qualcomm/analytics/ExampleUnitTest.java
@@ -0,0 +1,15 @@
+package com.qualcomm.analytics;
+
+import org.junit.Test;
+
+import static org.junit.Assert.*;
+
+/**
+ * To work on unit tests, switch the Test Artifact in the Build Variants view.
+ */
+public class ExampleUnitTest {
+ @Test
+ public void addition_isCorrect() throws Exception {
+ assertEquals(4, 2 + 2);
+ }
+}
\ No newline at end of file
diff --git a/FtcRobotController/FtcCommon/.gitignore b/FtcRobotController/FtcCommon/.gitignore
new file mode 100644
index 0000000..796b96d
--- /dev/null
+++ b/FtcRobotController/FtcCommon/.gitignore
@@ -0,0 +1 @@
+/build
diff --git a/FtcRobotController/FtcCommon/FtcCommon.iml b/FtcRobotController/FtcCommon/FtcCommon.iml
new file mode 100644
index 0000000..90c3a72
--- /dev/null
+++ b/FtcRobotController/FtcCommon/FtcCommon.iml
@@ -0,0 +1,97 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ generateDebugAndroidTestSources
+ generateDebugSources
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/FtcRobotController/FtcCommon/build.gradle b/FtcRobotController/FtcCommon/build.gradle
new file mode 100644
index 0000000..984af3d
--- /dev/null
+++ b/FtcRobotController/FtcCommon/build.gradle
@@ -0,0 +1,32 @@
+apply plugin: 'com.android.library'
+
+android {
+ compileSdkVersion 22
+ buildToolsVersion '22.0.1'
+
+ defaultConfig {
+ minSdkVersion 19
+ targetSdkVersion 23
+ versionCode 1
+ versionName "1.0"
+ }
+ buildTypes {
+ release {
+ minifyEnabled false
+ proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
+ }
+ }
+ compileOptions {
+ sourceCompatibility JavaVersion.VERSION_1_7
+ targetCompatibility JavaVersion.VERSION_1_7
+ }
+}
+
+dependencies {
+ compile fileTree(include: ['*.jar'], dir: 'libs')
+ testCompile 'junit:junit:4.12'
+ compile project(':robotcore')
+ compile project(':ModernRobotics')
+ compile project(':WirelessP2p')
+ compile project(':Hardware')
+}
diff --git a/FtcRobotController/FtcCommon/proguard-rules.pro b/FtcRobotController/FtcCommon/proguard-rules.pro
new file mode 100644
index 0000000..db73af4
--- /dev/null
+++ b/FtcRobotController/FtcCommon/proguard-rules.pro
@@ -0,0 +1,17 @@
+# Add project specific ProGuard rules here.
+# By default, the flags in this file are appended to flags specified
+# in C:\Users\Public\Android\sdk/tools/proguard/proguard-android.txt
+# You can edit the include path and order by changing the proguardFiles
+# directive in build.gradle.
+#
+# For more details, see
+# http://developer.android.com/guide/developing/tools/proguard.html
+
+# Add any project specific keep options here:
+
+# If your project uses WebView with JS, uncomment the following
+# and specify the fully qualified class name to the JavaScript interface
+# class:
+#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
+# public *;
+#}
diff --git a/FtcRobotController/FtcCommon/src/androidTest/java/com/qualcomm/ftccommon/ApplicationTest.java b/FtcRobotController/FtcCommon/src/androidTest/java/com/qualcomm/ftccommon/ApplicationTest.java
new file mode 100644
index 0000000..91c1c09
--- /dev/null
+++ b/FtcRobotController/FtcCommon/src/androidTest/java/com/qualcomm/ftccommon/ApplicationTest.java
@@ -0,0 +1,13 @@
+package com.qualcomm.ftccommon;
+
+import android.app.Application;
+import android.test.ApplicationTestCase;
+
+/**
+ * Testing Fundamentals
+ */
+public class ApplicationTest extends ApplicationTestCase {
+ public ApplicationTest() {
+ super(Application.class);
+ }
+}
\ No newline at end of file
diff --git a/FtcRobotController/FtcCommon/src/main/AndroidManifest.xml b/FtcRobotController/FtcCommon/src/main/AndroidManifest.xml
new file mode 100644
index 0000000..649e4cd
--- /dev/null
+++ b/FtcRobotController/FtcCommon/src/main/AndroidManifest.xml
@@ -0,0 +1,9 @@
+
+
+
+
+
+
+
diff --git a/FtcRobotController/app/src/main/java/com/qualcomm/ftccommon/AboutActivity.java b/FtcRobotController/FtcCommon/src/main/java/com/qualcomm/ftccommon/AboutActivity.java
similarity index 76%
rename from FtcRobotController/app/src/main/java/com/qualcomm/ftccommon/AboutActivity.java
rename to FtcRobotController/FtcCommon/src/main/java/com/qualcomm/ftccommon/AboutActivity.java
index 91c1df3..f51c7bb 100644
--- a/FtcRobotController/app/src/main/java/com/qualcomm/ftccommon/AboutActivity.java
+++ b/FtcRobotController/FtcCommon/src/main/java/com/qualcomm/ftccommon/AboutActivity.java
@@ -1,123 +1,123 @@
-package com.qualcomm.ftccommon;
-
-import android.app.Activity;
-import android.content.Context;
-import android.content.pm.PackageManager.NameNotFoundException;
-import android.view.View;
-import android.view.ViewGroup;
-import android.widget.ArrayAdapter;
-import android.widget.ListView;
-import android.widget.TextView;
-import com.qualcomm.ftccommon.R;
-import com.qualcomm.robotcore.util.RobotLog;
-import com.qualcomm.robotcore.util.Version;
-import com.qualcomm.robotcore.wifi.WifiDirectAssistant;
-
-public class AboutActivity extends Activity {
- WifiDirectAssistant a = null;
-
- protected void onStart() {
- super.onStart();
- this.setContentView(R.layout.activity_about);
- ListView var1 = (ListView)this.findViewById(R.id.aboutList);
-
- try {
- this.a = WifiDirectAssistant.getWifiDirectAssistant((Context)null);
- this.a.enable();
- } catch (NullPointerException var3) {
- RobotLog.i("Cannot start Wifi Direct Assistant");
- this.a = null;
- }
-
- var1.setAdapter(new ArrayAdapter(this, 17367044, 16908308) {
- private AboutActivity.Item a() {
- AboutActivity.Item var1 = new AboutActivity.Item();
- var1.title = "App Version";
-
- try {
- var1.info = AboutActivity.this.getPackageManager().getPackageInfo(AboutActivity.this.getPackageName(), 0).versionName;
- return var1;
- } catch (NameNotFoundException var3) {
- var1.info = var3.getMessage();
- return var1;
- }
- }
-
- private AboutActivity.Item b() {
- AboutActivity.Item var1 = new AboutActivity.Item();
- var1.title = "Library Version";
- var1.info = Version.getLibraryVersion();
- return var1;
- }
-
- private AboutActivity.Item c() {
- AboutActivity.Item var1 = new AboutActivity.Item();
- var1.title = "Wifi Direct Information";
- var1.info = "unavailable";
- StringBuilder var2 = new StringBuilder();
- if(AboutActivity.this.a != null && AboutActivity.this.a.isEnabled()) {
- var2.append("Name: ").append(AboutActivity.this.a.getDeviceName());
- if(AboutActivity.this.a.isGroupOwner()) {
- var2.append("\nIP Address").append(AboutActivity.this.a.getGroupOwnerAddress().getHostAddress());
- var2.append("\nPassphrase: ").append(AboutActivity.this.a.getPassphrase());
- var2.append("\nGroup Owner");
- } else if(AboutActivity.this.a.isConnected()) {
- var2.append("\nGroup Owner: ").append(AboutActivity.this.a.getGroupOwnerName());
- var2.append("\nConnected");
- } else {
- var2.append("\nNo connection information");
- }
-
- var1.info = var2.toString();
- }
-
- return var1;
- }
-
- public AboutActivity.Item a(int var1) {
- switch(var1) {
- case 0:
- return this.a();
- case 1:
- return this.b();
- case 2:
- return this.c();
- default:
- return new AboutActivity.Item();
- }
- }
-
- public int getCount() {
- return 3;
- }
-
- // $FF: synthetic method
- public Object getItem(int var1) {
- return this.a(var1);
- }
-
- public View getView(int var1, View var2, ViewGroup var3) {
- View var4 = super.getView(var1, var2, var3);
- TextView var5 = (TextView)var4.findViewById(16908308);
- TextView var6 = (TextView)var4.findViewById(16908309);
- AboutActivity.Item var7 = this.a(var1);
- var5.setText(var7.title);
- var6.setText(var7.info);
- return var4;
- }
- });
- }
-
- protected void onStop() {
- super.onStop();
- if(this.a != null) {
- this.a.disable();
- }
-
- }
-
- public static class Item {
- public String info = "";
- public String title = "";
- }
-}
+package com.qualcomm.ftccommon;
+
+import android.app.Activity;
+import android.content.pm.PackageManager.NameNotFoundException;
+import android.view.View;
+import android.view.ViewGroup;
+import android.widget.ArrayAdapter;
+import android.widget.ListView;
+import android.widget.TextView;
+
+import com.qualcomm.robotcore.util.RobotLog;
+import com.qualcomm.robotcore.util.Version;
+import com.qualcomm.robotcore.wifi.WifiDirectAssistant;
+
+public class AboutActivity extends Activity {
+ WifiDirectAssistant a = null;
+
+ protected void onStart() {
+ super.onStart();
+ this.setContentView(R.layout.about);
+ ListView var1 = (ListView)this.findViewById(R.id.aboutList);
+
+ try {
+ this.a = WifiDirectAssistant.getWifiDirectAssistant(null);
+ this.a.enable();
+ } catch (NullPointerException var3) {
+ RobotLog.i("Cannot start Wifi Direct Assistant");
+ this.a = null;
+ }
+
+ var1.setAdapter(new ArrayAdapter(this, R.layout.about, R.id.aboutList) {
+ private Item a() {
+ Item var1 = new Item();
+ var1.title = "App Version";
+
+ try {
+ var1.info = AboutActivity.this.getPackageManager().getPackageInfo(AboutActivity.this.getPackageName(), 0).versionName;
+ return var1;
+ } catch (NameNotFoundException var3) {
+ var1.info = var3.getMessage();
+ return var1;
+ }
+ }
+
+ private Item b() {
+ Item var1 = new Item();
+ var1.title = "Library Version";
+ var1.info = Version.getLibraryVersion();
+ return var1;
+ }
+
+ private Item c() {
+ Item var1 = new Item();
+ var1.title = "Wifi Direct Information";
+ var1.info = "unavailable";
+ StringBuilder var2 = new StringBuilder();
+ if(AboutActivity.this.a != null && AboutActivity.this.a.isEnabled()) {
+ var2.append("Name: ").append(AboutActivity.this.a.getDeviceName());
+ if(AboutActivity.this.a.isGroupOwner()) {
+ var2.append("\nIP Address").append(AboutActivity.this.a.getGroupOwnerAddress().getHostAddress());
+ var2.append("\nPassphrase: ").append(AboutActivity.this.a.getPassphrase());
+ var2.append("\nGroup Owner");
+ } else if(AboutActivity.this.a.isConnected()) {
+ var2.append("\nGroup Owner: ").append(AboutActivity.this.a.getGroupOwnerName());
+ var2.append("\nConnected");
+ } else {
+ var2.append("\nNo connection information");
+ }
+
+ var1.info = var2.toString();
+ }
+
+ return var1;
+ }
+
+ public Item a(int var1) {
+ switch(var1) {
+ case 0:
+ return this.a();
+ case 1:
+ return this.b();
+ case 2:
+ return this.c();
+ default:
+ return new Item();
+ }
+ }
+
+ public int getCount() {
+ return 3;
+ }
+
+ // $FF: synthetic method
+ public Object getItem(int var1) {
+ return this.a(var1);
+ }
+
+ public View getView(int var1, View var2, ViewGroup var3) {
+ View var4 = super.getView(var1, var2, var3);
+ // todo: figure out what this actually is
+ TextView var5 = (TextView) var4.findViewById(R.id.textView);
+ TextView var6 = (TextView) var4.findViewById(R.id.textView1);
+ Item var7 = this.a(var1);
+ var5.setText(var7.title);
+ var6.setText(var7.info);
+ return var4;
+ }
+ });
+ }
+
+ protected void onStop() {
+ super.onStop();
+ if(this.a != null) {
+ this.a.disable();
+ }
+
+ }
+
+ public static class Item {
+ public String info = "";
+ public String title = "";
+ }
+}
diff --git a/FtcRobotController/app/src/main/java/com/qualcomm/ftccommon/CommandList.java b/FtcRobotController/FtcCommon/src/main/java/com/qualcomm/ftccommon/CommandList.java
similarity index 98%
rename from FtcRobotController/app/src/main/java/com/qualcomm/ftccommon/CommandList.java
rename to FtcRobotController/FtcCommon/src/main/java/com/qualcomm/ftccommon/CommandList.java
index bd8d650..7e06bd8 100644
--- a/FtcRobotController/app/src/main/java/com/qualcomm/ftccommon/CommandList.java
+++ b/FtcRobotController/FtcCommon/src/main/java/com/qualcomm/ftccommon/CommandList.java
@@ -1,11 +1,11 @@
-package com.qualcomm.ftccommon;
-
-public class CommandList {
- public static final String CMD_INIT_OP_MODE = "CMD_INIT_OP_MODE";
- public static final String CMD_INIT_OP_MODE_RESP = "CMD_INIT_OP_MODE_RESP";
- public static final String CMD_REQUEST_OP_MODE_LIST = "CMD_REQUEST_OP_MODE_LIST";
- public static final String CMD_REQUEST_OP_MODE_LIST_RESP = "CMD_REQUEST_OP_MODE_LIST_RESP";
- public static final String CMD_RESTART_ROBOT = "CMD_RESTART_ROBOT";
- public static final String CMD_RUN_OP_MODE = "CMD_RUN_OP_MODE";
- public static final String CMD_RUN_OP_MODE_RESP = "CMD_RUN_OP_MODE_RESP";
-}
+package com.qualcomm.ftccommon;
+
+public class CommandList {
+ public static final String CMD_INIT_OP_MODE = "CMD_INIT_OP_MODE";
+ public static final String CMD_INIT_OP_MODE_RESP = "CMD_INIT_OP_MODE_RESP";
+ public static final String CMD_REQUEST_OP_MODE_LIST = "CMD_REQUEST_OP_MODE_LIST";
+ public static final String CMD_REQUEST_OP_MODE_LIST_RESP = "CMD_REQUEST_OP_MODE_LIST_RESP";
+ public static final String CMD_RESTART_ROBOT = "CMD_RESTART_ROBOT";
+ public static final String CMD_RUN_OP_MODE = "CMD_RUN_OP_MODE";
+ public static final String CMD_RUN_OP_MODE_RESP = "CMD_RUN_OP_MODE_RESP";
+}
diff --git a/FtcRobotController/app/src/main/java/com/qualcomm/ftccommon/ConfigWifiDirectActivity.java b/FtcRobotController/FtcCommon/src/main/java/com/qualcomm/ftccommon/ConfigWifiDirectActivity.java
similarity index 92%
rename from FtcRobotController/app/src/main/java/com/qualcomm/ftccommon/ConfigWifiDirectActivity.java
rename to FtcRobotController/FtcCommon/src/main/java/com/qualcomm/ftccommon/ConfigWifiDirectActivity.java
index 387f814..547c233 100644
--- a/FtcRobotController/app/src/main/java/com/qualcomm/ftccommon/ConfigWifiDirectActivity.java
+++ b/FtcRobotController/FtcCommon/src/main/java/com/qualcomm/ftccommon/ConfigWifiDirectActivity.java
@@ -1,63 +1,63 @@
-package com.qualcomm.ftccommon;
-
-import android.app.Activity;
-import android.app.ProgressDialog;
-import android.content.Context;
-import android.net.wifi.WifiManager;
-import android.os.Bundle;
-import com.qualcomm.ftccommon.DbgLog;
-import com.qualcomm.ftccommon.R;
-import com.qualcomm.robotcore.wifi.FixWifiDirectSetup;
-
-public class ConfigWifiDirectActivity extends Activity {
- private ProgressDialog a;
- private Context b;
-
- protected void onCreate(Bundle var1) {
- super.onCreate(var1);
- this.setContentView(R.layout.activity_config_wifi_direct);
- this.b = this;
- }
-
- protected void onResume() {
- super.onResume();
- (new Thread(new ConfigWifiDirectActivity.a(null))).start();
- }
-
- private class a implements Runnable {
- private a() {
- }
-
- // $FF: synthetic method
- a(Object var2) {
- this();
- }
-
- public void run() {
- DbgLog.msg("attempting to reconfigure Wifi Direct");
- ConfigWifiDirectActivity.this.runOnUiThread(new Runnable() {
- public void run() {
- ConfigWifiDirectActivity.this.a = new ProgressDialog(ConfigWifiDirectActivity.this.b, R.style.CustomAlertDialog);
- ConfigWifiDirectActivity.this.a.setMessage("Please wait");
- ConfigWifiDirectActivity.this.a.setTitle("Configuring Wifi Direct");
- ConfigWifiDirectActivity.this.a.setIndeterminate(true);
- ConfigWifiDirectActivity.this.a.show();
- }
- });
- WifiManager var1 = (WifiManager)ConfigWifiDirectActivity.this.getSystemService("wifi");
-
- try {
- FixWifiDirectSetup.fixWifiDirectSetup(var1);
- } catch (InterruptedException var3) {
- DbgLog.msg("Cannot fix wifi setup - interrupted");
- }
-
- ConfigWifiDirectActivity.this.runOnUiThread(new Runnable() {
- public void run() {
- ConfigWifiDirectActivity.this.a.dismiss();
- ConfigWifiDirectActivity.this.finish();
- }
- });
- }
- }
-}
+package com.qualcomm.ftccommon;
+
+import android.app.Activity;
+import android.app.ProgressDialog;
+import android.content.Context;
+import android.net.wifi.WifiManager;
+import android.os.Bundle;
+
+import com.qualcomm.ftccommon.R;
+import com.qualcomm.robotcore.wifi.FixWifiDirectSetup;
+
+public class ConfigWifiDirectActivity extends Activity {
+ private ProgressDialog a;
+ private Context b;
+
+ protected void onCreate(Bundle var1) {
+ super.onCreate(var1);
+ this.setContentView(R.layout.activity_config_wifi_direct);
+ this.b = this;
+ }
+
+ protected void onResume() {
+ super.onResume();
+ (new Thread(new a(null))).start();
+ }
+
+ private class a implements Runnable {
+ private a() {
+ }
+
+ // $FF: synthetic method
+ a(Object var2) {
+ this();
+ }
+
+ public void run() {
+ DbgLog.msg("attempting to reconfigure Wifi Direct");
+ ConfigWifiDirectActivity.this.runOnUiThread(new Runnable() {
+ public void run() {
+ ConfigWifiDirectActivity.this.a = new ProgressDialog(ConfigWifiDirectActivity.this.b, R.style.CustomAlertDialog);
+ ConfigWifiDirectActivity.this.a.setMessage("Please wait");
+ ConfigWifiDirectActivity.this.a.setTitle("Configuring Wifi Direct");
+ ConfigWifiDirectActivity.this.a.setIndeterminate(true);
+ ConfigWifiDirectActivity.this.a.show();
+ }
+ });
+ WifiManager var1 = (WifiManager)ConfigWifiDirectActivity.this.getSystemService("wifi");
+
+ try {
+ FixWifiDirectSetup.fixWifiDirectSetup(var1);
+ } catch (InterruptedException var3) {
+ DbgLog.msg("Cannot fix wifi setup - interrupted");
+ }
+
+ ConfigWifiDirectActivity.this.runOnUiThread(new Runnable() {
+ public void run() {
+ ConfigWifiDirectActivity.this.a.dismiss();
+ ConfigWifiDirectActivity.this.finish();
+ }
+ });
+ }
+ }
+}
diff --git a/FtcRobotController/app/src/main/java/com/qualcomm/ftccommon/DbgLog.java b/FtcRobotController/FtcCommon/src/main/java/com/qualcomm/ftccommon/DbgLog.java
similarity index 95%
rename from FtcRobotController/app/src/main/java/com/qualcomm/ftccommon/DbgLog.java
rename to FtcRobotController/FtcCommon/src/main/java/com/qualcomm/ftccommon/DbgLog.java
index 0ea9744..81d2bb7 100644
--- a/FtcRobotController/app/src/main/java/com/qualcomm/ftccommon/DbgLog.java
+++ b/FtcRobotController/FtcCommon/src/main/java/com/qualcomm/ftccommon/DbgLog.java
@@ -1,27 +1,27 @@
-package com.qualcomm.ftccommon;
-
-import android.util.Log;
-
-public class DbgLog {
- public static final String ERROR_PREPEND = "### ERROR: ";
- public static final String TAG = "FIRST";
-
- public static void error(String var0) {
- Log.e("FIRST", "### ERROR: " + var0);
- }
-
- public static void logStacktrace(Exception var0) {
- msg(var0.toString());
- StackTraceElement[] var1 = var0.getStackTrace();
- int var2 = var1.length;
-
- for(int var3 = 0; var3 < var2; ++var3) {
- msg(var1[var3].toString());
- }
-
- }
-
- public static void msg(String var0) {
- Log.i("FIRST", var0);
- }
-}
+package com.qualcomm.ftccommon;
+
+import android.util.Log;
+
+public class DbgLog {
+ public static final String ERROR_PREPEND = "### ERROR: ";
+ public static final String TAG = "FIRST";
+
+ public static void error(String var0) {
+ Log.e("FIRST", "### ERROR: " + var0);
+ }
+
+ public static void logStacktrace(Exception var0) {
+ msg(var0.toString());
+ StackTraceElement[] var1 = var0.getStackTrace();
+ int var2 = var1.length;
+
+ for(int var3 = 0; var3 < var2; ++var3) {
+ msg(var1[var3].toString());
+ }
+
+ }
+
+ public static void msg(String var0) {
+ Log.i("FIRST", var0);
+ }
+}
diff --git a/FtcRobotController/app/src/main/java/com/qualcomm/ftccommon/Device.java b/FtcRobotController/FtcCommon/src/main/java/com/qualcomm/ftccommon/Device.java
similarity index 97%
rename from FtcRobotController/app/src/main/java/com/qualcomm/ftccommon/Device.java
rename to FtcRobotController/FtcCommon/src/main/java/com/qualcomm/ftccommon/Device.java
index 83553e8..6290b00 100644
--- a/FtcRobotController/app/src/main/java/com/qualcomm/ftccommon/Device.java
+++ b/FtcRobotController/FtcCommon/src/main/java/com/qualcomm/ftccommon/Device.java
@@ -1,7 +1,7 @@
-package com.qualcomm.ftccommon;
-
-public class Device {
- public static final String MANUFACTURER_ZTE = "zte";
- public static final String MODEL_FOXDA_FL7007 = "FL7007";
- public static final String MODEL_ZTE_SPEED = "N9130";
-}
+package com.qualcomm.ftccommon;
+
+public class Device {
+ public static final String MANUFACTURER_ZTE = "zte";
+ public static final String MODEL_FOXDA_FL7007 = "FL7007";
+ public static final String MODEL_ZTE_SPEED = "N9130";
+}
diff --git a/FtcRobotController/app/src/main/java/com/qualcomm/ftccommon/FtcEventLoop.java b/FtcRobotController/FtcCommon/src/main/java/com/qualcomm/ftccommon/FtcEventLoop.java
similarity index 93%
rename from FtcRobotController/app/src/main/java/com/qualcomm/ftccommon/FtcEventLoop.java
rename to FtcRobotController/FtcCommon/src/main/java/com/qualcomm/ftccommon/FtcEventLoop.java
index e229d4c..42ade36 100644
--- a/FtcRobotController/app/src/main/java/com/qualcomm/ftccommon/FtcEventLoop.java
+++ b/FtcRobotController/FtcCommon/src/main/java/com/qualcomm/ftccommon/FtcEventLoop.java
@@ -1,112 +1,111 @@
-package com.qualcomm.ftccommon;
-
-import android.content.Context;
-import com.qualcomm.ftccommon.DbgLog;
-import com.qualcomm.ftccommon.FtcEventLoopHandler;
-import com.qualcomm.ftccommon.UpdateUI;
-import com.qualcomm.modernrobotics.ModernRoboticsUsbUtil;
-import com.qualcomm.robotcore.eventloop.EventLoop;
-import com.qualcomm.robotcore.eventloop.EventLoopManager;
-import com.qualcomm.robotcore.eventloop.opmode.OpModeManager;
-import com.qualcomm.robotcore.eventloop.opmode.OpModeRegister;
-import com.qualcomm.robotcore.exception.RobotCoreException;
-import com.qualcomm.robotcore.hardware.Gamepad;
-import com.qualcomm.robotcore.hardware.HardwareFactory;
-import com.qualcomm.robotcore.hardware.HardwareMap;
-import com.qualcomm.robotcore.robocol.Command;
-import com.qualcomm.robotcore.util.Util;
-import java.util.Iterator;
-
-public class FtcEventLoop implements EventLoop {
- FtcEventLoopHandler a;
- OpModeManager b = new OpModeManager(new HardwareMap());
- OpModeRegister c;
-
- public FtcEventLoop(HardwareFactory var1, OpModeRegister var2, UpdateUI.Callback var3, Context var4) {
- this.a = new FtcEventLoopHandler(var1, var3, var4);
- this.c = var2;
- }
-
- private void a() {
- this.a.restartRobot();
- }
-
- private void a(String var1) {
- String var2 = this.a.getOpMode(var1);
- this.b.initActiveOpMode(var2);
- this.a.sendCommand(new Command("CMD_INIT_OP_MODE_RESP", var2));
- }
-
- private void b() {
- String var1 = "";
- Iterator var2 = this.b.getOpModes().iterator();
-
- while(var2.hasNext()) {
- String var3 = (String)var2.next();
- if(!var3.equals("Stop Robot")) {
- if(!var1.isEmpty()) {
- var1 = var1 + Util.ASCII_RECORD_SEPARATOR;
- }
-
- var1 = var1 + var3;
- }
- }
-
- this.a.sendCommand(new Command("CMD_REQUEST_OP_MODE_LIST_RESP", var1));
- }
-
- private void c() {
- this.b.startActiveOpMode();
- this.a.sendCommand(new Command("CMD_RUN_OP_MODE_RESP", this.b.getActiveOpModeName()));
- }
-
- public OpModeManager getOpModeManager() {
- return this.b;
- }
-
- public void init(EventLoopManager var1) throws RobotCoreException, InterruptedException {
- DbgLog.msg("======= INIT START =======");
- this.b.registerOpModes(this.c);
- this.a.init(var1);
- HardwareMap var2 = this.a.getHardwareMap();
- ModernRoboticsUsbUtil.init(var2.appContext, var2);
- this.b.setHardwareMap(var2);
- var2.logDevices();
- DbgLog.msg("======= INIT FINISH =======");
- }
-
- public void loop() throws RobotCoreException {
- this.a.displayGamePadInfo(this.b.getActiveOpModeName());
- Gamepad[] var1 = this.a.getGamepads();
- this.b.runActiveOpMode(var1);
- this.a.sendTelemetryData(this.b.getActiveOpMode().telemetry);
- }
-
- public void processCommand(Command var1) {
- DbgLog.msg("Processing Command: " + var1.getName() + " " + var1.getExtra());
- this.a.sendBatteryInfo();
- String var2 = var1.getName();
- String var3 = var1.getExtra();
- if(var2.equals("CMD_RESTART_ROBOT")) {
- this.a();
- } else if(var2.equals("CMD_REQUEST_OP_MODE_LIST")) {
- this.b();
- } else if(var2.equals("CMD_INIT_OP_MODE")) {
- this.a(var3);
- } else if(var2.equals("CMD_RUN_OP_MODE")) {
- this.c();
- } else {
- DbgLog.msg("Unknown command: " + var2);
- }
- }
-
- public void teardown() throws RobotCoreException {
- DbgLog.msg("======= TEARDOWN =======");
- this.b.stopActiveOpMode();
- this.a.shutdownMotorControllers();
- this.a.shutdownServoControllers();
- this.a.shutdownLegacyModules();
- this.a.shutdownCoreInterfaceDeviceModules();
- DbgLog.msg("======= TEARDOWN COMPLETE =======");
- }
-}
+package com.qualcomm.ftccommon;
+
+import android.content.Context;
+
+import com.qualcomm.modernrobotics.ModernRoboticsUsbUtil;
+import com.qualcomm.robotcore.eventloop.EventLoop;
+import com.qualcomm.robotcore.eventloop.EventLoopManager;
+import com.qualcomm.robotcore.eventloop.opmode.OpModeManager;
+import com.qualcomm.robotcore.eventloop.opmode.OpModeRegister;
+import com.qualcomm.robotcore.exception.RobotCoreException;
+import com.qualcomm.robotcore.hardware.Gamepad;
+import com.qualcomm.robotcore.hardware.HardwareFactory;
+import com.qualcomm.robotcore.hardware.HardwareMap;
+import com.qualcomm.robotcore.robocol.Command;
+import com.qualcomm.robotcore.util.Util;
+
+import java.util.Iterator;
+
+public class FtcEventLoop implements EventLoop {
+ FtcEventLoopHandler a;
+ OpModeManager b = new OpModeManager(new HardwareMap());
+ OpModeRegister c;
+
+ public FtcEventLoop(HardwareFactory var1, OpModeRegister var2, UpdateUI.Callback var3, Context var4) {
+ this.a = new FtcEventLoopHandler(var1, var3, var4);
+ this.c = var2;
+ }
+
+ private void a() {
+ this.a.restartRobot();
+ }
+
+ private void a(String var1) {
+ String var2 = this.a.getOpMode(var1);
+ this.b.initActiveOpMode(var2);
+ this.a.sendCommand(new Command("CMD_INIT_OP_MODE_RESP", var2));
+ }
+
+ private void b() {
+ String var1 = "";
+ Iterator var2 = this.b.getOpModes().iterator();
+
+ while(var2.hasNext()) {
+ String var3 = (String)var2.next();
+ if(!var3.equals("Stop Robot")) {
+ if(!var1.isEmpty()) {
+ var1 = var1 + Util.ASCII_RECORD_SEPARATOR;
+ }
+
+ var1 = var1 + var3;
+ }
+ }
+
+ this.a.sendCommand(new Command("CMD_REQUEST_OP_MODE_LIST_RESP", var1));
+ }
+
+ private void c() {
+ this.b.startActiveOpMode();
+ this.a.sendCommand(new Command("CMD_RUN_OP_MODE_RESP", this.b.getActiveOpModeName()));
+ }
+
+ public OpModeManager getOpModeManager() {
+ return this.b;
+ }
+
+ public void init(EventLoopManager var1) throws RobotCoreException, InterruptedException {
+ DbgLog.msg("======= INIT START =======");
+ this.b.registerOpModes(this.c);
+ this.a.init(var1);
+ HardwareMap var2 = this.a.getHardwareMap();
+ ModernRoboticsUsbUtil.init(var2.appContext, var2);
+ this.b.setHardwareMap(var2);
+ var2.logDevices();
+ DbgLog.msg("======= INIT FINISH =======");
+ }
+
+ public void loop() throws RobotCoreException {
+ this.a.displayGamePadInfo(this.b.getActiveOpModeName());
+ Gamepad[] var1 = this.a.getGamepads();
+ this.b.runActiveOpMode(var1);
+ this.a.sendTelemetryData(this.b.getActiveOpMode().telemetry);
+ }
+
+ public void processCommand(Command var1) {
+ DbgLog.msg("Processing Command: " + var1.getName() + " " + var1.getExtra());
+ this.a.sendBatteryInfo();
+ String var2 = var1.getName();
+ String var3 = var1.getExtra();
+ if(var2.equals("CMD_RESTART_ROBOT")) {
+ this.a();
+ } else if(var2.equals("CMD_REQUEST_OP_MODE_LIST")) {
+ this.b();
+ } else if(var2.equals("CMD_INIT_OP_MODE")) {
+ this.a(var3);
+ } else if(var2.equals("CMD_RUN_OP_MODE")) {
+ this.c();
+ } else {
+ DbgLog.msg("Unknown command: " + var2);
+ }
+ }
+
+ public void teardown() throws RobotCoreException {
+ DbgLog.msg("======= TEARDOWN =======");
+ this.b.stopActiveOpMode();
+ this.a.shutdownMotorControllers();
+ this.a.shutdownServoControllers();
+ this.a.shutdownLegacyModules();
+ this.a.shutdownCoreInterfaceDeviceModules();
+ DbgLog.msg("======= TEARDOWN COMPLETE =======");
+ }
+}
diff --git a/FtcRobotController/app/src/main/java/com/qualcomm/ftccommon/FtcEventLoopHandler.java b/FtcRobotController/FtcCommon/src/main/java/com/qualcomm/ftccommon/FtcEventLoopHandler.java
similarity index 95%
rename from FtcRobotController/app/src/main/java/com/qualcomm/ftccommon/FtcEventLoopHandler.java
rename to FtcRobotController/FtcCommon/src/main/java/com/qualcomm/ftccommon/FtcEventLoopHandler.java
index 6dce199..d0d5a1e 100644
--- a/FtcRobotController/app/src/main/java/com/qualcomm/ftccommon/FtcEventLoopHandler.java
+++ b/FtcRobotController/FtcCommon/src/main/java/com/qualcomm/ftccommon/FtcEventLoopHandler.java
@@ -1,191 +1,191 @@
-package com.qualcomm.ftccommon;
-
-import android.content.Context;
-import com.qualcomm.ftccommon.DbgLog;
-import com.qualcomm.ftccommon.UpdateUI;
-import com.qualcomm.robotcore.eventloop.EventLoopManager;
-import com.qualcomm.robotcore.exception.RobotCoreException;
-import com.qualcomm.robotcore.hardware.DcMotorController;
-import com.qualcomm.robotcore.hardware.DeviceInterfaceModule;
-import com.qualcomm.robotcore.hardware.Gamepad;
-import com.qualcomm.robotcore.hardware.HardwareFactory;
-import com.qualcomm.robotcore.hardware.HardwareMap;
-import com.qualcomm.robotcore.hardware.LegacyModule;
-import com.qualcomm.robotcore.hardware.ServoController;
-import com.qualcomm.robotcore.hardware.VoltageSensor;
-import com.qualcomm.robotcore.robocol.Command;
-import com.qualcomm.robotcore.robocol.Telemetry;
-import com.qualcomm.robotcore.robot.RobotState;
-import com.qualcomm.robotcore.util.BatteryChecker;
-import com.qualcomm.robotcore.util.ElapsedTime;
-import java.math.BigDecimal;
-import java.math.RoundingMode;
-import java.util.Iterator;
-import java.util.Map.Entry;
-
-public class FtcEventLoopHandler implements BatteryChecker.BatteryWatcher {
- public static final String NO_VOLTAGE_SENSOR = "no voltage sensor found";
- EventLoopManager a;
- BatteryChecker b;
- Context c;
- ElapsedTime d = new ElapsedTime();
- double e = 0.25D;
- UpdateUI.Callback f;
- HardwareFactory g;
- HardwareMap h = new HardwareMap();
-
- public FtcEventLoopHandler(HardwareFactory var1, UpdateUI.Callback var2, Context var3) {
- this.g = var1;
- this.f = var2;
- this.c = var3;
- this.b = new BatteryChecker(var3, this, 180000L);
- this.b.startBatteryMonitoring();
- }
-
- private void a() {
- this.sendTelemetry("RobotController Battery Level", String.valueOf(this.b.getBatteryLevel()));
- }
-
- private void b() {
- Iterator var1 = this.h.voltageSensor.iterator();
-
- double var2;
- double var6;
- for(var2 = Double.MAX_VALUE; var1.hasNext(); var2 = var6) {
- VoltageSensor var5 = (VoltageSensor)var1.next();
- if(var5.getVoltage() < var2) {
- var6 = var5.getVoltage();
- } else {
- var6 = var2;
- }
- }
-
- String var4;
- if(this.h.voltageSensor.size() == 0) {
- var4 = "no voltage sensor found";
- } else {
- var4 = String.valueOf((new BigDecimal(var2)).setScale(2, RoundingMode.HALF_UP).doubleValue());
- }
-
- this.sendTelemetry("Robot Battery Level", var4);
- }
-
- public void displayGamePadInfo(String var1) {
- Gamepad[] var2 = this.a.getGamepads();
- this.f.updateUi(var1, var2);
- }
-
- public Gamepad[] getGamepads() {
- return this.a.getGamepads();
- }
-
- public HardwareMap getHardwareMap() throws RobotCoreException, InterruptedException {
- this.h = this.g.createHardwareMap(this.a);
- return this.h;
- }
-
- public String getOpMode(String var1) {
- if(this.a.state != RobotState.RUNNING) {
- var1 = "Stop Robot";
- }
-
- return var1;
- }
-
- public void init(EventLoopManager var1) {
- this.a = var1;
- }
-
- public void restartRobot() {
- this.b.endBatteryMonitoring();
- this.f.restartRobot();
- }
-
- public void sendBatteryInfo() {
- this.a();
- this.b();
- }
-
- public void sendCommand(Command var1) {
- this.a.sendCommand(var1);
- }
-
- public void sendTelemetry(String var1, String var2) {
- Telemetry var3 = new Telemetry();
- var3.setTag(var1);
- var3.addData(var1, var2);
- if(this.a != null) {
- this.a.sendTelemetryData(var3);
- var3.clearData();
- }
-
- }
-
- public void sendTelemetryData(Telemetry var1) {
- if(this.d.time() > this.e) {
- this.d.reset();
- if(var1.hasData()) {
- this.a.sendTelemetryData(var1);
- }
-
- var1.clearData();
- }
-
- }
-
- public void shutdownCoreInterfaceDeviceModules() {
- Iterator var1 = this.h.deviceInterfaceModule.entrySet().iterator();
-
- while(var1.hasNext()) {
- Entry var2 = (Entry)var1.next();
- String var3 = (String)var2.getKey();
- DeviceInterfaceModule var4 = (DeviceInterfaceModule)var2.getValue();
- DbgLog.msg("Stopping Core Interface Device Module " + var3);
- var4.close();
- }
-
- }
-
- public void shutdownLegacyModules() {
- Iterator var1 = this.h.legacyModule.entrySet().iterator();
-
- while(var1.hasNext()) {
- Entry var2 = (Entry)var1.next();
- String var3 = (String)var2.getKey();
- LegacyModule var4 = (LegacyModule)var2.getValue();
- DbgLog.msg("Stopping Legacy Module " + var3);
- var4.close();
- }
-
- }
-
- public void shutdownMotorControllers() {
- Iterator var1 = this.h.dcMotorController.entrySet().iterator();
-
- while(var1.hasNext()) {
- Entry var2 = (Entry)var1.next();
- String var3 = (String)var2.getKey();
- DcMotorController var4 = (DcMotorController)var2.getValue();
- DbgLog.msg("Stopping DC Motor Controller " + var3);
- var4.close();
- }
-
- }
-
- public void shutdownServoControllers() {
- Iterator var1 = this.h.servoController.entrySet().iterator();
-
- while(var1.hasNext()) {
- Entry var2 = (Entry)var1.next();
- String var3 = (String)var2.getKey();
- ServoController var4 = (ServoController)var2.getValue();
- DbgLog.msg("Stopping Servo Controller " + var3);
- var4.close();
- }
-
- }
-
- public void updateBatteryLevel(float var1) {
- this.sendTelemetry("RobotController Battery Level", String.valueOf(var1));
- }
-}
+package com.qualcomm.ftccommon;
+
+import android.content.Context;
+
+import com.qualcomm.robotcore.eventloop.EventLoopManager;
+import com.qualcomm.robotcore.exception.RobotCoreException;
+import com.qualcomm.robotcore.hardware.DcMotorController;
+import com.qualcomm.robotcore.hardware.DeviceInterfaceModule;
+import com.qualcomm.robotcore.hardware.Gamepad;
+import com.qualcomm.robotcore.hardware.HardwareFactory;
+import com.qualcomm.robotcore.hardware.HardwareMap;
+import com.qualcomm.robotcore.hardware.LegacyModule;
+import com.qualcomm.robotcore.hardware.ServoController;
+import com.qualcomm.robotcore.hardware.VoltageSensor;
+import com.qualcomm.robotcore.robocol.Command;
+import com.qualcomm.robotcore.robocol.Telemetry;
+import com.qualcomm.robotcore.robot.RobotState;
+import com.qualcomm.robotcore.util.BatteryChecker;
+import com.qualcomm.robotcore.util.ElapsedTime;
+
+import java.math.BigDecimal;
+import java.math.RoundingMode;
+import java.util.Iterator;
+import java.util.Map.Entry;
+
+public class FtcEventLoopHandler implements BatteryChecker.BatteryWatcher {
+ public static final String NO_VOLTAGE_SENSOR = "no voltage sensor found";
+ EventLoopManager a;
+ BatteryChecker b;
+ Context c;
+ ElapsedTime d = new ElapsedTime();
+ double e = 0.25D;
+ UpdateUI.Callback f;
+ HardwareFactory g;
+ HardwareMap h = new HardwareMap();
+
+ public FtcEventLoopHandler(HardwareFactory var1, UpdateUI.Callback var2, Context var3) {
+ this.g = var1;
+ this.f = var2;
+ this.c = var3;
+ this.b = new BatteryChecker(var3, this, 180000L);
+ this.b.startBatteryMonitoring();
+ }
+
+ private void a() {
+ this.sendTelemetry("RobotController Battery Level", String.valueOf(this.b.getBatteryLevel()));
+ }
+
+ private void b() {
+ Iterator var1 = this.h.voltageSensor.iterator();
+
+ double var2;
+ double var6;
+ for(var2 = Double.MAX_VALUE; var1.hasNext(); var2 = var6) {
+ VoltageSensor var5 = (VoltageSensor)var1.next();
+ if(var5.getVoltage() < var2) {
+ var6 = var5.getVoltage();
+ } else {
+ var6 = var2;
+ }
+ }
+
+ String var4;
+ if(this.h.voltageSensor.size() == 0) {
+ var4 = "no voltage sensor found";
+ } else {
+ var4 = String.valueOf((new BigDecimal(var2)).setScale(2, RoundingMode.HALF_UP).doubleValue());
+ }
+
+ this.sendTelemetry("Robot Battery Level", var4);
+ }
+
+ public void displayGamePadInfo(String var1) {
+ Gamepad[] var2 = this.a.getGamepads();
+ this.f.updateUi(var1, var2);
+ }
+
+ public Gamepad[] getGamepads() {
+ return this.a.getGamepads();
+ }
+
+ public HardwareMap getHardwareMap() throws RobotCoreException, InterruptedException {
+ this.h = this.g.createHardwareMap(this.a);
+ return this.h;
+ }
+
+ public String getOpMode(String var1) {
+ if(this.a.state != RobotState.RUNNING) {
+ var1 = "Stop Robot";
+ }
+
+ return var1;
+ }
+
+ public void init(EventLoopManager var1) {
+ this.a = var1;
+ }
+
+ public void restartRobot() {
+ this.b.endBatteryMonitoring();
+ this.f.restartRobot();
+ }
+
+ public void sendBatteryInfo() {
+ this.a();
+ this.b();
+ }
+
+ public void sendCommand(Command var1) {
+ this.a.sendCommand(var1);
+ }
+
+ public void sendTelemetry(String var1, String var2) {
+ Telemetry var3 = new Telemetry();
+ var3.setTag(var1);
+ var3.addData(var1, var2);
+ if(this.a != null) {
+ this.a.sendTelemetryData(var3);
+ var3.clearData();
+ }
+
+ }
+
+ public void sendTelemetryData(Telemetry var1) {
+ if(this.d.time() > this.e) {
+ this.d.reset();
+ if(var1.hasData()) {
+ this.a.sendTelemetryData(var1);
+ }
+
+ var1.clearData();
+ }
+
+ }
+
+ public void shutdownCoreInterfaceDeviceModules() {
+ Iterator var1 = this.h.deviceInterfaceModule.entrySet().iterator();
+
+ while(var1.hasNext()) {
+ Entry var2 = (Entry)var1.next();
+ String var3 = (String)var2.getKey();
+ DeviceInterfaceModule var4 = (DeviceInterfaceModule)var2.getValue();
+ DbgLog.msg("Stopping Core Interface Device Module " + var3);
+ var4.close();
+ }
+
+ }
+
+ public void shutdownLegacyModules() {
+ Iterator var1 = this.h.legacyModule.entrySet().iterator();
+
+ while(var1.hasNext()) {
+ Entry var2 = (Entry)var1.next();
+ String var3 = (String)var2.getKey();
+ LegacyModule var4 = (LegacyModule)var2.getValue();
+ DbgLog.msg("Stopping Legacy Module " + var3);
+ var4.close();
+ }
+
+ }
+
+ public void shutdownMotorControllers() {
+ Iterator var1 = this.h.dcMotorController.entrySet().iterator();
+
+ while(var1.hasNext()) {
+ Entry var2 = (Entry)var1.next();
+ String var3 = (String)var2.getKey();
+ DcMotorController var4 = (DcMotorController)var2.getValue();
+ DbgLog.msg("Stopping DC Motor Controller " + var3);
+ var4.close();
+ }
+
+ }
+
+ public void shutdownServoControllers() {
+ Iterator var1 = this.h.servoController.entrySet().iterator();
+
+ while(var1.hasNext()) {
+ Entry var2 = (Entry)var1.next();
+ String var3 = (String)var2.getKey();
+ ServoController var4 = (ServoController)var2.getValue();
+ DbgLog.msg("Stopping Servo Controller " + var3);
+ var4.close();
+ }
+
+ }
+
+ public void updateBatteryLevel(float var1) {
+ this.sendTelemetry("RobotController Battery Level", String.valueOf(var1));
+ }
+}
diff --git a/FtcRobotController/app/src/main/java/com/qualcomm/ftccommon/FtcRobotControllerService.java b/FtcRobotController/FtcCommon/src/main/java/com/qualcomm/ftccommon/FtcRobotControllerService.java
similarity index 91%
rename from FtcRobotController/app/src/main/java/com/qualcomm/ftccommon/FtcRobotControllerService.java
rename to FtcRobotController/FtcCommon/src/main/java/com/qualcomm/ftccommon/FtcRobotControllerService.java
index 9491498..93c5ad3 100644
--- a/FtcRobotController/app/src/main/java/com/qualcomm/ftccommon/FtcRobotControllerService.java
+++ b/FtcRobotController/FtcCommon/src/main/java/com/qualcomm/ftccommon/FtcRobotControllerService.java
@@ -1,253 +1,254 @@
-//
-// Source code recreated from a .class file by IntelliJ IDEA
-// (powered by Fernflower decompiler)
-//
-
-package com.qualcomm.ftccommon;
-
-import android.app.Service;
-import android.content.Intent;
-import android.os.Binder;
-import android.os.Build;
-import android.os.IBinder;
-import com.qualcomm.ftccommon.DbgLog;
-import com.qualcomm.ftccommon.UpdateUI.Callback;
-import com.qualcomm.robotcore.eventloop.EventLoop;
-import com.qualcomm.robotcore.eventloop.EventLoopManager.EventLoopMonitor;
-import com.qualcomm.robotcore.exception.RobotCoreException;
-import com.qualcomm.robotcore.factory.RobotFactory;
-import com.qualcomm.robotcore.robot.Robot;
-import com.qualcomm.robotcore.robot.RobotState;
-import com.qualcomm.robotcore.util.ElapsedTime;
-import com.qualcomm.robotcore.util.RobotLog;
-import com.qualcomm.robotcore.wifi.WifiDirectAssistant;
-import com.qualcomm.robotcore.wifi.WifiDirectAssistant.Event;
-import com.qualcomm.robotcore.wifi.WifiDirectAssistant.WifiDirectAssistantCallback;
-import java.lang.Thread.State;
-import java.net.InetAddress;
-
-public class FtcRobotControllerService extends Service implements WifiDirectAssistantCallback {
- private final IBinder a = new FtcRobotControllerService.FtcRobotControllerBinder();
- private WifiDirectAssistant b;
- private Robot c;
- private EventLoop d;
- private Event e;
- private String f;
- private Callback g;
- private final FtcRobotControllerService.a h;
- private final ElapsedTime i;
- private Thread j;
-
- public FtcRobotControllerService() {
- this.e = Event.DISCONNECTED;
- this.f = "Robot Status: null";
- this.g = null;
- this.h = new FtcRobotControllerService.a((FtcRobotControllerService.SyntheticClass_1)null);
- this.i = new ElapsedTime();
- this.j = null;
- }
-
- public WifiDirectAssistant getWifiDirectAssistant() {
- return this.b;
- }
-
- public Event getWifiDirectStatus() {
- return this.e;
- }
-
- public String getRobotStatus() {
- return this.f;
- }
-
- public IBinder onBind(Intent intent) {
- DbgLog.msg("Starting FTC Controller Service");
- DbgLog.msg("Android device is " + Build.MANUFACTURER + ", " + Build.MODEL);
- this.b = WifiDirectAssistant.getWifiDirectAssistant(this);
- this.b.setCallback(this);
- this.b.enable();
- if(Build.MODEL.equals("FL7007")) {
- this.b.discoverPeers();
- } else {
- this.b.createGroup();
- }
-
- return this.a;
- }
-
- public boolean onUnbind(Intent intent) {
- DbgLog.msg("Stopping FTC Controller Service");
- this.b.disable();
- this.shutdownRobot();
- return false;
- }
-
- public synchronized void setCallback(Callback callback) {
- this.g = callback;
- }
-
- public synchronized void setupRobot(EventLoop eventLoop) {
- if(this.j != null && this.j.isAlive()) {
- DbgLog.msg("FtcRobotControllerService.setupRobot() is currently running, stopping old setup");
- this.j.interrupt();
-
- while(this.j.isAlive()) {
- Thread.yield();
- }
-
- DbgLog.msg("Old setup stopped; restarting setup");
- }
-
- RobotLog.clearGlobalErrorMsg();
- DbgLog.msg("Processing robot setup");
- this.d = eventLoop;
- this.j = new Thread(new FtcRobotControllerService.b((FtcRobotControllerService.SyntheticClass_1)null), "Robot Setup");
- this.j.start();
-
- while(this.j.getState() == State.NEW) {
- Thread.yield();
- }
-
- }
-
- public synchronized void shutdownRobot() {
- if(this.j != null && this.j.isAlive()) {
- this.j.interrupt();
- }
-
- if(this.c != null) {
- this.c.shutdown();
- }
-
- this.c = null;
- this.a("Robot Status: null");
- }
-
- public void onWifiDirectEvent(Event event) {
- switch(FtcRobotControllerService.SyntheticClass_1.b[event.ordinal()]) {
- case 1:
- DbgLog.msg("Wifi Direct - Group Owner");
- this.b.cancelDiscoverPeers();
- break;
- case 2:
- DbgLog.error("Wifi Direct - connected as peer, was expecting Group Owner");
- break;
- case 3:
- DbgLog.msg("Wifi Direct Passphrase: " + this.b.getPassphrase());
- break;
- case 4:
- DbgLog.error("Wifi Direct Error: " + this.b.getFailureReason());
- }
-
- this.a(event);
- }
-
- private void a(Event var1) {
- this.e = var1;
- if(this.g != null) {
- this.g.wifiDirectUpdate(this.e);
- }
-
- }
-
- private void a(String var1) {
- this.f = var1;
- if(this.g != null) {
- this.g.robotUpdate(var1);
- }
-
- }
-
- private class b implements Runnable {
- private b() {
- }
-
- public void run() {
- try {
- if(FtcRobotControllerService.this.c != null) {
- FtcRobotControllerService.this.c.shutdown();
- FtcRobotControllerService.this.c = null;
- }
-
- FtcRobotControllerService.this.a("Robot Status: scanning for USB devices");
-
- try {
- Thread.sleep(2000L);
- } catch (InterruptedException var4) {
- FtcRobotControllerService.this.a("Robot Status: abort due to interrupt");
- return;
- }
-
- FtcRobotControllerService.this.c = RobotFactory.createRobot();
- FtcRobotControllerService.this.a("Robot Status: waiting on network");
- FtcRobotControllerService.this.i.reset();
-
- while(!FtcRobotControllerService.this.b.isConnected()) {
- try {
- Thread.sleep(1000L);
- if(FtcRobotControllerService.this.i.time() > 120.0D) {
- FtcRobotControllerService.this.a("Robot Status: network timed out");
- return;
- }
- } catch (InterruptedException var3) {
- DbgLog.msg("interrupt waiting for network; aborting setup");
- return;
- }
- }
-
- FtcRobotControllerService.this.a("Robot Status: starting robot");
-
- try {
- FtcRobotControllerService.this.c.eventLoopManager.setMonitor(FtcRobotControllerService.this.h);
- InetAddress var1 = FtcRobotControllerService.this.b.getGroupOwnerAddress();
- FtcRobotControllerService.this.c.start(var1, FtcRobotControllerService.this.d);
- } catch (RobotCoreException var2) {
- FtcRobotControllerService.this.a("Robot Status: failed to start robot");
- RobotLog.setGlobalErrorMsg(var2.getMessage());
- }
- } catch (RobotCoreException var5) {
- FtcRobotControllerService.this.a("Robot Status: Unable to create robot!");
- RobotLog.setGlobalErrorMsg(var5.getMessage());
- }
-
- }
- }
-
- private class a implements EventLoopMonitor {
- private a() {
- }
-
- public void onStateChange(RobotState state) {
- if(FtcRobotControllerService.this.g != null) {
- switch(FtcRobotControllerService.SyntheticClass_1.a[state.ordinal()]) {
- case 1:
- FtcRobotControllerService.this.g.robotUpdate("Robot Status: init");
- break;
- case 2:
- FtcRobotControllerService.this.g.robotUpdate("Robot Status: not started");
- break;
- case 3:
- FtcRobotControllerService.this.g.robotUpdate("Robot Status: running");
- break;
- case 4:
- FtcRobotControllerService.this.g.robotUpdate("Robot Status: stopped");
- break;
- case 5:
- FtcRobotControllerService.this.g.robotUpdate("Robot Status: EMERGENCY STOP");
- break;
- case 6:
- FtcRobotControllerService.this.g.robotUpdate("Robot Status: dropped connection");
- }
-
- }
- }
- }
-
- public class FtcRobotControllerBinder extends Binder {
- public FtcRobotControllerBinder() {
- }
-
- public FtcRobotControllerService getService() {
- return FtcRobotControllerService.this;
- }
- }
-}
+//
+// Source code recreated from a .class file by IntelliJ IDEA
+// (powered by Fernflower decompiler)
+//
+
+package com.qualcomm.ftccommon;
+
+import android.app.Service;
+import android.content.Intent;
+import android.os.Binder;
+import android.os.Build;
+import android.os.IBinder;
+
+import com.qualcomm.ftccommon.UpdateUI.Callback;
+import com.qualcomm.robotcore.eventloop.EventLoop;
+import com.qualcomm.robotcore.eventloop.EventLoopManager.EventLoopMonitor;
+import com.qualcomm.robotcore.exception.RobotCoreException;
+import com.qualcomm.robotcore.factory.RobotFactory;
+import com.qualcomm.robotcore.robot.Robot;
+import com.qualcomm.robotcore.robot.RobotState;
+import com.qualcomm.robotcore.util.ElapsedTime;
+import com.qualcomm.robotcore.util.RobotLog;
+import com.qualcomm.robotcore.wifi.WifiDirectAssistant;
+import com.qualcomm.robotcore.wifi.WifiDirectAssistant.Event;
+import com.qualcomm.robotcore.wifi.WifiDirectAssistant.WifiDirectAssistantCallback;
+
+import java.lang.Thread.State;
+import java.net.InetAddress;
+
+public class FtcRobotControllerService extends Service implements WifiDirectAssistantCallback {
+ private final IBinder a = new FtcRobotControllerBinder();
+ private final FtcRobotControllerService.a h;
+ private final ElapsedTime i;
+ private WifiDirectAssistant b;
+ private Robot c;
+ private EventLoop d;
+ private Event e;
+ private String f;
+ private Callback g;
+ private Thread j;
+
+ public FtcRobotControllerService() {
+ this.e = Event.DISCONNECTED;
+ this.f = "Robot Status: null";
+ this.g = null;
+ this.h = new a();
+ this.i = new ElapsedTime();
+ this.j = null;
+ }
+
+ public WifiDirectAssistant getWifiDirectAssistant() {
+ return this.b;
+ }
+
+ public Event getWifiDirectStatus() {
+ return this.e;
+ }
+
+ public String getRobotStatus() {
+ return this.f;
+ }
+
+ public IBinder onBind(Intent intent) {
+ DbgLog.msg("Starting FTC Controller Service");
+ DbgLog.msg("Android device is " + Build.MANUFACTURER + ", " + Build.MODEL);
+ this.b = WifiDirectAssistant.getWifiDirectAssistant(this);
+ this.b.setCallback(this);
+ this.b.enable();
+ if(Build.MODEL.equals("FL7007")) {
+ this.b.discoverPeers();
+ } else {
+ this.b.createGroup();
+ }
+
+ return this.a;
+ }
+
+ public boolean onUnbind(Intent intent) {
+ DbgLog.msg("Stopping FTC Controller Service");
+ this.b.disable();
+ this.shutdownRobot();
+ return false;
+ }
+
+ public synchronized void setCallback(Callback callback) {
+ this.g = callback;
+ }
+
+ public synchronized void setupRobot(EventLoop eventLoop) {
+ if(this.j != null && this.j.isAlive()) {
+ DbgLog.msg("FtcRobotControllerService.setupRobot() is currently running, stopping old setup");
+ this.j.interrupt();
+
+ while(this.j.isAlive()) {
+ Thread.yield();
+ }
+
+ DbgLog.msg("Old setup stopped; restarting setup");
+ }
+
+ RobotLog.clearGlobalErrorMsg();
+ DbgLog.msg("Processing robot setup");
+ this.d = eventLoop;
+ this.j = new Thread(new b(), "Robot Setup");
+ this.j.start();
+
+ while(this.j.getState() == State.NEW) {
+ Thread.yield();
+ }
+
+ }
+
+ public synchronized void shutdownRobot() {
+ if(this.j != null && this.j.isAlive()) {
+ this.j.interrupt();
+ }
+
+ if(this.c != null) {
+ this.c.shutdown();
+ }
+
+ this.c = null;
+ this.a("Robot Status: null");
+ }
+
+ public void onWifiDirectEvent(Event event) {
+ switch (event.ordinal()) {
+ case 1:
+ DbgLog.msg("Wifi Direct - Group Owner");
+ this.b.cancelDiscoverPeers();
+ break;
+ case 2:
+ DbgLog.error("Wifi Direct - connected as peer, was expecting Group Owner");
+ break;
+ case 3:
+ DbgLog.msg("Wifi Direct Passphrase: " + this.b.getPassphrase());
+ break;
+ case 4:
+ DbgLog.error("Wifi Direct Error: " + this.b.getFailureReason());
+ }
+
+ this.a(event);
+ }
+
+ private void a(Event var1) {
+ this.e = var1;
+ if(this.g != null) {
+ this.g.wifiDirectUpdate(this.e);
+ }
+
+ }
+
+ private void a(String var1) {
+ this.f = var1;
+ if(this.g != null) {
+ this.g.robotUpdate(var1);
+ }
+
+ }
+
+ private class b implements Runnable {
+ private b() {
+ }
+
+ public void run() {
+ try {
+ if(FtcRobotControllerService.this.c != null) {
+ FtcRobotControllerService.this.c.shutdown();
+ FtcRobotControllerService.this.c = null;
+ }
+
+ FtcRobotControllerService.this.a("Robot Status: scanning for USB devices");
+
+ try {
+ Thread.sleep(2000L);
+ } catch (InterruptedException var4) {
+ FtcRobotControllerService.this.a("Robot Status: abort due to interrupt");
+ return;
+ }
+
+ FtcRobotControllerService.this.c = RobotFactory.createRobot();
+ FtcRobotControllerService.this.a("Robot Status: waiting on network");
+ FtcRobotControllerService.this.i.reset();
+
+ while(!FtcRobotControllerService.this.b.isConnected()) {
+ try {
+ Thread.sleep(1000L);
+ if(FtcRobotControllerService.this.i.time() > 120.0D) {
+ FtcRobotControllerService.this.a("Robot Status: network timed out");
+ return;
+ }
+ } catch (InterruptedException var3) {
+ DbgLog.msg("interrupt waiting for network; aborting setup");
+ return;
+ }
+ }
+
+ FtcRobotControllerService.this.a("Robot Status: starting robot");
+
+ try {
+ FtcRobotControllerService.this.c.eventLoopManager.setMonitor(FtcRobotControllerService.this.h);
+ InetAddress var1 = FtcRobotControllerService.this.b.getGroupOwnerAddress();
+ FtcRobotControllerService.this.c.start(var1, FtcRobotControllerService.this.d);
+ } catch (RobotCoreException var2) {
+ FtcRobotControllerService.this.a("Robot Status: failed to start robot");
+ RobotLog.setGlobalErrorMsg(var2.getMessage());
+ }
+ } catch (RobotCoreException var5) {
+ FtcRobotControllerService.this.a("Robot Status: Unable to create robot!");
+ RobotLog.setGlobalErrorMsg(var5.getMessage());
+ }
+
+ }
+ }
+
+ private class a implements EventLoopMonitor {
+ private a() {
+ }
+
+ public void onStateChange(RobotState state) {
+ if(FtcRobotControllerService.this.g != null) {
+ switch (state.ordinal()) {
+ case 1:
+ FtcRobotControllerService.this.g.robotUpdate("Robot Status: init");
+ break;
+ case 2:
+ FtcRobotControllerService.this.g.robotUpdate("Robot Status: not started");
+ break;
+ case 3:
+ FtcRobotControllerService.this.g.robotUpdate("Robot Status: running");
+ break;
+ case 4:
+ FtcRobotControllerService.this.g.robotUpdate("Robot Status: stopped");
+ break;
+ case 5:
+ FtcRobotControllerService.this.g.robotUpdate("Robot Status: EMERGENCY STOP");
+ break;
+ case 6:
+ FtcRobotControllerService.this.g.robotUpdate("Robot Status: dropped connection");
+ }
+
+ }
+ }
+ }
+
+ public class FtcRobotControllerBinder extends Binder {
+ public FtcRobotControllerBinder() {
+ }
+
+ public FtcRobotControllerService getService() {
+ return FtcRobotControllerService.this;
+ }
+ }
+}
diff --git a/FtcRobotController/app/src/main/java/com/qualcomm/ftccommon/FtcRobotControllerSettingsActivity.java b/FtcRobotController/FtcCommon/src/main/java/com/qualcomm/ftccommon/FtcRobotControllerSettingsActivity.java
similarity index 94%
rename from FtcRobotController/app/src/main/java/com/qualcomm/ftccommon/FtcRobotControllerSettingsActivity.java
rename to FtcRobotController/FtcCommon/src/main/java/com/qualcomm/ftccommon/FtcRobotControllerSettingsActivity.java
index 80d305e..1af9fb9 100644
--- a/FtcRobotController/app/src/main/java/com/qualcomm/ftccommon/FtcRobotControllerSettingsActivity.java
+++ b/FtcRobotController/FtcCommon/src/main/java/com/qualcomm/ftccommon/FtcRobotControllerSettingsActivity.java
@@ -1,76 +1,75 @@
-package com.qualcomm.ftccommon;
-
-import android.app.Activity;
-import android.content.Intent;
-import android.os.Build;
-import android.os.Bundle;
-import android.preference.Preference;
-import android.preference.PreferenceFragment;
-import android.preference.Preference.OnPreferenceClickListener;
-import android.widget.Toast;
-import com.qualcomm.ftccommon.R;
-
-public class FtcRobotControllerSettingsActivity extends Activity {
- protected void onCreate(Bundle var1) {
- super.onCreate(var1);
- this.getFragmentManager().beginTransaction().replace(16908290, new FtcRobotControllerSettingsActivity.SettingsFragment()).commit();
- }
-
- public static class SettingsFragment extends PreferenceFragment {
- OnPreferenceClickListener a = new OnPreferenceClickListener() {
- public boolean onPreferenceClick(Preference var1) {
- Intent var2 = new Intent(var1.getIntent().getAction());
- SettingsFragment.this.startActivityForResult(var2, 3);
- return true;
- }
- };
-
- public void onActivityResult(int var1, int var2, Intent var3) {
- if(var1 == 3 && var2 == -1) {
- this.getActivity().setResult(-1, var3);
- }
-
- }
-
- public void onCreate(Bundle var1) {
- super.onCreate(var1);
- this.addPreferencesFromResource(R.xml.preferences);
- this.findPreference(this.getString(R.string.pref_launch_configure)).setOnPreferenceClickListener(this.a);
- this.findPreference(this.getString(R.string.pref_launch_autoconfigure)).setOnPreferenceClickListener(this.a);
- if(Build.MANUFACTURER.equalsIgnoreCase("zte") && Build.MODEL.equalsIgnoreCase("N9130")) {
- this.findPreference(this.getString(R.string.pref_launch_settings)).setOnPreferenceClickListener(new OnPreferenceClickListener() {
- public boolean onPreferenceClick(Preference var1) {
- Intent var2 = SettingsFragment.this.getActivity().getPackageManager().getLaunchIntentForPackage("com.zte.wifichanneleditor");
-
- try {
- SettingsFragment.this.startActivity(var2);
- } catch (NullPointerException var4) {
- Toast.makeText(SettingsFragment.this.getActivity(), "Unable to launch ZTE WifiChannelEditor", 0).show();
- }
-
- return true;
- }
- });
- } else {
- this.findPreference(this.getString(R.string.pref_launch_settings)).setOnPreferenceClickListener(new OnPreferenceClickListener() {
- public boolean onPreferenceClick(Preference var1) {
- Intent var2 = new Intent(var1.getIntent().getAction());
- SettingsFragment.this.startActivity(var2);
- return true;
- }
- });
- }
-
- if(Build.MODEL.equals("FL7007")) {
- this.findPreference(this.getString(R.string.pref_launch_settings)).setOnPreferenceClickListener(new OnPreferenceClickListener() {
- public boolean onPreferenceClick(Preference var1) {
- Intent var2 = new Intent("android.settings.SETTINGS");
- SettingsFragment.this.startActivity(var2);
- return true;
- }
- });
- }
-
- }
- }
-}
+package com.qualcomm.ftccommon;
+
+import android.app.Activity;
+import android.content.Intent;
+import android.os.Build;
+import android.os.Bundle;
+import android.preference.Preference;
+import android.preference.Preference.OnPreferenceClickListener;
+import android.preference.PreferenceFragment;
+import android.widget.Toast;
+
+public class FtcRobotControllerSettingsActivity extends Activity {
+ protected void onCreate(Bundle var1) {
+ super.onCreate(var1);
+ this.getFragmentManager().beginTransaction().replace(16908290, new SettingsFragment()).commit();
+ }
+
+ public static class SettingsFragment extends PreferenceFragment {
+ OnPreferenceClickListener a = new OnPreferenceClickListener() {
+ public boolean onPreferenceClick(Preference var1) {
+ Intent var2 = new Intent(var1.getIntent().getAction());
+ SettingsFragment.this.startActivityForResult(var2, 3);
+ return true;
+ }
+ };
+
+ public void onActivityResult(int var1, int var2, Intent var3) {
+ if(var1 == 3 && var2 == -1) {
+ this.getActivity().setResult(-1, var3);
+ }
+
+ }
+
+ public void onCreate(Bundle var1) {
+ super.onCreate(var1);
+ this.addPreferencesFromResource(R.xml.preferences);
+ this.findPreference(this.getString(R.string.pref_launch_configure)).setOnPreferenceClickListener(this.a);
+ this.findPreference(this.getString(R.string.pref_launch_autoconfigure)).setOnPreferenceClickListener(this.a);
+ if(Build.MANUFACTURER.equalsIgnoreCase("zte") && Build.MODEL.equalsIgnoreCase("N9130")) {
+ this.findPreference(this.getString(R.string.pref_launch_settings)).setOnPreferenceClickListener(new OnPreferenceClickListener() {
+ public boolean onPreferenceClick(Preference var1) {
+ Intent var2 = SettingsFragment.this.getActivity().getPackageManager().getLaunchIntentForPackage("com.zte.wifichanneleditor");
+
+ try {
+ SettingsFragment.this.startActivity(var2);
+ } catch (NullPointerException var4) {
+ Toast.makeText(SettingsFragment.this.getActivity(), "Unable to launch ZTE WifiChannelEditor", 0).show();
+ }
+
+ return true;
+ }
+ });
+ } else {
+ this.findPreference(this.getString(R.string.pref_launch_settings)).setOnPreferenceClickListener(new OnPreferenceClickListener() {
+ public boolean onPreferenceClick(Preference var1) {
+ Intent var2 = new Intent(var1.getIntent().getAction());
+ SettingsFragment.this.startActivity(var2);
+ return true;
+ }
+ });
+ }
+
+ if(Build.MODEL.equals("FL7007")) {
+ this.findPreference(this.getString(R.string.pref_launch_settings)).setOnPreferenceClickListener(new OnPreferenceClickListener() {
+ public boolean onPreferenceClick(Preference var1) {
+ Intent var2 = new Intent("android.settings.SETTINGS");
+ SettingsFragment.this.startActivity(var2);
+ return true;
+ }
+ });
+ }
+
+ }
+ }
+}
diff --git a/FtcRobotController/app/src/main/java/com/qualcomm/ftccommon/FtcWifiChannelSelectorActivity.java b/FtcRobotController/FtcCommon/src/main/java/com/qualcomm/ftccommon/FtcWifiChannelSelectorActivity.java
similarity index 90%
rename from FtcRobotController/app/src/main/java/com/qualcomm/ftccommon/FtcWifiChannelSelectorActivity.java
rename to FtcRobotController/FtcCommon/src/main/java/com/qualcomm/ftccommon/FtcWifiChannelSelectorActivity.java
index e39af09..537cf34 100644
--- a/FtcRobotController/app/src/main/java/com/qualcomm/ftccommon/FtcWifiChannelSelectorActivity.java
+++ b/FtcRobotController/FtcCommon/src/main/java/com/qualcomm/ftccommon/FtcWifiChannelSelectorActivity.java
@@ -1,144 +1,143 @@
-package com.qualcomm.ftccommon;
-
-import android.app.Activity;
-import android.app.ProgressDialog;
-import android.content.Context;
-import android.content.Intent;
-import android.net.wifi.WifiManager;
-import android.os.Bundle;
-import android.view.View;
-import android.view.View.OnClickListener;
-import android.widget.AdapterView;
-import android.widget.ArrayAdapter;
-import android.widget.Button;
-import android.widget.Spinner;
-import android.widget.Toast;
-import android.widget.AdapterView.OnItemSelectedListener;
-import com.qualcomm.ftccommon.DbgLog;
-import com.qualcomm.ftccommon.R;
-import com.qualcomm.wirelessp2p.WifiDirectChannelSelection;
-import java.io.IOException;
-
-public class FtcWifiChannelSelectorActivity extends Activity implements OnClickListener, OnItemSelectedListener {
- private static int a = 0;
- private Button b;
- private Button c;
- private Spinner d;
- private ProgressDialog e;
- private WifiDirectChannelSelection f;
- private int g = -1;
- private int h = -1;
- private Context i;
-
- private void a() {
- Object[] var1 = new Object[]{Integer.valueOf(this.g), Integer.valueOf(this.h)};
- DbgLog.msg(String.format("configure p2p channel - class %d channel %d", var1));
-
- try {
- this.e = ProgressDialog.show(this, "Configuring Channel", "Please Wait", true);
- this.f.config(this.g, this.h);
- (new Thread(new Runnable() {
- public void run() {
- try {
- Thread.sleep(5000L);
- } catch (InterruptedException var2) {
- ;
- }
-
- FtcWifiChannelSelectorActivity.this.runOnUiThread(new Runnable() {
- public void run() {
- FtcWifiChannelSelectorActivity.this.setResult(-1);
- FtcWifiChannelSelectorActivity.this.e.dismiss();
- FtcWifiChannelSelectorActivity.this.finish();
- }
- });
- }
- })).start();
- } catch (IOException var3) {
- this.a("Failed - root is required", 0);
- var3.printStackTrace();
- }
- }
-
- private void a(final String var1, final int var2) {
- this.runOnUiThread(new Runnable() {
- public void run() {
- Toast.makeText(FtcWifiChannelSelectorActivity.this.i, var1, var2).show();
- }
- });
- }
-
- public void onClick(View var1) {
- if(var1.getId() == R.id.buttonConfigure) {
- a = this.d.getSelectedItemPosition();
- this.a();
- } else if(var1.getId() == R.id.buttonWifiSettings) {
- DbgLog.msg("launch wifi settings");
- this.startActivity(new Intent("android.net.wifi.PICK_WIFI_NETWORK"));
- return;
- }
-
- }
-
- protected void onCreate(Bundle var1) {
- super.onCreate(var1);
- this.setContentView(R.layout.activity_ftc_wifi_channel_selector);
- this.i = this;
- this.d = (Spinner)this.findViewById(R.id.spinnerChannelSelect);
- ArrayAdapter var2 = ArrayAdapter.createFromResource(this, R.array.wifi_direct_channels, 17367048);
- var2.setDropDownViewResource(17367049);
- this.d.setAdapter(var2);
- this.d.setOnItemSelectedListener(this);
- this.b = (Button)this.findViewById(R.id.buttonConfigure);
- this.b.setOnClickListener(this);
- this.c = (Button)this.findViewById(R.id.buttonWifiSettings);
- this.c.setOnClickListener(this);
- this.f = new WifiDirectChannelSelection(this, (WifiManager)this.getSystemService("wifi"));
- }
-
- public void onItemSelected(AdapterView> var1, View var2, int var3, long var4) {
- switch(var3) {
- case 0:
- this.g = -1;
- this.h = -1;
- return;
- case 1:
- this.g = 81;
- this.h = 1;
- return;
- case 2:
- this.g = 81;
- this.h = 6;
- return;
- case 3:
- this.g = 81;
- this.h = 11;
- return;
- case 4:
- this.g = 124;
- this.h = 149;
- return;
- case 5:
- this.g = 124;
- this.h = 153;
- return;
- case 6:
- this.g = 124;
- this.h = 157;
- return;
- case 7:
- this.g = 124;
- this.h = 161;
- return;
- default:
- }
- }
-
- public void onNothingSelected(AdapterView> var1) {
- }
-
- protected void onStart() {
- super.onStart();
- this.d.setSelection(a);
- }
-}
+package com.qualcomm.ftccommon;
+
+import android.app.Activity;
+import android.app.ProgressDialog;
+import android.content.Context;
+import android.content.Intent;
+import android.net.wifi.WifiManager;
+import android.os.Bundle;
+import android.view.View;
+import android.view.View.OnClickListener;
+import android.widget.AdapterView;
+import android.widget.AdapterView.OnItemSelectedListener;
+import android.widget.ArrayAdapter;
+import android.widget.Button;
+import android.widget.Spinner;
+import android.widget.Toast;
+
+import com.qualcomm.wirelessP2p.WifiDirectChannelSelection;
+
+import java.io.IOException;
+
+public class FtcWifiChannelSelectorActivity extends Activity implements OnClickListener, OnItemSelectedListener {
+ private static int a = 0;
+ private Button b;
+ private Button c;
+ private Spinner d;
+ private ProgressDialog e;
+ private WifiDirectChannelSelection f;
+ private int g = -1;
+ private int h = -1;
+ private Context i;
+
+ private void a() {
+ Object[] var1 = new Object[]{Integer.valueOf(this.g), Integer.valueOf(this.h)};
+ DbgLog.msg(String.format("configure p2p channel - class %d channel %d", var1));
+
+ try {
+ this.e = ProgressDialog.show(this, "Configuring Channel", "Please Wait", true);
+ this.f.config(this.g, this.h);
+ (new Thread(new Runnable() {
+ public void run() {
+ try {
+ Thread.sleep(5000L);
+ } catch (InterruptedException var2) {
+ }
+
+ FtcWifiChannelSelectorActivity.this.runOnUiThread(new Runnable() {
+ public void run() {
+ FtcWifiChannelSelectorActivity.this.setResult(-1);
+ FtcWifiChannelSelectorActivity.this.e.dismiss();
+ FtcWifiChannelSelectorActivity.this.finish();
+ }
+ });
+ }
+ })).start();
+ } catch (IOException var3) {
+ this.a("Failed - root is required", 0);
+ var3.printStackTrace();
+ }
+ }
+
+ private void a(final String var1, final int var2) {
+ this.runOnUiThread(new Runnable() {
+ public void run() {
+ Toast.makeText(FtcWifiChannelSelectorActivity.this.i, var1, var2).show();
+ }
+ });
+ }
+
+ public void onClick(View var1) {
+ if(var1.getId() == R.id.buttonConfigure) {
+ a = this.d.getSelectedItemPosition();
+ this.a();
+ } else if(var1.getId() == R.id.buttonWifiSettings) {
+ DbgLog.msg("launch wifi settings");
+ this.startActivity(new Intent("android.net.wifi.PICK_WIFI_NETWORK"));
+ return;
+ }
+
+ }
+
+ protected void onCreate(Bundle var1) {
+ super.onCreate(var1);
+ this.setContentView(R.layout.activity_ftc_wifi_channel_selector);
+ this.i = this;
+ this.d = (Spinner)this.findViewById(R.id.spinnerChannelSelect);
+ ArrayAdapter var2 = ArrayAdapter.createFromResource(this, R.array.wifi_direct_channels, R.layout.activity_ftc_wifi_channel_selector);
+ var2.setDropDownViewResource(/* 17367049 */ R.layout.activity_ftc_wifi_channel_selector);
+ this.d.setAdapter(var2);
+ this.d.setOnItemSelectedListener(this);
+ this.b = (Button)this.findViewById(R.id.buttonConfigure);
+ this.b.setOnClickListener(this);
+ this.c = (Button)this.findViewById(R.id.buttonWifiSettings);
+ this.c.setOnClickListener(this);
+ this.f = new WifiDirectChannelSelection(this, (WifiManager) this.getSystemService(WIFI_SERVICE));
+ }
+
+ public void onItemSelected(AdapterView> var1, View var2, int var3, long var4) {
+ switch(var3) {
+ case 0:
+ this.g = -1;
+ this.h = -1;
+ return;
+ case 1:
+ this.g = 81;
+ this.h = 1;
+ return;
+ case 2:
+ this.g = 81;
+ this.h = 6;
+ return;
+ case 3:
+ this.g = 81;
+ this.h = 11;
+ return;
+ case 4:
+ this.g = 124;
+ this.h = 149;
+ return;
+ case 5:
+ this.g = 124;
+ this.h = 153;
+ return;
+ case 6:
+ this.g = 124;
+ this.h = 157;
+ return;
+ case 7:
+ this.g = 124;
+ this.h = 161;
+ return;
+ default:
+ }
+ }
+
+ public void onNothingSelected(AdapterView> var1) {
+ }
+
+ protected void onStart() {
+ super.onStart();
+ this.d.setSelection(a);
+ }
+}
diff --git a/FtcRobotController/app/src/main/java/com/qualcomm/ftccommon/LaunchActivityConstantsList.java b/FtcRobotController/FtcCommon/src/main/java/com/qualcomm/ftccommon/LaunchActivityConstantsList.java
similarity index 97%
rename from FtcRobotController/app/src/main/java/com/qualcomm/ftccommon/LaunchActivityConstantsList.java
rename to FtcRobotController/FtcCommon/src/main/java/com/qualcomm/ftccommon/LaunchActivityConstantsList.java
index 76f74c8..288d5fb 100644
--- a/FtcRobotController/app/src/main/java/com/qualcomm/ftccommon/LaunchActivityConstantsList.java
+++ b/FtcRobotController/FtcCommon/src/main/java/com/qualcomm/ftccommon/LaunchActivityConstantsList.java
@@ -1,7 +1,7 @@
-package com.qualcomm.ftccommon;
-
-public class LaunchActivityConstantsList {
- public static final int FTC_ROBOT_CONTROLLER_ACTIVITY_CONFIGURE_ROBOT = 3;
- public static final String VIEW_LOGS_ACTIVITY_FILENAME = "Filename";
- public static final String ZTE_WIFI_CHANNEL_EDITOR_PACKAGE = "com.zte.wifichanneleditor";
-}
+package com.qualcomm.ftccommon;
+
+public class LaunchActivityConstantsList {
+ public static final int FTC_ROBOT_CONTROLLER_ACTIVITY_CONFIGURE_ROBOT = 3;
+ public static final String VIEW_LOGS_ACTIVITY_FILENAME = "Filename";
+ public static final String ZTE_WIFI_CHANNEL_EDITOR_PACKAGE = "com.zte.wifichanneleditor";
+}
diff --git a/FtcRobotController/app/src/main/java/com/qualcomm/ftccommon/Restarter.java b/FtcRobotController/FtcCommon/src/main/java/com/qualcomm/ftccommon/Restarter.java
similarity index 94%
rename from FtcRobotController/app/src/main/java/com/qualcomm/ftccommon/Restarter.java
rename to FtcRobotController/FtcCommon/src/main/java/com/qualcomm/ftccommon/Restarter.java
index 15d348b..4638688 100644
--- a/FtcRobotController/app/src/main/java/com/qualcomm/ftccommon/Restarter.java
+++ b/FtcRobotController/FtcCommon/src/main/java/com/qualcomm/ftccommon/Restarter.java
@@ -1,5 +1,5 @@
-package com.qualcomm.ftccommon;
-
-public interface Restarter {
- void requestRestart();
-}
+package com.qualcomm.ftccommon;
+
+public interface Restarter {
+ void requestRestart();
+}
diff --git a/FtcRobotController/app/src/main/java/com/qualcomm/ftccommon/UpdateUI.java b/FtcRobotController/FtcCommon/src/main/java/com/qualcomm/ftccommon/UpdateUI.java
similarity index 92%
rename from FtcRobotController/app/src/main/java/com/qualcomm/ftccommon/UpdateUI.java
rename to FtcRobotController/FtcCommon/src/main/java/com/qualcomm/ftccommon/UpdateUI.java
index a46a3c4..6c54824 100644
--- a/FtcRobotController/app/src/main/java/com/qualcomm/ftccommon/UpdateUI.java
+++ b/FtcRobotController/FtcCommon/src/main/java/com/qualcomm/ftccommon/UpdateUI.java
@@ -1,143 +1,140 @@
-package com.qualcomm.ftccommon;
-
-import android.app.Activity;
-import android.widget.TextView;
-import android.widget.Toast;
-import com.qualcomm.ftccommon.DbgLog;
-import com.qualcomm.ftccommon.FtcRobotControllerService;
-import com.qualcomm.ftccommon.Restarter;
-import com.qualcomm.robotcore.hardware.Gamepad;
-import com.qualcomm.robotcore.util.Dimmer;
-import com.qualcomm.robotcore.util.RobotLog;
-import com.qualcomm.robotcore.wifi.WifiDirectAssistant;
-
-public class UpdateUI {
- Restarter a;
- FtcRobotControllerService b;
- Activity c;
- Dimmer d;
- protected TextView textDeviceName;
- protected TextView textErrorMessage;
- protected TextView[] textGamepad = new TextView[2];
- protected TextView textOpMode;
- protected TextView textRobotStatus;
- protected TextView textWifiDirectStatus;
-
- public UpdateUI(Activity var1, Dimmer var2) {
- this.c = var1;
- this.d = var2;
- }
-
- private void a() {
- this.a.requestRestart();
- }
-
- private void a(final String var1) {
- DbgLog.msg(var1);
- this.c.runOnUiThread(new Runnable() {
- public void run() {
- UpdateUI.this.textWifiDirectStatus.setText(var1);
- }
- });
- }
-
- private void b(final String var1) {
- this.c.runOnUiThread(new Runnable() {
- public void run() {
- UpdateUI.this.textDeviceName.setText(var1);
- }
- });
- }
-
- public void setControllerService(FtcRobotControllerService var1) {
- this.b = var1;
- }
-
- public void setRestarter(Restarter var1) {
- this.a = var1;
- }
-
- public void setTextViews(TextView var1, TextView var2, TextView[] var3, TextView var4, TextView var5, TextView var6) {
- this.textWifiDirectStatus = var1;
- this.textRobotStatus = var2;
- this.textGamepad = var3;
- this.textOpMode = var4;
- this.textErrorMessage = var5;
- this.textDeviceName = var6;
- }
-
- public class Callback {
- public void restartRobot() {
- UpdateUI.this.c.runOnUiThread(new Runnable() {
- public void run() {
- Toast.makeText(UpdateUI.this.c, "Restarting Robot", 0).show();
- }
- });
- (new Thread() {
- public void run() {
- try {
- Thread.sleep(1500L);
- } catch (InterruptedException var2) {
- ;
- }
-
- UpdateUI.this.c.runOnUiThread(new Runnable() {
- public void run() {
- UpdateUI.this.a();
- }
- });
- }
- }).start();
- }
-
- public void robotUpdate(final String var1) {
- DbgLog.msg(var1);
- UpdateUI.this.c.runOnUiThread(new Runnable() {
- public void run() {
- UpdateUI.this.textRobotStatus.setText(var1);
- UpdateUI.this.textErrorMessage.setText(RobotLog.getGlobalErrorMsg());
- if(RobotLog.hasGlobalErrorMsg()) {
- UpdateUI.this.d.longBright();
- }
-
- }
- });
- }
-
- public void updateUi(final String var1, final Gamepad[] var2) {
- UpdateUI.this.c.runOnUiThread(new Runnable() {
- public void run() {
- for(int var1x = 0; var1x < UpdateUI.this.textGamepad.length && var1x < var2.length; ++var1x) {
- if(var2[var1x].id == -1) {
- UpdateUI.this.textGamepad[var1x].setText(" ");
- } else {
- UpdateUI.this.textGamepad[var1x].setText(var2[var1x].toString());
- }
- }
-
- UpdateUI.this.textOpMode.setText("Op Mode: " + var1);
- UpdateUI.this.textErrorMessage.setText(RobotLog.getGlobalErrorMsg());
- }
- });
- }
-
- public void wifiDirectUpdate(WifiDirectAssistant.Event var1) {
- switch(null.a[var1.ordinal()]) {
- case 1:
- UpdateUI.this.a("Wifi Direct - disconnected");
- return;
- case 2:
- UpdateUI.this.a("Wifi Direct - enabled");
- return;
- case 3:
- UpdateUI.this.a("Wifi Direct - ERROR");
- return;
- case 4:
- WifiDirectAssistant var2 = UpdateUI.this.b.getWifiDirectAssistant();
- UpdateUI.this.b(var2.getDeviceName());
- return;
- default:
- }
- }
- }
-}
+package com.qualcomm.ftccommon;
+
+import android.app.Activity;
+import android.widget.TextView;
+import android.widget.Toast;
+
+import com.qualcomm.robotcore.hardware.Gamepad;
+import com.qualcomm.robotcore.util.Dimmer;
+import com.qualcomm.robotcore.util.RobotLog;
+import com.qualcomm.robotcore.wifi.WifiDirectAssistant;
+
+public class UpdateUI {
+ protected TextView textDeviceName;
+ protected TextView textErrorMessage;
+ protected TextView[] textGamepad = new TextView[2];
+ protected TextView textOpMode;
+ protected TextView textRobotStatus;
+ protected TextView textWifiDirectStatus;
+ Restarter a;
+ FtcRobotControllerService b;
+ Activity c;
+ Dimmer d;
+
+ public UpdateUI(Activity var1, Dimmer var2) {
+ this.c = var1;
+ this.d = var2;
+ }
+
+ private void a() {
+ this.a.requestRestart();
+ }
+
+ private void a(final String var1) {
+ DbgLog.msg(var1);
+ this.c.runOnUiThread(new Runnable() {
+ public void run() {
+ UpdateUI.this.textWifiDirectStatus.setText(var1);
+ }
+ });
+ }
+
+ private void b(final String var1) {
+ this.c.runOnUiThread(new Runnable() {
+ public void run() {
+ UpdateUI.this.textDeviceName.setText(var1);
+ }
+ });
+ }
+
+ public void setControllerService(FtcRobotControllerService var1) {
+ this.b = var1;
+ }
+
+ public void setRestarter(Restarter var1) {
+ this.a = var1;
+ }
+
+ public void setTextViews(TextView var1, TextView var2, TextView[] var3, TextView var4, TextView var5, TextView var6) {
+ this.textWifiDirectStatus = var1;
+ this.textRobotStatus = var2;
+ this.textGamepad = var3;
+ this.textOpMode = var4;
+ this.textErrorMessage = var5;
+ this.textDeviceName = var6;
+ }
+
+ public class Callback {
+ public void restartRobot() {
+ UpdateUI.this.c.runOnUiThread(new Runnable() {
+ public void run() {
+ Toast.makeText(UpdateUI.this.c, "Restarting Robot", 0).show();
+ }
+ });
+ (new Thread() {
+ public void run() {
+ try {
+ Thread.sleep(1500L);
+ } catch (InterruptedException var2) {
+ }
+
+ UpdateUI.this.c.runOnUiThread(new Runnable() {
+ public void run() {
+ UpdateUI.this.a();
+ }
+ });
+ }
+ }).start();
+ }
+
+ public void robotUpdate(final String var1) {
+ DbgLog.msg(var1);
+ UpdateUI.this.c.runOnUiThread(new Runnable() {
+ public void run() {
+ UpdateUI.this.textRobotStatus.setText(var1);
+ UpdateUI.this.textErrorMessage.setText(RobotLog.getGlobalErrorMsg());
+ if(RobotLog.hasGlobalErrorMsg()) {
+ UpdateUI.this.d.longBright();
+ }
+
+ }
+ });
+ }
+
+ public void updateUi(final String var1, final Gamepad[] var2) {
+ UpdateUI.this.c.runOnUiThread(new Runnable() {
+ public void run() {
+ for(int var1x = 0; var1x < UpdateUI.this.textGamepad.length && var1x < var2.length; ++var1x) {
+ if(var2[var1x].id == -1) {
+ UpdateUI.this.textGamepad[var1x].setText(" ");
+ } else {
+ UpdateUI.this.textGamepad[var1x].setText(var2[var1x].toString());
+ }
+ }
+
+ UpdateUI.this.textOpMode.setText("Op Mode: " + var1);
+ UpdateUI.this.textErrorMessage.setText(RobotLog.getGlobalErrorMsg());
+ }
+ });
+ }
+
+ public void wifiDirectUpdate(WifiDirectAssistant.Event var1) {
+ switch (var1.ordinal()) {
+ case 1:
+ UpdateUI.this.a("Wifi Direct - disconnected");
+ return;
+ case 2:
+ UpdateUI.this.a("Wifi Direct - enabled");
+ return;
+ case 3:
+ UpdateUI.this.a("Wifi Direct - ERROR");
+ return;
+ case 4:
+ WifiDirectAssistant var2 = UpdateUI.this.b.getWifiDirectAssistant();
+ UpdateUI.this.b(var2.getDeviceName());
+ return;
+ default:
+ }
+ }
+ }
+}
diff --git a/FtcRobotController/app/src/main/java/com/qualcomm/ftccommon/ViewLogsActivity.java b/FtcRobotController/FtcCommon/src/main/java/com/qualcomm/ftccommon/ViewLogsActivity.java
similarity index 96%
rename from FtcRobotController/app/src/main/java/com/qualcomm/ftccommon/ViewLogsActivity.java
rename to FtcRobotController/FtcCommon/src/main/java/com/qualcomm/ftccommon/ViewLogsActivity.java
index 24f8f7c..7d8040d 100644
--- a/FtcRobotController/app/src/main/java/com/qualcomm/ftccommon/ViewLogsActivity.java
+++ b/FtcRobotController/FtcCommon/src/main/java/com/qualcomm/ftccommon/ViewLogsActivity.java
@@ -1,108 +1,110 @@
-package com.qualcomm.ftccommon;
-
-import android.app.Activity;
-import android.os.Bundle;
-import android.os.Environment;
-import android.text.Spannable;
-import android.text.SpannableString;
-import android.text.style.ForegroundColorSpan;
-import android.widget.ScrollView;
-import android.widget.TextView;
-import com.qualcomm.ftccommon.R;
-import com.qualcomm.robotcore.util.RobotLog;
-import java.io.BufferedReader;
-import java.io.File;
-import java.io.FileReader;
-import java.io.IOException;
-import java.io.Serializable;
-
-public class ViewLogsActivity extends Activity {
- public static final String FILENAME = "Filename";
- TextView a;
- int b = 300;
- String c = " ";
-
- private Spannable a(String var1) {
- int var2 = 0;
- SpannableString var3 = new SpannableString(var1);
- String[] var4 = var1.split("\\n");
- int var5 = var4.length;
-
- for(int var6 = 0; var2 < var5; ++var2) {
- String var7 = var4[var2];
- if(var7.contains("E/RobotCore") || var7.contains("### ERROR: ")) {
- var3.setSpan(new ForegroundColorSpan(-65536), var6, var6 + var7.length(), 33);
- }
-
- var6 = 1 + var6 + var7.length();
- }
-
- return var3;
- }
-
- protected void onCreate(Bundle var1) {
- super.onCreate(var1);
- this.setContentView(R.layout.activity_view_logs);
- this.a = (TextView)this.findViewById(R.id.textAdbLogs);
- final ScrollView var2 = (ScrollView)this.findViewById(R.id.scrollView);
- var2.post(new Runnable() {
- public void run() {
- var2.fullScroll(130);
- }
- });
- }
-
- protected void onStart() {
- super.onStart();
- Serializable var1 = this.getIntent().getSerializableExtra("Filename");
- if(var1 != null) {
- this.c = (String)var1;
- }
-
- this.runOnUiThread(new Runnable() {
- public void run() {
- try {
- String var2 = ViewLogsActivity.this.readNLines(ViewLogsActivity.this.b);
- Spannable var3 = ViewLogsActivity.this.a(var2);
- ViewLogsActivity.this.a.setText(var3);
- } catch (IOException var4) {
- RobotLog.e(var4.toString());
- ViewLogsActivity.this.a.setText("File not found: " + ViewLogsActivity.this.c);
- }
- }
- });
- }
-
- public String readNLines(int var1) throws IOException {
- Environment.getExternalStorageDirectory();
- BufferedReader var3 = new BufferedReader(new FileReader(new File(this.c)));
- String[] var4 = new String[var1];
- int var5 = 0;
-
- while(true) {
- String var6 = var3.readLine();
- if(var6 == null) {
- int var7 = var5 - var1;
- int var8 = 0;
- if(var7 >= 0) {
- var8 = var7;
- }
-
- String var10 = "";
-
- String var14;
- for(int var11 = var8; var11 < var5; var10 = var14) {
- String var13 = var4[var11 % var4.length];
- var14 = var10 + var13 + "\n";
- ++var11;
- }
-
- int var12 = var10.lastIndexOf("--------- beginning");
- return var12 < 0?var10:var10.substring(var12);
- }
-
- var4[var5 % var4.length] = var6;
- ++var5;
- }
- }
-}
+package com.qualcomm.ftccommon;
+
+import android.app.Activity;
+import android.os.Bundle;
+import android.os.Environment;
+import android.text.Spannable;
+import android.text.SpannableString;
+import android.text.style.ForegroundColorSpan;
+import android.widget.ScrollView;
+import android.widget.TextView;
+
+import com.qualcomm.ftccommon.R;
+import com.qualcomm.robotcore.util.RobotLog;
+
+import java.io.BufferedReader;
+import java.io.File;
+import java.io.FileReader;
+import java.io.IOException;
+import java.io.Serializable;
+
+public class ViewLogsActivity extends Activity {
+ public static final String FILENAME = "Filename";
+ TextView a;
+ int b = 300;
+ String c = " ";
+
+ private Spannable a(String var1) {
+ int var2 = 0;
+ SpannableString var3 = new SpannableString(var1);
+ String[] var4 = var1.split("\\n");
+ int var5 = var4.length;
+
+ for(int var6 = 0; var2 < var5; ++var2) {
+ String var7 = var4[var2];
+ if(var7.contains("E/RobotCore") || var7.contains("### ERROR: ")) {
+ var3.setSpan(new ForegroundColorSpan(-65536), var6, var6 + var7.length(), 33);
+ }
+
+ var6 = 1 + var6 + var7.length();
+ }
+
+ return var3;
+ }
+
+ protected void onCreate(Bundle var1) {
+ super.onCreate(var1);
+ this.setContentView(R.layout.activity_view_logs);
+ this.a = (TextView)this.findViewById(R.id.textAdbLogs);
+ final ScrollView var2 = (ScrollView)this.findViewById(R.id.scrollView);
+ var2.post(new Runnable() {
+ public void run() {
+ var2.fullScroll(130);
+ }
+ });
+ }
+
+ protected void onStart() {
+ super.onStart();
+ Serializable var1 = this.getIntent().getSerializableExtra("Filename");
+ if(var1 != null) {
+ this.c = (String)var1;
+ }
+
+ this.runOnUiThread(new Runnable() {
+ public void run() {
+ try {
+ String var2 = ViewLogsActivity.this.readNLines(ViewLogsActivity.this.b);
+ Spannable var3 = ViewLogsActivity.this.a(var2);
+ ViewLogsActivity.this.a.setText(var3);
+ } catch (IOException var4) {
+ RobotLog.e(var4.toString());
+ ViewLogsActivity.this.a.setText("File not found: " + ViewLogsActivity.this.c);
+ }
+ }
+ });
+ }
+
+ public String readNLines(int var1) throws IOException {
+ Environment.getExternalStorageDirectory();
+ BufferedReader var3 = new BufferedReader(new FileReader(new File(this.c)));
+ String[] var4 = new String[var1];
+ int var5 = 0;
+
+ while(true) {
+ String var6 = var3.readLine();
+ if(var6 == null) {
+ int var7 = var5 - var1;
+ int var8 = 0;
+ if(var7 >= 0) {
+ var8 = var7;
+ }
+
+ String var10 = "";
+
+ String var14;
+ for(int var11 = var8; var11 < var5; var10 = var14) {
+ String var13 = var4[var11 % var4.length];
+ var14 = var10 + var13 + "\n";
+ ++var11;
+ }
+
+ int var12 = var10.lastIndexOf("--------- beginning");
+ return var12 < 0?var10:var10.substring(var12);
+ }
+
+ var4[var5 % var4.length] = var6;
+ ++var5;
+ }
+ }
+}
diff --git a/FtcRobotController/app/src/main/java/com/qualcomm/ftccommon/configuration/AutoConfigureActivity.java b/FtcRobotController/FtcCommon/src/main/java/com/qualcomm/ftccommon/configuration/AutoConfigureActivity.java
similarity index 97%
rename from FtcRobotController/app/src/main/java/com/qualcomm/ftccommon/configuration/AutoConfigureActivity.java
rename to FtcRobotController/FtcCommon/src/main/java/com/qualcomm/ftccommon/configuration/AutoConfigureActivity.java
index 81ef5da..bfd3a7c 100644
--- a/FtcRobotController/app/src/main/java/com/qualcomm/ftccommon/configuration/AutoConfigureActivity.java
+++ b/FtcRobotController/FtcCommon/src/main/java/com/qualcomm/ftccommon/configuration/AutoConfigureActivity.java
@@ -1,356 +1,358 @@
-package com.qualcomm.ftccommon.configuration;
-
-import android.app.Activity;
-import android.content.Context;
-import android.os.Bundle;
-import android.view.View;
-import android.view.View.OnClickListener;
-import android.widget.Button;
-import android.widget.LinearLayout;
-import android.widget.Toast;
-import com.qualcomm.ftccommon.DbgLog;
-import com.qualcomm.ftccommon.R;
-import com.qualcomm.hardware.ModernRoboticsDeviceManager;
-import com.qualcomm.robotcore.eventloop.EventLoopManager;
-import com.qualcomm.robotcore.exception.RobotCoreException;
-import com.qualcomm.robotcore.hardware.DeviceManager;
-import com.qualcomm.robotcore.hardware.configuration.ControllerConfiguration;
-import com.qualcomm.robotcore.hardware.configuration.DeviceConfiguration;
-import com.qualcomm.robotcore.hardware.configuration.LegacyModuleControllerConfiguration;
-import com.qualcomm.robotcore.hardware.configuration.MotorConfiguration;
-import com.qualcomm.robotcore.hardware.configuration.MotorControllerConfiguration;
-import com.qualcomm.robotcore.hardware.configuration.ServoConfiguration;
-import com.qualcomm.robotcore.hardware.configuration.ServoControllerConfiguration;
-import com.qualcomm.robotcore.hardware.configuration.Utility;
-import com.qualcomm.robotcore.util.SerialNumber;
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.Map;
-import java.util.Set;
-import java.util.Map.Entry;
-
-public class AutoConfigureActivity extends Activity {
- private Context a;
- private Button b;
- private Button c;
- private DeviceManager d;
- private Map e = new HashMap();
- protected Set> entries = new HashSet();
- private Thread f;
- private Utility g;
- protected Map scannedDevices = new HashMap();
-
- private DeviceConfiguration a(DeviceConfiguration.ConfigurationType var1, String var2, int var3) {
- return new DeviceConfiguration(var3, var1, var2, true);
- }
-
- private MotorControllerConfiguration a(SerialNumber var1, String var2, String var3, String var4) {
- MotorControllerConfiguration var5;
- if(!var1.equals(ControllerConfiguration.NO_SERIAL_NUMBER)) {
- var5 = (MotorControllerConfiguration)this.e.get(var1);
- } else {
- var5 = new MotorControllerConfiguration();
- }
-
- var5.setName(var4);
- ArrayList var6 = new ArrayList();
- MotorConfiguration var7 = new MotorConfiguration(1, var2, true);
- MotorConfiguration var8 = new MotorConfiguration(2, var3, true);
- var6.add(var7);
- var6.add(var8);
- var5.addMotors(var6);
- return var5;
- }
-
- private ServoControllerConfiguration a(SerialNumber var1, ArrayList var2, String var3) {
- ServoControllerConfiguration var4;
- if(!var1.equals(ControllerConfiguration.NO_SERIAL_NUMBER)) {
- var4 = (ServoControllerConfiguration)this.e.get(var1);
- } else {
- var4 = new ServoControllerConfiguration();
- }
-
- var4.setName(var3);
- ArrayList var5 = new ArrayList();
-
- for(int var6 = 1; var6 <= 6; ++var6) {
- String var7 = (String)var2.get(var6 - 1);
- boolean var8;
- if(var7.equals("NO DEVICE ATTACHED")) {
- var8 = false;
- } else {
- var8 = true;
- }
-
- var5.add(new ServoConfiguration(var6, var7, var8));
- }
-
- var4.addServos(var5);
- return var4;
- }
-
- private void a() {
- this.g.setOrangeText("No devices found!", "To configure K9LegacyBot, please: \n 1. Attach a LegacyModuleController, \n with \n a. MotorController in port 0, with a \n motor in port 1 and port 2 \n b. ServoController in port 1, with a \n servo in port 1 and port 6 \n c. IR seeker in port 2\n d. Light sensor in port 3 \n 2. Press the K9LegacyBot button\n \nTo configure K9USBBot, please: \n 1. Attach a USBMotorController, with a \n motor in port 1 and port 2 \n 2. USBServoController in port 1, with a \n servo in port 1 and port 6 \n 3. LegacyModule, with \n a. IR seeker in port 2\n b. Light sensor in port 3 \n 4. Press the K9USBBot button", R.id.autoconfigure_info, R.layout.orange_warning, R.id.orangetext0, R.id.orangetext1);
- }
-
- private void a(SerialNumber var1, String var2) {
- LegacyModuleControllerConfiguration var3 = (LegacyModuleControllerConfiguration)this.e.get(var1);
- var3.setName(var2);
- DeviceConfiguration var4 = this.a(DeviceConfiguration.ConfigurationType.IR_SEEKER, "ir_seeker", 2);
- DeviceConfiguration var5 = this.a(DeviceConfiguration.ConfigurationType.LIGHT_SENSOR, "light_sensor", 3);
- ArrayList var6 = new ArrayList();
-
- for(int var7 = 0; var7 < 6; ++var7) {
- if(var7 == 2) {
- var6.add(var4);
- }
-
- if(var7 == 3) {
- var6.add(var5);
- } else {
- var6.add(new DeviceConfiguration(var7));
- }
- }
-
- var3.addDevices(var6);
- }
-
- private void a(String var1) {
- this.g.writeXML(this.e);
-
- try {
- this.g.writeToFile(var1 + ".xml");
- this.g.saveToPreferences(var1, R.string.pref_hardware_config_filename);
- this.g.updateHeader(var1, R.string.pref_hardware_config_filename, R.id.active_filename, R.id.included_header);
- Toast.makeText(this.a, "AutoConfigure " + var1 + " Successful", 0).show();
- } catch (RobotCoreException var5) {
- this.g.complainToast(var5.getMessage(), this.a);
- DbgLog.error(var5.getMessage());
- } catch (IOException var6) {
- this.g.complainToast("Found " + var6.getMessage() + "\n Please fix and re-save", this.a);
- DbgLog.error(var6.getMessage());
- }
- }
-
- private void b() {
- String var1 = "Found: \n" + this.scannedDevices.values() + "\n" + "Required: \n" + " 1. LegacyModuleController, with \n " + " a. MotorController in port 0, with a \n" + " motor in port 1 and port 2 \n " + " b. ServoController in port 1, with a \n" + " servo in port 1 and port 6 \n" + " c. IR seeker in port 2\n" + " d. Light sensor in port 3 ";
- this.g.setOrangeText("Wrong devices found!", var1, R.id.autoconfigure_info, R.layout.orange_warning, R.id.orangetext0, R.id.orangetext1);
- }
-
- private void b(SerialNumber var1, String var2) {
- LegacyModuleControllerConfiguration var3 = (LegacyModuleControllerConfiguration)this.e.get(var1);
- var3.setName(var2);
- MotorControllerConfiguration var4 = this.a(ControllerConfiguration.NO_SERIAL_NUMBER, "motor_1", "motor_2", "wheels");
- var4.setPort(0);
- ArrayList var5 = this.f();
- ServoControllerConfiguration var6 = this.a(ControllerConfiguration.NO_SERIAL_NUMBER, var5, "servos");
- var6.setPort(1);
- DeviceConfiguration var7 = this.a(DeviceConfiguration.ConfigurationType.IR_SEEKER, "ir_seeker", 2);
- DeviceConfiguration var8 = this.a(DeviceConfiguration.ConfigurationType.LIGHT_SENSOR, "light_sensor", 3);
- ArrayList var9 = new ArrayList();
- var9.add(var4);
- var9.add(var6);
- var9.add(var7);
- var9.add(var8);
-
- for(int var14 = 4; var14 < 6; ++var14) {
- var9.add(new DeviceConfiguration(var14));
- }
-
- var3.addDevices(var9);
- }
-
- private void c() {
- String var1 = "Found: \n" + this.scannedDevices.values() + "\n" + "Required: \n" + " 1. USBMotorController with a \n" + " motor in port 1 and port 2 \n " + " 2. USBServoController with a \n" + " servo in port 1 and port 6 \n" + " 3. LegacyModuleController, with \n " + " a. IR seeker in port 2\n" + " b. Light sensor in port 3 ";
- this.g.setOrangeText("Wrong devices found!", var1, R.id.autoconfigure_info, R.layout.orange_warning, R.id.orangetext0, R.id.orangetext1);
- }
-
- private void d() {
- this.g.setOrangeText("Already configured!", "", R.id.autoconfigure_info, R.layout.orange_warning, R.id.orangetext0, R.id.orangetext1);
- }
-
- private boolean e() {
- Iterator var1 = this.entries.iterator();
- boolean var2 = true;
- boolean var3 = true;
-
- boolean var4;
- boolean var7;
- for(var4 = true; var1.hasNext(); var4 = var7) {
- Entry var5 = (Entry)var1.next();
- DeviceManager.DeviceType var6 = (DeviceManager.DeviceType)var5.getValue();
- if(var6 == DeviceManager.DeviceType.MODERN_ROBOTICS_USB_LEGACY_MODULE && var4) {
- this.a((SerialNumber)var5.getKey(), "sensors");
- var7 = false;
- } else {
- var7 = var4;
- }
-
- boolean var8;
- if(var6 == DeviceManager.DeviceType.MODERN_ROBOTICS_USB_DC_MOTOR_CONTROLLER && var3) {
- this.a((SerialNumber)var5.getKey(), "motor_1", "motor_2", "wheels");
- var8 = false;
- } else {
- var8 = var3;
- }
-
- boolean var9;
- if(var6 == DeviceManager.DeviceType.MODERN_ROBOTICS_USB_SERVO_CONTROLLER && var2) {
- this.a((SerialNumber)var5.getKey(), this.f(), "servos");
- var9 = false;
- } else {
- var9 = var2;
- }
-
- var2 = var9;
- var3 = var8;
- }
-
- if(!var4 && !var3 && !var2) {
- ((LinearLayout)this.findViewById(R.id.autoconfigure_info)).removeAllViews();
- return true;
- } else {
- return false;
- }
- }
-
- private ArrayList f() {
- ArrayList var1 = new ArrayList();
- var1.add("servo_1");
- var1.add("NO DEVICE ATTACHED");
- var1.add("NO DEVICE ATTACHED");
- var1.add("NO DEVICE ATTACHED");
- var1.add("NO DEVICE ATTACHED");
- var1.add("servo_6");
- return var1;
- }
-
- private boolean g() {
- Iterator var1 = this.entries.iterator();
-
- boolean var2;
- boolean var4;
- for(var2 = true; var1.hasNext(); var2 = var4) {
- Entry var3 = (Entry)var1.next();
- if((DeviceManager.DeviceType)var3.getValue() == DeviceManager.DeviceType.MODERN_ROBOTICS_USB_LEGACY_MODULE && var2) {
- this.b((SerialNumber)var3.getKey(), "devices");
- var4 = false;
- } else {
- var4 = var2;
- }
- }
-
- if(var2) {
- return false;
- } else {
- ((LinearLayout)this.findViewById(R.id.autoconfigure_info)).removeAllViews();
- return true;
- }
- }
-
- protected void onCreate(Bundle var1) {
- super.onCreate(var1);
- this.a = this;
- this.setContentView(R.layout.activity_autoconfigure);
- this.g = new Utility(this);
- this.b = (Button)this.findViewById(R.id.configureLegacy);
- this.c = (Button)this.findViewById(R.id.configureUSB);
-
- try {
- this.d = new ModernRoboticsDeviceManager(this.a, (EventLoopManager)null);
- } catch (RobotCoreException var3) {
- this.g.complainToast("Failed to open the Device Manager", this.a);
- DbgLog.error("Failed to open deviceManager: " + var3.toString());
- DbgLog.logStacktrace(var3);
- }
- }
-
- protected void onStart() {
- super.onStart();
- this.g.updateHeader("K9LegacyBot", R.string.pref_hardware_config_filename, R.id.active_filename, R.id.included_header);
- String var1 = this.g.getFilenameFromPrefs(R.string.pref_hardware_config_filename, "No current file!");
- if(!var1.equals("K9LegacyBot") && !var1.equals("K9USBBot")) {
- this.a();
- } else {
- this.d();
- }
-
- this.b.setOnClickListener(new OnClickListener() {
- public void onClick(View var1) {
- AutoConfigureActivity.this.f = new Thread(new Runnable() {
- public void run() {
- try {
- DbgLog.msg("Scanning USB bus");
- AutoConfigureActivity.this.scannedDevices = AutoConfigureActivity.this.d.scanForUsbDevices();
- } catch (RobotCoreException var2) {
- DbgLog.error("Device scan failed");
- }
-
- AutoConfigureActivity.this.runOnUiThread(new Runnable() {
- public void run() {
- AutoConfigureActivity.this.g.resetCount();
- if(AutoConfigureActivity.this.scannedDevices.size() == 0) {
- AutoConfigureActivity.this.g.saveToPreferences("No current file!", R.string.pref_hardware_config_filename);
- AutoConfigureActivity.this.g.updateHeader("No current file!", R.string.pref_hardware_config_filename, R.id.active_filename, R.id.included_header);
- AutoConfigureActivity.this.a();
- }
-
- AutoConfigureActivity.this.entries = AutoConfigureActivity.this.scannedDevices.entrySet();
- AutoConfigureActivity.this.e = new HashMap();
- AutoConfigureActivity.this.g.createLists(AutoConfigureActivity.this.entries, AutoConfigureActivity.this.e);
- if(AutoConfigureActivity.this.g()) {
- AutoConfigureActivity.this.a("K9LegacyBot");
- } else {
- AutoConfigureActivity.this.g.saveToPreferences("No current file!", R.string.pref_hardware_config_filename);
- AutoConfigureActivity.this.g.updateHeader("No current file!", R.string.pref_hardware_config_filename, R.id.active_filename, R.id.included_header);
- AutoConfigureActivity.this.b();
- }
- }
- });
- }
- });
- AutoConfigureActivity.this.f.start();
- }
- });
- this.c.setOnClickListener(new OnClickListener() {
- public void onClick(View var1) {
- AutoConfigureActivity.this.f = new Thread(new Runnable() {
- public void run() {
- try {
- DbgLog.msg("Scanning USB bus");
- AutoConfigureActivity.this.scannedDevices = AutoConfigureActivity.this.d.scanForUsbDevices();
- } catch (RobotCoreException var2) {
- DbgLog.error("Device scan failed");
- }
-
- AutoConfigureActivity.this.runOnUiThread(new Runnable() {
- public void run() {
- AutoConfigureActivity.this.g.resetCount();
- if(AutoConfigureActivity.this.scannedDevices.size() == 0) {
- AutoConfigureActivity.this.g.saveToPreferences("No current file!", R.string.pref_hardware_config_filename);
- AutoConfigureActivity.this.g.updateHeader("No current file!", R.string.pref_hardware_config_filename, R.id.active_filename, R.id.included_header);
- AutoConfigureActivity.this.a();
- }
-
- AutoConfigureActivity.this.entries = AutoConfigureActivity.this.scannedDevices.entrySet();
- AutoConfigureActivity.this.e = new HashMap();
- AutoConfigureActivity.this.g.createLists(AutoConfigureActivity.this.entries, AutoConfigureActivity.this.e);
- if(AutoConfigureActivity.this.e()) {
- AutoConfigureActivity.this.a("K9USBBot");
- } else {
- AutoConfigureActivity.this.g.saveToPreferences("No current file!", R.string.pref_hardware_config_filename);
- AutoConfigureActivity.this.g.updateHeader("No current file!", R.string.pref_hardware_config_filename, R.id.active_filename, R.id.included_header);
- AutoConfigureActivity.this.c();
- }
- }
- });
- }
- });
- AutoConfigureActivity.this.f.start();
- }
- });
- }
-}
+package com.qualcomm.ftccommon.configuration;
+
+import android.app.Activity;
+import android.content.Context;
+import android.os.Bundle;
+import android.view.View;
+import android.view.View.OnClickListener;
+import android.widget.Button;
+import android.widget.LinearLayout;
+import android.widget.Toast;
+
+import com.qualcomm.ftccommon.DbgLog;
+import com.qualcomm.ftccommon.R;
+import com.qualcomm.hardware.ModernRoboticsDeviceManager;
+import com.qualcomm.robotcore.eventloop.EventLoopManager;
+import com.qualcomm.robotcore.exception.RobotCoreException;
+import com.qualcomm.robotcore.hardware.DeviceManager;
+import com.qualcomm.robotcore.hardware.configuration.ControllerConfiguration;
+import com.qualcomm.robotcore.hardware.configuration.DeviceConfiguration;
+import com.qualcomm.robotcore.hardware.configuration.LegacyModuleControllerConfiguration;
+import com.qualcomm.robotcore.hardware.configuration.MotorConfiguration;
+import com.qualcomm.robotcore.hardware.configuration.MotorControllerConfiguration;
+import com.qualcomm.robotcore.hardware.configuration.ServoConfiguration;
+import com.qualcomm.robotcore.hardware.configuration.ServoControllerConfiguration;
+import com.qualcomm.robotcore.hardware.configuration.Utility;
+import com.qualcomm.robotcore.util.SerialNumber;
+
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.Map;
+import java.util.Map.Entry;
+import java.util.Set;
+
+public class AutoConfigureActivity extends Activity {
+ private Context a;
+ private Button b;
+ private Button c;
+ private DeviceManager d;
+ private Map e = new HashMap();
+ protected Set> entries = new HashSet();
+ private Thread f;
+ private Utility g;
+ protected Map scannedDevices = new HashMap();
+
+ private DeviceConfiguration a(DeviceConfiguration.ConfigurationType var1, String var2, int var3) {
+ return new DeviceConfiguration(var3, var1, var2, true);
+ }
+
+ private MotorControllerConfiguration a(SerialNumber var1, String var2, String var3, String var4) {
+ MotorControllerConfiguration var5;
+ if(!var1.equals(ControllerConfiguration.NO_SERIAL_NUMBER)) {
+ var5 = (MotorControllerConfiguration)this.e.get(var1);
+ } else {
+ var5 = new MotorControllerConfiguration();
+ }
+
+ var5.setName(var4);
+ ArrayList var6 = new ArrayList();
+ MotorConfiguration var7 = new MotorConfiguration(1, var2, true);
+ MotorConfiguration var8 = new MotorConfiguration(2, var3, true);
+ var6.add(var7);
+ var6.add(var8);
+ var5.addMotors(var6);
+ return var5;
+ }
+
+ private ServoControllerConfiguration a(SerialNumber var1, ArrayList var2, String var3) {
+ ServoControllerConfiguration var4;
+ if(!var1.equals(ControllerConfiguration.NO_SERIAL_NUMBER)) {
+ var4 = (ServoControllerConfiguration)this.e.get(var1);
+ } else {
+ var4 = new ServoControllerConfiguration();
+ }
+
+ var4.setName(var3);
+ ArrayList var5 = new ArrayList();
+
+ for(int var6 = 1; var6 <= 6; ++var6) {
+ String var7 = (String)var2.get(var6 - 1);
+ boolean var8;
+ if(var7.equals("NO DEVICE ATTACHED")) {
+ var8 = false;
+ } else {
+ var8 = true;
+ }
+
+ var5.add(new ServoConfiguration(var6, var7, var8));
+ }
+
+ var4.addServos(var5);
+ return var4;
+ }
+
+ private void a() {
+ this.g.setOrangeText("No devices found!", "To configure K9LegacyBot, please: \n 1. Attach a LegacyModuleController, \n with \n a. MotorController in port 0, with a \n motor in port 1 and port 2 \n b. ServoController in port 1, with a \n servo in port 1 and port 6 \n c. IR seeker in port 2\n d. Light sensor in port 3 \n 2. Press the K9LegacyBot button\n \nTo configure K9USBBot, please: \n 1. Attach a USBMotorController, with a \n motor in port 1 and port 2 \n 2. USBServoController in port 1, with a \n servo in port 1 and port 6 \n 3. LegacyModule, with \n a. IR seeker in port 2\n b. Light sensor in port 3 \n 4. Press the K9USBBot button", R.id.autoconfigure_info, R.layout.orange_warning, R.id.orangetext0, R.id.orangetext1);
+ }
+
+ private void a(SerialNumber var1, String var2) {
+ LegacyModuleControllerConfiguration var3 = (LegacyModuleControllerConfiguration)this.e.get(var1);
+ var3.setName(var2);
+ DeviceConfiguration var4 = this.a(DeviceConfiguration.ConfigurationType.IR_SEEKER, "ir_seeker", 2);
+ DeviceConfiguration var5 = this.a(DeviceConfiguration.ConfigurationType.LIGHT_SENSOR, "light_sensor", 3);
+ ArrayList var6 = new ArrayList();
+
+ for(int var7 = 0; var7 < 6; ++var7) {
+ if(var7 == 2) {
+ var6.add(var4);
+ }
+
+ if(var7 == 3) {
+ var6.add(var5);
+ } else {
+ var6.add(new DeviceConfiguration(var7));
+ }
+ }
+
+ var3.addDevices(var6);
+ }
+
+ private void a(String var1) {
+ this.g.writeXML(this.e);
+
+ try {
+ this.g.writeToFile(var1 + ".xml");
+ this.g.saveToPreferences(var1, R.string.pref_hardware_config_filename);
+ this.g.updateHeader(var1, R.string.pref_hardware_config_filename, R.id.active_filename, R.id.included_header);
+ Toast.makeText(this.a, "AutoConfigure " + var1 + " Successful", 0).show();
+ } catch (RobotCoreException var5) {
+ this.g.complainToast(var5.getMessage(), this.a);
+ DbgLog.error(var5.getMessage());
+ } catch (IOException var6) {
+ this.g.complainToast("Found " + var6.getMessage() + "\n Please fix and re-save", this.a);
+ DbgLog.error(var6.getMessage());
+ }
+ }
+
+ private void b() {
+ String var1 = "Found: \n" + this.scannedDevices.values() + "\n" + "Required: \n" + " 1. LegacyModuleController, with \n " + " a. MotorController in port 0, with a \n" + " motor in port 1 and port 2 \n " + " b. ServoController in port 1, with a \n" + " servo in port 1 and port 6 \n" + " c. IR seeker in port 2\n" + " d. Light sensor in port 3 ";
+ this.g.setOrangeText("Wrong devices found!", var1, R.id.autoconfigure_info, R.layout.orange_warning, R.id.orangetext0, R.id.orangetext1);
+ }
+
+ private void b(SerialNumber var1, String var2) {
+ LegacyModuleControllerConfiguration var3 = (LegacyModuleControllerConfiguration)this.e.get(var1);
+ var3.setName(var2);
+ MotorControllerConfiguration var4 = this.a(ControllerConfiguration.NO_SERIAL_NUMBER, "motor_1", "motor_2", "wheels");
+ var4.setPort(0);
+ ArrayList var5 = this.f();
+ ServoControllerConfiguration var6 = this.a(ControllerConfiguration.NO_SERIAL_NUMBER, var5, "servos");
+ var6.setPort(1);
+ DeviceConfiguration var7 = this.a(DeviceConfiguration.ConfigurationType.IR_SEEKER, "ir_seeker", 2);
+ DeviceConfiguration var8 = this.a(DeviceConfiguration.ConfigurationType.LIGHT_SENSOR, "light_sensor", 3);
+ ArrayList var9 = new ArrayList();
+ var9.add(var4);
+ var9.add(var6);
+ var9.add(var7);
+ var9.add(var8);
+
+ for(int var14 = 4; var14 < 6; ++var14) {
+ var9.add(new DeviceConfiguration(var14));
+ }
+
+ var3.addDevices(var9);
+ }
+
+ private void c() {
+ String var1 = "Found: \n" + this.scannedDevices.values() + "\n" + "Required: \n" + " 1. USBMotorController with a \n" + " motor in port 1 and port 2 \n " + " 2. USBServoController with a \n" + " servo in port 1 and port 6 \n" + " 3. LegacyModuleController, with \n " + " a. IR seeker in port 2\n" + " b. Light sensor in port 3 ";
+ this.g.setOrangeText("Wrong devices found!", var1, R.id.autoconfigure_info, R.layout.orange_warning, R.id.orangetext0, R.id.orangetext1);
+ }
+
+ private void d() {
+ this.g.setOrangeText("Already configured!", "", R.id.autoconfigure_info, R.layout.orange_warning, R.id.orangetext0, R.id.orangetext1);
+ }
+
+ private boolean e() {
+ Iterator var1 = this.entries.iterator();
+ boolean var2 = true;
+ boolean var3 = true;
+
+ boolean var4;
+ boolean var7;
+ for(var4 = true; var1.hasNext(); var4 = var7) {
+ Entry var5 = (Entry)var1.next();
+ DeviceManager.DeviceType var6 = (DeviceManager.DeviceType)var5.getValue();
+ if(var6 == DeviceManager.DeviceType.MODERN_ROBOTICS_USB_LEGACY_MODULE && var4) {
+ this.a((SerialNumber)var5.getKey(), "sensors");
+ var7 = false;
+ } else {
+ var7 = var4;
+ }
+
+ boolean var8;
+ if(var6 == DeviceManager.DeviceType.MODERN_ROBOTICS_USB_DC_MOTOR_CONTROLLER && var3) {
+ this.a((SerialNumber)var5.getKey(), "motor_1", "motor_2", "wheels");
+ var8 = false;
+ } else {
+ var8 = var3;
+ }
+
+ boolean var9;
+ if(var6 == DeviceManager.DeviceType.MODERN_ROBOTICS_USB_SERVO_CONTROLLER && var2) {
+ this.a((SerialNumber)var5.getKey(), this.f(), "servos");
+ var9 = false;
+ } else {
+ var9 = var2;
+ }
+
+ var2 = var9;
+ var3 = var8;
+ }
+
+ if(!var4 && !var3 && !var2) {
+ ((LinearLayout)this.findViewById(R.id.autoconfigure_info)).removeAllViews();
+ return true;
+ } else {
+ return false;
+ }
+ }
+
+ private ArrayList f() {
+ ArrayList var1 = new ArrayList();
+ var1.add("servo_1");
+ var1.add("NO DEVICE ATTACHED");
+ var1.add("NO DEVICE ATTACHED");
+ var1.add("NO DEVICE ATTACHED");
+ var1.add("NO DEVICE ATTACHED");
+ var1.add("servo_6");
+ return var1;
+ }
+
+ private boolean g() {
+ Iterator var1 = this.entries.iterator();
+
+ boolean var2;
+ boolean var4;
+ for(var2 = true; var1.hasNext(); var2 = var4) {
+ Entry var3 = (Entry)var1.next();
+ if((DeviceManager.DeviceType)var3.getValue() == DeviceManager.DeviceType.MODERN_ROBOTICS_USB_LEGACY_MODULE && var2) {
+ this.b((SerialNumber)var3.getKey(), "devices");
+ var4 = false;
+ } else {
+ var4 = var2;
+ }
+ }
+
+ if(var2) {
+ return false;
+ } else {
+ ((LinearLayout)this.findViewById(R.id.autoconfigure_info)).removeAllViews();
+ return true;
+ }
+ }
+
+ protected void onCreate(Bundle var1) {
+ super.onCreate(var1);
+ this.a = this;
+ this.setContentView(R.layout.activity_autoconfigure);
+ this.g = new Utility(this);
+ this.b = (Button)this.findViewById(R.id.configureLegacy);
+ this.c = (Button)this.findViewById(R.id.configureUSB);
+
+ try {
+ this.d = new ModernRoboticsDeviceManager(this.a, (EventLoopManager)null);
+ } catch (RobotCoreException var3) {
+ this.g.complainToast("Failed to open the Device Manager", this.a);
+ DbgLog.error("Failed to open deviceManager: " + var3.toString());
+ DbgLog.logStacktrace(var3);
+ }
+ }
+
+ protected void onStart() {
+ super.onStart();
+ this.g.updateHeader("K9LegacyBot", R.string.pref_hardware_config_filename, R.id.active_filename, R.id.included_header);
+ String var1 = this.g.getFilenameFromPrefs(R.string.pref_hardware_config_filename, "No current file!");
+ if(!var1.equals("K9LegacyBot") && !var1.equals("K9USBBot")) {
+ this.a();
+ } else {
+ this.d();
+ }
+
+ this.b.setOnClickListener(new OnClickListener() {
+ public void onClick(View var1) {
+ AutoConfigureActivity.this.f = new Thread(new Runnable() {
+ public void run() {
+ try {
+ DbgLog.msg("Scanning USB bus");
+ AutoConfigureActivity.this.scannedDevices = AutoConfigureActivity.this.d.scanForUsbDevices();
+ } catch (RobotCoreException var2) {
+ DbgLog.error("Device scan failed");
+ }
+
+ AutoConfigureActivity.this.runOnUiThread(new Runnable() {
+ public void run() {
+ AutoConfigureActivity.this.g.resetCount();
+ if(AutoConfigureActivity.this.scannedDevices.size() == 0) {
+ AutoConfigureActivity.this.g.saveToPreferences("No current file!", R.string.pref_hardware_config_filename);
+ AutoConfigureActivity.this.g.updateHeader("No current file!", R.string.pref_hardware_config_filename, R.id.active_filename, R.id.included_header);
+ AutoConfigureActivity.this.a();
+ }
+
+ AutoConfigureActivity.this.entries = AutoConfigureActivity.this.scannedDevices.entrySet();
+ AutoConfigureActivity.this.e = new HashMap();
+ AutoConfigureActivity.this.g.createLists(AutoConfigureActivity.this.entries, AutoConfigureActivity.this.e);
+ if(AutoConfigureActivity.this.g()) {
+ AutoConfigureActivity.this.a("K9LegacyBot");
+ } else {
+ AutoConfigureActivity.this.g.saveToPreferences("No current file!", R.string.pref_hardware_config_filename);
+ AutoConfigureActivity.this.g.updateHeader("No current file!", R.string.pref_hardware_config_filename, R.id.active_filename, R.id.included_header);
+ AutoConfigureActivity.this.b();
+ }
+ }
+ });
+ }
+ });
+ AutoConfigureActivity.this.f.start();
+ }
+ });
+ this.c.setOnClickListener(new OnClickListener() {
+ public void onClick(View var1) {
+ AutoConfigureActivity.this.f = new Thread(new Runnable() {
+ public void run() {
+ try {
+ DbgLog.msg("Scanning USB bus");
+ AutoConfigureActivity.this.scannedDevices = AutoConfigureActivity.this.d.scanForUsbDevices();
+ } catch (RobotCoreException var2) {
+ DbgLog.error("Device scan failed");
+ }
+
+ AutoConfigureActivity.this.runOnUiThread(new Runnable() {
+ public void run() {
+ AutoConfigureActivity.this.g.resetCount();
+ if(AutoConfigureActivity.this.scannedDevices.size() == 0) {
+ AutoConfigureActivity.this.g.saveToPreferences("No current file!", R.string.pref_hardware_config_filename);
+ AutoConfigureActivity.this.g.updateHeader("No current file!", R.string.pref_hardware_config_filename, R.id.active_filename, R.id.included_header);
+ AutoConfigureActivity.this.a();
+ }
+
+ AutoConfigureActivity.this.entries = AutoConfigureActivity.this.scannedDevices.entrySet();
+ AutoConfigureActivity.this.e = new HashMap();
+ AutoConfigureActivity.this.g.createLists(AutoConfigureActivity.this.entries, AutoConfigureActivity.this.e);
+ if(AutoConfigureActivity.this.e()) {
+ AutoConfigureActivity.this.a("K9USBBot");
+ } else {
+ AutoConfigureActivity.this.g.saveToPreferences("No current file!", R.string.pref_hardware_config_filename);
+ AutoConfigureActivity.this.g.updateHeader("No current file!", R.string.pref_hardware_config_filename, R.id.active_filename, R.id.included_header);
+ AutoConfigureActivity.this.c();
+ }
+ }
+ });
+ }
+ });
+ AutoConfigureActivity.this.f.start();
+ }
+ });
+ }
+}
diff --git a/FtcRobotController/app/src/main/java/com/qualcomm/ftccommon/configuration/EditAnalogInputDevicesActivity.java b/FtcRobotController/FtcCommon/src/main/java/com/qualcomm/ftccommon/configuration/EditAnalogInputDevicesActivity.java
similarity index 91%
rename from FtcRobotController/app/src/main/java/com/qualcomm/ftccommon/configuration/EditAnalogInputDevicesActivity.java
rename to FtcRobotController/FtcCommon/src/main/java/com/qualcomm/ftccommon/configuration/EditAnalogInputDevicesActivity.java
index 92ded0f..51b682a 100644
--- a/FtcRobotController/app/src/main/java/com/qualcomm/ftccommon/configuration/EditAnalogInputDevicesActivity.java
+++ b/FtcRobotController/FtcCommon/src/main/java/com/qualcomm/ftccommon/configuration/EditAnalogInputDevicesActivity.java
@@ -1,229 +1,230 @@
-package com.qualcomm.ftccommon.configuration;
-
-import android.app.Activity;
-import android.content.Intent;
-import android.os.Bundle;
-import android.preference.PreferenceManager;
-import android.text.Editable;
-import android.text.TextWatcher;
-import android.view.View;
-import android.widget.AdapterView;
-import android.widget.ArrayAdapter;
-import android.widget.EditText;
-import android.widget.LinearLayout;
-import android.widget.Spinner;
-import android.widget.TextView;
-import android.widget.AdapterView.OnItemSelectedListener;
-import com.qualcomm.ftccommon.R;
-import com.qualcomm.robotcore.hardware.configuration.DeviceConfiguration;
-import com.qualcomm.robotcore.hardware.configuration.Utility;
-import com.qualcomm.robotcore.util.RobotLog;
-import java.io.Serializable;
-import java.util.ArrayList;
-import java.util.Iterator;
-
-public class EditAnalogInputDevicesActivity extends Activity {
- private Utility a;
- private View b;
- private View c;
- private View d;
- private View e;
- private View f;
- private View g;
- private View h;
- private View i;
- private ArrayList j = new ArrayList();
- private OnItemSelectedListener k = new OnItemSelectedListener() {
- public void onItemSelected(AdapterView> var1, View var2, int var3, long var4) {
- String var6 = var1.getItemAtPosition(var3).toString();
- LinearLayout var7 = (LinearLayout)var2.getParent().getParent().getParent();
- if(var6.equalsIgnoreCase(DeviceConfiguration.ConfigurationType.NOTHING.toString())) {
- EditAnalogInputDevicesActivity.this.a(var7);
- } else {
- EditAnalogInputDevicesActivity.this.a(var7, var6);
- }
- }
-
- public void onNothingSelected(AdapterView> var1) {
- }
- };
-
- private View a(int var1) {
- switch(var1) {
- case 0:
- return this.b;
- case 1:
- return this.c;
- case 2:
- return this.d;
- case 3:
- return this.e;
- case 4:
- return this.f;
- case 5:
- return this.g;
- case 6:
- return this.h;
- case 7:
- return this.i;
- default:
- return null;
- }
- }
-
- private void a() {
- Bundle var1 = new Bundle();
-
- for(int var2 = 0; var2 < this.j.size(); ++var2) {
- var1.putSerializable(String.valueOf(var2), (Serializable)this.j.get(var2));
- }
-
- Intent var3 = new Intent();
- var3.putExtras(var1);
- var3.putExtras(var1);
- this.setResult(-1, var3);
- this.finish();
- }
-
- private void a(View var1) {
- ((EditText)var1.findViewById(R.id.editTextResult_analogInput)).addTextChangedListener(new EditAnalogInputDevicesActivity.a(var1, null));
- }
-
- private void a(View var1, DeviceConfiguration var2) {
- Spinner var3 = (Spinner)var1.findViewById(R.id.choiceSpinner_analogInput);
- ArrayAdapter var4 = (ArrayAdapter)var3.getAdapter();
- if(var2.isEnabled()) {
- var3.setSelection(var4.getPosition(var2.getType().toString()));
- } else {
- var3.setSelection(0);
- }
-
- var3.setOnItemSelectedListener(this.k);
- }
-
- private void a(EditText var1, DeviceConfiguration var2) {
- if(var1.getText().toString().equalsIgnoreCase("NO DEVICE ATTACHED")) {
- var1.setText("");
- var2.setName("");
- } else {
- var1.setText(var2.getName());
- }
- }
-
- private void a(LinearLayout var1) {
- int var2 = Integer.parseInt(((TextView)var1.findViewById(R.id.port_number_analogInput)).getText().toString());
- EditText var3 = (EditText)var1.findViewById(R.id.editTextResult_analogInput);
- var3.setEnabled(false);
- var3.setText("NO DEVICE ATTACHED");
- ((DeviceConfiguration)this.j.get(var2)).setEnabled(false);
- }
-
- private void a(LinearLayout var1, String var2) {
- int var3 = Integer.parseInt(((TextView)var1.findViewById(R.id.port_number_analogInput)).getText().toString());
- EditText var4 = (EditText)var1.findViewById(R.id.editTextResult_analogInput);
- var4.setEnabled(true);
- DeviceConfiguration var5 = (DeviceConfiguration)this.j.get(var3);
- var5.setType(var5.typeFromString(var2));
- var5.setEnabled(true);
- this.a(var4, var5);
- }
-
- private void b(View var1, DeviceConfiguration var2) {
- EditText var3 = (EditText)var1.findViewById(R.id.editTextResult_analogInput);
- if(var2.isEnabled()) {
- var3.setText(var2.getName());
- var3.setEnabled(true);
- } else {
- var3.setText("NO DEVICE ATTACHED");
- var3.setEnabled(false);
- }
- }
-
- public void cancelAnalogInputDevices(View var1) {
- this.setResult(0, new Intent());
- this.finish();
- }
-
- protected void onCreate(Bundle var1) {
- super.onCreate(var1);
- this.setContentView(R.layout.analog_inputs);
- PreferenceManager.setDefaultValues(this, R.xml.preferences, false);
- this.a = new Utility(this);
- RobotLog.writeLogcatToDisk(this, 1024);
- LinearLayout var2 = (LinearLayout)this.findViewById(R.id.linearLayout_analogInput0);
- this.b = this.getLayoutInflater().inflate(R.layout.analog_input_device, var2, true);
- ((TextView)this.b.findViewById(R.id.port_number_analogInput)).setText("0");
- LinearLayout var3 = (LinearLayout)this.findViewById(R.id.linearLayout_analogInput1);
- this.c = this.getLayoutInflater().inflate(R.layout.analog_input_device, var3, true);
- ((TextView)this.c.findViewById(R.id.port_number_analogInput)).setText("1");
- LinearLayout var4 = (LinearLayout)this.findViewById(R.id.linearLayout_analogInput2);
- this.d = this.getLayoutInflater().inflate(R.layout.analog_input_device, var4, true);
- ((TextView)this.d.findViewById(R.id.port_number_analogInput)).setText("2");
- LinearLayout var5 = (LinearLayout)this.findViewById(R.id.linearLayout_analogInput3);
- this.e = this.getLayoutInflater().inflate(R.layout.analog_input_device, var5, true);
- ((TextView)this.e.findViewById(R.id.port_number_analogInput)).setText("3");
- LinearLayout var6 = (LinearLayout)this.findViewById(R.id.linearLayout_analogInput4);
- this.f = this.getLayoutInflater().inflate(R.layout.analog_input_device, var6, true);
- ((TextView)this.f.findViewById(R.id.port_number_analogInput)).setText("4");
- LinearLayout var7 = (LinearLayout)this.findViewById(R.id.linearLayout_analogInput5);
- this.g = this.getLayoutInflater().inflate(R.layout.analog_input_device, var7, true);
- ((TextView)this.g.findViewById(R.id.port_number_analogInput)).setText("5");
- LinearLayout var8 = (LinearLayout)this.findViewById(R.id.linearLayout_analogInput6);
- this.h = this.getLayoutInflater().inflate(R.layout.analog_input_device, var8, true);
- ((TextView)this.h.findViewById(R.id.port_number_analogInput)).setText("6");
- LinearLayout var9 = (LinearLayout)this.findViewById(R.id.linearLayout_analogInput7);
- this.i = this.getLayoutInflater().inflate(R.layout.analog_input_device, var9, true);
- ((TextView)this.i.findViewById(R.id.port_number_analogInput)).setText("7");
- }
-
- protected void onStart() {
- super.onStart();
- this.a.updateHeader("No current file!", R.string.pref_hardware_config_filename, R.id.active_filename, R.id.included_header);
- Bundle var1 = this.getIntent().getExtras();
- if(var1 != null) {
- Iterator var2 = var1.keySet().iterator();
-
- while(var2.hasNext()) {
- String var6 = (String)var2.next();
- DeviceConfiguration var7 = (DeviceConfiguration)var1.getSerializable(var6);
- this.j.add(Integer.parseInt(var6), var7);
- }
-
- for(int var3 = 0; var3 < this.j.size(); ++var3) {
- View var4 = this.a(var3);
- DeviceConfiguration var5 = (DeviceConfiguration)this.j.get(var3);
- this.a(var4);
- this.b(var4, var5);
- this.a(var4, var5);
- }
- }
-
- }
-
- public void saveAnalogInputDevices(View var1) {
- this.a();
- }
-
- private class a implements TextWatcher {
- private int b;
-
- private a(View var2) {
- this.b = Integer.parseInt(((TextView)var2.findViewById(R.id.port_number_analogInput)).getText().toString());
- }
-
- // $FF: synthetic method
- a(View var2, Object var3) {
- this();
- }
-
- public void afterTextChanged(Editable var1) {
- ((DeviceConfiguration)EditAnalogInputDevicesActivity.this.j.get(this.b)).setName(var1.toString());
- }
-
- public void beforeTextChanged(CharSequence var1, int var2, int var3, int var4) {
- }
-
- public void onTextChanged(CharSequence var1, int var2, int var3, int var4) {
- }
- }
-}
+package com.qualcomm.ftccommon.configuration;
+
+import android.app.Activity;
+import android.content.Intent;
+import android.os.Bundle;
+import android.preference.PreferenceManager;
+import android.text.Editable;
+import android.text.TextWatcher;
+import android.view.View;
+import android.widget.AdapterView;
+import android.widget.AdapterView.OnItemSelectedListener;
+import android.widget.ArrayAdapter;
+import android.widget.EditText;
+import android.widget.LinearLayout;
+import android.widget.Spinner;
+import android.widget.TextView;
+
+import com.qualcomm.ftccommon.R;
+import com.qualcomm.robotcore.hardware.configuration.DeviceConfiguration;
+import com.qualcomm.robotcore.hardware.configuration.Utility;
+import com.qualcomm.robotcore.util.RobotLog;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+
+public class EditAnalogInputDevicesActivity extends Activity {
+ private Utility a;
+ private View b;
+ private View c;
+ private View d;
+ private View e;
+ private View f;
+ private View g;
+ private View h;
+ private View i;
+ private ArrayList j = new ArrayList();
+ private OnItemSelectedListener k = new OnItemSelectedListener() {
+ public void onItemSelected(AdapterView> var1, View var2, int var3, long var4) {
+ String var6 = var1.getItemAtPosition(var3).toString();
+ LinearLayout var7 = (LinearLayout)var2.getParent().getParent().getParent();
+ if(var6.equalsIgnoreCase(DeviceConfiguration.ConfigurationType.NOTHING.toString())) {
+ EditAnalogInputDevicesActivity.this.a(var7);
+ } else {
+ EditAnalogInputDevicesActivity.this.a(var7, var6);
+ }
+ }
+
+ public void onNothingSelected(AdapterView> var1) {
+ }
+ };
+
+ private View a(int var1) {
+ switch(var1) {
+ case 0:
+ return this.b;
+ case 1:
+ return this.c;
+ case 2:
+ return this.d;
+ case 3:
+ return this.e;
+ case 4:
+ return this.f;
+ case 5:
+ return this.g;
+ case 6:
+ return this.h;
+ case 7:
+ return this.i;
+ default:
+ return null;
+ }
+ }
+
+ private void a() {
+ Bundle var1 = new Bundle();
+
+ for(int var2 = 0; var2 < this.j.size(); ++var2) {
+ var1.putSerializable(String.valueOf(var2), this.j.get(var2));
+ }
+
+ Intent var3 = new Intent();
+ var3.putExtras(var1);
+ var3.putExtras(var1);
+ this.setResult(-1, var3);
+ this.finish();
+ }
+
+ private void a(View var1) {
+ ((EditText)var1.findViewById(R.id.editTextResult_analogInput)).addTextChangedListener(new a(var1, null));
+ }
+
+ private void a(View var1, DeviceConfiguration var2) {
+ Spinner var3 = (Spinner)var1.findViewById(R.id.choiceSpinner_analogInput);
+ ArrayAdapter var4 = (ArrayAdapter)var3.getAdapter();
+ if(var2.isEnabled()) {
+ var3.setSelection(var4.getPosition(var2.getType().toString()));
+ } else {
+ var3.setSelection(0);
+ }
+
+ var3.setOnItemSelectedListener(this.k);
+ }
+
+ private void a(EditText var1, DeviceConfiguration var2) {
+ if(var1.getText().toString().equalsIgnoreCase("NO DEVICE ATTACHED")) {
+ var1.setText("");
+ var2.setName("");
+ } else {
+ var1.setText(var2.getName());
+ }
+ }
+
+ private void a(LinearLayout var1) {
+ int var2 = Integer.parseInt(((TextView)var1.findViewById(R.id.port_number_analogInput)).getText().toString());
+ EditText var3 = (EditText)var1.findViewById(R.id.editTextResult_analogInput);
+ var3.setEnabled(false);
+ var3.setText("NO DEVICE ATTACHED");
+ this.j.get(var2).setEnabled(false);
+ }
+
+ private void a(LinearLayout var1, String var2) {
+ int var3 = Integer.parseInt(((TextView)var1.findViewById(R.id.port_number_analogInput)).getText().toString());
+ EditText var4 = (EditText)var1.findViewById(R.id.editTextResult_analogInput);
+ var4.setEnabled(true);
+ DeviceConfiguration var5 = this.j.get(var3);
+ var5.setType(var5.typeFromString(var2));
+ var5.setEnabled(true);
+ this.a(var4, var5);
+ }
+
+ private void b(View var1, DeviceConfiguration var2) {
+ EditText var3 = (EditText)var1.findViewById(R.id.editTextResult_analogInput);
+ if(var2.isEnabled()) {
+ var3.setText(var2.getName());
+ var3.setEnabled(true);
+ } else {
+ var3.setText("NO DEVICE ATTACHED");
+ var3.setEnabled(false);
+ }
+ }
+
+ public void cancelAnalogInputDevices(View var1) {
+ this.setResult(0, new Intent());
+ this.finish();
+ }
+
+ protected void onCreate(Bundle var1) {
+ super.onCreate(var1);
+ this.setContentView(R.layout.analog_inputs);
+ PreferenceManager.setDefaultValues(this, R.xml.preferences, false);
+ this.a = new Utility(this);
+ RobotLog.writeLogcatToDisk(this, 1024);
+ LinearLayout var2 = (LinearLayout)this.findViewById(R.id.linearLayout_analogInput0);
+ this.b = this.getLayoutInflater().inflate(R.layout.analog_input_device, var2, true);
+ ((TextView)this.b.findViewById(R.id.port_number_analogInput)).setText("0");
+ LinearLayout var3 = (LinearLayout)this.findViewById(R.id.linearLayout_analogInput1);
+ this.c = this.getLayoutInflater().inflate(R.layout.analog_input_device, var3, true);
+ ((TextView)this.c.findViewById(R.id.port_number_analogInput)).setText("1");
+ LinearLayout var4 = (LinearLayout)this.findViewById(R.id.linearLayout_analogInput2);
+ this.d = this.getLayoutInflater().inflate(R.layout.analog_input_device, var4, true);
+ ((TextView)this.d.findViewById(R.id.port_number_analogInput)).setText("2");
+ LinearLayout var5 = (LinearLayout)this.findViewById(R.id.linearLayout_analogInput3);
+ this.e = this.getLayoutInflater().inflate(R.layout.analog_input_device, var5, true);
+ ((TextView)this.e.findViewById(R.id.port_number_analogInput)).setText("3");
+ LinearLayout var6 = (LinearLayout)this.findViewById(R.id.linearLayout_analogInput4);
+ this.f = this.getLayoutInflater().inflate(R.layout.analog_input_device, var6, true);
+ ((TextView)this.f.findViewById(R.id.port_number_analogInput)).setText("4");
+ LinearLayout var7 = (LinearLayout)this.findViewById(R.id.linearLayout_analogInput5);
+ this.g = this.getLayoutInflater().inflate(R.layout.analog_input_device, var7, true);
+ ((TextView)this.g.findViewById(R.id.port_number_analogInput)).setText("5");
+ LinearLayout var8 = (LinearLayout)this.findViewById(R.id.linearLayout_analogInput6);
+ this.h = this.getLayoutInflater().inflate(R.layout.analog_input_device, var8, true);
+ ((TextView)this.h.findViewById(R.id.port_number_analogInput)).setText("6");
+ LinearLayout var9 = (LinearLayout)this.findViewById(R.id.linearLayout_analogInput7);
+ this.i = this.getLayoutInflater().inflate(R.layout.analog_input_device, var9, true);
+ ((TextView)this.i.findViewById(R.id.port_number_analogInput)).setText("7");
+ }
+
+ protected void onStart() {
+ super.onStart();
+ this.a.updateHeader("No current file!", R.string.pref_hardware_config_filename, R.id.active_filename, R.id.included_header);
+ Bundle var1 = this.getIntent().getExtras();
+ if(var1 != null) {
+ Iterator var2 = var1.keySet().iterator();
+
+ while(var2.hasNext()) {
+ String var6 = (String)var2.next();
+ DeviceConfiguration var7 = (DeviceConfiguration)var1.getSerializable(var6);
+ this.j.add(Integer.parseInt(var6), var7);
+ }
+
+ for(int var3 = 0; var3 < this.j.size(); ++var3) {
+ View var4 = this.a(var3);
+ DeviceConfiguration var5 = this.j.get(var3);
+ this.a(var4);
+ this.b(var4, var5);
+ this.a(var4, var5);
+ }
+ }
+
+ }
+
+ public void saveAnalogInputDevices(View var1) {
+ this.a();
+ }
+
+ private class a implements TextWatcher {
+ private int b;
+
+ private a(View var2) {
+ this.b = Integer.parseInt(((TextView)var2.findViewById(R.id.port_number_analogInput)).getText().toString());
+ }
+
+ // $FF: synthetic method
+ a(View var2, Object var3) {
+ this(var2);
+ }
+
+ public void afterTextChanged(Editable var1) {
+ EditAnalogInputDevicesActivity.this.j.get(this.b).setName(var1.toString());
+ }
+
+ public void beforeTextChanged(CharSequence var1, int var2, int var3, int var4) {
+ }
+
+ public void onTextChanged(CharSequence var1, int var2, int var3, int var4) {
+ }
+ }
+}
diff --git a/FtcRobotController/app/src/main/java/com/qualcomm/ftccommon/configuration/EditAnalogOutputDevicesActivity.java b/FtcRobotController/FtcCommon/src/main/java/com/qualcomm/ftccommon/configuration/EditAnalogOutputDevicesActivity.java
similarity index 90%
rename from FtcRobotController/app/src/main/java/com/qualcomm/ftccommon/configuration/EditAnalogOutputDevicesActivity.java
rename to FtcRobotController/FtcCommon/src/main/java/com/qualcomm/ftccommon/configuration/EditAnalogOutputDevicesActivity.java
index 7b9d555..016e25d 100644
--- a/FtcRobotController/app/src/main/java/com/qualcomm/ftccommon/configuration/EditAnalogOutputDevicesActivity.java
+++ b/FtcRobotController/FtcCommon/src/main/java/com/qualcomm/ftccommon/configuration/EditAnalogOutputDevicesActivity.java
@@ -1,193 +1,195 @@
-package com.qualcomm.ftccommon.configuration;
-
-import android.app.Activity;
-import android.content.Intent;
-import android.os.Bundle;
-import android.preference.PreferenceManager;
-import android.text.Editable;
-import android.text.TextWatcher;
-import android.view.View;
-import android.widget.AdapterView;
-import android.widget.ArrayAdapter;
-import android.widget.EditText;
-import android.widget.LinearLayout;
-import android.widget.Spinner;
-import android.widget.TextView;
-import android.widget.AdapterView.OnItemSelectedListener;
-import com.qualcomm.ftccommon.R;
-import com.qualcomm.robotcore.hardware.configuration.DeviceConfiguration;
-import com.qualcomm.robotcore.hardware.configuration.Utility;
-import com.qualcomm.robotcore.util.RobotLog;
-import java.util.ArrayList;
-import java.util.Iterator;
-
-public class EditAnalogOutputDevicesActivity extends Activity {
- private Utility a;
- private View b;
- private View c;
- private ArrayList d = new ArrayList();
- private OnItemSelectedListener e = new OnItemSelectedListener() {
- public void onItemSelected(AdapterView> var1, View var2, int var3, long var4) {
- String var6 = var1.getItemAtPosition(var3).toString();
- LinearLayout var7 = (LinearLayout)var2.getParent().getParent().getParent();
- if(var6.equalsIgnoreCase(DeviceConfiguration.ConfigurationType.NOTHING.toString())) {
- EditAnalogOutputDevicesActivity.this.a(var7);
- } else {
- EditAnalogOutputDevicesActivity.this.a(var7, var6);
- }
- }
-
- public void onNothingSelected(AdapterView> var1) {
- }
- };
-
- private View a(int var1) {
- switch(var1) {
- case 0:
- return this.b;
- case 1:
- return this.c;
- default:
- return null;
- }
- }
-
- private void a() {
- Bundle var1 = new Bundle();
-
- for(int var2 = 0; var2 < this.d.size(); ++var2) {
- DeviceConfiguration var6 = (DeviceConfiguration)this.d.get(var2);
- var1.putSerializable(String.valueOf(var2), var6);
- }
-
- Intent var3 = new Intent();
- var3.putExtras(var1);
- var3.putExtras(var1);
- this.setResult(-1, var3);
- this.finish();
- }
-
- private void a(View var1) {
- ((EditText)var1.findViewById(R.id.editTextResult_analogOutput)).addTextChangedListener(new EditAnalogOutputDevicesActivity.a(var1, null));
- }
-
- private void a(View var1, DeviceConfiguration var2) {
- Spinner var3 = (Spinner)var1.findViewById(R.id.choiceSpinner_analogOutput);
- ArrayAdapter var4 = (ArrayAdapter)var3.getAdapter();
- if(var2.isEnabled()) {
- var3.setSelection(var4.getPosition(var2.getType().toString()));
- } else {
- var3.setSelection(0);
- }
-
- var3.setOnItemSelectedListener(this.e);
- }
-
- private void a(EditText var1, DeviceConfiguration var2) {
- if(var1.getText().toString().equalsIgnoreCase("NO DEVICE ATTACHED")) {
- var1.setText("");
- var2.setName("");
- } else {
- var1.setText(var2.getName());
- }
- }
-
- private void a(LinearLayout var1) {
- int var2 = Integer.parseInt(((TextView)var1.findViewById(R.id.port_number_analogOutput)).getText().toString());
- EditText var3 = (EditText)var1.findViewById(R.id.editTextResult_analogOutput);
- var3.setEnabled(false);
- var3.setText("NO DEVICE ATTACHED");
- ((DeviceConfiguration)this.d.get(var2)).setEnabled(false);
- }
-
- private void a(LinearLayout var1, String var2) {
- int var3 = Integer.parseInt(((TextView)var1.findViewById(R.id.port_number_analogOutput)).getText().toString());
- EditText var4 = (EditText)var1.findViewById(R.id.editTextResult_analogOutput);
- var4.setEnabled(true);
- DeviceConfiguration var5 = (DeviceConfiguration)this.d.get(var3);
- var5.setType(var5.typeFromString(var2));
- var5.setEnabled(true);
- this.a(var4, var5);
- }
-
- private void b(View var1, DeviceConfiguration var2) {
- EditText var3 = (EditText)var1.findViewById(R.id.editTextResult_analogOutput);
- if(var2.isEnabled()) {
- var3.setText(var2.getName());
- var3.setEnabled(true);
- } else {
- var3.setText("NO DEVICE ATTACHED");
- var3.setEnabled(false);
- }
- }
-
- public void cancelanalogOutputDevices(View var1) {
- this.setResult(0, new Intent());
- this.finish();
- }
-
- protected void onCreate(Bundle var1) {
- super.onCreate(var1);
- this.setContentView(R.layout.analog_outputs);
- PreferenceManager.setDefaultValues(this, R.xml.preferences, false);
- this.a = new Utility(this);
- RobotLog.writeLogcatToDisk(this, 1024);
- LinearLayout var2 = (LinearLayout)this.findViewById(R.id.linearLayout_analogOutput0);
- this.b = this.getLayoutInflater().inflate(R.layout.analog_output_device, var2, true);
- ((TextView)this.b.findViewById(R.id.port_number_analogOutput)).setText("0");
- LinearLayout var3 = (LinearLayout)this.findViewById(R.id.linearLayout_analogOutput1);
- this.c = this.getLayoutInflater().inflate(R.layout.analog_output_device, var3, true);
- ((TextView)this.c.findViewById(R.id.port_number_analogOutput)).setText("1");
- }
-
- protected void onStart() {
- super.onStart();
- this.a.updateHeader("No current file!", R.string.pref_hardware_config_filename, R.id.active_filename, R.id.included_header);
- Bundle var1 = this.getIntent().getExtras();
- if(var1 != null) {
- Iterator var2 = var1.keySet().iterator();
-
- while(var2.hasNext()) {
- String var6 = (String)var2.next();
- DeviceConfiguration var7 = (DeviceConfiguration)var1.getSerializable(var6);
- this.d.add(Integer.parseInt(var6), var7);
- }
-
- for(int var3 = 0; var3 < this.d.size(); ++var3) {
- View var4 = this.a(var3);
- DeviceConfiguration var5 = (DeviceConfiguration)this.d.get(var3);
- this.a(var4);
- this.b(var4, var5);
- this.a(var4, var5);
- }
- }
-
- }
-
- public void saveanalogOutputDevices(View var1) {
- this.a();
- }
-
- private class a implements TextWatcher {
- private int b;
-
- private a(View var2) {
- this.b = Integer.parseInt(((TextView)var2.findViewById(R.id.port_number_analogOutput)).getText().toString());
- }
-
- // $FF: synthetic method
- a(View var2, Object var3) {
- this();
- }
-
- public void afterTextChanged(Editable var1) {
- ((DeviceConfiguration)EditAnalogOutputDevicesActivity.this.d.get(this.b)).setName(var1.toString());
- }
-
- public void beforeTextChanged(CharSequence var1, int var2, int var3, int var4) {
- }
-
- public void onTextChanged(CharSequence var1, int var2, int var3, int var4) {
- }
- }
-}
+package com.qualcomm.ftccommon.configuration;
+
+import android.app.Activity;
+import android.content.Intent;
+import android.os.Bundle;
+import android.preference.PreferenceManager;
+import android.text.Editable;
+import android.text.TextWatcher;
+import android.view.View;
+import android.widget.AdapterView;
+import android.widget.AdapterView.OnItemSelectedListener;
+import android.widget.ArrayAdapter;
+import android.widget.EditText;
+import android.widget.LinearLayout;
+import android.widget.Spinner;
+import android.widget.TextView;
+
+import com.qualcomm.ftccommon.R;
+import com.qualcomm.robotcore.hardware.configuration.DeviceConfiguration;
+import com.qualcomm.robotcore.hardware.configuration.Utility;
+import com.qualcomm.robotcore.util.RobotLog;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+
+public class EditAnalogOutputDevicesActivity extends Activity {
+ private Utility a;
+ private View b;
+ private View c;
+ private ArrayList d = new ArrayList();
+ private OnItemSelectedListener e = new OnItemSelectedListener() {
+ public void onItemSelected(AdapterView> var1, View var2, int var3, long var4) {
+ String var6 = var1.getItemAtPosition(var3).toString();
+ LinearLayout var7 = (LinearLayout)var2.getParent().getParent().getParent();
+ if(var6.equalsIgnoreCase(DeviceConfiguration.ConfigurationType.NOTHING.toString())) {
+ EditAnalogOutputDevicesActivity.this.a(var7);
+ } else {
+ EditAnalogOutputDevicesActivity.this.a(var7, var6);
+ }
+ }
+
+ public void onNothingSelected(AdapterView> var1) {
+ }
+ };
+
+ private View a(int var1) {
+ switch(var1) {
+ case 0:
+ return this.b;
+ case 1:
+ return this.c;
+ default:
+ return null;
+ }
+ }
+
+ private void a() {
+ Bundle var1 = new Bundle();
+
+ for(int var2 = 0; var2 < this.d.size(); ++var2) {
+ DeviceConfiguration var6 = this.d.get(var2);
+ var1.putSerializable(String.valueOf(var2), var6);
+ }
+
+ Intent var3 = new Intent();
+ var3.putExtras(var1);
+ var3.putExtras(var1);
+ this.setResult(-1, var3);
+ this.finish();
+ }
+
+ private void a(View var1) {
+ ((EditText)var1.findViewById(R.id.editTextResult_analogOutput)).addTextChangedListener(new a(var1, null));
+ }
+
+ private void a(View var1, DeviceConfiguration var2) {
+ Spinner var3 = (Spinner)var1.findViewById(R.id.choiceSpinner_analogOutput);
+ ArrayAdapter var4 = (ArrayAdapter)var3.getAdapter();
+ if(var2.isEnabled()) {
+ var3.setSelection(var4.getPosition(var2.getType().toString()));
+ } else {
+ var3.setSelection(0);
+ }
+
+ var3.setOnItemSelectedListener(this.e);
+ }
+
+ private void a(EditText var1, DeviceConfiguration var2) {
+ if(var1.getText().toString().equalsIgnoreCase("NO DEVICE ATTACHED")) {
+ var1.setText("");
+ var2.setName("");
+ } else {
+ var1.setText(var2.getName());
+ }
+ }
+
+ private void a(LinearLayout var1) {
+ int var2 = Integer.parseInt(((TextView)var1.findViewById(R.id.port_number_analogOutput)).getText().toString());
+ EditText var3 = (EditText)var1.findViewById(R.id.editTextResult_analogOutput);
+ var3.setEnabled(false);
+ var3.setText("NO DEVICE ATTACHED");
+ this.d.get(var2).setEnabled(false);
+ }
+
+ private void a(LinearLayout var1, String var2) {
+ int var3 = Integer.parseInt(((TextView)var1.findViewById(R.id.port_number_analogOutput)).getText().toString());
+ EditText var4 = (EditText)var1.findViewById(R.id.editTextResult_analogOutput);
+ var4.setEnabled(true);
+ DeviceConfiguration var5 = this.d.get(var3);
+ var5.setType(var5.typeFromString(var2));
+ var5.setEnabled(true);
+ this.a(var4, var5);
+ }
+
+ private void b(View var1, DeviceConfiguration var2) {
+ EditText var3 = (EditText)var1.findViewById(R.id.editTextResult_analogOutput);
+ if(var2.isEnabled()) {
+ var3.setText(var2.getName());
+ var3.setEnabled(true);
+ } else {
+ var3.setText("NO DEVICE ATTACHED");
+ var3.setEnabled(false);
+ }
+ }
+
+ public void cancelanalogOutputDevices(View var1) {
+ this.setResult(0, new Intent());
+ this.finish();
+ }
+
+ protected void onCreate(Bundle var1) {
+ super.onCreate(var1);
+ this.setContentView(R.layout.analog_outputs);
+ PreferenceManager.setDefaultValues(this, R.xml.preferences, false);
+ this.a = new Utility(this);
+ RobotLog.writeLogcatToDisk(this, 1024);
+ LinearLayout var2 = (LinearLayout)this.findViewById(R.id.linearLayout_analogOutput0);
+ this.b = this.getLayoutInflater().inflate(R.layout.analog_output_device, var2, true);
+ ((TextView)this.b.findViewById(R.id.port_number_analogOutput)).setText("0");
+ LinearLayout var3 = (LinearLayout)this.findViewById(R.id.linearLayout_analogOutput1);
+ this.c = this.getLayoutInflater().inflate(R.layout.analog_output_device, var3, true);
+ ((TextView)this.c.findViewById(R.id.port_number_analogOutput)).setText("1");
+ }
+
+ protected void onStart() {
+ super.onStart();
+ this.a.updateHeader("No current file!", R.string.pref_hardware_config_filename, R.id.active_filename, R.id.included_header);
+ Bundle var1 = this.getIntent().getExtras();
+ if(var1 != null) {
+ Iterator var2 = var1.keySet().iterator();
+
+ while(var2.hasNext()) {
+ String var6 = (String)var2.next();
+ DeviceConfiguration var7 = (DeviceConfiguration)var1.getSerializable(var6);
+ this.d.add(Integer.parseInt(var6), var7);
+ }
+
+ for(int var3 = 0; var3 < this.d.size(); ++var3) {
+ View var4 = this.a(var3);
+ DeviceConfiguration var5 = this.d.get(var3);
+ this.a(var4);
+ this.b(var4, var5);
+ this.a(var4, var5);
+ }
+ }
+
+ }
+
+ public void saveanalogOutputDevices(View var1) {
+ this.a();
+ }
+
+ private class a implements TextWatcher {
+ private int b;
+
+ private a(View var2) {
+ this.b = Integer.parseInt(((TextView)var2.findViewById(R.id.port_number_analogOutput)).getText().toString());
+ }
+
+ // $FF: synthetic method
+ a(View var2, Object var3) {
+ this(var2);
+ }
+
+ public void afterTextChanged(Editable var1) {
+ EditAnalogOutputDevicesActivity.this.d.get(this.b).setName(var1.toString());
+ }
+
+ public void beforeTextChanged(CharSequence var1, int var2, int var3, int var4) {
+ }
+
+ public void onTextChanged(CharSequence var1, int var2, int var3, int var4) {
+ }
+ }
+}
diff --git a/FtcRobotController/app/src/main/java/com/qualcomm/ftccommon/configuration/EditDeviceInterfaceModuleActivity.java b/FtcRobotController/FtcCommon/src/main/java/com/qualcomm/ftccommon/configuration/EditDeviceInterfaceModuleActivity.java
similarity index 91%
rename from FtcRobotController/app/src/main/java/com/qualcomm/ftccommon/configuration/EditDeviceInterfaceModuleActivity.java
rename to FtcRobotController/FtcCommon/src/main/java/com/qualcomm/ftccommon/configuration/EditDeviceInterfaceModuleActivity.java
index 1fb4f56..d101097 100644
--- a/FtcRobotController/app/src/main/java/com/qualcomm/ftccommon/configuration/EditDeviceInterfaceModuleActivity.java
+++ b/FtcRobotController/FtcCommon/src/main/java/com/qualcomm/ftccommon/configuration/EditDeviceInterfaceModuleActivity.java
@@ -1,204 +1,201 @@
-package com.qualcomm.ftccommon.configuration;
-
-import android.app.Activity;
-import android.content.Context;
-import android.content.Intent;
-import android.os.Bundle;
-import android.preference.PreferenceManager;
-import android.text.Editable;
-import android.text.TextWatcher;
-import android.view.View;
-import android.widget.AdapterView;
-import android.widget.ArrayAdapter;
-import android.widget.EditText;
-import android.widget.ListView;
-import android.widget.TextView;
-import android.widget.AdapterView.OnItemClickListener;
-import com.qualcomm.ftccommon.R;
-import com.qualcomm.ftccommon.configuration.EditAnalogInputDevicesActivity;
-import com.qualcomm.ftccommon.configuration.EditAnalogOutputDevicesActivity;
-import com.qualcomm.ftccommon.configuration.EditDigitalDevicesActivity;
-import com.qualcomm.ftccommon.configuration.EditI2cDevicesActivity;
-import com.qualcomm.ftccommon.configuration.EditPWMDevicesActivity;
-import com.qualcomm.robotcore.hardware.configuration.DeviceConfiguration;
-import com.qualcomm.robotcore.hardware.configuration.DeviceInterfaceModuleConfiguration;
-import com.qualcomm.robotcore.hardware.configuration.Utility;
-import com.qualcomm.robotcore.util.RobotLog;
-import java.io.Serializable;
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-
-public class EditDeviceInterfaceModuleActivity extends Activity {
- public static final int EDIT_ANALOG_INPUT_REQUEST_CODE = 203;
- public static final int EDIT_ANALOG_OUTPUT_REQUEST_CODE = 205;
- public static final String EDIT_DEVICE_INTERFACE_MODULE_CONFIG = "EDIT_DEVICE_INTERFACE_MODULE_CONFIG";
- public static final int EDIT_DIGITAL_REQUEST_CODE = 204;
- public static final int EDIT_I2C_PORT_REQUEST_CODE = 202;
- public static final int EDIT_PWM_PORT_REQUEST_CODE = 201;
- private Utility a;
- private String b;
- private Context c;
- private DeviceInterfaceModuleConfiguration d;
- private EditText e;
- private ArrayList f = new ArrayList();
- private OnItemClickListener g = new OnItemClickListener() {
- public void onItemClick(AdapterView> var1, View var2, int var3, long var4) {
- switch(var3) {
- case 0:
- EditDeviceInterfaceModuleActivity.this.a(201, EditDeviceInterfaceModuleActivity.this.d.getPwmDevices(), EditPWMDevicesActivity.class);
- return;
- case 1:
- EditDeviceInterfaceModuleActivity.this.a(202, EditDeviceInterfaceModuleActivity.this.d.getI2cDevices(), EditI2cDevicesActivity.class);
- return;
- case 2:
- EditDeviceInterfaceModuleActivity.this.a(203, EditDeviceInterfaceModuleActivity.this.d.getAnalogInputDevices(), EditAnalogInputDevicesActivity.class);
- return;
- case 3:
- EditDeviceInterfaceModuleActivity.this.a(204, EditDeviceInterfaceModuleActivity.this.d.getDigitalDevices(), EditDigitalDevicesActivity.class);
- return;
- case 4:
- EditDeviceInterfaceModuleActivity.this.a(205, EditDeviceInterfaceModuleActivity.this.d.getAnalogOutputDevices(), EditAnalogOutputDevicesActivity.class);
- return;
- default:
- }
- }
- };
-
- private ArrayList a(Bundle var1) {
- ArrayList var2 = new ArrayList();
- Iterator var3 = var1.keySet().iterator();
-
- while(var3.hasNext()) {
- String var4 = (String)var3.next();
- DeviceConfiguration var5 = (DeviceConfiguration)var1.getSerializable(var4);
- var2.add(Integer.parseInt(var4), var5);
- }
-
- return var2;
- }
-
- private void a() {
- if(!this.b.toLowerCase().contains("Unsaved".toLowerCase())) {
- String var1 = "Unsaved " + this.b;
- this.a.saveToPreferences(var1, R.string.pref_hardware_config_filename);
- this.b = var1;
- }
-
- this.a.updateHeader("No current file!", R.string.pref_hardware_config_filename, R.id.active_filename, R.id.included_header);
- }
-
- private void a(int var1, List var2, Class var3) {
- Bundle var4 = new Bundle();
-
- for(int var5 = 0; var5 < var2.size(); ++var5) {
- var4.putSerializable(String.valueOf(var5), (Serializable)var2.get(var5));
- }
-
- Intent var6 = new Intent(this.c, var3);
- var6.putExtras(var4);
- this.setResult(-1, var6);
- this.startActivityForResult(var6, var1);
- }
-
- private void b() {
- Intent var1 = new Intent();
- this.d.setName(this.e.getText().toString());
- var1.putExtra("EDIT_DEVICE_INTERFACE_MODULE_CONFIG", this.d);
- this.setResult(-1, var1);
- this.finish();
- }
-
- public void cancelDeviceInterface(View var1) {
- this.setResult(0, new Intent());
- this.finish();
- }
-
- protected void onActivityResult(int var1, int var2, Intent var3) {
- if(var2 == -1) {
- if(var1 == 201) {
- Bundle var8 = var3.getExtras();
- if(var8 != null) {
- this.d.setPwmDevices(this.a(var8));
- }
- } else if(var1 == 203) {
- Bundle var7 = var3.getExtras();
- if(var7 != null) {
- this.d.setAnalogInputDevices(this.a(var7));
- }
- } else if(var1 == 204) {
- Bundle var6 = var3.getExtras();
- if(var6 != null) {
- this.d.setDigitalDevices(this.a(var6));
- }
- } else if(var1 == 202) {
- Bundle var5 = var3.getExtras();
- if(var5 != null) {
- this.d.setI2cDevices(this.a(var5));
- }
- } else if(var1 == 205) {
- Bundle var4 = var3.getExtras();
- if(var4 != null) {
- this.d.setAnalogOutputDevices(this.a(var4));
- }
- }
-
- this.a();
- }
-
- }
-
- protected void onCreate(Bundle var1) {
- super.onCreate(var1);
- this.setContentView(R.layout.device_interface_module);
- String[] var2 = this.getResources().getStringArray(R.array.device_interface_module_options_array);
- ListView var3 = (ListView)this.findViewById(R.id.listView_devices);
- var3.setAdapter(new ArrayAdapter(this, 17367043, var2));
- var3.setOnItemClickListener(this.g);
- this.c = this;
- PreferenceManager.setDefaultValues(this, R.xml.preferences, false);
- this.a = new Utility(this);
- RobotLog.writeLogcatToDisk(this, 1024);
- this.e = (EditText)this.findViewById(R.id.device_interface_module_name);
- this.e.addTextChangedListener(new EditDeviceInterfaceModuleActivity.a(null));
- }
-
- protected void onStart() {
- super.onStart();
- this.a.updateHeader("No current file!", R.string.pref_hardware_config_filename, R.id.active_filename, R.id.included_header);
- this.b = this.a.getFilenameFromPrefs(R.string.pref_hardware_config_filename, "No current file!");
- Serializable var1 = this.getIntent().getSerializableExtra("EDIT_DEVICE_INTERFACE_MODULE_CONFIG");
- if(var1 != null) {
- this.d = (DeviceInterfaceModuleConfiguration)var1;
- this.f = (ArrayList)this.d.getDevices();
- this.e.setText(this.d.getName());
- ((TextView)this.findViewById(R.id.device_interface_module_serialNumber)).setText(this.d.getSerialNumber().toString());
- }
-
- }
-
- public void saveDeviceInterface(View var1) {
- this.b();
- }
-
- private class a implements TextWatcher {
- private a() {
- }
-
- // $FF: synthetic method
- a(Object var2) {
- this();
- }
-
- public void afterTextChanged(Editable var1) {
- String var2 = var1.toString();
- EditDeviceInterfaceModuleActivity.this.d.setName(var2);
- }
-
- public void beforeTextChanged(CharSequence var1, int var2, int var3, int var4) {
- }
-
- public void onTextChanged(CharSequence var1, int var2, int var3, int var4) {
- }
- }
-}
+package com.qualcomm.ftccommon.configuration;
+
+import android.app.Activity;
+import android.content.Context;
+import android.content.Intent;
+import android.os.Bundle;
+import android.preference.PreferenceManager;
+import android.text.Editable;
+import android.text.TextWatcher;
+import android.view.View;
+import android.widget.AdapterView;
+import android.widget.AdapterView.OnItemClickListener;
+import android.widget.ArrayAdapter;
+import android.widget.EditText;
+import android.widget.ListView;
+import android.widget.TextView;
+
+import com.qualcomm.ftccommon.R;
+import com.qualcomm.robotcore.hardware.configuration.DeviceConfiguration;
+import com.qualcomm.robotcore.hardware.configuration.DeviceInterfaceModuleConfiguration;
+import com.qualcomm.robotcore.hardware.configuration.Utility;
+import com.qualcomm.robotcore.util.RobotLog;
+
+import java.io.Serializable;
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+
+public class EditDeviceInterfaceModuleActivity extends Activity {
+ public static final int EDIT_ANALOG_INPUT_REQUEST_CODE = 203;
+ public static final int EDIT_ANALOG_OUTPUT_REQUEST_CODE = 205;
+ public static final String EDIT_DEVICE_INTERFACE_MODULE_CONFIG = "EDIT_DEVICE_INTERFACE_MODULE_CONFIG";
+ public static final int EDIT_DIGITAL_REQUEST_CODE = 204;
+ public static final int EDIT_I2C_PORT_REQUEST_CODE = 202;
+ public static final int EDIT_PWM_PORT_REQUEST_CODE = 201;
+ private Utility a;
+ private String b;
+ private Context c;
+ private DeviceInterfaceModuleConfiguration d;
+ private EditText e;
+ private ArrayList f = new ArrayList();
+ private OnItemClickListener g = new OnItemClickListener() {
+ public void onItemClick(AdapterView> var1, View var2, int var3, long var4) {
+ switch(var3) {
+ case 0:
+ EditDeviceInterfaceModuleActivity.this.a(201, EditDeviceInterfaceModuleActivity.this.d.getPwmDevices(), EditPWMDevicesActivity.class);
+ return;
+ case 1:
+ EditDeviceInterfaceModuleActivity.this.a(202, EditDeviceInterfaceModuleActivity.this.d.getI2cDevices(), EditI2cDevicesActivity.class);
+ return;
+ case 2:
+ EditDeviceInterfaceModuleActivity.this.a(203, EditDeviceInterfaceModuleActivity.this.d.getAnalogInputDevices(), EditAnalogInputDevicesActivity.class);
+ return;
+ case 3:
+ EditDeviceInterfaceModuleActivity.this.a(204, EditDeviceInterfaceModuleActivity.this.d.getDigitalDevices(), EditDigitalDevicesActivity.class);
+ return;
+ case 4:
+ EditDeviceInterfaceModuleActivity.this.a(205, EditDeviceInterfaceModuleActivity.this.d.getAnalogOutputDevices(), EditAnalogOutputDevicesActivity.class);
+ return;
+ default:
+ }
+ }
+ };
+
+ private ArrayList a(Bundle var1) {
+ ArrayList var2 = new ArrayList();
+ Iterator var3 = var1.keySet().iterator();
+
+ while(var3.hasNext()) {
+ String var4 = (String)var3.next();
+ DeviceConfiguration var5 = (DeviceConfiguration)var1.getSerializable(var4);
+ var2.add(Integer.parseInt(var4), var5);
+ }
+
+ return var2;
+ }
+
+ private void a() {
+ if(!this.b.toLowerCase().contains("Unsaved".toLowerCase())) {
+ String var1 = "Unsaved " + this.b;
+ this.a.saveToPreferences(var1, R.string.pref_hardware_config_filename);
+ this.b = var1;
+ }
+
+ this.a.updateHeader("No current file!", R.string.pref_hardware_config_filename, R.id.active_filename, R.id.included_header);
+ }
+
+ private void a(int var1, List var2, Class var3) {
+ Bundle var4 = new Bundle();
+
+ for(int var5 = 0; var5 < var2.size(); ++var5) {
+ var4.putSerializable(String.valueOf(var5), (Serializable)var2.get(var5));
+ }
+
+ Intent var6 = new Intent(this.c, var3);
+ var6.putExtras(var4);
+ this.setResult(-1, var6);
+ this.startActivityForResult(var6, var1);
+ }
+
+ private void b() {
+ Intent var1 = new Intent();
+ this.d.setName(this.e.getText().toString());
+ var1.putExtra("EDIT_DEVICE_INTERFACE_MODULE_CONFIG", this.d);
+ this.setResult(-1, var1);
+ this.finish();
+ }
+
+ public void cancelDeviceInterface(View var1) {
+ this.setResult(0, new Intent());
+ this.finish();
+ }
+
+ protected void onActivityResult(int var1, int var2, Intent var3) {
+ if(var2 == -1) {
+ if(var1 == 201) {
+ Bundle var8 = var3.getExtras();
+ if(var8 != null) {
+ this.d.setPwmDevices(this.a(var8));
+ }
+ } else if(var1 == 203) {
+ Bundle var7 = var3.getExtras();
+ if(var7 != null) {
+ this.d.setAnalogInputDevices(this.a(var7));
+ }
+ } else if(var1 == 204) {
+ Bundle var6 = var3.getExtras();
+ if(var6 != null) {
+ this.d.setDigitalDevices(this.a(var6));
+ }
+ } else if(var1 == 202) {
+ Bundle var5 = var3.getExtras();
+ if(var5 != null) {
+ this.d.setI2cDevices(this.a(var5));
+ }
+ } else if(var1 == 205) {
+ Bundle var4 = var3.getExtras();
+ if(var4 != null) {
+ this.d.setAnalogOutputDevices(this.a(var4));
+ }
+ }
+
+ this.a();
+ }
+
+ }
+
+ protected void onCreate(Bundle var1) {
+ super.onCreate(var1);
+ this.setContentView(R.layout.device_interface_module);
+ String[] var2 = this.getResources().getStringArray(R.array.device_interface_module_options_array);
+ ListView var3 = (ListView)this.findViewById(R.id.listView_devices);
+ var3.setAdapter(new ArrayAdapter(this, 17367043, var2));
+ var3.setOnItemClickListener(this.g);
+ this.c = this;
+ PreferenceManager.setDefaultValues(this, R.xml.preferences, false);
+ this.a = new Utility(this);
+ RobotLog.writeLogcatToDisk(this, 1024);
+ this.e = (EditText)this.findViewById(R.id.device_interface_module_name);
+ this.e.addTextChangedListener(new a(null));
+ }
+
+ protected void onStart() {
+ super.onStart();
+ this.a.updateHeader("No current file!", R.string.pref_hardware_config_filename, R.id.active_filename, R.id.included_header);
+ this.b = this.a.getFilenameFromPrefs(R.string.pref_hardware_config_filename, "No current file!");
+ Serializable var1 = this.getIntent().getSerializableExtra("EDIT_DEVICE_INTERFACE_MODULE_CONFIG");
+ if(var1 != null) {
+ this.d = (DeviceInterfaceModuleConfiguration)var1;
+ this.f = (ArrayList)this.d.getDevices();
+ this.e.setText(this.d.getName());
+ ((TextView)this.findViewById(R.id.device_interface_module_serialNumber)).setText(this.d.getSerialNumber().toString());
+ }
+
+ }
+
+ public void saveDeviceInterface(View var1) {
+ this.b();
+ }
+
+ private class a implements TextWatcher {
+ private a() {
+ }
+
+ // $FF: synthetic method
+ a(Object var2) {
+ this();
+ }
+
+ public void afterTextChanged(Editable var1) {
+ String var2 = var1.toString();
+ EditDeviceInterfaceModuleActivity.this.d.setName(var2);
+ }
+
+ public void beforeTextChanged(CharSequence var1, int var2, int var3, int var4) {
+ }
+
+ public void onTextChanged(CharSequence var1, int var2, int var3, int var4) {
+ }
+ }
+}
diff --git a/FtcRobotController/app/src/main/java/com/qualcomm/ftccommon/configuration/EditDigitalDevicesActivity.java b/FtcRobotController/FtcCommon/src/main/java/com/qualcomm/ftccommon/configuration/EditDigitalDevicesActivity.java
similarity index 91%
rename from FtcRobotController/app/src/main/java/com/qualcomm/ftccommon/configuration/EditDigitalDevicesActivity.java
rename to FtcRobotController/FtcCommon/src/main/java/com/qualcomm/ftccommon/configuration/EditDigitalDevicesActivity.java
index 5ca5012..8920f08 100644
--- a/FtcRobotController/app/src/main/java/com/qualcomm/ftccommon/configuration/EditDigitalDevicesActivity.java
+++ b/FtcRobotController/FtcCommon/src/main/java/com/qualcomm/ftccommon/configuration/EditDigitalDevicesActivity.java
@@ -1,229 +1,230 @@
-package com.qualcomm.ftccommon.configuration;
-
-import android.app.Activity;
-import android.content.Intent;
-import android.os.Bundle;
-import android.preference.PreferenceManager;
-import android.text.Editable;
-import android.text.TextWatcher;
-import android.view.View;
-import android.widget.AdapterView;
-import android.widget.ArrayAdapter;
-import android.widget.EditText;
-import android.widget.LinearLayout;
-import android.widget.Spinner;
-import android.widget.TextView;
-import android.widget.AdapterView.OnItemSelectedListener;
-import com.qualcomm.ftccommon.R;
-import com.qualcomm.robotcore.hardware.configuration.DeviceConfiguration;
-import com.qualcomm.robotcore.hardware.configuration.Utility;
-import com.qualcomm.robotcore.util.RobotLog;
-import java.io.Serializable;
-import java.util.ArrayList;
-import java.util.Iterator;
-
-public class EditDigitalDevicesActivity extends Activity {
- private Utility a;
- private View b;
- private View c;
- private View d;
- private View e;
- private View f;
- private View g;
- private View h;
- private View i;
- private ArrayList j = new ArrayList();
- private OnItemSelectedListener k = new OnItemSelectedListener() {
- public void onItemSelected(AdapterView> var1, View var2, int var3, long var4) {
- String var6 = var1.getItemAtPosition(var3).toString();
- LinearLayout var7 = (LinearLayout)var2.getParent().getParent().getParent();
- if(var6.equalsIgnoreCase(DeviceConfiguration.ConfigurationType.NOTHING.toString())) {
- EditDigitalDevicesActivity.this.a(var7);
- } else {
- EditDigitalDevicesActivity.this.a(var7, var6);
- }
- }
-
- public void onNothingSelected(AdapterView> var1) {
- }
- };
-
- private View a(int var1) {
- switch(var1) {
- case 0:
- return this.b;
- case 1:
- return this.c;
- case 2:
- return this.d;
- case 3:
- return this.e;
- case 4:
- return this.f;
- case 5:
- return this.g;
- case 6:
- return this.h;
- case 7:
- return this.i;
- default:
- return null;
- }
- }
-
- private void a() {
- Bundle var1 = new Bundle();
-
- for(int var2 = 0; var2 < this.j.size(); ++var2) {
- var1.putSerializable(String.valueOf(var2), (Serializable)this.j.get(var2));
- }
-
- Intent var3 = new Intent();
- var3.putExtras(var1);
- var3.putExtras(var1);
- this.setResult(-1, var3);
- this.finish();
- }
-
- private void a(View var1) {
- ((EditText)var1.findViewById(R.id.editTextResult_digital_device)).addTextChangedListener(new EditDigitalDevicesActivity.a(var1, null));
- }
-
- private void a(View var1, DeviceConfiguration var2) {
- Spinner var3 = (Spinner)var1.findViewById(R.id.choiceSpinner_digital_device);
- ArrayAdapter var4 = (ArrayAdapter)var3.getAdapter();
- if(var2.isEnabled()) {
- var3.setSelection(var4.getPosition(var2.getType().toString()));
- } else {
- var3.setSelection(0);
- }
-
- var3.setOnItemSelectedListener(this.k);
- }
-
- private void a(EditText var1, DeviceConfiguration var2) {
- if(var1.getText().toString().equalsIgnoreCase("NO DEVICE ATTACHED")) {
- var1.setText("");
- var2.setName("");
- } else {
- var1.setText(var2.getName());
- }
- }
-
- private void a(LinearLayout var1) {
- int var2 = Integer.parseInt(((TextView)var1.findViewById(R.id.port_number_digital_device)).getText().toString());
- EditText var3 = (EditText)var1.findViewById(R.id.editTextResult_digital_device);
- var3.setEnabled(false);
- var3.setText("NO DEVICE ATTACHED");
- ((DeviceConfiguration)this.j.get(var2)).setEnabled(false);
- }
-
- private void a(LinearLayout var1, String var2) {
- int var3 = Integer.parseInt(((TextView)var1.findViewById(R.id.port_number_digital_device)).getText().toString());
- EditText var4 = (EditText)var1.findViewById(R.id.editTextResult_digital_device);
- var4.setEnabled(true);
- DeviceConfiguration var5 = (DeviceConfiguration)this.j.get(var3);
- var5.setType(var5.typeFromString(var2));
- var5.setEnabled(true);
- this.a(var4, var5);
- }
-
- private void b(View var1, DeviceConfiguration var2) {
- EditText var3 = (EditText)var1.findViewById(R.id.editTextResult_digital_device);
- if(var2.isEnabled()) {
- var3.setText(var2.getName());
- var3.setEnabled(true);
- } else {
- var3.setText("NO DEVICE ATTACHED");
- var3.setEnabled(false);
- }
- }
-
- public void cancelDigitalDevices(View var1) {
- this.setResult(0, new Intent());
- this.finish();
- }
-
- protected void onCreate(Bundle var1) {
- super.onCreate(var1);
- this.setContentView(R.layout.digital_devices);
- PreferenceManager.setDefaultValues(this, R.xml.preferences, false);
- this.a = new Utility(this);
- RobotLog.writeLogcatToDisk(this, 1024);
- LinearLayout var2 = (LinearLayout)this.findViewById(R.id.linearLayout_digital_device0);
- this.b = this.getLayoutInflater().inflate(R.layout.digital_device, var2, true);
- ((TextView)this.b.findViewById(R.id.port_number_digital_device)).setText("0");
- LinearLayout var3 = (LinearLayout)this.findViewById(R.id.linearLayout_digital_device1);
- this.c = this.getLayoutInflater().inflate(R.layout.digital_device, var3, true);
- ((TextView)this.c.findViewById(R.id.port_number_digital_device)).setText("1");
- LinearLayout var4 = (LinearLayout)this.findViewById(R.id.linearLayout_digital_device2);
- this.d = this.getLayoutInflater().inflate(R.layout.digital_device, var4, true);
- ((TextView)this.d.findViewById(R.id.port_number_digital_device)).setText("2");
- LinearLayout var5 = (LinearLayout)this.findViewById(R.id.linearLayout_digital_device3);
- this.e = this.getLayoutInflater().inflate(R.layout.digital_device, var5, true);
- ((TextView)this.e.findViewById(R.id.port_number_digital_device)).setText("3");
- LinearLayout var6 = (LinearLayout)this.findViewById(R.id.linearLayout_digital_device4);
- this.f = this.getLayoutInflater().inflate(R.layout.digital_device, var6, true);
- ((TextView)this.f.findViewById(R.id.port_number_digital_device)).setText("4");
- LinearLayout var7 = (LinearLayout)this.findViewById(R.id.linearLayout_digital_device5);
- this.g = this.getLayoutInflater().inflate(R.layout.digital_device, var7, true);
- ((TextView)this.g.findViewById(R.id.port_number_digital_device)).setText("5");
- LinearLayout var8 = (LinearLayout)this.findViewById(R.id.linearLayout_digital_device6);
- this.h = this.getLayoutInflater().inflate(R.layout.digital_device, var8, true);
- ((TextView)this.h.findViewById(R.id.port_number_digital_device)).setText("6");
- LinearLayout var9 = (LinearLayout)this.findViewById(R.id.linearLayout_digital_device7);
- this.i = this.getLayoutInflater().inflate(R.layout.digital_device, var9, true);
- ((TextView)this.i.findViewById(R.id.port_number_digital_device)).setText("7");
- }
-
- protected void onStart() {
- super.onStart();
- this.a.updateHeader("No current file!", R.string.pref_hardware_config_filename, R.id.active_filename, R.id.included_header);
- Bundle var1 = this.getIntent().getExtras();
- if(var1 != null) {
- Iterator var2 = var1.keySet().iterator();
-
- while(var2.hasNext()) {
- String var6 = (String)var2.next();
- DeviceConfiguration var7 = (DeviceConfiguration)var1.getSerializable(var6);
- this.j.add(Integer.parseInt(var6), var7);
- }
-
- for(int var3 = 0; var3 < this.j.size(); ++var3) {
- View var4 = this.a(var3);
- DeviceConfiguration var5 = (DeviceConfiguration)this.j.get(var3);
- this.a(var4);
- this.b(var4, var5);
- this.a(var4, var5);
- }
- }
-
- }
-
- public void saveDigitalDevices(View var1) {
- this.a();
- }
-
- private class a implements TextWatcher {
- private int b;
-
- private a(View var2) {
- this.b = Integer.parseInt(((TextView)var2.findViewById(R.id.port_number_digital_device)).getText().toString());
- }
-
- // $FF: synthetic method
- a(View var2, Object var3) {
- this();
- }
-
- public void afterTextChanged(Editable var1) {
- ((DeviceConfiguration)EditDigitalDevicesActivity.this.j.get(this.b)).setName(var1.toString());
- }
-
- public void beforeTextChanged(CharSequence var1, int var2, int var3, int var4) {
- }
-
- public void onTextChanged(CharSequence var1, int var2, int var3, int var4) {
- }
- }
-}
+package com.qualcomm.ftccommon.configuration;
+
+import android.app.Activity;
+import android.content.Intent;
+import android.os.Bundle;
+import android.preference.PreferenceManager;
+import android.text.Editable;
+import android.text.TextWatcher;
+import android.view.View;
+import android.widget.AdapterView;
+import android.widget.AdapterView.OnItemSelectedListener;
+import android.widget.ArrayAdapter;
+import android.widget.EditText;
+import android.widget.LinearLayout;
+import android.widget.Spinner;
+import android.widget.TextView;
+
+import com.qualcomm.ftccommon.R;
+import com.qualcomm.robotcore.hardware.configuration.DeviceConfiguration;
+import com.qualcomm.robotcore.hardware.configuration.Utility;
+import com.qualcomm.robotcore.util.RobotLog;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+
+public class EditDigitalDevicesActivity extends Activity {
+ private Utility a;
+ private View b;
+ private View c;
+ private View d;
+ private View e;
+ private View f;
+ private View g;
+ private View h;
+ private View i;
+ private ArrayList j = new ArrayList();
+ private OnItemSelectedListener k = new OnItemSelectedListener() {
+ public void onItemSelected(AdapterView> var1, View var2, int var3, long var4) {
+ String var6 = var1.getItemAtPosition(var3).toString();
+ LinearLayout var7 = (LinearLayout)var2.getParent().getParent().getParent();
+ if(var6.equalsIgnoreCase(DeviceConfiguration.ConfigurationType.NOTHING.toString())) {
+ EditDigitalDevicesActivity.this.a(var7);
+ } else {
+ EditDigitalDevicesActivity.this.a(var7, var6);
+ }
+ }
+
+ public void onNothingSelected(AdapterView> var1) {
+ }
+ };
+
+ private View a(int var1) {
+ switch(var1) {
+ case 0:
+ return this.b;
+ case 1:
+ return this.c;
+ case 2:
+ return this.d;
+ case 3:
+ return this.e;
+ case 4:
+ return this.f;
+ case 5:
+ return this.g;
+ case 6:
+ return this.h;
+ case 7:
+ return this.i;
+ default:
+ return null;
+ }
+ }
+
+ private void a() {
+ Bundle var1 = new Bundle();
+
+ for(int var2 = 0; var2 < this.j.size(); ++var2) {
+ var1.putSerializable(String.valueOf(var2), this.j.get(var2));
+ }
+
+ Intent var3 = new Intent();
+ var3.putExtras(var1);
+ var3.putExtras(var1);
+ this.setResult(-1, var3);
+ this.finish();
+ }
+
+ private void a(View var1) {
+ ((EditText)var1.findViewById(R.id.editTextResult_digital_device)).addTextChangedListener(new a(var1, null));
+ }
+
+ private void a(View var1, DeviceConfiguration var2) {
+ Spinner var3 = (Spinner)var1.findViewById(R.id.choiceSpinner_digital_device);
+ ArrayAdapter var4 = (ArrayAdapter)var3.getAdapter();
+ if(var2.isEnabled()) {
+ var3.setSelection(var4.getPosition(var2.getType().toString()));
+ } else {
+ var3.setSelection(0);
+ }
+
+ var3.setOnItemSelectedListener(this.k);
+ }
+
+ private void a(EditText var1, DeviceConfiguration var2) {
+ if(var1.getText().toString().equalsIgnoreCase("NO DEVICE ATTACHED")) {
+ var1.setText("");
+ var2.setName("");
+ } else {
+ var1.setText(var2.getName());
+ }
+ }
+
+ private void a(LinearLayout var1) {
+ int var2 = Integer.parseInt(((TextView)var1.findViewById(R.id.port_number_digital_device)).getText().toString());
+ EditText var3 = (EditText)var1.findViewById(R.id.editTextResult_digital_device);
+ var3.setEnabled(false);
+ var3.setText("NO DEVICE ATTACHED");
+ this.j.get(var2).setEnabled(false);
+ }
+
+ private void a(LinearLayout var1, String var2) {
+ int var3 = Integer.parseInt(((TextView)var1.findViewById(R.id.port_number_digital_device)).getText().toString());
+ EditText var4 = (EditText)var1.findViewById(R.id.editTextResult_digital_device);
+ var4.setEnabled(true);
+ DeviceConfiguration var5 = this.j.get(var3);
+ var5.setType(var5.typeFromString(var2));
+ var5.setEnabled(true);
+ this.a(var4, var5);
+ }
+
+ private void b(View var1, DeviceConfiguration var2) {
+ EditText var3 = (EditText)var1.findViewById(R.id.editTextResult_digital_device);
+ if(var2.isEnabled()) {
+ var3.setText(var2.getName());
+ var3.setEnabled(true);
+ } else {
+ var3.setText("NO DEVICE ATTACHED");
+ var3.setEnabled(false);
+ }
+ }
+
+ public void cancelDigitalDevices(View var1) {
+ this.setResult(0, new Intent());
+ this.finish();
+ }
+
+ protected void onCreate(Bundle var1) {
+ super.onCreate(var1);
+ this.setContentView(R.layout.digital_devices);
+ PreferenceManager.setDefaultValues(this, R.xml.preferences, false);
+ this.a = new Utility(this);
+ RobotLog.writeLogcatToDisk(this, 1024);
+ LinearLayout var2 = (LinearLayout)this.findViewById(R.id.linearLayout_digital_device0);
+ this.b = this.getLayoutInflater().inflate(R.layout.digital_device, var2, true);
+ ((TextView)this.b.findViewById(R.id.port_number_digital_device)).setText("0");
+ LinearLayout var3 = (LinearLayout)this.findViewById(R.id.linearLayout_digital_device1);
+ this.c = this.getLayoutInflater().inflate(R.layout.digital_device, var3, true);
+ ((TextView)this.c.findViewById(R.id.port_number_digital_device)).setText("1");
+ LinearLayout var4 = (LinearLayout)this.findViewById(R.id.linearLayout_digital_device2);
+ this.d = this.getLayoutInflater().inflate(R.layout.digital_device, var4, true);
+ ((TextView)this.d.findViewById(R.id.port_number_digital_device)).setText("2");
+ LinearLayout var5 = (LinearLayout)this.findViewById(R.id.linearLayout_digital_device3);
+ this.e = this.getLayoutInflater().inflate(R.layout.digital_device, var5, true);
+ ((TextView)this.e.findViewById(R.id.port_number_digital_device)).setText("3");
+ LinearLayout var6 = (LinearLayout)this.findViewById(R.id.linearLayout_digital_device4);
+ this.f = this.getLayoutInflater().inflate(R.layout.digital_device, var6, true);
+ ((TextView)this.f.findViewById(R.id.port_number_digital_device)).setText("4");
+ LinearLayout var7 = (LinearLayout)this.findViewById(R.id.linearLayout_digital_device5);
+ this.g = this.getLayoutInflater().inflate(R.layout.digital_device, var7, true);
+ ((TextView)this.g.findViewById(R.id.port_number_digital_device)).setText("5");
+ LinearLayout var8 = (LinearLayout)this.findViewById(R.id.linearLayout_digital_device6);
+ this.h = this.getLayoutInflater().inflate(R.layout.digital_device, var8, true);
+ ((TextView)this.h.findViewById(R.id.port_number_digital_device)).setText("6");
+ LinearLayout var9 = (LinearLayout)this.findViewById(R.id.linearLayout_digital_device7);
+ this.i = this.getLayoutInflater().inflate(R.layout.digital_device, var9, true);
+ ((TextView)this.i.findViewById(R.id.port_number_digital_device)).setText("7");
+ }
+
+ protected void onStart() {
+ super.onStart();
+ this.a.updateHeader("No current file!", R.string.pref_hardware_config_filename, R.id.active_filename, R.id.included_header);
+ Bundle var1 = this.getIntent().getExtras();
+ if(var1 != null) {
+ Iterator var2 = var1.keySet().iterator();
+
+ while(var2.hasNext()) {
+ String var6 = (String)var2.next();
+ DeviceConfiguration var7 = (DeviceConfiguration)var1.getSerializable(var6);
+ this.j.add(Integer.parseInt(var6), var7);
+ }
+
+ for(int var3 = 0; var3 < this.j.size(); ++var3) {
+ View var4 = this.a(var3);
+ DeviceConfiguration var5 = this.j.get(var3);
+ this.a(var4);
+ this.b(var4, var5);
+ this.a(var4, var5);
+ }
+ }
+
+ }
+
+ public void saveDigitalDevices(View var1) {
+ this.a();
+ }
+
+ private class a implements TextWatcher {
+ private int b;
+
+ private a(View var2) {
+ this.b = Integer.parseInt(((TextView)var2.findViewById(R.id.port_number_digital_device)).getText().toString());
+ }
+
+ // $FF: synthetic method
+ a(View var2, Object var3) {
+ this(var2);
+ }
+
+ public void afterTextChanged(Editable var1) {
+ EditDigitalDevicesActivity.this.j.get(this.b).setName(var1.toString());
+ }
+
+ public void beforeTextChanged(CharSequence var1, int var2, int var3, int var4) {
+ }
+
+ public void onTextChanged(CharSequence var1, int var2, int var3, int var4) {
+ }
+ }
+}
diff --git a/FtcRobotController/app/src/main/java/com/qualcomm/ftccommon/configuration/EditI2cDevicesActivity.java b/FtcRobotController/FtcCommon/src/main/java/com/qualcomm/ftccommon/configuration/EditI2cDevicesActivity.java
similarity index 91%
rename from FtcRobotController/app/src/main/java/com/qualcomm/ftccommon/configuration/EditI2cDevicesActivity.java
rename to FtcRobotController/FtcCommon/src/main/java/com/qualcomm/ftccommon/configuration/EditI2cDevicesActivity.java
index cfeb7c5..daf0ad4 100644
--- a/FtcRobotController/app/src/main/java/com/qualcomm/ftccommon/configuration/EditI2cDevicesActivity.java
+++ b/FtcRobotController/FtcCommon/src/main/java/com/qualcomm/ftccommon/configuration/EditI2cDevicesActivity.java
@@ -1,217 +1,219 @@
-package com.qualcomm.ftccommon.configuration;
-
-import android.app.Activity;
-import android.content.Intent;
-import android.os.Bundle;
-import android.preference.PreferenceManager;
-import android.text.Editable;
-import android.text.TextWatcher;
-import android.view.View;
-import android.widget.AdapterView;
-import android.widget.ArrayAdapter;
-import android.widget.EditText;
-import android.widget.LinearLayout;
-import android.widget.Spinner;
-import android.widget.TextView;
-import android.widget.AdapterView.OnItemSelectedListener;
-import com.qualcomm.ftccommon.R;
-import com.qualcomm.robotcore.hardware.configuration.DeviceConfiguration;
-import com.qualcomm.robotcore.hardware.configuration.Utility;
-import com.qualcomm.robotcore.util.RobotLog;
-import java.util.ArrayList;
-import java.util.Iterator;
-
-public class EditI2cDevicesActivity extends Activity {
- private Utility a;
- private View b;
- private View c;
- private View d;
- private View e;
- private View f;
- private View g;
- private ArrayList h = new ArrayList();
- private OnItemSelectedListener i = new OnItemSelectedListener() {
- public void onItemSelected(AdapterView> var1, View var2, int var3, long var4) {
- String var6 = var1.getItemAtPosition(var3).toString();
- LinearLayout var7 = (LinearLayout)var2.getParent().getParent().getParent();
- if(var6.equalsIgnoreCase(DeviceConfiguration.ConfigurationType.NOTHING.toString())) {
- EditI2cDevicesActivity.this.a(var7);
- } else {
- EditI2cDevicesActivity.this.a(var7, var6);
- }
- }
-
- public void onNothingSelected(AdapterView> var1) {
- }
- };
-
- private View a(int var1) {
- switch(var1) {
- case 0:
- return this.b;
- case 1:
- return this.c;
- case 2:
- return this.d;
- case 3:
- return this.e;
- case 4:
- return this.f;
- case 5:
- return this.g;
- default:
- return null;
- }
- }
-
- private void a() {
- Bundle var1 = new Bundle();
-
- for(int var2 = 0; var2 < this.h.size(); ++var2) {
- DeviceConfiguration var6 = (DeviceConfiguration)this.h.get(var2);
- var1.putSerializable(String.valueOf(var2), var6);
- }
-
- Intent var3 = new Intent();
- var3.putExtras(var1);
- var3.putExtras(var1);
- this.setResult(-1, var3);
- this.finish();
- }
-
- private void a(View var1) {
- ((EditText)var1.findViewById(R.id.editTextResult_i2c)).addTextChangedListener(new EditI2cDevicesActivity.a(var1, null));
- }
-
- private void a(View var1, DeviceConfiguration var2) {
- Spinner var3 = (Spinner)var1.findViewById(R.id.choiceSpinner_i2c);
- ArrayAdapter var4 = (ArrayAdapter)var3.getAdapter();
- if(var2.isEnabled()) {
- var3.setSelection(var4.getPosition(var2.getType().toString()));
- } else {
- var3.setSelection(0);
- }
-
- var3.setOnItemSelectedListener(this.i);
- }
-
- private void a(EditText var1, DeviceConfiguration var2) {
- if(var1.getText().toString().equalsIgnoreCase("NO DEVICE ATTACHED")) {
- var1.setText("");
- var2.setName("");
- } else {
- var1.setText(var2.getName());
- }
- }
-
- private void a(LinearLayout var1) {
- int var2 = Integer.parseInt(((TextView)var1.findViewById(R.id.port_number_i2c)).getText().toString());
- EditText var3 = (EditText)var1.findViewById(R.id.editTextResult_i2c);
- var3.setEnabled(false);
- var3.setText("NO DEVICE ATTACHED");
- ((DeviceConfiguration)this.h.get(var2)).setEnabled(false);
- }
-
- private void a(LinearLayout var1, String var2) {
- int var3 = Integer.parseInt(((TextView)var1.findViewById(R.id.port_number_i2c)).getText().toString());
- EditText var4 = (EditText)var1.findViewById(R.id.editTextResult_i2c);
- var4.setEnabled(true);
- DeviceConfiguration var5 = (DeviceConfiguration)this.h.get(var3);
- var5.setType(var5.typeFromString(var2));
- var5.setEnabled(true);
- this.a(var4, var5);
- }
-
- private void b(View var1, DeviceConfiguration var2) {
- EditText var3 = (EditText)var1.findViewById(R.id.editTextResult_i2c);
- if(var2.isEnabled()) {
- var3.setText(var2.getName());
- var3.setEnabled(true);
- } else {
- var3.setText("NO DEVICE ATTACHED");
- var3.setEnabled(false);
- }
- }
-
- public void cancelI2cDevices(View var1) {
- this.setResult(0, new Intent());
- this.finish();
- }
-
- protected void onCreate(Bundle var1) {
- super.onCreate(var1);
- this.setContentView(R.layout.i2cs);
- PreferenceManager.setDefaultValues(this, R.xml.preferences, false);
- this.a = new Utility(this);
- RobotLog.writeLogcatToDisk(this, 1024);
- LinearLayout var2 = (LinearLayout)this.findViewById(R.id.linearLayout_i2c0);
- this.b = this.getLayoutInflater().inflate(R.layout.i2c_device, var2, true);
- ((TextView)this.b.findViewById(R.id.port_number_i2c)).setText("0");
- LinearLayout var3 = (LinearLayout)this.findViewById(R.id.linearLayout_i2c1);
- this.c = this.getLayoutInflater().inflate(R.layout.i2c_device, var3, true);
- ((TextView)this.c.findViewById(R.id.port_number_i2c)).setText("1");
- LinearLayout var4 = (LinearLayout)this.findViewById(R.id.linearLayout_i2c2);
- this.d = this.getLayoutInflater().inflate(R.layout.i2c_device, var4, true);
- ((TextView)this.d.findViewById(R.id.port_number_i2c)).setText("2");
- LinearLayout var5 = (LinearLayout)this.findViewById(R.id.linearLayout_i2c3);
- this.e = this.getLayoutInflater().inflate(R.layout.i2c_device, var5, true);
- ((TextView)this.e.findViewById(R.id.port_number_i2c)).setText("3");
- LinearLayout var6 = (LinearLayout)this.findViewById(R.id.linearLayout_i2c4);
- this.f = this.getLayoutInflater().inflate(R.layout.i2c_device, var6, true);
- ((TextView)this.f.findViewById(R.id.port_number_i2c)).setText("4");
- LinearLayout var7 = (LinearLayout)this.findViewById(R.id.linearLayout_i2c5);
- this.g = this.getLayoutInflater().inflate(R.layout.i2c_device, var7, true);
- ((TextView)this.g.findViewById(R.id.port_number_i2c)).setText("5");
- }
-
- protected void onStart() {
- super.onStart();
- this.a.updateHeader("No current file!", R.string.pref_hardware_config_filename, R.id.active_filename, R.id.included_header);
- Bundle var1 = this.getIntent().getExtras();
- if(var1 != null) {
- Iterator var2 = var1.keySet().iterator();
-
- while(var2.hasNext()) {
- String var6 = (String)var2.next();
- DeviceConfiguration var7 = (DeviceConfiguration)var1.getSerializable(var6);
- this.h.add(Integer.parseInt(var6), var7);
- }
-
- for(int var3 = 0; var3 < this.h.size(); ++var3) {
- View var4 = this.a(var3);
- DeviceConfiguration var5 = (DeviceConfiguration)this.h.get(var3);
- this.a(var4);
- this.b(var4, var5);
- this.a(var4, var5);
- }
- }
-
- }
-
- public void saveI2cDevices(View var1) {
- this.a();
- }
-
- private class a implements TextWatcher {
- private int b;
-
- private a(View var2) {
- this.b = Integer.parseInt(((TextView)var2.findViewById(R.id.port_number_i2c)).getText().toString());
- }
-
- // $FF: synthetic method
- a(View var2, Object var3) {
- this();
- }
-
- public void afterTextChanged(Editable var1) {
- ((DeviceConfiguration)EditI2cDevicesActivity.this.h.get(this.b)).setName(var1.toString());
- }
-
- public void beforeTextChanged(CharSequence var1, int var2, int var3, int var4) {
- }
-
- public void onTextChanged(CharSequence var1, int var2, int var3, int var4) {
- }
- }
-}
+package com.qualcomm.ftccommon.configuration;
+
+import android.app.Activity;
+import android.content.Intent;
+import android.os.Bundle;
+import android.preference.PreferenceManager;
+import android.text.Editable;
+import android.text.TextWatcher;
+import android.view.View;
+import android.widget.AdapterView;
+import android.widget.AdapterView.OnItemSelectedListener;
+import android.widget.ArrayAdapter;
+import android.widget.EditText;
+import android.widget.LinearLayout;
+import android.widget.Spinner;
+import android.widget.TextView;
+
+import com.qualcomm.ftccommon.R;
+import com.qualcomm.robotcore.hardware.configuration.DeviceConfiguration;
+import com.qualcomm.robotcore.hardware.configuration.Utility;
+import com.qualcomm.robotcore.util.RobotLog;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+
+public class EditI2cDevicesActivity extends Activity {
+ private Utility a;
+ private View b;
+ private View c;
+ private View d;
+ private View e;
+ private View f;
+ private View g;
+ private ArrayList h = new ArrayList();
+ private OnItemSelectedListener i = new OnItemSelectedListener() {
+ public void onItemSelected(AdapterView> var1, View var2, int var3, long var4) {
+ String var6 = var1.getItemAtPosition(var3).toString();
+ LinearLayout var7 = (LinearLayout)var2.getParent().getParent().getParent();
+ if(var6.equalsIgnoreCase(DeviceConfiguration.ConfigurationType.NOTHING.toString())) {
+ EditI2cDevicesActivity.this.a(var7);
+ } else {
+ EditI2cDevicesActivity.this.a(var7, var6);
+ }
+ }
+
+ public void onNothingSelected(AdapterView> var1) {
+ }
+ };
+
+ private View a(int var1) {
+ switch(var1) {
+ case 0:
+ return this.b;
+ case 1:
+ return this.c;
+ case 2:
+ return this.d;
+ case 3:
+ return this.e;
+ case 4:
+ return this.f;
+ case 5:
+ return this.g;
+ default:
+ return null;
+ }
+ }
+
+ private void a() {
+ Bundle var1 = new Bundle();
+
+ for(int var2 = 0; var2 < this.h.size(); ++var2) {
+ DeviceConfiguration var6 = this.h.get(var2);
+ var1.putSerializable(String.valueOf(var2), var6);
+ }
+
+ Intent var3 = new Intent();
+ var3.putExtras(var1);
+ var3.putExtras(var1);
+ this.setResult(-1, var3);
+ this.finish();
+ }
+
+ private void a(View var1) {
+ ((EditText)var1.findViewById(R.id.editTextResult_i2c)).addTextChangedListener(new a(var1, null));
+ }
+
+ private void a(View var1, DeviceConfiguration var2) {
+ Spinner var3 = (Spinner)var1.findViewById(R.id.choiceSpinner_i2c);
+ ArrayAdapter var4 = (ArrayAdapter)var3.getAdapter();
+ if(var2.isEnabled()) {
+ var3.setSelection(var4.getPosition(var2.getType().toString()));
+ } else {
+ var3.setSelection(0);
+ }
+
+ var3.setOnItemSelectedListener(this.i);
+ }
+
+ private void a(EditText var1, DeviceConfiguration var2) {
+ if(var1.getText().toString().equalsIgnoreCase("NO DEVICE ATTACHED")) {
+ var1.setText("");
+ var2.setName("");
+ } else {
+ var1.setText(var2.getName());
+ }
+ }
+
+ private void a(LinearLayout var1) {
+ int var2 = Integer.parseInt(((TextView)var1.findViewById(R.id.port_number_i2c)).getText().toString());
+ EditText var3 = (EditText)var1.findViewById(R.id.editTextResult_i2c);
+ var3.setEnabled(false);
+ var3.setText("NO DEVICE ATTACHED");
+ this.h.get(var2).setEnabled(false);
+ }
+
+ private void a(LinearLayout var1, String var2) {
+ int var3 = Integer.parseInt(((TextView)var1.findViewById(R.id.port_number_i2c)).getText().toString());
+ EditText var4 = (EditText)var1.findViewById(R.id.editTextResult_i2c);
+ var4.setEnabled(true);
+ DeviceConfiguration var5 = this.h.get(var3);
+ var5.setType(var5.typeFromString(var2));
+ var5.setEnabled(true);
+ this.a(var4, var5);
+ }
+
+ private void b(View var1, DeviceConfiguration var2) {
+ EditText var3 = (EditText)var1.findViewById(R.id.editTextResult_i2c);
+ if(var2.isEnabled()) {
+ var3.setText(var2.getName());
+ var3.setEnabled(true);
+ } else {
+ var3.setText("NO DEVICE ATTACHED");
+ var3.setEnabled(false);
+ }
+ }
+
+ public void cancelI2cDevices(View var1) {
+ this.setResult(0, new Intent());
+ this.finish();
+ }
+
+ protected void onCreate(Bundle var1) {
+ super.onCreate(var1);
+ this.setContentView(R.layout.i2cs);
+ PreferenceManager.setDefaultValues(this, R.xml.preferences, false);
+ this.a = new Utility(this);
+ RobotLog.writeLogcatToDisk(this, 1024);
+ LinearLayout var2 = (LinearLayout)this.findViewById(R.id.linearLayout_i2c0);
+ this.b = this.getLayoutInflater().inflate(R.layout.i2c_device, var2, true);
+ ((TextView)this.b.findViewById(R.id.port_number_i2c)).setText("0");
+ LinearLayout var3 = (LinearLayout)this.findViewById(R.id.linearLayout_i2c1);
+ this.c = this.getLayoutInflater().inflate(R.layout.i2c_device, var3, true);
+ ((TextView)this.c.findViewById(R.id.port_number_i2c)).setText("1");
+ LinearLayout var4 = (LinearLayout)this.findViewById(R.id.linearLayout_i2c2);
+ this.d = this.getLayoutInflater().inflate(R.layout.i2c_device, var4, true);
+ ((TextView)this.d.findViewById(R.id.port_number_i2c)).setText("2");
+ LinearLayout var5 = (LinearLayout)this.findViewById(R.id.linearLayout_i2c3);
+ this.e = this.getLayoutInflater().inflate(R.layout.i2c_device, var5, true);
+ ((TextView)this.e.findViewById(R.id.port_number_i2c)).setText("3");
+ LinearLayout var6 = (LinearLayout)this.findViewById(R.id.linearLayout_i2c4);
+ this.f = this.getLayoutInflater().inflate(R.layout.i2c_device, var6, true);
+ ((TextView)this.f.findViewById(R.id.port_number_i2c)).setText("4");
+ LinearLayout var7 = (LinearLayout)this.findViewById(R.id.linearLayout_i2c5);
+ this.g = this.getLayoutInflater().inflate(R.layout.i2c_device, var7, true);
+ ((TextView)this.g.findViewById(R.id.port_number_i2c)).setText("5");
+ }
+
+ protected void onStart() {
+ super.onStart();
+ this.a.updateHeader("No current file!", R.string.pref_hardware_config_filename, R.id.active_filename, R.id.included_header);
+ Bundle var1 = this.getIntent().getExtras();
+ if(var1 != null) {
+ Iterator var2 = var1.keySet().iterator();
+
+ while(var2.hasNext()) {
+ String var6 = (String)var2.next();
+ DeviceConfiguration var7 = (DeviceConfiguration)var1.getSerializable(var6);
+ this.h.add(Integer.parseInt(var6), var7);
+ }
+
+ for(int var3 = 0; var3 < this.h.size(); ++var3) {
+ View var4 = this.a(var3);
+ DeviceConfiguration var5 = this.h.get(var3);
+ this.a(var4);
+ this.b(var4, var5);
+ this.a(var4, var5);
+ }
+ }
+
+ }
+
+ public void saveI2cDevices(View var1) {
+ this.a();
+ }
+
+ private class a implements TextWatcher {
+ private int b;
+
+ private a(View var2) {
+ this.b = Integer.parseInt(((TextView)var2.findViewById(R.id.port_number_i2c)).getText().toString());
+ }
+
+ // $FF: synthetic method
+ a(View var2, Object var3) {
+ this(var2);
+ }
+
+ public void afterTextChanged(Editable var1) {
+ EditI2cDevicesActivity.this.h.get(this.b).setName(var1.toString());
+ }
+
+ public void beforeTextChanged(CharSequence var1, int var2, int var3, int var4) {
+ }
+
+ public void onTextChanged(CharSequence var1, int var2, int var3, int var4) {
+ }
+ }
+}
diff --git a/FtcRobotController/app/src/main/java/com/qualcomm/ftccommon/configuration/EditLegacyModuleControllerActivity.java b/FtcRobotController/FtcCommon/src/main/java/com/qualcomm/ftccommon/configuration/EditLegacyModuleControllerActivity.java
similarity index 90%
rename from FtcRobotController/app/src/main/java/com/qualcomm/ftccommon/configuration/EditLegacyModuleControllerActivity.java
rename to FtcRobotController/FtcCommon/src/main/java/com/qualcomm/ftccommon/configuration/EditLegacyModuleControllerActivity.java
index ad926a0..30f7638 100644
--- a/FtcRobotController/app/src/main/java/com/qualcomm/ftccommon/configuration/EditLegacyModuleControllerActivity.java
+++ b/FtcRobotController/FtcCommon/src/main/java/com/qualcomm/ftccommon/configuration/EditLegacyModuleControllerActivity.java
@@ -1,370 +1,368 @@
-package com.qualcomm.ftccommon.configuration;
-
-import android.app.Activity;
-import android.content.Context;
-import android.content.Intent;
-import android.os.Bundle;
-import android.preference.PreferenceManager;
-import android.text.Editable;
-import android.text.TextWatcher;
-import android.view.View;
-import android.widget.AdapterView;
-import android.widget.ArrayAdapter;
-import android.widget.Button;
-import android.widget.EditText;
-import android.widget.LinearLayout;
-import android.widget.Spinner;
-import android.widget.TextView;
-import android.widget.AdapterView.OnItemSelectedListener;
-import com.qualcomm.ftccommon.R;
-import com.qualcomm.ftccommon.configuration.EditMatrixControllerActivity;
-import com.qualcomm.ftccommon.configuration.EditMotorControllerActivity;
-import com.qualcomm.ftccommon.configuration.EditServoControllerActivity;
-import com.qualcomm.robotcore.hardware.configuration.ControllerConfiguration;
-import com.qualcomm.robotcore.hardware.configuration.DeviceConfiguration;
-import com.qualcomm.robotcore.hardware.configuration.LegacyModuleControllerConfiguration;
-import com.qualcomm.robotcore.hardware.configuration.MatrixControllerConfiguration;
-import com.qualcomm.robotcore.hardware.configuration.MotorConfiguration;
-import com.qualcomm.robotcore.hardware.configuration.MotorControllerConfiguration;
-import com.qualcomm.robotcore.hardware.configuration.ServoConfiguration;
-import com.qualcomm.robotcore.hardware.configuration.ServoControllerConfiguration;
-import com.qualcomm.robotcore.hardware.configuration.Utility;
-import com.qualcomm.robotcore.util.RobotLog;
-import com.qualcomm.robotcore.util.SerialNumber;
-import java.io.Serializable;
-import java.util.ArrayList;
-
-public class EditLegacyModuleControllerActivity extends Activity {
- public static final String EDIT_LEGACY_CONFIG = "EDIT_LEGACY_CONFIG";
- public static final int EDIT_MATRIX_CONTROLLER_REQUEST_CODE = 103;
- public static final int EDIT_MOTOR_CONTROLLER_REQUEST_CODE = 101;
- public static final int EDIT_SERVO_CONTROLLER_REQUEST_CODE = 102;
- private static boolean a = false;
- private Utility b;
- private String c;
- private Context d;
- private LegacyModuleControllerConfiguration e;
- private EditText f;
- private ArrayList g = new ArrayList();
- private View h;
- private View i;
- private View j;
- private View k;
- private View l;
- private View m;
- private OnItemSelectedListener n = new OnItemSelectedListener() {
- public void onItemSelected(AdapterView> var1, View var2, int var3, long var4) {
- String var6 = var1.getItemAtPosition(var3).toString();
- LinearLayout var7 = (LinearLayout)var2.getParent().getParent().getParent();
- if(var6.equalsIgnoreCase(DeviceConfiguration.ConfigurationType.NOTHING.toString())) {
- EditLegacyModuleControllerActivity.this.a(var7);
- } else {
- EditLegacyModuleControllerActivity.this.a(var7, var6);
- }
- }
-
- public void onNothingSelected(AdapterView> var1) {
- }
- };
-
- private View a(int var1) {
- switch(var1) {
- case 0:
- return this.h;
- case 1:
- return this.i;
- case 2:
- return this.j;
- case 3:
- return this.k;
- case 4:
- return this.l;
- case 5:
- return this.m;
- default:
- return null;
- }
- }
-
- private void a() {
- Intent var1 = new Intent();
- this.e.setName(this.f.getText().toString());
- var1.putExtra("EDIT_LEGACY_CONFIG", this.e);
- this.setResult(-1, var1);
- this.finish();
- }
-
- private void a(int var1, int var2) {
- ((Button)this.a(var1).findViewById(R.id.edit_controller_btn)).setVisibility(var2);
- }
-
- private void a(int var1, String var2) {
- DeviceConfiguration var3 = (DeviceConfiguration)this.g.get(var1);
- String var4 = var3.getName();
- ArrayList var5 = new ArrayList();
- SerialNumber var6 = ControllerConfiguration.NO_SERIAL_NUMBER;
- if(!var3.getType().toString().equalsIgnoreCase(var2)) {
- Object var7 = new ControllerConfiguration("dummy module", var5, var6, DeviceConfiguration.ConfigurationType.NOTHING);
- if(var2.equalsIgnoreCase(DeviceConfiguration.ConfigurationType.MOTOR_CONTROLLER.toString())) {
- for(int var16 = 1; var16 <= 2; ++var16) {
- var5.add(new MotorConfiguration(var16));
- }
-
- var7 = new MotorControllerConfiguration(var4, var5, var6);
- ((ControllerConfiguration)var7).setPort(var1);
- } else if(var2.equalsIgnoreCase(DeviceConfiguration.ConfigurationType.SERVO_CONTROLLER.toString())) {
- for(int var14 = 1; var14 <= 6; ++var14) {
- var5.add(new ServoConfiguration(var14));
- }
-
- var7 = new ServoControllerConfiguration(var4, var5, var6);
- ((ControllerConfiguration)var7).setPort(var1);
- } else if(var2.equalsIgnoreCase(DeviceConfiguration.ConfigurationType.MATRIX_CONTROLLER.toString())) {
- ArrayList var8 = new ArrayList();
-
- for(int var9 = 1; var9 <= 4; ++var9) {
- var8.add(new MotorConfiguration(var9));
- }
-
- ArrayList var10 = new ArrayList();
-
- for(int var11 = 1; var11 <= 4; ++var11) {
- var10.add(new ServoConfiguration(var11));
- }
-
- var7 = new MatrixControllerConfiguration(var4, var8, var10, var6);
- ((ControllerConfiguration)var7).setPort(var1);
- }
-
- ((ControllerConfiguration)var7).setEnabled(true);
- this.b((DeviceConfiguration)var7);
- }
-
- }
-
- private void a(View var1, DeviceConfiguration var2) {
- Spinner var3 = (Spinner)var1.findViewById(R.id.choiceSpinner_legacyModule);
- var3.setSelection(((ArrayAdapter)var3.getAdapter()).getPosition(var2.getType().toString()));
- var3.setOnItemSelectedListener(this.n);
- String var4 = var2.getName();
- EditText var5 = (EditText)var1.findViewById(R.id.editTextResult_name);
- int var6 = Integer.parseInt(((TextView)var1.findViewById(R.id.portNumber)).getText().toString());
- var5.addTextChangedListener(new EditLegacyModuleControllerActivity.a(var2, null));
- var5.setText(var4);
- if(a) {
- RobotLog.e("[populatePort] name: " + var4 + ", port: " + var6 + ", type: " + var2.getType());
- }
-
- }
-
- private void a(EditText var1, DeviceConfiguration var2) {
- if(var1.getText().toString().equalsIgnoreCase("NO DEVICE ATTACHED")) {
- var1.setText("");
- var2.setName("");
- } else {
- var1.setText(var2.getName());
- }
- }
-
- private void a(LinearLayout var1) {
- int var2 = Integer.parseInt(((TextView)var1.findViewById(R.id.portNumber)).getText().toString());
- EditText var3 = (EditText)var1.findViewById(R.id.editTextResult_name);
- var3.setEnabled(false);
- var3.setText("NO DEVICE ATTACHED");
- DeviceConfiguration var4 = new DeviceConfiguration(DeviceConfiguration.ConfigurationType.NOTHING);
- var4.setPort(var2);
- this.b(var4);
- this.a(var2, 8);
- }
-
- private void a(LinearLayout var1, String var2) {
- int var3 = Integer.parseInt(((TextView)var1.findViewById(R.id.portNumber)).getText().toString());
- EditText var4 = (EditText)var1.findViewById(R.id.editTextResult_name);
- DeviceConfiguration var5 = (DeviceConfiguration)this.g.get(var3);
- var4.setEnabled(true);
- this.a(var4, var5);
- DeviceConfiguration.ConfigurationType var6 = var5.typeFromString(var2);
- if(var6 != DeviceConfiguration.ConfigurationType.MOTOR_CONTROLLER && var6 != DeviceConfiguration.ConfigurationType.SERVO_CONTROLLER && var6 != DeviceConfiguration.ConfigurationType.MATRIX_CONTROLLER) {
- var5.setType(var6);
- if(var6 == DeviceConfiguration.ConfigurationType.NOTHING) {
- var5.setEnabled(false);
- } else {
- var5.setEnabled(true);
- }
-
- this.a(var3, 8);
- } else {
- this.a(var3, var2);
- this.a(var3, 0);
- }
-
- if(a) {
- DeviceConfiguration var7 = (DeviceConfiguration)this.g.get(var3);
- RobotLog.e("[changeDevice] modules.get(port) name: " + var7.getName() + ", port: " + var7.getPort() + ", type: " + var7.getType());
- }
-
- }
-
- private void a(DeviceConfiguration var1) {
- var1.setName(((EditText)((LinearLayout)this.a(var1.getPort())).findViewById(R.id.editTextResult_name)).getText().toString());
- if(var1.getType() == DeviceConfiguration.ConfigurationType.MOTOR_CONTROLLER) {
- Intent var2 = new Intent(this.d, EditMotorControllerActivity.class);
- var2.putExtra("EDIT_MOTOR_CONTROLLER_CONFIG", var1);
- var2.putExtra("requestCode", 101);
- this.setResult(-1, var2);
- this.startActivityForResult(var2, 101);
- } else {
- if(var1.getType() == DeviceConfiguration.ConfigurationType.SERVO_CONTROLLER) {
- Intent var5 = new Intent(this.d, EditServoControllerActivity.class);
- var5.putExtra("Edit Servo ControllerConfiguration Activity", var1);
- this.setResult(-1, var5);
- this.startActivityForResult(var5, 102);
- return;
- }
-
- if(var1.getType() == DeviceConfiguration.ConfigurationType.MATRIX_CONTROLLER) {
- Intent var7 = new Intent(this.d, EditMatrixControllerActivity.class);
- var7.putExtra("Edit Matrix ControllerConfiguration Activity", var1);
- this.setResult(-1, var7);
- this.startActivityForResult(var7, 103);
- return;
- }
- }
-
- }
-
- private void b(DeviceConfiguration var1) {
- int var2 = var1.getPort();
- this.g.set(var2, var1);
- }
-
- private boolean c(DeviceConfiguration var1) {
- return var1.getType() == DeviceConfiguration.ConfigurationType.MOTOR_CONTROLLER || var1.getType() == DeviceConfiguration.ConfigurationType.SERVO_CONTROLLER;
- }
-
- public void cancelLegacyController(View var1) {
- this.setResult(0, new Intent());
- this.finish();
- }
-
- public void editController_portALL(View var1) {
- LinearLayout var2 = (LinearLayout)var1.getParent().getParent();
- int var3 = Integer.parseInt(((TextView)var2.findViewById(R.id.portNumber)).getText().toString());
- DeviceConfiguration var4 = (DeviceConfiguration)this.g.get(var3);
- if(!this.c(var4)) {
- this.a(var3, ((Spinner)var2.findViewById(R.id.choiceSpinner_legacyModule)).getSelectedItem().toString());
- }
-
- this.a(var4);
- }
-
- protected void onActivityResult(int var1, int var2, Intent var3) {
- if(var2 == -1) {
- Serializable var4;
- if(var1 == 101) {
- var4 = var3.getSerializableExtra("EDIT_MOTOR_CONTROLLER_CONFIG");
- } else if(var1 == 102) {
- var4 = var3.getSerializableExtra("Edit Servo ControllerConfiguration Activity");
- } else {
- var4 = null;
- if(var1 == 103) {
- var4 = var3.getSerializableExtra("Edit Matrix ControllerConfiguration Activity");
- }
- }
-
- if(var4 != null) {
- ControllerConfiguration var5 = (ControllerConfiguration)var4;
- this.b(var5);
- this.a(this.a(var5.getPort()), (DeviceConfiguration)this.g.get(var5.getPort()));
- if(!this.c.toLowerCase().contains("Unsaved".toLowerCase())) {
- String var6 = "Unsaved " + this.c;
- this.b.saveToPreferences(var6, R.string.pref_hardware_config_filename);
- this.c = var6;
- }
-
- this.b.updateHeader("No current file!", R.string.pref_hardware_config_filename, R.id.active_filename, R.id.included_header);
- }
- }
-
- }
-
- protected void onCreate(Bundle var1) {
- super.onCreate(var1);
- this.setContentView(R.layout.legacy);
- LinearLayout var2 = (LinearLayout)this.findViewById(R.id.linearLayout0);
- this.h = this.getLayoutInflater().inflate(R.layout.simple_device, var2, true);
- ((TextView)this.h.findViewById(R.id.portNumber)).setText("0");
- LinearLayout var3 = (LinearLayout)this.findViewById(R.id.linearLayout1);
- this.i = this.getLayoutInflater().inflate(R.layout.simple_device, var3, true);
- ((TextView)this.i.findViewById(R.id.portNumber)).setText("1");
- LinearLayout var4 = (LinearLayout)this.findViewById(R.id.linearLayout2);
- this.j = this.getLayoutInflater().inflate(R.layout.simple_device, var4, true);
- ((TextView)this.j.findViewById(R.id.portNumber)).setText("2");
- LinearLayout var5 = (LinearLayout)this.findViewById(R.id.linearLayout3);
- this.k = this.getLayoutInflater().inflate(R.layout.simple_device, var5, true);
- ((TextView)this.k.findViewById(R.id.portNumber)).setText("3");
- LinearLayout var6 = (LinearLayout)this.findViewById(R.id.linearLayout4);
- this.l = this.getLayoutInflater().inflate(R.layout.simple_device, var6, true);
- ((TextView)this.l.findViewById(R.id.portNumber)).setText("4");
- LinearLayout var7 = (LinearLayout)this.findViewById(R.id.linearLayout5);
- this.m = this.getLayoutInflater().inflate(R.layout.simple_device, var7, true);
- ((TextView)this.m.findViewById(R.id.portNumber)).setText("5");
- this.d = this;
- PreferenceManager.setDefaultValues(this, R.xml.preferences, false);
- this.b = new Utility(this);
- RobotLog.writeLogcatToDisk(this, 1024);
- this.f = (EditText)this.findViewById(R.id.device_interface_module_name);
- }
-
- protected void onStart() {
- super.onStart();
- this.b.updateHeader("No current file!", R.string.pref_hardware_config_filename, R.id.active_filename, R.id.included_header);
- this.c = this.b.getFilenameFromPrefs(R.string.pref_hardware_config_filename, "No current file!");
- Serializable var1 = this.getIntent().getSerializableExtra("EDIT_LEGACY_CONFIG");
- if(var1 != null) {
- this.e = (LegacyModuleControllerConfiguration)var1;
- this.g = (ArrayList)this.e.getDevices();
- this.f.setText(this.e.getName());
- this.f.addTextChangedListener(new EditLegacyModuleControllerActivity.a(this.e, null));
- ((TextView)this.findViewById(R.id.legacy_serialNumber)).setText(this.e.getSerialNumber().toString());
-
- for(int var2 = 0; var2 < this.g.size(); ++var2) {
- DeviceConfiguration var3 = (DeviceConfiguration)this.g.get(var2);
- if(a) {
- RobotLog.e("[onStart] module name: " + var3.getName() + ", port: " + var3.getPort() + ", type: " + var3.getType());
- }
-
- this.a(this.a(var2), var3);
- }
- }
-
- }
-
- public void saveLegacyController(View var1) {
- this.a();
- }
-
- private class a implements TextWatcher {
- private DeviceConfiguration b;
-
- private a(DeviceConfiguration var2) {
- this.b = var2;
- }
-
- // $FF: synthetic method
- a(DeviceConfiguration var2, Object var3) {
- this();
- }
-
- public void afterTextChanged(Editable var1) {
- String var2 = var1.toString();
- this.b.setName(var2);
- }
-
- public void beforeTextChanged(CharSequence var1, int var2, int var3, int var4) {
- }
-
- public void onTextChanged(CharSequence var1, int var2, int var3, int var4) {
- }
- }
-}
+package com.qualcomm.ftccommon.configuration;
+
+import android.app.Activity;
+import android.content.Context;
+import android.content.Intent;
+import android.os.Bundle;
+import android.preference.PreferenceManager;
+import android.text.Editable;
+import android.text.TextWatcher;
+import android.view.View;
+import android.widget.AdapterView;
+import android.widget.AdapterView.OnItemSelectedListener;
+import android.widget.ArrayAdapter;
+import android.widget.EditText;
+import android.widget.LinearLayout;
+import android.widget.Spinner;
+import android.widget.TextView;
+
+import com.qualcomm.ftccommon.R;
+import com.qualcomm.robotcore.hardware.configuration.ControllerConfiguration;
+import com.qualcomm.robotcore.hardware.configuration.DeviceConfiguration;
+import com.qualcomm.robotcore.hardware.configuration.LegacyModuleControllerConfiguration;
+import com.qualcomm.robotcore.hardware.configuration.MatrixControllerConfiguration;
+import com.qualcomm.robotcore.hardware.configuration.MotorConfiguration;
+import com.qualcomm.robotcore.hardware.configuration.MotorControllerConfiguration;
+import com.qualcomm.robotcore.hardware.configuration.ServoConfiguration;
+import com.qualcomm.robotcore.hardware.configuration.ServoControllerConfiguration;
+import com.qualcomm.robotcore.hardware.configuration.Utility;
+import com.qualcomm.robotcore.util.RobotLog;
+import com.qualcomm.robotcore.util.SerialNumber;
+
+import java.io.Serializable;
+import java.util.ArrayList;
+
+public class EditLegacyModuleControllerActivity extends Activity {
+ public static final String EDIT_LEGACY_CONFIG = "EDIT_LEGACY_CONFIG";
+ public static final int EDIT_MATRIX_CONTROLLER_REQUEST_CODE = 103;
+ public static final int EDIT_MOTOR_CONTROLLER_REQUEST_CODE = 101;
+ public static final int EDIT_SERVO_CONTROLLER_REQUEST_CODE = 102;
+ private static boolean a = false;
+ private Utility b;
+ private String c;
+ private Context d;
+ private LegacyModuleControllerConfiguration e;
+ private EditText f;
+ private ArrayList g = new ArrayList();
+ private View h;
+ private View i;
+ private View j;
+ private View k;
+ private View l;
+ private View m;
+ private OnItemSelectedListener n = new OnItemSelectedListener() {
+ public void onItemSelected(AdapterView> var1, View var2, int var3, long var4) {
+ String var6 = var1.getItemAtPosition(var3).toString();
+ LinearLayout var7 = (LinearLayout)var2.getParent().getParent().getParent();
+ if(var6.equalsIgnoreCase(DeviceConfiguration.ConfigurationType.NOTHING.toString())) {
+ EditLegacyModuleControllerActivity.this.a(var7);
+ } else {
+ EditLegacyModuleControllerActivity.this.a(var7, var6);
+ }
+ }
+
+ public void onNothingSelected(AdapterView> var1) {
+ }
+ };
+
+ private View a(int var1) {
+ switch(var1) {
+ case 0:
+ return this.h;
+ case 1:
+ return this.i;
+ case 2:
+ return this.j;
+ case 3:
+ return this.k;
+ case 4:
+ return this.l;
+ case 5:
+ return this.m;
+ default:
+ return null;
+ }
+ }
+
+ private void a() {
+ Intent var1 = new Intent();
+ this.e.setName(this.f.getText().toString());
+ var1.putExtra("EDIT_LEGACY_CONFIG", this.e);
+ this.setResult(-1, var1);
+ this.finish();
+ }
+
+ private void a(int var1, int var2) {
+ this.a(var1).findViewById(R.id.edit_controller_btn).setVisibility(var2);
+ }
+
+ private void a(int var1, String var2) {
+ DeviceConfiguration var3 = this.g.get(var1);
+ String var4 = var3.getName();
+ ArrayList var5 = new ArrayList();
+ SerialNumber var6 = ControllerConfiguration.NO_SERIAL_NUMBER;
+ if(!var3.getType().toString().equalsIgnoreCase(var2)) {
+ Object var7 = new ControllerConfiguration("dummy module", var5, var6, DeviceConfiguration.ConfigurationType.NOTHING);
+ if(var2.equalsIgnoreCase(DeviceConfiguration.ConfigurationType.MOTOR_CONTROLLER.toString())) {
+ for(int var16 = 1; var16 <= 2; ++var16) {
+ var5.add(new MotorConfiguration(var16));
+ }
+
+ var7 = new MotorControllerConfiguration(var4, var5, var6);
+ ((ControllerConfiguration)var7).setPort(var1);
+ } else if(var2.equalsIgnoreCase(DeviceConfiguration.ConfigurationType.SERVO_CONTROLLER.toString())) {
+ for(int var14 = 1; var14 <= 6; ++var14) {
+ var5.add(new ServoConfiguration(var14));
+ }
+
+ var7 = new ServoControllerConfiguration(var4, var5, var6);
+ ((ControllerConfiguration)var7).setPort(var1);
+ } else if(var2.equalsIgnoreCase(DeviceConfiguration.ConfigurationType.MATRIX_CONTROLLER.toString())) {
+ ArrayList var8 = new ArrayList();
+
+ for(int var9 = 1; var9 <= 4; ++var9) {
+ var8.add(new MotorConfiguration(var9));
+ }
+
+ ArrayList var10 = new ArrayList();
+
+ for(int var11 = 1; var11 <= 4; ++var11) {
+ var10.add(new ServoConfiguration(var11));
+ }
+
+ var7 = new MatrixControllerConfiguration(var4, var8, var10, var6);
+ ((ControllerConfiguration)var7).setPort(var1);
+ }
+
+ ((ControllerConfiguration)var7).setEnabled(true);
+ this.b((DeviceConfiguration)var7);
+ }
+
+ }
+
+ private void a(View var1, DeviceConfiguration var2) {
+ Spinner var3 = (Spinner)var1.findViewById(R.id.choiceSpinner_legacyModule);
+ var3.setSelection(((ArrayAdapter)var3.getAdapter()).getPosition(var2.getType().toString()));
+ var3.setOnItemSelectedListener(this.n);
+ String var4 = var2.getName();
+ EditText var5 = (EditText)var1.findViewById(R.id.editTextResult_name);
+ int var6 = Integer.parseInt(((TextView)var1.findViewById(R.id.portNumber)).getText().toString());
+ var5.addTextChangedListener(new a(var2, null));
+ var5.setText(var4);
+ if(a) {
+ RobotLog.e("[populatePort] name: " + var4 + ", port: " + var6 + ", type: " + var2.getType());
+ }
+
+ }
+
+ private void a(EditText var1, DeviceConfiguration var2) {
+ if(var1.getText().toString().equalsIgnoreCase("NO DEVICE ATTACHED")) {
+ var1.setText("");
+ var2.setName("");
+ } else {
+ var1.setText(var2.getName());
+ }
+ }
+
+ private void a(LinearLayout var1) {
+ int var2 = Integer.parseInt(((TextView)var1.findViewById(R.id.portNumber)).getText().toString());
+ EditText var3 = (EditText)var1.findViewById(R.id.editTextResult_name);
+ var3.setEnabled(false);
+ var3.setText("NO DEVICE ATTACHED");
+ DeviceConfiguration var4 = new DeviceConfiguration(DeviceConfiguration.ConfigurationType.NOTHING);
+ var4.setPort(var2);
+ this.b(var4);
+ this.a(var2, 8);
+ }
+
+ private void a(LinearLayout var1, String var2) {
+ int var3 = Integer.parseInt(((TextView)var1.findViewById(R.id.portNumber)).getText().toString());
+ EditText var4 = (EditText)var1.findViewById(R.id.editTextResult_name);
+ DeviceConfiguration var5 = this.g.get(var3);
+ var4.setEnabled(true);
+ this.a(var4, var5);
+ DeviceConfiguration.ConfigurationType var6 = var5.typeFromString(var2);
+ if(var6 != DeviceConfiguration.ConfigurationType.MOTOR_CONTROLLER && var6 != DeviceConfiguration.ConfigurationType.SERVO_CONTROLLER && var6 != DeviceConfiguration.ConfigurationType.MATRIX_CONTROLLER) {
+ var5.setType(var6);
+ if(var6 == DeviceConfiguration.ConfigurationType.NOTHING) {
+ var5.setEnabled(false);
+ } else {
+ var5.setEnabled(true);
+ }
+
+ this.a(var3, 8);
+ } else {
+ this.a(var3, var2);
+ this.a(var3, 0);
+ }
+
+ if(a) {
+ DeviceConfiguration var7 = this.g.get(var3);
+ RobotLog.e("[changeDevice] modules.get(port) name: " + var7.getName() + ", port: " + var7.getPort() + ", type: " + var7.getType());
+ }
+
+ }
+
+ private void a(DeviceConfiguration var1) {
+ var1.setName(((EditText) this.a(var1.getPort()).findViewById(R.id.editTextResult_name)).getText().toString());
+ if(var1.getType() == DeviceConfiguration.ConfigurationType.MOTOR_CONTROLLER) {
+ Intent var2 = new Intent(this.d, EditMotorControllerActivity.class);
+ var2.putExtra("EDIT_MOTOR_CONTROLLER_CONFIG", var1);
+ var2.putExtra("requestCode", 101);
+ this.setResult(-1, var2);
+ this.startActivityForResult(var2, 101);
+ } else {
+ if(var1.getType() == DeviceConfiguration.ConfigurationType.SERVO_CONTROLLER) {
+ Intent var5 = new Intent(this.d, EditServoControllerActivity.class);
+ var5.putExtra("Edit Servo ControllerConfiguration Activity", var1);
+ this.setResult(-1, var5);
+ this.startActivityForResult(var5, 102);
+ return;
+ }
+
+ if(var1.getType() == DeviceConfiguration.ConfigurationType.MATRIX_CONTROLLER) {
+ Intent var7 = new Intent(this.d, EditMatrixControllerActivity.class);
+ var7.putExtra("Edit Matrix ControllerConfiguration Activity", var1);
+ this.setResult(-1, var7);
+ this.startActivityForResult(var7, 103);
+ return;
+ }
+ }
+
+ }
+
+ private void b(DeviceConfiguration var1) {
+ int var2 = var1.getPort();
+ this.g.set(var2, var1);
+ }
+
+ private boolean c(DeviceConfiguration var1) {
+ return var1.getType() == DeviceConfiguration.ConfigurationType.MOTOR_CONTROLLER || var1.getType() == DeviceConfiguration.ConfigurationType.SERVO_CONTROLLER;
+ }
+
+ public void cancelLegacyController(View var1) {
+ this.setResult(0, new Intent());
+ this.finish();
+ }
+
+ public void editController_portALL(View var1) {
+ LinearLayout var2 = (LinearLayout)var1.getParent().getParent();
+ int var3 = Integer.parseInt(((TextView)var2.findViewById(R.id.portNumber)).getText().toString());
+ DeviceConfiguration var4 = this.g.get(var3);
+ if(!this.c(var4)) {
+ this.a(var3, ((Spinner)var2.findViewById(R.id.choiceSpinner_legacyModule)).getSelectedItem().toString());
+ }
+
+ this.a(var4);
+ }
+
+ protected void onActivityResult(int var1, int var2, Intent var3) {
+ if(var2 == -1) {
+ Serializable var4;
+ if(var1 == 101) {
+ var4 = var3.getSerializableExtra("EDIT_MOTOR_CONTROLLER_CONFIG");
+ } else if(var1 == 102) {
+ var4 = var3.getSerializableExtra("Edit Servo ControllerConfiguration Activity");
+ } else {
+ var4 = null;
+ if(var1 == 103) {
+ var4 = var3.getSerializableExtra("Edit Matrix ControllerConfiguration Activity");
+ }
+ }
+
+ if(var4 != null) {
+ ControllerConfiguration var5 = (ControllerConfiguration)var4;
+ this.b(var5);
+ this.a(this.a(var5.getPort()), this.g.get(var5.getPort()));
+ if(!this.c.toLowerCase().contains("Unsaved".toLowerCase())) {
+ String var6 = "Unsaved " + this.c;
+ this.b.saveToPreferences(var6, R.string.pref_hardware_config_filename);
+ this.c = var6;
+ }
+
+ this.b.updateHeader("No current file!", R.string.pref_hardware_config_filename, R.id.active_filename, R.id.included_header);
+ }
+ }
+
+ }
+
+ protected void onCreate(Bundle var1) {
+ super.onCreate(var1);
+ this.setContentView(R.layout.legacy);
+ LinearLayout var2 = (LinearLayout)this.findViewById(R.id.linearLayout0);
+ this.h = this.getLayoutInflater().inflate(R.layout.simple_device, var2, true);
+ ((TextView)this.h.findViewById(R.id.portNumber)).setText("0");
+ LinearLayout var3 = (LinearLayout)this.findViewById(R.id.linearLayout1);
+ this.i = this.getLayoutInflater().inflate(R.layout.simple_device, var3, true);
+ ((TextView)this.i.findViewById(R.id.portNumber)).setText("1");
+ LinearLayout var4 = (LinearLayout)this.findViewById(R.id.linearLayout2);
+ this.j = this.getLayoutInflater().inflate(R.layout.simple_device, var4, true);
+ ((TextView)this.j.findViewById(R.id.portNumber)).setText("2");
+ LinearLayout var5 = (LinearLayout)this.findViewById(R.id.linearLayout3);
+ this.k = this.getLayoutInflater().inflate(R.layout.simple_device, var5, true);
+ ((TextView)this.k.findViewById(R.id.portNumber)).setText("3");
+ LinearLayout var6 = (LinearLayout)this.findViewById(R.id.linearLayout4);
+ this.l = this.getLayoutInflater().inflate(R.layout.simple_device, var6, true);
+ ((TextView)this.l.findViewById(R.id.portNumber)).setText("4");
+ LinearLayout var7 = (LinearLayout)this.findViewById(R.id.linearLayout5);
+ this.m = this.getLayoutInflater().inflate(R.layout.simple_device, var7, true);
+ ((TextView)this.m.findViewById(R.id.portNumber)).setText("5");
+ this.d = this;
+ PreferenceManager.setDefaultValues(this, R.xml.preferences, false);
+ this.b = new Utility(this);
+ RobotLog.writeLogcatToDisk(this, 1024);
+ this.f = (EditText)this.findViewById(R.id.device_interface_module_name);
+ }
+
+ protected void onStart() {
+ super.onStart();
+ this.b.updateHeader("No current file!", R.string.pref_hardware_config_filename, R.id.active_filename, R.id.included_header);
+ this.c = this.b.getFilenameFromPrefs(R.string.pref_hardware_config_filename, "No current file!");
+ Serializable var1 = this.getIntent().getSerializableExtra("EDIT_LEGACY_CONFIG");
+ if(var1 != null) {
+ this.e = (LegacyModuleControllerConfiguration)var1;
+ this.g = (ArrayList)this.e.getDevices();
+ this.f.setText(this.e.getName());
+ this.f.addTextChangedListener(new a(this.e, null));
+ ((TextView)this.findViewById(R.id.legacy_serialNumber)).setText(this.e.getSerialNumber().toString());
+
+ for(int var2 = 0; var2 < this.g.size(); ++var2) {
+ DeviceConfiguration var3 = this.g.get(var2);
+ if(a) {
+ RobotLog.e("[onStart] module name: " + var3.getName() + ", port: " + var3.getPort() + ", type: " + var3.getType());
+ }
+
+ this.a(this.a(var2), var3);
+ }
+ }
+
+ }
+
+ public void saveLegacyController(View var1) {
+ this.a();
+ }
+
+ private class a implements TextWatcher {
+ private DeviceConfiguration b;
+
+ private a(DeviceConfiguration var2) {
+ this.b = var2;
+ }
+
+ // $FF: synthetic method
+ a(DeviceConfiguration var2, Object var3) {
+ this(var2);
+ }
+
+ public void afterTextChanged(Editable var1) {
+ String var2 = var1.toString();
+ this.b.setName(var2);
+ }
+
+ public void beforeTextChanged(CharSequence var1, int var2, int var3, int var4) {
+ }
+
+ public void onTextChanged(CharSequence var1, int var2, int var3, int var4) {
+ }
+ }
+}
diff --git a/FtcRobotController/app/src/main/java/com/qualcomm/ftccommon/configuration/EditMatrixControllerActivity.java b/FtcRobotController/FtcCommon/src/main/java/com/qualcomm/ftccommon/configuration/EditMatrixControllerActivity.java
similarity index 90%
rename from FtcRobotController/app/src/main/java/com/qualcomm/ftccommon/configuration/EditMatrixControllerActivity.java
rename to FtcRobotController/FtcCommon/src/main/java/com/qualcomm/ftccommon/configuration/EditMatrixControllerActivity.java
index 5fa770a..2ff0ab7 100644
--- a/FtcRobotController/app/src/main/java/com/qualcomm/ftccommon/configuration/EditMatrixControllerActivity.java
+++ b/FtcRobotController/FtcCommon/src/main/java/com/qualcomm/ftccommon/configuration/EditMatrixControllerActivity.java
@@ -1,216 +1,218 @@
-package com.qualcomm.ftccommon.configuration;
-
-import android.app.Activity;
-import android.content.Intent;
-import android.os.Bundle;
-import android.preference.PreferenceManager;
-import android.text.Editable;
-import android.text.TextWatcher;
-import android.view.View;
-import android.view.View.OnClickListener;
-import android.widget.CheckBox;
-import android.widget.EditText;
-import android.widget.LinearLayout;
-import android.widget.TextView;
-import com.qualcomm.ftccommon.R;
-import com.qualcomm.robotcore.hardware.configuration.DeviceConfiguration;
-import com.qualcomm.robotcore.hardware.configuration.MatrixControllerConfiguration;
-import com.qualcomm.robotcore.hardware.configuration.Utility;
-import com.qualcomm.robotcore.util.RobotLog;
-import java.io.Serializable;
-import java.util.ArrayList;
-
-public class EditMatrixControllerActivity extends Activity {
- public static final String EDIT_MATRIX_ACTIVITY = "Edit Matrix ControllerConfiguration Activity";
- private Utility a;
- private MatrixControllerConfiguration b;
- private ArrayList c;
- private ArrayList d;
- private EditText e;
- private View f;
- private View g;
- private View h;
- private View i;
- private View j;
- private View k;
- private View l;
- private View m;
-
- private View a(int var1) {
- switch(var1) {
- case 1:
- return this.f;
- case 2:
- return this.g;
- case 3:
- return this.h;
- case 4:
- return this.i;
- default:
- return null;
- }
- }
-
- private void a() {
- Intent var1 = new Intent();
- this.b.addServos(this.d);
- this.b.addMotors(this.c);
- this.b.setName(this.e.getText().toString());
- var1.putExtra("Edit Matrix ControllerConfiguration Activity", this.b);
- this.setResult(-1, var1);
- this.finish();
- }
-
- private void a(int var1, View var2, ArrayList var3) {
- CheckBox var4 = (CheckBox)var2.findViewById(R.id.checkbox_port_matrix);
- DeviceConfiguration var5 = (DeviceConfiguration)var3.get(var1 - 1);
- if(var5.isEnabled()) {
- var4.setChecked(true);
- ((EditText)var2.findViewById(R.id.editTextResult_matrix)).setText(var5.getName());
- } else {
- var4.setChecked(true);
- var4.performClick();
- }
- }
-
- private void a(View var1, DeviceConfiguration var2) {
- ((EditText)var1.findViewById(R.id.editTextResult_matrix)).addTextChangedListener(new EditMatrixControllerActivity.a(var2, null));
- }
-
- private View b(int var1) {
- switch(var1) {
- case 1:
- return this.j;
- case 2:
- return this.k;
- case 3:
- return this.l;
- case 4:
- return this.m;
- default:
- return null;
- }
- }
-
- private void b(int var1, View var2, ArrayList var3) {
- final EditText var4 = (EditText)var2.findViewById(R.id.editTextResult_matrix);
- final DeviceConfiguration var5 = (DeviceConfiguration)var3.get(var1 - 1);
- ((CheckBox)var2.findViewById(R.id.checkbox_port_matrix)).setOnClickListener(new OnClickListener() {
- public void onClick(View var1) {
- if(((CheckBox)var1).isChecked()) {
- var4.setEnabled(true);
- var4.setText("");
- var5.setEnabled(true);
- var5.setName("");
- } else {
- var4.setEnabled(false);
- var5.setEnabled(false);
- var5.setName("NO DEVICE ATTACHED");
- var4.setText("NO DEVICE ATTACHED");
- }
- }
- });
- }
-
- public void cancelMatrixController(View var1) {
- this.setResult(0, new Intent());
- this.finish();
- }
-
- protected void onCreate(Bundle var1) {
- super.onCreate(var1);
- this.setContentView(R.layout.matrices);
- PreferenceManager.setDefaultValues(this, R.xml.preferences, false);
- this.a = new Utility(this);
- RobotLog.writeLogcatToDisk(this, 1024);
- this.e = (EditText)this.findViewById(R.id.matrixcontroller_name);
- LinearLayout var2 = (LinearLayout)this.findViewById(R.id.linearLayout_matrix1);
- this.f = this.getLayoutInflater().inflate(R.layout.matrix_devices, var2, true);
- ((TextView)this.f.findViewById(R.id.port_number_matrix)).setText("1");
- LinearLayout var3 = (LinearLayout)this.findViewById(R.id.linearLayout_matrix2);
- this.g = this.getLayoutInflater().inflate(R.layout.matrix_devices, var3, true);
- ((TextView)this.g.findViewById(R.id.port_number_matrix)).setText("2");
- LinearLayout var4 = (LinearLayout)this.findViewById(R.id.linearLayout_matrix3);
- this.h = this.getLayoutInflater().inflate(R.layout.matrix_devices, var4, true);
- ((TextView)this.h.findViewById(R.id.port_number_matrix)).setText("3");
- LinearLayout var5 = (LinearLayout)this.findViewById(R.id.linearLayout_matrix4);
- this.i = this.getLayoutInflater().inflate(R.layout.matrix_devices, var5, true);
- ((TextView)this.i.findViewById(R.id.port_number_matrix)).setText("4");
- LinearLayout var6 = (LinearLayout)this.findViewById(R.id.linearLayout_matrix5);
- this.j = this.getLayoutInflater().inflate(R.layout.matrix_devices, var6, true);
- ((TextView)this.j.findViewById(R.id.port_number_matrix)).setText("1");
- LinearLayout var7 = (LinearLayout)this.findViewById(R.id.linearLayout_matrix6);
- this.k = this.getLayoutInflater().inflate(R.layout.matrix_devices, var7, true);
- ((TextView)this.k.findViewById(R.id.port_number_matrix)).setText("2");
- LinearLayout var8 = (LinearLayout)this.findViewById(R.id.linearLayout_matrix7);
- this.l = this.getLayoutInflater().inflate(R.layout.matrix_devices, var8, true);
- ((TextView)this.l.findViewById(R.id.port_number_matrix)).setText("3");
- LinearLayout var9 = (LinearLayout)this.findViewById(R.id.linearLayout_matrix8);
- this.m = this.getLayoutInflater().inflate(R.layout.matrix_devices, var9, true);
- ((TextView)this.m.findViewById(R.id.port_number_matrix)).setText("4");
- }
-
- protected void onStart() {
- super.onStart();
- this.a.updateHeader("No current file!", R.string.pref_hardware_config_filename, R.id.active_filename, R.id.included_header);
- Serializable var1 = this.getIntent().getSerializableExtra("Edit Matrix ControllerConfiguration Activity");
- if(var1 != null) {
- this.b = (MatrixControllerConfiguration)var1;
- this.c = (ArrayList)this.b.getMotors();
- this.d = (ArrayList)this.b.getServos();
- }
-
- this.e.setText(this.b.getName());
- int var2 = 0;
-
- while(true) {
- int var3 = this.c.size();
- int var4 = 0;
- if(var2 >= var3) {
- while(var4 < this.d.size()) {
- View var5 = this.a(var4 + 1);
- this.b(var4 + 1, var5, this.d);
- this.a(var5, (DeviceConfiguration)this.d.get(var4));
- this.a(var4 + 1, var5, this.d);
- ++var4;
- }
-
- return;
- }
-
- View var6 = this.b(var2 + 1);
- this.b(var2 + 1, var6, this.c);
- this.a(var6, (DeviceConfiguration)this.c.get(var2));
- this.a(var2 + 1, var6, this.c);
- ++var2;
- }
- }
-
- public void saveMatrixController(View var1) {
- this.a();
- }
-
- private class a implements TextWatcher {
- private DeviceConfiguration b;
-
- private a(DeviceConfiguration var2) {
- this.b = var2;
- }
-
- // $FF: synthetic method
- a(DeviceConfiguration var2, Object var3) {
- this();
- }
-
- public void afterTextChanged(Editable var1) {
- String var2 = var1.toString();
- this.b.setName(var2);
- }
-
- public void beforeTextChanged(CharSequence var1, int var2, int var3, int var4) {
- }
-
- public void onTextChanged(CharSequence var1, int var2, int var3, int var4) {
- }
- }
-}
+package com.qualcomm.ftccommon.configuration;
+
+import android.app.Activity;
+import android.content.Intent;
+import android.os.Bundle;
+import android.preference.PreferenceManager;
+import android.text.Editable;
+import android.text.TextWatcher;
+import android.view.View;
+import android.view.View.OnClickListener;
+import android.widget.CheckBox;
+import android.widget.EditText;
+import android.widget.LinearLayout;
+import android.widget.TextView;
+
+import com.qualcomm.ftccommon.R;
+import com.qualcomm.robotcore.hardware.configuration.DeviceConfiguration;
+import com.qualcomm.robotcore.hardware.configuration.MatrixControllerConfiguration;
+import com.qualcomm.robotcore.hardware.configuration.Utility;
+import com.qualcomm.robotcore.util.RobotLog;
+
+import java.io.Serializable;
+import java.util.ArrayList;
+
+public class EditMatrixControllerActivity extends Activity {
+ public static final String EDIT_MATRIX_ACTIVITY = "Edit Matrix ControllerConfiguration Activity";
+ private Utility a;
+ private MatrixControllerConfiguration b;
+ private ArrayList c;
+ private ArrayList d;
+ private EditText e;
+ private View f;
+ private View g;
+ private View h;
+ private View i;
+ private View j;
+ private View k;
+ private View l;
+ private View m;
+
+ private View a(int var1) {
+ switch(var1) {
+ case 1:
+ return this.f;
+ case 2:
+ return this.g;
+ case 3:
+ return this.h;
+ case 4:
+ return this.i;
+ default:
+ return null;
+ }
+ }
+
+ private void a() {
+ Intent var1 = new Intent();
+ this.b.addServos(this.d);
+ this.b.addMotors(this.c);
+ this.b.setName(this.e.getText().toString());
+ var1.putExtra("Edit Matrix ControllerConfiguration Activity", this.b);
+ this.setResult(-1, var1);
+ this.finish();
+ }
+
+ private void a(int var1, View var2, ArrayList var3) {
+ CheckBox var4 = (CheckBox)var2.findViewById(R.id.checkbox_port_matrix);
+ DeviceConfiguration var5 = var3.get(var1 - 1);
+ if(var5.isEnabled()) {
+ var4.setChecked(true);
+ ((EditText)var2.findViewById(R.id.editTextResult_matrix)).setText(var5.getName());
+ } else {
+ var4.setChecked(true);
+ var4.performClick();
+ }
+ }
+
+ private void a(View var1, DeviceConfiguration var2) {
+ ((EditText)var1.findViewById(R.id.editTextResult_matrix)).addTextChangedListener(new a(var2, null));
+ }
+
+ private View b(int var1) {
+ switch(var1) {
+ case 1:
+ return this.j;
+ case 2:
+ return this.k;
+ case 3:
+ return this.l;
+ case 4:
+ return this.m;
+ default:
+ return null;
+ }
+ }
+
+ private void b(int var1, View var2, ArrayList var3) {
+ final EditText var4 = (EditText)var2.findViewById(R.id.editTextResult_matrix);
+ final DeviceConfiguration var5 = var3.get(var1 - 1);
+ var2.findViewById(R.id.checkbox_port_matrix).setOnClickListener(new OnClickListener() {
+ public void onClick(View var1) {
+ if (((CheckBox) var1).isChecked()) {
+ var4.setEnabled(true);
+ var4.setText("");
+ var5.setEnabled(true);
+ var5.setName("");
+ } else {
+ var4.setEnabled(false);
+ var5.setEnabled(false);
+ var5.setName("NO DEVICE ATTACHED");
+ var4.setText("NO DEVICE ATTACHED");
+ }
+ }
+ });
+ }
+
+ public void cancelMatrixController(View var1) {
+ this.setResult(0, new Intent());
+ this.finish();
+ }
+
+ protected void onCreate(Bundle var1) {
+ super.onCreate(var1);
+ this.setContentView(R.layout.matrices);
+ PreferenceManager.setDefaultValues(this, R.xml.preferences, false);
+ this.a = new Utility(this);
+ RobotLog.writeLogcatToDisk(this, 1024);
+ this.e = (EditText)this.findViewById(R.id.matrixcontroller_name);
+ LinearLayout var2 = (LinearLayout)this.findViewById(R.id.linearLayout_matrix1);
+ this.f = this.getLayoutInflater().inflate(R.layout.matrix_devices, var2, true);
+ ((TextView)this.f.findViewById(R.id.port_number_matrix)).setText("1");
+ LinearLayout var3 = (LinearLayout)this.findViewById(R.id.linearLayout_matrix2);
+ this.g = this.getLayoutInflater().inflate(R.layout.matrix_devices, var3, true);
+ ((TextView)this.g.findViewById(R.id.port_number_matrix)).setText("2");
+ LinearLayout var4 = (LinearLayout)this.findViewById(R.id.linearLayout_matrix3);
+ this.h = this.getLayoutInflater().inflate(R.layout.matrix_devices, var4, true);
+ ((TextView)this.h.findViewById(R.id.port_number_matrix)).setText("3");
+ LinearLayout var5 = (LinearLayout)this.findViewById(R.id.linearLayout_matrix4);
+ this.i = this.getLayoutInflater().inflate(R.layout.matrix_devices, var5, true);
+ ((TextView)this.i.findViewById(R.id.port_number_matrix)).setText("4");
+ LinearLayout var6 = (LinearLayout)this.findViewById(R.id.linearLayout_matrix5);
+ this.j = this.getLayoutInflater().inflate(R.layout.matrix_devices, var6, true);
+ ((TextView)this.j.findViewById(R.id.port_number_matrix)).setText("1");
+ LinearLayout var7 = (LinearLayout)this.findViewById(R.id.linearLayout_matrix6);
+ this.k = this.getLayoutInflater().inflate(R.layout.matrix_devices, var7, true);
+ ((TextView)this.k.findViewById(R.id.port_number_matrix)).setText("2");
+ LinearLayout var8 = (LinearLayout)this.findViewById(R.id.linearLayout_matrix7);
+ this.l = this.getLayoutInflater().inflate(R.layout.matrix_devices, var8, true);
+ ((TextView)this.l.findViewById(R.id.port_number_matrix)).setText("3");
+ LinearLayout var9 = (LinearLayout)this.findViewById(R.id.linearLayout_matrix8);
+ this.m = this.getLayoutInflater().inflate(R.layout.matrix_devices, var9, true);
+ ((TextView)this.m.findViewById(R.id.port_number_matrix)).setText("4");
+ }
+
+ protected void onStart() {
+ super.onStart();
+ this.a.updateHeader("No current file!", R.string.pref_hardware_config_filename, R.id.active_filename, R.id.included_header);
+ Serializable var1 = this.getIntent().getSerializableExtra("Edit Matrix ControllerConfiguration Activity");
+ if(var1 != null) {
+ this.b = (MatrixControllerConfiguration)var1;
+ this.c = (ArrayList)this.b.getMotors();
+ this.d = (ArrayList)this.b.getServos();
+ }
+
+ this.e.setText(this.b.getName());
+ int var2 = 0;
+
+ while(true) {
+ int var3 = this.c.size();
+ int var4 = 0;
+ if(var2 >= var3) {
+ while(var4 < this.d.size()) {
+ View var5 = this.a(var4 + 1);
+ this.b(var4 + 1, var5, this.d);
+ this.a(var5, this.d.get(var4));
+ this.a(var4 + 1, var5, this.d);
+ ++var4;
+ }
+
+ return;
+ }
+
+ View var6 = this.b(var2 + 1);
+ this.b(var2 + 1, var6, this.c);
+ this.a(var6, this.c.get(var2));
+ this.a(var2 + 1, var6, this.c);
+ ++var2;
+ }
+ }
+
+ public void saveMatrixController(View var1) {
+ this.a();
+ }
+
+ private class a implements TextWatcher {
+ private DeviceConfiguration b;
+
+ private a(DeviceConfiguration var2) {
+ this.b = var2;
+ }
+
+ // $FF: synthetic method
+ a(DeviceConfiguration var2, Object var3) {
+ this(var2);
+ }
+
+ public void afterTextChanged(Editable var1) {
+ String var2 = var1.toString();
+ this.b.setName(var2);
+ }
+
+ public void beforeTextChanged(CharSequence var1, int var2, int var3, int var4) {
+ }
+
+ public void onTextChanged(CharSequence var1, int var2, int var3, int var4) {
+ }
+ }
+}
diff --git a/FtcRobotController/app/src/main/java/com/qualcomm/ftccommon/configuration/EditMotorControllerActivity.java b/FtcRobotController/FtcCommon/src/main/java/com/qualcomm/ftccommon/configuration/EditMotorControllerActivity.java
similarity index 97%
rename from FtcRobotController/app/src/main/java/com/qualcomm/ftccommon/configuration/EditMotorControllerActivity.java
rename to FtcRobotController/FtcCommon/src/main/java/com/qualcomm/ftccommon/configuration/EditMotorControllerActivity.java
index 2e4fff6..12707e2 100644
--- a/FtcRobotController/app/src/main/java/com/qualcomm/ftccommon/configuration/EditMotorControllerActivity.java
+++ b/FtcRobotController/FtcCommon/src/main/java/com/qualcomm/ftccommon/configuration/EditMotorControllerActivity.java
@@ -1,160 +1,162 @@
-package com.qualcomm.ftccommon.configuration;
-
-import android.app.Activity;
-import android.content.Intent;
-import android.os.Bundle;
-import android.preference.PreferenceManager;
-import android.view.View;
-import android.view.View.OnClickListener;
-import android.widget.CheckBox;
-import android.widget.EditText;
-import android.widget.TextView;
-import com.qualcomm.ftccommon.R;
-import com.qualcomm.robotcore.hardware.configuration.ControllerConfiguration;
-import com.qualcomm.robotcore.hardware.configuration.DeviceConfiguration;
-import com.qualcomm.robotcore.hardware.configuration.MotorConfiguration;
-import com.qualcomm.robotcore.hardware.configuration.MotorControllerConfiguration;
-import com.qualcomm.robotcore.hardware.configuration.Utility;
-import com.qualcomm.robotcore.util.RobotLog;
-import java.io.Serializable;
-import java.util.ArrayList;
-
-public class EditMotorControllerActivity extends Activity {
- public static final String EDIT_MOTOR_CONTROLLER_CONFIG = "EDIT_MOTOR_CONTROLLER_CONFIG";
- private Utility a;
- private MotorControllerConfiguration b;
- private ArrayList c = new ArrayList();
- private MotorConfiguration d = new MotorConfiguration(1);
- private MotorConfiguration e = new MotorConfiguration(2);
- private EditText f;
- private boolean g = true;
- private boolean h = true;
- private CheckBox i;
- private CheckBox j;
- private EditText k;
- private EditText l;
-
- private void a() {
- this.i.setOnClickListener(new OnClickListener() {
- public void onClick(View var1) {
- if(((CheckBox)var1).isChecked()) {
- EditMotorControllerActivity.this.g = true;
- EditMotorControllerActivity.this.k.setEnabled(true);
- EditMotorControllerActivity.this.k.setText("");
- EditMotorControllerActivity.this.d.setPort(1);
- EditMotorControllerActivity.this.d.setType(DeviceConfiguration.ConfigurationType.MOTOR);
- } else {
- EditMotorControllerActivity.this.g = false;
- EditMotorControllerActivity.this.k.setEnabled(false);
- EditMotorControllerActivity.this.k.setText("NO DEVICE ATTACHED");
- EditMotorControllerActivity.this.d.setType(DeviceConfiguration.ConfigurationType.NOTHING);
- }
- }
- });
- }
-
- private void a(MotorConfiguration var1, CheckBox var2) {
- if(!var1.getName().equals("NO DEVICE ATTACHED") && var1.getType() != DeviceConfiguration.ConfigurationType.NOTHING) {
- var2.setChecked(true);
- } else {
- var2.setChecked(true);
- var2.performClick();
- }
- }
-
- private void b() {
- this.j.setOnClickListener(new OnClickListener() {
- public void onClick(View var1) {
- if(((CheckBox)var1).isChecked()) {
- EditMotorControllerActivity.this.h = true;
- EditMotorControllerActivity.this.l.setEnabled(true);
- EditMotorControllerActivity.this.l.setText("");
- EditMotorControllerActivity.this.e.setPort(2);
- EditMotorControllerActivity.this.d.setType(DeviceConfiguration.ConfigurationType.MOTOR);
- } else {
- EditMotorControllerActivity.this.h = false;
- EditMotorControllerActivity.this.l.setEnabled(false);
- EditMotorControllerActivity.this.l.setText("NO DEVICE ATTACHED");
- EditMotorControllerActivity.this.d.setType(DeviceConfiguration.ConfigurationType.NOTHING);
- }
- }
- });
- }
-
- private void c() {
- Intent var1 = new Intent();
- ArrayList var2 = new ArrayList();
- if(this.g) {
- MotorConfiguration var3 = new MotorConfiguration(this.k.getText().toString());
- var3.setEnabled(true);
- var3.setPort(1);
- var2.add(var3);
- } else {
- var2.add(new MotorConfiguration(1));
- }
-
- if(this.h) {
- MotorConfiguration var5 = new MotorConfiguration(this.l.getText().toString());
- var5.setEnabled(true);
- var5.setPort(2);
- var2.add(var5);
- } else {
- var2.add(new MotorConfiguration(2));
- }
-
- this.b.addMotors(var2);
- this.b.setName(this.f.getText().toString());
- var1.putExtra("EDIT_MOTOR_CONTROLLER_CONFIG", this.b);
- this.setResult(-1, var1);
- this.finish();
- }
-
- public void cancelMotorController(View var1) {
- this.setResult(0, new Intent());
- this.finish();
- }
-
- protected void onCreate(Bundle var1) {
- super.onCreate(var1);
- this.setContentView(R.layout.motors);
- PreferenceManager.setDefaultValues(this, R.xml.preferences, false);
- this.a = new Utility(this);
- RobotLog.writeLogcatToDisk(this, 1024);
- this.f = (EditText)this.findViewById(R.id.controller_name);
- this.i = (CheckBox)this.findViewById(R.id.checkbox_port7);
- this.j = (CheckBox)this.findViewById(R.id.checkbox_port6);
- this.k = (EditText)this.findViewById(R.id.editTextResult_analogInput7);
- this.l = (EditText)this.findViewById(R.id.editTextResult_analogInput6);
- }
-
- protected void onStart() {
- super.onStart();
- this.a.updateHeader("No current file!", R.string.pref_hardware_config_filename, R.id.active_filename, R.id.included_header);
- Serializable var1 = this.getIntent().getSerializableExtra("EDIT_MOTOR_CONTROLLER_CONFIG");
- if(var1 != null) {
- this.b = (MotorControllerConfiguration)var1;
- this.c = (ArrayList)this.b.getMotors();
- this.d = (MotorConfiguration)this.c.get(0);
- this.e = (MotorConfiguration)this.c.get(1);
- this.f.setText(this.b.getName());
- TextView var2 = (TextView)this.findViewById(R.id.motor_controller_serialNumber);
- String var3 = this.b.getSerialNumber().toString();
- if(var3.equalsIgnoreCase(ControllerConfiguration.NO_SERIAL_NUMBER.toString())) {
- var3 = "No serial number";
- }
-
- var2.setText(var3);
- this.k.setText(this.d.getName());
- this.l.setText(this.e.getName());
- this.a();
- this.a(this.d, this.i);
- this.b();
- this.a(this.e, this.j);
- }
-
- }
-
- public void saveMotorController(View var1) {
- this.c();
- }
-}
+package com.qualcomm.ftccommon.configuration;
+
+import android.app.Activity;
+import android.content.Intent;
+import android.os.Bundle;
+import android.preference.PreferenceManager;
+import android.view.View;
+import android.view.View.OnClickListener;
+import android.widget.CheckBox;
+import android.widget.EditText;
+import android.widget.TextView;
+
+import com.qualcomm.ftccommon.R;
+import com.qualcomm.robotcore.hardware.configuration.ControllerConfiguration;
+import com.qualcomm.robotcore.hardware.configuration.DeviceConfiguration;
+import com.qualcomm.robotcore.hardware.configuration.MotorConfiguration;
+import com.qualcomm.robotcore.hardware.configuration.MotorControllerConfiguration;
+import com.qualcomm.robotcore.hardware.configuration.Utility;
+import com.qualcomm.robotcore.util.RobotLog;
+
+import java.io.Serializable;
+import java.util.ArrayList;
+
+public class EditMotorControllerActivity extends Activity {
+ public static final String EDIT_MOTOR_CONTROLLER_CONFIG = "EDIT_MOTOR_CONTROLLER_CONFIG";
+ private Utility a;
+ private MotorControllerConfiguration b;
+ private ArrayList c = new ArrayList();
+ private MotorConfiguration d = new MotorConfiguration(1);
+ private MotorConfiguration e = new MotorConfiguration(2);
+ private EditText f;
+ private boolean g = true;
+ private boolean h = true;
+ private CheckBox i;
+ private CheckBox j;
+ private EditText k;
+ private EditText l;
+
+ private void a() {
+ this.i.setOnClickListener(new OnClickListener() {
+ public void onClick(View var1) {
+ if(((CheckBox)var1).isChecked()) {
+ EditMotorControllerActivity.this.g = true;
+ EditMotorControllerActivity.this.k.setEnabled(true);
+ EditMotorControllerActivity.this.k.setText("");
+ EditMotorControllerActivity.this.d.setPort(1);
+ EditMotorControllerActivity.this.d.setType(DeviceConfiguration.ConfigurationType.MOTOR);
+ } else {
+ EditMotorControllerActivity.this.g = false;
+ EditMotorControllerActivity.this.k.setEnabled(false);
+ EditMotorControllerActivity.this.k.setText("NO DEVICE ATTACHED");
+ EditMotorControllerActivity.this.d.setType(DeviceConfiguration.ConfigurationType.NOTHING);
+ }
+ }
+ });
+ }
+
+ private void a(MotorConfiguration var1, CheckBox var2) {
+ if(!var1.getName().equals("NO DEVICE ATTACHED") && var1.getType() != DeviceConfiguration.ConfigurationType.NOTHING) {
+ var2.setChecked(true);
+ } else {
+ var2.setChecked(true);
+ var2.performClick();
+ }
+ }
+
+ private void b() {
+ this.j.setOnClickListener(new OnClickListener() {
+ public void onClick(View var1) {
+ if(((CheckBox)var1).isChecked()) {
+ EditMotorControllerActivity.this.h = true;
+ EditMotorControllerActivity.this.l.setEnabled(true);
+ EditMotorControllerActivity.this.l.setText("");
+ EditMotorControllerActivity.this.e.setPort(2);
+ EditMotorControllerActivity.this.d.setType(DeviceConfiguration.ConfigurationType.MOTOR);
+ } else {
+ EditMotorControllerActivity.this.h = false;
+ EditMotorControllerActivity.this.l.setEnabled(false);
+ EditMotorControllerActivity.this.l.setText("NO DEVICE ATTACHED");
+ EditMotorControllerActivity.this.d.setType(DeviceConfiguration.ConfigurationType.NOTHING);
+ }
+ }
+ });
+ }
+
+ private void c() {
+ Intent var1 = new Intent();
+ ArrayList var2 = new ArrayList();
+ if(this.g) {
+ MotorConfiguration var3 = new MotorConfiguration(this.k.getText().toString());
+ var3.setEnabled(true);
+ var3.setPort(1);
+ var2.add(var3);
+ } else {
+ var2.add(new MotorConfiguration(1));
+ }
+
+ if(this.h) {
+ MotorConfiguration var5 = new MotorConfiguration(this.l.getText().toString());
+ var5.setEnabled(true);
+ var5.setPort(2);
+ var2.add(var5);
+ } else {
+ var2.add(new MotorConfiguration(2));
+ }
+
+ this.b.addMotors(var2);
+ this.b.setName(this.f.getText().toString());
+ var1.putExtra("EDIT_MOTOR_CONTROLLER_CONFIG", this.b);
+ this.setResult(-1, var1);
+ this.finish();
+ }
+
+ public void cancelMotorController(View var1) {
+ this.setResult(0, new Intent());
+ this.finish();
+ }
+
+ protected void onCreate(Bundle var1) {
+ super.onCreate(var1);
+ this.setContentView(R.layout.motors);
+ PreferenceManager.setDefaultValues(this, R.xml.preferences, false);
+ this.a = new Utility(this);
+ RobotLog.writeLogcatToDisk(this, 1024);
+ this.f = (EditText)this.findViewById(R.id.controller_name);
+ this.i = (CheckBox)this.findViewById(R.id.checkbox_port7);
+ this.j = (CheckBox)this.findViewById(R.id.checkbox_port6);
+ this.k = (EditText)this.findViewById(R.id.editTextResult_analogInput7);
+ this.l = (EditText)this.findViewById(R.id.editTextResult_analogInput6);
+ }
+
+ protected void onStart() {
+ super.onStart();
+ this.a.updateHeader("No current file!", R.string.pref_hardware_config_filename, R.id.active_filename, R.id.included_header);
+ Serializable var1 = this.getIntent().getSerializableExtra("EDIT_MOTOR_CONTROLLER_CONFIG");
+ if(var1 != null) {
+ this.b = (MotorControllerConfiguration)var1;
+ this.c = (ArrayList)this.b.getMotors();
+ this.d = (MotorConfiguration)this.c.get(0);
+ this.e = (MotorConfiguration)this.c.get(1);
+ this.f.setText(this.b.getName());
+ TextView var2 = (TextView)this.findViewById(R.id.motor_controller_serialNumber);
+ String var3 = this.b.getSerialNumber().toString();
+ if(var3.equalsIgnoreCase(ControllerConfiguration.NO_SERIAL_NUMBER.toString())) {
+ var3 = "No serial number";
+ }
+
+ var2.setText(var3);
+ this.k.setText(this.d.getName());
+ this.l.setText(this.e.getName());
+ this.a();
+ this.a(this.d, this.i);
+ this.b();
+ this.a(this.e, this.j);
+ }
+
+ }
+
+ public void saveMotorController(View var1) {
+ this.c();
+ }
+}
diff --git a/FtcRobotController/app/src/main/java/com/qualcomm/ftccommon/configuration/EditPWMDevicesActivity.java b/FtcRobotController/FtcCommon/src/main/java/com/qualcomm/ftccommon/configuration/EditPWMDevicesActivity.java
similarity index 85%
rename from FtcRobotController/app/src/main/java/com/qualcomm/ftccommon/configuration/EditPWMDevicesActivity.java
rename to FtcRobotController/FtcCommon/src/main/java/com/qualcomm/ftccommon/configuration/EditPWMDevicesActivity.java
index 64eaff5..92431d8 100644
--- a/FtcRobotController/app/src/main/java/com/qualcomm/ftccommon/configuration/EditPWMDevicesActivity.java
+++ b/FtcRobotController/FtcCommon/src/main/java/com/qualcomm/ftccommon/configuration/EditPWMDevicesActivity.java
@@ -1,160 +1,161 @@
-package com.qualcomm.ftccommon.configuration;
-
-import android.app.Activity;
-import android.content.Intent;
-import android.os.Bundle;
-import android.preference.PreferenceManager;
-import android.text.Editable;
-import android.text.TextWatcher;
-import android.view.View;
-import android.view.View.OnClickListener;
-import android.widget.CheckBox;
-import android.widget.EditText;
-import android.widget.LinearLayout;
-import android.widget.TextView;
-import com.qualcomm.ftccommon.R;
-import com.qualcomm.robotcore.hardware.configuration.DeviceConfiguration;
-import com.qualcomm.robotcore.hardware.configuration.Utility;
-import com.qualcomm.robotcore.util.RobotLog;
-import java.io.Serializable;
-import java.util.ArrayList;
-import java.util.Iterator;
-
-public class EditPWMDevicesActivity extends Activity {
- public static final String EDIT_PWM_DEVICES = "EDIT_PWM_DEVICES";
- private Utility a;
- private View b;
- private View c;
- private ArrayList d = new ArrayList();
-
- private void a() {
- Bundle var1 = new Bundle();
-
- for(int var2 = 0; var2 < this.d.size(); ++var2) {
- var1.putSerializable(String.valueOf(var2), (Serializable)this.d.get(var2));
- }
-
- Intent var3 = new Intent();
- var3.putExtras(var1);
- var3.putExtras(var1);
- this.setResult(-1, var3);
- this.finish();
- }
-
- private void a(int var1) {
- View var2 = this.d(var1);
- CheckBox var3 = (CheckBox)var2.findViewById(R.id.checkbox_port_pwm);
- DeviceConfiguration var4 = (DeviceConfiguration)this.d.get(var1);
- if(var4.isEnabled()) {
- var3.setChecked(true);
- ((EditText)var2.findViewById(R.id.editTextResult_pwm)).setText(var4.getName());
- } else {
- var3.setChecked(true);
- var3.performClick();
- }
- }
-
- private void b(int var1) {
- View var2 = this.d(var1);
- ((EditText)var2.findViewById(R.id.editTextResult_pwm)).addTextChangedListener(new EditPWMDevicesActivity.a(var2, null));
- }
-
- private void c(int var1) {
- View var2 = this.d(var1);
- final EditText var3 = (EditText)var2.findViewById(R.id.editTextResult_pwm);
- final DeviceConfiguration var4 = (DeviceConfiguration)this.d.get(var1);
- ((CheckBox)var2.findViewById(R.id.checkbox_port_pwm)).setOnClickListener(new OnClickListener() {
- public void onClick(View var1) {
- if(((CheckBox)var1).isChecked()) {
- var3.setEnabled(true);
- var3.setText("");
- var4.setEnabled(true);
- var4.setName("");
- } else {
- var3.setEnabled(false);
- var4.setEnabled(false);
- var4.setName("NO DEVICE ATTACHED");
- var3.setText("NO DEVICE ATTACHED");
- }
- }
- });
- }
-
- private View d(int var1) {
- switch(var1) {
- case 0:
- return this.b;
- case 1:
- return this.c;
- default:
- return null;
- }
- }
-
- public void cancelPWMDevices(View var1) {
- this.setResult(0, new Intent());
- this.finish();
- }
-
- protected void onCreate(Bundle var1) {
- super.onCreate(var1);
- this.setContentView(R.layout.pwms);
- PreferenceManager.setDefaultValues(this, R.xml.preferences, false);
- this.a = new Utility(this);
- RobotLog.writeLogcatToDisk(this, 1024);
- LinearLayout var2 = (LinearLayout)this.findViewById(R.id.linearLayout_pwm0);
- this.b = this.getLayoutInflater().inflate(R.layout.pwm_device, var2, true);
- ((TextView)this.b.findViewById(R.id.port_number_pwm)).setText("0");
- LinearLayout var3 = (LinearLayout)this.findViewById(R.id.linearLayout_pwm1);
- this.c = this.getLayoutInflater().inflate(R.layout.pwm_device, var3, true);
- ((TextView)this.c.findViewById(R.id.port_number_pwm)).setText("1");
- }
-
- protected void onStart() {
- super.onStart();
- this.a.updateHeader("No current file!", R.string.pref_hardware_config_filename, R.id.active_filename, R.id.included_header);
- Bundle var1 = this.getIntent().getExtras();
- if(var1 != null) {
- Iterator var2 = var1.keySet().iterator();
-
- while(var2.hasNext()) {
- String var4 = (String)var2.next();
- this.d.add(Integer.parseInt(var4), (DeviceConfiguration)var1.getSerializable(var4));
- }
-
- for(int var3 = 0; var3 < this.d.size(); ++var3) {
- this.c(var3);
- this.b(var3);
- this.a(var3);
- }
- }
-
- }
-
- public void savePWMDevices(View var1) {
- this.a();
- }
-
- private class a implements TextWatcher {
- private int b;
-
- private a(View var2) {
- this.b = Integer.parseInt(((TextView)var2.findViewById(R.id.port_number_pwm)).getText().toString());
- }
-
- // $FF: synthetic method
- a(View var2, Object var3) {
- this();
- }
-
- public void afterTextChanged(Editable var1) {
- ((DeviceConfiguration)EditPWMDevicesActivity.this.d.get(this.b)).setName(var1.toString());
- }
-
- public void beforeTextChanged(CharSequence var1, int var2, int var3, int var4) {
- }
-
- public void onTextChanged(CharSequence var1, int var2, int var3, int var4) {
- }
- }
-}
+package com.qualcomm.ftccommon.configuration;
+
+import android.app.Activity;
+import android.content.Intent;
+import android.os.Bundle;
+import android.preference.PreferenceManager;
+import android.text.Editable;
+import android.text.TextWatcher;
+import android.view.View;
+import android.view.View.OnClickListener;
+import android.widget.CheckBox;
+import android.widget.EditText;
+import android.widget.LinearLayout;
+import android.widget.TextView;
+
+import com.qualcomm.ftccommon.R;
+import com.qualcomm.robotcore.hardware.configuration.DeviceConfiguration;
+import com.qualcomm.robotcore.hardware.configuration.Utility;
+import com.qualcomm.robotcore.util.RobotLog;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+
+public class EditPWMDevicesActivity extends Activity {
+ public static final String EDIT_PWM_DEVICES = "EDIT_PWM_DEVICES";
+ private Utility a;
+ private View b;
+ private View c;
+ private ArrayList d = new ArrayList();
+
+ private void a() {
+ Bundle var1 = new Bundle();
+
+ for(int var2 = 0; var2 < this.d.size(); ++var2) {
+ var1.putSerializable(String.valueOf(var2), this.d.get(var2));
+ }
+
+ Intent var3 = new Intent();
+ var3.putExtras(var1);
+ var3.putExtras(var1);
+ this.setResult(-1, var3);
+ this.finish();
+ }
+
+ private void a(int var1) {
+ View var2 = this.d(var1);
+ CheckBox var3 = (CheckBox)var2.findViewById(R.id.checkbox_port_pwm);
+ DeviceConfiguration var4 = this.d.get(var1);
+ if(var4.isEnabled()) {
+ var3.setChecked(true);
+ ((EditText)var2.findViewById(R.id.editTextResult_pwm)).setText(var4.getName());
+ } else {
+ var3.setChecked(true);
+ var3.performClick();
+ }
+ }
+
+ private void b(int var1) {
+ View var2 = this.d(var1);
+ ((EditText)var2.findViewById(R.id.editTextResult_pwm)).addTextChangedListener(new a(var2, null));
+ }
+
+ private void c(int var1) {
+ View var2 = this.d(var1);
+ final EditText var3 = (EditText)var2.findViewById(R.id.editTextResult_pwm);
+ final DeviceConfiguration var4 = this.d.get(var1);
+ var2.findViewById(R.id.checkbox_port_pwm).setOnClickListener(new OnClickListener() {
+ public void onClick(View var1) {
+ if (((CheckBox) var1).isChecked()) {
+ var3.setEnabled(true);
+ var3.setText("");
+ var4.setEnabled(true);
+ var4.setName("");
+ } else {
+ var3.setEnabled(false);
+ var4.setEnabled(false);
+ var4.setName("NO DEVICE ATTACHED");
+ var3.setText("NO DEVICE ATTACHED");
+ }
+ }
+ });
+ }
+
+ private View d(int var1) {
+ switch(var1) {
+ case 0:
+ return this.b;
+ case 1:
+ return this.c;
+ default:
+ return null;
+ }
+ }
+
+ public void cancelPWMDevices(View var1) {
+ this.setResult(0, new Intent());
+ this.finish();
+ }
+
+ protected void onCreate(Bundle var1) {
+ super.onCreate(var1);
+ this.setContentView(R.layout.pwms);
+ PreferenceManager.setDefaultValues(this, R.xml.preferences, false);
+ this.a = new Utility(this);
+ RobotLog.writeLogcatToDisk(this, 1024);
+ LinearLayout var2 = (LinearLayout)this.findViewById(R.id.linearLayout_pwm0);
+ this.b = this.getLayoutInflater().inflate(R.layout.pwm_device, var2, true);
+ ((TextView)this.b.findViewById(R.id.port_number_pwm)).setText("0");
+ LinearLayout var3 = (LinearLayout)this.findViewById(R.id.linearLayout_pwm1);
+ this.c = this.getLayoutInflater().inflate(R.layout.pwm_device, var3, true);
+ ((TextView)this.c.findViewById(R.id.port_number_pwm)).setText("1");
+ }
+
+ protected void onStart() {
+ super.onStart();
+ this.a.updateHeader("No current file!", R.string.pref_hardware_config_filename, R.id.active_filename, R.id.included_header);
+ Bundle var1 = this.getIntent().getExtras();
+ if(var1 != null) {
+ Iterator var2 = var1.keySet().iterator();
+
+ while(var2.hasNext()) {
+ String var4 = (String)var2.next();
+ this.d.add(Integer.parseInt(var4), (DeviceConfiguration)var1.getSerializable(var4));
+ }
+
+ for(int var3 = 0; var3 < this.d.size(); ++var3) {
+ this.c(var3);
+ this.b(var3);
+ this.a(var3);
+ }
+ }
+
+ }
+
+ public void savePWMDevices(View var1) {
+ this.a();
+ }
+
+ private class a implements TextWatcher {
+ private int b;
+
+ private a(View var2) {
+ this.b = Integer.parseInt(((TextView)var2.findViewById(R.id.port_number_pwm)).getText().toString());
+ }
+
+ // $FF: synthetic method
+ a(View var2, Object var3) {
+ this(var2);
+ }
+
+ public void afterTextChanged(Editable var1) {
+ EditPWMDevicesActivity.this.d.get(this.b).setName(var1.toString());
+ }
+
+ public void beforeTextChanged(CharSequence var1, int var2, int var3, int var4) {
+ }
+
+ public void onTextChanged(CharSequence var1, int var2, int var3, int var4) {
+ }
+ }
+}
diff --git a/FtcRobotController/app/src/main/java/com/qualcomm/ftccommon/configuration/EditServoControllerActivity.java b/FtcRobotController/FtcCommon/src/main/java/com/qualcomm/ftccommon/configuration/EditServoControllerActivity.java
similarity index 90%
rename from FtcRobotController/app/src/main/java/com/qualcomm/ftccommon/configuration/EditServoControllerActivity.java
rename to FtcRobotController/FtcCommon/src/main/java/com/qualcomm/ftccommon/configuration/EditServoControllerActivity.java
index 6e85f41..83f3e27 100644
--- a/FtcRobotController/app/src/main/java/com/qualcomm/ftccommon/configuration/EditServoControllerActivity.java
+++ b/FtcRobotController/FtcCommon/src/main/java/com/qualcomm/ftccommon/configuration/EditServoControllerActivity.java
@@ -1,188 +1,190 @@
-package com.qualcomm.ftccommon.configuration;
-
-import android.app.Activity;
-import android.content.Intent;
-import android.os.Bundle;
-import android.preference.PreferenceManager;
-import android.text.Editable;
-import android.text.TextWatcher;
-import android.view.View;
-import android.view.View.OnClickListener;
-import android.widget.CheckBox;
-import android.widget.EditText;
-import android.widget.LinearLayout;
-import android.widget.TextView;
-import com.qualcomm.ftccommon.R;
-import com.qualcomm.robotcore.hardware.configuration.ControllerConfiguration;
-import com.qualcomm.robotcore.hardware.configuration.DeviceConfiguration;
-import com.qualcomm.robotcore.hardware.configuration.ServoControllerConfiguration;
-import com.qualcomm.robotcore.hardware.configuration.Utility;
-import com.qualcomm.robotcore.util.RobotLog;
-import java.io.Serializable;
-import java.util.ArrayList;
-
-public class EditServoControllerActivity extends Activity {
- public static final String EDIT_SERVO_ACTIVITY = "Edit Servo ControllerConfiguration Activity";
- private Utility a;
- private ServoControllerConfiguration b;
- private ArrayList c;
- private EditText d;
- private View e;
- private View f;
- private View g;
- private View h;
- private View i;
- private View j;
-
- private void a() {
- Intent var1 = new Intent();
- this.b.addServos(this.c);
- this.b.setName(this.d.getText().toString());
- var1.putExtra("Edit Servo ControllerConfiguration Activity", this.b);
- this.setResult(-1, var1);
- this.finish();
- }
-
- private void a(int var1) {
- View var2 = this.d(var1);
- ((EditText)var2.findViewById(R.id.editTextResult_servo)).addTextChangedListener(new EditServoControllerActivity.a(var2, null));
- }
-
- private void b(int var1) {
- View var2 = this.d(var1);
- CheckBox var3 = (CheckBox)var2.findViewById(R.id.checkbox_port_servo);
- DeviceConfiguration var4 = (DeviceConfiguration)this.c.get(var1 - 1);
- if(var4.isEnabled()) {
- var3.setChecked(true);
- ((EditText)var2.findViewById(R.id.editTextResult_servo)).setText(var4.getName());
- } else {
- var3.setChecked(true);
- var3.performClick();
- }
- }
-
- private void c(int var1) {
- View var2 = this.d(var1);
- final EditText var3 = (EditText)var2.findViewById(R.id.editTextResult_servo);
- final DeviceConfiguration var4 = (DeviceConfiguration)this.c.get(var1 - 1);
- ((CheckBox)var2.findViewById(R.id.checkbox_port_servo)).setOnClickListener(new OnClickListener() {
- public void onClick(View var1) {
- if(((CheckBox)var1).isChecked()) {
- var3.setEnabled(true);
- var3.setText("");
- var4.setEnabled(true);
- var4.setName("");
- } else {
- var3.setEnabled(false);
- var4.setEnabled(false);
- var4.setName("NO DEVICE ATTACHED");
- var3.setText("NO DEVICE ATTACHED");
- }
- }
- });
- }
-
- private View d(int var1) {
- switch(var1) {
- case 1:
- return this.e;
- case 2:
- return this.f;
- case 3:
- return this.g;
- case 4:
- return this.h;
- case 5:
- return this.i;
- case 6:
- return this.j;
- default:
- return null;
- }
- }
-
- public void cancelServoController(View var1) {
- this.setResult(0, new Intent());
- this.finish();
- }
-
- protected void onCreate(Bundle var1) {
- super.onCreate(var1);
- this.setContentView(R.layout.servos);
- PreferenceManager.setDefaultValues(this, R.xml.preferences, false);
- this.a = new Utility(this);
- RobotLog.writeLogcatToDisk(this, 1024);
- this.d = (EditText)this.findViewById(R.id.servocontroller_name);
- LinearLayout var2 = (LinearLayout)this.findViewById(R.id.linearLayout_servo1);
- this.e = this.getLayoutInflater().inflate(R.layout.servo, var2, true);
- ((TextView)this.e.findViewById(R.id.port_number_servo)).setText("1");
- LinearLayout var3 = (LinearLayout)this.findViewById(R.id.linearLayout_servo2);
- this.f = this.getLayoutInflater().inflate(R.layout.servo, var3, true);
- ((TextView)this.f.findViewById(R.id.port_number_servo)).setText("2");
- LinearLayout var4 = (LinearLayout)this.findViewById(R.id.linearLayout_servo3);
- this.g = this.getLayoutInflater().inflate(R.layout.servo, var4, true);
- ((TextView)this.g.findViewById(R.id.port_number_servo)).setText("3");
- LinearLayout var5 = (LinearLayout)this.findViewById(R.id.linearLayout_servo4);
- this.h = this.getLayoutInflater().inflate(R.layout.servo, var5, true);
- ((TextView)this.h.findViewById(R.id.port_number_servo)).setText("4");
- LinearLayout var6 = (LinearLayout)this.findViewById(R.id.linearLayout_servo5);
- this.i = this.getLayoutInflater().inflate(R.layout.servo, var6, true);
- ((TextView)this.i.findViewById(R.id.port_number_servo)).setText("5");
- LinearLayout var7 = (LinearLayout)this.findViewById(R.id.linearLayout_servo6);
- this.j = this.getLayoutInflater().inflate(R.layout.servo, var7, true);
- ((TextView)this.j.findViewById(R.id.port_number_servo)).setText("6");
- }
-
- protected void onStart() {
- super.onStart();
- this.a.updateHeader("No current file!", R.string.pref_hardware_config_filename, R.id.active_filename, R.id.included_header);
- Serializable var1 = this.getIntent().getSerializableExtra("Edit Servo ControllerConfiguration Activity");
- if(var1 != null) {
- this.b = (ServoControllerConfiguration)var1;
- this.c = (ArrayList)this.b.getServos();
- }
-
- this.d.setText(this.b.getName());
- TextView var2 = (TextView)this.findViewById(R.id.servo_controller_serialNumber);
- String var3 = this.b.getSerialNumber().toString();
- if(var3.equalsIgnoreCase(ControllerConfiguration.NO_SERIAL_NUMBER.toString())) {
- var3 = "No serial number";
- }
-
- var2.setText(var3);
-
- for(int var4 = 0; var4 < this.c.size(); ++var4) {
- this.c(var4 + 1);
- this.a(var4 + 1);
- this.b(var4 + 1);
- }
-
- }
-
- public void saveServoController(View var1) {
- this.a();
- }
-
- private class a implements TextWatcher {
- private int b;
-
- private a(View var2) {
- this.b = Integer.parseInt(((TextView)var2.findViewById(R.id.port_number_servo)).getText().toString());
- }
-
- // $FF: synthetic method
- a(View var2, Object var3) {
- this();
- }
-
- public void afterTextChanged(Editable var1) {
- ((DeviceConfiguration)EditServoControllerActivity.this.c.get(-1 + this.b)).setName(var1.toString());
- }
-
- public void beforeTextChanged(CharSequence var1, int var2, int var3, int var4) {
- }
-
- public void onTextChanged(CharSequence var1, int var2, int var3, int var4) {
- }
- }
-}
+package com.qualcomm.ftccommon.configuration;
+
+import android.app.Activity;
+import android.content.Intent;
+import android.os.Bundle;
+import android.preference.PreferenceManager;
+import android.text.Editable;
+import android.text.TextWatcher;
+import android.view.View;
+import android.view.View.OnClickListener;
+import android.widget.CheckBox;
+import android.widget.EditText;
+import android.widget.LinearLayout;
+import android.widget.TextView;
+
+import com.qualcomm.ftccommon.R;
+import com.qualcomm.robotcore.hardware.configuration.ControllerConfiguration;
+import com.qualcomm.robotcore.hardware.configuration.DeviceConfiguration;
+import com.qualcomm.robotcore.hardware.configuration.ServoControllerConfiguration;
+import com.qualcomm.robotcore.hardware.configuration.Utility;
+import com.qualcomm.robotcore.util.RobotLog;
+
+import java.io.Serializable;
+import java.util.ArrayList;
+
+public class EditServoControllerActivity extends Activity {
+ public static final String EDIT_SERVO_ACTIVITY = "Edit Servo ControllerConfiguration Activity";
+ private Utility a;
+ private ServoControllerConfiguration b;
+ private ArrayList c;
+ private EditText d;
+ private View e;
+ private View f;
+ private View g;
+ private View h;
+ private View i;
+ private View j;
+
+ private void a() {
+ Intent var1 = new Intent();
+ this.b.addServos(this.c);
+ this.b.setName(this.d.getText().toString());
+ var1.putExtra("Edit Servo ControllerConfiguration Activity", this.b);
+ this.setResult(-1, var1);
+ this.finish();
+ }
+
+ private void a(int var1) {
+ View var2 = this.d(var1);
+ ((EditText)var2.findViewById(R.id.editTextResult_servo)).addTextChangedListener(new a(var2, null));
+ }
+
+ private void b(int var1) {
+ View var2 = this.d(var1);
+ CheckBox var3 = (CheckBox)var2.findViewById(R.id.checkbox_port_servo);
+ DeviceConfiguration var4 = this.c.get(var1 - 1);
+ if(var4.isEnabled()) {
+ var3.setChecked(true);
+ ((EditText)var2.findViewById(R.id.editTextResult_servo)).setText(var4.getName());
+ } else {
+ var3.setChecked(true);
+ var3.performClick();
+ }
+ }
+
+ private void c(int var1) {
+ View var2 = this.d(var1);
+ final EditText var3 = (EditText)var2.findViewById(R.id.editTextResult_servo);
+ final DeviceConfiguration var4 = this.c.get(var1 - 1);
+ var2.findViewById(R.id.checkbox_port_servo).setOnClickListener(new OnClickListener() {
+ public void onClick(View var1) {
+ if (((CheckBox) var1).isChecked()) {
+ var3.setEnabled(true);
+ var3.setText("");
+ var4.setEnabled(true);
+ var4.setName("");
+ } else {
+ var3.setEnabled(false);
+ var4.setEnabled(false);
+ var4.setName("NO DEVICE ATTACHED");
+ var3.setText("NO DEVICE ATTACHED");
+ }
+ }
+ });
+ }
+
+ private View d(int var1) {
+ switch(var1) {
+ case 1:
+ return this.e;
+ case 2:
+ return this.f;
+ case 3:
+ return this.g;
+ case 4:
+ return this.h;
+ case 5:
+ return this.i;
+ case 6:
+ return this.j;
+ default:
+ return null;
+ }
+ }
+
+ public void cancelServoController(View var1) {
+ this.setResult(0, new Intent());
+ this.finish();
+ }
+
+ protected void onCreate(Bundle var1) {
+ super.onCreate(var1);
+ this.setContentView(R.layout.servos);
+ PreferenceManager.setDefaultValues(this, R.xml.preferences, false);
+ this.a = new Utility(this);
+ RobotLog.writeLogcatToDisk(this, 1024);
+ this.d = (EditText)this.findViewById(R.id.servocontroller_name);
+ LinearLayout var2 = (LinearLayout)this.findViewById(R.id.linearLayout_servo1);
+ this.e = this.getLayoutInflater().inflate(R.layout.servo, var2, true);
+ ((TextView)this.e.findViewById(R.id.port_number_servo)).setText("1");
+ LinearLayout var3 = (LinearLayout)this.findViewById(R.id.linearLayout_servo2);
+ this.f = this.getLayoutInflater().inflate(R.layout.servo, var3, true);
+ ((TextView)this.f.findViewById(R.id.port_number_servo)).setText("2");
+ LinearLayout var4 = (LinearLayout)this.findViewById(R.id.linearLayout_servo3);
+ this.g = this.getLayoutInflater().inflate(R.layout.servo, var4, true);
+ ((TextView)this.g.findViewById(R.id.port_number_servo)).setText("3");
+ LinearLayout var5 = (LinearLayout)this.findViewById(R.id.linearLayout_servo4);
+ this.h = this.getLayoutInflater().inflate(R.layout.servo, var5, true);
+ ((TextView)this.h.findViewById(R.id.port_number_servo)).setText("4");
+ LinearLayout var6 = (LinearLayout)this.findViewById(R.id.linearLayout_servo5);
+ this.i = this.getLayoutInflater().inflate(R.layout.servo, var6, true);
+ ((TextView)this.i.findViewById(R.id.port_number_servo)).setText("5");
+ LinearLayout var7 = (LinearLayout)this.findViewById(R.id.linearLayout_servo6);
+ this.j = this.getLayoutInflater().inflate(R.layout.servo, var7, true);
+ ((TextView)this.j.findViewById(R.id.port_number_servo)).setText("6");
+ }
+
+ protected void onStart() {
+ super.onStart();
+ this.a.updateHeader("No current file!", R.string.pref_hardware_config_filename, R.id.active_filename, R.id.included_header);
+ Serializable var1 = this.getIntent().getSerializableExtra("Edit Servo ControllerConfiguration Activity");
+ if(var1 != null) {
+ this.b = (ServoControllerConfiguration)var1;
+ this.c = (ArrayList)this.b.getServos();
+ }
+
+ this.d.setText(this.b.getName());
+ TextView var2 = (TextView)this.findViewById(R.id.servo_controller_serialNumber);
+ String var3 = this.b.getSerialNumber().toString();
+ if(var3.equalsIgnoreCase(ControllerConfiguration.NO_SERIAL_NUMBER.toString())) {
+ var3 = "No serial number";
+ }
+
+ var2.setText(var3);
+
+ for(int var4 = 0; var4 < this.c.size(); ++var4) {
+ this.c(var4 + 1);
+ this.a(var4 + 1);
+ this.b(var4 + 1);
+ }
+
+ }
+
+ public void saveServoController(View var1) {
+ this.a();
+ }
+
+ private class a implements TextWatcher {
+ private int b;
+
+ private a(View var2) {
+ this.b = Integer.parseInt(((TextView)var2.findViewById(R.id.port_number_servo)).getText().toString());
+ }
+
+ // $FF: synthetic method
+ a(View var2, Object var3) {
+ this(var2);
+ }
+
+ public void afterTextChanged(Editable var1) {
+ EditServoControllerActivity.this.c.get(-1 + this.b).setName(var1.toString());
+ }
+
+ public void beforeTextChanged(CharSequence var1, int var2, int var3, int var4) {
+ }
+
+ public void onTextChanged(CharSequence var1, int var2, int var3, int var4) {
+ }
+ }
+}
diff --git a/FtcRobotController/app/src/main/java/com/qualcomm/ftccommon/configuration/FtcConfigurationActivity.java b/FtcRobotController/FtcCommon/src/main/java/com/qualcomm/ftccommon/configuration/FtcConfigurationActivity.java
similarity index 91%
rename from FtcRobotController/app/src/main/java/com/qualcomm/ftccommon/configuration/FtcConfigurationActivity.java
rename to FtcRobotController/FtcCommon/src/main/java/com/qualcomm/ftccommon/configuration/FtcConfigurationActivity.java
index 7aa0a2d..0c2b663 100644
--- a/FtcRobotController/app/src/main/java/com/qualcomm/ftccommon/configuration/FtcConfigurationActivity.java
+++ b/FtcRobotController/FtcCommon/src/main/java/com/qualcomm/ftccommon/configuration/FtcConfigurationActivity.java
@@ -1,434 +1,430 @@
-package com.qualcomm.ftccommon.configuration;
-
-import android.app.Activity;
-import android.app.AlertDialog;
-import android.app.AlertDialog.Builder;
-import android.content.Context;
-import android.content.DialogInterface;
-import android.content.Intent;
-import android.content.SharedPreferences;
-import android.content.DialogInterface.OnClickListener;
-import android.os.Bundle;
-import android.preference.PreferenceManager;
-import android.view.View;
-import android.widget.AdapterView;
-import android.widget.Button;
-import android.widget.EditText;
-import android.widget.LinearLayout;
-import android.widget.ListView;
-import android.widget.TextView;
-import android.widget.AdapterView.OnItemClickListener;
-import com.qualcomm.ftccommon.DbgLog;
-import com.qualcomm.ftccommon.R;
-import com.qualcomm.ftccommon.configuration.EditDeviceInterfaceModuleActivity;
-import com.qualcomm.ftccommon.configuration.EditLegacyModuleControllerActivity;
-import com.qualcomm.ftccommon.configuration.EditMotorControllerActivity;
-import com.qualcomm.ftccommon.configuration.EditServoControllerActivity;
-import com.qualcomm.hardware.ModernRoboticsDeviceManager;
-import com.qualcomm.robotcore.eventloop.EventLoopManager;
-import com.qualcomm.robotcore.exception.RobotCoreException;
-import com.qualcomm.robotcore.hardware.DeviceManager;
-import com.qualcomm.robotcore.hardware.configuration.ControllerConfiguration;
-import com.qualcomm.robotcore.hardware.configuration.DeviceConfiguration;
-import com.qualcomm.robotcore.hardware.configuration.DeviceInfoAdapter;
-import com.qualcomm.robotcore.hardware.configuration.ReadXMLFileHandler;
-import com.qualcomm.robotcore.hardware.configuration.Utility;
-import com.qualcomm.robotcore.util.RobotLog;
-import com.qualcomm.robotcore.util.SerialNumber;
-import java.io.FileInputStream;
-import java.io.FileNotFoundException;
-import java.io.IOException;
-import java.io.Serializable;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.Map;
-import java.util.Set;
-import java.util.Map.Entry;
-
-public class FtcConfigurationActivity extends Activity {
- OnClickListener a = new OnClickListener() {
- public void onClick(DialogInterface var1, int var2) {
- }
- };
- OnClickListener b = new OnClickListener() {
- public void onClick(DialogInterface var1, int var2) {
- FtcConfigurationActivity.this.j.saveToPreferences(FtcConfigurationActivity.this.i.substring(7).trim(), R.string.pref_hardware_config_filename);
- FtcConfigurationActivity.this.finish();
- }
- };
- OnClickListener c = new OnClickListener() {
- public void onClick(DialogInterface var1, int var2) {
- }
- };
- private Thread d;
- private Map e = new HashMap();
- private Context f;
- private DeviceManager g;
- private Button h;
- private String i = "No current file!";
- private Utility j;
- protected SharedPreferences preferences;
- protected Map scannedDevices = new HashMap();
- protected Set> scannedEntries = new HashSet();
-
- private void a() {
- ((Button)this.findViewById(R.id.devices_holder).findViewById(R.id.info_btn)).setOnClickListener(new android.view.View.OnClickListener() {
- public void onClick(View var1) {
- Builder var2 = FtcConfigurationActivity.this.j.buildBuilder("Devices", "These are the devices discovered by the Hardware Wizard. You can click on the name of each device to edit the information relating to that device. Make sure each device has a unique name. The names should match what is in the Op mode code. Scroll down to see more devices if there are any.");
- var2.setPositiveButton("Ok", FtcConfigurationActivity.this.a);
- AlertDialog var4 = var2.create();
- var4.show();
- ((TextView)var4.findViewById(16908299)).setTextSize(14.0F);
- }
- });
- ((Button)this.findViewById(R.id.save_holder).findViewById(R.id.info_btn)).setOnClickListener(new android.view.View.OnClickListener() {
- public void onClick(View var1) {
- Builder var2 = FtcConfigurationActivity.this.j.buildBuilder("Save Configuration", "Clicking the save button will create an xml file in: \n /sdcard/FIRST/ \nThis file will be used to initialize the robot.");
- var2.setPositiveButton("Ok", FtcConfigurationActivity.this.a);
- AlertDialog var4 = var2.create();
- var4.show();
- ((TextView)var4.findViewById(16908299)).setTextSize(14.0F);
- }
- });
- }
-
- private void a(String var1) {
- String var2 = "Found " + var1;
- this.j.setOrangeText(var2, "Please fix and re-save.", R.id.warning_layout, R.layout.orange_warning, R.id.orangetext0, R.id.orangetext1);
- }
-
- private void a(ArrayList var1) {
- this.e = new HashMap();
- Iterator var2 = var1.iterator();
-
- while(var2.hasNext()) {
- ControllerConfiguration var3 = (ControllerConfiguration)var2.next();
- this.e.put(var3.getSerialNumber(), var3);
- }
-
- }
-
- private HashMap b() {
- HashMap var1 = new HashMap();
- Iterator var2 = this.scannedEntries.iterator();
-
- while(var2.hasNext()) {
- Entry var3 = (Entry)var2.next();
- SerialNumber var4 = (SerialNumber)var3.getKey();
- if(this.e.containsKey(var4)) {
- var1.put(var4, this.e.get(var4));
- } else {
- switch(null.a[((DeviceManager.DeviceType)var3.getValue()).ordinal()]) {
- case 1:
- var1.put(var4, this.j.buildMotorController(var4));
- break;
- case 2:
- var1.put(var4, this.j.buildServoController(var4));
- break;
- case 3:
- var1.put(var4, this.j.buildLegacyModule(var4));
- break;
- case 4:
- var1.put(var4, this.j.buildDeviceInterfaceModule(var4));
- }
- }
- }
-
- return var1;
- }
-
- private void c() {
- if(this.i.toLowerCase().contains("Unsaved".toLowerCase())) {
- EditText var1 = new EditText(this.f);
- var1.setEnabled(false);
- var1.setText("");
- Builder var2 = this.j.buildBuilder("Unsaved changes", "If you scan, your current unsaved changes will be lost.");
- var2.setView(var1);
- var2.setPositiveButton("Ok", new OnClickListener() {
- public void onClick(DialogInterface var1, int var2) {
- FtcConfigurationActivity.this.d.start();
- }
- });
- var2.setNegativeButton("Cancel", this.c);
- var2.show();
- } else {
- this.d.start();
- }
- }
-
- private void d() {
- ReadXMLFileHandler var1 = new ReadXMLFileHandler(this.f);
- if(!this.i.equalsIgnoreCase("No current file!")) {
- try {
- this.a((ArrayList)var1.parse(new FileInputStream(Utility.CONFIG_FILES_DIR + this.i + ".xml")));
- this.h();
- this.f();
- } catch (RobotCoreException var4) {
- RobotLog.e("Error parsing XML file");
- RobotLog.logStacktrace(var4);
- this.j.complainToast("Error parsing XML file: " + this.i, this.f);
- } catch (FileNotFoundException var5) {
- DbgLog.error("File was not found: " + this.i);
- DbgLog.logStacktrace(var5);
- this.j.complainToast("That file was not found: " + this.i, this.f);
- }
- }
- }
-
- private void e() {
- if(this.e.size() == 0) {
- this.j.setOrangeText("Scan to find devices.", "In order to find devices: \n 1. Attach a robot \n 2. Press the \'Scan\' button", R.id.empty_devicelist, R.layout.orange_warning, R.id.orangetext0, R.id.orangetext1);
- this.g();
- } else {
- LinearLayout var1 = (LinearLayout)this.findViewById(R.id.empty_devicelist);
- var1.removeAllViews();
- var1.setVisibility(8);
- }
- }
-
- private void f() {
- if(this.e.size() == 0) {
- this.j.setOrangeText("No devices found!", "In order to find devices: \n 1. Attach a robot \n 2. Press the \'Scan\' button", R.id.empty_devicelist, R.layout.orange_warning, R.id.orangetext0, R.id.orangetext1);
- this.g();
- } else {
- LinearLayout var1 = (LinearLayout)this.findViewById(R.id.empty_devicelist);
- var1.removeAllViews();
- var1.setVisibility(8);
- }
- }
-
- private void g() {
- LinearLayout var1 = (LinearLayout)this.findViewById(R.id.warning_layout);
- var1.removeAllViews();
- var1.setVisibility(8);
- }
-
- private void h() {
- ListView var1 = (ListView)this.findViewById(R.id.controllersList);
- var1.setAdapter(new DeviceInfoAdapter(this, 17367044, this.e));
- var1.setOnItemClickListener(new OnItemClickListener() {
- public void onItemClick(AdapterView> var1, View var2, int var3, long var4) {
- ControllerConfiguration var6 = (ControllerConfiguration)var1.getItemAtPosition(var3);
- DeviceConfiguration.ConfigurationType var7 = var6.getType();
- if(var7.equals(DeviceConfiguration.ConfigurationType.MOTOR_CONTROLLER)) {
- Intent var8 = new Intent(FtcConfigurationActivity.this.f, EditMotorControllerActivity.class);
- var8.putExtra("EDIT_MOTOR_CONTROLLER_CONFIG", var6);
- var8.putExtra("requestCode", 1);
- FtcConfigurationActivity.this.setResult(-1, var8);
- FtcConfigurationActivity.this.startActivityForResult(var8, 1);
- }
-
- if(var7.equals(DeviceConfiguration.ConfigurationType.SERVO_CONTROLLER)) {
- Intent var11 = new Intent(FtcConfigurationActivity.this.f, EditServoControllerActivity.class);
- var11.putExtra("Edit Servo ControllerConfiguration Activity", var6);
- var11.putExtra("requestCode", 2);
- FtcConfigurationActivity.this.setResult(-1, var11);
- FtcConfigurationActivity.this.startActivityForResult(var11, 2);
- }
-
- if(var7.equals(DeviceConfiguration.ConfigurationType.LEGACY_MODULE_CONTROLLER)) {
- Intent var14 = new Intent(FtcConfigurationActivity.this.f, EditLegacyModuleControllerActivity.class);
- var14.putExtra("EDIT_LEGACY_CONFIG", var6);
- var14.putExtra("requestCode", 3);
- FtcConfigurationActivity.this.setResult(-1, var14);
- FtcConfigurationActivity.this.startActivityForResult(var14, 3);
- }
-
- if(var7.equals(DeviceConfiguration.ConfigurationType.DEVICE_INTERFACE_MODULE)) {
- Intent var17 = new Intent(FtcConfigurationActivity.this.f, EditDeviceInterfaceModuleActivity.class);
- var17.putExtra("EDIT_DEVICE_INTERFACE_MODULE_CONFIG", var6);
- var17.putExtra("requestCode", 4);
- FtcConfigurationActivity.this.setResult(-1, var17);
- FtcConfigurationActivity.this.startActivityForResult(var17, 4);
- }
-
- }
- });
- }
-
- private void i() {
- if(!this.i.toLowerCase().contains("Unsaved".toLowerCase())) {
- String var1 = "Unsaved " + this.i;
- this.j.saveToPreferences(var1, R.string.pref_hardware_config_filename);
- this.i = var1;
- }
-
- }
-
- protected void onActivityResult(int var1, int var2, Intent var3) {
- if(var2 != 0) {
- Serializable var4;
- if(var1 == 1) {
- var4 = var3.getSerializableExtra("EDIT_MOTOR_CONTROLLER_CONFIG");
- } else if(var1 == 2) {
- var4 = var3.getSerializableExtra("Edit Servo ControllerConfiguration Activity");
- } else if(var1 == 3) {
- var4 = var3.getSerializableExtra("EDIT_LEGACY_CONFIG");
- } else {
- var4 = null;
- if(var1 == 4) {
- var4 = var3.getSerializableExtra("EDIT_DEVICE_INTERFACE_MODULE_CONFIG");
- }
- }
-
- if(var4 != null) {
- ControllerConfiguration var5 = (ControllerConfiguration)var4;
- this.scannedDevices.put(var5.getSerialNumber(), var5.configTypeToDeviceType(var5.getType()));
- this.e.put(var5.getSerialNumber(), var5);
- this.h();
- this.i();
- } else {
- DbgLog.error("Received Result with an incorrect request code: " + String.valueOf(var1));
- }
- }
- }
-
- public void onBackPressed() {
- if(this.i.toLowerCase().contains("Unsaved".toLowerCase())) {
- if(!this.j.writeXML(this.e)) {
- final EditText var1 = new EditText(this);
- var1.setText(this.j.prepareFilename(this.i));
- Builder var2 = this.j.buildBuilder("Unsaved changes", "Please save your file before exiting the Hardware Wizard! \n If you click \'Cancel\' your changes will be lost.");
- var2.setView(var1);
- var2.setPositiveButton("Ok", new OnClickListener() {
- public void onClick(DialogInterface var1x, int var2) {
- String var3 = (var1.getText().toString() + ".xml").trim();
- if(var3.equals(".xml")) {
- FtcConfigurationActivity.this.j.complainToast("File not saved: Please entire a filename.", FtcConfigurationActivity.this.f);
- } else {
- try {
- FtcConfigurationActivity.this.j.writeToFile(var3);
- } catch (RobotCoreException var6) {
- FtcConfigurationActivity.this.j.complainToast(var6.getMessage(), FtcConfigurationActivity.this.f);
- DbgLog.error(var6.getMessage());
- return;
- } catch (IOException var7) {
- FtcConfigurationActivity.this.a(var7.getMessage());
- DbgLog.error(var7.getMessage());
- return;
- }
-
- FtcConfigurationActivity.this.g();
- FtcConfigurationActivity.this.j.saveToPreferences(var1.getText().toString(), R.string.pref_hardware_config_filename);
- FtcConfigurationActivity.this.i = var1.getText().toString();
- FtcConfigurationActivity.this.j.updateHeader("robot_config", R.string.pref_hardware_config_filename, R.id.active_filename, R.id.included_header);
- FtcConfigurationActivity.this.j.confirmSave();
- FtcConfigurationActivity.this.finish();
- }
- }
- });
- var2.setNegativeButton("Cancel", this.b);
- var2.show();
- }
- } else {
- super.onBackPressed();
- }
- }
-
- protected void onCreate(Bundle var1) {
- super.onCreate(var1);
- this.setContentView(R.layout.activity_ftc_configuration);
- RobotLog.writeLogcatToDisk(this, 1024);
- this.f = this;
- this.j = new Utility(this);
- this.h = (Button)this.findViewById(R.id.scanButton);
- this.a();
-
- try {
- this.g = new ModernRoboticsDeviceManager(this.f, (EventLoopManager)null);
- } catch (RobotCoreException var3) {
- this.j.complainToast("Failed to open the Device Manager", this.f);
- DbgLog.error("Failed to open deviceManager: " + var3.toString());
- DbgLog.logStacktrace(var3);
- }
-
- this.preferences = PreferenceManager.getDefaultSharedPreferences(this);
- }
-
- protected void onDestroy() {
- super.onDestroy();
- this.j.resetCount();
- }
-
- protected void onStart() {
- super.onStart();
- this.i = this.j.getFilenameFromPrefs(R.string.pref_hardware_config_filename, "No current file!");
- if(this.i.equalsIgnoreCase("No current file!")) {
- this.j.createConfigFolder();
- }
-
- this.j.updateHeader("No current file!", R.string.pref_hardware_config_filename, R.id.active_filename, R.id.included_header);
- this.e();
- if(!this.i.toLowerCase().contains("Unsaved".toLowerCase())) {
- this.d();
- }
-
- this.h.setOnClickListener(new android.view.View.OnClickListener() {
- public void onClick(View var1) {
- FtcConfigurationActivity.this.d = new Thread(new Runnable() {
- public void run() {
- try {
- DbgLog.msg("Scanning USB bus");
- FtcConfigurationActivity.this.scannedDevices = FtcConfigurationActivity.this.g.scanForUsbDevices();
- } catch (RobotCoreException var2) {
- DbgLog.error("Device scan failed: " + var2.toString());
- }
-
- FtcConfigurationActivity.this.runOnUiThread(new Runnable() {
- public void run() {
- FtcConfigurationActivity.this.j.resetCount();
- FtcConfigurationActivity.this.g();
- FtcConfigurationActivity.this.i();
- FtcConfigurationActivity.this.j.updateHeader(FtcConfigurationActivity.this.i, R.string.pref_hardware_config_filename, R.id.active_filename, R.id.included_header);
- FtcConfigurationActivity.this.scannedEntries = FtcConfigurationActivity.this.scannedDevices.entrySet();
- FtcConfigurationActivity.this.e = FtcConfigurationActivity.this.b();
- FtcConfigurationActivity.this.h();
- FtcConfigurationActivity.this.f();
- }
- });
- }
- });
- FtcConfigurationActivity.this.c();
- }
- });
- }
-
- public void saveConfiguration(View var1) {
- if(!this.j.writeXML(this.e)) {
- final EditText var2 = new EditText(this);
- var2.setText(this.j.prepareFilename(this.i));
- Builder var3 = this.j.buildBuilder("Enter file name", "Please enter the file name");
- var3.setView(var2);
- var3.setPositiveButton("Ok", new OnClickListener() {
- public void onClick(DialogInterface var1, int var2x) {
- String var3 = (var2.getText().toString() + ".xml").trim();
- if(var3.equals(".xml")) {
- FtcConfigurationActivity.this.j.complainToast("File not saved: Please entire a filename.", FtcConfigurationActivity.this.f);
- } else {
- try {
- FtcConfigurationActivity.this.j.writeToFile(var3);
- } catch (RobotCoreException var6) {
- FtcConfigurationActivity.this.j.complainToast(var6.getMessage(), FtcConfigurationActivity.this.f);
- DbgLog.error(var6.getMessage());
- return;
- } catch (IOException var7) {
- FtcConfigurationActivity.this.a(var7.getMessage());
- DbgLog.error(var7.getMessage());
- return;
- }
-
- FtcConfigurationActivity.this.g();
- FtcConfigurationActivity.this.j.saveToPreferences(var2.getText().toString(), R.string.pref_hardware_config_filename);
- FtcConfigurationActivity.this.i = var2.getText().toString();
- FtcConfigurationActivity.this.j.updateHeader("robot_config", R.string.pref_hardware_config_filename, R.id.active_filename, R.id.included_header);
- FtcConfigurationActivity.this.j.confirmSave();
- }
- }
- });
- var3.setNegativeButton("Cancel", this.c);
- var3.show();
- }
- }
-}
+package com.qualcomm.ftccommon.configuration;
+
+import android.app.Activity;
+import android.app.AlertDialog;
+import android.app.AlertDialog.Builder;
+import android.content.Context;
+import android.content.DialogInterface;
+import android.content.DialogInterface.OnClickListener;
+import android.content.Intent;
+import android.content.SharedPreferences;
+import android.os.Bundle;
+import android.preference.PreferenceManager;
+import android.view.View;
+import android.widget.AdapterView;
+import android.widget.AdapterView.OnItemClickListener;
+import android.widget.Button;
+import android.widget.EditText;
+import android.widget.LinearLayout;
+import android.widget.ListView;
+import android.widget.TextView;
+
+import com.qualcomm.ftccommon.DbgLog;
+import com.qualcomm.hardware.ModernRoboticsDeviceManager;
+import com.qualcomm.robotcore.exception.RobotCoreException;
+import com.qualcomm.robotcore.hardware.DeviceManager;
+import com.qualcomm.robotcore.hardware.configuration.ControllerConfiguration;
+import com.qualcomm.robotcore.hardware.configuration.DeviceConfiguration;
+import com.qualcomm.robotcore.hardware.configuration.DeviceInfoAdapter;
+import com.qualcomm.robotcore.hardware.configuration.ReadXMLFileHandler;
+import com.qualcomm.robotcore.hardware.configuration.Utility;
+import com.qualcomm.robotcore.util.RobotLog;
+import com.qualcomm.robotcore.util.SerialNumber;
+
+import java.io.FileInputStream;
+import java.io.FileNotFoundException;
+import java.io.IOException;
+import java.io.Serializable;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.Map;
+import java.util.Map.Entry;
+import java.util.Set;
+
+public class FtcConfigurationActivity extends Activity {
+ protected SharedPreferences preferences;
+ protected Map scannedDevices = new HashMap();
+ protected Set> scannedEntries = new HashSet();
+ OnClickListener a = new OnClickListener() {
+ public void onClick(DialogInterface var1, int var2) {
+ }
+ };
+ OnClickListener c = new OnClickListener() {
+ public void onClick(DialogInterface var1, int var2) {
+ }
+ };
+ private Thread d;
+ private Map e = new HashMap();
+ private Context f;
+ private DeviceManager g;
+ private Button h;
+ private String i = "No current file!";
+ private Utility j;
+ OnClickListener b = new OnClickListener() {
+ public void onClick(DialogInterface var1, int var2) {
+ FtcConfigurationActivity.this.j.saveToPreferences(FtcConfigurationActivity.this.i.substring(7).trim(), R.string.pref_hardware_config_filename);
+ FtcConfigurationActivity.this.finish();
+ }
+ };
+
+ private void a() {
+ this.findViewById(R.id.devices_holder).findViewById(R.id.info_btn).setOnClickListener(new View.OnClickListener() {
+ public void onClick(View var1) {
+ Builder var2 = FtcConfigurationActivity.this.j.buildBuilder("Devices", "These are the devices discovered by the Hardware Wizard. You can click on the name of each device to edit the information relating to that device. Make sure each device has a unique name. The names should match what is in the Op mode code. Scroll down to see more devices if there are any.");
+ var2.setPositiveButton("Ok", FtcConfigurationActivity.this.a);
+ AlertDialog var4 = var2.create();
+ var4.show();
+ ((TextView) var4.findViewById(R.id.writeXML_text)).setTextSize(14.0F);
+ }
+ });
+ this.findViewById(R.id.save_holder).findViewById(R.id.info_btn).setOnClickListener(new View.OnClickListener() {
+ public void onClick(View var1) {
+ Builder var2 = FtcConfigurationActivity.this.j.buildBuilder("Save Configuration", "Clicking the save button will create an xml file in: \n /sdcard/FIRST/ \nThis file will be used to initialize the robot.");
+ var2.setPositiveButton("Ok", FtcConfigurationActivity.this.a);
+ AlertDialog var4 = var2.create();
+ var4.show();
+ ((TextView) var4.findViewById(R.id.writeXML_text)).setTextSize(14.0F);
+ }
+ });
+ }
+
+ private void a(String var1) {
+ String var2 = "Found " + var1;
+ this.j.setOrangeText(var2, "Please fix and re-save.", R.id.warning_layout, R.layout.orange_warning, R.id.orangetext0, R.id.orangetext1);
+ }
+
+ private void a(ArrayList var1) {
+ this.e = new HashMap();
+ Iterator var2 = var1.iterator();
+
+ while(var2.hasNext()) {
+ ControllerConfiguration var3 = (ControllerConfiguration)var2.next();
+ this.e.put(var3.getSerialNumber(), var3);
+ }
+
+ }
+
+ private HashMap b() {
+ HashMap var1 = new HashMap();
+ Iterator> var2 = this.scannedEntries.iterator();
+
+ while(var2.hasNext()) {
+ Entry var3 = var2.next();
+ SerialNumber var4 = (SerialNumber)var3.getKey();
+ if(this.e.containsKey(var4)) {
+ var1.put(var4, this.e.get(var4));
+ } else {
+ switch (((DeviceManager.DeviceType) var3.getValue()).ordinal()) {
+ case 1:
+ var1.put(var4, this.j.buildMotorController(var4));
+ break;
+ case 2:
+ var1.put(var4, this.j.buildServoController(var4));
+ break;
+ case 3:
+ var1.put(var4, this.j.buildLegacyModule(var4));
+ break;
+ case 4:
+ var1.put(var4, this.j.buildDeviceInterfaceModule(var4));
+ }
+ }
+ }
+
+ return var1;
+ }
+
+ private void c() {
+ if(this.i.toLowerCase().contains("Unsaved".toLowerCase())) {
+ EditText var1 = new EditText(this.f);
+ var1.setEnabled(false);
+ var1.setText("");
+ Builder var2 = this.j.buildBuilder("Unsaved changes", "If you scan, your current unsaved changes will be lost.");
+ var2.setView(var1);
+ var2.setPositiveButton("Ok", new OnClickListener() {
+ public void onClick(DialogInterface var1, int var2) {
+ FtcConfigurationActivity.this.d.start();
+ }
+ });
+ var2.setNegativeButton("Cancel", this.c);
+ var2.show();
+ } else {
+ this.d.start();
+ }
+ }
+
+ private void d() {
+ ReadXMLFileHandler var1 = new ReadXMLFileHandler(this.f);
+ if(!this.i.equalsIgnoreCase("No current file!")) {
+ try {
+ this.a((ArrayList)var1.parse(new FileInputStream(Utility.CONFIG_FILES_DIR + this.i + ".xml")));
+ this.h();
+ this.f();
+ } catch (RobotCoreException var4) {
+ RobotLog.e("Error parsing XML file");
+ RobotLog.logStacktrace(var4);
+ this.j.complainToast("Error parsing XML file: " + this.i, this.f);
+ } catch (FileNotFoundException var5) {
+ DbgLog.error("File was not found: " + this.i);
+ DbgLog.logStacktrace(var5);
+ this.j.complainToast("That file was not found: " + this.i, this.f);
+ }
+ }
+ }
+
+ private void e() {
+ if(this.e.size() == 0) {
+ this.j.setOrangeText("Scan to find devices.", "In order to find devices: \n 1. Attach a robot \n 2. Press the \'Scan\' button", R.id.empty_devicelist, R.layout.orange_warning, R.id.orangetext0, R.id.orangetext1);
+ this.g();
+ } else {
+ LinearLayout var1 = (LinearLayout)this.findViewById(R.id.empty_devicelist);
+ var1.removeAllViews();
+ var1.setVisibility(View.GONE);
+ }
+ }
+
+ private void f() {
+ if(this.e.size() == 0) {
+ this.j.setOrangeText("No devices found!", "In order to find devices: \n 1. Attach a robot \n 2. Press the \'Scan\' button", R.id.empty_devicelist, R.layout.orange_warning, R.id.orangetext0, R.id.orangetext1);
+ this.g();
+ } else {
+ LinearLayout var1 = (LinearLayout)this.findViewById(R.id.empty_devicelist);
+ var1.removeAllViews();
+ var1.setVisibility(View.GONE);
+ }
+ }
+
+ private void g() {
+ LinearLayout var1 = (LinearLayout)this.findViewById(R.id.warning_layout);
+ var1.removeAllViews();
+ var1.setVisibility(View.GONE);
+ }
+
+ private void h() {
+ ListView var1 = (ListView)this.findViewById(R.id.controllersList);
+ var1.setAdapter(new DeviceInfoAdapter(this, 17367044, this.e));
+ var1.setOnItemClickListener(new OnItemClickListener() {
+ public void onItemClick(AdapterView> var1, View var2, int var3, long var4) {
+ ControllerConfiguration var6 = (ControllerConfiguration)var1.getItemAtPosition(var3);
+ DeviceConfiguration.ConfigurationType var7 = var6.getType();
+ if(var7.equals(DeviceConfiguration.ConfigurationType.MOTOR_CONTROLLER)) {
+ Intent var8 = new Intent(FtcConfigurationActivity.this.f, EditMotorControllerActivity.class);
+ var8.putExtra("EDIT_MOTOR_CONTROLLER_CONFIG", var6);
+ var8.putExtra("requestCode", 1);
+ FtcConfigurationActivity.this.setResult(-1, var8);
+ FtcConfigurationActivity.this.startActivityForResult(var8, 1);
+ }
+
+ if(var7.equals(DeviceConfiguration.ConfigurationType.SERVO_CONTROLLER)) {
+ Intent var11 = new Intent(FtcConfigurationActivity.this.f, EditServoControllerActivity.class);
+ var11.putExtra("Edit Servo ControllerConfiguration Activity", var6);
+ var11.putExtra("requestCode", 2);
+ FtcConfigurationActivity.this.setResult(-1, var11);
+ FtcConfigurationActivity.this.startActivityForResult(var11, 2);
+ }
+
+ if(var7.equals(DeviceConfiguration.ConfigurationType.LEGACY_MODULE_CONTROLLER)) {
+ Intent var14 = new Intent(FtcConfigurationActivity.this.f, EditLegacyModuleControllerActivity.class);
+ var14.putExtra("EDIT_LEGACY_CONFIG", var6);
+ var14.putExtra("requestCode", 3);
+ FtcConfigurationActivity.this.setResult(-1, var14);
+ FtcConfigurationActivity.this.startActivityForResult(var14, 3);
+ }
+
+ if(var7.equals(DeviceConfiguration.ConfigurationType.DEVICE_INTERFACE_MODULE)) {
+ Intent var17 = new Intent(FtcConfigurationActivity.this.f, EditDeviceInterfaceModuleActivity.class);
+ var17.putExtra("EDIT_DEVICE_INTERFACE_MODULE_CONFIG", var6);
+ var17.putExtra("requestCode", 4);
+ FtcConfigurationActivity.this.setResult(-1, var17);
+ FtcConfigurationActivity.this.startActivityForResult(var17, 4);
+ }
+
+ }
+ });
+ }
+
+ private void i() {
+ if(!this.i.toLowerCase().contains("Unsaved".toLowerCase())) {
+ String var1 = "Unsaved " + this.i;
+ this.j.saveToPreferences(var1, R.string.pref_hardware_config_filename);
+ this.i = var1;
+ }
+
+ }
+
+ protected void onActivityResult(int var1, int var2, Intent var3) {
+ if(var2 != 0) {
+ Serializable var4;
+ if(var1 == 1) {
+ var4 = var3.getSerializableExtra("EDIT_MOTOR_CONTROLLER_CONFIG");
+ } else if(var1 == 2) {
+ var4 = var3.getSerializableExtra("Edit Servo ControllerConfiguration Activity");
+ } else if(var1 == 3) {
+ var4 = var3.getSerializableExtra("EDIT_LEGACY_CONFIG");
+ } else {
+ var4 = null;
+ if(var1 == 4) {
+ var4 = var3.getSerializableExtra("EDIT_DEVICE_INTERFACE_MODULE_CONFIG");
+ }
+ }
+
+ if(var4 != null) {
+ ControllerConfiguration var5 = (ControllerConfiguration)var4;
+ this.scannedDevices.put(var5.getSerialNumber(), var5.configTypeToDeviceType(var5.getType()));
+ this.e.put(var5.getSerialNumber(), var5);
+ this.h();
+ this.i();
+ } else {
+ DbgLog.error("Received Result with an incorrect request code: " + String.valueOf(var1));
+ }
+ }
+ }
+
+ public void onBackPressed() {
+ if(this.i.toLowerCase().contains("Unsaved".toLowerCase())) {
+ if(!this.j.writeXML(this.e)) {
+ final EditText var1 = new EditText(this);
+ var1.setText(this.j.prepareFilename(this.i));
+ Builder var2 = this.j.buildBuilder("Unsaved changes", "Please save your file before exiting the Hardware Wizard! \n If you click \'Cancel\' your changes will be lost.");
+ var2.setView(var1);
+ var2.setPositiveButton("Ok", new OnClickListener() {
+ public void onClick(DialogInterface var1x, int var2) {
+ String var3 = (var1.getText().toString() + ".xml").trim();
+ if(var3.equals(".xml")) {
+ FtcConfigurationActivity.this.j.complainToast("File not saved: Please entire a filename.", FtcConfigurationActivity.this.f);
+ } else {
+ try {
+ FtcConfigurationActivity.this.j.writeToFile(var3);
+ } catch (RobotCoreException var6) {
+ FtcConfigurationActivity.this.j.complainToast(var6.getMessage(), FtcConfigurationActivity.this.f);
+ DbgLog.error(var6.getMessage());
+ return;
+ } catch (IOException var7) {
+ FtcConfigurationActivity.this.a(var7.getMessage());
+ DbgLog.error(var7.getMessage());
+ return;
+ }
+
+ FtcConfigurationActivity.this.g();
+ FtcConfigurationActivity.this.j.saveToPreferences(var1.getText().toString(), R.string.pref_hardware_config_filename);
+ FtcConfigurationActivity.this.i = var1.getText().toString();
+ FtcConfigurationActivity.this.j.updateHeader("robot_config", R.string.pref_hardware_config_filename, R.id.active_filename, R.id.included_header);
+ FtcConfigurationActivity.this.j.confirmSave();
+ FtcConfigurationActivity.this.finish();
+ }
+ }
+ });
+ var2.setNegativeButton("Cancel", this.b);
+ var2.show();
+ }
+ } else {
+ super.onBackPressed();
+ }
+ }
+
+ protected void onCreate(Bundle var1) {
+ super.onCreate(var1);
+ this.setContentView(R.layout.activity_ftc_configuration);
+ RobotLog.writeLogcatToDisk(this, 1024);
+ this.f = this;
+ this.j = new Utility(this);
+ this.h = (Button)this.findViewById(R.id.scanButton);
+ this.a();
+
+ try {
+ this.g = new ModernRoboticsDeviceManager(this.f, null);
+ } catch (RobotCoreException var3) {
+ this.j.complainToast("Failed to open the Device Manager", this.f);
+ DbgLog.error("Failed to open deviceManager: " + var3.toString());
+ DbgLog.logStacktrace(var3);
+ }
+
+ this.preferences = PreferenceManager.getDefaultSharedPreferences(this);
+ }
+
+ protected void onDestroy() {
+ super.onDestroy();
+ this.j.resetCount();
+ }
+
+ protected void onStart() {
+ super.onStart();
+ this.i = this.j.getFilenameFromPrefs(R.string.pref_hardware_config_filename, "No current file!");
+ if(this.i.equalsIgnoreCase("No current file!")) {
+ this.j.createConfigFolder();
+ }
+
+ this.j.updateHeader("No current file!", R.string.pref_hardware_config_filename, R.id.active_filename, R.id.included_header);
+ this.e();
+ if(!this.i.toLowerCase().contains("Unsaved".toLowerCase())) {
+ this.d();
+ }
+
+ this.h.setOnClickListener(new View.OnClickListener() {
+ public void onClick(View var1) {
+ FtcConfigurationActivity.this.d = new Thread(new Runnable() {
+ public void run() {
+ try {
+ DbgLog.msg("Scanning USB bus");
+ FtcConfigurationActivity.this.scannedDevices = FtcConfigurationActivity.this.g.scanForUsbDevices();
+ } catch (RobotCoreException var2) {
+ DbgLog.error("Device scan failed: " + var2.toString());
+ }
+
+ FtcConfigurationActivity.this.runOnUiThread(new Runnable() {
+ public void run() {
+ FtcConfigurationActivity.this.j.resetCount();
+ FtcConfigurationActivity.this.g();
+ FtcConfigurationActivity.this.i();
+ FtcConfigurationActivity.this.j.updateHeader(FtcConfigurationActivity.this.i, R.string.pref_hardware_config_filename, R.id.active_filename, R.id.included_header);
+ FtcConfigurationActivity.this.scannedEntries = FtcConfigurationActivity.this.scannedDevices.entrySet();
+ FtcConfigurationActivity.this.e = FtcConfigurationActivity.this.b();
+ FtcConfigurationActivity.this.h();
+ FtcConfigurationActivity.this.f();
+ }
+ });
+ }
+ });
+ FtcConfigurationActivity.this.c();
+ }
+ });
+ }
+
+ public void saveConfiguration(View var1) {
+ if(!this.j.writeXML(this.e)) {
+ final EditText var2 = new EditText(this);
+ var2.setText(this.j.prepareFilename(this.i));
+ Builder var3 = this.j.buildBuilder("Enter file name", "Please enter the file name");
+ var3.setView(var2);
+ var3.setPositiveButton("Ok", new OnClickListener() {
+ public void onClick(DialogInterface var1, int var2x) {
+ String var3 = (var2.getText().toString() + ".xml").trim();
+ if(var3.equals(".xml")) {
+ FtcConfigurationActivity.this.j.complainToast("File not saved: Please entire a filename.", FtcConfigurationActivity.this.f);
+ } else {
+ try {
+ FtcConfigurationActivity.this.j.writeToFile(var3);
+ } catch (RobotCoreException var6) {
+ FtcConfigurationActivity.this.j.complainToast(var6.getMessage(), FtcConfigurationActivity.this.f);
+ DbgLog.error(var6.getMessage());
+ return;
+ } catch (IOException var7) {
+ FtcConfigurationActivity.this.a(var7.getMessage());
+ DbgLog.error(var7.getMessage());
+ return;
+ }
+
+ FtcConfigurationActivity.this.g();
+ FtcConfigurationActivity.this.j.saveToPreferences(var2.getText().toString(), R.string.pref_hardware_config_filename);
+ FtcConfigurationActivity.this.i = var2.getText().toString();
+ FtcConfigurationActivity.this.j.updateHeader("robot_config", R.string.pref_hardware_config_filename, R.id.active_filename, R.id.included_header);
+ FtcConfigurationActivity.this.j.confirmSave();
+ }
+ }
+ });
+ var3.setNegativeButton("Cancel", this.c);
+ var3.show();
+ }
+ }
+}
diff --git a/FtcRobotController/app/src/main/java/com/qualcomm/ftccommon/configuration/FtcLoadFileActivity.java b/FtcRobotController/FtcCommon/src/main/java/com/qualcomm/ftccommon/configuration/FtcLoadFileActivity.java
similarity index 92%
rename from FtcRobotController/app/src/main/java/com/qualcomm/ftccommon/configuration/FtcLoadFileActivity.java
rename to FtcRobotController/FtcCommon/src/main/java/com/qualcomm/ftccommon/configuration/FtcLoadFileActivity.java
index e855688..c381f2d 100644
--- a/FtcRobotController/app/src/main/java/com/qualcomm/ftccommon/configuration/FtcLoadFileActivity.java
+++ b/FtcRobotController/FtcCommon/src/main/java/com/qualcomm/ftccommon/configuration/FtcLoadFileActivity.java
@@ -1,151 +1,151 @@
-package com.qualcomm.ftccommon.configuration;
-
-import android.app.Activity;
-import android.app.AlertDialog;
-import android.app.AlertDialog.Builder;
-import android.content.Context;
-import android.content.DialogInterface;
-import android.content.Intent;
-import android.content.DialogInterface.OnClickListener;
-import android.os.Bundle;
-import android.view.LayoutInflater;
-import android.view.View;
-import android.view.ViewGroup;
-import android.widget.Button;
-import android.widget.LinearLayout;
-import android.widget.TextView;
-import com.qualcomm.ftccommon.DbgLog;
-import com.qualcomm.ftccommon.R;
-import com.qualcomm.ftccommon.configuration.AutoConfigureActivity;
-import com.qualcomm.ftccommon.configuration.FtcConfigurationActivity;
-import com.qualcomm.robotcore.hardware.configuration.Utility;
-import java.io.File;
-import java.util.ArrayList;
-import java.util.Iterator;
-
-public class FtcLoadFileActivity extends Activity {
- public static final String CONFIGURE_FILENAME = "CONFIGURE_FILENAME";
- OnClickListener a = new OnClickListener() {
- public void onClick(DialogInterface var1, int var2) {
- }
- };
- private ArrayList b = new ArrayList();
- private Context c;
- private Utility d;
-
- private String a(View var1, boolean var2) {
- String var3 = ((TextView)((LinearLayout)((LinearLayout)var1.getParent()).getParent()).findViewById(R.id.filename_editText)).getText().toString();
- if(var2) {
- var3 = var3 + ".xml";
- }
-
- return var3;
- }
-
- private void a() {
- ((Button)this.findViewById(R.id.files_holder).findViewById(R.id.info_btn)).setOnClickListener(new android.view.View.OnClickListener() {
- public void onClick(View var1) {
- Builder var2 = FtcLoadFileActivity.this.d.buildBuilder("Available files", "These are the files the Hardware Wizard was able to find. You can edit each file by clicking the edit button. The \'Activate\' button will set that file as the current configuration file, which will be used to start the robot.");
- var2.setPositiveButton("Ok", FtcLoadFileActivity.this.a);
- AlertDialog var4 = var2.create();
- var4.show();
- ((TextView)var4.findViewById(16908299)).setTextSize(14.0F);
- }
- });
- ((Button)this.findViewById(R.id.autoconfigure_holder).findViewById(R.id.info_btn)).setOnClickListener(new android.view.View.OnClickListener() {
- public void onClick(View var1) {
- Builder var2 = FtcLoadFileActivity.this.d.buildBuilder("AutoConfigure", "This is the fastest way to get a new machine up and running. The AutoConfigure tool will automatically enter some default names for devices. AutoConfigure expects certain devices. If there are other devices attached, the AutoConfigure tool will not name them.");
- var2.setPositiveButton("Ok", FtcLoadFileActivity.this.a);
- AlertDialog var4 = var2.create();
- var4.show();
- ((TextView)var4.findViewById(16908299)).setTextSize(14.0F);
- }
- });
- }
-
- private void b() {
- if(this.b.size() == 0) {
- this.d.setOrangeText("No files found!", "In order to proceed, you must create a new file", R.id.empty_filelist, R.layout.orange_warning, R.id.orangetext0, R.id.orangetext1);
- } else {
- ViewGroup var1 = (ViewGroup)this.findViewById(R.id.empty_filelist);
- var1.removeAllViews();
- var1.setVisibility(8);
- }
- }
-
- private void c() {
- ViewGroup var1 = (ViewGroup)this.findViewById(R.id.inclusionlayout);
- var1.removeAllViews();
- Iterator var2 = this.b.iterator();
-
- while(var2.hasNext()) {
- String var3 = (String)var2.next();
- View var4 = LayoutInflater.from(this).inflate(R.layout.file_info, (ViewGroup)null);
- var1.addView(var4);
- ((TextView)var4.findViewById(R.id.filename_editText)).setText(var3);
- }
-
- }
-
- public void file_activate_button(View var1) {
- String var2 = this.a(var1, false);
- this.d.saveToPreferences(var2, R.string.pref_hardware_config_filename);
- this.d.updateHeader("No current file!", R.string.pref_hardware_config_filename, R.id.active_filename, R.id.included_header);
- }
-
- public void file_delete_button(View var1) {
- String var2 = this.a(var1, true);
- File var3 = new File(Utility.CONFIG_FILES_DIR + var2);
- if(var3.exists()) {
- var3.delete();
- } else {
- this.d.complainToast("That file does not exist: " + var2, this.c);
- DbgLog.error("Tried to delete a file that does not exist: " + var2);
- }
-
- this.b = this.d.getXMLFiles();
- this.d.saveToPreferences("No current file!", R.string.pref_hardware_config_filename);
- this.d.updateHeader("No current file!", R.string.pref_hardware_config_filename, R.id.active_filename, R.id.included_header);
- this.c();
- }
-
- public void file_edit_button(View var1) {
- String var2 = this.a(var1, true);
- this.d.saveToPreferences(var2, R.string.pref_hardware_config_filename);
- this.startActivity(new Intent(this.c, FtcConfigurationActivity.class));
- }
-
- public void launch_autoConfigure(View var1) {
- this.startActivity(new Intent(this.getBaseContext(), AutoConfigureActivity.class));
- }
-
- public void new_button(View var1) {
- this.d.saveToPreferences("No current file!", R.string.pref_hardware_config_filename);
- this.startActivity(new Intent(this.c, FtcConfigurationActivity.class));
- }
-
- public void onBackPressed() {
- String var1 = this.d.getFilenameFromPrefs(R.string.pref_hardware_config_filename, "No current file!");
- Intent var2 = new Intent();
- var2.putExtra("CONFIGURE_FILENAME", var1);
- this.setResult(-1, var2);
- this.finish();
- }
-
- protected void onCreate(Bundle var1) {
- super.onCreate(var1);
- this.setContentView(R.layout.activity_load);
- this.c = this;
- this.d = new Utility(this);
- this.d.createConfigFolder();
- this.a();
- }
-
- protected void onStart() {
- super.onStart();
- this.b = this.d.getXMLFiles();
- this.b();
- this.d.updateHeader("No current file!", R.string.pref_hardware_config_filename, R.id.active_filename, R.id.included_header);
- this.c();
- }
-}
+package com.qualcomm.ftccommon.configuration;
+
+import android.app.Activity;
+import android.app.AlertDialog;
+import android.app.AlertDialog.Builder;
+import android.content.Context;
+import android.content.DialogInterface;
+import android.content.DialogInterface.OnClickListener;
+import android.content.Intent;
+import android.os.Bundle;
+import android.view.LayoutInflater;
+import android.view.View;
+import android.view.ViewGroup;
+import android.widget.Button;
+import android.widget.LinearLayout;
+import android.widget.TextView;
+
+import com.qualcomm.ftccommon.DbgLog;
+import com.qualcomm.ftccommon.R;
+import com.qualcomm.robotcore.hardware.configuration.Utility;
+
+import java.io.File;
+import java.util.ArrayList;
+import java.util.Iterator;
+
+public class FtcLoadFileActivity extends Activity {
+ public static final String CONFIGURE_FILENAME = "CONFIGURE_FILENAME";
+ OnClickListener a = new OnClickListener() {
+ public void onClick(DialogInterface var1, int var2) {
+ }
+ };
+ private ArrayList b = new ArrayList();
+ private Context c;
+ private Utility d;
+
+ private String a(View var1, boolean var2) {
+ String var3 = ((TextView)((LinearLayout)((LinearLayout)var1.getParent()).getParent()).findViewById(R.id.filename_editText)).getText().toString();
+ if(var2) {
+ var3 = var3 + ".xml";
+ }
+
+ return var3;
+ }
+
+ private void a() {
+ ((Button)this.findViewById(R.id.files_holder).findViewById(R.id.info_btn)).setOnClickListener(new View.OnClickListener() {
+ public void onClick(View var1) {
+ Builder var2 = FtcLoadFileActivity.this.d.buildBuilder("Available files", "These are the files the Hardware Wizard was able to find. You can edit each file by clicking the edit button. The \'Activate\' button will set that file as the current configuration file, which will be used to start the robot.");
+ var2.setPositiveButton("Ok", FtcLoadFileActivity.this.a);
+ AlertDialog var4 = var2.create();
+ var4.show();
+ ((TextView)var4.findViewById(16908299)).setTextSize(14.0F);
+ }
+ });
+ ((Button)this.findViewById(R.id.autoconfigure_holder).findViewById(R.id.info_btn)).setOnClickListener(new View.OnClickListener() {
+ public void onClick(View var1) {
+ Builder var2 = FtcLoadFileActivity.this.d.buildBuilder("AutoConfigure", "This is the fastest way to get a new machine up and running. The AutoConfigure tool will automatically enter some default names for devices. AutoConfigure expects certain devices. If there are other devices attached, the AutoConfigure tool will not name them.");
+ var2.setPositiveButton("Ok", FtcLoadFileActivity.this.a);
+ AlertDialog var4 = var2.create();
+ var4.show();
+ ((TextView)var4.findViewById(16908299)).setTextSize(14.0F);
+ }
+ });
+ }
+
+ private void b() {
+ if(this.b.size() == 0) {
+ this.d.setOrangeText("No files found!", "In order to proceed, you must create a new file", R.id.empty_filelist, R.layout.orange_warning, R.id.orangetext0, R.id.orangetext1);
+ } else {
+ ViewGroup var1 = (ViewGroup)this.findViewById(R.id.empty_filelist);
+ var1.removeAllViews();
+ var1.setVisibility(8);
+ }
+ }
+
+ private void c() {
+ ViewGroup var1 = (ViewGroup)this.findViewById(R.id.inclusionlayout);
+ var1.removeAllViews();
+ Iterator var2 = this.b.iterator();
+
+ while(var2.hasNext()) {
+ String var3 = (String)var2.next();
+ View var4 = LayoutInflater.from(this).inflate(R.layout.file_info, (ViewGroup)null);
+ var1.addView(var4);
+ ((TextView)var4.findViewById(R.id.filename_editText)).setText(var3);
+ }
+
+ }
+
+ public void file_activate_button(View var1) {
+ String var2 = this.a(var1, false);
+ this.d.saveToPreferences(var2, R.string.pref_hardware_config_filename);
+ this.d.updateHeader("No current file!", R.string.pref_hardware_config_filename, R.id.active_filename, R.id.included_header);
+ }
+
+ public void file_delete_button(View var1) {
+ String var2 = this.a(var1, true);
+ File var3 = new File(Utility.CONFIG_FILES_DIR + var2);
+ if(var3.exists()) {
+ var3.delete();
+ } else {
+ this.d.complainToast("That file does not exist: " + var2, this.c);
+ DbgLog.error("Tried to delete a file that does not exist: " + var2);
+ }
+
+ this.b = this.d.getXMLFiles();
+ this.d.saveToPreferences("No current file!", R.string.pref_hardware_config_filename);
+ this.d.updateHeader("No current file!", R.string.pref_hardware_config_filename, R.id.active_filename, R.id.included_header);
+ this.c();
+ }
+
+ public void file_edit_button(View var1) {
+ String var2 = this.a(var1, true);
+ this.d.saveToPreferences(var2, R.string.pref_hardware_config_filename);
+ this.startActivity(new Intent(this.c, FtcConfigurationActivity.class));
+ }
+
+ public void launch_autoConfigure(View var1) {
+ this.startActivity(new Intent(this.getBaseContext(), AutoConfigureActivity.class));
+ }
+
+ public void new_button(View var1) {
+ this.d.saveToPreferences("No current file!", R.string.pref_hardware_config_filename);
+ this.startActivity(new Intent(this.c, FtcConfigurationActivity.class));
+ }
+
+ public void onBackPressed() {
+ String var1 = this.d.getFilenameFromPrefs(R.string.pref_hardware_config_filename, "No current file!");
+ Intent var2 = new Intent();
+ var2.putExtra("CONFIGURE_FILENAME", var1);
+ this.setResult(-1, var2);
+ this.finish();
+ }
+
+ protected void onCreate(Bundle var1) {
+ super.onCreate(var1);
+ this.setContentView(R.layout.activity_load);
+ this.c = this;
+ this.d = new Utility(this);
+ this.d.createConfigFolder();
+ this.a();
+ }
+
+ protected void onStart() {
+ super.onStart();
+ this.b = this.d.getXMLFiles();
+ this.b();
+ this.d.updateHeader("No current file!", R.string.pref_hardware_config_filename, R.id.active_filename, R.id.included_header);
+ this.c();
+ }
+}
diff --git a/FtcRobotController/FtcCommon/src/main/res/drawable/lib_button_shape.xml b/FtcRobotController/FtcCommon/src/main/res/drawable/lib_button_shape.xml
new file mode 100644
index 0000000..0e2568b
--- /dev/null
+++ b/FtcRobotController/FtcCommon/src/main/res/drawable/lib_button_shape.xml
@@ -0,0 +1,19 @@
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/FtcRobotController/FtcCommon/src/main/res/layout/about.xml b/FtcRobotController/FtcCommon/src/main/res/layout/about.xml
new file mode 100644
index 0000000..18bc2d1
--- /dev/null
+++ b/FtcRobotController/FtcCommon/src/main/res/layout/about.xml
@@ -0,0 +1,11 @@
+
+
+
+
+
\ No newline at end of file
diff --git a/FtcRobotController/FtcCommon/src/main/res/layout/activity_autoconfigure.xml b/FtcRobotController/FtcCommon/src/main/res/layout/activity_autoconfigure.xml
new file mode 100644
index 0000000..a7218dc
--- /dev/null
+++ b/FtcRobotController/FtcCommon/src/main/res/layout/activity_autoconfigure.xml
@@ -0,0 +1,62 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/FtcRobotController/FtcCommon/src/main/res/layout/activity_config_wifi_direct.xml b/FtcRobotController/FtcCommon/src/main/res/layout/activity_config_wifi_direct.xml
new file mode 100644
index 0000000..b547f74
--- /dev/null
+++ b/FtcRobotController/FtcCommon/src/main/res/layout/activity_config_wifi_direct.xml
@@ -0,0 +1,19 @@
+
+
+
+
+
\ No newline at end of file
diff --git a/FtcRobotController/FtcCommon/src/main/res/layout/activity_ftc_configuration.xml b/FtcRobotController/FtcCommon/src/main/res/layout/activity_ftc_configuration.xml
new file mode 100644
index 0000000..bfc6c31
--- /dev/null
+++ b/FtcRobotController/FtcCommon/src/main/res/layout/activity_ftc_configuration.xml
@@ -0,0 +1,144 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/FtcRobotController/FtcCommon/src/main/res/layout/activity_ftc_wifi_channel_selector.xml b/FtcRobotController/FtcCommon/src/main/res/layout/activity_ftc_wifi_channel_selector.xml
new file mode 100644
index 0000000..d36e4a3
--- /dev/null
+++ b/FtcRobotController/FtcCommon/src/main/res/layout/activity_ftc_wifi_channel_selector.xml
@@ -0,0 +1,40 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/FtcRobotController/FtcCommon/src/main/res/layout/activity_load.xml b/FtcRobotController/FtcCommon/src/main/res/layout/activity_load.xml
new file mode 100644
index 0000000..a7959b0
--- /dev/null
+++ b/FtcRobotController/FtcCommon/src/main/res/layout/activity_load.xml
@@ -0,0 +1,114 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/FtcRobotController/FtcCommon/src/main/res/layout/activity_view_logs.xml b/FtcRobotController/FtcCommon/src/main/res/layout/activity_view_logs.xml
new file mode 100644
index 0000000..7b9f357
--- /dev/null
+++ b/FtcRobotController/FtcCommon/src/main/res/layout/activity_view_logs.xml
@@ -0,0 +1,22 @@
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/FtcRobotController/FtcCommon/src/main/res/layout/analog_input_device.xml b/FtcRobotController/FtcCommon/src/main/res/layout/analog_input_device.xml
new file mode 100644
index 0000000..1403787
--- /dev/null
+++ b/FtcRobotController/FtcCommon/src/main/res/layout/analog_input_device.xml
@@ -0,0 +1,50 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/FtcRobotController/FtcCommon/src/main/res/layout/analog_inputs.xml b/FtcRobotController/FtcCommon/src/main/res/layout/analog_inputs.xml
new file mode 100644
index 0000000..8d16616
--- /dev/null
+++ b/FtcRobotController/FtcCommon/src/main/res/layout/analog_inputs.xml
@@ -0,0 +1,152 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/FtcRobotController/FtcCommon/src/main/res/layout/analog_output_device.xml b/FtcRobotController/FtcCommon/src/main/res/layout/analog_output_device.xml
new file mode 100644
index 0000000..d80b3b0
--- /dev/null
+++ b/FtcRobotController/FtcCommon/src/main/res/layout/analog_output_device.xml
@@ -0,0 +1,50 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/FtcRobotController/FtcCommon/src/main/res/layout/analog_outputs.xml b/FtcRobotController/FtcCommon/src/main/res/layout/analog_outputs.xml
new file mode 100644
index 0000000..2707406
--- /dev/null
+++ b/FtcRobotController/FtcCommon/src/main/res/layout/analog_outputs.xml
@@ -0,0 +1,110 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/FtcRobotController/FtcCommon/src/main/res/layout/device_interface_module.xml b/FtcRobotController/FtcCommon/src/main/res/layout/device_interface_module.xml
new file mode 100644
index 0000000..e05290d
--- /dev/null
+++ b/FtcRobotController/FtcCommon/src/main/res/layout/device_interface_module.xml
@@ -0,0 +1,80 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/FtcRobotController/FtcCommon/src/main/res/layout/digital_device.xml b/FtcRobotController/FtcCommon/src/main/res/layout/digital_device.xml
new file mode 100644
index 0000000..3797ade
--- /dev/null
+++ b/FtcRobotController/FtcCommon/src/main/res/layout/digital_device.xml
@@ -0,0 +1,50 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/FtcRobotController/FtcCommon/src/main/res/layout/digital_devices.xml b/FtcRobotController/FtcCommon/src/main/res/layout/digital_devices.xml
new file mode 100644
index 0000000..ef702b6
--- /dev/null
+++ b/FtcRobotController/FtcCommon/src/main/res/layout/digital_devices.xml
@@ -0,0 +1,152 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/FtcRobotController/FtcCommon/src/main/res/layout/file_info.xml b/FtcRobotController/FtcCommon/src/main/res/layout/file_info.xml
new file mode 100644
index 0000000..925e745
--- /dev/null
+++ b/FtcRobotController/FtcCommon/src/main/res/layout/file_info.xml
@@ -0,0 +1,84 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/FtcRobotController/FtcCommon/src/main/res/layout/header.xml b/FtcRobotController/FtcCommon/src/main/res/layout/header.xml
new file mode 100644
index 0000000..876afd0
--- /dev/null
+++ b/FtcRobotController/FtcCommon/src/main/res/layout/header.xml
@@ -0,0 +1,29 @@
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/FtcRobotController/FtcCommon/src/main/res/layout/i2c_device.xml b/FtcRobotController/FtcCommon/src/main/res/layout/i2c_device.xml
new file mode 100644
index 0000000..503f919
--- /dev/null
+++ b/FtcRobotController/FtcCommon/src/main/res/layout/i2c_device.xml
@@ -0,0 +1,50 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/FtcRobotController/FtcCommon/src/main/res/layout/i2cs.xml b/FtcRobotController/FtcCommon/src/main/res/layout/i2cs.xml
new file mode 100644
index 0000000..63d620e
--- /dev/null
+++ b/FtcRobotController/FtcCommon/src/main/res/layout/i2cs.xml
@@ -0,0 +1,138 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/FtcRobotController/FtcCommon/src/main/res/layout/info_button.xml b/FtcRobotController/FtcCommon/src/main/res/layout/info_button.xml
new file mode 100644
index 0000000..2628423
--- /dev/null
+++ b/FtcRobotController/FtcCommon/src/main/res/layout/info_button.xml
@@ -0,0 +1,25 @@
+
+
+
+
+
\ No newline at end of file
diff --git a/FtcRobotController/FtcCommon/src/main/res/layout/legacy.xml b/FtcRobotController/FtcCommon/src/main/res/layout/legacy.xml
new file mode 100644
index 0000000..9e7a7d9
--- /dev/null
+++ b/FtcRobotController/FtcCommon/src/main/res/layout/legacy.xml
@@ -0,0 +1,317 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/FtcRobotController/FtcCommon/src/main/res/layout/matrices.xml b/FtcRobotController/FtcCommon/src/main/res/layout/matrices.xml
new file mode 100644
index 0000000..e77dbc2
--- /dev/null
+++ b/FtcRobotController/FtcCommon/src/main/res/layout/matrices.xml
@@ -0,0 +1,194 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/FtcRobotController/FtcCommon/src/main/res/layout/matrix_devices.xml b/FtcRobotController/FtcCommon/src/main/res/layout/matrix_devices.xml
new file mode 100644
index 0000000..b14abdd
--- /dev/null
+++ b/FtcRobotController/FtcCommon/src/main/res/layout/matrix_devices.xml
@@ -0,0 +1,45 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/FtcRobotController/FtcCommon/src/main/res/layout/motors.xml b/FtcRobotController/FtcCommon/src/main/res/layout/motors.xml
new file mode 100644
index 0000000..929f9c5
--- /dev/null
+++ b/FtcRobotController/FtcCommon/src/main/res/layout/motors.xml
@@ -0,0 +1,203 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/FtcRobotController/FtcCommon/src/main/res/layout/orange_warning.xml b/FtcRobotController/FtcCommon/src/main/res/layout/orange_warning.xml
new file mode 100644
index 0000000..a391464
--- /dev/null
+++ b/FtcRobotController/FtcCommon/src/main/res/layout/orange_warning.xml
@@ -0,0 +1,42 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/FtcRobotController/FtcCommon/src/main/res/layout/pwm_device.xml b/FtcRobotController/FtcCommon/src/main/res/layout/pwm_device.xml
new file mode 100644
index 0000000..7efc830
--- /dev/null
+++ b/FtcRobotController/FtcCommon/src/main/res/layout/pwm_device.xml
@@ -0,0 +1,45 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/FtcRobotController/FtcCommon/src/main/res/layout/pwms.xml b/FtcRobotController/FtcCommon/src/main/res/layout/pwms.xml
new file mode 100644
index 0000000..0288e38
--- /dev/null
+++ b/FtcRobotController/FtcCommon/src/main/res/layout/pwms.xml
@@ -0,0 +1,110 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/FtcRobotController/FtcCommon/src/main/res/layout/servo.xml b/FtcRobotController/FtcCommon/src/main/res/layout/servo.xml
new file mode 100644
index 0000000..8aa1701
--- /dev/null
+++ b/FtcRobotController/FtcCommon/src/main/res/layout/servo.xml
@@ -0,0 +1,45 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/FtcRobotController/FtcCommon/src/main/res/layout/servos.xml b/FtcRobotController/FtcCommon/src/main/res/layout/servos.xml
new file mode 100644
index 0000000..a9a4eaf
--- /dev/null
+++ b/FtcRobotController/FtcCommon/src/main/res/layout/servos.xml
@@ -0,0 +1,165 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/FtcRobotController/FtcCommon/src/main/res/layout/shape.xml b/FtcRobotController/FtcCommon/src/main/res/layout/shape.xml
new file mode 100644
index 0000000..68b3c7b
--- /dev/null
+++ b/FtcRobotController/FtcCommon/src/main/res/layout/shape.xml
@@ -0,0 +1,19 @@
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/FtcRobotController/FtcCommon/src/main/res/layout/simple_device.xml b/FtcRobotController/FtcCommon/src/main/res/layout/simple_device.xml
new file mode 100644
index 0000000..01faf1c
--- /dev/null
+++ b/FtcRobotController/FtcCommon/src/main/res/layout/simple_device.xml
@@ -0,0 +1,69 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/FtcRobotController/FtcCommon/src/main/res/values-sw720dp-land-v13/dimens.xml b/FtcRobotController/FtcCommon/src/main/res/values-sw720dp-land-v13/dimens.xml
new file mode 100644
index 0000000..3f11e48
--- /dev/null
+++ b/FtcRobotController/FtcCommon/src/main/res/values-sw720dp-land-v13/dimens.xml
@@ -0,0 +1,4 @@
+
+
+ 128.0dip
+
diff --git a/FtcRobotController/FtcCommon/src/main/res/values-v11/styles.xml b/FtcRobotController/FtcCommon/src/main/res/values-v11/styles.xml
new file mode 100644
index 0000000..8134c26
--- /dev/null
+++ b/FtcRobotController/FtcCommon/src/main/res/values-v11/styles.xml
@@ -0,0 +1,5 @@
+
+
+
+
+
diff --git a/FtcRobotController/FtcCommon/src/main/res/values-v14/styles.xml b/FtcRobotController/FtcCommon/src/main/res/values-v14/styles.xml
new file mode 100644
index 0000000..c1bfd63
--- /dev/null
+++ b/FtcRobotController/FtcCommon/src/main/res/values-v14/styles.xml
@@ -0,0 +1,5 @@
+
+
+
+
+
diff --git a/FtcRobotController/FtcCommon/src/main/res/values/arrays.xml b/FtcRobotController/FtcCommon/src/main/res/values/arrays.xml
new file mode 100644
index 0000000..f45bcf5
--- /dev/null
+++ b/FtcRobotController/FtcCommon/src/main/res/values/arrays.xml
@@ -0,0 +1,56 @@
+
+
+
+ - GYRO
+ - TOUCH_SENSOR
+ - COMPASS
+ - IR_SEEKER
+ - LIGHT_SENSOR
+ - ACCELEROMETER
+ - ULTRASONIC_SENSOR
+ - MOTOR_CONTROLLER
+ - SERVO_CONTROLLER
+ - TOUCH_SENSOR_MULTIPLEXER
+ - COLOR_SENSOR
+ - NOTHING
+
+
+ - NOTHING
+ - OPTICAL_DISTANCE_SENSOR
+ - ANALOG_INPUT
+
+
+ - NOTHING
+ - ANALOG_OUTPUT
+
+
+ - NOTHING
+ - TOUCH_SENSOR
+ - LED
+ - DIGITAL_DEVICE
+
+
+ - NOTHING
+ - IR_SEEKER_V3
+ - ADAFRUIT_COLOR_SENSOR
+ - COLOR_SENSOR
+ - I2C_DEVICE
+
+
+ - PWM Devices
+ - I2C Devices
+ - Analog Input Devices
+ - Digital Devices
+ - Analog Output Devices
+
+
+ - Auto - device selects channel
+ - 2.4GHz, Channel 1
+ - 2.4GHz, Channel 6
+ - 2.4GHz, Channel 11
+ - 5GHz, Channel 149
+ - 5GHz, Channel 153
+ - 5GHz, Channel 157
+ - 5GHz, Channel 161
+
+
diff --git a/FtcRobotController/FtcCommon/src/main/res/values/colors.xml b/FtcRobotController/FtcCommon/src/main/res/values/colors.xml
new file mode 100644
index 0000000..d2ce74d
--- /dev/null
+++ b/FtcRobotController/FtcCommon/src/main/res/values/colors.xml
@@ -0,0 +1,14 @@
+
+
+ #ff000000
+ #ff309ea4
+ #ffa6040e
+ #ffff0a19
+ #ff3f0206
+ #ffc1e2e4
+ #ff790e15
+ #ff4e0106
+ #00000000
+ #ffbf0510
+ #ffffffff
+
diff --git a/FtcRobotController/FtcCommon/src/main/res/values/dimens.xml b/FtcRobotController/FtcCommon/src/main/res/values/dimens.xml
new file mode 100644
index 0000000..8e936a9
--- /dev/null
+++ b/FtcRobotController/FtcCommon/src/main/res/values/dimens.xml
@@ -0,0 +1,5 @@
+
+
+ 16.0dip
+ 5.0dip
+
diff --git a/FtcRobotController/FtcCommon/src/main/res/values/strings.xml b/FtcRobotController/FtcCommon/src/main/res/values/strings.xml
new file mode 100644
index 0000000..1da9396
--- /dev/null
+++ b/FtcRobotController/FtcCommon/src/main/res/values/strings.xml
@@ -0,0 +1,115 @@
+
+
+ About
+ About
+ Configure Robot
+ Exit
+ Settings
+ View logs
+ Wifi Channel Selection
+ Add Motor Controller
+ Add Servo Controller
+ FTC Robot Controller
+ Attached
+ AutoConfigure
+ Press this button to use the AutoConfigure tool
+ AutoConfigure
+ Clear Logs
+ Cancel
+ Which sensor is attached?
+ Which sensor is attached?
+ Which sensor is attached?
+ Which sensor is attached?
+ Which sensor is attached?
+ Configure Robot
+ Configure Robot
+ Configure
+ 0
+ Device Info
+ Device Types
+ Done
+ Edit Analog Input Devices
+ Edit Analog Output Devices
+ Edit Controller
+ Edit Core Device Interface Module Controller
+ Edit Digital Devices
+ Edit I2c Devices
+ Edit Legacy Module Controller
+ Edit Matrix Controller
+ Edit Motor Controller
+ Edit Motor Controller
+ Edit PWM Devices
+ Edit Servo Controller
+ Activate
+ Delete
+ Edit
+ Choose Configuration File
+ Filename
+ Enter device name here
+ Device name
+ K9LegacyBot
+ K9USBBot
+ Launch WiFi Settings
+ Enter the name for this legacy module here
+ Load Configuration File
+ Matrix Controller
+ Enter the name for this matrix controller here
+ Motors
+ Matrix name
+ 1
+ 2
+ 3
+ 4
+ 1
+ 2
+ 3
+ 4
+ Servos
+ Motor Controller
+ Enter the name for this motor controller here
+ Enter motor name
+ Motor name
+ 1
+ 2
+ Enter name
+ Device name
+ OK
+ Port
+ Change Wifi Channel
+ Robot Configuration Settings
+ pref_hardware_config_filename
+ pref_launch_autoconfigure
+ pref_launch_configure
+ pref_launch_settings
+ Wifi Channel Selection
+ Select an XML file to instantiate a Robot from that file
+ Restart Robot
+ Restore Saved WiFi Settings
+ 0
+ 1
+ 2
+ 3
+ 4
+ 5
+ 6
+ Save
+ Save Configuration
+ Scan
+ Press this button to scan for attached devices
+ Servo Controller
+ Enter the name for this servo controller here
+ Servo name
+ Settings
+ Settings
+ Device type
+ Autoconfigure Robot
+ Configure Wifi Direct
+ Load Configuration File
+ View Logs
+ Wifi Channel Selection
+ View Logs
+ View logs
+ Please wait while we update the Wifi Direct settings on this device.
+ Select an XML file to instantiate a Robot from that file
+ Press this button to write the current configuration to an XML file
+
diff --git a/FtcRobotController/FtcCommon/src/main/res/values/styles.xml b/FtcRobotController/FtcCommon/src/main/res/values/styles.xml
new file mode 100644
index 0000000..42f3e32
--- /dev/null
+++ b/FtcRobotController/FtcCommon/src/main/res/values/styles.xml
@@ -0,0 +1,26 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/FtcRobotController/FtcCommon/src/main/res/xml/preferences.xml b/FtcRobotController/FtcCommon/src/main/res/xml/preferences.xml
new file mode 100644
index 0000000..2bf2130
--- /dev/null
+++ b/FtcRobotController/FtcCommon/src/main/res/xml/preferences.xml
@@ -0,0 +1,38 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/FtcRobotController/FtcCommon/src/test/java/com/qualcomm/ftccommon/ExampleUnitTest.java b/FtcRobotController/FtcCommon/src/test/java/com/qualcomm/ftccommon/ExampleUnitTest.java
new file mode 100644
index 0000000..5cb8a01
--- /dev/null
+++ b/FtcRobotController/FtcCommon/src/test/java/com/qualcomm/ftccommon/ExampleUnitTest.java
@@ -0,0 +1,15 @@
+package com.qualcomm.ftccommon;
+
+import org.junit.Test;
+
+import static org.junit.Assert.*;
+
+/**
+ * To work on unit tests, switch the Test Artifact in the Build Variants view.
+ */
+public class ExampleUnitTest {
+ @Test
+ public void addition_isCorrect() throws Exception {
+ assertEquals(4, 2 + 2);
+ }
+}
\ No newline at end of file
diff --git a/FtcRobotController/Hardware/.gitignore b/FtcRobotController/Hardware/.gitignore
new file mode 100644
index 0000000..796b96d
--- /dev/null
+++ b/FtcRobotController/Hardware/.gitignore
@@ -0,0 +1 @@
+/build
diff --git a/FtcRobotController/Hardware/Hardware.iml b/FtcRobotController/Hardware/Hardware.iml
new file mode 100644
index 0000000..4043bf0
--- /dev/null
+++ b/FtcRobotController/Hardware/Hardware.iml
@@ -0,0 +1,95 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ generateDebugAndroidTestSources
+ generateDebugSources
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/FtcRobotController/Hardware/build.gradle b/FtcRobotController/Hardware/build.gradle
new file mode 100644
index 0000000..b4b8649
--- /dev/null
+++ b/FtcRobotController/Hardware/build.gradle
@@ -0,0 +1,30 @@
+apply plugin: 'com.android.library'
+
+android {
+ compileSdkVersion 22
+ buildToolsVersion "23.0.1"
+
+ defaultConfig {
+ minSdkVersion 19
+ targetSdkVersion 23
+ versionCode 1
+ versionName "1.0"
+ }
+ buildTypes {
+ release {
+ minifyEnabled false
+ proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
+ }
+ }
+ compileOptions {
+ sourceCompatibility JavaVersion.VERSION_1_7
+ targetCompatibility JavaVersion.VERSION_1_7
+ }
+}
+
+dependencies {
+ compile fileTree(include: ['*.jar'], dir: 'libs')
+ testCompile 'junit:junit:4.12'
+ compile project(':robotcore')
+ compile project(':ModernRobotics')
+}
diff --git a/FtcRobotController/Hardware/proguard-rules.pro b/FtcRobotController/Hardware/proguard-rules.pro
new file mode 100644
index 0000000..db73af4
--- /dev/null
+++ b/FtcRobotController/Hardware/proguard-rules.pro
@@ -0,0 +1,17 @@
+# Add project specific ProGuard rules here.
+# By default, the flags in this file are appended to flags specified
+# in C:\Users\Public\Android\sdk/tools/proguard/proguard-android.txt
+# You can edit the include path and order by changing the proguardFiles
+# directive in build.gradle.
+#
+# For more details, see
+# http://developer.android.com/guide/developing/tools/proguard.html
+
+# Add any project specific keep options here:
+
+# If your project uses WebView with JS, uncomment the following
+# and specify the fully qualified class name to the JavaScript interface
+# class:
+#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
+# public *;
+#}
diff --git a/FtcRobotController/Hardware/src/androidTest/java/com/qualcomm/hardware/ApplicationTest.java b/FtcRobotController/Hardware/src/androidTest/java/com/qualcomm/hardware/ApplicationTest.java
new file mode 100644
index 0000000..afff1af
--- /dev/null
+++ b/FtcRobotController/Hardware/src/androidTest/java/com/qualcomm/hardware/ApplicationTest.java
@@ -0,0 +1,13 @@
+package com.qualcomm.hardware;
+
+import android.app.Application;
+import android.test.ApplicationTestCase;
+
+/**
+ * Testing Fundamentals
+ */
+public class ApplicationTest extends ApplicationTestCase {
+ public ApplicationTest() {
+ super(Application.class);
+ }
+}
\ No newline at end of file
diff --git a/FtcRobotController/Hardware/src/main/AndroidManifest.xml b/FtcRobotController/Hardware/src/main/AndroidManifest.xml
new file mode 100644
index 0000000..5161801
--- /dev/null
+++ b/FtcRobotController/Hardware/src/main/AndroidManifest.xml
@@ -0,0 +1,9 @@
+
+
+
+
+
+
+
diff --git a/FtcRobotController/app/src/main/java/com/qualcomm/hardware/AdafruitI2cColorSensor.java b/FtcRobotController/Hardware/src/main/java/com/qualcomm/hardware/AdafruitI2cColorSensor.java
similarity index 96%
rename from FtcRobotController/app/src/main/java/com/qualcomm/hardware/AdafruitI2cColorSensor.java
rename to FtcRobotController/Hardware/src/main/java/com/qualcomm/hardware/AdafruitI2cColorSensor.java
index 2fba50e..0906e14 100644
--- a/FtcRobotController/app/src/main/java/com/qualcomm/hardware/AdafruitI2cColorSensor.java
+++ b/FtcRobotController/Hardware/src/main/java/com/qualcomm/hardware/AdafruitI2cColorSensor.java
@@ -1,143 +1,145 @@
-package com.qualcomm.hardware;
-
-import android.graphics.Color;
-import com.qualcomm.robotcore.hardware.ColorSensor;
-import com.qualcomm.robotcore.hardware.DeviceInterfaceModule;
-import com.qualcomm.robotcore.hardware.I2cController;
-import java.util.concurrent.locks.Lock;
-
-public class AdafruitI2cColorSensor extends ColorSensor implements I2cController.I2cPortReadyCallback {
- public static final int ADDRESS_TCS34725_ENABLE = 0;
- public static final int I2C_ADDRESS_TCS34725 = 82;
- public static final int OFFSET_ALPHA_HIGH_BYTE = 5;
- public static final int OFFSET_ALPHA_LOW_BYTE = 4;
- public static final int OFFSET_BLUE_HIGH_BYTE = 11;
- public static final int OFFSET_BLUE_LOW_BYTE = 10;
- public static final int OFFSET_GREEN_HIGH_BYTE = 9;
- public static final int OFFSET_GREEN_LOW_BYTE = 8;
- public static final int OFFSET_RED_HIGH_BYTE = 7;
- public static final int OFFSET_RED_LOW_BYTE = 6;
- public static final int TCS34725_BDATAL = 26;
- public static final int TCS34725_CDATAL = 20;
- public static final int TCS34725_COMMAND_BIT = 128;
- public static final int TCS34725_ENABLE_AEN = 2;
- public static final int TCS34725_ENABLE_AIEN = 16;
- public static final int TCS34725_ENABLE_PON = 1;
- public static final int TCS34725_GDATAL = 24;
- public static final int TCS34725_ID = 18;
- public static final int TCS34725_RDATAL = 22;
- private final DeviceInterfaceModule a;
- private final byte[] b;
- private final Lock c;
- private final byte[] d;
- private final Lock e;
- private final int f;
- private boolean g = false;
- private boolean h = false;
-
- public AdafruitI2cColorSensor(DeviceInterfaceModule var1, int var2) {
- this.f = var2;
- this.a = var1;
- this.b = var1.getI2cReadCache(var2);
- this.c = var1.getI2cReadCacheLock(var2);
- this.d = var1.getI2cWriteCache(var2);
- this.e = var1.getI2cWriteCacheLock(var2);
- this.g = true;
- var1.registerForI2cPortReadyCallback(this, var2);
- }
-
- private int a(int var1, int var2) {
- boolean var8 = false;
-
- int var4;
- byte var5;
- try {
- var8 = true;
- this.c.lock();
- var4 = this.b[var1] << 8;
- var5 = this.b[var2];
- var8 = false;
- } finally {
- if(var8) {
- this.c.unlock();
- }
- }
-
- int var6 = var4 | var5 & 255;
- this.c.unlock();
- return var6;
- }
-
- private void a() {
- this.a.enableI2cReadMode(this.f, 82, 148, 8);
- this.a.writeI2cCacheToController(this.f);
- }
-
- private void b() {
- this.a.enableI2cWriteMode(this.f, 82, 128, 1);
-
- try {
- this.e.lock();
- this.d[4] = 3;
- } finally {
- this.e.unlock();
- }
-
- this.a.setI2cPortActionFlag(this.f);
- this.a.writeI2cCacheToController(this.f);
- }
-
- public int alpha() {
- return this.a(5, 4);
- }
-
- public int argb() {
- return Color.argb(this.alpha(), this.red(), this.green(), this.blue());
- }
-
- public int blue() {
- return this.a(11, 10);
- }
-
- public void close() {
- }
-
- public void enableLed(boolean var1) {
- throw new UnsupportedOperationException("enableLed is not implemented.");
- }
-
- public String getConnectionInfo() {
- return this.a.getConnectionInfo() + "; I2C port: " + this.f;
- }
-
- public String getDeviceName() {
- return "Adafruit I2C Color Sensor";
- }
-
- public int getVersion() {
- return 1;
- }
-
- public int green() {
- return this.a(9, 8);
- }
-
- public void portIsReady(int var1) {
- if(this.g) {
- this.b();
- this.g = false;
- this.h = true;
- } else if(this.h) {
- this.a();
- this.h = false;
- }
-
- this.a.readI2cCacheFromController(this.f);
- this.a.setI2cPortActionFlag(this.f);
- this.a.writeI2cPortFlagOnlyToController(this.f);
- }
-
- public int red() {
- return this.a(7, 6);
- }
-}
+package com.qualcomm.hardware;
+
+import android.graphics.Color;
+
+import com.qualcomm.robotcore.hardware.ColorSensor;
+import com.qualcomm.robotcore.hardware.DeviceInterfaceModule;
+import com.qualcomm.robotcore.hardware.I2cController;
+
+import java.util.concurrent.locks.Lock;
+
+public class AdafruitI2cColorSensor extends ColorSensor implements I2cController.I2cPortReadyCallback {
+ public static final int ADDRESS_TCS34725_ENABLE = 0;
+ public static final int I2C_ADDRESS_TCS34725 = 82;
+ public static final int OFFSET_ALPHA_HIGH_BYTE = 5;
+ public static final int OFFSET_ALPHA_LOW_BYTE = 4;
+ public static final int OFFSET_BLUE_HIGH_BYTE = 11;
+ public static final int OFFSET_BLUE_LOW_BYTE = 10;
+ public static final int OFFSET_GREEN_HIGH_BYTE = 9;
+ public static final int OFFSET_GREEN_LOW_BYTE = 8;
+ public static final int OFFSET_RED_HIGH_BYTE = 7;
+ public static final int OFFSET_RED_LOW_BYTE = 6;
+ public static final int TCS34725_BDATAL = 26;
+ public static final int TCS34725_CDATAL = 20;
+ public static final int TCS34725_COMMAND_BIT = 128;
+ public static final int TCS34725_ENABLE_AEN = 2;
+ public static final int TCS34725_ENABLE_AIEN = 16;
+ public static final int TCS34725_ENABLE_PON = 1;
+ public static final int TCS34725_GDATAL = 24;
+ public static final int TCS34725_ID = 18;
+ public static final int TCS34725_RDATAL = 22;
+ private final DeviceInterfaceModule a;
+ private final byte[] b;
+ private final Lock c;
+ private final byte[] d;
+ private final Lock e;
+ private final int f;
+ private boolean g = false;
+ private boolean h = false;
+
+ public AdafruitI2cColorSensor(DeviceInterfaceModule var1, int var2) {
+ this.f = var2;
+ this.a = var1;
+ this.b = var1.getI2cReadCache(var2);
+ this.c = var1.getI2cReadCacheLock(var2);
+ this.d = var1.getI2cWriteCache(var2);
+ this.e = var1.getI2cWriteCacheLock(var2);
+ this.g = true;
+ var1.registerForI2cPortReadyCallback(this, var2);
+ }
+
+ private int a(int var1, int var2) {
+ boolean var8 = false;
+
+ int var4;
+ byte var5;
+ try {
+ var8 = true;
+ this.c.lock();
+ var4 = this.b[var1] << 8;
+ var5 = this.b[var2];
+ var8 = false;
+ } finally {
+ if(var8) {
+ this.c.unlock();
+ }
+ }
+
+ int var6 = var4 | var5 & 255;
+ this.c.unlock();
+ return var6;
+ }
+
+ private void a() {
+ this.a.enableI2cReadMode(this.f, 82, 148, 8);
+ this.a.writeI2cCacheToController(this.f);
+ }
+
+ private void b() {
+ this.a.enableI2cWriteMode(this.f, 82, 128, 1);
+
+ try {
+ this.e.lock();
+ this.d[4] = 3;
+ } finally {
+ this.e.unlock();
+ }
+
+ this.a.setI2cPortActionFlag(this.f);
+ this.a.writeI2cCacheToController(this.f);
+ }
+
+ public int alpha() {
+ return this.a(5, 4);
+ }
+
+ public int argb() {
+ return Color.argb(this.alpha(), this.red(), this.green(), this.blue());
+ }
+
+ public int blue() {
+ return this.a(11, 10);
+ }
+
+ public void close() {
+ }
+
+ public void enableLed(boolean var1) {
+ throw new UnsupportedOperationException("enableLed is not implemented.");
+ }
+
+ public String getConnectionInfo() {
+ return this.a.getConnectionInfo() + "; I2C port: " + this.f;
+ }
+
+ public String getDeviceName() {
+ return "Adafruit I2C Color Sensor";
+ }
+
+ public int getVersion() {
+ return 1;
+ }
+
+ public int green() {
+ return this.a(9, 8);
+ }
+
+ public void portIsReady(int var1) {
+ if(this.g) {
+ this.b();
+ this.g = false;
+ this.h = true;
+ } else if(this.h) {
+ this.a();
+ this.h = false;
+ }
+
+ this.a.readI2cCacheFromController(this.f);
+ this.a.setI2cPortActionFlag(this.f);
+ this.a.writeI2cPortFlagOnlyToController(this.f);
+ }
+
+ public int red() {
+ return this.a(7, 6);
+ }
+}
diff --git a/FtcRobotController/app/src/main/java/com/qualcomm/hardware/HiTechnicNxtAccelerationSensor.java b/FtcRobotController/Hardware/src/main/java/com/qualcomm/hardware/HiTechnicNxtAccelerationSensor.java
similarity index 94%
rename from FtcRobotController/app/src/main/java/com/qualcomm/hardware/HiTechnicNxtAccelerationSensor.java
rename to FtcRobotController/Hardware/src/main/java/com/qualcomm/hardware/HiTechnicNxtAccelerationSensor.java
index 6378e47..74896f2 100644
--- a/FtcRobotController/app/src/main/java/com/qualcomm/hardware/HiTechnicNxtAccelerationSensor.java
+++ b/FtcRobotController/Hardware/src/main/java/com/qualcomm/hardware/HiTechnicNxtAccelerationSensor.java
@@ -1,70 +1,70 @@
-package com.qualcomm.hardware;
-
-import com.qualcomm.hardware.ModernRoboticsUsbLegacyModule;
-import com.qualcomm.robotcore.hardware.AccelerationSensor;
-import com.qualcomm.robotcore.hardware.I2cController;
-import java.util.concurrent.locks.Lock;
-
-public class HiTechnicNxtAccelerationSensor extends AccelerationSensor implements I2cController.I2cPortReadyCallback {
- public static final int ACCEL_LENGTH = 6;
- public static final int ADDRESS_ACCEL_START = 66;
- public static final byte I2C_ADDRESS = 2;
- private final ModernRoboticsUsbLegacyModule a;
- private final byte[] b;
- private final Lock c;
- private final int d;
-
- public HiTechnicNxtAccelerationSensor(ModernRoboticsUsbLegacyModule var1, int var2) {
- var1.enableI2cReadMode(var2, 2, 66, 6);
- this.a = var1;
- this.b = var1.getI2cReadCache(var2);
- this.c = var1.getI2cReadCacheLock(var2);
- this.d = var2;
- var1.registerForI2cPortReadyCallback(this, var2);
- }
-
- private double a(double var1, double var3) {
- return (var3 + 4.0D * var1) / 200.0D;
- }
-
- public void close() {
- }
-
- public AccelerationSensor.Acceleration getAcceleration() {
- AccelerationSensor.Acceleration var1 = new AccelerationSensor.Acceleration();
-
- try {
- this.c.lock();
- var1.x = this.a((double)this.b[4], (double)this.b[7]);
- var1.y = this.a((double)this.b[5], (double)this.b[8]);
- var1.z = this.a((double)this.b[6], (double)this.b[9]);
- } finally {
- this.c.unlock();
- }
-
- return var1;
- }
-
- public String getConnectionInfo() {
- return this.a.getConnectionInfo() + "; port " + this.d;
- }
-
- public String getDeviceName() {
- return "NXT Acceleration Sensor";
- }
-
- public int getVersion() {
- return 1;
- }
-
- public void portIsReady(int var1) {
- this.a.setI2cPortActionFlag(this.d);
- this.a.writeI2cPortFlagOnlyToController(this.d);
- this.a.readI2cCacheFromController(this.d);
- }
-
- public String status() {
- Object[] var1 = new Object[]{this.a.getSerialNumber().toString(), Integer.valueOf(this.d)};
- return String.format("NXT Acceleration Sensor, connected via device %s, port %d", var1);
- }
-}
+package com.qualcomm.hardware;
+
+import com.qualcomm.robotcore.hardware.AccelerationSensor;
+import com.qualcomm.robotcore.hardware.I2cController;
+
+import java.util.concurrent.locks.Lock;
+
+public class HiTechnicNxtAccelerationSensor extends AccelerationSensor implements I2cController.I2cPortReadyCallback {
+ public static final int ACCEL_LENGTH = 6;
+ public static final int ADDRESS_ACCEL_START = 66;
+ public static final byte I2C_ADDRESS = 2;
+ private final ModernRoboticsUsbLegacyModule a;
+ private final byte[] b;
+ private final Lock c;
+ private final int d;
+
+ public HiTechnicNxtAccelerationSensor(ModernRoboticsUsbLegacyModule var1, int var2) {
+ var1.enableI2cReadMode(var2, 2, 66, 6);
+ this.a = var1;
+ this.b = var1.getI2cReadCache(var2);
+ this.c = var1.getI2cReadCacheLock(var2);
+ this.d = var2;
+ var1.registerForI2cPortReadyCallback(this, var2);
+ }
+
+ private double a(double var1, double var3) {
+ return (var3 + 4.0D * var1) / 200.0D;
+ }
+
+ public void close() {
+ }
+
+ public AccelerationSensor.Acceleration getAcceleration() {
+ AccelerationSensor.Acceleration var1 = new AccelerationSensor.Acceleration();
+
+ try {
+ this.c.lock();
+ var1.x = this.a((double)this.b[4], (double)this.b[7]);
+ var1.y = this.a((double)this.b[5], (double)this.b[8]);
+ var1.z = this.a((double)this.b[6], (double)this.b[9]);
+ } finally {
+ this.c.unlock();
+ }
+
+ return var1;
+ }
+
+ public String getConnectionInfo() {
+ return this.a.getConnectionInfo() + "; port " + this.d;
+ }
+
+ public String getDeviceName() {
+ return "NXT Acceleration Sensor";
+ }
+
+ public int getVersion() {
+ return 1;
+ }
+
+ public void portIsReady(int var1) {
+ this.a.setI2cPortActionFlag(this.d);
+ this.a.writeI2cPortFlagOnlyToController(this.d);
+ this.a.readI2cCacheFromController(this.d);
+ }
+
+ public String status() {
+ Object[] var1 = new Object[]{this.a.getSerialNumber().toString(), Integer.valueOf(this.d)};
+ return String.format("NXT Acceleration Sensor, connected via device %s, port %d", var1);
+ }
+}
diff --git a/FtcRobotController/app/src/main/java/com/qualcomm/hardware/HiTechnicNxtColorSensor.java b/FtcRobotController/Hardware/src/main/java/com/qualcomm/hardware/HiTechnicNxtColorSensor.java
similarity index 84%
rename from FtcRobotController/app/src/main/java/com/qualcomm/hardware/HiTechnicNxtColorSensor.java
rename to FtcRobotController/Hardware/src/main/java/com/qualcomm/hardware/HiTechnicNxtColorSensor.java
index 0c5d16c..efb880e 100644
--- a/FtcRobotController/app/src/main/java/com/qualcomm/hardware/HiTechnicNxtColorSensor.java
+++ b/FtcRobotController/Hardware/src/main/java/com/qualcomm/hardware/HiTechnicNxtColorSensor.java
@@ -1,138 +1,140 @@
-package com.qualcomm.hardware;
-
-import android.graphics.Color;
-import com.qualcomm.robotcore.hardware.ColorSensor;
-import com.qualcomm.robotcore.hardware.I2cController;
-import com.qualcomm.robotcore.hardware.LegacyModule;
-import com.qualcomm.robotcore.util.TypeConversion;
-import java.util.concurrent.locks.Lock;
-
-public class HiTechnicNxtColorSensor extends ColorSensor implements I2cController.I2cPortReadyCallback {
- public static final int ADDRESS_COLOR_NUMBER = 66;
- public static final int ADDRESS_COMMAND = 65;
- public static final int ADDRESS_I2C = 2;
- public static final int BUFFER_LENGTH = 5;
- public static final int COMMAND_ACTIVE_LED = 0;
- public static final int COMMAND_PASSIVE_LED = 1;
- public static final int OFFSET_BLUE_READING = 8;
- public static final int OFFSET_COLOR_NUMBER = 5;
- public static final int OFFSET_COMMAND = 4;
- public static final int OFFSET_GREEN_READING = 7;
- public static final int OFFSET_RED_READING = 6;
- private final LegacyModule a;
- private final byte[] b;
- private final Lock c;
- private final byte[] d;
- private final Lock e;
- private HiTechnicNxtColorSensor.a f;
- private volatile int g;
- private final int h;
-
- HiTechnicNxtColorSensor(LegacyModule var1, int var2) {
- this.f = HiTechnicNxtColorSensor.a.a;
- this.g = 0;
- this.a = var1;
- this.h = var2;
- this.b = var1.getI2cReadCache(var2);
- this.c = var1.getI2cReadCacheLock(var2);
- this.d = var1.getI2cWriteCache(var2);
- this.e = var1.getI2cWriteCacheLock(var2);
- var1.enableI2cReadMode(var2, 2, 65, 5);
- var1.setI2cPortActionFlag(var2);
- var1.writeI2cCacheToController(var2);
- var1.registerForI2cPortReadyCallback(this, var2);
- }
-
- private int a(int var1) {
- byte var3;
- try {
- this.c.lock();
- var3 = this.b[var1];
- } finally {
- this.c.unlock();
- }
-
- return TypeConversion.unsignedByteToInt(var3);
- }
-
- public int alpha() {
- return 0;
- }
-
- public int argb() {
- return Color.argb(this.alpha(), this.red(), this.green(), this.blue());
- }
-
- public int blue() {
- return this.a(8);
- }
-
- public void close() {
- }
-
- public void enableLed(boolean var1) {
- byte var2 = 1;
- if(var1) {
- var2 = 0;
- }
-
- if(this.g != var2) {
- this.g = var2;
- this.f = HiTechnicNxtColorSensor.a.b;
-
- try {
- this.e.lock();
- this.d[4] = var2;
- } finally {
- this.e.unlock();
- }
-
- }
- }
-
- public String getConnectionInfo() {
- return this.a.getConnectionInfo() + "; I2C port: " + this.h;
- }
-
- public String getDeviceName() {
- return "NXT Color Sensor";
- }
-
- public int getVersion() {
- return 2;
- }
-
- public int green() {
- return this.a(7);
- }
-
- public void portIsReady(int var1) {
- this.a.setI2cPortActionFlag(this.h);
- this.a.readI2cCacheFromController(this.h);
- if(this.f == HiTechnicNxtColorSensor.a.b) {
- this.a.enableI2cWriteMode(this.h, 2, 65, 5);
- this.a.writeI2cCacheToController(this.h);
- this.f = HiTechnicNxtColorSensor.a.c;
- } else if(this.f == HiTechnicNxtColorSensor.a.c) {
- this.a.enableI2cReadMode(this.h, 2, 65, 5);
- this.a.writeI2cCacheToController(this.h);
- this.f = HiTechnicNxtColorSensor.a.a;
- } else {
- this.a.writeI2cPortFlagOnlyToController(this.h);
- }
- }
-
- public int red() {
- return this.a(6);
- }
-
- private static enum a {
- a,
- b,
- c;
-
- static {
- HiTechnicNxtColorSensor.a[] var0 = new HiTechnicNxtColorSensor.a[]{a, b, c};
- }
- }
-}
+package com.qualcomm.hardware;
+
+import android.graphics.Color;
+
+import com.qualcomm.robotcore.hardware.ColorSensor;
+import com.qualcomm.robotcore.hardware.I2cController;
+import com.qualcomm.robotcore.hardware.LegacyModule;
+import com.qualcomm.robotcore.util.TypeConversion;
+
+import java.util.concurrent.locks.Lock;
+
+public class HiTechnicNxtColorSensor extends ColorSensor implements I2cController.I2cPortReadyCallback {
+ public static final int ADDRESS_COLOR_NUMBER = 66;
+ public static final int ADDRESS_COMMAND = 65;
+ public static final int ADDRESS_I2C = 2;
+ public static final int BUFFER_LENGTH = 5;
+ public static final int COMMAND_ACTIVE_LED = 0;
+ public static final int COMMAND_PASSIVE_LED = 1;
+ public static final int OFFSET_BLUE_READING = 8;
+ public static final int OFFSET_COLOR_NUMBER = 5;
+ public static final int OFFSET_COMMAND = 4;
+ public static final int OFFSET_GREEN_READING = 7;
+ public static final int OFFSET_RED_READING = 6;
+ private final LegacyModule a;
+ private final byte[] b;
+ private final Lock c;
+ private final byte[] d;
+ private final Lock e;
+ private final int h;
+ private States f;
+ private volatile int g;
+
+ HiTechnicNxtColorSensor(LegacyModule var1, int var2) {
+ this.f = HiTechnicNxtColorSensor.States.a;
+ this.g = 0;
+ this.a = var1;
+ this.h = var2;
+ this.b = var1.getI2cReadCache(var2);
+ this.c = var1.getI2cReadCacheLock(var2);
+ this.d = var1.getI2cWriteCache(var2);
+ this.e = var1.getI2cWriteCacheLock(var2);
+ var1.enableI2cReadMode(var2, 2, 65, 5);
+ var1.setI2cPortActionFlag(var2);
+ var1.writeI2cCacheToController(var2);
+ var1.registerForI2cPortReadyCallback(this, var2);
+ }
+
+ private int a(int var1) {
+ byte var3;
+ try {
+ this.c.lock();
+ var3 = this.b[var1];
+ } finally {
+ this.c.unlock();
+ }
+
+ return TypeConversion.unsignedByteToInt(var3);
+ }
+
+ public int alpha() {
+ return 0;
+ }
+
+ public int argb() {
+ return Color.argb(this.alpha(), this.red(), this.green(), this.blue());
+ }
+
+ public int blue() {
+ return this.a(8);
+ }
+
+ public void close() {
+ }
+
+ public void enableLed(boolean var1) {
+ byte var2 = 1;
+ if(var1) {
+ var2 = 0;
+ }
+
+ if(this.g != var2) {
+ this.g = var2;
+ this.f = HiTechnicNxtColorSensor.States.b;
+
+ try {
+ this.e.lock();
+ this.d[4] = var2;
+ } finally {
+ this.e.unlock();
+ }
+
+ }
+ }
+
+ public String getConnectionInfo() {
+ return this.a.getConnectionInfo() + "; I2C port: " + this.h;
+ }
+
+ public String getDeviceName() {
+ return "NXT Color Sensor";
+ }
+
+ public int getVersion() {
+ return 2;
+ }
+
+ public int green() {
+ return this.a(7);
+ }
+
+ public void portIsReady(int var1) {
+ this.a.setI2cPortActionFlag(this.h);
+ this.a.readI2cCacheFromController(this.h);
+ if (this.f == HiTechnicNxtColorSensor.States.b) {
+ this.a.enableI2cWriteMode(this.h, 2, 65, 5);
+ this.a.writeI2cCacheToController(this.h);
+ this.f = HiTechnicNxtColorSensor.States.c;
+ } else if (this.f == HiTechnicNxtColorSensor.States.c) {
+ this.a.enableI2cReadMode(this.h, 2, 65, 5);
+ this.a.writeI2cCacheToController(this.h);
+ this.f = HiTechnicNxtColorSensor.States.a;
+ } else {
+ this.a.writeI2cPortFlagOnlyToController(this.h);
+ }
+ }
+
+ public int red() {
+ return this.a(6);
+ }
+
+ private enum States {
+ a,
+ b,
+ c;
+
+ static {
+ States[] var0 = new States[]{a, b, c};
+ }
+ }
+}
diff --git a/FtcRobotController/app/src/main/java/com/qualcomm/hardware/HiTechnicNxtCompassSensor.java b/FtcRobotController/Hardware/src/main/java/com/qualcomm/hardware/HiTechnicNxtCompassSensor.java
similarity index 95%
rename from FtcRobotController/app/src/main/java/com/qualcomm/hardware/HiTechnicNxtCompassSensor.java
rename to FtcRobotController/Hardware/src/main/java/com/qualcomm/hardware/HiTechnicNxtCompassSensor.java
index 5d70308..2ca1348 100644
--- a/FtcRobotController/app/src/main/java/com/qualcomm/hardware/HiTechnicNxtCompassSensor.java
+++ b/FtcRobotController/Hardware/src/main/java/com/qualcomm/hardware/HiTechnicNxtCompassSensor.java
@@ -1,158 +1,158 @@
-package com.qualcomm.hardware;
-
-import com.qualcomm.hardware.ModernRoboticsUsbLegacyModule;
-import com.qualcomm.robotcore.hardware.CompassSensor;
-import com.qualcomm.robotcore.hardware.I2cController;
-import com.qualcomm.robotcore.util.TypeConversion;
-import java.nio.ByteOrder;
-import java.util.Arrays;
-import java.util.concurrent.locks.Lock;
-
-public class HiTechnicNxtCompassSensor extends CompassSensor implements I2cController.I2cPortReadyCallback {
- public static final byte CALIBRATION = 67;
- public static final byte CALIBRATION_FAILURE = 70;
- public static final int COMPASS_BUFFER = 65;
- public static final int COMPASS_BUFFER_SIZE = 5;
- public static final byte DIRECTION_END = 9;
- public static final byte DIRECTION_START = 7;
- public static final byte HEADING_IN_TWO_DEGREE_INCREMENTS = 66;
- public static final int HEADING_WORD_LENGTH = 2;
- public static final byte I2C_ADDRESS = 2;
- public static final double INVALID_DIRECTION = -1.0D;
- public static final byte MEASUREMENT = 0;
- public static final byte MODE_CONTROL_ADDRESS = 65;
- public static final byte ONE_DEGREE_HEADING_ADDER = 67;
- private final ModernRoboticsUsbLegacyModule a;
- private final byte[] b;
- private final Lock c;
- private final byte[] d;
- private final Lock e;
- private final int f;
- private CompassSensor.CompassMode g;
- private boolean h;
- private boolean i;
-
- public HiTechnicNxtCompassSensor(ModernRoboticsUsbLegacyModule var1, int var2) {
- this.g = CompassSensor.CompassMode.MEASUREMENT_MODE;
- this.h = false;
- this.i = false;
- var1.enableI2cReadMode(var2, 2, 65, 5);
- this.a = var1;
- this.b = var1.getI2cReadCache(var2);
- this.c = var1.getI2cReadCacheLock(var2);
- this.d = var1.getI2cWriteCache(var2);
- this.e = var1.getI2cWriteCacheLock(var2);
- this.f = var2;
- var1.registerForI2cPortReadyCallback(this, var2);
- }
-
- private void a() {
- this.h = true;
- byte var1;
- if(this.g == CompassSensor.CompassMode.CALIBRATION_MODE) {
- var1 = 67;
- } else {
- var1 = 0;
- }
-
- this.a.enableI2cWriteMode(this.f, 2, 65, 1);
-
- try {
- this.e.lock();
- this.d[3] = var1;
- } finally {
- this.e.unlock();
- }
-
- }
-
- private void b() {
- if(this.g == CompassSensor.CompassMode.MEASUREMENT_MODE) {
- this.a.enableI2cReadMode(this.f, 2, 65, 5);
- }
-
- this.h = false;
- }
-
- public boolean calibrationFailed() {
- if(this.g != CompassSensor.CompassMode.CALIBRATION_MODE && !this.h) {
- boolean var5 = false;
-
- byte var2;
- try {
- var5 = true;
- this.c.lock();
- var2 = this.b[3];
- var5 = false;
- } finally {
- if(var5) {
- this.c.unlock();
- }
- }
-
- boolean var3 = false;
- if(var2 == 70) {
- var3 = true;
- }
-
- this.c.unlock();
- return var3;
- } else {
- return false;
- }
- }
-
- public void close() {
- }
-
- public String getConnectionInfo() {
- return this.a.getConnectionInfo() + "; port " + this.f;
- }
-
- public String getDeviceName() {
- return "NXT Compass Sensor";
- }
-
- public double getDirection() {
- if(!this.h && this.g != CompassSensor.CompassMode.CALIBRATION_MODE) {
- byte[] var2;
- try {
- this.c.lock();
- var2 = Arrays.copyOfRange(this.b, 7, 9);
- } finally {
- this.c.unlock();
- }
-
- return (double)TypeConversion.byteArrayToShort(var2, ByteOrder.LITTLE_ENDIAN);
- } else {
- return -1.0D;
- }
- }
-
- public int getVersion() {
- return 1;
- }
-
- public void portIsReady(int var1) {
- this.a.setI2cPortActionFlag(this.f);
- this.a.readI2cCacheFromController(this.f);
- if(this.h) {
- this.b();
- this.a.writeI2cCacheToController(this.f);
- } else {
- this.a.writeI2cPortFlagOnlyToController(this.f);
- }
- }
-
- public void setMode(CompassSensor.CompassMode var1) {
- if(this.g != var1) {
- this.g = var1;
- this.a();
- }
- }
-
- public String status() {
- Object[] var1 = new Object[]{this.a.getSerialNumber().toString(), Integer.valueOf(this.f)};
- return String.format("NXT Compass Sensor, connected via device %s, port %d", var1);
- }
-}
+package com.qualcomm.hardware;
+
+import com.qualcomm.robotcore.hardware.CompassSensor;
+import com.qualcomm.robotcore.hardware.I2cController;
+import com.qualcomm.robotcore.util.TypeConversion;
+
+import java.nio.ByteOrder;
+import java.util.Arrays;
+import java.util.concurrent.locks.Lock;
+
+public class HiTechnicNxtCompassSensor extends CompassSensor implements I2cController.I2cPortReadyCallback {
+ public static final byte CALIBRATION = 67;
+ public static final byte CALIBRATION_FAILURE = 70;
+ public static final int COMPASS_BUFFER = 65;
+ public static final int COMPASS_BUFFER_SIZE = 5;
+ public static final byte DIRECTION_END = 9;
+ public static final byte DIRECTION_START = 7;
+ public static final byte HEADING_IN_TWO_DEGREE_INCREMENTS = 66;
+ public static final int HEADING_WORD_LENGTH = 2;
+ public static final byte I2C_ADDRESS = 2;
+ public static final double INVALID_DIRECTION = -1.0D;
+ public static final byte MEASUREMENT = 0;
+ public static final byte MODE_CONTROL_ADDRESS = 65;
+ public static final byte ONE_DEGREE_HEADING_ADDER = 67;
+ private final ModernRoboticsUsbLegacyModule a;
+ private final byte[] b;
+ private final Lock c;
+ private final byte[] d;
+ private final Lock e;
+ private final int f;
+ private CompassSensor.CompassMode g;
+ private boolean h;
+ private boolean i;
+
+ public HiTechnicNxtCompassSensor(ModernRoboticsUsbLegacyModule var1, int var2) {
+ this.g = CompassSensor.CompassMode.MEASUREMENT_MODE;
+ this.h = false;
+ this.i = false;
+ var1.enableI2cReadMode(var2, 2, 65, 5);
+ this.a = var1;
+ this.b = var1.getI2cReadCache(var2);
+ this.c = var1.getI2cReadCacheLock(var2);
+ this.d = var1.getI2cWriteCache(var2);
+ this.e = var1.getI2cWriteCacheLock(var2);
+ this.f = var2;
+ var1.registerForI2cPortReadyCallback(this, var2);
+ }
+
+ private void a() {
+ this.h = true;
+ byte var1;
+ if(this.g == CompassSensor.CompassMode.CALIBRATION_MODE) {
+ var1 = 67;
+ } else {
+ var1 = 0;
+ }
+
+ this.a.enableI2cWriteMode(this.f, 2, 65, 1);
+
+ try {
+ this.e.lock();
+ this.d[3] = var1;
+ } finally {
+ this.e.unlock();
+ }
+
+ }
+
+ private void b() {
+ if(this.g == CompassSensor.CompassMode.MEASUREMENT_MODE) {
+ this.a.enableI2cReadMode(this.f, 2, 65, 5);
+ }
+
+ this.h = false;
+ }
+
+ public boolean calibrationFailed() {
+ if(this.g != CompassSensor.CompassMode.CALIBRATION_MODE && !this.h) {
+ boolean var5 = false;
+
+ byte var2;
+ try {
+ var5 = true;
+ this.c.lock();
+ var2 = this.b[3];
+ var5 = false;
+ } finally {
+ if(var5) {
+ this.c.unlock();
+ }
+ }
+
+ boolean var3 = false;
+ if(var2 == 70) {
+ var3 = true;
+ }
+
+ this.c.unlock();
+ return var3;
+ } else {
+ return false;
+ }
+ }
+
+ public void close() {
+ }
+
+ public String getConnectionInfo() {
+ return this.a.getConnectionInfo() + "; port " + this.f;
+ }
+
+ public String getDeviceName() {
+ return "NXT Compass Sensor";
+ }
+
+ public double getDirection() {
+ if(!this.h && this.g != CompassSensor.CompassMode.CALIBRATION_MODE) {
+ byte[] var2;
+ try {
+ this.c.lock();
+ var2 = Arrays.copyOfRange(this.b, 7, 9);
+ } finally {
+ this.c.unlock();
+ }
+
+ return (double)TypeConversion.byteArrayToShort(var2, ByteOrder.LITTLE_ENDIAN);
+ } else {
+ return -1.0D;
+ }
+ }
+
+ public int getVersion() {
+ return 1;
+ }
+
+ public void portIsReady(int var1) {
+ this.a.setI2cPortActionFlag(this.f);
+ this.a.readI2cCacheFromController(this.f);
+ if(this.h) {
+ this.b();
+ this.a.writeI2cCacheToController(this.f);
+ } else {
+ this.a.writeI2cPortFlagOnlyToController(this.f);
+ }
+ }
+
+ public void setMode(CompassSensor.CompassMode var1) {
+ if(this.g != var1) {
+ this.g = var1;
+ this.a();
+ }
+ }
+
+ public String status() {
+ Object[] var1 = new Object[]{this.a.getSerialNumber().toString(), Integer.valueOf(this.f)};
+ return String.format("NXT Compass Sensor, connected via device %s, port %d", var1);
+ }
+}
diff --git a/FtcRobotController/app/src/main/java/com/qualcomm/hardware/HiTechnicNxtDcMotorController.java b/FtcRobotController/Hardware/src/main/java/com/qualcomm/hardware/HiTechnicNxtDcMotorController.java
similarity index 86%
rename from FtcRobotController/app/src/main/java/com/qualcomm/hardware/HiTechnicNxtDcMotorController.java
rename to FtcRobotController/Hardware/src/main/java/com/qualcomm/hardware/HiTechnicNxtDcMotorController.java
index e61a00d..a13784d 100644
--- a/FtcRobotController/app/src/main/java/com/qualcomm/hardware/HiTechnicNxtDcMotorController.java
+++ b/FtcRobotController/Hardware/src/main/java/com/qualcomm/hardware/HiTechnicNxtDcMotorController.java
@@ -1,388 +1,380 @@
-package com.qualcomm.hardware;
-
-import com.qualcomm.hardware.ModernRoboticsUsbLegacyModule;
-import com.qualcomm.robotcore.hardware.DcMotorController;
-import com.qualcomm.robotcore.hardware.I2cController;
-import com.qualcomm.robotcore.util.ElapsedTime;
-import com.qualcomm.robotcore.util.Range;
-import com.qualcomm.robotcore.util.TypeConversion;
-import java.util.concurrent.locks.Lock;
-
-public class HiTechnicNxtDcMotorController implements DcMotorController, I2cController.I2cPortReadyCallback {
- public static final byte CHANNEL_MODE_FLAG_SELECT_RESET = 3;
- public static final byte CHANNEL_MODE_FLAG_SELECT_RUN_CONSTANT_SPEED_NXT = 1;
- public static final byte CHANNEL_MODE_FLAG_SELECT_RUN_POWER_CONTROL_ONLY_NXT = 0;
- public static final byte CHANNEL_MODE_FLAG_SELECT_RUN_TO_POSITION = 2;
- public static final int CHANNEL_MODE_MASK_BUSY = 128;
- public static final int CHANNEL_MODE_MASK_EMPTY_D5 = 32;
- public static final int CHANNEL_MODE_MASK_ERROR = 64;
- public static final int CHANNEL_MODE_MASK_LOCK = 4;
- public static final int CHANNEL_MODE_MASK_NO_TIMEOUT = 16;
- public static final int CHANNEL_MODE_MASK_REVERSE = 8;
- public static final int CHANNEL_MODE_MASK_SELECTION = 3;
- public static final int I2C_ADDRESS = 2;
- public static final int MAX_MOTOR = 2;
- public static final int MEM_READ_LENGTH = 20;
- public static final int MEM_START_ADDRESS = 64;
- public static final int MIN_MOTOR = 1;
- public static final int NUM_BYTES = 20;
- public static final byte[] OFFSET_MAP_MOTOR_CURRENT_ENCODER_VALUE = new byte[]{(byte)-1, (byte)16, (byte)20};
- public static final byte[] OFFSET_MAP_MOTOR_MODE = new byte[]{(byte)-1, (byte)8, (byte)11};
- public static final byte[] OFFSET_MAP_MOTOR_POWER = new byte[]{(byte)-1, (byte)9, (byte)10};
- public static final byte[] OFFSET_MAP_MOTOR_TARGET_ENCODER_VALUE = new byte[]{(byte)-1, (byte)4, (byte)12};
- public static final int OFFSET_MOTOR1_CURRENT_ENCODER_VALUE = 16;
- public static final int OFFSET_MOTOR1_MODE = 8;
- public static final int OFFSET_MOTOR1_POWER = 9;
- public static final int OFFSET_MOTOR1_TARGET_ENCODER_VALUE = 4;
- public static final int OFFSET_MOTOR2_CURRENT_ENCODER_VALUE = 20;
- public static final int OFFSET_MOTOR2_MODE = 11;
- public static final int OFFSET_MOTOR2_POWER = 10;
- public static final int OFFSET_MOTOR2_TARGET_ENCODER_VALUE = 12;
- public static final int OFFSET_UNUSED = -1;
- public static final byte POWER_BREAK = 0;
- public static final byte POWER_FLOAT = -128;
- public static final byte POWER_MAX = 100;
- public static final byte POWER_MIN = -100;
- private final ModernRoboticsUsbLegacyModule a;
- private final byte[] b;
- private final Lock c;
- private final byte[] d;
- private final Lock e;
- private final int f;
- private final ElapsedTime g = new ElapsedTime(0L);
- private volatile DcMotorController.DeviceMode h;
- private volatile boolean i = true;
-
- public HiTechnicNxtDcMotorController(ModernRoboticsUsbLegacyModule var1, int var2) {
- this.a = var1;
- this.f = var2;
- this.b = var1.getI2cReadCache(var2);
- this.c = var1.getI2cReadCacheLock(var2);
- this.d = var1.getI2cWriteCache(var2);
- this.e = var1.getI2cWriteCacheLock(var2);
- this.h = DcMotorController.DeviceMode.WRITE_ONLY;
- var1.enableI2cWriteMode(var2, 2, 64, 20);
-
- try {
- this.e.lock();
- this.d[9] = -128;
- this.d[10] = -128;
- } finally {
- this.e.unlock();
- }
-
- var1.writeI2cCacheToController(var2);
- var1.registerForI2cPortReadyCallback(this, var2);
- }
-
- private void a() {
- if(this.h != DcMotorController.DeviceMode.SWITCHING_TO_WRITE_MODE && (this.h == DcMotorController.DeviceMode.READ_ONLY || this.h == DcMotorController.DeviceMode.SWITCHING_TO_READ_MODE)) {
- String var1 = "Cannot write while in this mode: " + this.h;
- StackTraceElement[] var2 = Thread.currentThread().getStackTrace();
- if(var2 != null && var2.length > 3) {
- var1 = var1 + "\n from method: " + var2[3].getMethodName();
- }
-
- throw new IllegalArgumentException(var1);
- }
- }
-
- private void a(int var1) {
- if(var1 < 1 || var1 > 2) {
- Object[] var2 = new Object[]{Integer.valueOf(var1), Integer.valueOf(2)};
- throw new IllegalArgumentException(String.format("Motor %d is invalid; valid motors are 1..%d", var2));
- }
- }
-
- private void b() {
- if(this.h != DcMotorController.DeviceMode.SWITCHING_TO_READ_MODE && (this.h == DcMotorController.DeviceMode.WRITE_ONLY || this.h == DcMotorController.DeviceMode.SWITCHING_TO_WRITE_MODE)) {
- String var1 = "Cannot read while in this mode: " + this.h;
- StackTraceElement[] var2 = Thread.currentThread().getStackTrace();
- if(var2 != null && var2.length > 3) {
- var1 = var1 + "\n from method: " + var2[3].getMethodName();
- }
-
- throw new IllegalArgumentException(var1);
- }
- }
-
- public static DcMotorController.RunMode flagToRunModeNXT(byte var0) {
- switch(var0 & 3) {
- case 0:
- return DcMotorController.RunMode.RUN_WITHOUT_ENCODERS;
- case 1:
- return DcMotorController.RunMode.RUN_USING_ENCODERS;
- case 2:
- return DcMotorController.RunMode.RUN_TO_POSITION;
- case 3:
- return DcMotorController.RunMode.RESET_ENCODERS;
- default:
- return DcMotorController.RunMode.RUN_WITHOUT_ENCODERS;
- }
- }
-
- public static byte runModeToFlagNXT(DcMotorController.RunMode var0) {
- switch(null.b[var0.ordinal()]) {
- case 1:
- default:
- return (byte)1;
- case 2:
- return (byte)0;
- case 3:
- return (byte)2;
- case 4:
- return (byte)3;
- }
- }
-
- public void close() {
- if(this.h == DcMotorController.DeviceMode.WRITE_ONLY) {
- this.setMotorPowerFloat(1);
- this.setMotorPowerFloat(2);
- }
-
- }
-
- public String getConnectionInfo() {
- return this.a.getConnectionInfo() + "; port " + this.f;
- }
-
- public String getDeviceName() {
- return "NXT DC Motor Controller";
- }
-
- public DcMotorController.RunMode getMotorChannelMode(int var1) {
- this.a(var1);
- this.b();
-
- byte var3;
- try {
- this.c.lock();
- var3 = this.b[OFFSET_MAP_MOTOR_MODE[var1]];
- } finally {
- this.c.unlock();
- }
-
- return flagToRunModeNXT(var3);
- }
-
- public DcMotorController.DeviceMode getMotorControllerDeviceMode() {
- return this.h;
- }
-
- public int getMotorCurrentPosition(int var1) {
- this.a(var1);
- this.b();
- byte[] var2 = new byte[4];
-
- try {
- this.c.lock();
- System.arraycopy(this.b, OFFSET_MAP_MOTOR_CURRENT_ENCODER_VALUE[var1], var2, 0, var2.length);
- } finally {
- this.c.unlock();
- }
-
- return TypeConversion.byteArrayToInt(var2);
- }
-
- public double getMotorPower(int var1) {
- this.a(var1);
- this.b();
-
- byte var3;
- try {
- this.c.lock();
- var3 = this.b[OFFSET_MAP_MOTOR_POWER[var1]];
- } finally {
- this.c.unlock();
- }
-
- return var3 == -128?0.0D:(double)var3 / 100.0D;
- }
-
- public boolean getMotorPowerFloat(int var1) {
- this.a(var1);
- this.b();
- boolean var6 = false;
-
- byte var3;
- try {
- var6 = true;
- this.c.lock();
- var3 = this.b[OFFSET_MAP_MOTOR_POWER[var1]];
- var6 = false;
- } finally {
- if(var6) {
- this.c.unlock();
- }
- }
-
- boolean var4;
- if(var3 == -128) {
- var4 = true;
- } else {
- var4 = false;
- }
-
- this.c.unlock();
- return var4;
- }
-
- public int getMotorTargetPosition(int var1) {
- this.a(var1);
- this.b();
- byte[] var2 = new byte[4];
-
- try {
- this.c.lock();
- System.arraycopy(this.b, OFFSET_MAP_MOTOR_TARGET_ENCODER_VALUE[var1], var2, 0, var2.length);
- } finally {
- this.c.unlock();
- }
-
- return TypeConversion.byteArrayToInt(var2);
- }
-
- public int getVersion() {
- return 1;
- }
-
- public boolean isBusy(int var1) {
- this.a(var1);
- this.b();
- boolean var6 = false;
-
- byte var3;
- try {
- var6 = true;
- this.c.lock();
- var3 = this.b[OFFSET_MAP_MOTOR_MODE[var1]];
- var6 = false;
- } finally {
- if(var6) {
- this.c.unlock();
- }
- }
-
- boolean var4;
- if((var3 & 128) == 128) {
- var4 = true;
- } else {
- var4 = false;
- }
-
- this.c.unlock();
- return var4;
- }
-
- public void portIsReady(int var1) {
- switch(null.a[this.h.ordinal()]) {
- case 3:
- if(this.a.isI2cPortInReadMode(var1)) {
- this.h = DcMotorController.DeviceMode.READ_ONLY;
- }
- break;
- case 4:
- if(this.a.isI2cPortInWriteMode(var1)) {
- this.h = DcMotorController.DeviceMode.WRITE_ONLY;
- }
- }
-
- if(this.h == DcMotorController.DeviceMode.READ_ONLY) {
- this.a.setI2cPortActionFlag(this.f);
- this.a.writeI2cPortFlagOnlyToController(this.f);
- } else {
- if(this.i || this.g.time() > 2.0D) {
- this.a.setI2cPortActionFlag(this.f);
- this.a.writeI2cCacheToController(this.f);
- this.g.reset();
- }
-
- this.i = false;
- }
-
- this.a.readI2cCacheFromController(this.f);
- }
-
- public void setMotorChannelMode(int var1, DcMotorController.RunMode var2) {
- this.a(var1);
- this.a();
- byte var3 = runModeToFlagNXT(var2);
-
- try {
- this.e.lock();
- if(this.d[OFFSET_MAP_MOTOR_MODE[var1]] != var3) {
- this.d[OFFSET_MAP_MOTOR_MODE[var1]] = var3;
- this.i = true;
- }
- } finally {
- this.e.unlock();
- }
-
- }
-
- public void setMotorControllerDeviceMode(DcMotorController.DeviceMode var1) {
- if(this.h != var1) {
- switch(null.a[var1.ordinal()]) {
- case 1:
- this.h = DcMotorController.DeviceMode.SWITCHING_TO_READ_MODE;
- this.a.enableI2cReadMode(this.f, 2, 64, 20);
- break;
- case 2:
- this.h = DcMotorController.DeviceMode.SWITCHING_TO_WRITE_MODE;
- this.a.enableI2cWriteMode(this.f, 2, 64, 20);
- }
-
- this.i = true;
- }
- }
-
- public void setMotorPower(int var1, double var2) {
- this.a(var1);
- this.a();
- Range.throwIfRangeIsInvalid(var2, -1.0D, 1.0D);
- byte var4 = (byte)((int)(100.0D * var2));
-
- try {
- this.e.lock();
- if(var4 != this.d[OFFSET_MAP_MOTOR_POWER[var1]]) {
- this.d[OFFSET_MAP_MOTOR_POWER[var1]] = var4;
- this.i = true;
- }
- } finally {
- this.e.unlock();
- }
-
- }
-
- public void setMotorPowerFloat(int var1) {
- this.a(var1);
- this.a();
-
- try {
- this.e.lock();
- if(-128 != this.d[OFFSET_MAP_MOTOR_POWER[var1]]) {
- this.d[OFFSET_MAP_MOTOR_POWER[var1]] = -128;
- this.i = true;
- }
- } finally {
- this.e.unlock();
- }
-
- }
-
- public void setMotorTargetPosition(int var1, int var2) {
- this.a(var1);
- this.a();
- byte[] var3 = TypeConversion.intToByteArray(var2);
-
- try {
- this.e.lock();
- System.arraycopy(var3, 0, this.d, OFFSET_MAP_MOTOR_TARGET_ENCODER_VALUE[var1], var3.length);
- this.i = true;
- } finally {
- this.e.unlock();
- }
-
- }
-}
+package com.qualcomm.hardware;
+
+import com.qualcomm.robotcore.hardware.DcMotorController;
+import com.qualcomm.robotcore.hardware.I2cController;
+import com.qualcomm.robotcore.util.ElapsedTime;
+import com.qualcomm.robotcore.util.Range;
+import com.qualcomm.robotcore.util.TypeConversion;
+
+import java.util.concurrent.locks.Lock;
+
+public class HiTechnicNxtDcMotorController implements DcMotorController, I2cController.I2cPortReadyCallback {
+ public static final byte CHANNEL_MODE_FLAG_SELECT_RESET = 3;
+ public static final byte CHANNEL_MODE_FLAG_SELECT_RUN_CONSTANT_SPEED_NXT = 1;
+ public static final byte CHANNEL_MODE_FLAG_SELECT_RUN_POWER_CONTROL_ONLY_NXT = 0;
+ public static final byte CHANNEL_MODE_FLAG_SELECT_RUN_TO_POSITION = 2;
+ public static final int CHANNEL_MODE_MASK_BUSY = 128;
+ public static final int CHANNEL_MODE_MASK_EMPTY_D5 = 32;
+ public static final int CHANNEL_MODE_MASK_ERROR = 64;
+ public static final int CHANNEL_MODE_MASK_LOCK = 4;
+ public static final int CHANNEL_MODE_MASK_NO_TIMEOUT = 16;
+ public static final int CHANNEL_MODE_MASK_REVERSE = 8;
+ public static final int CHANNEL_MODE_MASK_SELECTION = 3;
+ public static final int I2C_ADDRESS = 2;
+ public static final int MAX_MOTOR = 2;
+ public static final int MEM_READ_LENGTH = 20;
+ public static final int MEM_START_ADDRESS = 64;
+ public static final int MIN_MOTOR = 1;
+ public static final int NUM_BYTES = 20;
+ public static final byte[] OFFSET_MAP_MOTOR_CURRENT_ENCODER_VALUE = new byte[]{(byte)-1, (byte)16, (byte)20};
+ public static final byte[] OFFSET_MAP_MOTOR_MODE = new byte[]{(byte)-1, (byte)8, (byte)11};
+ public static final byte[] OFFSET_MAP_MOTOR_POWER = new byte[]{(byte)-1, (byte)9, (byte)10};
+ public static final byte[] OFFSET_MAP_MOTOR_TARGET_ENCODER_VALUE = new byte[]{(byte)-1, (byte)4, (byte)12};
+ public static final int OFFSET_MOTOR1_CURRENT_ENCODER_VALUE = 16;
+ public static final int OFFSET_MOTOR1_MODE = 8;
+ public static final int OFFSET_MOTOR1_POWER = 9;
+ public static final int OFFSET_MOTOR1_TARGET_ENCODER_VALUE = 4;
+ public static final int OFFSET_MOTOR2_CURRENT_ENCODER_VALUE = 20;
+ public static final int OFFSET_MOTOR2_MODE = 11;
+ public static final int OFFSET_MOTOR2_POWER = 10;
+ public static final int OFFSET_MOTOR2_TARGET_ENCODER_VALUE = 12;
+ public static final int OFFSET_UNUSED = -1;
+ public static final byte POWER_BREAK = 0;
+ public static final byte POWER_FLOAT = -128;
+ public static final byte POWER_MAX = 100;
+ public static final byte POWER_MIN = -100;
+ private final ModernRoboticsUsbLegacyModule a;
+ private final byte[] b;
+ private final Lock c;
+ private final byte[] d;
+ private final Lock e;
+ private final int f;
+ private final ElapsedTime g = new ElapsedTime(0L);
+ private volatile DcMotorController.DeviceMode h;
+ private volatile boolean i = true;
+
+ public HiTechnicNxtDcMotorController(ModernRoboticsUsbLegacyModule var1, int var2) {
+ this.a = var1;
+ this.f = var2;
+ this.b = var1.getI2cReadCache(var2);
+ this.c = var1.getI2cReadCacheLock(var2);
+ this.d = var1.getI2cWriteCache(var2);
+ this.e = var1.getI2cWriteCacheLock(var2);
+ this.h = DcMotorController.DeviceMode.WRITE_ONLY;
+ var1.enableI2cWriteMode(var2, 2, 64, 20);
+
+ try {
+ this.e.lock();
+ this.d[9] = -128;
+ this.d[10] = -128;
+ } finally {
+ this.e.unlock();
+ }
+
+ var1.writeI2cCacheToController(var2);
+ var1.registerForI2cPortReadyCallback(this, var2);
+ }
+
+ public static DcMotorController.RunMode flagToRunModeNXT(byte var0) {
+ switch (var0 & 3) {
+ case 0:
+ return DcMotorController.RunMode.RUN_WITHOUT_ENCODERS;
+ case 1:
+ return DcMotorController.RunMode.RUN_USING_ENCODERS;
+ case 2:
+ return DcMotorController.RunMode.RUN_TO_POSITION;
+ case 3:
+ return DcMotorController.RunMode.RESET_ENCODERS;
+ default:
+ return DcMotorController.RunMode.RUN_WITHOUT_ENCODERS;
+ }
+ }
+
+ public static byte runModeToFlagNXT(DcMotorController.RunMode var0) {
+ switch (var0.ordinal()) {
+ case 1:
+ default:
+ return (byte) 1;
+ case 2:
+ return (byte) 0;
+ case 3:
+ return (byte) 2;
+ case 4:
+ return (byte) 3;
+ }
+ }
+
+ private void a() {
+ if(this.h != DcMotorController.DeviceMode.SWITCHING_TO_WRITE_MODE && (this.h == DcMotorController.DeviceMode.READ_ONLY || this.h == DcMotorController.DeviceMode.SWITCHING_TO_READ_MODE)) {
+ String var1 = "Cannot write while in this mode: " + this.h;
+ StackTraceElement[] var2 = Thread.currentThread().getStackTrace();
+ if(var2 != null && var2.length > 3) {
+ var1 = var1 + "\n from method: " + var2[3].getMethodName();
+ }
+
+ throw new IllegalArgumentException(var1);
+ }
+ }
+
+ private void a(int var1) {
+ if(var1 < 1 || var1 > 2) {
+ Object[] var2 = new Object[]{Integer.valueOf(var1), Integer.valueOf(2)};
+ throw new IllegalArgumentException(String.format("Motor %d is invalid; valid motors are 1..%d", var2));
+ }
+ }
+
+ private void b() {
+ if(this.h != DcMotorController.DeviceMode.SWITCHING_TO_READ_MODE && (this.h == DcMotorController.DeviceMode.WRITE_ONLY || this.h == DcMotorController.DeviceMode.SWITCHING_TO_WRITE_MODE)) {
+ String var1 = "Cannot read while in this mode: " + this.h;
+ StackTraceElement[] var2 = Thread.currentThread().getStackTrace();
+ if(var2 != null && var2.length > 3) {
+ var1 = var1 + "\n from method: " + var2[3].getMethodName();
+ }
+
+ throw new IllegalArgumentException(var1);
+ }
+ }
+
+ public void close() {
+ if(this.h == DcMotorController.DeviceMode.WRITE_ONLY) {
+ this.setMotorPowerFloat(1);
+ this.setMotorPowerFloat(2);
+ }
+
+ }
+
+ public String getConnectionInfo() {
+ return this.a.getConnectionInfo() + "; port " + this.f;
+ }
+
+ public String getDeviceName() {
+ return "NXT DC Motor Controller";
+ }
+
+ public DcMotorController.RunMode getMotorChannelMode(int var1) {
+ this.a(var1);
+ this.b();
+
+ byte var3;
+ try {
+ this.c.lock();
+ var3 = this.b[OFFSET_MAP_MOTOR_MODE[var1]];
+ } finally {
+ this.c.unlock();
+ }
+
+ return flagToRunModeNXT(var3);
+ }
+
+ public DcMotorController.DeviceMode getMotorControllerDeviceMode() {
+ return this.h;
+ }
+
+ public void setMotorControllerDeviceMode(DcMotorController.DeviceMode var1) {
+ if (this.h != var1) {
+ switch (var1.ordinal()) {
+ case 1:
+ this.h = DcMotorController.DeviceMode.SWITCHING_TO_READ_MODE;
+ this.a.enableI2cReadMode(this.f, 2, 64, 20);
+ break;
+ case 2:
+ this.h = DcMotorController.DeviceMode.SWITCHING_TO_WRITE_MODE;
+ this.a.enableI2cWriteMode(this.f, 2, 64, 20);
+ }
+
+ this.i = true;
+ }
+ }
+
+ public int getMotorCurrentPosition(int var1) {
+ this.a(var1);
+ this.b();
+ byte[] var2 = new byte[4];
+
+ try {
+ this.c.lock();
+ System.arraycopy(this.b, OFFSET_MAP_MOTOR_CURRENT_ENCODER_VALUE[var1], var2, 0, var2.length);
+ } finally {
+ this.c.unlock();
+ }
+
+ return TypeConversion.byteArrayToInt(var2);
+ }
+
+ public double getMotorPower(int var1) {
+ this.a(var1);
+ this.b();
+
+ byte var3;
+ try {
+ this.c.lock();
+ var3 = this.b[OFFSET_MAP_MOTOR_POWER[var1]];
+ } finally {
+ this.c.unlock();
+ }
+
+ return var3 == -128?0.0D:(double)var3 / 100.0D;
+ }
+
+ public boolean getMotorPowerFloat(int var1) {
+ this.a(var1);
+ this.b();
+ boolean var6 = false;
+
+ byte var3;
+ try {
+ var6 = true;
+ this.c.lock();
+ var3 = this.b[OFFSET_MAP_MOTOR_POWER[var1]];
+ var6 = false;
+ } finally {
+ if(var6) {
+ this.c.unlock();
+ }
+ }
+
+ boolean var4;
+ var4 = var3 == -128;
+
+ this.c.unlock();
+ return var4;
+ }
+
+ public int getMotorTargetPosition(int var1) {
+ this.a(var1);
+ this.b();
+ byte[] var2 = new byte[4];
+
+ try {
+ this.c.lock();
+ System.arraycopy(this.b, OFFSET_MAP_MOTOR_TARGET_ENCODER_VALUE[var1], var2, 0, var2.length);
+ } finally {
+ this.c.unlock();
+ }
+
+ return TypeConversion.byteArrayToInt(var2);
+ }
+
+ public int getVersion() {
+ return 1;
+ }
+
+ public boolean isBusy(int var1) {
+ this.a(var1);
+ this.b();
+ boolean var6 = false;
+
+ byte var3;
+ try {
+ var6 = true;
+ this.c.lock();
+ var3 = this.b[OFFSET_MAP_MOTOR_MODE[var1]];
+ var6 = false;
+ } finally {
+ if(var6) {
+ this.c.unlock();
+ }
+ }
+
+ boolean var4;
+ var4 = (var3 & 128) == 128;
+
+ this.c.unlock();
+ return var4;
+ }
+
+ public void portIsReady(int var1) {
+ switch (this.h.ordinal()) {
+ case 3:
+ if(this.a.isI2cPortInReadMode(var1)) {
+ this.h = DcMotorController.DeviceMode.READ_ONLY;
+ }
+ break;
+ case 4:
+ if(this.a.isI2cPortInWriteMode(var1)) {
+ this.h = DcMotorController.DeviceMode.WRITE_ONLY;
+ }
+ }
+
+ if(this.h == DcMotorController.DeviceMode.READ_ONLY) {
+ this.a.setI2cPortActionFlag(this.f);
+ this.a.writeI2cPortFlagOnlyToController(this.f);
+ } else {
+ if(this.i || this.g.time() > 2.0D) {
+ this.a.setI2cPortActionFlag(this.f);
+ this.a.writeI2cCacheToController(this.f);
+ this.g.reset();
+ }
+
+ this.i = false;
+ }
+
+ this.a.readI2cCacheFromController(this.f);
+ }
+
+ public void setMotorChannelMode(int var1, DcMotorController.RunMode var2) {
+ this.a(var1);
+ this.a();
+ byte var3 = runModeToFlagNXT(var2);
+
+ try {
+ this.e.lock();
+ if(this.d[OFFSET_MAP_MOTOR_MODE[var1]] != var3) {
+ this.d[OFFSET_MAP_MOTOR_MODE[var1]] = var3;
+ this.i = true;
+ }
+ } finally {
+ this.e.unlock();
+ }
+
+ }
+
+ public void setMotorPower(int var1, double var2) {
+ this.a(var1);
+ this.a();
+ Range.throwIfRangeIsInvalid(var2, -1.0D, 1.0D);
+ byte var4 = (byte)((int)(100.0D * var2));
+
+ try {
+ this.e.lock();
+ if(var4 != this.d[OFFSET_MAP_MOTOR_POWER[var1]]) {
+ this.d[OFFSET_MAP_MOTOR_POWER[var1]] = var4;
+ this.i = true;
+ }
+ } finally {
+ this.e.unlock();
+ }
+
+ }
+
+ public void setMotorPowerFloat(int var1) {
+ this.a(var1);
+ this.a();
+
+ try {
+ this.e.lock();
+ if(-128 != this.d[OFFSET_MAP_MOTOR_POWER[var1]]) {
+ this.d[OFFSET_MAP_MOTOR_POWER[var1]] = -128;
+ this.i = true;
+ }
+ } finally {
+ this.e.unlock();
+ }
+
+ }
+
+ public void setMotorTargetPosition(int var1, int var2) {
+ this.a(var1);
+ this.a();
+ byte[] var3 = TypeConversion.intToByteArray(var2);
+
+ try {
+ this.e.lock();
+ System.arraycopy(var3, 0, this.d, OFFSET_MAP_MOTOR_TARGET_ENCODER_VALUE[var1], var3.length);
+ this.i = true;
+ } finally {
+ this.e.unlock();
+ }
+
+ }
+}
diff --git a/FtcRobotController/app/src/main/java/com/qualcomm/hardware/HiTechnicNxtGyroSensor.java b/FtcRobotController/Hardware/src/main/java/com/qualcomm/hardware/HiTechnicNxtGyroSensor.java
similarity index 91%
rename from FtcRobotController/app/src/main/java/com/qualcomm/hardware/HiTechnicNxtGyroSensor.java
rename to FtcRobotController/Hardware/src/main/java/com/qualcomm/hardware/HiTechnicNxtGyroSensor.java
index 4e8d4b9..e029d0f 100644
--- a/FtcRobotController/app/src/main/java/com/qualcomm/hardware/HiTechnicNxtGyroSensor.java
+++ b/FtcRobotController/Hardware/src/main/java/com/qualcomm/hardware/HiTechnicNxtGyroSensor.java
@@ -1,41 +1,41 @@
-package com.qualcomm.hardware;
-
-import com.qualcomm.hardware.ModernRoboticsUsbLegacyModule;
-import com.qualcomm.robotcore.hardware.GyroSensor;
-import com.qualcomm.robotcore.util.TypeConversion;
-import java.nio.ByteOrder;
-
-public class HiTechnicNxtGyroSensor extends GyroSensor {
- private final ModernRoboticsUsbLegacyModule a;
- private final int b;
-
- HiTechnicNxtGyroSensor(ModernRoboticsUsbLegacyModule var1, int var2) {
- var1.enableAnalogReadMode(var2);
- this.a = var1;
- this.b = var2;
- }
-
- public void close() {
- }
-
- public String getConnectionInfo() {
- return this.a.getConnectionInfo() + "; port " + this.b;
- }
-
- public String getDeviceName() {
- return "NXT Gyro Sensor";
- }
-
- public double getRotation() {
- return (double)TypeConversion.byteArrayToShort(this.a.readAnalog(this.b), ByteOrder.LITTLE_ENDIAN);
- }
-
- public int getVersion() {
- return 1;
- }
-
- public String status() {
- Object[] var1 = new Object[]{this.a.getSerialNumber().toString(), Integer.valueOf(this.b)};
- return String.format("NXT Gyro Sensor, connected via device %s, port %d", var1);
- }
-}
+package com.qualcomm.hardware;
+
+import com.qualcomm.robotcore.hardware.GyroSensor;
+import com.qualcomm.robotcore.util.TypeConversion;
+
+import java.nio.ByteOrder;
+
+public class HiTechnicNxtGyroSensor extends GyroSensor {
+ private final ModernRoboticsUsbLegacyModule a;
+ private final int b;
+
+ HiTechnicNxtGyroSensor(ModernRoboticsUsbLegacyModule var1, int var2) {
+ var1.enableAnalogReadMode(var2);
+ this.a = var1;
+ this.b = var2;
+ }
+
+ public void close() {
+ }
+
+ public String getConnectionInfo() {
+ return this.a.getConnectionInfo() + "; port " + this.b;
+ }
+
+ public String getDeviceName() {
+ return "NXT Gyro Sensor";
+ }
+
+ public double getRotation() {
+ return (double)TypeConversion.byteArrayToShort(this.a.readAnalog(this.b), ByteOrder.LITTLE_ENDIAN);
+ }
+
+ public int getVersion() {
+ return 1;
+ }
+
+ public String status() {
+ Object[] var1 = new Object[]{this.a.getSerialNumber().toString(), Integer.valueOf(this.b)};
+ return String.format("NXT Gyro Sensor, connected via device %s, port %d", var1);
+ }
+}
diff --git a/FtcRobotController/app/src/main/java/com/qualcomm/hardware/HiTechnicNxtIrSeekerSensor.java b/FtcRobotController/Hardware/src/main/java/com/qualcomm/hardware/HiTechnicNxtIrSeekerSensor.java
similarity index 76%
rename from FtcRobotController/app/src/main/java/com/qualcomm/hardware/HiTechnicNxtIrSeekerSensor.java
rename to FtcRobotController/Hardware/src/main/java/com/qualcomm/hardware/HiTechnicNxtIrSeekerSensor.java
index 1769daf..ae9996b 100644
--- a/FtcRobotController/app/src/main/java/com/qualcomm/hardware/HiTechnicNxtIrSeekerSensor.java
+++ b/FtcRobotController/Hardware/src/main/java/com/qualcomm/hardware/HiTechnicNxtIrSeekerSensor.java
@@ -1,177 +1,227 @@
-package com.qualcomm.hardware;
-
-import com.qualcomm.hardware.ModernRoboticsUsbLegacyModule;
-import com.qualcomm.robotcore.hardware.I2cController;
-import com.qualcomm.robotcore.hardware.IrSeekerSensor;
-import com.qualcomm.robotcore.util.TypeConversion;
-import java.util.concurrent.locks.Lock;
-
-public class HiTechnicNxtIrSeekerSensor extends IrSeekerSensor implements I2cController.I2cPortReadyCallback {
- public static final double DEFAULT_SIGNAL_DETECTED_THRESHOLD = 0.00390625D;
- public static final byte DIRECTION = 4;
- public static final double[] DIRECTION_TO_ANGLE = new double[]{0.0D, -120.0D, -90.0D, -60.0D, -30.0D, 0.0D, 30.0D, 60.0D, 90.0D, 120.0D};
- public static final int I2C_ADDRESS = 16;
- public static final byte INVALID_ANGLE = 0;
- public static final byte MAX_ANGLE = 9;
- public static final double MAX_SENSOR_STRENGTH = 256.0D;
- public static final int MEM_AC_START_ADDRESS = 73;
- public static final int MEM_DC_START_ADDRESS = 66;
- public static final int MEM_MODE_ADDRESS = 65;
- public static final int MEM_READ_LENGTH = 6;
- public static final byte MIN_ANGLE = 1;
- public static final byte MODE_AC = 0;
- public static final byte MODE_DC = 2;
- public static final byte SENSOR_COUNT = 9;
- public static final byte SENSOR_FIRST = 5;
- private final ModernRoboticsUsbLegacyModule a;
- private final byte[] b;
- private final Lock c;
- private final byte[] d;
- private final Lock e;
- private final int f;
- private IrSeekerSensor.Mode g;
- private double h = 0.00390625D;
- private volatile boolean i;
-
- public HiTechnicNxtIrSeekerSensor(ModernRoboticsUsbLegacyModule var1, int var2) {
- this.a = var1;
- this.b = var1.getI2cReadCache(var2);
- this.c = var1.getI2cReadCacheLock(var2);
- this.d = var1.getI2cWriteCache(var2);
- this.e = var1.getI2cWriteCacheLock(var2);
- this.f = var2;
- this.g = IrSeekerSensor.Mode.MODE_1200HZ;
- var1.registerForI2cPortReadyCallback(this, var2);
- this.i = true;
- }
-
- private double a(byte[] var1, int var2) {
- return TypeConversion.unsignedByteToDouble(var1[var2 + 5]) / 256.0D;
- }
-
- private void a() {
- this.i = true;
- byte var1;
- if(this.g == IrSeekerSensor.Mode.MODE_600HZ) {
- var1 = 2;
- } else {
- var1 = 0;
- }
-
- this.a.enableI2cWriteMode(this.f, 16, 65, 1);
-
- try {
- this.e.lock();
- this.d[4] = var1;
- } finally {
- this.e.unlock();
- }
-
- }
-
- public void close() {
- }
-
- public double getAngle() {
- // $FF: Couldn't be decompiled
- }
-
- public String getConnectionInfo() {
- return this.a.getConnectionInfo() + "; port " + this.f;
- }
-
- public String getDeviceName() {
- return "NXT IR Seeker Sensor";
- }
-
- public int getI2cAddress() {
- return 16;
- }
-
- public IrSeekerSensor.IrSeekerIndividualSensor[] getIndividualSensors() {
- // $FF: Couldn't be decompiled
- }
-
- public IrSeekerSensor.Mode getMode() {
- return this.g;
- }
-
- public double getSignalDetectedThreshold() {
- return this.h;
- }
-
- public double getStrength() {
- // $FF: Couldn't be decompiled
- }
-
- public int getVersion() {
- return 2;
- }
-
- public void portIsReady(int var1) {
- this.a.setI2cPortActionFlag(this.f);
- this.a.readI2cCacheFromController(this.f);
- if(this.i) {
- if(this.g == IrSeekerSensor.Mode.MODE_600HZ) {
- this.a.enableI2cReadMode(this.f, 16, 66, 6);
- } else {
- this.a.enableI2cReadMode(this.f, 16, 73, 6);
- }
-
- this.a.writeI2cCacheToController(this.f);
- this.i = false;
- } else {
- this.a.writeI2cPortFlagOnlyToController(this.f);
- }
- }
-
- public void setI2cAddress(int var1) {
- throw new UnsupportedOperationException("This method is not supported.");
- }
-
- public void setMode(IrSeekerSensor.Mode var1) {
- if(this.g != var1) {
- this.g = var1;
- this.a();
- }
- }
-
- public void setSignalDetectedThreshold(double var1) {
- this.h = var1;
- }
-
- public boolean signalDetected() {
- boolean var1 = true;
- if(this.i) {
- return false;
- } else {
- boolean var6 = false;
-
- byte var3;
- try {
- var6 = true;
- this.c.lock();
- var3 = this.b[4];
- var6 = false;
- } finally {
- if(var6) {
- this.c.unlock();
- }
- }
-
- boolean var4;
- if(var3 != 0) {
- var4 = var1;
- } else {
- var4 = false;
- }
-
- this.c.unlock();
- if(!var4 || this.getStrength() <= this.h) {
- var1 = false;
- }
-
- return var1;
- }
- }
-}
+package com.qualcomm.hardware;
+
+import com.qualcomm.robotcore.hardware.I2cController;
+import com.qualcomm.robotcore.hardware.IrSeekerSensor;
+import com.qualcomm.robotcore.util.TypeConversion;
+
+import java.util.concurrent.locks.Lock;
+
+public class HiTechnicNxtIrSeekerSensor extends IrSeekerSensor implements I2cController.I2cPortReadyCallback {
+ public static final double DEFAULT_SIGNAL_DETECTED_THRESHOLD = 0.00390625D;
+ public static final byte DIRECTION = 4;
+ public static final double[] DIRECTION_TO_ANGLE = new double[]{0.0D, -120.0D, -90.0D, -60.0D, -30.0D, 0.0D, 30.0D, 60.0D, 90.0D, 120.0D};
+ public static final int I2C_ADDRESS = 16;
+ public static final byte INVALID_ANGLE = 0;
+ public static final byte MAX_ANGLE = 9;
+ public static final double MAX_SENSOR_STRENGTH = 256.0D;
+ public static final int MEM_AC_START_ADDRESS = 73;
+ public static final int MEM_DC_START_ADDRESS = 66;
+ public static final int MEM_MODE_ADDRESS = 65;
+ public static final int MEM_READ_LENGTH = 6;
+ public static final byte MIN_ANGLE = 1;
+ public static final byte MODE_AC = 0;
+ public static final byte MODE_DC = 2;
+ public static final byte SENSOR_COUNT = 9;
+ public static final byte SENSOR_FIRST = 5;
+ private final ModernRoboticsUsbLegacyModule a;
+ private final byte[] b;
+ private final Lock c;
+ private final byte[] d;
+ private final Lock e;
+ private final int f;
+ private IrSeekerSensor.Mode g;
+ private double h = 0.00390625D;
+ private volatile boolean i;
+
+ public HiTechnicNxtIrSeekerSensor(ModernRoboticsUsbLegacyModule var1, int var2) {
+ this.a = var1;
+ this.b = var1.getI2cReadCache(var2);
+ this.c = var1.getI2cReadCacheLock(var2);
+ this.d = var1.getI2cWriteCache(var2);
+ this.e = var1.getI2cWriteCacheLock(var2);
+ this.f = var2;
+ this.g = IrSeekerSensor.Mode.MODE_1200HZ;
+ var1.registerForI2cPortReadyCallback(this, var2);
+ this.i = true;
+ }
+
+ private double a(byte[] var1, int var2) {
+ return TypeConversion.unsignedByteToDouble(var1[var2 + 5]) / 256.0D;
+ }
+
+ private void a() {
+ this.i = true;
+ byte var1;
+ if(this.g == IrSeekerSensor.Mode.MODE_600HZ) {
+ var1 = 2;
+ } else {
+ var1 = 0;
+ }
+
+ this.a.enableI2cWriteMode(this.f, 16, 65, 1);
+
+ try {
+ this.e.lock();
+ this.d[4] = var1;
+ } finally {
+ this.e.unlock();
+ }
+
+ }
+
+ public void close() {
+ }
+
+ public double getAngle() {
+ if (this.i) {
+ return 0.0D;
+ } else {
+ double var1 = 0.0D;
+
+ try {
+ this.c.lock();
+ if (this.b[4] >= 1 && this.b[4] <= 9) {
+ var1 = DIRECTION_TO_ANGLE[this.b[4]];
+ } else {
+ var1 = 0.0D;
+ }
+ } finally {
+ this.c.unlock();
+ }
+
+ return var1;
+ }
+ }
+
+ public String getConnectionInfo() {
+ return this.a.getConnectionInfo() + "; port " + this.f;
+ }
+
+ public String getDeviceName() {
+ return "NXT IR Seeker Sensor";
+ }
+
+ public int getI2cAddress() {
+ return 16;
+ }
+
+ public void setI2cAddress(int var1) {
+ throw new UnsupportedOperationException("This method is not supported.");
+ }
+
+ public IrSeekerIndividualSensor[] getIndividualSensors() {
+ IrSeekerIndividualSensor[] var1 = new IrSeekerIndividualSensor[9];
+ if (this.i) {
+ return var1;
+ } else {
+ try {
+ this.c.lock();
+
+ for (int var2 = 0; var2 < 9; ++var2) {
+ double var3 = DIRECTION_TO_ANGLE[var2 * 2 + 1];
+ double var5 = this.a(this.b, var2);
+ var1[var2] = new IrSeekerIndividualSensor(var3, var5);
+ }
+ } finally {
+ this.c.unlock();
+ }
+
+ return var1;
+ }
+ }
+
+ public IrSeekerSensor.Mode getMode() {
+ return this.g;
+ }
+
+ public void setMode(IrSeekerSensor.Mode var1) {
+ if (this.g != var1) {
+ this.g = var1;
+ this.a();
+ }
+ }
+
+ public double getSignalDetectedThreshold() {
+ return this.h;
+ }
+
+ public void setSignalDetectedThreshold(double var1) {
+ this.h = var1;
+ }
+
+ public double getStrength() {
+ if (this.i) {
+ return 0.0D;
+ } else {
+ double var1 = 0.0D;
+
+ try {
+ this.c.lock();
+
+ for (int var3 = 0; var3 < 9; ++var3) {
+ var1 = Math.max(var1, this.a(this.b, var3));
+ }
+ } finally {
+ this.c.unlock();
+ }
+
+ return var1;
+ }
+ }
+
+ public int getVersion() {
+ return 2;
+ }
+
+ public void portIsReady(int var1) {
+ this.a.setI2cPortActionFlag(this.f);
+ this.a.readI2cCacheFromController(this.f);
+ if(this.i) {
+ if(this.g == IrSeekerSensor.Mode.MODE_600HZ) {
+ this.a.enableI2cReadMode(this.f, 16, 66, 6);
+ } else {
+ this.a.enableI2cReadMode(this.f, 16, 73, 6);
+ }
+
+ this.a.writeI2cCacheToController(this.f);
+ this.i = false;
+ } else {
+ this.a.writeI2cPortFlagOnlyToController(this.f);
+ }
+ }
+
+ public boolean signalDetected() {
+ boolean var1 = true;
+ if(this.i) {
+ return false;
+ } else {
+ boolean var6 = false;
+
+ byte var3;
+ try {
+ var6 = true;
+ this.c.lock();
+ var3 = this.b[4];
+ var6 = false;
+ } finally {
+ if(var6) {
+ this.c.unlock();
+ }
+ }
+
+ boolean var4;
+ if(var3 != 0) {
+ var4 = var1;
+ } else {
+ var4 = false;
+ }
+
+ this.c.unlock();
+ if(!var4 || this.getStrength() <= this.h) {
+ var1 = false;
+ }
+
+ return var1;
+ }
+ }
+}
diff --git a/FtcRobotController/app/src/main/java/com/qualcomm/hardware/HiTechnicNxtLightSensor.java b/FtcRobotController/Hardware/src/main/java/com/qualcomm/hardware/HiTechnicNxtLightSensor.java
similarity index 88%
rename from FtcRobotController/app/src/main/java/com/qualcomm/hardware/HiTechnicNxtLightSensor.java
rename to FtcRobotController/Hardware/src/main/java/com/qualcomm/hardware/HiTechnicNxtLightSensor.java
index 29bec25..0ea4c0d 100644
--- a/FtcRobotController/app/src/main/java/com/qualcomm/hardware/HiTechnicNxtLightSensor.java
+++ b/FtcRobotController/Hardware/src/main/java/com/qualcomm/hardware/HiTechnicNxtLightSensor.java
@@ -1,50 +1,49 @@
-package com.qualcomm.hardware;
-
-import com.qualcomm.hardware.ModernRoboticsUsbLegacyModule;
-import com.qualcomm.robotcore.hardware.LightSensor;
-import com.qualcomm.robotcore.util.Range;
-import com.qualcomm.robotcore.util.TypeConversion;
-
-public class HiTechnicNxtLightSensor extends LightSensor {
- public static final byte LED_DIGITAL_LINE_NUMBER;
- private final ModernRoboticsUsbLegacyModule a;
- private final int b;
-
- HiTechnicNxtLightSensor(ModernRoboticsUsbLegacyModule var1, int var2) {
- var1.enableAnalogReadMode(var2);
- this.a = var1;
- this.b = var2;
- }
-
- public void close() {
- }
-
- public void enableLed(boolean var1) {
- this.a.setDigitalLine(this.b, 0, var1);
- }
-
- public String getConnectionInfo() {
- return this.a.getConnectionInfo() + "; port " + this.b;
- }
-
- public String getDeviceName() {
- return "NXT Light Sensor";
- }
-
- public double getLightDetected() {
- return Range.scale((double)this.a.readAnalog(this.b)[0], -128.0D, 127.0D, 0.0D, 1.0D);
- }
-
- public int getLightDetectedRaw() {
- return TypeConversion.unsignedByteToInt(this.a.readAnalog(this.b)[0]);
- }
-
- public int getVersion() {
- return 1;
- }
-
- public String status() {
- Object[] var1 = new Object[]{this.a.getSerialNumber().toString(), Integer.valueOf(this.b)};
- return String.format("NXT Light Sensor, connected via device %s, port %d", var1);
- }
-}
+package com.qualcomm.hardware;
+
+import com.qualcomm.robotcore.hardware.LightSensor;
+import com.qualcomm.robotcore.util.Range;
+import com.qualcomm.robotcore.util.TypeConversion;
+
+public class HiTechnicNxtLightSensor extends LightSensor {
+ public static final byte LED_DIGITAL_LINE_NUMBER = 0;
+ private final ModernRoboticsUsbLegacyModule a;
+ private final int b;
+
+ HiTechnicNxtLightSensor(ModernRoboticsUsbLegacyModule var1, int var2) {
+ var1.enableAnalogReadMode(var2);
+ this.a = var1;
+ this.b = var2;
+ }
+
+ public void close() {
+ }
+
+ public void enableLed(boolean var1) {
+ this.a.setDigitalLine(this.b, 0, var1);
+ }
+
+ public String getConnectionInfo() {
+ return this.a.getConnectionInfo() + "; port " + this.b;
+ }
+
+ public String getDeviceName() {
+ return "NXT Light Sensor";
+ }
+
+ public double getLightDetected() {
+ return Range.scale((double)this.a.readAnalog(this.b)[0], -128.0D, 127.0D, 0.0D, 1.0D);
+ }
+
+ public int getLightDetectedRaw() {
+ return TypeConversion.unsignedByteToInt(this.a.readAnalog(this.b)[0]);
+ }
+
+ public int getVersion() {
+ return 1;
+ }
+
+ public String status() {
+ Object[] var1 = new Object[]{this.a.getSerialNumber().toString(), Integer.valueOf(this.b)};
+ return String.format("NXT Light Sensor, connected via device %s, port %d", var1);
+ }
+}
diff --git a/FtcRobotController/app/src/main/java/com/qualcomm/hardware/HiTechnicNxtServoController.java b/FtcRobotController/Hardware/src/main/java/com/qualcomm/hardware/HiTechnicNxtServoController.java
similarity index 95%
rename from FtcRobotController/app/src/main/java/com/qualcomm/hardware/HiTechnicNxtServoController.java
rename to FtcRobotController/Hardware/src/main/java/com/qualcomm/hardware/HiTechnicNxtServoController.java
index 9b5d504..6d8d5ce 100644
--- a/FtcRobotController/app/src/main/java/com/qualcomm/hardware/HiTechnicNxtServoController.java
+++ b/FtcRobotController/Hardware/src/main/java/com/qualcomm/hardware/HiTechnicNxtServoController.java
@@ -1,131 +1,131 @@
-package com.qualcomm.hardware;
-
-import com.qualcomm.hardware.ModernRoboticsUsbLegacyModule;
-import com.qualcomm.robotcore.hardware.I2cController;
-import com.qualcomm.robotcore.hardware.ServoController;
-import com.qualcomm.robotcore.util.ElapsedTime;
-import com.qualcomm.robotcore.util.Range;
-import java.util.concurrent.locks.Lock;
-
-public class HiTechnicNxtServoController implements I2cController.I2cPortReadyCallback, ServoController {
- public static final int I2C_ADDRESS = 2;
- public static final int MAX_SERVOS = 6;
- public static final int MEM_READ_LENGTH = 7;
- public static final int MEM_START_ADDRESS = 66;
- public static final int OFFSET_PWM = 10;
- public static final int OFFSET_SERVO1_POSITION = 4;
- public static final int OFFSET_SERVO2_POSITION = 5;
- public static final int OFFSET_SERVO3_POSITION = 6;
- public static final int OFFSET_SERVO4_POSITION = 7;
- public static final int OFFSET_SERVO5_POSITION = 8;
- public static final int OFFSET_SERVO6_POSITION = 9;
- public static final byte[] OFFSET_SERVO_MAP = new byte[]{(byte)-1, (byte)4, (byte)5, (byte)6, (byte)7, (byte)8, (byte)9};
- public static final int OFFSET_UNUSED = -1;
- public static final byte PWM_DISABLE = -1;
- public static final byte PWM_ENABLE = 0;
- public static final byte PWM_ENABLE_WITHOUT_TIMEOUT = -86;
- public static final int SERVO_POSITION_MAX = 255;
- private final ModernRoboticsUsbLegacyModule a;
- private final byte[] b;
- private final Lock c;
- private final int d;
- private ElapsedTime e = new ElapsedTime(0L);
- private volatile boolean f = true;
-
- public HiTechnicNxtServoController(ModernRoboticsUsbLegacyModule var1, int var2) {
- this.a = var1;
- this.d = var2;
- this.b = var1.getI2cWriteCache(var2);
- this.c = var1.getI2cWriteCacheLock(var2);
- var1.enableI2cWriteMode(var2, 2, 66, 7);
- this.pwmDisable();
- var1.setI2cPortActionFlag(var2);
- var1.writeI2cCacheToController(var2);
- var1.registerForI2cPortReadyCallback(this, var2);
- }
-
- private void a(int var1) {
- if(var1 < 1 || var1 > OFFSET_SERVO_MAP.length) {
- Object[] var2 = new Object[]{Integer.valueOf(var1), Integer.valueOf(6)};
- throw new IllegalArgumentException(String.format("Channel %d is invalid; valid channels are 1..%d", var2));
- }
- }
-
- public void close() {
- this.pwmDisable();
- }
-
- public String getConnectionInfo() {
- return this.a.getConnectionInfo() + "; port " + this.d;
- }
-
- public String getDeviceName() {
- return "NXT Servo Controller";
- }
-
- public ServoController.PwmStatus getPwmStatus() {
- return ServoController.PwmStatus.DISABLED;
- }
-
- public double getServoPosition(int var1) {
- return 0.0D;
- }
-
- public int getVersion() {
- return 1;
- }
-
- public void portIsReady(int var1) {
- if(this.f || this.e.time() > 5.0D) {
- this.a.setI2cPortActionFlag(this.d);
- this.a.writeI2cCacheToController(this.d);
- this.e.reset();
- }
-
- this.f = false;
- }
-
- public void pwmDisable() {
- try {
- this.c.lock();
- if(-1 != this.b[10]) {
- this.b[10] = -1;
- this.f = true;
- }
- } finally {
- this.c.unlock();
- }
-
- }
-
- public void pwmEnable() {
- try {
- this.c.lock();
- if(this.b[10] != 0) {
- this.b[10] = 0;
- this.f = true;
- }
- } finally {
- this.c.unlock();
- }
-
- }
-
- public void setServoPosition(int var1, double var2) {
- this.a(var1);
- Range.throwIfRangeIsInvalid(var2, 0.0D, 1.0D);
- byte var4 = (byte)((int)(255.0D * var2));
-
- try {
- this.c.lock();
- if(var4 != this.b[OFFSET_SERVO_MAP[var1]]) {
- this.f = true;
- this.b[OFFSET_SERVO_MAP[var1]] = var4;
- this.b[10] = 0;
- }
- } finally {
- this.c.unlock();
- }
-
- }
-}
+package com.qualcomm.hardware;
+
+import com.qualcomm.robotcore.hardware.I2cController;
+import com.qualcomm.robotcore.hardware.ServoController;
+import com.qualcomm.robotcore.util.ElapsedTime;
+import com.qualcomm.robotcore.util.Range;
+
+import java.util.concurrent.locks.Lock;
+
+public class HiTechnicNxtServoController implements I2cController.I2cPortReadyCallback, ServoController {
+ public static final int I2C_ADDRESS = 2;
+ public static final int MAX_SERVOS = 6;
+ public static final int MEM_READ_LENGTH = 7;
+ public static final int MEM_START_ADDRESS = 66;
+ public static final int OFFSET_PWM = 10;
+ public static final int OFFSET_SERVO1_POSITION = 4;
+ public static final int OFFSET_SERVO2_POSITION = 5;
+ public static final int OFFSET_SERVO3_POSITION = 6;
+ public static final int OFFSET_SERVO4_POSITION = 7;
+ public static final int OFFSET_SERVO5_POSITION = 8;
+ public static final int OFFSET_SERVO6_POSITION = 9;
+ public static final byte[] OFFSET_SERVO_MAP = new byte[]{(byte)-1, (byte)4, (byte)5, (byte)6, (byte)7, (byte)8, (byte)9};
+ public static final int OFFSET_UNUSED = -1;
+ public static final byte PWM_DISABLE = -1;
+ public static final byte PWM_ENABLE = 0;
+ public static final byte PWM_ENABLE_WITHOUT_TIMEOUT = -86;
+ public static final int SERVO_POSITION_MAX = 255;
+ private final ModernRoboticsUsbLegacyModule a;
+ private final byte[] b;
+ private final Lock c;
+ private final int d;
+ private ElapsedTime e = new ElapsedTime(0L);
+ private volatile boolean f = true;
+
+ public HiTechnicNxtServoController(ModernRoboticsUsbLegacyModule var1, int var2) {
+ this.a = var1;
+ this.d = var2;
+ this.b = var1.getI2cWriteCache(var2);
+ this.c = var1.getI2cWriteCacheLock(var2);
+ var1.enableI2cWriteMode(var2, 2, 66, 7);
+ this.pwmDisable();
+ var1.setI2cPortActionFlag(var2);
+ var1.writeI2cCacheToController(var2);
+ var1.registerForI2cPortReadyCallback(this, var2);
+ }
+
+ private void a(int var1) {
+ if(var1 < 1 || var1 > OFFSET_SERVO_MAP.length) {
+ Object[] var2 = new Object[]{Integer.valueOf(var1), Integer.valueOf(6)};
+ throw new IllegalArgumentException(String.format("Channel %d is invalid; valid channels are 1..%d", var2));
+ }
+ }
+
+ public void close() {
+ this.pwmDisable();
+ }
+
+ public String getConnectionInfo() {
+ return this.a.getConnectionInfo() + "; port " + this.d;
+ }
+
+ public String getDeviceName() {
+ return "NXT Servo Controller";
+ }
+
+ public ServoController.PwmStatus getPwmStatus() {
+ return ServoController.PwmStatus.DISABLED;
+ }
+
+ public double getServoPosition(int var1) {
+ return 0.0D;
+ }
+
+ public int getVersion() {
+ return 1;
+ }
+
+ public void portIsReady(int var1) {
+ if(this.f || this.e.time() > 5.0D) {
+ this.a.setI2cPortActionFlag(this.d);
+ this.a.writeI2cCacheToController(this.d);
+ this.e.reset();
+ }
+
+ this.f = false;
+ }
+
+ public void pwmDisable() {
+ try {
+ this.c.lock();
+ if(-1 != this.b[10]) {
+ this.b[10] = -1;
+ this.f = true;
+ }
+ } finally {
+ this.c.unlock();
+ }
+
+ }
+
+ public void pwmEnable() {
+ try {
+ this.c.lock();
+ if(this.b[10] != 0) {
+ this.b[10] = 0;
+ this.f = true;
+ }
+ } finally {
+ this.c.unlock();
+ }
+
+ }
+
+ public void setServoPosition(int var1, double var2) {
+ this.a(var1);
+ Range.throwIfRangeIsInvalid(var2, 0.0D, 1.0D);
+ byte var4 = (byte)((int)(255.0D * var2));
+
+ try {
+ this.c.lock();
+ if(var4 != this.b[OFFSET_SERVO_MAP[var1]]) {
+ this.f = true;
+ this.b[OFFSET_SERVO_MAP[var1]] = var4;
+ this.b[10] = 0;
+ }
+ } finally {
+ this.c.unlock();
+ }
+
+ }
+}
diff --git a/FtcRobotController/app/src/main/java/com/qualcomm/hardware/HiTechnicNxtTouchSensor.java b/FtcRobotController/Hardware/src/main/java/com/qualcomm/hardware/HiTechnicNxtTouchSensor.java
similarity index 91%
rename from FtcRobotController/app/src/main/java/com/qualcomm/hardware/HiTechnicNxtTouchSensor.java
rename to FtcRobotController/Hardware/src/main/java/com/qualcomm/hardware/HiTechnicNxtTouchSensor.java
index 95e04c1..f641efa 100644
--- a/FtcRobotController/app/src/main/java/com/qualcomm/hardware/HiTechnicNxtTouchSensor.java
+++ b/FtcRobotController/Hardware/src/main/java/com/qualcomm/hardware/HiTechnicNxtTouchSensor.java
@@ -1,45 +1,45 @@
-package com.qualcomm.hardware;
-
-import com.qualcomm.hardware.ModernRoboticsUsbLegacyModule;
-import com.qualcomm.robotcore.hardware.TouchSensor;
-import com.qualcomm.robotcore.util.TypeConversion;
-import java.nio.ByteOrder;
-
-public class HiTechnicNxtTouchSensor extends TouchSensor {
- private final ModernRoboticsUsbLegacyModule a;
- private final int b;
-
- public HiTechnicNxtTouchSensor(ModernRoboticsUsbLegacyModule var1, int var2) {
- var1.enableAnalogReadMode(var2);
- this.a = var1;
- this.b = var2;
- }
-
- public void close() {
- }
-
- public String getConnectionInfo() {
- return this.a.getConnectionInfo() + "; port " + this.b;
- }
-
- public String getDeviceName() {
- return "NXT Touch Sensor";
- }
-
- public double getValue() {
- return (double)TypeConversion.byteArrayToShort(this.a.readAnalog(this.b), ByteOrder.LITTLE_ENDIAN) > 675.0D?0.0D:1.0D;
- }
-
- public int getVersion() {
- return 1;
- }
-
- public boolean isPressed() {
- return this.getValue() > 0.0D;
- }
-
- public String status() {
- Object[] var1 = new Object[]{this.a.getSerialNumber().toString(), Integer.valueOf(this.b)};
- return String.format("NXT Touch Sensor, connected via device %s, port %d", var1);
- }
-}
+package com.qualcomm.hardware;
+
+import com.qualcomm.robotcore.hardware.TouchSensor;
+import com.qualcomm.robotcore.util.TypeConversion;
+
+import java.nio.ByteOrder;
+
+public class HiTechnicNxtTouchSensor extends TouchSensor {
+ private final ModernRoboticsUsbLegacyModule a;
+ private final int b;
+
+ public HiTechnicNxtTouchSensor(ModernRoboticsUsbLegacyModule var1, int var2) {
+ var1.enableAnalogReadMode(var2);
+ this.a = var1;
+ this.b = var2;
+ }
+
+ public void close() {
+ }
+
+ public String getConnectionInfo() {
+ return this.a.getConnectionInfo() + "; port " + this.b;
+ }
+
+ public String getDeviceName() {
+ return "NXT Touch Sensor";
+ }
+
+ public double getValue() {
+ return (double)TypeConversion.byteArrayToShort(this.a.readAnalog(this.b), ByteOrder.LITTLE_ENDIAN) > 675.0D?0.0D:1.0D;
+ }
+
+ public int getVersion() {
+ return 1;
+ }
+
+ public boolean isPressed() {
+ return this.getValue() > 0.0D;
+ }
+
+ public String status() {
+ Object[] var1 = new Object[]{this.a.getSerialNumber().toString(), Integer.valueOf(this.b)};
+ return String.format("NXT Touch Sensor, connected via device %s, port %d", var1);
+ }
+}
diff --git a/FtcRobotController/app/src/main/java/com/qualcomm/hardware/HiTechnicNxtTouchSensorMultiplexer.java b/FtcRobotController/Hardware/src/main/java/com/qualcomm/hardware/HiTechnicNxtTouchSensorMultiplexer.java
similarity index 94%
rename from FtcRobotController/app/src/main/java/com/qualcomm/hardware/HiTechnicNxtTouchSensorMultiplexer.java
rename to FtcRobotController/Hardware/src/main/java/com/qualcomm/hardware/HiTechnicNxtTouchSensorMultiplexer.java
index 7e26991..6e049b9 100644
--- a/FtcRobotController/app/src/main/java/com/qualcomm/hardware/HiTechnicNxtTouchSensorMultiplexer.java
+++ b/FtcRobotController/Hardware/src/main/java/com/qualcomm/hardware/HiTechnicNxtTouchSensorMultiplexer.java
@@ -1,65 +1,65 @@
-package com.qualcomm.hardware;
-
-import com.qualcomm.hardware.ModernRoboticsUsbLegacyModule;
-import com.qualcomm.robotcore.hardware.TouchSensorMultiplexer;
-import com.qualcomm.robotcore.util.TypeConversion;
-import java.nio.ByteOrder;
-
-public class HiTechnicNxtTouchSensorMultiplexer extends TouchSensorMultiplexer {
- public static final int INVALID = -1;
- public static final int[] MASK_MAP = new int[]{-1, 1, 2, 4, 8};
- public static final int MASK_TOUCH_SENSOR_1 = 1;
- public static final int MASK_TOUCH_SENSOR_2 = 2;
- public static final int MASK_TOUCH_SENSOR_3 = 4;
- public static final int MASK_TOUCH_SENSOR_4 = 8;
- int a = 4;
- private final ModernRoboticsUsbLegacyModule b;
- private final int c;
-
- public HiTechnicNxtTouchSensorMultiplexer(ModernRoboticsUsbLegacyModule var1, int var2) {
- var1.enableAnalogReadMode(var2);
- this.b = var1;
- this.c = var2;
- }
-
- private int a() {
- int var1 = 1023 - TypeConversion.byteArrayToShort(this.b.readAnalog(3), ByteOrder.LITTLE_ENDIAN);
- return (5 + var1 * 339 / (1023 - var1)) / 10;
- }
-
- private void a(int var1) {
- if(var1 <= 0 || var1 > this.a) {
- Object[] var2 = new Object[]{Integer.valueOf(var1), Integer.valueOf(this.a)};
- throw new IllegalArgumentException(String.format("Channel %d is invalid; valid channels are 1..%d", var2));
- }
- }
-
- public void close() {
- }
-
- public String getConnectionInfo() {
- return this.b.getConnectionInfo() + "; port " + this.c;
- }
-
- public String getDeviceName() {
- return "NXT Touch Sensor Multiplexer";
- }
-
- public int getSwitches() {
- return this.a();
- }
-
- public int getVersion() {
- return 1;
- }
-
- public boolean isTouchSensorPressed(int var1) {
- this.a(var1);
- return (this.a() & MASK_MAP[var1]) > 0;
- }
-
- public String status() {
- Object[] var1 = new Object[]{this.b.getSerialNumber().toString(), Integer.valueOf(this.c)};
- return String.format("NXT Touch Sensor Multiplexer, connected via device %s, port %d", var1);
- }
-}
+package com.qualcomm.hardware;
+
+import com.qualcomm.robotcore.hardware.TouchSensorMultiplexer;
+import com.qualcomm.robotcore.util.TypeConversion;
+
+import java.nio.ByteOrder;
+
+public class HiTechnicNxtTouchSensorMultiplexer extends TouchSensorMultiplexer {
+ public static final int INVALID = -1;
+ public static final int[] MASK_MAP = new int[]{-1, 1, 2, 4, 8};
+ public static final int MASK_TOUCH_SENSOR_1 = 1;
+ public static final int MASK_TOUCH_SENSOR_2 = 2;
+ public static final int MASK_TOUCH_SENSOR_3 = 4;
+ public static final int MASK_TOUCH_SENSOR_4 = 8;
+ int a = 4;
+ private final ModernRoboticsUsbLegacyModule b;
+ private final int c;
+
+ public HiTechnicNxtTouchSensorMultiplexer(ModernRoboticsUsbLegacyModule var1, int var2) {
+ var1.enableAnalogReadMode(var2);
+ this.b = var1;
+ this.c = var2;
+ }
+
+ private int a() {
+ int var1 = 1023 - TypeConversion.byteArrayToShort(this.b.readAnalog(3), ByteOrder.LITTLE_ENDIAN);
+ return (5 + var1 * 339 / (1023 - var1)) / 10;
+ }
+
+ private void a(int var1) {
+ if(var1 <= 0 || var1 > this.a) {
+ Object[] var2 = new Object[]{Integer.valueOf(var1), Integer.valueOf(this.a)};
+ throw new IllegalArgumentException(String.format("Channel %d is invalid; valid channels are 1..%d", var2));
+ }
+ }
+
+ public void close() {
+ }
+
+ public String getConnectionInfo() {
+ return this.b.getConnectionInfo() + "; port " + this.c;
+ }
+
+ public String getDeviceName() {
+ return "NXT Touch Sensor Multiplexer";
+ }
+
+ public int getSwitches() {
+ return this.a();
+ }
+
+ public int getVersion() {
+ return 1;
+ }
+
+ public boolean isTouchSensorPressed(int var1) {
+ this.a(var1);
+ return (this.a() & MASK_MAP[var1]) > 0;
+ }
+
+ public String status() {
+ Object[] var1 = new Object[]{this.b.getSerialNumber().toString(), Integer.valueOf(this.c)};
+ return String.format("NXT Touch Sensor Multiplexer, connected via device %s, port %d", var1);
+ }
+}
diff --git a/FtcRobotController/app/src/main/java/com/qualcomm/hardware/HiTechnicNxtUltrasonicSensor.java b/FtcRobotController/Hardware/src/main/java/com/qualcomm/hardware/HiTechnicNxtUltrasonicSensor.java
similarity index 94%
rename from FtcRobotController/app/src/main/java/com/qualcomm/hardware/HiTechnicNxtUltrasonicSensor.java
rename to FtcRobotController/Hardware/src/main/java/com/qualcomm/hardware/HiTechnicNxtUltrasonicSensor.java
index 3c70017..ee359d5 100644
--- a/FtcRobotController/app/src/main/java/com/qualcomm/hardware/HiTechnicNxtUltrasonicSensor.java
+++ b/FtcRobotController/Hardware/src/main/java/com/qualcomm/hardware/HiTechnicNxtUltrasonicSensor.java
@@ -1,77 +1,77 @@
-package com.qualcomm.hardware;
-
-import com.qualcomm.hardware.ModernRoboticsUsbLegacyModule;
-import com.qualcomm.robotcore.hardware.I2cController;
-import com.qualcomm.robotcore.hardware.UltrasonicSensor;
-import com.qualcomm.robotcore.util.TypeConversion;
-import java.util.concurrent.locks.Lock;
-
-public class HiTechnicNxtUltrasonicSensor extends UltrasonicSensor implements I2cController.I2cPortReadyCallback {
- public static final int ADDRESS_DISTANCE = 66;
- public static final int I2C_ADDRESS = 2;
- public static final int MAX_PORT = 5;
- public static final int MIN_PORT = 4;
- Lock a;
- byte[] b;
- private final ModernRoboticsUsbLegacyModule c;
- private final int d;
-
- HiTechnicNxtUltrasonicSensor(ModernRoboticsUsbLegacyModule var1, int var2) {
- this.a(var2);
- this.c = var1;
- this.d = var2;
- this.a = var1.getI2cReadCacheLock(var2);
- this.b = var1.getI2cReadCache(var2);
- var1.enableI2cReadMode(var2, 2, 66, 1);
- var1.enable9v(var2, true);
- var1.setI2cPortActionFlag(var2);
- var1.readI2cCacheFromController(var2);
- var1.registerForI2cPortReadyCallback(this, var2);
- }
-
- private void a(int var1) {
- if(var1 < 4 || var1 > 5) {
- String var2 = "Port %d is invalid for " + this.getDeviceName() + "; valid ports are %d or %d";
- Object[] var3 = new Object[]{Integer.valueOf(var1), Integer.valueOf(4), Integer.valueOf(5)};
- throw new IllegalArgumentException(String.format(var2, var3));
- }
- }
-
- public void close() {
- }
-
- public String getConnectionInfo() {
- return this.c.getConnectionInfo() + "; port " + this.d;
- }
-
- public String getDeviceName() {
- return "NXT Ultrasonic Sensor";
- }
-
- public double getUltrasonicLevel() {
- byte var2;
- try {
- this.a.lock();
- var2 = this.b[4];
- } finally {
- this.a.unlock();
- }
-
- return TypeConversion.unsignedByteToDouble(var2);
- }
-
- public int getVersion() {
- return 1;
- }
-
- public void portIsReady(int var1) {
- this.c.setI2cPortActionFlag(this.d);
- this.c.writeI2cCacheToController(this.d);
- this.c.readI2cCacheFromController(this.d);
- }
-
- public String status() {
- Object[] var1 = new Object[]{this.c.getSerialNumber().toString(), Integer.valueOf(this.d)};
- return String.format("NXT Ultrasonic Sensor, connected via device %s, port %d", var1);
- }
-}
+package com.qualcomm.hardware;
+
+import com.qualcomm.robotcore.hardware.I2cController;
+import com.qualcomm.robotcore.hardware.UltrasonicSensor;
+import com.qualcomm.robotcore.util.TypeConversion;
+
+import java.util.concurrent.locks.Lock;
+
+public class HiTechnicNxtUltrasonicSensor extends UltrasonicSensor implements I2cController.I2cPortReadyCallback {
+ public static final int ADDRESS_DISTANCE = 66;
+ public static final int I2C_ADDRESS = 2;
+ public static final int MAX_PORT = 5;
+ public static final int MIN_PORT = 4;
+ Lock a;
+ byte[] b;
+ private final ModernRoboticsUsbLegacyModule c;
+ private final int d;
+
+ HiTechnicNxtUltrasonicSensor(ModernRoboticsUsbLegacyModule var1, int var2) {
+ this.a(var2);
+ this.c = var1;
+ this.d = var2;
+ this.a = var1.getI2cReadCacheLock(var2);
+ this.b = var1.getI2cReadCache(var2);
+ var1.enableI2cReadMode(var2, 2, 66, 1);
+ var1.enable9v(var2, true);
+ var1.setI2cPortActionFlag(var2);
+ var1.readI2cCacheFromController(var2);
+ var1.registerForI2cPortReadyCallback(this, var2);
+ }
+
+ private void a(int var1) {
+ if(var1 < 4 || var1 > 5) {
+ String var2 = "Port %d is invalid for " + this.getDeviceName() + "; valid ports are %d or %d";
+ Object[] var3 = new Object[]{Integer.valueOf(var1), Integer.valueOf(4), Integer.valueOf(5)};
+ throw new IllegalArgumentException(String.format(var2, var3));
+ }
+ }
+
+ public void close() {
+ }
+
+ public String getConnectionInfo() {
+ return this.c.getConnectionInfo() + "; port " + this.d;
+ }
+
+ public String getDeviceName() {
+ return "NXT Ultrasonic Sensor";
+ }
+
+ public double getUltrasonicLevel() {
+ byte var2;
+ try {
+ this.a.lock();
+ var2 = this.b[4];
+ } finally {
+ this.a.unlock();
+ }
+
+ return TypeConversion.unsignedByteToDouble(var2);
+ }
+
+ public int getVersion() {
+ return 1;
+ }
+
+ public void portIsReady(int var1) {
+ this.c.setI2cPortActionFlag(this.d);
+ this.c.writeI2cCacheToController(this.d);
+ this.c.readI2cCacheFromController(this.d);
+ }
+
+ public String status() {
+ Object[] var1 = new Object[]{this.c.getSerialNumber().toString(), Integer.valueOf(this.d)};
+ return String.format("NXT Ultrasonic Sensor, connected via device %s, port %d", var1);
+ }
+}
diff --git a/FtcRobotController/app/src/main/java/com/qualcomm/hardware/MatrixDcMotorController.java b/FtcRobotController/Hardware/src/main/java/com/qualcomm/hardware/MatrixDcMotorController.java
similarity index 89%
rename from FtcRobotController/app/src/main/java/com/qualcomm/hardware/MatrixDcMotorController.java
rename to FtcRobotController/Hardware/src/main/java/com/qualcomm/hardware/MatrixDcMotorController.java
index 10daf3b..0efaa77 100644
--- a/FtcRobotController/app/src/main/java/com/qualcomm/hardware/MatrixDcMotorController.java
+++ b/FtcRobotController/Hardware/src/main/java/com/qualcomm/hardware/MatrixDcMotorController.java
@@ -1,246 +1,241 @@
-package com.qualcomm.hardware;
-
-import com.qualcomm.hardware.MatrixI2cTransaction;
-import com.qualcomm.hardware.MatrixMasterController;
-import com.qualcomm.robotcore.hardware.DcMotor;
-import com.qualcomm.robotcore.hardware.DcMotorController;
-import com.qualcomm.robotcore.util.Range;
-import com.qualcomm.robotcore.util.RobotLog;
-import com.qualcomm.robotcore.util.TypeConversion;
-import java.util.Arrays;
-import java.util.Iterator;
-import java.util.Set;
-
-public class MatrixDcMotorController implements DcMotorController {
- public static final byte POWER_MAX = 100;
- public static final byte POWER_MIN = -100;
- private MatrixDcMotorController.a[] a;
- private int b;
- protected DcMotorController.DeviceMode deviceMode;
- protected MatrixMasterController master;
-
- public MatrixDcMotorController(MatrixMasterController var1) {
- MatrixDcMotorController.a[] var2 = new MatrixDcMotorController.a[]{new MatrixDcMotorController.a(), new MatrixDcMotorController.a(), new MatrixDcMotorController.a(), new MatrixDcMotorController.a(), new MatrixDcMotorController.a()};
- this.a = var2;
- this.master = var1;
- this.b = 0;
- var1.registerMotorController(this);
-
- for(byte var3 = 0; var3 < 4; ++var3) {
- var1.queueTransaction(new MatrixI2cTransaction(var3, (byte)0, 0, (byte)0));
- this.a[var3].f = DcMotorController.RunMode.RUN_WITHOUT_ENCODERS;
- this.a[var3].d = true;
- }
-
- this.deviceMode = DcMotorController.DeviceMode.READ_ONLY;
- }
-
- private void a(int var1) {
- if(var1 < 1 || var1 > 4) {
- Object[] var2 = new Object[]{Integer.valueOf(var1), Integer.valueOf(4)};
- throw new IllegalArgumentException(String.format("Motor %d is invalid; valid motors are 1..%d", var2));
- }
- }
-
- public void close() {
- this.setMotorPowerFloat(1);
- this.setMotorPowerFloat(2);
- this.setMotorPowerFloat(3);
- this.setMotorPowerFloat(4);
- }
-
- protected DcMotorController.RunMode flagMatrixToRunMode(byte var1) {
- switch(var1) {
- case 1:
- return DcMotorController.RunMode.RUN_WITHOUT_ENCODERS;
- case 2:
- return DcMotorController.RunMode.RUN_USING_ENCODERS;
- case 3:
- return DcMotorController.RunMode.RUN_TO_POSITION;
- case 4:
- return DcMotorController.RunMode.RESET_ENCODERS;
- default:
- RobotLog.e("Invalid run mode flag " + var1);
- return DcMotorController.RunMode.RUN_WITHOUT_ENCODERS;
- }
- }
-
- public int getBattery() {
- MatrixI2cTransaction var1 = new MatrixI2cTransaction((byte)0, MatrixI2cTransaction.a.d);
- if(this.master.queueTransaction(var1)) {
- this.master.waitOnRead();
- }
-
- return this.b;
- }
-
- public String getConnectionInfo() {
- return this.master.getConnectionInfo();
- }
-
- public String getDeviceName() {
- return "Matrix Motor Controller";
- }
-
- public DcMotorController.RunMode getMotorChannelMode(int var1) {
- this.a(var1);
- return this.a[var1].f;
- }
-
- public DcMotorController.DeviceMode getMotorControllerDeviceMode() {
- return this.deviceMode;
- }
-
- public int getMotorCurrentPosition(int var1) {
- this.a(var1);
- MatrixI2cTransaction var2 = new MatrixI2cTransaction((byte)var1, MatrixI2cTransaction.a.e);
- if(this.master.queueTransaction(var2)) {
- this.master.waitOnRead();
- }
-
- return this.a[var1].b;
- }
-
- public double getMotorPower(int var1) {
- this.a(var1);
- return this.a[var1].e;
- }
-
- public boolean getMotorPowerFloat(int var1) {
- this.a(var1);
- return this.a[var1].d;
- }
-
- public int getMotorTargetPosition(int var1) {
- this.a(var1);
- MatrixI2cTransaction var2 = new MatrixI2cTransaction((byte)var1, MatrixI2cTransaction.a.b);
- if(this.master.queueTransaction(var2)) {
- this.master.waitOnRead();
- }
-
- return this.a[var1].a;
- }
-
- public int getVersion() {
- return 1;
- }
-
- public void handleReadBattery(byte[] var1) {
- this.b = 40 * TypeConversion.unsignedByteToInt(var1[4]);
- RobotLog.v("Battery voltage: " + this.b + "mV");
- }
-
- public void handleReadMode(MatrixI2cTransaction var1, byte[] var2) {
- this.a[var1.motor].c = var2[4];
- RobotLog.v("Mode: " + this.a[var1.motor].c);
- }
-
- public void handleReadPosition(MatrixI2cTransaction var1, byte[] var2) {
- this.a[var1.motor].b = TypeConversion.byteArrayToInt(Arrays.copyOfRange(var2, 4, 8));
- RobotLog.v("Position motor: " + var1.motor + " " + this.a[var1.motor].b);
- }
-
- public void handleReadTargetPosition(MatrixI2cTransaction var1, byte[] var2) {
- this.a[var1.motor].a = TypeConversion.byteArrayToInt(Arrays.copyOfRange(var2, 4, 8));
- RobotLog.v("Target motor: " + var1.motor + " " + this.a[var1.motor].a);
- }
-
- public boolean isBusy(int var1) {
- MatrixI2cTransaction var2 = new MatrixI2cTransaction((byte)var1, MatrixI2cTransaction.a.a);
- this.master.queueTransaction(var2);
- this.master.waitOnRead();
- return (128 & this.a[var2.motor].c) != 0;
- }
-
- protected byte runModeToFlagMatrix(DcMotorController.RunMode var1) {
- switch(null.a[var1.ordinal()]) {
- case 1:
- return (byte)2;
- case 2:
- return (byte)1;
- case 3:
- return (byte)3;
- case 4:
- default:
- return (byte)4;
- }
- }
-
- public void setMotorChannelMode(int var1, DcMotorController.RunMode var2) {
- this.a(var1);
- if(this.a[var1].d || this.a[var1].f != var2) {
- byte var3 = this.runModeToFlagMatrix(var2);
- MatrixI2cTransaction var4 = new MatrixI2cTransaction((byte)var1, MatrixI2cTransaction.a.a, var3);
- this.master.queueTransaction(var4);
- this.a[var1].f = var2;
- if(var2 == DcMotorController.RunMode.RESET_ENCODERS) {
- this.a[var1].d = true;
- } else {
- this.a[var1].d = false;
- }
- }
- }
-
- public void setMotorControllerDeviceMode(DcMotorController.DeviceMode var1) {
- this.deviceMode = var1;
- }
-
- public void setMotorPower(int var1, double var2) {
- this.a(var1);
- Range.throwIfRangeIsInvalid(var2, -1.0D, 1.0D);
- byte var4 = (byte)((int)(100.0D * var2));
- MatrixI2cTransaction var5 = new MatrixI2cTransaction((byte)var1, var4, this.a[var1].a, this.runModeToFlagMatrix(this.a[var1].f));
- this.master.queueTransaction(var5);
- this.a[var1].e = var2;
- }
-
- public void setMotorPower(Set var1, double var2) {
- Range.throwIfRangeIsInvalid(var2, -1.0D, 1.0D);
- Iterator var4 = var1.iterator();
-
- while(var4.hasNext()) {
- DcMotor var7 = (DcMotor)var4.next();
- byte var8 = (byte)((int)(100.0D * var2));
- if(var7.getDirection() == DcMotor.Direction.REVERSE) {
- var8 *= -1;
- }
-
- int var9 = var7.getPortNumber();
- MatrixI2cTransaction var10 = new MatrixI2cTransaction((byte)var9, var8, this.a[var9].a, (byte)(8 | this.runModeToFlagMatrix(this.a[var9].f)));
- this.master.queueTransaction(var10);
- }
-
- MatrixI2cTransaction var5 = new MatrixI2cTransaction((byte)0, MatrixI2cTransaction.a.i, 1);
- this.master.queueTransaction(var5);
- }
-
- public void setMotorPowerFloat(int var1) {
- this.a(var1);
- if(!this.a[var1].d) {
- MatrixI2cTransaction var2 = new MatrixI2cTransaction((byte)var1, MatrixI2cTransaction.a.a, 4);
- this.master.queueTransaction(var2);
- }
-
- this.a[var1].d = true;
- }
-
- public void setMotorTargetPosition(int var1, int var2) {
- this.a(var1);
- MatrixI2cTransaction var3 = new MatrixI2cTransaction((byte)var1, MatrixI2cTransaction.a.b, var2);
- this.master.queueTransaction(var3);
- this.a[var1].a = var2;
- }
-
- private class a {
- public int a = 0;
- public int b = 0;
- public byte c = 0;
- public boolean d = true;
- public double e = 0.0D;
- public DcMotorController.RunMode f;
-
- public a() {
- this.f = DcMotorController.RunMode.RESET_ENCODERS;
- }
- }
-}
+package com.qualcomm.hardware;
+
+import com.qualcomm.robotcore.hardware.DcMotor;
+import com.qualcomm.robotcore.hardware.DcMotorController;
+import com.qualcomm.robotcore.util.Range;
+import com.qualcomm.robotcore.util.RobotLog;
+import com.qualcomm.robotcore.util.TypeConversion;
+
+import java.util.Arrays;
+import java.util.Iterator;
+import java.util.Set;
+
+public class MatrixDcMotorController implements DcMotorController {
+ public static final byte POWER_MAX = 100;
+ public static final byte POWER_MIN = -100;
+ protected DcMotorController.DeviceMode deviceMode;
+ protected MatrixMasterController master;
+ private MatrixDcMotorController.a[] a;
+ private int b;
+
+ public MatrixDcMotorController(MatrixMasterController var1) {
+ MatrixDcMotorController.a[] var2 = new MatrixDcMotorController.a[]{new MatrixDcMotorController.a(), new MatrixDcMotorController.a(), new MatrixDcMotorController.a(), new MatrixDcMotorController.a(), new MatrixDcMotorController.a()};
+ this.a = var2;
+ this.master = var1;
+ this.b = 0;
+ var1.registerMotorController(this);
+
+ for(byte var3 = 0; var3 < 4; ++var3) {
+ var1.queueTransaction(new MatrixI2cTransaction(var3, (byte)0, 0, (byte)0));
+ this.a[var3].f = DcMotorController.RunMode.RUN_WITHOUT_ENCODERS;
+ this.a[var3].d = true;
+ }
+
+ this.deviceMode = DcMotorController.DeviceMode.READ_ONLY;
+ }
+
+ private void a(int var1) {
+ if(var1 < 1 || var1 > 4) {
+ Object[] var2 = new Object[]{Integer.valueOf(var1), Integer.valueOf(4)};
+ throw new IllegalArgumentException(String.format("Motor %d is invalid; valid motors are 1..%d", var2));
+ }
+ }
+
+ public void close() {
+ this.setMotorPowerFloat(1);
+ this.setMotorPowerFloat(2);
+ this.setMotorPowerFloat(3);
+ this.setMotorPowerFloat(4);
+ }
+
+ protected DcMotorController.RunMode flagMatrixToRunMode(byte var1) {
+ switch(var1) {
+ case 1:
+ return DcMotorController.RunMode.RUN_WITHOUT_ENCODERS;
+ case 2:
+ return DcMotorController.RunMode.RUN_USING_ENCODERS;
+ case 3:
+ return DcMotorController.RunMode.RUN_TO_POSITION;
+ case 4:
+ return DcMotorController.RunMode.RESET_ENCODERS;
+ default:
+ RobotLog.e("Invalid run mode flag " + var1);
+ return DcMotorController.RunMode.RUN_WITHOUT_ENCODERS;
+ }
+ }
+
+ public int getBattery() {
+ MatrixI2cTransaction var1 = new MatrixI2cTransaction((byte) 0, MatrixI2cTransaction.Type1.d);
+ if(this.master.queueTransaction(var1)) {
+ this.master.waitOnRead();
+ }
+
+ return this.b;
+ }
+
+ public String getConnectionInfo() {
+ return this.master.getConnectionInfo();
+ }
+
+ public String getDeviceName() {
+ return "Matrix Motor Controller";
+ }
+
+ public DcMotorController.RunMode getMotorChannelMode(int var1) {
+ this.a(var1);
+ return this.a[var1].f;
+ }
+
+ public DcMotorController.DeviceMode getMotorControllerDeviceMode() {
+ return this.deviceMode;
+ }
+
+ public void setMotorControllerDeviceMode(DcMotorController.DeviceMode var1) {
+ this.deviceMode = var1;
+ }
+
+ public int getMotorCurrentPosition(int var1) {
+ this.a(var1);
+ MatrixI2cTransaction var2 = new MatrixI2cTransaction((byte) var1, MatrixI2cTransaction.Type1.e);
+ if(this.master.queueTransaction(var2)) {
+ this.master.waitOnRead();
+ }
+
+ return this.a[var1].b;
+ }
+
+ public double getMotorPower(int var1) {
+ this.a(var1);
+ return this.a[var1].e;
+ }
+
+ public boolean getMotorPowerFloat(int var1) {
+ this.a(var1);
+ return this.a[var1].d;
+ }
+
+ public int getMotorTargetPosition(int var1) {
+ this.a(var1);
+ MatrixI2cTransaction var2 = new MatrixI2cTransaction((byte) var1, MatrixI2cTransaction.Type1.b);
+ if(this.master.queueTransaction(var2)) {
+ this.master.waitOnRead();
+ }
+
+ return this.a[var1].a;
+ }
+
+ public int getVersion() {
+ return 1;
+ }
+
+ public void handleReadBattery(byte[] var1) {
+ this.b = 40 * TypeConversion.unsignedByteToInt(var1[4]);
+ RobotLog.v("Battery voltage: " + this.b + "mV");
+ }
+
+ public void handleReadMode(MatrixI2cTransaction var1, byte[] var2) {
+ this.a[var1.motor].c = var2[4];
+ RobotLog.v("Mode: " + this.a[var1.motor].c);
+ }
+
+ public void handleReadPosition(MatrixI2cTransaction var1, byte[] var2) {
+ this.a[var1.motor].b = TypeConversion.byteArrayToInt(Arrays.copyOfRange(var2, 4, 8));
+ RobotLog.v("Position motor: " + var1.motor + " " + this.a[var1.motor].b);
+ }
+
+ public void handleReadTargetPosition(MatrixI2cTransaction var1, byte[] var2) {
+ this.a[var1.motor].a = TypeConversion.byteArrayToInt(Arrays.copyOfRange(var2, 4, 8));
+ RobotLog.v("Target motor: " + var1.motor + " " + this.a[var1.motor].a);
+ }
+
+ public boolean isBusy(int var1) {
+ MatrixI2cTransaction var2 = new MatrixI2cTransaction((byte) var1, MatrixI2cTransaction.Type1.a);
+ this.master.queueTransaction(var2);
+ this.master.waitOnRead();
+ return (128 & this.a[var2.motor].c) != 0;
+ }
+
+ protected byte runModeToFlagMatrix(DcMotorController.RunMode var1) {
+ switch (var1.ordinal()) {
+ case 1:
+ return (byte)2;
+ case 2:
+ return (byte)1;
+ case 3:
+ return (byte)3;
+ case 4:
+ default:
+ return (byte)4;
+ }
+ }
+
+ public void setMotorChannelMode(int var1, DcMotorController.RunMode var2) {
+ this.a(var1);
+ if(this.a[var1].d || this.a[var1].f != var2) {
+ byte var3 = this.runModeToFlagMatrix(var2);
+ MatrixI2cTransaction var4 = new MatrixI2cTransaction((byte) var1, MatrixI2cTransaction.Type1.a, var3);
+ this.master.queueTransaction(var4);
+ this.a[var1].f = var2;
+ this.a[var1].d = var2 == RunMode.RESET_ENCODERS;
+ }
+ }
+
+ public void setMotorPower(int var1, double var2) {
+ this.a(var1);
+ Range.throwIfRangeIsInvalid(var2, -1.0D, 1.0D);
+ byte var4 = (byte)((int)(100.0D * var2));
+ MatrixI2cTransaction var5 = new MatrixI2cTransaction((byte)var1, var4, this.a[var1].a, this.runModeToFlagMatrix(this.a[var1].f));
+ this.master.queueTransaction(var5);
+ this.a[var1].e = var2;
+ }
+
+ public void setMotorPower(Set var1, double var2) {
+ Range.throwIfRangeIsInvalid(var2, -1.0D, 1.0D);
+ Iterator var4 = var1.iterator();
+
+ while(var4.hasNext()) {
+ DcMotor var7 = (DcMotor)var4.next();
+ byte var8 = (byte)((int)(100.0D * var2));
+ if(var7.getDirection() == DcMotor.Direction.REVERSE) {
+ var8 *= -1;
+ }
+
+ int var9 = var7.getPortNumber();
+ MatrixI2cTransaction var10 = new MatrixI2cTransaction((byte)var9, var8, this.a[var9].a, (byte)(8 | this.runModeToFlagMatrix(this.a[var9].f)));
+ this.master.queueTransaction(var10);
+ }
+
+ MatrixI2cTransaction var5 = new MatrixI2cTransaction((byte) 0, MatrixI2cTransaction.Type1.i, 1);
+ this.master.queueTransaction(var5);
+ }
+
+ public void setMotorPowerFloat(int var1) {
+ this.a(var1);
+ if(!this.a[var1].d) {
+ MatrixI2cTransaction var2 = new MatrixI2cTransaction((byte) var1, MatrixI2cTransaction.Type1.a, 4);
+ this.master.queueTransaction(var2);
+ }
+
+ this.a[var1].d = true;
+ }
+
+ public void setMotorTargetPosition(int var1, int var2) {
+ this.a(var1);
+ MatrixI2cTransaction var3 = new MatrixI2cTransaction((byte) var1, MatrixI2cTransaction.Type1.b, var2);
+ this.master.queueTransaction(var3);
+ this.a[var1].a = var2;
+ }
+
+ private class a {
+ public int a = 0;
+ public int b = 0;
+ public byte c = 0;
+ public boolean d = true;
+ public double e = 0.0D;
+ public DcMotorController.RunMode f;
+
+ public a() {
+ this.f = DcMotorController.RunMode.RESET_ENCODERS;
+ }
+ }
+}
diff --git a/FtcRobotController/app/src/main/java/com/qualcomm/hardware/MatrixI2cTransaction.java b/FtcRobotController/Hardware/src/main/java/com/qualcomm/hardware/MatrixI2cTransaction.java
similarity index 58%
rename from FtcRobotController/app/src/main/java/com/qualcomm/hardware/MatrixI2cTransaction.java
rename to FtcRobotController/Hardware/src/main/java/com/qualcomm/hardware/MatrixI2cTransaction.java
index 3394a6a..b3132a0 100644
--- a/FtcRobotController/app/src/main/java/com/qualcomm/hardware/MatrixI2cTransaction.java
+++ b/FtcRobotController/Hardware/src/main/java/com/qualcomm/hardware/MatrixI2cTransaction.java
@@ -1,127 +1,127 @@
-package com.qualcomm.hardware;
-
-import com.qualcomm.robotcore.util.RobotLog;
-
-public class MatrixI2cTransaction {
- public byte mode;
- public byte motor;
- public MatrixI2cTransaction.a property;
- public byte servo;
- public byte speed;
- public MatrixI2cTransaction.b state;
- public int target;
- public int value;
- public boolean write;
-
- MatrixI2cTransaction(byte var1, byte var2, byte var3) {
- this.servo = var1;
- this.speed = var3;
- this.target = var2;
- this.property = MatrixI2cTransaction.a.g;
- this.state = MatrixI2cTransaction.b.a;
- this.write = true;
- }
-
- MatrixI2cTransaction(byte var1, byte var2, int var3, byte var4) {
- this.motor = var1;
- this.speed = var2;
- this.target = var3;
- this.mode = var4;
- this.property = MatrixI2cTransaction.a.f;
- this.state = MatrixI2cTransaction.b.a;
- this.write = true;
- }
-
- MatrixI2cTransaction(byte var1, MatrixI2cTransaction.a var2) {
- this.motor = var1;
- this.property = var2;
- this.state = MatrixI2cTransaction.b.a;
- this.write = false;
- }
-
- MatrixI2cTransaction(byte var1, MatrixI2cTransaction.a var2, int var3) {
- this.motor = var1;
- this.value = var3;
- this.property = var2;
- this.state = MatrixI2cTransaction.b.a;
- this.write = true;
- }
-
- public boolean isEqual(MatrixI2cTransaction var1) {
- boolean var2 = true;
- if(this.property != var1.property) {
- var2 = false;
- } else {
- switch(null.a[this.property.ordinal()]) {
- case 1:
- case 2:
- case 3:
- case 4:
- case 5:
- case 6:
- case 7:
- if(this.write == var1.write && this.motor == var1.motor && this.value == var1.value) {
- break;
- }
-
- return false;
- case 8:
- if(this.write == var1.write && this.motor == var1.motor && this.speed == var1.speed && this.target == var1.target && this.mode == var1.mode) {
- break;
- }
-
- return false;
- case 9:
- if(this.write == var1.write && this.servo == var1.servo && this.speed == var1.speed && this.target == var1.target) {
- break;
- }
-
- return false;
- case 10:
- if(this.write == var1.write && this.value == var1.value) {
- break;
- }
-
- return false;
- default:
- RobotLog.e("Can not compare against unknown transaction property " + var1.toString());
- return false;
- }
- }
-
- return var2;
- }
-
- public String toString() {
- return this.property == MatrixI2cTransaction.a.f?"Matrix motor transaction: " + this.property + " motor " + this.motor + " write " + this.write + " speed " + this.speed + " target " + this.target + " mode " + this.mode:(this.property == MatrixI2cTransaction.a.g?"Matrix servo transaction: " + this.property + " servo " + this.servo + " write " + this.write + " change rate " + this.speed + " target " + this.target:(this.property == MatrixI2cTransaction.a.h?"Matrix servo transaction: " + this.property + " servo " + this.servo + " write " + this.write + " value " + this.value:"Matrix motor transaction: " + this.property + " motor " + this.motor + " write " + this.write + " value " + this.value));
- }
-
- static enum a {
- a,
- b,
- c,
- d,
- e,
- f,
- g,
- h,
- i,
- j;
-
- static {
- MatrixI2cTransaction.a[] var0 = new MatrixI2cTransaction.a[]{a, b, c, d, e, f, g, h, i, j};
- }
- }
-
- static enum b {
- a,
- b,
- c,
- d,
- e;
-
- static {
- MatrixI2cTransaction.b[] var0 = new MatrixI2cTransaction.b[]{a, b, c, d, e};
- }
- }
-}
+package com.qualcomm.hardware;
+
+import com.qualcomm.robotcore.util.RobotLog;
+
+public class MatrixI2cTransaction {
+ public byte mode;
+ public byte motor;
+ public Type1 property;
+ public byte servo;
+ public byte speed;
+ public Type2 state;
+ public int target;
+ public int value;
+ public boolean write;
+
+ MatrixI2cTransaction(byte var1, byte var2, byte var3) {
+ this.servo = var1;
+ this.speed = var3;
+ this.target = var2;
+ this.property = Type1.g;
+ this.state = Type2.a;
+ this.write = true;
+ }
+
+ MatrixI2cTransaction(byte var1, byte var2, int var3, byte var4) {
+ this.motor = var1;
+ this.speed = var2;
+ this.target = var3;
+ this.mode = var4;
+ this.property = Type1.f;
+ this.state = Type2.a;
+ this.write = true;
+ }
+
+ MatrixI2cTransaction(byte var1, Type1 var2) {
+ this.motor = var1;
+ this.property = var2;
+ this.state = Type2.a;
+ this.write = false;
+ }
+
+ MatrixI2cTransaction(byte var1, Type1 var2, int var3) {
+ this.motor = var1;
+ this.value = var3;
+ this.property = var2;
+ this.state = Type2.a;
+ this.write = true;
+ }
+
+ public boolean isEqual(MatrixI2cTransaction var1) {
+ boolean var2 = true;
+ if(this.property != var1.property) {
+ var2 = false;
+ } else {
+ switch (this.property.ordinal()) {
+ case 1:
+ case 2:
+ case 3:
+ case 4:
+ case 5:
+ case 6:
+ case 7:
+ if(this.write == var1.write && this.motor == var1.motor && this.value == var1.value) {
+ break;
+ }
+
+ return false;
+ case 8:
+ if(this.write == var1.write && this.motor == var1.motor && this.speed == var1.speed && this.target == var1.target && this.mode == var1.mode) {
+ break;
+ }
+
+ return false;
+ case 9:
+ if(this.write == var1.write && this.servo == var1.servo && this.speed == var1.speed && this.target == var1.target) {
+ break;
+ }
+
+ return false;
+ case 10:
+ if(this.write == var1.write && this.value == var1.value) {
+ break;
+ }
+
+ return false;
+ default:
+ RobotLog.e("Can not compare against unknown transaction property " + var1.toString());
+ return false;
+ }
+ }
+
+ return var2;
+ }
+
+ public String toString() {
+ return this.property == Type1.f ? "Matrix motor transaction: " + this.property + " motor " + this.motor + " write " + this.write + " speed " + this.speed + " target " + this.target + " mode " + this.mode : (this.property == Type1.g ? "Matrix servo transaction: " + this.property + " servo " + this.servo + " write " + this.write + " change rate " + this.speed + " target " + this.target : (this.property == Type1.h ? "Matrix servo transaction: " + this.property + " servo " + this.servo + " write " + this.write + " value " + this.value : "Matrix motor transaction: " + this.property + " motor " + this.motor + " write " + this.write + " value " + this.value));
+ }
+
+ enum Type1 {
+ a,
+ b,
+ c,
+ d,
+ e,
+ f,
+ g,
+ h,
+ i,
+ j;
+
+ static {
+ Type1[] var0 = new Type1[]{a, b, c, d, e, f, g, h, i, j};
+ }
+ }
+
+ enum Type2 {
+ a,
+ b,
+ c,
+ d,
+ e;
+
+ static {
+ Type2[] var0 = new Type2[]{a, b, c, d, e};
+ }
+ }
+}
diff --git a/FtcRobotController/app/src/main/java/com/qualcomm/hardware/MatrixMasterController.java b/FtcRobotController/Hardware/src/main/java/com/qualcomm/hardware/MatrixMasterController.java
similarity index 83%
rename from FtcRobotController/app/src/main/java/com/qualcomm/hardware/MatrixMasterController.java
rename to FtcRobotController/Hardware/src/main/java/com/qualcomm/hardware/MatrixMasterController.java
index 99ce16f..7662617 100644
--- a/FtcRobotController/app/src/main/java/com/qualcomm/hardware/MatrixMasterController.java
+++ b/FtcRobotController/Hardware/src/main/java/com/qualcomm/hardware/MatrixMasterController.java
@@ -1,250 +1,245 @@
-//
-// Source code recreated from a .class file by IntelliJ IDEA
-// (powered by Fernflower decompiler)
-//
-
-package com.qualcomm.hardware;
-
-import com.qualcomm.hardware.MatrixDcMotorController;
-import com.qualcomm.hardware.MatrixI2cTransaction;
-import com.qualcomm.hardware.MatrixServoController;
-import com.qualcomm.hardware.ModernRoboticsUsbLegacyModule;
-import com.qualcomm.hardware.MatrixI2cTransaction.a;
-import com.qualcomm.hardware.MatrixI2cTransaction.b;
-import com.qualcomm.robotcore.hardware.I2cController.I2cPortReadyCallback;
-import com.qualcomm.robotcore.util.ElapsedTime;
-import com.qualcomm.robotcore.util.RobotLog;
-import com.qualcomm.robotcore.util.TypeConversion;
-import java.nio.ByteBuffer;
-import java.util.Iterator;
-import java.util.concurrent.ConcurrentLinkedQueue;
-
-public class MatrixMasterController implements I2cPortReadyCallback {
- private static final byte[] a = new byte[]{(byte)0, (byte)70, (byte)72, (byte)74, (byte)76};
- private static final byte[] b = new byte[]{(byte)0, (byte)78, (byte)88, (byte)98, (byte)108};
- private static final byte[] c = new byte[]{(byte)0, (byte)82, (byte)92, (byte)102, (byte)112};
- private static final byte[] d = new byte[]{(byte)0, (byte)86, (byte)96, (byte)106, (byte)116};
- private static final byte[] e = new byte[]{(byte)0, (byte)87, (byte)97, (byte)107, (byte)117};
- protected ConcurrentLinkedQueue transactionQueue;
- protected ModernRoboticsUsbLegacyModule legacyModule;
- protected MatrixDcMotorController motorController;
- protected MatrixServoController servoController;
- protected int physicalPort;
- private volatile boolean f = false;
- private final ElapsedTime g = new ElapsedTime(0L);
-
- public MatrixMasterController(ModernRoboticsUsbLegacyModule legacyModule, int physicalPort) {
- this.legacyModule = legacyModule;
- this.physicalPort = physicalPort;
- this.transactionQueue = new ConcurrentLinkedQueue();
- legacyModule.registerForI2cPortReadyCallback(this, physicalPort);
- }
-
- public void registerMotorController(MatrixDcMotorController mc) {
- this.motorController = mc;
- }
-
- public void registerServoController(MatrixServoController sc) {
- this.servoController = sc;
- }
-
- public int getPort() {
- return this.physicalPort;
- }
-
- public String getConnectionInfo() {
- return this.legacyModule.getConnectionInfo() + "; port " + this.physicalPort;
- }
-
- public boolean queueTransaction(MatrixI2cTransaction transaction, boolean force) {
- if(!force) {
- Iterator var3 = this.transactionQueue.iterator();
-
- while(var3.hasNext()) {
- MatrixI2cTransaction var4 = (MatrixI2cTransaction)var3.next();
- if(var4.isEqual(transaction)) {
- this.buginf("NO Queue transaction " + transaction.toString());
- return false;
- }
- }
- }
-
- this.buginf("YES Queue transaction " + transaction.toString());
- this.transactionQueue.add(transaction);
- return true;
- }
-
- public boolean queueTransaction(MatrixI2cTransaction transaction) {
- return this.queueTransaction(transaction, false);
- }
-
- public void waitOnRead() {
- synchronized(this) {
- this.f = true;
-
- try {
- while(this.f) {
- this.wait(0L);
- }
- } catch (InterruptedException var4) {
- var4.printStackTrace();
- }
-
- }
- }
-
- protected void handleReadDone(MatrixI2cTransaction transaction) {
- byte[] var2 = this.legacyModule.getI2cReadCache(this.physicalPort);
- switch(MatrixMasterController.SyntheticClass_1.a[transaction.property.ordinal()]) {
- case 1:
- this.motorController.handleReadBattery(var2);
- break;
- case 2:
- this.motorController.handleReadPosition(transaction, var2);
- break;
- case 3:
- this.motorController.handleReadPosition(transaction, var2);
- break;
- case 4:
- this.motorController.handleReadMode(transaction, var2);
- break;
- case 5:
- this.servoController.handleReadServo(transaction, var2);
- break;
- default:
- RobotLog.e("Transaction not a read " + transaction.property);
- }
-
- synchronized(this) {
- if(this.f) {
- this.f = false;
- this.notify();
- }
-
- }
- }
-
- protected void sendHeartbeat() {
- MatrixI2cTransaction var1 = new MatrixI2cTransaction((byte)0, a.j, 3);
- this.queueTransaction(var1);
- }
-
- public void portIsReady(int port) {
- if(this.transactionQueue.isEmpty()) {
- if(this.g.time() > 2.0D) {
- this.sendHeartbeat();
- this.g.reset();
- }
-
- } else {
- MatrixI2cTransaction var5 = (MatrixI2cTransaction)this.transactionQueue.peek();
- if(var5.state == b.b) {
- this.legacyModule.readI2cCacheFromModule(this.physicalPort);
- var5.state = b.d;
- } else {
- if(var5.state == b.c) {
- var5 = (MatrixI2cTransaction)this.transactionQueue.poll();
- if(this.transactionQueue.isEmpty()) {
- return;
- }
-
- var5 = (MatrixI2cTransaction)this.transactionQueue.peek();
- } else if(var5.state == b.d) {
- this.handleReadDone(var5);
- var5 = (MatrixI2cTransaction)this.transactionQueue.poll();
- if(this.transactionQueue.isEmpty()) {
- return;
- }
-
- var5 = (MatrixI2cTransaction)this.transactionQueue.peek();
- }
-
- byte[] var2;
- byte var3;
- byte var4;
- switch(MatrixMasterController.SyntheticClass_1.a[var5.property.ordinal()]) {
- case 1:
- var3 = 67;
- var2 = new byte[]{(byte)0};
- var4 = 1;
- break;
- case 2:
- var3 = b[var5.motor];
- var4 = 4;
- var2 = new byte[]{(byte)0};
- break;
- case 3:
- var3 = c[var5.motor];
- var2 = TypeConversion.intToByteArray(var5.value);
- var4 = 4;
- break;
- case 4:
- var3 = e[var5.motor];
- var2 = new byte[]{(byte)var5.value};
- var4 = 1;
- break;
- case 5:
- var3 = a[var5.servo];
- var2 = new byte[]{var5.speed, (byte)var5.target};
- var4 = 2;
- break;
- case 6:
- var3 = 66;
- var2 = new byte[]{(byte)var5.value};
- var4 = 1;
- break;
- case 7:
- var3 = 68;
- var2 = new byte[]{(byte)var5.value};
- var4 = 1;
- break;
- case 8:
- var3 = d[var5.motor];
- var2 = new byte[]{(byte)var5.value};
- var4 = 1;
- break;
- case 9:
- var3 = b[var5.motor];
- ByteBuffer var6 = ByteBuffer.allocate(10);
- var6.put(TypeConversion.intToByteArray(0));
- var6.put(TypeConversion.intToByteArray(var5.target));
- var6.put(var5.speed);
- var6.put(var5.mode);
- var2 = var6.array();
- var4 = 10;
- break;
- case 10:
- var3 = 69;
- var2 = new byte[]{(byte)var5.value};
- var4 = 1;
- break;
- default:
- var3 = 0;
- var2 = new byte[]{(byte)var5.value};
- var4 = 1;
- }
-
- try {
- if(var5.write) {
- this.legacyModule.setWriteMode(this.physicalPort, 16, var3);
- this.legacyModule.setData(this.physicalPort, var2, var4);
- var5.state = b.c;
- } else {
- this.legacyModule.setReadMode(this.physicalPort, 16, var3, var4);
- var5.state = b.b;
- }
-
- this.legacyModule.setI2cPortActionFlag(this.physicalPort);
- this.legacyModule.writeI2cCacheToModule(this.physicalPort);
- } catch (IllegalArgumentException var7) {
- RobotLog.e(var7.getMessage());
- }
-
- this.buginf(var5.toString());
- }
- }
- }
-
- protected void buginf(String s) {
- }
-}
+//
+// Source code recreated from Type1 .class file by IntelliJ IDEA
+// (powered by Fernflower decompiler)
+//
+
+package com.qualcomm.hardware;
+
+import com.qualcomm.robotcore.hardware.I2cController.I2cPortReadyCallback;
+import com.qualcomm.robotcore.util.ElapsedTime;
+import com.qualcomm.robotcore.util.RobotLog;
+import com.qualcomm.robotcore.util.TypeConversion;
+
+import java.nio.ByteBuffer;
+import java.util.Iterator;
+import java.util.concurrent.ConcurrentLinkedQueue;
+
+public class MatrixMasterController implements I2cPortReadyCallback {
+ private static final byte[] a = new byte[]{(byte)0, (byte)70, (byte)72, (byte)74, (byte)76};
+ private static final byte[] b = new byte[]{(byte)0, (byte)78, (byte)88, (byte)98, (byte)108};
+ private static final byte[] c = new byte[]{(byte)0, (byte)82, (byte)92, (byte)102, (byte)112};
+ private static final byte[] d = new byte[]{(byte)0, (byte)86, (byte)96, (byte)106, (byte)116};
+ private static final byte[] e = new byte[]{(byte)0, (byte)87, (byte)97, (byte)107, (byte)117};
+ private final ElapsedTime g = new ElapsedTime(0L);
+ protected ConcurrentLinkedQueue transactionQueue;
+ protected ModernRoboticsUsbLegacyModule legacyModule;
+ protected MatrixDcMotorController motorController;
+ protected MatrixServoController servoController;
+ protected int physicalPort;
+ private volatile boolean f = false;
+
+ public MatrixMasterController(ModernRoboticsUsbLegacyModule legacyModule, int physicalPort) {
+ this.legacyModule = legacyModule;
+ this.physicalPort = physicalPort;
+ this.transactionQueue = new ConcurrentLinkedQueue();
+ legacyModule.registerForI2cPortReadyCallback(this, physicalPort);
+ }
+
+ public void registerMotorController(MatrixDcMotorController mc) {
+ this.motorController = mc;
+ }
+
+ public void registerServoController(MatrixServoController sc) {
+ this.servoController = sc;
+ }
+
+ public int getPort() {
+ return this.physicalPort;
+ }
+
+ public String getConnectionInfo() {
+ return this.legacyModule.getConnectionInfo() + "; port " + this.physicalPort;
+ }
+
+ public boolean queueTransaction(MatrixI2cTransaction transaction, boolean force) {
+ if(!force) {
+ Iterator var3 = this.transactionQueue.iterator();
+
+ while(var3.hasNext()) {
+ MatrixI2cTransaction var4 = (MatrixI2cTransaction)var3.next();
+ if(var4.isEqual(transaction)) {
+ this.buginf("NO Queue transaction " + transaction.toString());
+ return false;
+ }
+ }
+ }
+
+ this.buginf("YES Queue transaction " + transaction.toString());
+ this.transactionQueue.add(transaction);
+ return true;
+ }
+
+ public boolean queueTransaction(MatrixI2cTransaction transaction) {
+ return this.queueTransaction(transaction, false);
+ }
+
+ public void waitOnRead() {
+ synchronized(this) {
+ this.f = true;
+
+ try {
+ while(this.f) {
+ this.wait(0L);
+ }
+ } catch (InterruptedException var4) {
+ var4.printStackTrace();
+ }
+
+ }
+ }
+
+ protected void handleReadDone(MatrixI2cTransaction transaction) {
+ byte[] var2 = this.legacyModule.getI2cReadCache(this.physicalPort);
+ switch (transaction.property.ordinal()) {
+ case 1:
+ this.motorController.handleReadBattery(var2);
+ break;
+ case 2:
+ this.motorController.handleReadPosition(transaction, var2);
+ break;
+ case 3:
+ this.motorController.handleReadPosition(transaction, var2);
+ break;
+ case 4:
+ this.motorController.handleReadMode(transaction, var2);
+ break;
+ case 5:
+ this.servoController.handleReadServo(transaction, var2);
+ break;
+ default:
+ RobotLog.e("Transaction not Type1 read " + transaction.property);
+ }
+
+ synchronized(this) {
+ if(this.f) {
+ this.f = false;
+ this.notify();
+ }
+
+ }
+ }
+
+ protected void sendHeartbeat() {
+ MatrixI2cTransaction var1 = new MatrixI2cTransaction((byte) 0, MatrixI2cTransaction.Type1.a, 3);
+ this.queueTransaction(var1);
+ }
+
+ public void portIsReady(int port) {
+ if(this.transactionQueue.isEmpty()) {
+ if(this.g.time() > 2.0D) {
+ this.sendHeartbeat();
+ this.g.reset();
+ }
+
+ } else {
+ MatrixI2cTransaction var5 = this.transactionQueue.peek();
+ if (var5.state == MatrixI2cTransaction.Type2.b) {
+ this.legacyModule.readI2cCacheFromModule(this.physicalPort);
+ var5.state = MatrixI2cTransaction.Type2.d;
+ } else {
+ if (var5.state == MatrixI2cTransaction.Type2.d) {
+ var5 = this.transactionQueue.poll();
+ if(this.transactionQueue.isEmpty()) {
+ return;
+ }
+
+ var5 = this.transactionQueue.peek();
+ } else if (var5.state == MatrixI2cTransaction.Type2.d) {
+ this.handleReadDone(var5);
+ var5 = this.transactionQueue.poll();
+ if(this.transactionQueue.isEmpty()) {
+ return;
+ }
+
+ var5 = this.transactionQueue.peek();
+ }
+
+ byte[] var2;
+ byte var3;
+ byte var4;
+ switch (var5.property.ordinal()) {
+ case 1:
+ var3 = 67;
+ var2 = new byte[]{(byte)0};
+ var4 = 1;
+ break;
+ case 2:
+ var3 = b[var5.motor];
+ var4 = 4;
+ var2 = new byte[]{(byte)0};
+ break;
+ case 3:
+ var3 = c[var5.motor];
+ var2 = TypeConversion.intToByteArray(var5.value);
+ var4 = 4;
+ break;
+ case 4:
+ var3 = e[var5.motor];
+ var2 = new byte[]{(byte)var5.value};
+ var4 = 1;
+ break;
+ case 5:
+ var3 = a[var5.servo];
+ var2 = new byte[]{var5.speed, (byte)var5.target};
+ var4 = 2;
+ break;
+ case 6:
+ var3 = 66;
+ var2 = new byte[]{(byte)var5.value};
+ var4 = 1;
+ break;
+ case 7:
+ var3 = 68;
+ var2 = new byte[]{(byte)var5.value};
+ var4 = 1;
+ break;
+ case 8:
+ var3 = d[var5.motor];
+ var2 = new byte[]{(byte)var5.value};
+ var4 = 1;
+ break;
+ case 9:
+ var3 = b[var5.motor];
+ ByteBuffer var6 = ByteBuffer.allocate(10);
+ var6.put(TypeConversion.intToByteArray(0));
+ var6.put(TypeConversion.intToByteArray(var5.target));
+ var6.put(var5.speed);
+ var6.put(var5.mode);
+ var2 = var6.array();
+ var4 = 10;
+ break;
+ case 10:
+ var3 = 69;
+ var2 = new byte[]{(byte)var5.value};
+ var4 = 1;
+ break;
+ default:
+ var3 = 0;
+ var2 = new byte[]{(byte)var5.value};
+ var4 = 1;
+ }
+
+ try {
+ if(var5.write) {
+ this.legacyModule.setWriteMode(this.physicalPort, 16, var3);
+ this.legacyModule.setData(this.physicalPort, var2, var4);
+ var5.state = MatrixI2cTransaction.Type2.c;
+ } else {
+ this.legacyModule.setReadMode(this.physicalPort, 16, var3, var4);
+ var5.state = MatrixI2cTransaction.Type2.b;
+ }
+
+ this.legacyModule.setI2cPortActionFlag(this.physicalPort);
+ this.legacyModule.writeI2cCacheToModule(this.physicalPort);
+ } catch (IllegalArgumentException var7) {
+ RobotLog.e(var7.getMessage());
+ }
+
+ this.buginf(var5.toString());
+ }
+ }
+ }
+
+ protected void buginf(String s) {
+ }
+}
diff --git a/FtcRobotController/app/src/main/java/com/qualcomm/hardware/MatrixServoController.java b/FtcRobotController/Hardware/src/main/java/com/qualcomm/hardware/MatrixServoController.java
similarity index 90%
rename from FtcRobotController/app/src/main/java/com/qualcomm/hardware/MatrixServoController.java
rename to FtcRobotController/Hardware/src/main/java/com/qualcomm/hardware/MatrixServoController.java
index 46072c3..8f9a08c 100644
--- a/FtcRobotController/app/src/main/java/com/qualcomm/hardware/MatrixServoController.java
+++ b/FtcRobotController/Hardware/src/main/java/com/qualcomm/hardware/MatrixServoController.java
@@ -1,90 +1,89 @@
-package com.qualcomm.hardware;
-
-import com.qualcomm.hardware.MatrixI2cTransaction;
-import com.qualcomm.hardware.MatrixMasterController;
-import com.qualcomm.robotcore.hardware.ServoController;
-import com.qualcomm.robotcore.util.Range;
-import com.qualcomm.robotcore.util.TypeConversion;
-import java.util.Arrays;
-
-public class MatrixServoController implements ServoController {
- public static final int SERVO_POSITION_MAX = 240;
- private MatrixMasterController a;
- protected ServoController.PwmStatus pwmStatus;
- protected double[] servoCache = new double[4];
-
- public MatrixServoController(MatrixMasterController var1) {
- this.a = var1;
- this.pwmStatus = ServoController.PwmStatus.DISABLED;
- Arrays.fill(this.servoCache, 0.0D);
- var1.registerServoController(this);
- }
-
- private void a(int var1) {
- if(var1 < 1 || var1 > 4) {
- Object[] var2 = new Object[]{Integer.valueOf(var1), Byte.valueOf((byte)4)};
- throw new IllegalArgumentException(String.format("Channel %d is invalid; valid channels are 1..%d", var2));
- }
- }
-
- public void close() {
- this.pwmDisable();
- }
-
- public String getConnectionInfo() {
- return this.a.getConnectionInfo();
- }
-
- public String getDeviceName() {
- return "Matrix Servo Controller";
- }
-
- public ServoController.PwmStatus getPwmStatus() {
- return this.pwmStatus;
- }
-
- public double getServoPosition(int var1) {
- MatrixI2cTransaction var2 = new MatrixI2cTransaction((byte)var1, MatrixI2cTransaction.a.g);
- if(this.a.queueTransaction(var2)) {
- this.a.waitOnRead();
- }
-
- return this.servoCache[var1] / 240.0D;
- }
-
- public int getVersion() {
- return 1;
- }
-
- public void handleReadServo(MatrixI2cTransaction var1, byte[] var2) {
- this.servoCache[var1.servo] = (double)TypeConversion.unsignedByteToInt(var2[4]);
- }
-
- public void pwmDisable() {
- MatrixI2cTransaction var1 = new MatrixI2cTransaction((byte)0, MatrixI2cTransaction.a.h, 0);
- this.a.queueTransaction(var1);
- this.pwmStatus = ServoController.PwmStatus.DISABLED;
- }
-
- public void pwmEnable() {
- MatrixI2cTransaction var1 = new MatrixI2cTransaction((byte)0, MatrixI2cTransaction.a.h, 15);
- this.a.queueTransaction(var1);
- this.pwmStatus = ServoController.PwmStatus.ENABLED;
- }
-
- public void setServoPosition(int var1, double var2) {
- this.a(var1);
- Range.throwIfRangeIsInvalid(var2, 0.0D, 1.0D);
- byte var4 = (byte)((int)(240.0D * var2));
- MatrixI2cTransaction var5 = new MatrixI2cTransaction((byte)var1, var4, (byte)0);
- this.a.queueTransaction(var5);
- }
-
- public void setServoPosition(int var1, double var2, byte var4) {
- this.a(var1);
- Range.throwIfRangeIsInvalid(var2, 0.0D, 1.0D);
- byte var5 = (byte)((int)(240.0D * var2));
- MatrixI2cTransaction var6 = new MatrixI2cTransaction((byte)var1, var5, var4);
- this.a.queueTransaction(var6);
- }
-}
+package com.qualcomm.hardware;
+
+import com.qualcomm.robotcore.hardware.ServoController;
+import com.qualcomm.robotcore.util.Range;
+import com.qualcomm.robotcore.util.TypeConversion;
+
+import java.util.Arrays;
+
+public class MatrixServoController implements ServoController {
+ public static final int SERVO_POSITION_MAX = 240;
+ protected ServoController.PwmStatus pwmStatus;
+ protected double[] servoCache = new double[4];
+ private MatrixMasterController a;
+
+ public MatrixServoController(MatrixMasterController var1) {
+ this.a = var1;
+ this.pwmStatus = ServoController.PwmStatus.DISABLED;
+ Arrays.fill(this.servoCache, 0.0D);
+ var1.registerServoController(this);
+ }
+
+ private void a(int var1) {
+ if(var1 < 1 || var1 > 4) {
+ Object[] var2 = new Object[]{Integer.valueOf(var1), Byte.valueOf((byte)4)};
+ throw new IllegalArgumentException(String.format("Channel %d is invalid; valid channels are 1..%d", var2));
+ }
+ }
+
+ public void close() {
+ this.pwmDisable();
+ }
+
+ public String getConnectionInfo() {
+ return this.a.getConnectionInfo();
+ }
+
+ public String getDeviceName() {
+ return "Matrix Servo Controller";
+ }
+
+ public ServoController.PwmStatus getPwmStatus() {
+ return this.pwmStatus;
+ }
+
+ public double getServoPosition(int var1) {
+ MatrixI2cTransaction var2 = new MatrixI2cTransaction((byte) var1, MatrixI2cTransaction.Type1.g);
+ if(this.a.queueTransaction(var2)) {
+ this.a.waitOnRead();
+ }
+
+ return this.servoCache[var1] / 240.0D;
+ }
+
+ public int getVersion() {
+ return 1;
+ }
+
+ public void handleReadServo(MatrixI2cTransaction var1, byte[] var2) {
+ this.servoCache[var1.servo] = (double)TypeConversion.unsignedByteToInt(var2[4]);
+ }
+
+ public void pwmDisable() {
+ MatrixI2cTransaction var1 = new MatrixI2cTransaction((byte) 0, MatrixI2cTransaction.Type1.h, 0);
+ this.a.queueTransaction(var1);
+ this.pwmStatus = ServoController.PwmStatus.DISABLED;
+ }
+
+ public void pwmEnable() {
+ MatrixI2cTransaction var1 = new MatrixI2cTransaction((byte) 0, MatrixI2cTransaction.Type1.h, 15);
+ this.a.queueTransaction(var1);
+ this.pwmStatus = ServoController.PwmStatus.ENABLED;
+ }
+
+ public void setServoPosition(int var1, double var2) {
+ this.a(var1);
+ Range.throwIfRangeIsInvalid(var2, 0.0D, 1.0D);
+ byte var4 = (byte)((int)(240.0D * var2));
+ MatrixI2cTransaction var5 = new MatrixI2cTransaction((byte)var1, var4, (byte)0);
+ this.a.queueTransaction(var5);
+ }
+
+ public void setServoPosition(int var1, double var2, byte var4) {
+ this.a(var1);
+ Range.throwIfRangeIsInvalid(var2, 0.0D, 1.0D);
+ byte var5 = (byte)((int)(240.0D * var2));
+ MatrixI2cTransaction var6 = new MatrixI2cTransaction((byte)var1, var5, var4);
+ this.a.queueTransaction(var6);
+ }
+}
diff --git a/FtcRobotController/app/src/main/java/com/qualcomm/hardware/ModernRoboticsAnalogOpticalDistanceSensor.java b/FtcRobotController/Hardware/src/main/java/com/qualcomm/hardware/ModernRoboticsAnalogOpticalDistanceSensor.java
similarity index 91%
rename from FtcRobotController/app/src/main/java/com/qualcomm/hardware/ModernRoboticsAnalogOpticalDistanceSensor.java
rename to FtcRobotController/Hardware/src/main/java/com/qualcomm/hardware/ModernRoboticsAnalogOpticalDistanceSensor.java
index 4176dd6..5c5143c 100644
--- a/FtcRobotController/app/src/main/java/com/qualcomm/hardware/ModernRoboticsAnalogOpticalDistanceSensor.java
+++ b/FtcRobotController/Hardware/src/main/java/com/qualcomm/hardware/ModernRoboticsAnalogOpticalDistanceSensor.java
@@ -1,45 +1,44 @@
-package com.qualcomm.hardware;
-
-import com.qualcomm.hardware.ModernRoboticsUsbDeviceInterfaceModule;
-import com.qualcomm.robotcore.hardware.OpticalDistanceSensor;
-
-public class ModernRoboticsAnalogOpticalDistanceSensor extends OpticalDistanceSensor {
- private final ModernRoboticsUsbDeviceInterfaceModule a;
- private final int b;
-
- public ModernRoboticsAnalogOpticalDistanceSensor(ModernRoboticsUsbDeviceInterfaceModule var1, int var2) {
- this.a = var1;
- this.b = var2;
- }
-
- public void close() {
- }
-
- public void enableLed(boolean var1) {
- }
-
- public String getConnectionInfo() {
- return this.a.getConnectionInfo() + "; analog port " + this.b;
- }
-
- public String getDeviceName() {
- return "Modern Robotics Analog Optical Distance Sensor";
- }
-
- public double getLightDetected() {
- return (double)this.a.getAnalogInputValue(this.b) / 1023.0D;
- }
-
- public int getLightDetectedRaw() {
- return this.a.getAnalogInputValue(this.b);
- }
-
- public int getVersion() {
- return 0;
- }
-
- public String status() {
- Object[] var1 = new Object[]{this.a.getSerialNumber().toString(), Integer.valueOf(this.b)};
- return String.format("Optical Distance Sensor, connected via device %s, port %d", var1);
- }
-}
+package com.qualcomm.hardware;
+
+import com.qualcomm.robotcore.hardware.OpticalDistanceSensor;
+
+public class ModernRoboticsAnalogOpticalDistanceSensor extends OpticalDistanceSensor {
+ private final ModernRoboticsUsbDeviceInterfaceModule a;
+ private final int b;
+
+ public ModernRoboticsAnalogOpticalDistanceSensor(ModernRoboticsUsbDeviceInterfaceModule var1, int var2) {
+ this.a = var1;
+ this.b = var2;
+ }
+
+ public void close() {
+ }
+
+ public void enableLed(boolean var1) {
+ }
+
+ public String getConnectionInfo() {
+ return this.a.getConnectionInfo() + "; analog port " + this.b;
+ }
+
+ public String getDeviceName() {
+ return "Modern Robotics Analog Optical Distance Sensor";
+ }
+
+ public double getLightDetected() {
+ return (double)this.a.getAnalogInputValue(this.b) / 1023.0D;
+ }
+
+ public int getLightDetectedRaw() {
+ return this.a.getAnalogInputValue(this.b);
+ }
+
+ public int getVersion() {
+ return 0;
+ }
+
+ public String status() {
+ Object[] var1 = new Object[]{this.a.getSerialNumber().toString(), Integer.valueOf(this.b)};
+ return String.format("Optical Distance Sensor, connected via device %s, port %d", var1);
+ }
+}
diff --git a/FtcRobotController/app/src/main/java/com/qualcomm/hardware/ModernRoboticsDeviceManager.java b/FtcRobotController/Hardware/src/main/java/com/qualcomm/hardware/ModernRoboticsDeviceManager.java
similarity index 83%
rename from FtcRobotController/app/src/main/java/com/qualcomm/hardware/ModernRoboticsDeviceManager.java
rename to FtcRobotController/Hardware/src/main/java/com/qualcomm/hardware/ModernRoboticsDeviceManager.java
index fda565b..a14deeb 100644
--- a/FtcRobotController/app/src/main/java/com/qualcomm/hardware/ModernRoboticsDeviceManager.java
+++ b/FtcRobotController/Hardware/src/main/java/com/qualcomm/hardware/ModernRoboticsDeviceManager.java
@@ -1,299 +1,298 @@
-package com.qualcomm.hardware;
-
-import android.content.Context;
-import com.qualcomm.hardware.AdafruitI2cColorSensor;
-import com.qualcomm.hardware.HiTechnicNxtAccelerationSensor;
-import com.qualcomm.hardware.HiTechnicNxtColorSensor;
-import com.qualcomm.hardware.HiTechnicNxtCompassSensor;
-import com.qualcomm.hardware.HiTechnicNxtDcMotorController;
-import com.qualcomm.hardware.HiTechnicNxtGyroSensor;
-import com.qualcomm.hardware.HiTechnicNxtIrSeekerSensor;
-import com.qualcomm.hardware.HiTechnicNxtLightSensor;
-import com.qualcomm.hardware.HiTechnicNxtServoController;
-import com.qualcomm.hardware.HiTechnicNxtTouchSensor;
-import com.qualcomm.hardware.HiTechnicNxtTouchSensorMultiplexer;
-import com.qualcomm.hardware.HiTechnicNxtUltrasonicSensor;
-import com.qualcomm.hardware.ModernRoboticsAnalogOpticalDistanceSensor;
-import com.qualcomm.hardware.ModernRoboticsDigitalTouchSensor;
-import com.qualcomm.hardware.ModernRoboticsI2cColorSensor;
-import com.qualcomm.hardware.ModernRoboticsI2cIrSeekerSensorV3;
-import com.qualcomm.hardware.ModernRoboticsUsbDcMotorController;
-import com.qualcomm.hardware.ModernRoboticsUsbDeviceInterfaceModule;
-import com.qualcomm.hardware.ModernRoboticsUsbLegacyModule;
-import com.qualcomm.hardware.ModernRoboticsUsbServoController;
-import com.qualcomm.modernrobotics.ModernRoboticsUsbUtil;
-import com.qualcomm.modernrobotics.RobotUsbManagerEmulator;
-import com.qualcomm.robotcore.eventloop.EventLoopManager;
-import com.qualcomm.robotcore.exception.RobotCoreException;
-import com.qualcomm.robotcore.hardware.AccelerationSensor;
-import com.qualcomm.robotcore.hardware.AnalogInput;
-import com.qualcomm.robotcore.hardware.AnalogInputController;
-import com.qualcomm.robotcore.hardware.AnalogOutput;
-import com.qualcomm.robotcore.hardware.AnalogOutputController;
-import com.qualcomm.robotcore.hardware.ColorSensor;
-import com.qualcomm.robotcore.hardware.CompassSensor;
-import com.qualcomm.robotcore.hardware.DcMotorController;
-import com.qualcomm.robotcore.hardware.DeviceInterfaceModule;
-import com.qualcomm.robotcore.hardware.DeviceManager;
-import com.qualcomm.robotcore.hardware.DigitalChannel;
-import com.qualcomm.robotcore.hardware.DigitalChannelController;
-import com.qualcomm.robotcore.hardware.GyroSensor;
-import com.qualcomm.robotcore.hardware.I2cController;
-import com.qualcomm.robotcore.hardware.I2cDevice;
-import com.qualcomm.robotcore.hardware.IrSeekerSensor;
-import com.qualcomm.robotcore.hardware.LED;
-import com.qualcomm.robotcore.hardware.LegacyModule;
-import com.qualcomm.robotcore.hardware.LightSensor;
-import com.qualcomm.robotcore.hardware.OpticalDistanceSensor;
-import com.qualcomm.robotcore.hardware.PWMOutput;
-import com.qualcomm.robotcore.hardware.ServoController;
-import com.qualcomm.robotcore.hardware.TouchSensor;
-import com.qualcomm.robotcore.hardware.TouchSensorMultiplexer;
-import com.qualcomm.robotcore.hardware.UltrasonicSensor;
-import com.qualcomm.robotcore.hardware.usb.RobotUsbDevice;
-import com.qualcomm.robotcore.hardware.usb.RobotUsbManager;
-import com.qualcomm.robotcore.hardware.usb.ftdi.RobotUsbManagerFtdi;
-import com.qualcomm.robotcore.util.RobotLog;
-import com.qualcomm.robotcore.util.SerialNumber;
-import java.util.Map;
-
-public class ModernRoboticsDeviceManager extends DeviceManager {
- private static ModernRoboticsDeviceManager.a a;
- private RobotUsbManager b;
- private final EventLoopManager c;
-
- static {
- a = ModernRoboticsDeviceManager.a.a;
- }
-
- public ModernRoboticsDeviceManager(Context var1, EventLoopManager var2) throws RobotCoreException {
- this.c = var2;
- switch(null.a[a.ordinal()]) {
- case 1:
- this.b = new RobotUsbManagerEmulator();
- return;
- default:
- this.b = new RobotUsbManagerFtdi(var1);
- }
- }
-
- private ModernRoboticsUsbDeviceInterfaceModule a(DeviceInterfaceModule var1) {
- if(!(var1 instanceof ModernRoboticsUsbDeviceInterfaceModule)) {
- throw new IllegalArgumentException("Modern Robotics Device Manager needs a Modern Robotics Device Interface Module");
- } else {
- return (ModernRoboticsUsbDeviceInterfaceModule)var1;
- }
- }
-
- private ModernRoboticsUsbLegacyModule a(LegacyModule var1) {
- if(!(var1 instanceof ModernRoboticsUsbLegacyModule)) {
- throw new IllegalArgumentException("Modern Robotics Device Manager needs a Modern Robotics LegacyModule");
- } else {
- return (ModernRoboticsUsbLegacyModule)var1;
- }
- }
-
- private void a(String var1) throws RobotCoreException {
- System.err.println(var1);
- throw new RobotCoreException(var1);
- }
-
- public static void disableDeviceEmulation() {
- a = ModernRoboticsDeviceManager.a.a;
- }
-
- public static void enableDeviceEmulation() {
- a = ModernRoboticsDeviceManager.a.b;
- }
-
- public ColorSensor createAdafruitI2cColorSensor(DeviceInterfaceModule var1, int var2) {
- RobotLog.v("Creating Adafruit I2C Color Sensor - Port: " + var2);
- return new AdafruitI2cColorSensor(var1, var2);
- }
-
- public AnalogInput createAnalogInputDevice(AnalogInputController var1, int var2) {
- RobotLog.v("Creating Analog Input Device - Port: " + var2);
- return new AnalogInput(var1, var2);
- }
-
- public OpticalDistanceSensor createAnalogOpticalDistanceSensor(DeviceInterfaceModule var1, int var2) {
- RobotLog.v("Creating Modern Robotics Analog Optical Distance Sensor - Port: " + var2);
- return new ModernRoboticsAnalogOpticalDistanceSensor(this.a(var1), var2);
- }
-
- public AnalogOutput createAnalogOutputDevice(AnalogOutputController var1, int var2) {
- RobotLog.v("Creating Analog Output Device - Port: " + var2);
- return new AnalogOutput(var1, var2);
- }
-
- public DeviceInterfaceModule createDeviceInterfaceModule(SerialNumber var1) throws RobotCoreException, InterruptedException {
- RobotLog.v("Creating Modern Robotics USB Core Device Interface Module - " + var1.toString());
-
- try {
- RobotUsbDevice var3 = ModernRoboticsUsbUtil.openUsbDevice(this.b, var1);
- if(ModernRoboticsUsbUtil.getDeviceType(ModernRoboticsUsbUtil.getUsbDeviceHeader(var3)) != DeviceManager.DeviceType.MODERN_ROBOTICS_USB_DEVICE_INTERFACE_MODULE) {
- this.a(var1.toString() + " is not a Modern Robotics USB Core Device Interface Module");
- }
-
- ModernRoboticsUsbDeviceInterfaceModule var4 = new ModernRoboticsUsbDeviceInterfaceModule(var1, var3, this.c);
- return var4;
- } catch (RobotCoreException var5) {
- RobotLog.setGlobalErrorMsgAndThrow("Unable to open Modern Robotics USB Core Device Interface Module", var5);
- return null;
- }
- }
-
- public DigitalChannel createDigitalChannelDevice(DigitalChannelController var1, int var2) {
- RobotLog.v("Creating Digital Channel Device - Port: " + var2);
- return new DigitalChannel(var1, var2);
- }
-
- public TouchSensor createDigitalTouchSensor(DeviceInterfaceModule var1, int var2) {
- RobotLog.v("Creating Modern Robotics Digital Touch Sensor - Port: " + var2);
- return new ModernRoboticsDigitalTouchSensor(this.a(var1), var2);
- }
-
- public I2cDevice createI2cDevice(I2cController var1, int var2) {
- RobotLog.v("Creating I2C Device - Port: " + var2);
- return new I2cDevice(var1, var2);
- }
-
- public IrSeekerSensor createI2cIrSeekerSensorV3(DeviceInterfaceModule var1, int var2) {
- RobotLog.v("Creating Modern Robotics I2C IR Seeker Sensor V3 - Port: " + var2);
- return new ModernRoboticsI2cIrSeekerSensorV3(this.a(var1), var2);
- }
-
- public LED createLED(DigitalChannelController var1, int var2) {
- RobotLog.v("Creating LED - Port: " + var2);
- return new LED(var1, var2);
- }
-
- public ColorSensor createModernRoboticsI2cColorSensor(DeviceInterfaceModule var1, int var2) {
- RobotLog.v("Creating Modern Robotics I2C Color Sensor - Port: " + var2);
- return new ModernRoboticsI2cColorSensor(var1, var2);
- }
-
- public AccelerationSensor createNxtAccelerationSensor(LegacyModule var1, int var2) {
- RobotLog.v("Creating HiTechnic NXT Acceleration Sensor - Port: " + var2);
- return new HiTechnicNxtAccelerationSensor(this.a(var1), var2);
- }
-
- public ColorSensor createNxtColorSensor(LegacyModule var1, int var2) {
- RobotLog.v("Creating HiTechnic NXT Color Sensor - Port: " + var2);
- return new HiTechnicNxtColorSensor(var1, var2);
- }
-
- public CompassSensor createNxtCompassSensor(LegacyModule var1, int var2) {
- RobotLog.v("Creating HiTechnic NXT Compass Sensor - Port: " + var2);
- return new HiTechnicNxtCompassSensor(this.a(var1), var2);
- }
-
- public DcMotorController createNxtDcMotorController(LegacyModule var1, int var2) {
- RobotLog.v("Creating HiTechnic NXT DC Motor Controller - Port: " + var2);
- return new HiTechnicNxtDcMotorController(this.a(var1), var2);
- }
-
- public GyroSensor createNxtGyroSensor(LegacyModule var1, int var2) {
- RobotLog.v("Creating HiTechnic NXT Gyro Sensor - Port: " + var2);
- return new HiTechnicNxtGyroSensor(this.a(var1), var2);
- }
-
- public IrSeekerSensor createNxtIrSeekerSensor(LegacyModule var1, int var2) {
- RobotLog.v("Creating HiTechnic NXT IR Seeker Sensor - Port: " + var2);
- return new HiTechnicNxtIrSeekerSensor(this.a(var1), var2);
- }
-
- public LightSensor createNxtLightSensor(LegacyModule var1, int var2) {
- RobotLog.v("Creating HiTechnic NXT Light Sensor - Port: " + var2);
- return new HiTechnicNxtLightSensor(this.a(var1), var2);
- }
-
- public ServoController createNxtServoController(LegacyModule var1, int var2) {
- RobotLog.v("Creating HiTechnic NXT Servo Controller - Port: " + var2);
- return new HiTechnicNxtServoController(this.a(var1), var2);
- }
-
- public TouchSensor createNxtTouchSensor(LegacyModule var1, int var2) {
- RobotLog.v("Creating HiTechnic NXT Touch Sensor - Port: " + var2);
- return new HiTechnicNxtTouchSensor(this.a(var1), var2);
- }
-
- public TouchSensorMultiplexer createNxtTouchSensorMultiplexer(LegacyModule var1, int var2) {
- RobotLog.v("Creating HiTechnic NXT Touch Sensor Multiplexer - Port: " + var2);
- return new HiTechnicNxtTouchSensorMultiplexer(this.a(var1), var2);
- }
-
- public UltrasonicSensor createNxtUltrasonicSensor(LegacyModule var1, int var2) {
- RobotLog.v("Creating HiTechnic NXT Ultrasonic Sensor - Port: " + var2);
- return new HiTechnicNxtUltrasonicSensor(this.a(var1), var2);
- }
-
- public PWMOutput createPwmOutputDevice(DeviceInterfaceModule var1, int var2) {
- RobotLog.v("Creating PWM Output Device - Port: " + var2);
- return new PWMOutput(var1, var2);
- }
-
- public DcMotorController createUsbDcMotorController(SerialNumber var1) throws RobotCoreException, InterruptedException {
- RobotLog.v("Creating Modern Robotics USB DC Motor Controller - " + var1.toString());
-
- try {
- RobotUsbDevice var3 = ModernRoboticsUsbUtil.openUsbDevice(this.b, var1);
- if(ModernRoboticsUsbUtil.getDeviceType(ModernRoboticsUsbUtil.getUsbDeviceHeader(var3)) != DeviceManager.DeviceType.MODERN_ROBOTICS_USB_DC_MOTOR_CONTROLLER) {
- this.a(var1.toString() + " is not a Modern Robotics USB DC Motor Controller");
- }
-
- ModernRoboticsUsbDcMotorController var4 = new ModernRoboticsUsbDcMotorController(var1, var3, this.c);
- return var4;
- } catch (RobotCoreException var5) {
- RobotLog.setGlobalErrorMsgAndThrow("Unable to open Modern Robotics USB DC Motor Controller", var5);
- return null;
- }
- }
-
- public LegacyModule createUsbLegacyModule(SerialNumber var1) throws RobotCoreException, InterruptedException {
- RobotLog.v("Creating Modern Robotics USB Legacy Module - " + var1.toString());
-
- try {
- RobotUsbDevice var3 = ModernRoboticsUsbUtil.openUsbDevice(this.b, var1);
- if(ModernRoboticsUsbUtil.getDeviceType(ModernRoboticsUsbUtil.getUsbDeviceHeader(var3)) != DeviceManager.DeviceType.MODERN_ROBOTICS_USB_LEGACY_MODULE) {
- this.a(var1.toString() + " is not a Modern Robotics USB Legacy Module");
- }
-
- ModernRoboticsUsbLegacyModule var4 = new ModernRoboticsUsbLegacyModule(var1, var3, this.c);
- return var4;
- } catch (RobotCoreException var5) {
- RobotLog.setGlobalErrorMsgAndThrow("Unable to open Modern Robotics USB Legacy Module", var5);
- return null;
- }
- }
-
- public ServoController createUsbServoController(SerialNumber var1) throws RobotCoreException, InterruptedException {
- RobotLog.v("Creating Modern Robotics USB Servo Controller - " + var1.toString());
-
- try {
- RobotUsbDevice var3 = ModernRoboticsUsbUtil.openUsbDevice(this.b, var1);
- if(ModernRoboticsUsbUtil.getDeviceType(ModernRoboticsUsbUtil.getUsbDeviceHeader(var3)) != DeviceManager.DeviceType.MODERN_ROBOTICS_USB_SERVO_CONTROLLER) {
- this.a(var1.toString() + " is not a Modern Robotics USB Servo Controller");
- }
-
- ModernRoboticsUsbServoController var4 = new ModernRoboticsUsbServoController(var1, var3, this.c);
- return var4;
- } catch (RobotCoreException var5) {
- RobotLog.setGlobalErrorMsgAndThrow("Unable to open Modern Robotics USB Servo Controller", var5);
- return null;
- }
- }
-
- public Map scanForUsbDevices() throws RobotCoreException {
- // $FF: Couldn't be decompiled
- }
-
- private static enum a {
- a,
- b;
-
- static {
- ModernRoboticsDeviceManager.a[] var0 = new ModernRoboticsDeviceManager.a[]{a, b};
- }
- }
-}
+package com.qualcomm.hardware;
+
+import android.content.Context;
+
+import com.qualcomm.modernrobotics.ModernRoboticsUsbUtil;
+import com.qualcomm.modernrobotics.RobotUsbManagerEmulator;
+import com.qualcomm.robotcore.eventloop.EventLoopManager;
+import com.qualcomm.robotcore.exception.RobotCoreException;
+import com.qualcomm.robotcore.hardware.AccelerationSensor;
+import com.qualcomm.robotcore.hardware.AnalogInput;
+import com.qualcomm.robotcore.hardware.AnalogInputController;
+import com.qualcomm.robotcore.hardware.AnalogOutput;
+import com.qualcomm.robotcore.hardware.AnalogOutputController;
+import com.qualcomm.robotcore.hardware.ColorSensor;
+import com.qualcomm.robotcore.hardware.CompassSensor;
+import com.qualcomm.robotcore.hardware.DcMotorController;
+import com.qualcomm.robotcore.hardware.DeviceInterfaceModule;
+import com.qualcomm.robotcore.hardware.DeviceManager;
+import com.qualcomm.robotcore.hardware.DigitalChannel;
+import com.qualcomm.robotcore.hardware.DigitalChannelController;
+import com.qualcomm.robotcore.hardware.GyroSensor;
+import com.qualcomm.robotcore.hardware.I2cController;
+import com.qualcomm.robotcore.hardware.I2cDevice;
+import com.qualcomm.robotcore.hardware.IrSeekerSensor;
+import com.qualcomm.robotcore.hardware.LED;
+import com.qualcomm.robotcore.hardware.LegacyModule;
+import com.qualcomm.robotcore.hardware.LightSensor;
+import com.qualcomm.robotcore.hardware.OpticalDistanceSensor;
+import com.qualcomm.robotcore.hardware.PWMOutput;
+import com.qualcomm.robotcore.hardware.ServoController;
+import com.qualcomm.robotcore.hardware.TouchSensor;
+import com.qualcomm.robotcore.hardware.TouchSensorMultiplexer;
+import com.qualcomm.robotcore.hardware.UltrasonicSensor;
+import com.qualcomm.robotcore.hardware.usb.RobotUsbDevice;
+import com.qualcomm.robotcore.hardware.usb.RobotUsbManager;
+import com.qualcomm.robotcore.hardware.usb.ftdi.RobotUsbManagerFtdi;
+import com.qualcomm.robotcore.util.RobotLog;
+import com.qualcomm.robotcore.util.SerialNumber;
+
+import java.util.HashMap;
+import java.util.Map;
+
+public class ModernRoboticsDeviceManager extends DeviceManager {
+ private static ModernRoboticsDeviceManager.States a;
+
+ static {
+ a = ModernRoboticsDeviceManager.States.a;
+ }
+
+ private final EventLoopManager c;
+ private RobotUsbManager b;
+
+ public ModernRoboticsDeviceManager(Context var1, EventLoopManager var2) throws RobotCoreException {
+ this.c = var2;
+ switch (a.ordinal()) {
+ case 1:
+ this.b = new RobotUsbManagerEmulator();
+ return;
+ default:
+ this.b = new RobotUsbManagerFtdi(var1);
+ }
+ }
+
+ public static void disableDeviceEmulation() {
+ a = ModernRoboticsDeviceManager.States.a;
+ }
+
+ public static void enableDeviceEmulation() {
+ a = ModernRoboticsDeviceManager.States.b;
+ }
+
+ private ModernRoboticsUsbDeviceInterfaceModule a(DeviceInterfaceModule var1) {
+ if(!(var1 instanceof ModernRoboticsUsbDeviceInterfaceModule)) {
+ throw new IllegalArgumentException("Modern Robotics Device Manager needs Type1 Modern Robotics Device Interface Module");
+ } else {
+ return (ModernRoboticsUsbDeviceInterfaceModule)var1;
+ }
+ }
+
+ private ModernRoboticsUsbLegacyModule a(LegacyModule var1) {
+ if(!(var1 instanceof ModernRoboticsUsbLegacyModule)) {
+ throw new IllegalArgumentException("Modern Robotics Device Manager needs Type1 Modern Robotics LegacyModule");
+ } else {
+ return (ModernRoboticsUsbLegacyModule)var1;
+ }
+ }
+
+ private void a(String var1) throws RobotCoreException {
+ System.err.println(var1);
+ throw new RobotCoreException(var1);
+ }
+
+ public ColorSensor createAdafruitI2cColorSensor(DeviceInterfaceModule var1, int var2) {
+ RobotLog.v("Creating Adafruit I2C Color Sensor - Port: " + var2);
+ return new AdafruitI2cColorSensor(var1, var2);
+ }
+
+ public AnalogInput createAnalogInputDevice(AnalogInputController var1, int var2) {
+ RobotLog.v("Creating Analog Input Device - Port: " + var2);
+ return new AnalogInput(var1, var2);
+ }
+
+ public OpticalDistanceSensor createAnalogOpticalDistanceSensor(DeviceInterfaceModule var1, int var2) {
+ RobotLog.v("Creating Modern Robotics Analog Optical Distance Sensor - Port: " + var2);
+ return new ModernRoboticsAnalogOpticalDistanceSensor(this.a(var1), var2);
+ }
+
+ public AnalogOutput createAnalogOutputDevice(AnalogOutputController var1, int var2) {
+ RobotLog.v("Creating Analog Output Device - Port: " + var2);
+ return new AnalogOutput(var1, var2);
+ }
+
+ public DeviceInterfaceModule createDeviceInterfaceModule(SerialNumber var1) throws RobotCoreException, InterruptedException {
+ RobotLog.v("Creating Modern Robotics USB Core Device Interface Module - " + var1.toString());
+
+ try {
+ RobotUsbDevice var3 = ModernRoboticsUsbUtil.openUsbDevice(this.b, var1);
+ if(ModernRoboticsUsbUtil.getDeviceType(ModernRoboticsUsbUtil.getUsbDeviceHeader(var3)) != DeviceManager.DeviceType.MODERN_ROBOTICS_USB_DEVICE_INTERFACE_MODULE) {
+ this.a(var1.toString() + " is not Type1 Modern Robotics USB Core Device Interface Module");
+ }
+
+ ModernRoboticsUsbDeviceInterfaceModule var4 = new ModernRoboticsUsbDeviceInterfaceModule(var1, var3, this.c);
+ return var4;
+ } catch (RobotCoreException var5) {
+ RobotLog.setGlobalErrorMsgAndThrow("Unable to open Modern Robotics USB Core Device Interface Module", var5);
+ return null;
+ }
+ }
+
+ public DigitalChannel createDigitalChannelDevice(DigitalChannelController var1, int var2) {
+ RobotLog.v("Creating Digital Channel Device - Port: " + var2);
+ return new DigitalChannel(var1, var2);
+ }
+
+ public TouchSensor createDigitalTouchSensor(DeviceInterfaceModule var1, int var2) {
+ RobotLog.v("Creating Modern Robotics Digital Touch Sensor - Port: " + var2);
+ return new ModernRoboticsDigitalTouchSensor(this.a(var1), var2);
+ }
+
+ public I2cDevice createI2cDevice(I2cController var1, int var2) {
+ RobotLog.v("Creating I2C Device - Port: " + var2);
+ return new I2cDevice(var1, var2);
+ }
+
+ public IrSeekerSensor createI2cIrSeekerSensorV3(DeviceInterfaceModule var1, int var2) {
+ RobotLog.v("Creating Modern Robotics I2C IR Seeker Sensor V3 - Port: " + var2);
+ return new ModernRoboticsI2cIrSeekerSensorV3(this.a(var1), var2);
+ }
+
+ public LED createLED(DigitalChannelController var1, int var2) {
+ RobotLog.v("Creating LED - Port: " + var2);
+ return new LED(var1, var2);
+ }
+
+ public ColorSensor createModernRoboticsI2cColorSensor(DeviceInterfaceModule var1, int var2) {
+ RobotLog.v("Creating Modern Robotics I2C Color Sensor - Port: " + var2);
+ return new ModernRoboticsI2cColorSensor(var1, var2);
+ }
+
+ public AccelerationSensor createNxtAccelerationSensor(LegacyModule var1, int var2) {
+ RobotLog.v("Creating HiTechnic NXT Acceleration Sensor - Port: " + var2);
+ return new HiTechnicNxtAccelerationSensor(this.a(var1), var2);
+ }
+
+ public ColorSensor createNxtColorSensor(LegacyModule var1, int var2) {
+ RobotLog.v("Creating HiTechnic NXT Color Sensor - Port: " + var2);
+ return new HiTechnicNxtColorSensor(var1, var2);
+ }
+
+ public CompassSensor createNxtCompassSensor(LegacyModule var1, int var2) {
+ RobotLog.v("Creating HiTechnic NXT Compass Sensor - Port: " + var2);
+ return new HiTechnicNxtCompassSensor(this.a(var1), var2);
+ }
+
+ public DcMotorController createNxtDcMotorController(LegacyModule var1, int var2) {
+ RobotLog.v("Creating HiTechnic NXT DC Motor Controller - Port: " + var2);
+ return new HiTechnicNxtDcMotorController(this.a(var1), var2);
+ }
+
+ public GyroSensor createNxtGyroSensor(LegacyModule var1, int var2) {
+ RobotLog.v("Creating HiTechnic NXT Gyro Sensor - Port: " + var2);
+ return new HiTechnicNxtGyroSensor(this.a(var1), var2);
+ }
+
+ public IrSeekerSensor createNxtIrSeekerSensor(LegacyModule var1, int var2) {
+ RobotLog.v("Creating HiTechnic NXT IR Seeker Sensor - Port: " + var2);
+ return new HiTechnicNxtIrSeekerSensor(this.a(var1), var2);
+ }
+
+ public LightSensor createNxtLightSensor(LegacyModule var1, int var2) {
+ RobotLog.v("Creating HiTechnic NXT Light Sensor - Port: " + var2);
+ return new HiTechnicNxtLightSensor(this.a(var1), var2);
+ }
+
+ public ServoController createNxtServoController(LegacyModule var1, int var2) {
+ RobotLog.v("Creating HiTechnic NXT Servo Controller - Port: " + var2);
+ return new HiTechnicNxtServoController(this.a(var1), var2);
+ }
+
+ public TouchSensor createNxtTouchSensor(LegacyModule var1, int var2) {
+ RobotLog.v("Creating HiTechnic NXT Touch Sensor - Port: " + var2);
+ return new HiTechnicNxtTouchSensor(this.a(var1), var2);
+ }
+
+ public TouchSensorMultiplexer createNxtTouchSensorMultiplexer(LegacyModule var1, int var2) {
+ RobotLog.v("Creating HiTechnic NXT Touch Sensor Multiplexer - Port: " + var2);
+ return new HiTechnicNxtTouchSensorMultiplexer(this.a(var1), var2);
+ }
+
+ public UltrasonicSensor createNxtUltrasonicSensor(LegacyModule var1, int var2) {
+ RobotLog.v("Creating HiTechnic NXT Ultrasonic Sensor - Port: " + var2);
+ return new HiTechnicNxtUltrasonicSensor(this.a(var1), var2);
+ }
+
+ public PWMOutput createPwmOutputDevice(DeviceInterfaceModule var1, int var2) {
+ RobotLog.v("Creating PWM Output Device - Port: " + var2);
+ return new PWMOutput(var1, var2);
+ }
+
+ public DcMotorController createUsbDcMotorController(SerialNumber var1) throws RobotCoreException, InterruptedException {
+ RobotLog.v("Creating Modern Robotics USB DC Motor Controller - " + var1.toString());
+
+ try {
+ RobotUsbDevice var3 = ModernRoboticsUsbUtil.openUsbDevice(this.b, var1);
+ if(ModernRoboticsUsbUtil.getDeviceType(ModernRoboticsUsbUtil.getUsbDeviceHeader(var3)) != DeviceManager.DeviceType.MODERN_ROBOTICS_USB_DC_MOTOR_CONTROLLER) {
+ this.a(var1.toString() + " is not Type1 Modern Robotics USB DC Motor Controller");
+ }
+
+ ModernRoboticsUsbDcMotorController var4 = new ModernRoboticsUsbDcMotorController(var1, var3, this.c);
+ return var4;
+ } catch (RobotCoreException var5) {
+ RobotLog.setGlobalErrorMsgAndThrow("Unable to open Modern Robotics USB DC Motor Controller", var5);
+ return null;
+ }
+ }
+
+ public LegacyModule createUsbLegacyModule(SerialNumber var1) throws RobotCoreException, InterruptedException {
+ RobotLog.v("Creating Modern Robotics USB Legacy Module - " + var1.toString());
+
+ try {
+ RobotUsbDevice var3 = ModernRoboticsUsbUtil.openUsbDevice(this.b, var1);
+ if(ModernRoboticsUsbUtil.getDeviceType(ModernRoboticsUsbUtil.getUsbDeviceHeader(var3)) != DeviceManager.DeviceType.MODERN_ROBOTICS_USB_LEGACY_MODULE) {
+ this.a(var1.toString() + " is not Type1 Modern Robotics USB Legacy Module");
+ }
+
+ ModernRoboticsUsbLegacyModule var4 = new ModernRoboticsUsbLegacyModule(var1, var3, this.c);
+ return var4;
+ } catch (RobotCoreException var5) {
+ RobotLog.setGlobalErrorMsgAndThrow("Unable to open Modern Robotics USB Legacy Module", var5);
+ return null;
+ }
+ }
+
+ public ServoController createUsbServoController(SerialNumber var1) throws RobotCoreException, InterruptedException {
+ RobotLog.v("Creating Modern Robotics USB Servo Controller - " + var1.toString());
+
+ try {
+ RobotUsbDevice var3 = ModernRoboticsUsbUtil.openUsbDevice(this.b, var1);
+ if(ModernRoboticsUsbUtil.getDeviceType(ModernRoboticsUsbUtil.getUsbDeviceHeader(var3)) != DeviceManager.DeviceType.MODERN_ROBOTICS_USB_SERVO_CONTROLLER) {
+ this.a(var1.toString() + " is not Type1 Modern Robotics USB Servo Controller");
+ }
+
+ ModernRoboticsUsbServoController var4 = new ModernRoboticsUsbServoController(var1, var3, this.c);
+ return var4;
+ } catch (RobotCoreException var5) {
+ RobotLog.setGlobalErrorMsgAndThrow("Unable to open Modern Robotics USB Servo Controller", var5);
+ return null;
+ }
+ }
+
+ public Map scanForUsbDevices() throws RobotCoreException {
+ HashMap var1 = new HashMap();
+
+ try {
+ int var2 = this.b.scanForDevices();
+
+ for (int var3 = 0; var3 < var2; ++var3) {
+ SerialNumber var4 = this.b.getDeviceSerialNumberByIndex(var3);
+ RobotUsbDevice var5 = ModernRoboticsUsbUtil.openUsbDevice(this.b, var4);
+ var1.put(var4, ModernRoboticsUsbUtil.getDeviceType(ModernRoboticsUsbUtil.getUsbDeviceHeader(var5)));
+ var5.close();
+ }
+ } catch (RobotCoreException var6) {
+ RobotLog.setGlobalErrorMsgAndThrow("Error while scanning for USB devices", var6);
+ }
+
+ return var1;
+ }
+
+ private enum States {
+ a,
+ b;
+
+ static {
+ States[] var0 = new States[]{a, b};
+ }
+ }
+}
diff --git a/FtcRobotController/app/src/main/java/com/qualcomm/hardware/ModernRoboticsDigitalTouchSensor.java b/FtcRobotController/Hardware/src/main/java/com/qualcomm/hardware/ModernRoboticsDigitalTouchSensor.java
similarity index 95%
rename from FtcRobotController/app/src/main/java/com/qualcomm/hardware/ModernRoboticsDigitalTouchSensor.java
rename to FtcRobotController/Hardware/src/main/java/com/qualcomm/hardware/ModernRoboticsDigitalTouchSensor.java
index a8dee8d..25480b8 100644
--- a/FtcRobotController/app/src/main/java/com/qualcomm/hardware/ModernRoboticsDigitalTouchSensor.java
+++ b/FtcRobotController/Hardware/src/main/java/com/qualcomm/hardware/ModernRoboticsDigitalTouchSensor.java
@@ -1,37 +1,37 @@
-package com.qualcomm.hardware;
-
-import com.qualcomm.robotcore.hardware.DeviceInterfaceModule;
-import com.qualcomm.robotcore.hardware.TouchSensor;
-
-public class ModernRoboticsDigitalTouchSensor extends TouchSensor {
- private DeviceInterfaceModule a = null;
- private int b = -1;
-
- public ModernRoboticsDigitalTouchSensor(DeviceInterfaceModule var1, int var2) {
- this.a = var1;
- this.b = var2;
- }
-
- public void close() {
- }
-
- public String getConnectionInfo() {
- return this.a.getConnectionInfo() + "; digital port " + this.b;
- }
-
- public String getDeviceName() {
- return "Modern Robotics Digital Touch Sensor";
- }
-
- public double getValue() {
- return this.isPressed()?1.0D:0.0D;
- }
-
- public int getVersion() {
- return 1;
- }
-
- public boolean isPressed() {
- return this.a.getDigitalChannelState(this.b);
- }
-}
+package com.qualcomm.hardware;
+
+import com.qualcomm.robotcore.hardware.DeviceInterfaceModule;
+import com.qualcomm.robotcore.hardware.TouchSensor;
+
+public class ModernRoboticsDigitalTouchSensor extends TouchSensor {
+ private DeviceInterfaceModule a = null;
+ private int b = -1;
+
+ public ModernRoboticsDigitalTouchSensor(DeviceInterfaceModule var1, int var2) {
+ this.a = var1;
+ this.b = var2;
+ }
+
+ public void close() {
+ }
+
+ public String getConnectionInfo() {
+ return this.a.getConnectionInfo() + "; digital port " + this.b;
+ }
+
+ public String getDeviceName() {
+ return "Modern Robotics Digital Touch Sensor";
+ }
+
+ public double getValue() {
+ return this.isPressed()?1.0D:0.0D;
+ }
+
+ public int getVersion() {
+ return 1;
+ }
+
+ public boolean isPressed() {
+ return this.a.getDigitalChannelState(this.b);
+ }
+}
diff --git a/FtcRobotController/app/src/main/java/com/qualcomm/hardware/ModernRoboticsHardwareFactory.java b/FtcRobotController/Hardware/src/main/java/com/qualcomm/hardware/ModernRoboticsHardwareFactory.java
similarity index 95%
rename from FtcRobotController/app/src/main/java/com/qualcomm/hardware/ModernRoboticsHardwareFactory.java
rename to FtcRobotController/Hardware/src/main/java/com/qualcomm/hardware/ModernRoboticsHardwareFactory.java
index 4492c46..04251a0 100644
--- a/FtcRobotController/app/src/main/java/com/qualcomm/hardware/ModernRoboticsHardwareFactory.java
+++ b/FtcRobotController/Hardware/src/main/java/com/qualcomm/hardware/ModernRoboticsHardwareFactory.java
@@ -1,410 +1,411 @@
-package com.qualcomm.hardware;
-
-import android.content.Context;
-
-import com.qualcomm.robotcore.eventloop.EventLoopManager;
-import com.qualcomm.robotcore.exception.RobotCoreException;
-import com.qualcomm.robotcore.hardware.AccelerationSensor;
-import com.qualcomm.robotcore.hardware.AnalogInput;
-import com.qualcomm.robotcore.hardware.AnalogOutput;
-import com.qualcomm.robotcore.hardware.ColorSensor;
-import com.qualcomm.robotcore.hardware.CompassSensor;
-import com.qualcomm.robotcore.hardware.DcMotor;
-import com.qualcomm.robotcore.hardware.DcMotorController;
-import com.qualcomm.robotcore.hardware.DeviceInterfaceModule;
-import com.qualcomm.robotcore.hardware.DeviceManager;
-import com.qualcomm.robotcore.hardware.DigitalChannel;
-import com.qualcomm.robotcore.hardware.DigitalChannelController;
-import com.qualcomm.robotcore.hardware.GyroSensor;
-import com.qualcomm.robotcore.hardware.HardwareFactory;
-import com.qualcomm.robotcore.hardware.HardwareMap;
-import com.qualcomm.robotcore.hardware.I2cDevice;
-import com.qualcomm.robotcore.hardware.IrSeekerSensor;
-import com.qualcomm.robotcore.hardware.LED;
-import com.qualcomm.robotcore.hardware.LegacyModule;
-import com.qualcomm.robotcore.hardware.LightSensor;
-import com.qualcomm.robotcore.hardware.OpticalDistanceSensor;
-import com.qualcomm.robotcore.hardware.PWMOutput;
-import com.qualcomm.robotcore.hardware.Servo;
-import com.qualcomm.robotcore.hardware.ServoController;
-import com.qualcomm.robotcore.hardware.TouchSensor;
-import com.qualcomm.robotcore.hardware.TouchSensorMultiplexer;
-import com.qualcomm.robotcore.hardware.UltrasonicSensor;
-import com.qualcomm.robotcore.hardware.configuration.ControllerConfiguration;
-import com.qualcomm.robotcore.hardware.configuration.DeviceConfiguration;
-import com.qualcomm.robotcore.hardware.configuration.DeviceInterfaceModuleConfiguration;
-import com.qualcomm.robotcore.hardware.configuration.MatrixControllerConfiguration;
-import com.qualcomm.robotcore.hardware.configuration.MotorControllerConfiguration;
-import com.qualcomm.robotcore.hardware.configuration.ReadXMLFileHandler;
-import com.qualcomm.robotcore.hardware.configuration.ServoControllerConfiguration;
-import com.qualcomm.robotcore.util.RobotLog;
-import java.io.InputStream;
-import java.util.Iterator;
-import java.util.List;
-
-public class ModernRoboticsHardwareFactory implements HardwareFactory {
- private Context context;
- private InputStream inputStream = null;
-
- public ModernRoboticsHardwareFactory(Context var1) {
- this.context = var1;
- }
-
- private void a(HardwareMap var1, DeviceManager var2, DeviceInterfaceModule var3, DeviceConfiguration var4) {
- IrSeekerSensor var5 = var2.createI2cIrSeekerSensorV3(var3, var4.getPort());
- var1.irSeekerSensor.put(var4.getName(), var5);
- }
-
- private void a(HardwareMap var1, DeviceManager var2, DigitalChannelController var3, DeviceConfiguration var4) {
- LED var5 = var2.createLED(var3, var4.getPort());
- var1.led.put(var4.getName(), var5);
- }
-
- private void a(HardwareMap var1, DeviceManager var2, LegacyModule var3, DeviceConfiguration var4) {
- TouchSensor var5 = var2.createNxtTouchSensor(var3, var4.getPort());
- var1.touchSensor.put(var4.getName(), var5);
- }
-
- private void a(HardwareMap var1, DeviceManager var2, ControllerConfiguration var3) throws RobotCoreException, InterruptedException {
- ModernRoboticsUsbDcMotorController var4 = (ModernRoboticsUsbDcMotorController)var2.createUsbDcMotorController(var3.getSerialNumber());
- var1.dcMotorController.put(var3.getName(), var4);
- Iterator var5 = var3.getDevices().iterator();
-
- while(var5.hasNext()) {
- DeviceConfiguration var6 = (DeviceConfiguration)var5.next();
- if(var6.isEnabled()) {
- DcMotor var7 = var2.createDcMotor(var4, var6.getPort());
- var1.dcMotor.put(var6.getName(), var7);
- }
- }
-
- var1.voltageSensor.put(var3.getName(), var4);
- }
-
- private void a(List var1, HardwareMap var2, DeviceManager var3, DeviceInterfaceModule var4) {
- Iterator var5 = var1.iterator();
-
- while(var5.hasNext()) {
- DeviceConfiguration var6 = (DeviceConfiguration)var5.next();
- if(var6.isEnabled()) {
- DeviceConfiguration.ConfigurationType var7 = var6.getType();
- switch(null.a[var7.ordinal()]) {
- case 5:
- this.h(var2, var3, var4, var6);
- break;
- case 6:
- this.d(var2, var3, var4, var6);
- break;
- case 7:
- this.c(var2, var3, var4, var6);
- break;
- case 8:
- this.b(var2, var3, var4, var6);
- break;
- case 9:
- this.e(var2, var3, var4, var6);
- break;
- case 10:
- this.a(var2, var3, var4, var6);
- break;
- case 11:
- this.f(var2, var3, var4, var6);
- break;
- case 12:
- this.g(var2, var3, var4, var6);
- break;
- case 13:
- this.i(var2, var3, var4, var6);
- break;
- case 14:
- this.a((HardwareMap)var2, (DeviceManager)var3, (DigitalChannelController)var4, (DeviceConfiguration)var6);
- break;
- case 15:
- this.j(var2, var3, var4, var6);
- case 16:
- break;
- default:
- RobotLog.w("Unexpected device type connected to Device Interface Module while parsing XML: " + var7.toString());
- }
- }
- }
-
- }
-
- private void b(HardwareMap var1, DeviceManager var2, DeviceInterfaceModule var3, DeviceConfiguration var4) {
- DigitalChannel var5 = var2.createDigitalChannelDevice(var3, var4.getPort());
- var1.digitalChannel.put(var4.getName(), var5);
- }
-
- private void b(HardwareMap var1, DeviceManager var2, LegacyModule var3, DeviceConfiguration var4) {
- TouchSensorMultiplexer var5 = var2.createNxtTouchSensorMultiplexer(var3, var4.getPort());
- var1.touchSensorMultiplexer.put(var4.getName(), var5);
- }
-
- private void b(HardwareMap var1, DeviceManager var2, ControllerConfiguration var3) throws RobotCoreException, InterruptedException {
- ServoController var4 = var2.createUsbServoController(var3.getSerialNumber());
- var1.servoController.put(var3.getName(), var4);
- Iterator var5 = var3.getDevices().iterator();
-
- while(var5.hasNext()) {
- DeviceConfiguration var6 = (DeviceConfiguration)var5.next();
- if(var6.isEnabled()) {
- Servo var7 = var2.createServo(var4, var6.getPort());
- var1.servo.put(var6.getName(), var7);
- }
- }
-
- }
-
- private void c(HardwareMap var1, DeviceManager var2, DeviceInterfaceModule var3, DeviceConfiguration var4) {
- TouchSensor var5 = var2.createDigitalTouchSensor(var3, var4.getPort());
- var1.touchSensor.put(var4.getName(), var5);
- }
-
- private void c(HardwareMap var1, DeviceManager var2, LegacyModule var3, DeviceConfiguration var4) {
- UltrasonicSensor var5 = var2.createNxtUltrasonicSensor(var3, var4.getPort());
- var1.ultrasonicSensor.put(var4.getName(), var5);
- }
-
- private void c(HardwareMap var1, DeviceManager var2, ControllerConfiguration var3) throws RobotCoreException, InterruptedException {
- DeviceInterfaceModule var4 = var2.createDeviceInterfaceModule(var3.getSerialNumber());
- var1.deviceInterfaceModule.put(var3.getName(), var4);
- this.a(((DeviceInterfaceModuleConfiguration)var3).getPwmDevices(), var1, var2, var4);
- this.a(((DeviceInterfaceModuleConfiguration)var3).getI2cDevices(), var1, var2, var4);
- this.a(((DeviceInterfaceModuleConfiguration)var3).getAnalogInputDevices(), var1, var2, var4);
- this.a(((DeviceInterfaceModuleConfiguration)var3).getDigitalDevices(), var1, var2, var4);
- this.a(((DeviceInterfaceModuleConfiguration)var3).getAnalogOutputDevices(), var1, var2, var4);
- }
-
- private void d(HardwareMap var1, DeviceManager var2, DeviceInterfaceModule var3, DeviceConfiguration var4) {
- AnalogInput var5 = var2.createAnalogInputDevice(var3, var4.getPort());
- var1.analogInput.put(var4.getName(), var5);
- }
-
- private void d(HardwareMap var1, DeviceManager var2, LegacyModule var3, DeviceConfiguration var4) {
- ColorSensor var5 = var2.createNxtColorSensor(var3, var4.getPort());
- var1.colorSensor.put(var4.getName(), var5);
- }
-
- private void d(HardwareMap var1, DeviceManager var2, ControllerConfiguration var3) throws RobotCoreException, InterruptedException {
- LegacyModule var4 = var2.createUsbLegacyModule(var3.getSerialNumber());
- var1.legacyModule.put(var3.getName(), var4);
- Iterator var5 = var3.getDevices().iterator();
-
- while(var5.hasNext()) {
- DeviceConfiguration var6 = (DeviceConfiguration)var5.next();
- if(var6.isEnabled()) {
- DeviceConfiguration.ConfigurationType var7 = var6.getType();
- switch(null.a[var7.ordinal()]) {
- case 1:
- this.j(var1, var2, var4, var6);
- break;
- case 2:
- this.k(var1, var2, var4, var6);
- break;
- case 3:
- case 4:
- case 5:
- case 6:
- case 8:
- case 9:
- case 10:
- case 11:
- case 12:
- case 13:
- case 14:
- default:
- RobotLog.w("Unexpected device type connected to Legacy Module while parsing XML: " + var7.toString());
- break;
- case 7:
- this.a(var1, var2, var4, var6);
- break;
- case 15:
- this.d(var1, var2, var4, var6);
- case 16:
- break;
- case 17:
- this.e(var1, var2, var4, var6);
- break;
- case 18:
- this.f(var1, var2, var4, var6);
- break;
- case 19:
- this.g(var1, var2, var4, var6);
- break;
- case 20:
- this.h(var1, var2, var4, var6);
- break;
- case 21:
- this.i(var1, var2, var4, var6);
- break;
- case 22:
- this.b(var1, var2, var4, var6);
- break;
- case 23:
- this.c(var1, var2, var4, var6);
- break;
- case 24:
- this.l(var1, var2, var4, var6);
- }
- }
- }
-
- }
-
- public static void disableDeviceEmulation() {
- ModernRoboticsDeviceManager.disableDeviceEmulation();
- }
-
- private void e(HardwareMap var1, DeviceManager var2, DeviceInterfaceModule var3, DeviceConfiguration var4) {
- PWMOutput var5 = var2.createPwmOutputDevice(var3, var4.getPort());
- var1.pwmOutput.put(var4.getName(), var5);
- }
-
- private void e(HardwareMap var1, DeviceManager var2, LegacyModule var3, DeviceConfiguration var4) {
- GyroSensor var5 = var2.createNxtGyroSensor(var3, var4.getPort());
- var1.gyroSensor.put(var4.getName(), var5);
- }
-
- public static void enableDeviceEmulation() {
- ModernRoboticsDeviceManager.enableDeviceEmulation();
- }
-
- private void f(HardwareMap var1, DeviceManager var2, DeviceInterfaceModule var3, DeviceConfiguration var4) {
- I2cDevice var5 = var2.createI2cDevice(var3, var4.getPort());
- var1.i2cDevice.put(var4.getName(), var5);
- }
-
- private void f(HardwareMap var1, DeviceManager var2, LegacyModule var3, DeviceConfiguration var4) {
- CompassSensor var5 = var2.createNxtCompassSensor(var3, var4.getPort());
- var1.compassSensor.put(var4.getName(), var5);
- }
-
- private void g(HardwareMap var1, DeviceManager var2, DeviceInterfaceModule var3, DeviceConfiguration var4) {
- AnalogOutput var5 = var2.createAnalogOutputDevice(var3, var4.getPort());
- var1.analogOutput.put(var4.getName(), var5);
- }
-
- private void g(HardwareMap var1, DeviceManager var2, LegacyModule var3, DeviceConfiguration var4) {
- IrSeekerSensor var5 = var2.createNxtIrSeekerSensor(var3, var4.getPort());
- var1.irSeekerSensor.put(var4.getName(), var5);
- }
-
- private void h(HardwareMap var1, DeviceManager var2, DeviceInterfaceModule var3, DeviceConfiguration var4) {
- OpticalDistanceSensor var5 = var2.createAnalogOpticalDistanceSensor(var3, var4.getPort());
- var1.opticalDistanceSensor.put(var4.getName(), var5);
- }
-
- private void h(HardwareMap var1, DeviceManager var2, LegacyModule var3, DeviceConfiguration var4) {
- LightSensor var5 = var2.createNxtLightSensor(var3, var4.getPort());
- var1.lightSensor.put(var4.getName(), var5);
- }
-
- private void i(HardwareMap var1, DeviceManager var2, DeviceInterfaceModule var3, DeviceConfiguration var4) {
- ColorSensor var5 = var2.createAdafruitI2cColorSensor(var3, var4.getPort());
- var1.colorSensor.put(var4.getName(), var5);
- }
-
- private void i(HardwareMap var1, DeviceManager var2, LegacyModule var3, DeviceConfiguration var4) {
- AccelerationSensor var5 = var2.createNxtAccelerationSensor(var3, var4.getPort());
- var1.accelerationSensor.put(var4.getName(), var5);
- }
-
- private void j(HardwareMap var1, DeviceManager var2, DeviceInterfaceModule var3, DeviceConfiguration var4) {
- ColorSensor var5 = var2.createModernRoboticsI2cColorSensor(var3, var4.getPort());
- var1.colorSensor.put(var4.getName(), var5);
- }
-
- private void j(HardwareMap var1, DeviceManager var2, LegacyModule var3, DeviceConfiguration var4) {
- DcMotorController var5 = var2.createNxtDcMotorController(var3, var4.getPort());
- var1.dcMotorController.put(var4.getName(), var5);
- Iterator var6 = ((MotorControllerConfiguration)var4).getMotors().iterator();
-
- while(var6.hasNext()) {
- DeviceConfiguration var7 = (DeviceConfiguration)var6.next();
- DcMotor var8 = var2.createDcMotor(var5, var7.getPort());
- var1.dcMotor.put(var7.getName(), var8);
- }
-
- }
-
- private void k(HardwareMap var1, DeviceManager var2, LegacyModule var3, DeviceConfiguration var4) {
- ServoController var5 = var2.createNxtServoController(var3, var4.getPort());
- var1.servoController.put(var4.getName(), var5);
- Iterator var6 = ((ServoControllerConfiguration)var4).getServos().iterator();
-
- while(var6.hasNext()) {
- DeviceConfiguration var7 = (DeviceConfiguration)var6.next();
- Servo var8 = var2.createServo(var5, var7.getPort());
- var1.servo.put(var7.getName(), var8);
- }
-
- }
-
- private void l(HardwareMap var1, DeviceManager var2, LegacyModule var3, DeviceConfiguration var4) {
- MatrixMasterController var5 = new MatrixMasterController((ModernRoboticsUsbLegacyModule)var3, var4.getPort());
- MatrixDcMotorController var6 = new MatrixDcMotorController(var5);
- var1.dcMotorController.put(var4.getName() + "Motor", var6);
- Iterator var7 = ((MatrixControllerConfiguration)var4).getMotors().iterator();
-
- while(var7.hasNext()) {
- DeviceConfiguration var12 = (DeviceConfiguration)var7.next();
- DcMotor var13 = var2.createDcMotor(var6, var12.getPort());
- var1.dcMotor.put(var12.getName(), var13);
- }
-
- MatrixServoController var8 = new MatrixServoController(var5);
- var1.servoController.put(var4.getName() + "Servo", var8);
- Iterator var9 = ((MatrixControllerConfiguration)var4).getServos().iterator();
-
- while(var9.hasNext()) {
- DeviceConfiguration var10 = (DeviceConfiguration)var9.next();
- Servo var11 = var2.createServo(var8, var10.getPort());
- var1.servo.put(var10.getName(), var11);
- }
-
- }
-
- public HardwareMap createHardwareMap(EventLoopManager var1) throws RobotCoreException, InterruptedException {
- if(this.inputStream == null) {
- throw new RobotCoreException("XML input stream is null, ModernRoboticsHardwareFactory cannot create a hardware map");
- } else {
- HardwareMap var2 = new HardwareMap();
- RobotLog.v("Starting Modern Robotics device manager");
- ModernRoboticsDeviceManager var3 = new ModernRoboticsDeviceManager(this.context, var1);
- Iterator var4 = (new ReadXMLFileHandler(this.context)).parse(this.inputStream).iterator();
-
- while(var4.hasNext()) {
- ControllerConfiguration var5 = (ControllerConfiguration)var4.next();
- DeviceConfiguration.ConfigurationType var6 = var5.getType();
- switch(null.a[var6.ordinal()]) {
- case 1:
- this.a(var2, var3, var5);
- break;
- case 2:
- this.b(var2, var3, var5);
- break;
- case 3:
- this.d(var2, var3, var5);
- break;
- case 4:
- this.c(var2, var3, var5);
- break;
- default:
- RobotLog.w("Unexpected controller type while parsing XML: " + var6.toString());
- }
- }
-
- var2.appContext = this.context;
- return var2;
- }
- }
-
- public InputStream getXmlInputStream() {
- return this.inputStream;
- }
-
- public void setXmlInputStream(InputStream var1) {
- this.inputStream = var1;
- }
-}
+package com.qualcomm.hardware;
+
+import android.content.Context;
+
+import com.qualcomm.robotcore.eventloop.EventLoopManager;
+import com.qualcomm.robotcore.exception.RobotCoreException;
+import com.qualcomm.robotcore.hardware.AccelerationSensor;
+import com.qualcomm.robotcore.hardware.AnalogInput;
+import com.qualcomm.robotcore.hardware.AnalogOutput;
+import com.qualcomm.robotcore.hardware.ColorSensor;
+import com.qualcomm.robotcore.hardware.CompassSensor;
+import com.qualcomm.robotcore.hardware.DcMotor;
+import com.qualcomm.robotcore.hardware.DcMotorController;
+import com.qualcomm.robotcore.hardware.DeviceInterfaceModule;
+import com.qualcomm.robotcore.hardware.DeviceManager;
+import com.qualcomm.robotcore.hardware.DigitalChannel;
+import com.qualcomm.robotcore.hardware.DigitalChannelController;
+import com.qualcomm.robotcore.hardware.GyroSensor;
+import com.qualcomm.robotcore.hardware.HardwareFactory;
+import com.qualcomm.robotcore.hardware.HardwareMap;
+import com.qualcomm.robotcore.hardware.I2cDevice;
+import com.qualcomm.robotcore.hardware.IrSeekerSensor;
+import com.qualcomm.robotcore.hardware.LED;
+import com.qualcomm.robotcore.hardware.LegacyModule;
+import com.qualcomm.robotcore.hardware.LightSensor;
+import com.qualcomm.robotcore.hardware.OpticalDistanceSensor;
+import com.qualcomm.robotcore.hardware.PWMOutput;
+import com.qualcomm.robotcore.hardware.Servo;
+import com.qualcomm.robotcore.hardware.ServoController;
+import com.qualcomm.robotcore.hardware.TouchSensor;
+import com.qualcomm.robotcore.hardware.TouchSensorMultiplexer;
+import com.qualcomm.robotcore.hardware.UltrasonicSensor;
+import com.qualcomm.robotcore.hardware.configuration.ControllerConfiguration;
+import com.qualcomm.robotcore.hardware.configuration.DeviceConfiguration;
+import com.qualcomm.robotcore.hardware.configuration.DeviceInterfaceModuleConfiguration;
+import com.qualcomm.robotcore.hardware.configuration.MatrixControllerConfiguration;
+import com.qualcomm.robotcore.hardware.configuration.MotorControllerConfiguration;
+import com.qualcomm.robotcore.hardware.configuration.ReadXMLFileHandler;
+import com.qualcomm.robotcore.hardware.configuration.ServoControllerConfiguration;
+import com.qualcomm.robotcore.util.RobotLog;
+
+import java.io.InputStream;
+import java.util.Iterator;
+import java.util.List;
+
+public class ModernRoboticsHardwareFactory implements HardwareFactory {
+ private Context context;
+ private InputStream inputStream = null;
+
+ public ModernRoboticsHardwareFactory(Context var1) {
+ this.context = var1;
+ }
+
+ public static void disableDeviceEmulation() {
+ ModernRoboticsDeviceManager.disableDeviceEmulation();
+ }
+
+ public static void enableDeviceEmulation() {
+ ModernRoboticsDeviceManager.enableDeviceEmulation();
+ }
+
+ private void a(HardwareMap var1, DeviceManager var2, DeviceInterfaceModule var3, DeviceConfiguration var4) {
+ IrSeekerSensor var5 = var2.createI2cIrSeekerSensorV3(var3, var4.getPort());
+ var1.irSeekerSensor.put(var4.getName(), var5);
+ }
+
+ private void a(HardwareMap var1, DeviceManager var2, DigitalChannelController var3, DeviceConfiguration var4) {
+ LED var5 = var2.createLED(var3, var4.getPort());
+ var1.led.put(var4.getName(), var5);
+ }
+
+ private void a(HardwareMap var1, DeviceManager var2, LegacyModule var3, DeviceConfiguration var4) {
+ TouchSensor var5 = var2.createNxtTouchSensor(var3, var4.getPort());
+ var1.touchSensor.put(var4.getName(), var5);
+ }
+
+ private void a(HardwareMap var1, DeviceManager var2, ControllerConfiguration var3) throws RobotCoreException, InterruptedException {
+ ModernRoboticsUsbDcMotorController var4 = (ModernRoboticsUsbDcMotorController)var2.createUsbDcMotorController(var3.getSerialNumber());
+ var1.dcMotorController.put(var3.getName(), var4);
+ Iterator var5 = var3.getDevices().iterator();
+
+ while(var5.hasNext()) {
+ DeviceConfiguration var6 = (DeviceConfiguration)var5.next();
+ if(var6.isEnabled()) {
+ DcMotor var7 = var2.createDcMotor(var4, var6.getPort());
+ var1.dcMotor.put(var6.getName(), var7);
+ }
+ }
+
+ var1.voltageSensor.put(var3.getName(), var4);
+ }
+
+ private void a(List var1, HardwareMap var2, DeviceManager var3, DeviceInterfaceModule var4) {
+ Iterator var5 = var1.iterator();
+
+ while(var5.hasNext()) {
+ DeviceConfiguration var6 = (DeviceConfiguration)var5.next();
+ if(var6.isEnabled()) {
+ DeviceConfiguration.ConfigurationType var7 = var6.getType();
+ switch (var7.ordinal()) {
+ case 5:
+ this.h(var2, var3, var4, var6);
+ break;
+ case 6:
+ this.d(var2, var3, var4, var6);
+ break;
+ case 7:
+ this.c(var2, var3, var4, var6);
+ break;
+ case 8:
+ this.b(var2, var3, var4, var6);
+ break;
+ case 9:
+ this.e(var2, var3, var4, var6);
+ break;
+ case 10:
+ this.a(var2, var3, var4, var6);
+ break;
+ case 11:
+ this.f(var2, var3, var4, var6);
+ break;
+ case 12:
+ this.g(var2, var3, var4, var6);
+ break;
+ case 13:
+ this.i(var2, var3, var4, var6);
+ break;
+ case 14:
+ this.a(var2, var3, (DigitalChannelController) var4, var6);
+ break;
+ case 15:
+ this.j(var2, var3, var4, var6);
+ case 16:
+ break;
+ default:
+ RobotLog.w("Unexpected device type connected to Device Interface Module while parsing XML: " + var7.toString());
+ }
+ }
+ }
+
+ }
+
+ private void b(HardwareMap var1, DeviceManager var2, DeviceInterfaceModule var3, DeviceConfiguration var4) {
+ DigitalChannel var5 = var2.createDigitalChannelDevice(var3, var4.getPort());
+ var1.digitalChannel.put(var4.getName(), var5);
+ }
+
+ private void b(HardwareMap var1, DeviceManager var2, LegacyModule var3, DeviceConfiguration var4) {
+ TouchSensorMultiplexer var5 = var2.createNxtTouchSensorMultiplexer(var3, var4.getPort());
+ var1.touchSensorMultiplexer.put(var4.getName(), var5);
+ }
+
+ private void b(HardwareMap var1, DeviceManager var2, ControllerConfiguration var3) throws RobotCoreException, InterruptedException {
+ ServoController var4 = var2.createUsbServoController(var3.getSerialNumber());
+ var1.servoController.put(var3.getName(), var4);
+ Iterator var5 = var3.getDevices().iterator();
+
+ while(var5.hasNext()) {
+ DeviceConfiguration var6 = (DeviceConfiguration)var5.next();
+ if(var6.isEnabled()) {
+ Servo var7 = var2.createServo(var4, var6.getPort());
+ var1.servo.put(var6.getName(), var7);
+ }
+ }
+
+ }
+
+ private void c(HardwareMap var1, DeviceManager var2, DeviceInterfaceModule var3, DeviceConfiguration var4) {
+ TouchSensor var5 = var2.createDigitalTouchSensor(var3, var4.getPort());
+ var1.touchSensor.put(var4.getName(), var5);
+ }
+
+ private void c(HardwareMap var1, DeviceManager var2, LegacyModule var3, DeviceConfiguration var4) {
+ UltrasonicSensor var5 = var2.createNxtUltrasonicSensor(var3, var4.getPort());
+ var1.ultrasonicSensor.put(var4.getName(), var5);
+ }
+
+ private void c(HardwareMap var1, DeviceManager var2, ControllerConfiguration var3) throws RobotCoreException, InterruptedException {
+ DeviceInterfaceModule var4 = var2.createDeviceInterfaceModule(var3.getSerialNumber());
+ var1.deviceInterfaceModule.put(var3.getName(), var4);
+ this.a(((DeviceInterfaceModuleConfiguration)var3).getPwmDevices(), var1, var2, var4);
+ this.a(((DeviceInterfaceModuleConfiguration)var3).getI2cDevices(), var1, var2, var4);
+ this.a(((DeviceInterfaceModuleConfiguration)var3).getAnalogInputDevices(), var1, var2, var4);
+ this.a(((DeviceInterfaceModuleConfiguration)var3).getDigitalDevices(), var1, var2, var4);
+ this.a(((DeviceInterfaceModuleConfiguration) var3).getAnalogOutputDevices(), var1, var2, var4);
+ }
+
+ private void d(HardwareMap var1, DeviceManager var2, DeviceInterfaceModule var3, DeviceConfiguration var4) {
+ AnalogInput var5 = var2.createAnalogInputDevice(var3, var4.getPort());
+ var1.analogInput.put(var4.getName(), var5);
+ }
+
+ private void d(HardwareMap var1, DeviceManager var2, LegacyModule var3, DeviceConfiguration var4) {
+ ColorSensor var5 = var2.createNxtColorSensor(var3, var4.getPort());
+ var1.colorSensor.put(var4.getName(), var5);
+ }
+
+ private void d(HardwareMap var1, DeviceManager var2, ControllerConfiguration var3) throws RobotCoreException, InterruptedException {
+ LegacyModule var4 = var2.createUsbLegacyModule(var3.getSerialNumber());
+ var1.legacyModule.put(var3.getName(), var4);
+ Iterator var5 = var3.getDevices().iterator();
+
+ while(var5.hasNext()) {
+ DeviceConfiguration var6 = (DeviceConfiguration)var5.next();
+ if(var6.isEnabled()) {
+ DeviceConfiguration.ConfigurationType var7 = var6.getType();
+ switch (var7.ordinal()) {
+ case 1:
+ this.j(var1, var2, var4, var6);
+ break;
+ case 2:
+ this.k(var1, var2, var4, var6);
+ break;
+ case 3:
+ case 4:
+ case 5:
+ case 6:
+ case 8:
+ case 9:
+ case 10:
+ case 11:
+ case 12:
+ case 13:
+ case 14:
+ default:
+ RobotLog.w("Unexpected device type connected to Legacy Module while parsing XML: " + var7.toString());
+ break;
+ case 7:
+ this.a(var1, var2, var4, var6);
+ break;
+ case 15:
+ this.d(var1, var2, var4, var6);
+ case 16:
+ break;
+ case 17:
+ this.e(var1, var2, var4, var6);
+ break;
+ case 18:
+ this.f(var1, var2, var4, var6);
+ break;
+ case 19:
+ this.g(var1, var2, var4, var6);
+ break;
+ case 20:
+ this.h(var1, var2, var4, var6);
+ break;
+ case 21:
+ this.i(var1, var2, var4, var6);
+ break;
+ case 22:
+ this.b(var1, var2, var4, var6);
+ break;
+ case 23:
+ this.c(var1, var2, var4, var6);
+ break;
+ case 24:
+ this.l(var1, var2, var4, var6);
+ }
+ }
+ }
+
+ }
+
+ private void e(HardwareMap var1, DeviceManager var2, DeviceInterfaceModule var3, DeviceConfiguration var4) {
+ PWMOutput var5 = var2.createPwmOutputDevice(var3, var4.getPort());
+ var1.pwmOutput.put(var4.getName(), var5);
+ }
+
+ private void e(HardwareMap var1, DeviceManager var2, LegacyModule var3, DeviceConfiguration var4) {
+ GyroSensor var5 = var2.createNxtGyroSensor(var3, var4.getPort());
+ var1.gyroSensor.put(var4.getName(), var5);
+ }
+
+ private void f(HardwareMap var1, DeviceManager var2, DeviceInterfaceModule var3, DeviceConfiguration var4) {
+ I2cDevice var5 = var2.createI2cDevice(var3, var4.getPort());
+ var1.i2cDevice.put(var4.getName(), var5);
+ }
+
+ private void f(HardwareMap var1, DeviceManager var2, LegacyModule var3, DeviceConfiguration var4) {
+ CompassSensor var5 = var2.createNxtCompassSensor(var3, var4.getPort());
+ var1.compassSensor.put(var4.getName(), var5);
+ }
+
+ private void g(HardwareMap var1, DeviceManager var2, DeviceInterfaceModule var3, DeviceConfiguration var4) {
+ AnalogOutput var5 = var2.createAnalogOutputDevice(var3, var4.getPort());
+ var1.analogOutput.put(var4.getName(), var5);
+ }
+
+ private void g(HardwareMap var1, DeviceManager var2, LegacyModule var3, DeviceConfiguration var4) {
+ IrSeekerSensor var5 = var2.createNxtIrSeekerSensor(var3, var4.getPort());
+ var1.irSeekerSensor.put(var4.getName(), var5);
+ }
+
+ private void h(HardwareMap var1, DeviceManager var2, DeviceInterfaceModule var3, DeviceConfiguration var4) {
+ OpticalDistanceSensor var5 = var2.createAnalogOpticalDistanceSensor(var3, var4.getPort());
+ var1.opticalDistanceSensor.put(var4.getName(), var5);
+ }
+
+ private void h(HardwareMap var1, DeviceManager var2, LegacyModule var3, DeviceConfiguration var4) {
+ LightSensor var5 = var2.createNxtLightSensor(var3, var4.getPort());
+ var1.lightSensor.put(var4.getName(), var5);
+ }
+
+ private void i(HardwareMap var1, DeviceManager var2, DeviceInterfaceModule var3, DeviceConfiguration var4) {
+ ColorSensor var5 = var2.createAdafruitI2cColorSensor(var3, var4.getPort());
+ var1.colorSensor.put(var4.getName(), var5);
+ }
+
+ private void i(HardwareMap var1, DeviceManager var2, LegacyModule var3, DeviceConfiguration var4) {
+ AccelerationSensor var5 = var2.createNxtAccelerationSensor(var3, var4.getPort());
+ var1.accelerationSensor.put(var4.getName(), var5);
+ }
+
+ private void j(HardwareMap var1, DeviceManager var2, DeviceInterfaceModule var3, DeviceConfiguration var4) {
+ ColorSensor var5 = var2.createModernRoboticsI2cColorSensor(var3, var4.getPort());
+ var1.colorSensor.put(var4.getName(), var5);
+ }
+
+ private void j(HardwareMap var1, DeviceManager var2, LegacyModule var3, DeviceConfiguration var4) {
+ DcMotorController var5 = var2.createNxtDcMotorController(var3, var4.getPort());
+ var1.dcMotorController.put(var4.getName(), var5);
+ Iterator var6 = ((MotorControllerConfiguration)var4).getMotors().iterator();
+
+ while(var6.hasNext()) {
+ DeviceConfiguration var7 = (DeviceConfiguration)var6.next();
+ DcMotor var8 = var2.createDcMotor(var5, var7.getPort());
+ var1.dcMotor.put(var7.getName(), var8);
+ }
+
+ }
+
+ private void k(HardwareMap var1, DeviceManager var2, LegacyModule var3, DeviceConfiguration var4) {
+ ServoController var5 = var2.createNxtServoController(var3, var4.getPort());
+ var1.servoController.put(var4.getName(), var5);
+ Iterator var6 = ((ServoControllerConfiguration)var4).getServos().iterator();
+
+ while(var6.hasNext()) {
+ DeviceConfiguration var7 = (DeviceConfiguration)var6.next();
+ Servo var8 = var2.createServo(var5, var7.getPort());
+ var1.servo.put(var7.getName(), var8);
+ }
+
+ }
+
+ private void l(HardwareMap var1, DeviceManager var2, LegacyModule var3, DeviceConfiguration var4) {
+ MatrixMasterController var5 = new MatrixMasterController((ModernRoboticsUsbLegacyModule)var3, var4.getPort());
+ MatrixDcMotorController var6 = new MatrixDcMotorController(var5);
+ var1.dcMotorController.put(var4.getName() + "Motor", var6);
+ Iterator var7 = ((MatrixControllerConfiguration)var4).getMotors().iterator();
+
+ while(var7.hasNext()) {
+ DeviceConfiguration var12 = (DeviceConfiguration)var7.next();
+ DcMotor var13 = var2.createDcMotor(var6, var12.getPort());
+ var1.dcMotor.put(var12.getName(), var13);
+ }
+
+ MatrixServoController var8 = new MatrixServoController(var5);
+ var1.servoController.put(var4.getName() + "Servo", var8);
+ Iterator var9 = ((MatrixControllerConfiguration)var4).getServos().iterator();
+
+ while(var9.hasNext()) {
+ DeviceConfiguration var10 = (DeviceConfiguration)var9.next();
+ Servo var11 = var2.createServo(var8, var10.getPort());
+ var1.servo.put(var10.getName(), var11);
+ }
+
+ }
+
+ public HardwareMap createHardwareMap(EventLoopManager var1) throws RobotCoreException, InterruptedException {
+ if(this.inputStream == null) {
+ throw new RobotCoreException("XML input stream is null, ModernRoboticsHardwareFactory cannot create Type1 hardware map");
+ } else {
+ HardwareMap var2 = new HardwareMap();
+ RobotLog.v("Starting Modern Robotics device manager");
+ ModernRoboticsDeviceManager var3 = new ModernRoboticsDeviceManager(this.context, var1);
+ Iterator var4 = (new ReadXMLFileHandler(this.context)).parse(this.inputStream).iterator();
+
+ while(var4.hasNext()) {
+ ControllerConfiguration var5 = (ControllerConfiguration)var4.next();
+ DeviceConfiguration.ConfigurationType var6 = var5.getType();
+ switch (var6.ordinal()) {
+ case 1:
+ this.a(var2, var3, var5);
+ break;
+ case 2:
+ this.b(var2, var3, var5);
+ break;
+ case 3:
+ this.d(var2, var3, var5);
+ break;
+ case 4:
+ this.c(var2, var3, var5);
+ break;
+ default:
+ RobotLog.w("Unexpected controller type while parsing XML: " + var6.toString());
+ }
+ }
+
+ var2.appContext = this.context;
+ return var2;
+ }
+ }
+
+ public InputStream getXmlInputStream() {
+ return this.inputStream;
+ }
+
+ public void setXmlInputStream(InputStream var1) {
+ this.inputStream = var1;
+ }
+}
diff --git a/FtcRobotController/app/src/main/java/com/qualcomm/hardware/ModernRoboticsI2cColorSensor.java b/FtcRobotController/Hardware/src/main/java/com/qualcomm/hardware/ModernRoboticsI2cColorSensor.java
similarity index 84%
rename from FtcRobotController/app/src/main/java/com/qualcomm/hardware/ModernRoboticsI2cColorSensor.java
rename to FtcRobotController/Hardware/src/main/java/com/qualcomm/hardware/ModernRoboticsI2cColorSensor.java
index 38fa9ed..56c7b2d 100644
--- a/FtcRobotController/app/src/main/java/com/qualcomm/hardware/ModernRoboticsI2cColorSensor.java
+++ b/FtcRobotController/Hardware/src/main/java/com/qualcomm/hardware/ModernRoboticsI2cColorSensor.java
@@ -1,139 +1,141 @@
-package com.qualcomm.hardware;
-
-import android.graphics.Color;
-import com.qualcomm.robotcore.hardware.ColorSensor;
-import com.qualcomm.robotcore.hardware.DeviceInterfaceModule;
-import com.qualcomm.robotcore.hardware.I2cController;
-import com.qualcomm.robotcore.util.TypeConversion;
-import java.util.concurrent.locks.Lock;
-
-public class ModernRoboticsI2cColorSensor extends ColorSensor implements I2cController.I2cPortReadyCallback {
- public static final int ADDRESS_COLOR_NUMBER = 4;
- public static final int ADDRESS_COMMAND = 3;
- public static final int ADDRESS_I2C = 60;
- public static final int BUFFER_LENGTH = 6;
- public static final int COMMAND_ACTIVE_LED = 0;
- public static final int COMMAND_PASSIVE_LED = 1;
- public static final int OFFSET_ALPHA_VALUE = 9;
- public static final int OFFSET_BLUE_READING = 8;
- public static final int OFFSET_COLOR_NUMBER = 5;
- public static final int OFFSET_COMMAND = 4;
- public static final int OFFSET_GREEN_READING = 7;
- public static final int OFFSET_RED_READING = 6;
- private final DeviceInterfaceModule a;
- private final byte[] b;
- private final Lock c;
- private final byte[] d;
- private final Lock e;
- private ModernRoboticsI2cColorSensor.a f;
- private volatile int g;
- private final int h;
-
- ModernRoboticsI2cColorSensor(DeviceInterfaceModule var1, int var2) {
- this.f = ModernRoboticsI2cColorSensor.a.a;
- this.g = 0;
- this.a = var1;
- this.h = var2;
- this.b = var1.getI2cReadCache(var2);
- this.c = var1.getI2cReadCacheLock(var2);
- this.d = var1.getI2cWriteCache(var2);
- this.e = var1.getI2cWriteCacheLock(var2);
- var1.enableI2cReadMode(var2, 60, 3, 6);
- var1.setI2cPortActionFlag(var2);
- var1.writeI2cCacheToController(var2);
- var1.registerForI2cPortReadyCallback(this, var2);
- }
-
- private int a(int var1) {
- byte var3;
- try {
- this.c.lock();
- var3 = this.b[var1];
- } finally {
- this.c.unlock();
- }
-
- return TypeConversion.unsignedByteToInt(var3);
- }
-
- public int alpha() {
- return this.a(9);
- }
-
- public int argb() {
- return Color.argb(this.alpha(), this.red(), this.green(), this.blue());
- }
-
- public int blue() {
- return this.a(8);
- }
-
- public void close() {
- }
-
- public void enableLed(boolean var1) {
- byte var2 = 1;
- if(var1) {
- var2 = 0;
- }
-
- if(this.g != var2) {
- this.g = var2;
- this.f = ModernRoboticsI2cColorSensor.a.b;
-
- try {
- this.e.lock();
- this.d[4] = var2;
- } finally {
- this.e.unlock();
- }
-
- }
- }
-
- public String getConnectionInfo() {
- return this.a.getConnectionInfo() + "; I2C port: " + this.h;
- }
-
- public String getDeviceName() {
- return "Modern Robotics I2C Color Sensor";
- }
-
- public int getVersion() {
- return 1;
- }
-
- public int green() {
- return this.a(7);
- }
-
- public void portIsReady(int var1) {
- this.a.setI2cPortActionFlag(this.h);
- this.a.readI2cCacheFromController(this.h);
- if(this.f == ModernRoboticsI2cColorSensor.a.b) {
- this.a.enableI2cWriteMode(this.h, 60, 3, 6);
- this.a.writeI2cCacheToController(this.h);
- this.f = ModernRoboticsI2cColorSensor.a.c;
- } else if(this.f == ModernRoboticsI2cColorSensor.a.c) {
- this.a.enableI2cReadMode(this.h, 60, 3, 6);
- this.a.writeI2cCacheToController(this.h);
- this.f = ModernRoboticsI2cColorSensor.a.a;
- } else {
- this.a.writeI2cPortFlagOnlyToController(this.h);
- }
- }
-
- public int red() {
- return this.a(6);
- }
-
- private static enum a {
- a,
- b,
- c;
-
- static {
- ModernRoboticsI2cColorSensor.a[] var0 = new ModernRoboticsI2cColorSensor.a[]{a, b, c};
- }
- }
-}
+package com.qualcomm.hardware;
+
+import android.graphics.Color;
+
+import com.qualcomm.robotcore.hardware.ColorSensor;
+import com.qualcomm.robotcore.hardware.DeviceInterfaceModule;
+import com.qualcomm.robotcore.hardware.I2cController;
+import com.qualcomm.robotcore.util.TypeConversion;
+
+import java.util.concurrent.locks.Lock;
+
+public class ModernRoboticsI2cColorSensor extends ColorSensor implements I2cController.I2cPortReadyCallback {
+ public static final int ADDRESS_COLOR_NUMBER = 4;
+ public static final int ADDRESS_COMMAND = 3;
+ public static final int ADDRESS_I2C = 60;
+ public static final int BUFFER_LENGTH = 6;
+ public static final int COMMAND_ACTIVE_LED = 0;
+ public static final int COMMAND_PASSIVE_LED = 1;
+ public static final int OFFSET_ALPHA_VALUE = 9;
+ public static final int OFFSET_BLUE_READING = 8;
+ public static final int OFFSET_COLOR_NUMBER = 5;
+ public static final int OFFSET_COMMAND = 4;
+ public static final int OFFSET_GREEN_READING = 7;
+ public static final int OFFSET_RED_READING = 6;
+ private final DeviceInterfaceModule a;
+ private final byte[] b;
+ private final Lock c;
+ private final byte[] d;
+ private final Lock e;
+ private final int h;
+ private States f;
+ private volatile int g;
+
+ ModernRoboticsI2cColorSensor(DeviceInterfaceModule var1, int var2) {
+ this.f = ModernRoboticsI2cColorSensor.States.a;
+ this.g = 0;
+ this.a = var1;
+ this.h = var2;
+ this.b = var1.getI2cReadCache(var2);
+ this.c = var1.getI2cReadCacheLock(var2);
+ this.d = var1.getI2cWriteCache(var2);
+ this.e = var1.getI2cWriteCacheLock(var2);
+ var1.enableI2cReadMode(var2, 60, 3, 6);
+ var1.setI2cPortActionFlag(var2);
+ var1.writeI2cCacheToController(var2);
+ var1.registerForI2cPortReadyCallback(this, var2);
+ }
+
+ private int a(int var1) {
+ byte var3;
+ try {
+ this.c.lock();
+ var3 = this.b[var1];
+ } finally {
+ this.c.unlock();
+ }
+
+ return TypeConversion.unsignedByteToInt(var3);
+ }
+
+ public int alpha() {
+ return this.a(9);
+ }
+
+ public int argb() {
+ return Color.argb(this.alpha(), this.red(), this.green(), this.blue());
+ }
+
+ public int blue() {
+ return this.a(8);
+ }
+
+ public void close() {
+ }
+
+ public void enableLed(boolean var1) {
+ byte var2 = 1;
+ if(var1) {
+ var2 = 0;
+ }
+
+ if(this.g != var2) {
+ this.g = var2;
+ this.f = ModernRoboticsI2cColorSensor.States.b;
+
+ try {
+ this.e.lock();
+ this.d[4] = var2;
+ } finally {
+ this.e.unlock();
+ }
+
+ }
+ }
+
+ public String getConnectionInfo() {
+ return this.a.getConnectionInfo() + "; I2C port: " + this.h;
+ }
+
+ public String getDeviceName() {
+ return "Modern Robotics I2C Color Sensor";
+ }
+
+ public int getVersion() {
+ return 1;
+ }
+
+ public int green() {
+ return this.a(7);
+ }
+
+ public void portIsReady(int var1) {
+ this.a.setI2cPortActionFlag(this.h);
+ this.a.readI2cCacheFromController(this.h);
+ if (this.f == ModernRoboticsI2cColorSensor.States.b) {
+ this.a.enableI2cWriteMode(this.h, 60, 3, 6);
+ this.a.writeI2cCacheToController(this.h);
+ this.f = ModernRoboticsI2cColorSensor.States.c;
+ } else if (this.f == ModernRoboticsI2cColorSensor.States.c) {
+ this.a.enableI2cReadMode(this.h, 60, 3, 6);
+ this.a.writeI2cCacheToController(this.h);
+ this.f = ModernRoboticsI2cColorSensor.States.a;
+ } else {
+ this.a.writeI2cPortFlagOnlyToController(this.h);
+ }
+ }
+
+ public int red() {
+ return this.a(6);
+ }
+
+ private enum States {
+ a,
+ b,
+ c;
+
+ static {
+ States[] var0 = new States[]{a, b, c};
+ }
+ }
+}
diff --git a/FtcRobotController/app/src/main/java/com/qualcomm/hardware/ModernRoboticsI2cIrSeekerSensorV3.java b/FtcRobotController/Hardware/src/main/java/com/qualcomm/hardware/ModernRoboticsI2cIrSeekerSensorV3.java
similarity index 81%
rename from FtcRobotController/app/src/main/java/com/qualcomm/hardware/ModernRoboticsI2cIrSeekerSensorV3.java
rename to FtcRobotController/Hardware/src/main/java/com/qualcomm/hardware/ModernRoboticsI2cIrSeekerSensorV3.java
index fab422c..186a42d 100644
--- a/FtcRobotController/app/src/main/java/com/qualcomm/hardware/ModernRoboticsI2cIrSeekerSensorV3.java
+++ b/FtcRobotController/Hardware/src/main/java/com/qualcomm/hardware/ModernRoboticsI2cIrSeekerSensorV3.java
@@ -1,151 +1,171 @@
-package com.qualcomm.hardware;
-
-import com.qualcomm.robotcore.hardware.DeviceInterfaceModule;
-import com.qualcomm.robotcore.hardware.I2cController;
-import com.qualcomm.robotcore.hardware.IrSeekerSensor;
-import com.qualcomm.robotcore.util.TypeConversion;
-import java.util.concurrent.locks.Lock;
-
-public class ModernRoboticsI2cIrSeekerSensorV3 extends IrSeekerSensor implements I2cController.I2cPortReadyCallback {
- public static final int ADDRESS_MEM_START = 4;
- public static final double DEFAULT_SIGNAL_DETECTED_THRESHOLD = 0.00390625D;
- public static final byte INVALID_ANGLE = 0;
- public static final double MAX_SENSOR_STRENGTH = 256.0D;
- public static final int MEM_LENGTH = 12;
- public static final int OFFSET_1200HZ_HEADING_DATA = 4;
- public static final int OFFSET_1200HZ_LEFT_SIDE_RAW_DATA = 8;
- public static final int OFFSET_1200HZ_RIGHT_SIDE_RAW_DATA = 10;
- public static final int OFFSET_1200HZ_SIGNAL_STRENGTH = 5;
- public static final int OFFSET_600HZ_HEADING_DATA = 6;
- public static final int OFFSET_600HZ_LEFT_SIDE_RAW_DATA = 12;
- public static final int OFFSET_600HZ_RIGHT_SIDE_RAW_DATA = 14;
- public static final int OFFSET_600HZ_SIGNAL_STRENGTH = 7;
- public static final byte SENSOR_COUNT = 2;
- public volatile int I2C_ADDRESS = 56;
- private final DeviceInterfaceModule a;
- private final int b;
- private IrSeekerSensor.Mode c;
- private final byte[] d;
- private final Lock e;
- private double f = 0.00390625D;
-
- public ModernRoboticsI2cIrSeekerSensorV3(DeviceInterfaceModule var1, int var2) {
- this.a = var1;
- this.b = var2;
- this.c = IrSeekerSensor.Mode.MODE_1200HZ;
- this.d = this.a.getI2cReadCache(var2);
- this.e = this.a.getI2cReadCacheLock(var2);
- this.a.enableI2cReadMode(var2, this.I2C_ADDRESS, 4, 12);
- this.a.setI2cPortActionFlag(var2);
- this.a.writeI2cCacheToController(var2);
- this.a.registerForI2cPortReadyCallback(this, var2);
- }
-
- public void close() {
- }
-
- public double getAngle() {
- byte var1;
- if(this.c == IrSeekerSensor.Mode.MODE_1200HZ) {
- var1 = 4;
- } else {
- var1 = 6;
- }
-
- boolean var7 = false;
-
- byte var3;
- try {
- var7 = true;
- this.e.lock();
- var3 = this.d[var1];
- var7 = false;
- } finally {
- if(var7) {
- this.e.unlock();
- }
- }
-
- double var4 = (double)var3;
- this.e.unlock();
- return var4;
- }
-
- public String getConnectionInfo() {
- return this.a.getConnectionInfo() + "; I2C port " + this.b;
- }
-
- public String getDeviceName() {
- return "Modern Robotics I2C IR Seeker Sensor";
- }
-
- public int getI2cAddress() {
- return this.I2C_ADDRESS;
- }
-
- public IrSeekerSensor.IrSeekerIndividualSensor[] getIndividualSensors() {
- // $FF: Couldn't be decompiled
- }
-
- public IrSeekerSensor.Mode getMode() {
- return this.c;
- }
-
- public double getSignalDetectedThreshold() {
- return this.f;
- }
-
- public double getStrength() {
- byte var1;
- if(this.c == IrSeekerSensor.Mode.MODE_1200HZ) {
- var1 = 5;
- } else {
- var1 = 7;
- }
-
- boolean var8 = false;
-
- double var3;
- try {
- var8 = true;
- this.e.lock();
- var3 = TypeConversion.unsignedByteToDouble(this.d[var1]);
- var8 = false;
- } finally {
- if(var8) {
- this.e.unlock();
- }
- }
-
- double var5 = var3 / 256.0D;
- this.e.unlock();
- return var5;
- }
-
- public int getVersion() {
- return 3;
- }
-
- public void portIsReady(int var1) {
- this.a.setI2cPortActionFlag(var1);
- this.a.readI2cCacheFromController(var1);
- this.a.writeI2cPortFlagOnlyToController(var1);
- }
-
- public void setI2cAddress(int var1) {
- IrSeekerSensor.throwIfModernRoboticsI2cAddressIsInvalid(var1);
- this.I2C_ADDRESS = var1;
- }
-
- public void setMode(IrSeekerSensor.Mode var1) {
- this.c = var1;
- }
-
- public void setSignalDetectedThreshold(double var1) {
- this.f = var1;
- }
-
- public boolean signalDetected() {
- return this.getStrength() > this.f;
- }
-}
+package com.qualcomm.hardware;
+
+import com.qualcomm.robotcore.hardware.DeviceInterfaceModule;
+import com.qualcomm.robotcore.hardware.I2cController;
+import com.qualcomm.robotcore.hardware.IrSeekerSensor;
+import com.qualcomm.robotcore.util.TypeConversion;
+
+import java.nio.ByteOrder;
+import java.util.concurrent.locks.Lock;
+
+public class ModernRoboticsI2cIrSeekerSensorV3 extends IrSeekerSensor implements I2cController.I2cPortReadyCallback {
+ public static final int ADDRESS_MEM_START = 4;
+ public static final double DEFAULT_SIGNAL_DETECTED_THRESHOLD = 0.00390625D;
+ public static final byte INVALID_ANGLE = 0;
+ public static final double MAX_SENSOR_STRENGTH = 256.0D;
+ public static final int MEM_LENGTH = 12;
+ public static final int OFFSET_1200HZ_HEADING_DATA = 4;
+ public static final int OFFSET_1200HZ_LEFT_SIDE_RAW_DATA = 8;
+ public static final int OFFSET_1200HZ_RIGHT_SIDE_RAW_DATA = 10;
+ public static final int OFFSET_1200HZ_SIGNAL_STRENGTH = 5;
+ public static final int OFFSET_600HZ_HEADING_DATA = 6;
+ public static final int OFFSET_600HZ_LEFT_SIDE_RAW_DATA = 12;
+ public static final int OFFSET_600HZ_RIGHT_SIDE_RAW_DATA = 14;
+ public static final int OFFSET_600HZ_SIGNAL_STRENGTH = 7;
+ public static final byte SENSOR_COUNT = 2;
+ private final DeviceInterfaceModule a;
+ private final int b;
+ private final byte[] d;
+ private final Lock e;
+ public volatile int I2C_ADDRESS = 56;
+ private IrSeekerSensor.Mode c;
+ private double f = 0.00390625D;
+
+ public ModernRoboticsI2cIrSeekerSensorV3(DeviceInterfaceModule var1, int var2) {
+ this.a = var1;
+ this.b = var2;
+ this.c = IrSeekerSensor.Mode.MODE_1200HZ;
+ this.d = this.a.getI2cReadCache(var2);
+ this.e = this.a.getI2cReadCacheLock(var2);
+ this.a.enableI2cReadMode(var2, this.I2C_ADDRESS, 4, 12);
+ this.a.setI2cPortActionFlag(var2);
+ this.a.writeI2cCacheToController(var2);
+ this.a.registerForI2cPortReadyCallback(this, var2);
+ }
+
+ public void close() {
+ }
+
+ public double getAngle() {
+ byte var1;
+ if(this.c == IrSeekerSensor.Mode.MODE_1200HZ) {
+ var1 = 4;
+ } else {
+ var1 = 6;
+ }
+
+ boolean var7 = false;
+
+ byte var3;
+ try {
+ var7 = true;
+ this.e.lock();
+ var3 = this.d[var1];
+ var7 = false;
+ } finally {
+ if(var7) {
+ this.e.unlock();
+ }
+ }
+
+ double var4 = (double)var3;
+ this.e.unlock();
+ return var4;
+ }
+
+ public String getConnectionInfo() {
+ return this.a.getConnectionInfo() + "; I2C port " + this.b;
+ }
+
+ public String getDeviceName() {
+ return "Modern Robotics I2C IR Seeker Sensor";
+ }
+
+ public int getI2cAddress() {
+ return this.I2C_ADDRESS;
+ }
+
+ public void setI2cAddress(int var1) {
+ IrSeekerSensor.throwIfModernRoboticsI2cAddressIsInvalid(var1);
+ this.I2C_ADDRESS = var1;
+ }
+
+ public IrSeekerIndividualSensor[] getIndividualSensors() {
+ IrSeekerIndividualSensor[] var1 = new IrSeekerIndividualSensor[2];
+
+ try {
+ this.e.lock();
+ int var2 = this.c == Mode.MODE_1200HZ ? 8 : 12;
+ byte[] var3 = new byte[2];
+ System.arraycopy(this.d, var2, var3, 0, var3.length);
+ double var4 = (double) TypeConversion.byteArrayToShort(var3, ByteOrder.LITTLE_ENDIAN) / 256.0D;
+ var1[0] = new IrSeekerIndividualSensor(-1.0D, var4);
+ int var6 = this.c == Mode.MODE_1200HZ ? 10 : 14;
+ byte[] var7 = new byte[2];
+ System.arraycopy(this.d, var6, var7, 0, var7.length);
+ double var8 = (double) TypeConversion.byteArrayToShort(var7, ByteOrder.LITTLE_ENDIAN) / 256.0D;
+ var1[1] = new IrSeekerIndividualSensor(1.0D, var8);
+ } finally {
+ this.e.unlock();
+ }
+
+ return var1;
+ }
+
+ public IrSeekerSensor.Mode getMode() {
+ return this.c;
+ }
+
+ public void setMode(IrSeekerSensor.Mode var1) {
+ this.c = var1;
+ }
+
+ public double getSignalDetectedThreshold() {
+ return this.f;
+ }
+
+ public void setSignalDetectedThreshold(double var1) {
+ this.f = var1;
+ }
+
+ public double getStrength() {
+ byte var1;
+ if(this.c == IrSeekerSensor.Mode.MODE_1200HZ) {
+ var1 = 5;
+ } else {
+ var1 = 7;
+ }
+
+ boolean var8 = false;
+
+ double var3;
+ try {
+ var8 = true;
+ this.e.lock();
+ var3 = TypeConversion.unsignedByteToDouble(this.d[var1]);
+ var8 = false;
+ } finally {
+ if(var8) {
+ this.e.unlock();
+ }
+ }
+
+ double var5 = var3 / 256.0D;
+ this.e.unlock();
+ return var5;
+ }
+
+ public int getVersion() {
+ return 3;
+ }
+
+ public void portIsReady(int var1) {
+ this.a.setI2cPortActionFlag(var1);
+ this.a.readI2cCacheFromController(var1);
+ this.a.writeI2cPortFlagOnlyToController(var1);
+ }
+
+ public boolean signalDetected() {
+ return this.getStrength() > this.f;
+ }
+}
diff --git a/FtcRobotController/app/src/main/java/com/qualcomm/hardware/ModernRoboticsUsbDcMotorController.java b/FtcRobotController/Hardware/src/main/java/com/qualcomm/hardware/ModernRoboticsUsbDcMotorController.java
similarity index 95%
rename from FtcRobotController/app/src/main/java/com/qualcomm/hardware/ModernRoboticsUsbDcMotorController.java
rename to FtcRobotController/Hardware/src/main/java/com/qualcomm/hardware/ModernRoboticsUsbDcMotorController.java
index a50bc7f..0958868 100644
--- a/FtcRobotController/app/src/main/java/com/qualcomm/hardware/ModernRoboticsUsbDcMotorController.java
+++ b/FtcRobotController/Hardware/src/main/java/com/qualcomm/hardware/ModernRoboticsUsbDcMotorController.java
@@ -1,308 +1,308 @@
-package com.qualcomm.hardware;
-
-import com.qualcomm.robotcore.eventloop.EventLoopManager;
-import com.qualcomm.robotcore.exception.RobotCoreException;
-import com.qualcomm.robotcore.hardware.DcMotorController;
-import com.qualcomm.robotcore.hardware.VoltageSensor;
-import com.qualcomm.robotcore.hardware.usb.RobotUsbDevice;
-import com.qualcomm.robotcore.util.DifferentialControlLoopCoefficients;
-import com.qualcomm.robotcore.util.Range;
-import com.qualcomm.robotcore.util.SerialNumber;
-import com.qualcomm.robotcore.util.TypeConversion;
-
-public class ModernRoboticsUsbDcMotorController extends ModernRoboticsUsbDevice implements DcMotorController, VoltageSensor {
- public static final int ADDRESS_BATTERY_VOLTAGE = 84;
- public static final int[] ADDRESS_MAX_DIFFERENTIAL_CONTROL_LOOP_COEFFICIENT_MAP = new int[]{255, 87, 91};
- public static final int ADDRESS_MOTOR1_CURRENT_ENCODER_VALUE = 76;
- public static final int ADDRESS_MOTOR1_D_COEFFICIENT = 89;
- public static final int ADDRESS_MOTOR1_GEAR_RATIO = 86;
- public static final int ADDRESS_MOTOR1_I_COEFFICIENT = 88;
- public static final int ADDRESS_MOTOR1_MODE = 68;
- public static final int ADDRESS_MOTOR1_POWER = 69;
- public static final int ADDRESS_MOTOR1_P_COEFFICIENT = 87;
- public static final int ADDRESS_MOTOR1_TARGET_ENCODER_VALUE = 64;
- public static final int ADDRESS_MOTOR2_CURRENT_ENCODER_VALUE = 80;
- public static final int ADDRESS_MOTOR2_D_COEFFICIENT = 93;
- public static final int ADDRESS_MOTOR2_GEAR_RATIO = 90;
- public static final int ADDRESS_MOTOR2_I_COEFFICIENT = 92;
- public static final int ADDRESS_MOTOR2_MODE = 71;
- public static final int ADDRESS_MOTOR2_POWER = 70;
- public static final int ADDRESS_MOTOR2_P_COEFFICIENT = 91;
- public static final int ADDRESS_MOTOR2_TARGET_ENCODER_VALUE = 72;
- public static final int[] ADDRESS_MOTOR_CURRENT_ENCODER_VALUE_MAP = new int[]{255, 76, 80};
- public static final int[] ADDRESS_MOTOR_GEAR_RATIO_MAP = new int[]{255, 86, 90};
- public static final int[] ADDRESS_MOTOR_MODE_MAP = new int[]{255, 68, 71};
- public static final int[] ADDRESS_MOTOR_POWER_MAP = new int[]{255, 69, 70};
- public static final int[] ADDRESS_MOTOR_TARGET_ENCODER_VALUE_MAP = new int[]{255, 64, 72};
- public static final int ADDRESS_UNUSED = 255;
- public static final double BATTERY_MAX_MEASURABLE_VOLTAGE = 20.4D;
- public static final int BATTERY_MAX_MEASURABLE_VOLTAGE_INT = 1023;
- public static final byte CHANNEL_MODE_FLAG_BUSY = -128;
- public static final byte CHANNEL_MODE_FLAG_ERROR = 64;
- public static final byte CHANNEL_MODE_FLAG_LOCK = 4;
- public static final byte CHANNEL_MODE_FLAG_NO_TIMEOUT = 16;
- public static final byte CHANNEL_MODE_FLAG_REVERSE = 8;
- public static final byte CHANNEL_MODE_FLAG_SELECT_RESET = 3;
- public static final byte CHANNEL_MODE_FLAG_SELECT_RUN_CONSTANT_SPEED = 1;
- public static final byte CHANNEL_MODE_FLAG_SELECT_RUN_POWER_CONTROL_ONLY = 0;
- public static final byte CHANNEL_MODE_FLAG_SELECT_RUN_TO_POSITION = 2;
- public static final byte CHANNEL_MODE_FLAG_UNUSED = 32;
- public static final int CHANNEL_MODE_MASK_BUSY = 128;
- public static final int CHANNEL_MODE_MASK_EMPTY_D5 = 32;
- public static final int CHANNEL_MODE_MASK_ERROR = 64;
- public static final int CHANNEL_MODE_MASK_LOCK = 4;
- public static final int CHANNEL_MODE_MASK_NO_TIMEOUT = 16;
- public static final int CHANNEL_MODE_MASK_REVERSE = 8;
- public static final int CHANNEL_MODE_MASK_SELECTION = 3;
- public static final boolean DEBUG_LOGGING = false;
- public static final byte DEFAULT_D_COEFFICIENT = -72;
- public static final byte DEFAULT_I_COEFFICIENT = 64;
- public static final byte DEFAULT_P_COEFFICIENT = -128;
- public static final int DIFFERENTIAL_CONTROL_LOOP_COEFFICIENT_MAX = 255;
- public static final int MAX_MOTOR = 2;
- public static final int MIN_MOTOR = 1;
- public static final int MONITOR_LENGTH = 30;
- public static final byte POWER_BREAK = 0;
- public static final byte POWER_FLOAT = -128;
- public static final byte POWER_MAX = 100;
- public static final byte POWER_MIN = -100;
- public static final byte RATIO_MAX = 127;
- public static final byte RATIO_MIN = -128;
- public static final byte START_ADDRESS = 64;
- private IsBusyHelper[] isBusyHelpers;
-
- protected ModernRoboticsUsbDcMotorController(SerialNumber var1, RobotUsbDevice var2, EventLoopManager var3) throws RobotCoreException, InterruptedException {
- super(var1, var3, new ReadWriteRunnableBlocking(var1, var2, 30, 64, false));
- this.isBusyHelpers = new IsBusyHelper[3];
- this.readWriteRunnable.setCallback(this);
-
- int index = 0;
- while(index < this.isBusyHelpers.length) {
- this.isBusyHelpers[index] = new IsBusyHelper(null);
- ++index;
- }
-
- this.floatMotors();
- this.initializePID();
- }
-
- private void floatMotors() {
- this.setMotorPowerFloat(1);
- this.setMotorPowerFloat(2);
- }
-
- private void validateMotor(int motor) {
- if(motor < 1 || motor > 2) {
- Object[] var2 = new Object[]{Integer.valueOf(motor), Integer.valueOf(2)};
- throw new IllegalArgumentException(String.format("Motor %d is invalid; valid motors are 1..%d", var2));
- }
- }
-
- private void initializePID() {
- for(int motor = 1; motor <= 2; ++motor) {
- this.write(ADDRESS_MAX_DIFFERENTIAL_CONTROL_LOOP_COEFFICIENT_MAP[motor], new byte[]{(byte)-128, (byte)64, (byte)-72});
- }
-
- }
-
- public static DcMotorController.RunMode flagToRunMode(byte grf) {
- switch(grf & 3) {
- case 0:
- return DcMotorController.RunMode.RUN_WITHOUT_ENCODERS;
- case 1:
- return DcMotorController.RunMode.RUN_USING_ENCODERS;
- case 2:
- return DcMotorController.RunMode.RUN_TO_POSITION;
- case 3:
- return DcMotorController.RunMode.RESET_ENCODERS;
- default:
- return DcMotorController.RunMode.RUN_WITHOUT_ENCODERS;
- }
- }
-
- public static byte runModeToFlag(DcMotorController.RunMode mode) {
- switch(mode.ordinal()) {
- case 1:
- default:
- return (byte)1;
- case 2:
- return (byte)0;
- case 3:
- return (byte)2;
- case 4:
- return (byte)3;
- }
- }
-
- public void close() {
- this.floatMotors();
- super.close();
- }
-
- public String getConnectionInfo() {
- return "USB " + this.getSerialNumber();
- }
-
- public String getDeviceName() {
- return "Modern Robotics USB DC Motor Controller";
- }
-
- public DifferentialControlLoopCoefficients getDifferentialControlLoopCoefficients(int motor) {
- this.validateMotor(motor);
- DifferentialControlLoopCoefficients coeffs = new DifferentialControlLoopCoefficients();
- byte[] data = this.read(ADDRESS_MAX_DIFFERENTIAL_CONTROL_LOOP_COEFFICIENT_MAP[motor], 3);
- coeffs.p = (double)data[0];
- coeffs.i = (double)data[1];
- coeffs.d = (double)data[2];
- return coeffs;
- }
-
- public double getGearRatio(int motor) {
- this.validateMotor(motor);
- return (double)this.read(ADDRESS_MOTOR_GEAR_RATIO_MAP[motor], 1)[0] / 127.0D;
- }
-
- public DcMotorController.RunMode getMotorChannelMode(int motor) {
- this.validateMotor(motor);
- return flagToRunMode(this.read(ADDRESS_MOTOR_MODE_MAP[motor]));
- }
-
- public DcMotorController.DeviceMode getMotorControllerDeviceMode() {
- return DcMotorController.DeviceMode.READ_WRITE;
- }
-
- public int getMotorCurrentPosition(int motor) {
- this.validateMotor(motor);
- return TypeConversion.byteArrayToInt(this.read(ADDRESS_MOTOR_CURRENT_ENCODER_VALUE_MAP[motor], 4));
- }
-
- public double getMotorPower(int motor) {
- this.validateMotor(motor);
- byte var2 = this.read(ADDRESS_MOTOR_POWER_MAP[motor]);
- return var2 == -128?0.0D:(double)var2 / 100.0D;
- }
-
- public boolean getMotorPowerFloat(int motor) {
- this.validateMotor(motor);
- return this.read(ADDRESS_MOTOR_POWER_MAP[motor]) == -128;
- }
-
- public int getMotorTargetPosition(int motor) {
- this.validateMotor(motor);
- return TypeConversion.byteArrayToInt(this.read(ADDRESS_MOTOR_TARGET_ENCODER_VALUE_MAP[motor], 4));
- }
-
- public double getVoltage() {
- return 20.4D * ((double)(1023 & TypeConversion.byteArrayToShort(this.read(84, 2)) >> 6) / 1023.0D);
- }
-
- public boolean isBusy(int motor) {
- this.validateMotor(motor);
- return this.isBusyHelpers[motor].isBusyHelper();
- }
-
- public void readComplete() throws InterruptedException {
- for(int motor = 1; motor <= 2; ++motor) {
- this.isBusyHelpers[motor].a(this.getMotorCurrentPosition(motor));
- }
-
- }
-
- public void setDifferentialControlLoopCoefficients(int motor, DifferentialControlLoopCoefficients var2) {
- this.validateMotor(motor);
- if(var2.p > 255.0D) {
- var2.p = 255.0D;
- }
-
- if(var2.i > 255.0D) {
- var2.i = 255.0D;
- }
-
- if(var2.d > 255.0D) {
- var2.d = 255.0D;
- }
-
- int var3 = ADDRESS_MAX_DIFFERENTIAL_CONTROL_LOOP_COEFFICIENT_MAP[motor];
- byte[] var4 = new byte[]{(byte)((int)var2.p), (byte)((int)var2.i), (byte)((int)var2.d)};
- this.write(var3, var4);
- }
-
- public void setGearRatio(int motor, double ratio) {
- this.validateMotor(motor);
- Range.throwIfRangeIsInvalid(ratio, -1.0D, 1.0D);
- int var4 = ADDRESS_MOTOR_GEAR_RATIO_MAP[motor];
- byte[] var5 = new byte[]{(byte)((int)(127.0D * ratio))};
- this.write(var4, var5);
- }
-
- public void setMotorChannelMode(int motor, DcMotorController.RunMode mode) {
- this.validateMotor(motor);
- byte var3 = runModeToFlag(mode);
- this.write(ADDRESS_MOTOR_MODE_MAP[motor], var3);
- }
-
- public void setMotorControllerDeviceMode(DcMotorController.DeviceMode var1) {
- }
-
- public void setMotorPower(int var1, double var2) {
- this.validateMotor(var1);
- Range.throwIfRangeIsInvalid(var2, -1.0D, 1.0D);
- int var4 = ADDRESS_MOTOR_POWER_MAP[var1];
- byte[] var5 = new byte[]{(byte)((int)(100.0D * var2))};
- this.write(var4, var5);
- }
-
- public void setMotorPowerFloat(int var1) {
- this.validateMotor(var1);
- this.write(ADDRESS_MOTOR_POWER_MAP[var1], new byte[]{(byte)-128});
- }
-
- public void setMotorTargetPosition(int var1, int var2) {
- this.validateMotor(var1);
- Range.throwIfRangeIsInvalid((double)var2, -2.147483648E9D, 2.147483647E9D);
- this.write(ADDRESS_MOTOR_TARGET_ENCODER_VALUE_MAP[var1], TypeConversion.intToByteArray(var2));
- }
-
- private static class IsBusyHelper
- {
- private int[] a;
- private int[] b;
- private int c;
-
- private IsBusyHelper() {
- this.a = new int[3];
- this.b = new int[3];
- this.c = 0;
- }
-
- // $FF: synthetic method
- IsBusyHelper(Object var1) {
- this();
- }
-
- public void a(int var1) {
- int var2 = this.a[this.c];
- this.c = (1 + this.c) % this.a.length;
- this.b[this.c] = Math.abs(var2 - var1);
- this.a[this.c] = var1;
- }
-
- public boolean a() {
- int[] var1 = this.b;
- int var2 = var1.length;
- int var3 = 0;
-
- int var4;
- for(var4 = 0; var3 < var2; ++var3) {
- var4 += var1[var3];
- }
-
- boolean var5 = false;
- if(var4 > 6) {
- var5 = true;
- }
-
- return var5;
- }
- }
-}
+package com.qualcomm.hardware;
+
+import com.qualcomm.robotcore.eventloop.EventLoopManager;
+import com.qualcomm.robotcore.exception.RobotCoreException;
+import com.qualcomm.robotcore.hardware.DcMotorController;
+import com.qualcomm.robotcore.hardware.VoltageSensor;
+import com.qualcomm.robotcore.hardware.usb.RobotUsbDevice;
+import com.qualcomm.robotcore.util.DifferentialControlLoopCoefficients;
+import com.qualcomm.robotcore.util.Range;
+import com.qualcomm.robotcore.util.SerialNumber;
+import com.qualcomm.robotcore.util.TypeConversion;
+
+public class ModernRoboticsUsbDcMotorController extends ModernRoboticsUsbDevice implements DcMotorController, VoltageSensor {
+ public static final int ADDRESS_BATTERY_VOLTAGE = 84;
+ public static final int[] ADDRESS_MAX_DIFFERENTIAL_CONTROL_LOOP_COEFFICIENT_MAP = new int[]{255, 87, 91};
+ public static final int ADDRESS_MOTOR1_CURRENT_ENCODER_VALUE = 76;
+ public static final int ADDRESS_MOTOR1_D_COEFFICIENT = 89;
+ public static final int ADDRESS_MOTOR1_GEAR_RATIO = 86;
+ public static final int ADDRESS_MOTOR1_I_COEFFICIENT = 88;
+ public static final int ADDRESS_MOTOR1_MODE = 68;
+ public static final int ADDRESS_MOTOR1_POWER = 69;
+ public static final int ADDRESS_MOTOR1_P_COEFFICIENT = 87;
+ public static final int ADDRESS_MOTOR1_TARGET_ENCODER_VALUE = 64;
+ public static final int ADDRESS_MOTOR2_CURRENT_ENCODER_VALUE = 80;
+ public static final int ADDRESS_MOTOR2_D_COEFFICIENT = 93;
+ public static final int ADDRESS_MOTOR2_GEAR_RATIO = 90;
+ public static final int ADDRESS_MOTOR2_I_COEFFICIENT = 92;
+ public static final int ADDRESS_MOTOR2_MODE = 71;
+ public static final int ADDRESS_MOTOR2_POWER = 70;
+ public static final int ADDRESS_MOTOR2_P_COEFFICIENT = 91;
+ public static final int ADDRESS_MOTOR2_TARGET_ENCODER_VALUE = 72;
+ public static final int[] ADDRESS_MOTOR_CURRENT_ENCODER_VALUE_MAP = new int[]{255, 76, 80};
+ public static final int[] ADDRESS_MOTOR_GEAR_RATIO_MAP = new int[]{255, 86, 90};
+ public static final int[] ADDRESS_MOTOR_MODE_MAP = new int[]{255, 68, 71};
+ public static final int[] ADDRESS_MOTOR_POWER_MAP = new int[]{255, 69, 70};
+ public static final int[] ADDRESS_MOTOR_TARGET_ENCODER_VALUE_MAP = new int[]{255, 64, 72};
+ public static final int ADDRESS_UNUSED = 255;
+ public static final double BATTERY_MAX_MEASURABLE_VOLTAGE = 20.4D;
+ public static final int BATTERY_MAX_MEASURABLE_VOLTAGE_INT = 1023;
+ public static final byte CHANNEL_MODE_FLAG_BUSY = -128;
+ public static final byte CHANNEL_MODE_FLAG_ERROR = 64;
+ public static final byte CHANNEL_MODE_FLAG_LOCK = 4;
+ public static final byte CHANNEL_MODE_FLAG_NO_TIMEOUT = 16;
+ public static final byte CHANNEL_MODE_FLAG_REVERSE = 8;
+ public static final byte CHANNEL_MODE_FLAG_SELECT_RESET = 3;
+ public static final byte CHANNEL_MODE_FLAG_SELECT_RUN_CONSTANT_SPEED = 1;
+ public static final byte CHANNEL_MODE_FLAG_SELECT_RUN_POWER_CONTROL_ONLY = 0;
+ public static final byte CHANNEL_MODE_FLAG_SELECT_RUN_TO_POSITION = 2;
+ public static final byte CHANNEL_MODE_FLAG_UNUSED = 32;
+ public static final int CHANNEL_MODE_MASK_BUSY = 128;
+ public static final int CHANNEL_MODE_MASK_EMPTY_D5 = 32;
+ public static final int CHANNEL_MODE_MASK_ERROR = 64;
+ public static final int CHANNEL_MODE_MASK_LOCK = 4;
+ public static final int CHANNEL_MODE_MASK_NO_TIMEOUT = 16;
+ public static final int CHANNEL_MODE_MASK_REVERSE = 8;
+ public static final int CHANNEL_MODE_MASK_SELECTION = 3;
+ public static final boolean DEBUG_LOGGING = false;
+ public static final byte DEFAULT_D_COEFFICIENT = -72;
+ public static final byte DEFAULT_I_COEFFICIENT = 64;
+ public static final byte DEFAULT_P_COEFFICIENT = -128;
+ public static final int DIFFERENTIAL_CONTROL_LOOP_COEFFICIENT_MAX = 255;
+ public static final int MAX_MOTOR = 2;
+ public static final int MIN_MOTOR = 1;
+ public static final int MONITOR_LENGTH = 30;
+ public static final byte POWER_BREAK = 0;
+ public static final byte POWER_FLOAT = -128;
+ public static final byte POWER_MAX = 100;
+ public static final byte POWER_MIN = -100;
+ public static final byte RATIO_MAX = 127;
+ public static final byte RATIO_MIN = -128;
+ public static final byte START_ADDRESS = 64;
+ private IsBusyHelper[] isBusyHelpers;
+
+ protected ModernRoboticsUsbDcMotorController(SerialNumber var1, RobotUsbDevice var2, EventLoopManager var3) throws RobotCoreException, InterruptedException {
+ super(var1, var3, new ReadWriteRunnableBlocking(var1, var2, 30, 64, false));
+ this.isBusyHelpers = new IsBusyHelper[3];
+ this.readWriteRunnable.setCallback(this);
+
+ int index = 0;
+ while(index < this.isBusyHelpers.length) {
+ this.isBusyHelpers[index] = new IsBusyHelper(null);
+ ++index;
+ }
+
+ this.floatMotors();
+ this.initializePID();
+ }
+
+ public static DcMotorController.RunMode flagToRunMode(byte grf) {
+ switch(grf & 3) {
+ case 0:
+ return DcMotorController.RunMode.RUN_WITHOUT_ENCODERS;
+ case 1:
+ return DcMotorController.RunMode.RUN_USING_ENCODERS;
+ case 2:
+ return DcMotorController.RunMode.RUN_TO_POSITION;
+ case 3:
+ return DcMotorController.RunMode.RESET_ENCODERS;
+ default:
+ return DcMotorController.RunMode.RUN_WITHOUT_ENCODERS;
+ }
+ }
+
+ public static byte runModeToFlag(DcMotorController.RunMode mode) {
+ switch(mode.ordinal()) {
+ case 1:
+ default:
+ return (byte)1;
+ case 2:
+ return (byte)0;
+ case 3:
+ return (byte)2;
+ case 4:
+ return (byte)3;
+ }
+ }
+
+ private void floatMotors() {
+ this.setMotorPowerFloat(1);
+ this.setMotorPowerFloat(2);
+ }
+
+ private void validateMotor(int motor) {
+ if (motor < 1 || motor > 2) {
+ Object[] var2 = new Object[]{Integer.valueOf(motor), Integer.valueOf(2)};
+ throw new IllegalArgumentException(String.format("Motor %d is invalid; valid motors are 1..%d", var2));
+ }
+ }
+
+ private void initializePID() {
+ for (int motor = 1; motor <= 2; ++motor) {
+ this.write(ADDRESS_MAX_DIFFERENTIAL_CONTROL_LOOP_COEFFICIENT_MAP[motor], new byte[]{(byte) -128, (byte) 64, (byte) -72});
+ }
+
+ }
+
+ public void close() {
+ this.floatMotors();
+ super.close();
+ }
+
+ public String getConnectionInfo() {
+ return "USB " + this.getSerialNumber();
+ }
+
+ public String getDeviceName() {
+ return "Modern Robotics USB DC Motor Controller";
+ }
+
+ public DifferentialControlLoopCoefficients getDifferentialControlLoopCoefficients(int motor) {
+ this.validateMotor(motor);
+ DifferentialControlLoopCoefficients coeffs = new DifferentialControlLoopCoefficients();
+ byte[] data = this.read(ADDRESS_MAX_DIFFERENTIAL_CONTROL_LOOP_COEFFICIENT_MAP[motor], 3);
+ coeffs.p = (double)data[0];
+ coeffs.i = (double)data[1];
+ coeffs.d = (double)data[2];
+ return coeffs;
+ }
+
+ public double getGearRatio(int motor) {
+ this.validateMotor(motor);
+ return (double)this.read(ADDRESS_MOTOR_GEAR_RATIO_MAP[motor], 1)[0] / 127.0D;
+ }
+
+ public DcMotorController.RunMode getMotorChannelMode(int motor) {
+ this.validateMotor(motor);
+ return flagToRunMode(this.read(ADDRESS_MOTOR_MODE_MAP[motor]));
+ }
+
+ public DcMotorController.DeviceMode getMotorControllerDeviceMode() {
+ return DcMotorController.DeviceMode.READ_WRITE;
+ }
+
+ public void setMotorControllerDeviceMode(DcMotorController.DeviceMode var1) {
+ }
+
+ public int getMotorCurrentPosition(int motor) {
+ this.validateMotor(motor);
+ return TypeConversion.byteArrayToInt(this.read(ADDRESS_MOTOR_CURRENT_ENCODER_VALUE_MAP[motor], 4));
+ }
+
+ public double getMotorPower(int motor) {
+ this.validateMotor(motor);
+ byte var2 = this.read(ADDRESS_MOTOR_POWER_MAP[motor]);
+ return var2 == -128?0.0D:(double)var2 / 100.0D;
+ }
+
+ public boolean getMotorPowerFloat(int motor) {
+ this.validateMotor(motor);
+ return this.read(ADDRESS_MOTOR_POWER_MAP[motor]) == -128;
+ }
+
+ public int getMotorTargetPosition(int motor) {
+ this.validateMotor(motor);
+ return TypeConversion.byteArrayToInt(this.read(ADDRESS_MOTOR_TARGET_ENCODER_VALUE_MAP[motor], 4));
+ }
+
+ public double getVoltage() {
+ return 20.4D * ((double)(1023 & TypeConversion.byteArrayToShort(this.read(84, 2)) >> 6) / 1023.0D);
+ }
+
+ public boolean isBusy(int motor) {
+ this.validateMotor(motor);
+ return this.isBusyHelpers[motor].a();
+ }
+
+ public void readComplete() throws InterruptedException {
+ for(int motor = 1; motor <= 2; ++motor) {
+ this.isBusyHelpers[motor].a(this.getMotorCurrentPosition(motor));
+ }
+
+ }
+
+ public void setDifferentialControlLoopCoefficients(int motor, DifferentialControlLoopCoefficients var2) {
+ this.validateMotor(motor);
+ if(var2.p > 255.0D) {
+ var2.p = 255.0D;
+ }
+
+ if(var2.i > 255.0D) {
+ var2.i = 255.0D;
+ }
+
+ if(var2.d > 255.0D) {
+ var2.d = 255.0D;
+ }
+
+ int var3 = ADDRESS_MAX_DIFFERENTIAL_CONTROL_LOOP_COEFFICIENT_MAP[motor];
+ byte[] var4 = new byte[]{(byte)((int)var2.p), (byte)((int)var2.i), (byte)((int)var2.d)};
+ this.write(var3, var4);
+ }
+
+ public void setGearRatio(int motor, double ratio) {
+ this.validateMotor(motor);
+ Range.throwIfRangeIsInvalid(ratio, -1.0D, 1.0D);
+ int var4 = ADDRESS_MOTOR_GEAR_RATIO_MAP[motor];
+ byte[] var5 = new byte[]{(byte)((int)(127.0D * ratio))};
+ this.write(var4, var5);
+ }
+
+ public void setMotorChannelMode(int motor, DcMotorController.RunMode mode) {
+ this.validateMotor(motor);
+ byte var3 = runModeToFlag(mode);
+ this.write(ADDRESS_MOTOR_MODE_MAP[motor], var3);
+ }
+
+ public void setMotorPower(int var1, double var2) {
+ this.validateMotor(var1);
+ Range.throwIfRangeIsInvalid(var2, -1.0D, 1.0D);
+ int var4 = ADDRESS_MOTOR_POWER_MAP[var1];
+ byte[] var5 = new byte[]{(byte)((int)(100.0D * var2))};
+ this.write(var4, var5);
+ }
+
+ public void setMotorPowerFloat(int var1) {
+ this.validateMotor(var1);
+ this.write(ADDRESS_MOTOR_POWER_MAP[var1], new byte[]{(byte)-128});
+ }
+
+ public void setMotorTargetPosition(int var1, int var2) {
+ this.validateMotor(var1);
+ Range.throwIfRangeIsInvalid((double)var2, -2.147483648E9D, 2.147483647E9D);
+ this.write(ADDRESS_MOTOR_TARGET_ENCODER_VALUE_MAP[var1], TypeConversion.intToByteArray(var2));
+ }
+
+ private static class IsBusyHelper
+ {
+ private int[] a;
+ private int[] b;
+ private int c;
+
+ private IsBusyHelper() {
+ this.a = new int[3];
+ this.b = new int[3];
+ this.c = 0;
+ }
+
+ // $FF: synthetic method
+ IsBusyHelper(Object var1) {
+ this();
+ }
+
+ public void a(int var1) {
+ int var2 = this.a[this.c];
+ this.c = (1 + this.c) % this.a.length;
+ this.b[this.c] = Math.abs(var2 - var1);
+ this.a[this.c] = var1;
+ }
+
+ public boolean a() {
+ int[] var1 = this.b;
+ int var2 = var1.length;
+ int var3 = 0;
+
+ int var4;
+ for(var4 = 0; var3 < var2; ++var3) {
+ var4 += var1[var3];
+ }
+
+ boolean var5 = false;
+ if(var4 > 6) {
+ var5 = true;
+ }
+
+ return var5;
+ }
+ }
+}
diff --git a/FtcRobotController/app/src/main/java/com/qualcomm/hardware/ModernRoboticsUsbDevice.java b/FtcRobotController/Hardware/src/main/java/com/qualcomm/hardware/ModernRoboticsUsbDevice.java
similarity index 95%
rename from FtcRobotController/app/src/main/java/com/qualcomm/hardware/ModernRoboticsUsbDevice.java
rename to FtcRobotController/Hardware/src/main/java/com/qualcomm/hardware/ModernRoboticsUsbDevice.java
index 9a5225c..18a0a41 100644
--- a/FtcRobotController/app/src/main/java/com/qualcomm/hardware/ModernRoboticsUsbDevice.java
+++ b/FtcRobotController/Hardware/src/main/java/com/qualcomm/hardware/ModernRoboticsUsbDevice.java
@@ -1,86 +1,86 @@
-package com.qualcomm.hardware;
-
-import com.qualcomm.hardware.ReadWriteRunnable;
-import com.qualcomm.robotcore.eventloop.EventLoopManager;
-import com.qualcomm.robotcore.exception.RobotCoreException;
-import com.qualcomm.robotcore.util.RobotLog;
-import com.qualcomm.robotcore.util.SerialNumber;
-import java.util.concurrent.ExecutorService;
-import java.util.concurrent.Executors;
-
-public abstract class ModernRoboticsUsbDevice implements ReadWriteRunnable.Callback {
- public static final int DEVICE_ID_DC_MOTOR_CONTROLLER = 77;
- public static final int DEVICE_ID_DEVICE_INTERFACE_MODULE = 65;
- public static final int DEVICE_ID_LEGACY_MODULE = 73;
- public static final int DEVICE_ID_SERVO_CONTROLLER = 83;
- public static final int MFG_CODE_MODERN_ROBOTICS = 77;
- protected ReadWriteRunnable readWriteRunnable;
- protected ExecutorService readWriteService = Executors.newSingleThreadExecutor();
- protected SerialNumber serialNumber;
-
- public ModernRoboticsUsbDevice(SerialNumber var1, EventLoopManager var2, ReadWriteRunnable var3) throws RobotCoreException, InterruptedException {
- this.serialNumber = var1;
- this.readWriteRunnable = var3;
- RobotLog.v("Starting up device " + var1.toString());
- this.readWriteService.execute(var3);
- var3.blockUntilReady();
- var3.setCallback(this);
- var2.registerSyncdDevice(var3);
- }
-
- public void close() {
- RobotLog.v("Shutting down device " + this.serialNumber.toString());
- this.readWriteService.shutdown();
- this.readWriteRunnable.close();
- }
-
- public abstract String getDeviceName();
-
- public SerialNumber getSerialNumber() {
- return this.serialNumber;
- }
-
- public int getVersion() {
- return this.read(0);
- }
-
- public byte read(int var1) {
- return this.read(var1, 1)[0];
- }
-
- public byte[] read(int var1, int var2) {
- return this.readWriteRunnable.read(var1, var2);
- }
-
- public void readComplete() throws InterruptedException {
- }
-
- public byte readFromWriteCache(int var1) {
- return this.readFromWriteCache(var1, 1)[0];
- }
-
- public byte[] readFromWriteCache(int var1, int var2) {
- return this.readWriteRunnable.readFromWriteCache(var1, var2);
- }
-
- public void write(int var1, byte var2) {
- this.write(var1, new byte[]{var2});
- }
-
- public void write(int var1, double var2) {
- byte[] var4 = new byte[]{(byte)((int)var2)};
- this.write(var1, var4);
- }
-
- public void write(int var1, int var2) {
- byte[] var3 = new byte[]{(byte)var2};
- this.write(var1, var3);
- }
-
- public void write(int var1, byte[] var2) {
- this.readWriteRunnable.write(var1, var2);
- }
-
- public void writeComplete() throws InterruptedException {
- }
-}
+package com.qualcomm.hardware;
+
+import com.qualcomm.robotcore.eventloop.EventLoopManager;
+import com.qualcomm.robotcore.exception.RobotCoreException;
+import com.qualcomm.robotcore.util.RobotLog;
+import com.qualcomm.robotcore.util.SerialNumber;
+
+import java.util.concurrent.ExecutorService;
+import java.util.concurrent.Executors;
+
+public abstract class ModernRoboticsUsbDevice implements ReadWriteRunnable.Callback {
+ public static final int DEVICE_ID_DC_MOTOR_CONTROLLER = 77;
+ public static final int DEVICE_ID_DEVICE_INTERFACE_MODULE = 65;
+ public static final int DEVICE_ID_LEGACY_MODULE = 73;
+ public static final int DEVICE_ID_SERVO_CONTROLLER = 83;
+ public static final int MFG_CODE_MODERN_ROBOTICS = 77;
+ protected ReadWriteRunnable readWriteRunnable;
+ protected ExecutorService readWriteService = Executors.newSingleThreadExecutor();
+ protected SerialNumber serialNumber;
+
+ public ModernRoboticsUsbDevice(SerialNumber var1, EventLoopManager var2, ReadWriteRunnable var3) throws RobotCoreException, InterruptedException {
+ this.serialNumber = var1;
+ this.readWriteRunnable = var3;
+ RobotLog.v("Starting up device " + var1.toString());
+ this.readWriteService.execute(var3);
+ var3.blockUntilReady();
+ var3.setCallback(this);
+ var2.registerSyncdDevice(var3);
+ }
+
+ public void close() {
+ RobotLog.v("Shutting down device " + this.serialNumber.toString());
+ this.readWriteService.shutdown();
+ this.readWriteRunnable.close();
+ }
+
+ public abstract String getDeviceName();
+
+ public SerialNumber getSerialNumber() {
+ return this.serialNumber;
+ }
+
+ public int getVersion() {
+ return this.read(0);
+ }
+
+ public byte read(int var1) {
+ return this.read(var1, 1)[0];
+ }
+
+ public byte[] read(int var1, int var2) {
+ return this.readWriteRunnable.read(var1, var2);
+ }
+
+ public void readComplete() throws InterruptedException {
+ }
+
+ public byte readFromWriteCache(int var1) {
+ return this.readFromWriteCache(var1, 1)[0];
+ }
+
+ public byte[] readFromWriteCache(int var1, int var2) {
+ return this.readWriteRunnable.readFromWriteCache(var1, var2);
+ }
+
+ public void write(int var1, byte var2) {
+ this.write(var1, new byte[]{var2});
+ }
+
+ public void write(int var1, double var2) {
+ byte[] var4 = new byte[]{(byte)((int)var2)};
+ this.write(var1, var4);
+ }
+
+ public void write(int var1, int var2) {
+ byte[] var3 = new byte[]{(byte)var2};
+ this.write(var1, var3);
+ }
+
+ public void write(int var1, byte[] var2) {
+ this.readWriteRunnable.write(var1, var2);
+ }
+
+ public void writeComplete() throws InterruptedException {
+ }
+}
diff --git a/FtcRobotController/app/src/main/java/com/qualcomm/hardware/ModernRoboticsUsbDeviceInterfaceModule.java b/FtcRobotController/Hardware/src/main/java/com/qualcomm/hardware/ModernRoboticsUsbDeviceInterfaceModule.java
similarity index 96%
rename from FtcRobotController/app/src/main/java/com/qualcomm/hardware/ModernRoboticsUsbDeviceInterfaceModule.java
rename to FtcRobotController/Hardware/src/main/java/com/qualcomm/hardware/ModernRoboticsUsbDeviceInterfaceModule.java
index d08c5a9..d7f51af 100644
--- a/FtcRobotController/app/src/main/java/com/qualcomm/hardware/ModernRoboticsUsbDeviceInterfaceModule.java
+++ b/FtcRobotController/Hardware/src/main/java/com/qualcomm/hardware/ModernRoboticsUsbDeviceInterfaceModule.java
@@ -1,621 +1,619 @@
-package com.qualcomm.hardware;
-
-import com.qualcomm.hardware.ModernRoboticsUsbDevice;
-import com.qualcomm.hardware.ReadWriteRunnableSegment;
-import com.qualcomm.hardware.ReadWriteRunnableStandard;
-import com.qualcomm.robotcore.eventloop.EventLoopManager;
-import com.qualcomm.robotcore.exception.RobotCoreException;
-import com.qualcomm.robotcore.hardware.DeviceInterfaceModule;
-import com.qualcomm.robotcore.hardware.DigitalChannelController;
-import com.qualcomm.robotcore.hardware.I2cController;
-import com.qualcomm.robotcore.hardware.usb.RobotUsbDevice;
-import com.qualcomm.robotcore.util.ElapsedTime;
-import com.qualcomm.robotcore.util.SerialNumber;
-import com.qualcomm.robotcore.util.TypeConversion;
-import java.nio.ByteOrder;
-import java.util.concurrent.locks.Lock;
-
-public class ModernRoboticsUsbDeviceInterfaceModule extends ModernRoboticsUsbDevice implements DeviceInterfaceModule {
- public static final int ADDRESS_ANALOG_PORT_A0 = 4;
- public static final int ADDRESS_ANALOG_PORT_A1 = 6;
- public static final int ADDRESS_ANALOG_PORT_A2 = 8;
- public static final int ADDRESS_ANALOG_PORT_A3 = 10;
- public static final int ADDRESS_ANALOG_PORT_A4 = 12;
- public static final int ADDRESS_ANALOG_PORT_A5 = 14;
- public static final int ADDRESS_ANALOG_PORT_A6 = 16;
- public static final int ADDRESS_ANALOG_PORT_A7 = 18;
- public static final int[] ADDRESS_ANALOG_PORT_MAP = new int[]{4, 6, 8, 10, 12, 14, 16, 18};
- public static final int ADDRESS_BUFFER_STATUS = 3;
- public static final int[] ADDRESS_DIGITAL_BIT_MASK = new int[]{1, 2, 4, 8, 16, 32, 64, 128};
- public static final int ADDRESS_DIGITAL_INPUT_STATE = 20;
- public static final int ADDRESS_DIGITAL_IO_CONTROL = 21;
- public static final int ADDRESS_DIGITAL_OUTPUT_STATE = 22;
- public static final int ADDRESS_I2C0 = 48;
- public static final int ADDRESS_I2C1 = 80;
- public static final int ADDRESS_I2C2 = 112;
- public static final int ADDRESS_I2C3 = 144;
- public static final int ADDRESS_I2C4 = 176;
- public static final int ADDRESS_I2C5 = 208;
- public static final int[] ADDRESS_I2C_PORT_MAP = new int[]{48, 80, 112, 144, 176, 208};
- public static final int ADDRESS_LED_SET = 23;
- public static final int ADDRESS_PULSE_OUTPUT_PORT_0 = 36;
- public static final int ADDRESS_PULSE_OUTPUT_PORT_1 = 40;
- public static final int[] ADDRESS_PULSE_OUTPUT_PORT_MAP = new int[]{36, 40};
- public static final int ADDRESS_VOLTAGE_OUTPUT_PORT_0 = 24;
- public static final int ADDRESS_VOLTAGE_OUTPUT_PORT_1 = 30;
- public static final int[] ADDRESS_VOLTAGE_OUTPUT_PORT_MAP = new int[]{24, 30};
- public static final int ANALOG_VOLTAGE_OUTPUT_BUFFER_SIZE = 5;
- public static final byte BUFFER_FLAG_I2C0 = 1;
- public static final byte BUFFER_FLAG_I2C1 = 2;
- public static final byte BUFFER_FLAG_I2C2 = 4;
- public static final byte BUFFER_FLAG_I2C3 = 8;
- public static final byte BUFFER_FLAG_I2C4 = 16;
- public static final byte BUFFER_FLAG_I2C5 = 32;
- public static final int[] BUFFER_FLAG_MAP = new int[]{1, 2, 4, 8, 16, 32};
- public static final int D0_MASK = 1;
- public static final int D1_MASK = 2;
- public static final int D2_MASK = 4;
- public static final int D3_MASK = 8;
- public static final int D4_MASK = 16;
- public static final int D5_MASK = 32;
- public static final int D6_MASK = 64;
- public static final int D7_MASK = 128;
- public static final boolean DEBUG_LOGGING = false;
- public static final byte I2C_ACTION_FLAG = -1;
- public static final byte I2C_MODE_READ = -128;
- public static final byte I2C_MODE_WRITE = 0;
- public static final byte I2C_NO_ACTION_FLAG = 0;
- public static final int I2C_PORT_BUFFER_SIZE = 32;
- public static final int LED_0_BIT_MASK = 1;
- public static final int LED_1_BIT_MASK = 2;
- public static final int[] LED_BIT_MASK_MAP = new int[]{1, 2};
- public static final int MAX_ANALOG_PORT_NUMBER = 7;
- public static final int MAX_I2C_PORT_NUMBER = 5;
- public static final int MIN_ANALOG_PORT_NUMBER = 0;
- public static final int MIN_I2C_PORT_NUMBER = 0;
- public static final int MONITOR_LENGTH = 21;
- public static final int NUMBER_OF_PORTS = 6;
- public static final int OFFSET_ANALOG_VOLTAGE_OUTPUT_FREQ = 2;
- public static final int OFFSET_ANALOG_VOLTAGE_OUTPUT_MODE = 4;
- public static final int OFFSET_ANALOG_VOLTAGE_OUTPUT_VOLTAGE = 0;
- public static final int OFFSET_I2C_PORT_FLAG = 31;
- public static final int OFFSET_I2C_PORT_I2C_ADDRESS = 1;
- public static final int OFFSET_I2C_PORT_MEMORY_ADDRESS = 2;
- public static final int OFFSET_I2C_PORT_MEMORY_BUFFER = 4;
- public static final int OFFSET_I2C_PORT_MEMORY_LENGTH = 3;
- public static final int OFFSET_I2C_PORT_MODE = 0;
- public static final int OFFSET_PULSE_OUTPUT_PERIOD = 2;
- public static final int OFFSET_PULSE_OUTPUT_TIME = 0;
- public static final int PULSE_OUTPUT_BUFFER_SIZE = 4;
- public static final int SIZE_ANALOG_BUFFER = 2;
- public static final int SIZE_I2C_BUFFER = 27;
- public static final int START_ADDRESS = 3;
- public static final int WORD_SIZE = 2;
- private static final int[] a = new int[]{0, 1};
- private static final int[] b = new int[]{2, 3};
- private static final int[] c = new int[]{4, 5, 6, 7, 8, 9};
- private static final int[] d = new int[]{10, 11, 12, 13, 14, 15};
- private final I2cController.I2cPortReadyCallback[] e = new I2cController.I2cPortReadyCallback[6];
- private final ElapsedTime[] f = new ElapsedTime[6];
- private ReadWriteRunnableSegment[] g;
- private ReadWriteRunnableSegment[] h;
- private ReadWriteRunnableSegment[] i;
- private ReadWriteRunnableSegment[] j;
-
- protected ModernRoboticsUsbDeviceInterfaceModule(SerialNumber var1, RobotUsbDevice var2, EventLoopManager var3) throws RobotCoreException, InterruptedException {
- super(var1, var3, new ReadWriteRunnableStandard(var1, var2, 21, 3, false));
- this.g = new ReadWriteRunnableSegment[a.length];
- this.h = new ReadWriteRunnableSegment[b.length];
- this.i = new ReadWriteRunnableSegment[c.length];
- this.j = new ReadWriteRunnableSegment[d.length];
-
- for(int var4 = 0; var4 < a.length; ++var4) {
- this.g[var4] = this.readWriteRunnable.createSegment(a[var4], ADDRESS_VOLTAGE_OUTPUT_PORT_MAP[var4], 5);
- }
-
- int var5 = 0;
-
- while(true) {
- int var6 = b.length;
- int var7 = 0;
- if(var5 >= var6) {
- while(var7 < c.length) {
- this.i[var7] = this.readWriteRunnable.createSegment(c[var7], ADDRESS_I2C_PORT_MAP[var7], 32);
- this.j[var7] = this.readWriteRunnable.createSegment(d[var7], 31 + ADDRESS_I2C_PORT_MAP[var7], 1);
- ++var7;
- }
-
- return;
- }
-
- this.h[var5] = this.readWriteRunnable.createSegment(b[var5], ADDRESS_PULSE_OUTPUT_PORT_MAP[var5], 4);
- ++var5;
- }
- }
-
- private int a(int var1, DigitalChannelController.Mode var2) {
- return var2 == DigitalChannelController.Mode.OUTPUT?ADDRESS_DIGITAL_BIT_MASK[var1]:~ADDRESS_DIGITAL_BIT_MASK[var1];
- }
-
- private DigitalChannelController.Mode a(int var1, int var2) {
- return (var2 & ADDRESS_DIGITAL_BIT_MASK[var1]) > 0?DigitalChannelController.Mode.OUTPUT:DigitalChannelController.Mode.INPUT;
- }
-
- private void a(int var1) {
- if(var1 != 0 && var1 != 1) {
- Object[] var2 = new Object[]{Integer.valueOf(var1)};
- throw new IllegalArgumentException(String.format("port %d is invalid; valid ports are 0 and 1.", var2));
- }
- }
-
- private boolean a(int var1, byte var2) {
- return (var2 & BUFFER_FLAG_MAP[var1]) == 0;
- }
-
- private void b(int var1) {
- if(var1 != 0 && var1 != 1) {
- Object[] var2 = new Object[]{Integer.valueOf(var1)};
- throw new IllegalArgumentException(String.format("port %d is invalid; valid ports are 0 and 1.", var2));
- }
- }
-
- private void c(int var1) {
- if(var1 != 0 && var1 != 1) {
- Object[] var2 = new Object[]{Integer.valueOf(var1)};
- throw new IllegalArgumentException(String.format("port %d is invalid; valid ports are 0 and 1.", var2));
- }
- }
-
- private void d(int var1) {
- if(var1 < 0 || var1 > 7) {
- Object[] var2 = new Object[]{Integer.valueOf(var1), Integer.valueOf(0), Integer.valueOf(7)};
- throw new IllegalArgumentException(String.format("port %d is invalid; valid ports are %d..%d", var2));
- }
- }
-
- private void e(int var1) {
- if(var1 < 0 || var1 > 5) {
- Object[] var2 = new Object[]{Integer.valueOf(var1), Integer.valueOf(0), Integer.valueOf(5)};
- throw new IllegalArgumentException(String.format("port %d is invalid; valid ports are %d..%d", var2));
- }
- }
-
- private void f(int var1) {
- if(var1 > 27) {
- Object[] var2 = new Object[]{Integer.valueOf(var1), Integer.valueOf(27)};
- throw new IllegalArgumentException(String.format("buffer is too large (%d byte), max size is %d bytes", var2));
- }
- }
-
- public void copyBufferIntoWriteBuffer(int var1, byte[] var2) {
- this.e(var1);
- this.f(var2.length);
-
- try {
- this.i[var1].getWriteLock().lock();
- System.arraycopy(var2, 0, this.i[var1].getWriteBuffer(), 4, var2.length);
- } finally {
- this.i[var1].getWriteLock().unlock();
- }
-
- }
-
- public void deregisterForPortReadyCallback(int var1) {
- this.e[var1] = null;
- }
-
- public void enableI2cReadMode(int var1, int var2, int var3, int var4) {
- this.e(var1);
- this.f(var4);
-
- try {
- this.i[var1].getWriteLock().lock();
- byte[] var6 = this.i[var1].getWriteBuffer();
- var6[0] = -128;
- var6[1] = (byte)var2;
- var6[2] = (byte)var3;
- var6[3] = (byte)var4;
- } finally {
- this.i[var1].getWriteLock().unlock();
- }
-
- }
-
- public void enableI2cWriteMode(int var1, int var2, int var3, int var4) {
- this.e(var1);
- this.f(var4);
-
- try {
- this.i[var1].getWriteLock().lock();
- byte[] var6 = this.i[var1].getWriteBuffer();
- var6[0] = 0;
- var6[1] = (byte)var2;
- var6[2] = (byte)var3;
- var6[3] = (byte)var4;
- } finally {
- this.i[var1].getWriteLock().unlock();
- }
-
- }
-
- public int getAnalogInputValue(int var1) {
- this.d(var1);
- return TypeConversion.byteArrayToShort(this.read(ADDRESS_ANALOG_PORT_MAP[var1], 2), ByteOrder.LITTLE_ENDIAN);
- }
-
- public String getConnectionInfo() {
- return "USB " + this.getSerialNumber();
- }
-
- public byte[] getCopyOfReadBuffer(int var1) {
- this.e(var1);
-
- byte[] var4;
- try {
- this.i[var1].getReadLock().lock();
- byte[] var3 = this.i[var1].getReadBuffer();
- var4 = new byte[var3[3]];
- System.arraycopy(var3, 4, var4, 0, var4.length);
- } finally {
- this.i[var1].getReadLock().unlock();
- }
-
- return var4;
- }
-
- public byte[] getCopyOfWriteBuffer(int var1) {
- this.e(var1);
-
- byte[] var4;
- try {
- this.i[var1].getWriteLock().lock();
- byte[] var3 = this.i[var1].getWriteBuffer();
- var4 = new byte[var3[3]];
- System.arraycopy(var3, 4, var4, 0, var4.length);
- } finally {
- this.i[var1].getWriteLock().unlock();
- }
-
- return var4;
- }
-
- public String getDeviceName() {
- return "Modern Robotics USB Device Interface Module";
- }
-
- public DigitalChannelController.Mode getDigitalChannelMode(int var1) {
- return this.a(var1, (int)this.getDigitalIOControlByte());
- }
-
- public boolean getDigitalChannelState(int var1) {
- int var2;
- if(DigitalChannelController.Mode.OUTPUT == this.getDigitalChannelMode(var1)) {
- var2 = this.getDigitalOutputStateByte();
- } else {
- var2 = this.getDigitalInputStateByte();
- }
-
- return (var2 & ADDRESS_DIGITAL_BIT_MASK[var1]) > 0;
- }
-
- public byte getDigitalIOControlByte() {
- return this.read(21);
- }
-
- public int getDigitalInputStateByte() {
- return TypeConversion.unsignedByteToInt(this.read(20));
- }
-
- public byte getDigitalOutputStateByte() {
- return this.read(22);
- }
-
- public byte[] getI2cReadCache(int var1) {
- return this.i[var1].getReadBuffer();
- }
-
- public Lock getI2cReadCacheLock(int var1) {
- return this.i[var1].getReadLock();
- }
-
- public byte[] getI2cWriteCache(int var1) {
- return this.i[var1].getWriteBuffer();
- }
-
- public Lock getI2cWriteCacheLock(int var1) {
- return this.i[var1].getWriteLock();
- }
-
- public boolean getLEDState(int var1) {
- this.a(var1);
- return (this.read(23) & LED_BIT_MASK_MAP[var1]) > 0;
- }
-
- public int getPulseWidthOutputTime(int var1) {
- throw new UnsupportedOperationException("getPulseWidthOutputTime is not implemented.");
- }
-
- public int getPulseWidthPeriod(int var1) {
- throw new UnsupportedOperationException("getPulseWidthOutputTime is not implemented.");
- }
-
- public boolean isI2cPortActionFlagSet(int var1) {
- this.e(var1);
- boolean var6 = false;
-
- byte var3;
- try {
- var6 = true;
- this.i[var1].getReadLock().lock();
- var3 = this.i[var1].getReadBuffer()[31];
- var6 = false;
- } finally {
- if(var6) {
- this.i[var1].getReadLock().unlock();
- }
- }
-
- boolean var4;
- if(var3 == -1) {
- var4 = true;
- } else {
- var4 = false;
- }
-
- this.i[var1].getReadLock().unlock();
- return var4;
- }
-
- public boolean isI2cPortInReadMode(int var1) {
- this.e(var1);
- boolean var6 = false;
-
- byte var3;
- try {
- var6 = true;
- this.i[var1].getReadLock().lock();
- var3 = this.i[var1].getReadBuffer()[0];
- var6 = false;
- } finally {
- if(var6) {
- this.i[var1].getReadLock().unlock();
- }
- }
-
- boolean var4 = false;
- if(var3 == -128) {
- var4 = true;
- }
-
- this.i[var1].getReadLock().unlock();
- return var4;
- }
-
- public boolean isI2cPortInWriteMode(int var1) {
- this.e(var1);
- boolean var6 = false;
-
- byte var3;
- try {
- var6 = true;
- this.i[var1].getReadLock().lock();
- var3 = this.i[var1].getReadBuffer()[0];
- var6 = false;
- } finally {
- if(var6) {
- this.i[var1].getReadLock().unlock();
- }
- }
-
- boolean var4 = false;
- if(var3 == 0) {
- var4 = true;
- }
-
- this.i[var1].getReadLock().unlock();
- return var4;
- }
-
- public boolean isI2cPortReady(int var1) {
- return this.a(var1, this.read(3));
- }
-
- public void readComplete() throws InterruptedException {
- if(this.e != null) {
- byte var1 = this.read(3);
-
- for(int var2 = 0; var2 < 6; ++var2) {
- if(this.e[var2] != null && this.a(var2, var1)) {
- this.e[var2].portIsReady(var2);
- }
- }
- }
-
- }
-
- public void readI2cCacheFromController(int var1) {
- this.e(var1);
- this.readWriteRunnable.queueSegmentRead(c[var1]);
- }
-
- @Deprecated
- public void readI2cCacheFromModule(int var1) {
- this.readI2cCacheFromController(var1);
- }
-
- public void registerForI2cPortReadyCallback(I2cController.I2cPortReadyCallback var1, int var2) {
- this.e[var2] = var1;
- }
-
- public void setAnalogOutputFrequency(int var1, int var2) {
- this.b(var1);
- Lock var3 = this.g[var1].getWriteLock();
- byte[] var4 = this.g[var1].getWriteBuffer();
- byte[] var5 = TypeConversion.shortToByteArray((short)var2, ByteOrder.LITTLE_ENDIAN);
-
- try {
- var3.lock();
- System.arraycopy(var5, 0, var4, 2, var5.length);
- } finally {
- var3.unlock();
- }
-
- this.readWriteRunnable.queueSegmentWrite(a[var1]);
- }
-
- public void setAnalogOutputMode(int var1, byte var2) {
- this.b(var1);
- Lock var3 = this.g[var1].getWriteLock();
- byte[] var4 = this.g[var1].getWriteBuffer();
-
- try {
- var3.lock();
- var4[4] = var2;
- } finally {
- var3.unlock();
- }
-
- this.readWriteRunnable.queueSegmentWrite(a[var1]);
- }
-
- public void setAnalogOutputVoltage(int var1, int var2) {
- this.b(var1);
- Lock var3 = this.g[var1].getWriteLock();
- byte[] var4 = this.g[var1].getWriteBuffer();
- byte[] var5 = TypeConversion.shortToByteArray((short)var2, ByteOrder.LITTLE_ENDIAN);
-
- try {
- var3.lock();
- System.arraycopy(var5, 0, var4, 0, var5.length);
- } finally {
- var3.unlock();
- }
-
- this.readWriteRunnable.queueSegmentWrite(a[var1]);
- }
-
- public void setDigitalChannelMode(int var1, DigitalChannelController.Mode var2) {
- int var3 = this.a(var1, var2);
- byte var4 = this.readFromWriteCache(21);
- int var5;
- if(var2 == DigitalChannelController.Mode.OUTPUT) {
- var5 = var3 | var4;
- } else {
- var5 = var3 & var4;
- }
-
- this.write(21, var5);
- }
-
- public void setDigitalChannelState(int var1, boolean var2) {
- if(DigitalChannelController.Mode.OUTPUT == this.getDigitalChannelMode(var1)) {
- byte var3 = this.readFromWriteCache(22);
- int var4;
- if(var2) {
- var4 = var3 | ADDRESS_DIGITAL_BIT_MASK[var1];
- } else {
- var4 = var3 & ~ADDRESS_DIGITAL_BIT_MASK[var1];
- }
-
- this.setDigitalOutputByte((byte)var4);
- }
-
- }
-
- public void setDigitalIOControlByte(byte var1) {
- this.write(21, var1);
- }
-
- public void setDigitalOutputByte(byte var1) {
- this.write(22, var1);
- }
-
- public void setI2cPortActionFlag(int var1) {
- this.e(var1);
-
- try {
- this.i[var1].getWriteLock().lock();
- this.i[var1].getWriteBuffer()[31] = -1;
- } finally {
- this.i[var1].getWriteLock().unlock();
- }
-
- }
-
- public void setLED(int var1, boolean var2) {
- this.a(var1);
- byte var3 = this.readFromWriteCache(23);
- int var4;
- if(var2) {
- var4 = var3 | LED_BIT_MASK_MAP[var1];
- } else {
- var4 = var3 & ~LED_BIT_MASK_MAP[var1];
- }
-
- this.write(23, var4);
- }
-
- public void setPulseWidthOutputTime(int var1, int var2) {
- this.c(var1);
- Lock var3 = this.h[var1].getWriteLock();
- byte[] var4 = this.h[var1].getWriteBuffer();
- byte[] var5 = TypeConversion.shortToByteArray((short)var2, ByteOrder.LITTLE_ENDIAN);
-
- try {
- var3.lock();
- System.arraycopy(var5, 0, var4, 0, var5.length);
- } finally {
- var3.unlock();
- }
-
- this.readWriteRunnable.queueSegmentWrite(b[var1]);
- }
-
- public void setPulseWidthPeriod(int var1, int var2) {
- this.e(var1);
- Lock var3 = this.h[var1].getWriteLock();
- byte[] var4 = this.h[var1].getWriteBuffer();
- byte[] var5 = TypeConversion.shortToByteArray((short)var2, ByteOrder.LITTLE_ENDIAN);
-
- try {
- var3.lock();
- System.arraycopy(var5, 0, var4, 2, var5.length);
- } finally {
- var3.unlock();
- }
-
- this.readWriteRunnable.queueSegmentWrite(b[var1]);
- }
-
- public void writeI2cCacheToController(int var1) {
- this.e(var1);
- this.readWriteRunnable.queueSegmentWrite(c[var1]);
- }
-
- @Deprecated
- public void writeI2cCacheToModule(int var1) {
- this.writeI2cCacheToController(var1);
- }
-
- public void writeI2cPortFlagOnlyToController(int var1) {
- this.e(var1);
- ReadWriteRunnableSegment var2 = this.i[var1];
- ReadWriteRunnableSegment var3 = this.j[var1];
-
- try {
- var2.getWriteLock().lock();
- var3.getWriteLock().lock();
- var3.getWriteBuffer()[0] = var2.getWriteBuffer()[31];
- } finally {
- var2.getWriteLock().unlock();
- var3.getWriteLock().unlock();
- }
-
- this.readWriteRunnable.queueSegmentWrite(d[var1]);
- }
-
- @Deprecated
- public void writeI2cPortFlagOnlyToModule(int var1) {
- this.writeI2cPortFlagOnlyToController(var1);
- }
-}
+package com.qualcomm.hardware;
+
+import com.qualcomm.robotcore.eventloop.EventLoopManager;
+import com.qualcomm.robotcore.exception.RobotCoreException;
+import com.qualcomm.robotcore.hardware.DeviceInterfaceModule;
+import com.qualcomm.robotcore.hardware.DigitalChannelController;
+import com.qualcomm.robotcore.hardware.I2cController;
+import com.qualcomm.robotcore.hardware.usb.RobotUsbDevice;
+import com.qualcomm.robotcore.util.ElapsedTime;
+import com.qualcomm.robotcore.util.SerialNumber;
+import com.qualcomm.robotcore.util.TypeConversion;
+
+import java.nio.ByteOrder;
+import java.util.concurrent.locks.Lock;
+
+public class ModernRoboticsUsbDeviceInterfaceModule extends ModernRoboticsUsbDevice implements DeviceInterfaceModule {
+ public static final int ADDRESS_ANALOG_PORT_A0 = 4;
+ public static final int ADDRESS_ANALOG_PORT_A1 = 6;
+ public static final int ADDRESS_ANALOG_PORT_A2 = 8;
+ public static final int ADDRESS_ANALOG_PORT_A3 = 10;
+ public static final int ADDRESS_ANALOG_PORT_A4 = 12;
+ public static final int ADDRESS_ANALOG_PORT_A5 = 14;
+ public static final int ADDRESS_ANALOG_PORT_A6 = 16;
+ public static final int ADDRESS_ANALOG_PORT_A7 = 18;
+ public static final int[] ADDRESS_ANALOG_PORT_MAP = new int[]{4, 6, 8, 10, 12, 14, 16, 18};
+ public static final int ADDRESS_BUFFER_STATUS = 3;
+ public static final int[] ADDRESS_DIGITAL_BIT_MASK = new int[]{1, 2, 4, 8, 16, 32, 64, 128};
+ public static final int ADDRESS_DIGITAL_INPUT_STATE = 20;
+ public static final int ADDRESS_DIGITAL_IO_CONTROL = 21;
+ public static final int ADDRESS_DIGITAL_OUTPUT_STATE = 22;
+ public static final int ADDRESS_I2C0 = 48;
+ public static final int ADDRESS_I2C1 = 80;
+ public static final int ADDRESS_I2C2 = 112;
+ public static final int ADDRESS_I2C3 = 144;
+ public static final int ADDRESS_I2C4 = 176;
+ public static final int ADDRESS_I2C5 = 208;
+ public static final int[] ADDRESS_I2C_PORT_MAP = new int[]{48, 80, 112, 144, 176, 208};
+ public static final int ADDRESS_LED_SET = 23;
+ public static final int ADDRESS_PULSE_OUTPUT_PORT_0 = 36;
+ public static final int ADDRESS_PULSE_OUTPUT_PORT_1 = 40;
+ public static final int[] ADDRESS_PULSE_OUTPUT_PORT_MAP = new int[]{36, 40};
+ public static final int ADDRESS_VOLTAGE_OUTPUT_PORT_0 = 24;
+ public static final int ADDRESS_VOLTAGE_OUTPUT_PORT_1 = 30;
+ public static final int[] ADDRESS_VOLTAGE_OUTPUT_PORT_MAP = new int[]{24, 30};
+ public static final int ANALOG_VOLTAGE_OUTPUT_BUFFER_SIZE = 5;
+ public static final byte BUFFER_FLAG_I2C0 = 1;
+ public static final byte BUFFER_FLAG_I2C1 = 2;
+ public static final byte BUFFER_FLAG_I2C2 = 4;
+ public static final byte BUFFER_FLAG_I2C3 = 8;
+ public static final byte BUFFER_FLAG_I2C4 = 16;
+ public static final byte BUFFER_FLAG_I2C5 = 32;
+ public static final int[] BUFFER_FLAG_MAP = new int[]{1, 2, 4, 8, 16, 32};
+ public static final int D0_MASK = 1;
+ public static final int D1_MASK = 2;
+ public static final int D2_MASK = 4;
+ public static final int D3_MASK = 8;
+ public static final int D4_MASK = 16;
+ public static final int D5_MASK = 32;
+ public static final int D6_MASK = 64;
+ public static final int D7_MASK = 128;
+ public static final boolean DEBUG_LOGGING = false;
+ public static final byte I2C_ACTION_FLAG = -1;
+ public static final byte I2C_MODE_READ = -128;
+ public static final byte I2C_MODE_WRITE = 0;
+ public static final byte I2C_NO_ACTION_FLAG = 0;
+ public static final int I2C_PORT_BUFFER_SIZE = 32;
+ public static final int LED_0_BIT_MASK = 1;
+ public static final int LED_1_BIT_MASK = 2;
+ public static final int[] LED_BIT_MASK_MAP = new int[]{1, 2};
+ public static final int MAX_ANALOG_PORT_NUMBER = 7;
+ public static final int MAX_I2C_PORT_NUMBER = 5;
+ public static final int MIN_ANALOG_PORT_NUMBER = 0;
+ public static final int MIN_I2C_PORT_NUMBER = 0;
+ public static final int MONITOR_LENGTH = 21;
+ public static final int NUMBER_OF_PORTS = 6;
+ public static final int OFFSET_ANALOG_VOLTAGE_OUTPUT_FREQ = 2;
+ public static final int OFFSET_ANALOG_VOLTAGE_OUTPUT_MODE = 4;
+ public static final int OFFSET_ANALOG_VOLTAGE_OUTPUT_VOLTAGE = 0;
+ public static final int OFFSET_I2C_PORT_FLAG = 31;
+ public static final int OFFSET_I2C_PORT_I2C_ADDRESS = 1;
+ public static final int OFFSET_I2C_PORT_MEMORY_ADDRESS = 2;
+ public static final int OFFSET_I2C_PORT_MEMORY_BUFFER = 4;
+ public static final int OFFSET_I2C_PORT_MEMORY_LENGTH = 3;
+ public static final int OFFSET_I2C_PORT_MODE = 0;
+ public static final int OFFSET_PULSE_OUTPUT_PERIOD = 2;
+ public static final int OFFSET_PULSE_OUTPUT_TIME = 0;
+ public static final int PULSE_OUTPUT_BUFFER_SIZE = 4;
+ public static final int SIZE_ANALOG_BUFFER = 2;
+ public static final int SIZE_I2C_BUFFER = 27;
+ public static final int START_ADDRESS = 3;
+ public static final int WORD_SIZE = 2;
+ private static final int[] a = new int[]{0, 1};
+ private static final int[] b = new int[]{2, 3};
+ private static final int[] c = new int[]{4, 5, 6, 7, 8, 9};
+ private static final int[] d = new int[]{10, 11, 12, 13, 14, 15};
+ private final I2cController.I2cPortReadyCallback[] e = new I2cController.I2cPortReadyCallback[6];
+ private final ElapsedTime[] f = new ElapsedTime[6];
+ private ReadWriteRunnableSegment[] g;
+ private ReadWriteRunnableSegment[] h;
+ private ReadWriteRunnableSegment[] i;
+ private ReadWriteRunnableSegment[] j;
+
+ protected ModernRoboticsUsbDeviceInterfaceModule(SerialNumber var1, RobotUsbDevice var2, EventLoopManager var3) throws RobotCoreException, InterruptedException {
+ super(var1, var3, new ReadWriteRunnableStandard(var1, var2, 21, 3, false));
+ this.g = new ReadWriteRunnableSegment[a.length];
+ this.h = new ReadWriteRunnableSegment[b.length];
+ this.i = new ReadWriteRunnableSegment[c.length];
+ this.j = new ReadWriteRunnableSegment[d.length];
+
+ for(int var4 = 0; var4 < a.length; ++var4) {
+ this.g[var4] = this.readWriteRunnable.createSegment(a[var4], ADDRESS_VOLTAGE_OUTPUT_PORT_MAP[var4], 5);
+ }
+
+ int var5 = 0;
+
+ while(true) {
+ int var6 = b.length;
+ int var7 = 0;
+ if(var5 >= var6) {
+ while(var7 < c.length) {
+ this.i[var7] = this.readWriteRunnable.createSegment(c[var7], ADDRESS_I2C_PORT_MAP[var7], 32);
+ this.j[var7] = this.readWriteRunnable.createSegment(d[var7], 31 + ADDRESS_I2C_PORT_MAP[var7], 1);
+ ++var7;
+ }
+
+ return;
+ }
+
+ this.h[var5] = this.readWriteRunnable.createSegment(b[var5], ADDRESS_PULSE_OUTPUT_PORT_MAP[var5], 4);
+ ++var5;
+ }
+ }
+
+ private int a(int var1, DigitalChannelController.Mode var2) {
+ return var2 == DigitalChannelController.Mode.OUTPUT?ADDRESS_DIGITAL_BIT_MASK[var1]:~ADDRESS_DIGITAL_BIT_MASK[var1];
+ }
+
+ private DigitalChannelController.Mode a(int var1, int var2) {
+ return (var2 & ADDRESS_DIGITAL_BIT_MASK[var1]) > 0?DigitalChannelController.Mode.OUTPUT:DigitalChannelController.Mode.INPUT;
+ }
+
+ private void a(int var1) {
+ if(var1 != 0 && var1 != 1) {
+ Object[] var2 = new Object[]{Integer.valueOf(var1)};
+ throw new IllegalArgumentException(String.format("port %d is invalid; valid ports are 0 and 1.", var2));
+ }
+ }
+
+ private boolean a(int var1, byte var2) {
+ return (var2 & BUFFER_FLAG_MAP[var1]) == 0;
+ }
+
+ private void b(int var1) {
+ if(var1 != 0 && var1 != 1) {
+ Object[] var2 = new Object[]{Integer.valueOf(var1)};
+ throw new IllegalArgumentException(String.format("port %d is invalid; valid ports are 0 and 1.", var2));
+ }
+ }
+
+ private void c(int var1) {
+ if(var1 != 0 && var1 != 1) {
+ Object[] var2 = new Object[]{Integer.valueOf(var1)};
+ throw new IllegalArgumentException(String.format("port %d is invalid; valid ports are 0 and 1.", var2));
+ }
+ }
+
+ private void d(int var1) {
+ if(var1 < 0 || var1 > 7) {
+ Object[] var2 = new Object[]{Integer.valueOf(var1), Integer.valueOf(0), Integer.valueOf(7)};
+ throw new IllegalArgumentException(String.format("port %d is invalid; valid ports are %d..%d", var2));
+ }
+ }
+
+ private void e(int var1) {
+ if(var1 < 0 || var1 > 5) {
+ Object[] var2 = new Object[]{Integer.valueOf(var1), Integer.valueOf(0), Integer.valueOf(5)};
+ throw new IllegalArgumentException(String.format("port %d is invalid; valid ports are %d..%d", var2));
+ }
+ }
+
+ private void f(int var1) {
+ if(var1 > 27) {
+ Object[] var2 = new Object[]{Integer.valueOf(var1), Integer.valueOf(27)};
+ throw new IllegalArgumentException(String.format("buffer is too large (%d byte), max size is %d bytes", var2));
+ }
+ }
+
+ public void copyBufferIntoWriteBuffer(int var1, byte[] var2) {
+ this.e(var1);
+ this.f(var2.length);
+
+ try {
+ this.i[var1].getWriteLock().lock();
+ System.arraycopy(var2, 0, this.i[var1].getWriteBuffer(), 4, var2.length);
+ } finally {
+ this.i[var1].getWriteLock().unlock();
+ }
+
+ }
+
+ public void deregisterForPortReadyCallback(int var1) {
+ this.e[var1] = null;
+ }
+
+ public void enableI2cReadMode(int var1, int var2, int var3, int var4) {
+ this.e(var1);
+ this.f(var4);
+
+ try {
+ this.i[var1].getWriteLock().lock();
+ byte[] var6 = this.i[var1].getWriteBuffer();
+ var6[0] = -128;
+ var6[1] = (byte)var2;
+ var6[2] = (byte)var3;
+ var6[3] = (byte)var4;
+ } finally {
+ this.i[var1].getWriteLock().unlock();
+ }
+
+ }
+
+ public void enableI2cWriteMode(int var1, int var2, int var3, int var4) {
+ this.e(var1);
+ this.f(var4);
+
+ try {
+ this.i[var1].getWriteLock().lock();
+ byte[] var6 = this.i[var1].getWriteBuffer();
+ var6[0] = 0;
+ var6[1] = (byte)var2;
+ var6[2] = (byte)var3;
+ var6[3] = (byte)var4;
+ } finally {
+ this.i[var1].getWriteLock().unlock();
+ }
+
+ }
+
+ public int getAnalogInputValue(int var1) {
+ this.d(var1);
+ return TypeConversion.byteArrayToShort(this.read(ADDRESS_ANALOG_PORT_MAP[var1], 2), ByteOrder.LITTLE_ENDIAN);
+ }
+
+ public String getConnectionInfo() {
+ return "USB " + this.getSerialNumber();
+ }
+
+ public byte[] getCopyOfReadBuffer(int var1) {
+ this.e(var1);
+
+ byte[] var4;
+ try {
+ this.i[var1].getReadLock().lock();
+ byte[] var3 = this.i[var1].getReadBuffer();
+ var4 = new byte[var3[3]];
+ System.arraycopy(var3, 4, var4, 0, var4.length);
+ } finally {
+ this.i[var1].getReadLock().unlock();
+ }
+
+ return var4;
+ }
+
+ public byte[] getCopyOfWriteBuffer(int var1) {
+ this.e(var1);
+
+ byte[] var4;
+ try {
+ this.i[var1].getWriteLock().lock();
+ byte[] var3 = this.i[var1].getWriteBuffer();
+ var4 = new byte[var3[3]];
+ System.arraycopy(var3, 4, var4, 0, var4.length);
+ } finally {
+ this.i[var1].getWriteLock().unlock();
+ }
+
+ return var4;
+ }
+
+ public String getDeviceName() {
+ return "Modern Robotics USB Device Interface Module";
+ }
+
+ public DigitalChannelController.Mode getDigitalChannelMode(int var1) {
+ return this.a(var1, (int)this.getDigitalIOControlByte());
+ }
+
+ public boolean getDigitalChannelState(int var1) {
+ int var2;
+ if(DigitalChannelController.Mode.OUTPUT == this.getDigitalChannelMode(var1)) {
+ var2 = this.getDigitalOutputStateByte();
+ } else {
+ var2 = this.getDigitalInputStateByte();
+ }
+
+ return (var2 & ADDRESS_DIGITAL_BIT_MASK[var1]) > 0;
+ }
+
+ public byte getDigitalIOControlByte() {
+ return this.read(21);
+ }
+
+ public int getDigitalInputStateByte() {
+ return TypeConversion.unsignedByteToInt(this.read(20));
+ }
+
+ public byte getDigitalOutputStateByte() {
+ return this.read(22);
+ }
+
+ public byte[] getI2cReadCache(int var1) {
+ return this.i[var1].getReadBuffer();
+ }
+
+ public Lock getI2cReadCacheLock(int var1) {
+ return this.i[var1].getReadLock();
+ }
+
+ public byte[] getI2cWriteCache(int var1) {
+ return this.i[var1].getWriteBuffer();
+ }
+
+ public Lock getI2cWriteCacheLock(int var1) {
+ return this.i[var1].getWriteLock();
+ }
+
+ public boolean getLEDState(int var1) {
+ this.a(var1);
+ return (this.read(23) & LED_BIT_MASK_MAP[var1]) > 0;
+ }
+
+ public int getPulseWidthOutputTime(int var1) {
+ throw new UnsupportedOperationException("getPulseWidthOutputTime is not implemented.");
+ }
+
+ public int getPulseWidthPeriod(int var1) {
+ throw new UnsupportedOperationException("getPulseWidthOutputTime is not implemented.");
+ }
+
+ public boolean isI2cPortActionFlagSet(int var1) {
+ this.e(var1);
+ boolean var6 = false;
+
+ byte var3;
+ try {
+ var6 = true;
+ this.i[var1].getReadLock().lock();
+ var3 = this.i[var1].getReadBuffer()[31];
+ var6 = false;
+ } finally {
+ if(var6) {
+ this.i[var1].getReadLock().unlock();
+ }
+ }
+
+ boolean var4;
+ if(var3 == -1) {
+ var4 = true;
+ } else {
+ var4 = false;
+ }
+
+ this.i[var1].getReadLock().unlock();
+ return var4;
+ }
+
+ public boolean isI2cPortInReadMode(int var1) {
+ this.e(var1);
+ boolean var6 = false;
+
+ byte var3;
+ try {
+ var6 = true;
+ this.i[var1].getReadLock().lock();
+ var3 = this.i[var1].getReadBuffer()[0];
+ var6 = false;
+ } finally {
+ if(var6) {
+ this.i[var1].getReadLock().unlock();
+ }
+ }
+
+ boolean var4 = false;
+ if(var3 == -128) {
+ var4 = true;
+ }
+
+ this.i[var1].getReadLock().unlock();
+ return var4;
+ }
+
+ public boolean isI2cPortInWriteMode(int var1) {
+ this.e(var1);
+ boolean var6 = false;
+
+ byte var3;
+ try {
+ var6 = true;
+ this.i[var1].getReadLock().lock();
+ var3 = this.i[var1].getReadBuffer()[0];
+ var6 = false;
+ } finally {
+ if(var6) {
+ this.i[var1].getReadLock().unlock();
+ }
+ }
+
+ boolean var4 = false;
+ if(var3 == 0) {
+ var4 = true;
+ }
+
+ this.i[var1].getReadLock().unlock();
+ return var4;
+ }
+
+ public boolean isI2cPortReady(int var1) {
+ return this.a(var1, this.read(3));
+ }
+
+ public void readComplete() throws InterruptedException {
+ if(this.e != null) {
+ byte var1 = this.read(3);
+
+ for(int var2 = 0; var2 < 6; ++var2) {
+ if(this.e[var2] != null && this.a(var2, var1)) {
+ this.e[var2].portIsReady(var2);
+ }
+ }
+ }
+
+ }
+
+ public void readI2cCacheFromController(int var1) {
+ this.e(var1);
+ this.readWriteRunnable.queueSegmentRead(c[var1]);
+ }
+
+ @Deprecated
+ public void readI2cCacheFromModule(int var1) {
+ this.readI2cCacheFromController(var1);
+ }
+
+ public void registerForI2cPortReadyCallback(I2cController.I2cPortReadyCallback var1, int var2) {
+ this.e[var2] = var1;
+ }
+
+ public void setAnalogOutputFrequency(int var1, int var2) {
+ this.b(var1);
+ Lock var3 = this.g[var1].getWriteLock();
+ byte[] var4 = this.g[var1].getWriteBuffer();
+ byte[] var5 = TypeConversion.shortToByteArray((short)var2, ByteOrder.LITTLE_ENDIAN);
+
+ try {
+ var3.lock();
+ System.arraycopy(var5, 0, var4, 2, var5.length);
+ } finally {
+ var3.unlock();
+ }
+
+ this.readWriteRunnable.queueSegmentWrite(a[var1]);
+ }
+
+ public void setAnalogOutputMode(int var1, byte var2) {
+ this.b(var1);
+ Lock var3 = this.g[var1].getWriteLock();
+ byte[] var4 = this.g[var1].getWriteBuffer();
+
+ try {
+ var3.lock();
+ var4[4] = var2;
+ } finally {
+ var3.unlock();
+ }
+
+ this.readWriteRunnable.queueSegmentWrite(a[var1]);
+ }
+
+ public void setAnalogOutputVoltage(int var1, int var2) {
+ this.b(var1);
+ Lock var3 = this.g[var1].getWriteLock();
+ byte[] var4 = this.g[var1].getWriteBuffer();
+ byte[] var5 = TypeConversion.shortToByteArray((short)var2, ByteOrder.LITTLE_ENDIAN);
+
+ try {
+ var3.lock();
+ System.arraycopy(var5, 0, var4, 0, var5.length);
+ } finally {
+ var3.unlock();
+ }
+
+ this.readWriteRunnable.queueSegmentWrite(a[var1]);
+ }
+
+ public void setDigitalChannelMode(int var1, DigitalChannelController.Mode var2) {
+ int var3 = this.a(var1, var2);
+ byte var4 = this.readFromWriteCache(21);
+ int var5;
+ if(var2 == DigitalChannelController.Mode.OUTPUT) {
+ var5 = var3 | var4;
+ } else {
+ var5 = var3 & var4;
+ }
+
+ this.write(21, var5);
+ }
+
+ public void setDigitalChannelState(int var1, boolean var2) {
+ if(DigitalChannelController.Mode.OUTPUT == this.getDigitalChannelMode(var1)) {
+ byte var3 = this.readFromWriteCache(22);
+ int var4;
+ if(var2) {
+ var4 = var3 | ADDRESS_DIGITAL_BIT_MASK[var1];
+ } else {
+ var4 = var3 & ~ADDRESS_DIGITAL_BIT_MASK[var1];
+ }
+
+ this.setDigitalOutputByte((byte)var4);
+ }
+
+ }
+
+ public void setDigitalIOControlByte(byte var1) {
+ this.write(21, var1);
+ }
+
+ public void setDigitalOutputByte(byte var1) {
+ this.write(22, var1);
+ }
+
+ public void setI2cPortActionFlag(int var1) {
+ this.e(var1);
+
+ try {
+ this.i[var1].getWriteLock().lock();
+ this.i[var1].getWriteBuffer()[31] = -1;
+ } finally {
+ this.i[var1].getWriteLock().unlock();
+ }
+
+ }
+
+ public void setLED(int var1, boolean var2) {
+ this.a(var1);
+ byte var3 = this.readFromWriteCache(23);
+ int var4;
+ if(var2) {
+ var4 = var3 | LED_BIT_MASK_MAP[var1];
+ } else {
+ var4 = var3 & ~LED_BIT_MASK_MAP[var1];
+ }
+
+ this.write(23, var4);
+ }
+
+ public void setPulseWidthOutputTime(int var1, int var2) {
+ this.c(var1);
+ Lock var3 = this.h[var1].getWriteLock();
+ byte[] var4 = this.h[var1].getWriteBuffer();
+ byte[] var5 = TypeConversion.shortToByteArray((short)var2, ByteOrder.LITTLE_ENDIAN);
+
+ try {
+ var3.lock();
+ System.arraycopy(var5, 0, var4, 0, var5.length);
+ } finally {
+ var3.unlock();
+ }
+
+ this.readWriteRunnable.queueSegmentWrite(b[var1]);
+ }
+
+ public void setPulseWidthPeriod(int var1, int var2) {
+ this.e(var1);
+ Lock var3 = this.h[var1].getWriteLock();
+ byte[] var4 = this.h[var1].getWriteBuffer();
+ byte[] var5 = TypeConversion.shortToByteArray((short)var2, ByteOrder.LITTLE_ENDIAN);
+
+ try {
+ var3.lock();
+ System.arraycopy(var5, 0, var4, 2, var5.length);
+ } finally {
+ var3.unlock();
+ }
+
+ this.readWriteRunnable.queueSegmentWrite(b[var1]);
+ }
+
+ public void writeI2cCacheToController(int var1) {
+ this.e(var1);
+ this.readWriteRunnable.queueSegmentWrite(c[var1]);
+ }
+
+ @Deprecated
+ public void writeI2cCacheToModule(int var1) {
+ this.writeI2cCacheToController(var1);
+ }
+
+ public void writeI2cPortFlagOnlyToController(int var1) {
+ this.e(var1);
+ ReadWriteRunnableSegment var2 = this.i[var1];
+ ReadWriteRunnableSegment var3 = this.j[var1];
+
+ try {
+ var2.getWriteLock().lock();
+ var3.getWriteLock().lock();
+ var3.getWriteBuffer()[0] = var2.getWriteBuffer()[31];
+ } finally {
+ var2.getWriteLock().unlock();
+ var3.getWriteLock().unlock();
+ }
+
+ this.readWriteRunnable.queueSegmentWrite(d[var1]);
+ }
+
+ @Deprecated
+ public void writeI2cPortFlagOnlyToModule(int var1) {
+ this.writeI2cPortFlagOnlyToController(var1);
+ }
+}
diff --git a/FtcRobotController/app/src/main/java/com/qualcomm/hardware/ModernRoboticsUsbLegacyModule.java b/FtcRobotController/Hardware/src/main/java/com/qualcomm/hardware/ModernRoboticsUsbLegacyModule.java
similarity index 94%
rename from FtcRobotController/app/src/main/java/com/qualcomm/hardware/ModernRoboticsUsbLegacyModule.java
rename to FtcRobotController/Hardware/src/main/java/com/qualcomm/hardware/ModernRoboticsUsbLegacyModule.java
index 39b66e3..6253ae4 100644
--- a/FtcRobotController/app/src/main/java/com/qualcomm/hardware/ModernRoboticsUsbLegacyModule.java
+++ b/FtcRobotController/Hardware/src/main/java/com/qualcomm/hardware/ModernRoboticsUsbLegacyModule.java
@@ -1,445 +1,440 @@
-package com.qualcomm.hardware;
-
-import com.qualcomm.hardware.ModernRoboticsUsbDevice;
-import com.qualcomm.hardware.ReadWriteRunnableSegment;
-import com.qualcomm.hardware.ReadWriteRunnableStandard;
-import com.qualcomm.robotcore.eventloop.EventLoopManager;
-import com.qualcomm.robotcore.exception.RobotCoreException;
-import com.qualcomm.robotcore.hardware.I2cController;
-import com.qualcomm.robotcore.hardware.LegacyModule;
-import com.qualcomm.robotcore.hardware.usb.RobotUsbDevice;
-import com.qualcomm.robotcore.util.SerialNumber;
-import java.util.concurrent.locks.Lock;
-
-public class ModernRoboticsUsbLegacyModule extends ModernRoboticsUsbDevice implements LegacyModule {
- public static final int[] ADDRESS_ANALOG_PORT_MAP = new int[]{4, 6, 8, 10, 12, 14};
- public static final int ADDRESS_ANALOG_PORT_S0 = 4;
- public static final int ADDRESS_ANALOG_PORT_S1 = 6;
- public static final int ADDRESS_ANALOG_PORT_S2 = 8;
- public static final int ADDRESS_ANALOG_PORT_S3 = 10;
- public static final int ADDRESS_ANALOG_PORT_S4 = 12;
- public static final int ADDRESS_ANALOG_PORT_S5 = 14;
- public static final int ADDRESS_BUFFER_STATUS = 3;
- public static final int[] ADDRESS_I2C_PORT_MAP = new int[]{16, 48, 80, 112, 144, 176};
- public static final int ADDRESS_I2C_PORT_S1 = 48;
- public static final int ADDRESS_I2C_PORT_S2 = 80;
- public static final int ADDRESS_I2C_PORT_S3 = 112;
- public static final int ADDRESS_I2C_PORT_S4 = 144;
- public static final int ADDRESS_I2C_PORT_S5 = 176;
- public static final int ADDRESS_I2C_PORT_SO = 16;
- public static final int[] BUFFER_FLAG_MAP = new int[]{1, 2, 4, 8, 16, 32};
- public static final byte BUFFER_FLAG_S0 = 1;
- public static final byte BUFFER_FLAG_S1 = 2;
- public static final byte BUFFER_FLAG_S2 = 4;
- public static final byte BUFFER_FLAG_S3 = 8;
- public static final byte BUFFER_FLAG_S4 = 16;
- public static final byte BUFFER_FLAG_S5 = 32;
- public static final boolean DEBUG_LOGGING = false;
- public static final int[] DIGITAL_LINE = new int[]{4, 8};
- public static final byte I2C_ACTION_FLAG = -1;
- public static final byte I2C_NO_ACTION_FLAG = 0;
- public static final byte MAX_PORT_NUMBER = 5;
- public static final byte MIN_PORT_NUMBER = 0;
- public static final int MONITOR_LENGTH = 13;
- public static final byte NUMBER_OF_PORTS = 6;
- public static final byte NXT_MODE_9V_ENABLED = 2;
- public static final byte NXT_MODE_ANALOG = 0;
- public static final byte NXT_MODE_DIGITAL_0 = 4;
- public static final byte NXT_MODE_DIGITAL_1 = 8;
- public static final byte NXT_MODE_I2C = 1;
- public static final byte NXT_MODE_READ = -128;
- public static final byte NXT_MODE_WRITE = 0;
- public static final byte OFFSET_I2C_PORT_FLAG = 31;
- public static final byte OFFSET_I2C_PORT_I2C_ADDRESS = 1;
- public static final byte OFFSET_I2C_PORT_MEMORY_ADDRESS = 2;
- public static final byte OFFSET_I2C_PORT_MEMORY_BUFFER = 4;
- public static final byte OFFSET_I2C_PORT_MEMORY_LENGTH = 3;
- public static final byte OFFSET_I2C_PORT_MODE = 0;
- public static final int[] PORT_9V_CAPABLE = new int[]{4, 5};
- public static final byte SIZE_ANALOG_BUFFER = 2;
- public static final byte SIZE_I2C_BUFFER = 27;
- public static final byte SIZE_OF_PORT_BUFFER = 32;
- public static final byte START_ADDRESS = 3;
- private final ReadWriteRunnableSegment[] a;
- private final I2cController.I2cPortReadyCallback[] b;
-
- protected ModernRoboticsUsbLegacyModule(SerialNumber var1, RobotUsbDevice var2, EventLoopManager var3) throws RobotCoreException, InterruptedException {
- int var4 = 0;
- super(var1, var3, new ReadWriteRunnableStandard(var1, var2, 13, 3, false));
- this.a = new ReadWriteRunnableSegment[12];
- this.b = new I2cController.I2cPortReadyCallback[6];
- this.readWriteRunnable.setCallback(this);
-
- while(var4 < 6) {
- this.a[var4] = this.readWriteRunnable.createSegment(var4, ADDRESS_I2C_PORT_MAP[var4], 32);
- this.a[var4 + 6] = this.readWriteRunnable.createSegment(var4 + 6, 31 + ADDRESS_I2C_PORT_MAP[var4], 1);
- this.enableAnalogReadMode(var4);
- this.readWriteRunnable.queueSegmentWrite(var4);
- ++var4;
- }
-
- }
-
- private void a(int var1) {
- if(var1 < 0 || var1 > 5) {
- Object[] var2 = new Object[]{Integer.valueOf(var1), Byte.valueOf((byte)0), Byte.valueOf((byte)5)};
- throw new IllegalArgumentException(String.format("port %d is invalid; valid ports are %d..%d", var2));
- }
- }
-
- private boolean a(int var1, byte var2) {
- return (var2 & BUFFER_FLAG_MAP[var1]) == 0;
- }
-
- private void b(int var1) {
- if(var1 < 0 || var1 > 27) {
- Object[] var2 = new Object[]{Integer.valueOf(var1), Byte.valueOf((byte)27)};
- throw new IllegalArgumentException(String.format("buffer length of %d is invalid; max value is %d", var2));
- }
- }
-
- private void c(int var1) {
- if(var1 != 0 && var1 != 1) {
- throw new IllegalArgumentException("line is invalid, valid lines are 0 and 1");
- }
- }
-
- public void close() {
- super.close();
- }
-
- public void copyBufferIntoWriteBuffer(int var1, byte[] var2) {
- this.a(var1);
- this.b(var2.length);
-
- try {
- this.a[var1].getWriteLock().lock();
- System.arraycopy(var2, 0, this.a[var1].getWriteBuffer(), 4, var2.length);
- } finally {
- this.a[var1].getWriteLock().unlock();
- }
-
- }
-
- public void deregisterForPortReadyCallback(int var1) {
- this.b[var1] = null;
- }
-
- public void enable9v(int param1, boolean param2) {
- // $FF: Couldn't be decompiled
- }
-
- public void enableAnalogReadMode(int var1) {
- this.a(var1);
-
- try {
- this.a[var1].getWriteLock().lock();
- this.a[var1].getWriteBuffer()[0] = 0;
- } finally {
- this.a[var1].getWriteLock().unlock();
- }
-
- this.writeI2cCacheToController(var1);
- }
-
- public void enableI2cReadMode(int var1, int var2, int var3, int var4) {
- this.a(var1);
- this.b(var4);
-
- try {
- this.a[var1].getWriteLock().lock();
- byte[] var6 = this.a[var1].getWriteBuffer();
- var6[0] = -127;
- var6[1] = (byte)var2;
- var6[2] = (byte)var3;
- var6[3] = (byte)var4;
- } finally {
- this.a[var1].getWriteLock().unlock();
- }
-
- }
-
- public void enableI2cWriteMode(int var1, int var2, int var3, int var4) {
- this.a(var1);
- this.b(var4);
-
- try {
- this.a[var1].getWriteLock().lock();
- byte[] var6 = this.a[var1].getWriteBuffer();
- var6[0] = 1;
- var6[1] = (byte)var2;
- var6[2] = (byte)var3;
- var6[3] = (byte)var4;
- } finally {
- this.a[var1].getWriteLock().unlock();
- }
-
- }
-
- public String getConnectionInfo() {
- return "USB " + this.getSerialNumber();
- }
-
- public byte[] getCopyOfReadBuffer(int var1) {
- this.a(var1);
-
- byte[] var4;
- try {
- this.a[var1].getReadLock().lock();
- byte[] var3 = this.a[var1].getReadBuffer();
- var4 = new byte[var3[3]];
- System.arraycopy(var3, 4, var4, 0, var4.length);
- } finally {
- this.a[var1].getReadLock().unlock();
- }
-
- return var4;
- }
-
- public byte[] getCopyOfWriteBuffer(int var1) {
- this.a(var1);
-
- byte[] var4;
- try {
- this.a[var1].getWriteLock().lock();
- byte[] var3 = this.a[var1].getWriteBuffer();
- var4 = new byte[var3[3]];
- System.arraycopy(var3, 4, var4, 0, var4.length);
- } finally {
- this.a[var1].getWriteLock().unlock();
- }
-
- return var4;
- }
-
- public String getDeviceName() {
- return "Modern Robotics USB Legacy Module";
- }
-
- public byte[] getI2cReadCache(int var1) {
- this.a(var1);
- return this.a[var1].getReadBuffer();
- }
-
- public Lock getI2cReadCacheLock(int var1) {
- this.a(var1);
- return this.a[var1].getReadLock();
- }
-
- public byte[] getI2cWriteCache(int var1) {
- this.a(var1);
- return this.a[var1].getWriteBuffer();
- }
-
- public Lock getI2cWriteCacheLock(int var1) {
- this.a(var1);
- return this.a[var1].getWriteLock();
- }
-
- public boolean isI2cPortActionFlagSet(int var1) {
- this.a(var1);
- boolean var6 = false;
-
- byte var3;
- try {
- var6 = true;
- this.a[var1].getReadLock().lock();
- var3 = this.a[var1].getReadBuffer()[31];
- var6 = false;
- } finally {
- if(var6) {
- this.a[var1].getReadLock().unlock();
- }
- }
-
- boolean var4;
- if(var3 == -1) {
- var4 = true;
- } else {
- var4 = false;
- }
-
- this.a[var1].getReadLock().unlock();
- return var4;
- }
-
- public boolean isI2cPortInReadMode(int var1) {
- this.a(var1);
- boolean var6 = false;
-
- byte var3;
- try {
- var6 = true;
- this.a[var1].getReadLock().lock();
- var3 = this.a[var1].getReadBuffer()[0];
- var6 = false;
- } finally {
- if(var6) {
- this.a[var1].getReadLock().unlock();
- }
- }
-
- boolean var4 = false;
- if(var3 == -127) {
- var4 = true;
- }
-
- this.a[var1].getReadLock().unlock();
- return var4;
- }
-
- public boolean isI2cPortInWriteMode(int var1) {
- byte var2 = 1;
- this.a(var1);
- boolean var6 = false;
-
- byte var4;
- try {
- var6 = true;
- this.a[var1].getReadLock().lock();
- var4 = this.a[var1].getReadBuffer()[0];
- var6 = false;
- } finally {
- if(var6) {
- this.a[var1].getReadLock().unlock();
- }
- }
-
- if(var4 != var2) {
- var2 = 0;
- }
-
- this.a[var1].getReadLock().unlock();
- return (boolean)var2;
- }
-
- public boolean isI2cPortReady(int var1) {
- return this.a(var1, this.read(3));
- }
-
- public byte[] readAnalog(int var1) {
- this.a(var1);
- return this.read(ADDRESS_ANALOG_PORT_MAP[var1], 2);
- }
-
- public void readComplete() throws InterruptedException {
- if(this.b != null) {
- byte var1 = this.read(3);
-
- for(int var2 = 0; var2 < 6; ++var2) {
- if(this.b[var2] != null && this.a(var2, var1)) {
- this.b[var2].portIsReady(var2);
- }
- }
- }
-
- }
-
- public void readI2cCacheFromController(int var1) {
- this.a(var1);
- this.readWriteRunnable.queueSegmentRead(var1);
- }
-
- @Deprecated
- public void readI2cCacheFromModule(int var1) {
- this.readI2cCacheFromController(var1);
- }
-
- public void registerForI2cPortReadyCallback(I2cController.I2cPortReadyCallback var1, int var2) {
- this.b[var2] = var1;
- }
-
- public void setData(int var1, byte[] var2, int var3) {
- this.a(var1);
- this.b(var3);
-
- try {
- this.a[var1].getWriteLock().lock();
- byte[] var5 = this.a[var1].getWriteBuffer();
- System.arraycopy(var2, 0, var5, 4, var3);
- var5[3] = (byte)var3;
- } finally {
- this.a[var1].getWriteLock().unlock();
- }
-
- }
-
- public void setDigitalLine(int param1, int param2, boolean param3) {
- // $FF: Couldn't be decompiled
- }
-
- public void setI2cPortActionFlag(int var1) {
- this.a(var1);
-
- try {
- this.a[var1].getWriteLock().lock();
- this.a[var1].getWriteBuffer()[31] = -1;
- } finally {
- this.a[var1].getWriteLock().unlock();
- }
-
- }
-
- public void setReadMode(int var1, int var2, int var3, int var4) {
- this.a(var1);
-
- try {
- this.a[var1].getWriteLock().lock();
- byte[] var6 = this.a[var1].getWriteBuffer();
- var6[0] = -127;
- var6[1] = (byte)var2;
- var6[2] = (byte)var3;
- var6[3] = (byte)var4;
- } finally {
- this.a[var1].getWriteLock().unlock();
- }
-
- }
-
- public void setWriteMode(int var1, int var2, int var3) {
- this.a(var1);
-
- try {
- this.a[var1].getWriteLock().lock();
- byte[] var5 = this.a[var1].getWriteBuffer();
- var5[0] = 1;
- var5[1] = (byte)var2;
- var5[2] = (byte)var3;
- } finally {
- this.a[var1].getWriteLock().unlock();
- }
-
- }
-
- public void writeI2cCacheToController(int var1) {
- this.a(var1);
- this.readWriteRunnable.queueSegmentWrite(var1);
- }
-
- @Deprecated
- public void writeI2cCacheToModule(int var1) {
- this.writeI2cCacheToController(var1);
- }
-
- public void writeI2cPortFlagOnlyToController(int var1) {
- this.a(var1);
- ReadWriteRunnableSegment var2 = this.a[var1];
- ReadWriteRunnableSegment var3 = this.a[var1 + 6];
-
- try {
- var2.getWriteLock().lock();
- var3.getWriteLock().lock();
- var3.getWriteBuffer()[0] = var2.getWriteBuffer()[31];
- } finally {
- var2.getWriteLock().unlock();
- var3.getWriteLock().unlock();
- }
-
- this.readWriteRunnable.queueSegmentWrite(var1 + 6);
- }
-
- @Deprecated
- public void writeI2cPortFlagOnlyToModule(int var1) {
- this.writeI2cPortFlagOnlyToController(var1);
- }
-}
+package com.qualcomm.hardware;
+
+import com.qualcomm.robotcore.eventloop.EventLoopManager;
+import com.qualcomm.robotcore.exception.RobotCoreException;
+import com.qualcomm.robotcore.hardware.I2cController;
+import com.qualcomm.robotcore.hardware.LegacyModule;
+import com.qualcomm.robotcore.hardware.usb.RobotUsbDevice;
+import com.qualcomm.robotcore.util.SerialNumber;
+
+import java.util.concurrent.locks.Lock;
+
+public class ModernRoboticsUsbLegacyModule extends ModernRoboticsUsbDevice implements LegacyModule {
+ public static final int[] ADDRESS_ANALOG_PORT_MAP = new int[]{4, 6, 8, 10, 12, 14};
+ public static final int ADDRESS_ANALOG_PORT_S0 = 4;
+ public static final int ADDRESS_ANALOG_PORT_S1 = 6;
+ public static final int ADDRESS_ANALOG_PORT_S2 = 8;
+ public static final int ADDRESS_ANALOG_PORT_S3 = 10;
+ public static final int ADDRESS_ANALOG_PORT_S4 = 12;
+ public static final int ADDRESS_ANALOG_PORT_S5 = 14;
+ public static final int ADDRESS_BUFFER_STATUS = 3;
+ public static final int[] ADDRESS_I2C_PORT_MAP = new int[]{16, 48, 80, 112, 144, 176};
+ public static final int ADDRESS_I2C_PORT_S1 = 48;
+ public static final int ADDRESS_I2C_PORT_S2 = 80;
+ public static final int ADDRESS_I2C_PORT_S3 = 112;
+ public static final int ADDRESS_I2C_PORT_S4 = 144;
+ public static final int ADDRESS_I2C_PORT_S5 = 176;
+ public static final int ADDRESS_I2C_PORT_SO = 16;
+ public static final int[] BUFFER_FLAG_MAP = new int[]{1, 2, 4, 8, 16, 32};
+ public static final byte BUFFER_FLAG_S0 = 1;
+ public static final byte BUFFER_FLAG_S1 = 2;
+ public static final byte BUFFER_FLAG_S2 = 4;
+ public static final byte BUFFER_FLAG_S3 = 8;
+ public static final byte BUFFER_FLAG_S4 = 16;
+ public static final byte BUFFER_FLAG_S5 = 32;
+ public static final boolean DEBUG_LOGGING = false;
+ public static final int[] DIGITAL_LINE = new int[]{4, 8};
+ public static final byte I2C_ACTION_FLAG = -1;
+ public static final byte I2C_NO_ACTION_FLAG = 0;
+ public static final byte MAX_PORT_NUMBER = 5;
+ public static final byte MIN_PORT_NUMBER = 0;
+ public static final int MONITOR_LENGTH = 13;
+ public static final byte NUMBER_OF_PORTS = 6;
+ public static final byte NXT_MODE_9V_ENABLED = 2;
+ public static final byte NXT_MODE_ANALOG = 0;
+ public static final byte NXT_MODE_DIGITAL_0 = 4;
+ public static final byte NXT_MODE_DIGITAL_1 = 8;
+ public static final byte NXT_MODE_I2C = 1;
+ public static final byte NXT_MODE_READ = -128;
+ public static final byte NXT_MODE_WRITE = 0;
+ public static final byte OFFSET_I2C_PORT_FLAG = 31;
+ public static final byte OFFSET_I2C_PORT_I2C_ADDRESS = 1;
+ public static final byte OFFSET_I2C_PORT_MEMORY_ADDRESS = 2;
+ public static final byte OFFSET_I2C_PORT_MEMORY_BUFFER = 4;
+ public static final byte OFFSET_I2C_PORT_MEMORY_LENGTH = 3;
+ public static final byte OFFSET_I2C_PORT_MODE = 0;
+ public static final int[] PORT_9V_CAPABLE = new int[]{4, 5};
+ public static final byte SIZE_ANALOG_BUFFER = 2;
+ public static final byte SIZE_I2C_BUFFER = 27;
+ public static final byte SIZE_OF_PORT_BUFFER = 32;
+ public static final byte START_ADDRESS = 3;
+ private final ReadWriteRunnableSegment[] a;
+ private final I2cController.I2cPortReadyCallback[] b;
+
+ protected ModernRoboticsUsbLegacyModule(SerialNumber var1, RobotUsbDevice var2, EventLoopManager var3) throws RobotCoreException, InterruptedException {
+ super(var1, var3, new ReadWriteRunnableStandard(var1, var2, 13, 3, false));
+
+ int var4 = 0;
+ this.a = new ReadWriteRunnableSegment[12];
+ this.b = new I2cController.I2cPortReadyCallback[6];
+ this.readWriteRunnable.setCallback(this);
+
+ while(var4 < 6) {
+ this.a[var4] = this.readWriteRunnable.createSegment(var4, ADDRESS_I2C_PORT_MAP[var4], 32);
+ this.a[var4 + 6] = this.readWriteRunnable.createSegment(var4 + 6, 31 + ADDRESS_I2C_PORT_MAP[var4], 1);
+ this.enableAnalogReadMode(var4);
+ this.readWriteRunnable.queueSegmentWrite(var4);
+ ++var4;
+ }
+
+ }
+
+ private void a(int var1) {
+ if(var1 < 0 || var1 > 5) {
+ Object[] var2 = new Object[]{Integer.valueOf(var1), Byte.valueOf((byte)0), Byte.valueOf((byte)5)};
+ throw new IllegalArgumentException(String.format("port %d is invalid; valid ports are %d..%d", var2));
+ }
+ }
+
+ private boolean a(int var1, byte var2) {
+ return (var2 & BUFFER_FLAG_MAP[var1]) == 0;
+ }
+
+ private void b(int var1) {
+ if(var1 < 0 || var1 > 27) {
+ Object[] var2 = new Object[]{Integer.valueOf(var1), Byte.valueOf((byte)27)};
+ throw new IllegalArgumentException(String.format("buffer length of %d is invalid; max value is %d", var2));
+ }
+ }
+
+ private void c(int var1) {
+ if(var1 != 0 && var1 != 1) {
+ throw new IllegalArgumentException("line is invalid, valid lines are 0 and 1");
+ }
+ }
+
+ public void close() {
+ super.close();
+ }
+
+ public void copyBufferIntoWriteBuffer(int var1, byte[] var2) {
+ this.a(var1);
+ this.b(var2.length);
+
+ try {
+ this.a[var1].getWriteLock().lock();
+ System.arraycopy(var2, 0, this.a[var1].getWriteBuffer(), 4, var2.length);
+ } finally {
+ this.a[var1].getWriteLock().unlock();
+ }
+
+ }
+
+ public void deregisterForPortReadyCallback(int var1) {
+ this.b[var1] = null;
+ }
+
+ public void enable9v(int param1, boolean param2) {
+ // $FF: Couldn't be decompiled
+ }
+
+ public void enableAnalogReadMode(int var1) {
+ this.a(var1);
+
+ try {
+ this.a[var1].getWriteLock().lock();
+ this.a[var1].getWriteBuffer()[0] = 0;
+ } finally {
+ this.a[var1].getWriteLock().unlock();
+ }
+
+ this.writeI2cCacheToController(var1);
+ }
+
+ public void enableI2cReadMode(int var1, int var2, int var3, int var4) {
+ this.a(var1);
+ this.b(var4);
+
+ try {
+ this.a[var1].getWriteLock().lock();
+ byte[] var6 = this.a[var1].getWriteBuffer();
+ var6[0] = -127;
+ var6[1] = (byte)var2;
+ var6[2] = (byte)var3;
+ var6[3] = (byte)var4;
+ } finally {
+ this.a[var1].getWriteLock().unlock();
+ }
+
+ }
+
+ public void enableI2cWriteMode(int var1, int var2, int var3, int var4) {
+ this.a(var1);
+ this.b(var4);
+
+ try {
+ this.a[var1].getWriteLock().lock();
+ byte[] var6 = this.a[var1].getWriteBuffer();
+ var6[0] = 1;
+ var6[1] = (byte)var2;
+ var6[2] = (byte)var3;
+ var6[3] = (byte)var4;
+ } finally {
+ this.a[var1].getWriteLock().unlock();
+ }
+
+ }
+
+ public String getConnectionInfo() {
+ return "USB " + this.getSerialNumber();
+ }
+
+ public byte[] getCopyOfReadBuffer(int var1) {
+ this.a(var1);
+
+ byte[] var4;
+ try {
+ this.a[var1].getReadLock().lock();
+ byte[] var3 = this.a[var1].getReadBuffer();
+ var4 = new byte[var3[3]];
+ System.arraycopy(var3, 4, var4, 0, var4.length);
+ } finally {
+ this.a[var1].getReadLock().unlock();
+ }
+
+ return var4;
+ }
+
+ public byte[] getCopyOfWriteBuffer(int var1) {
+ this.a(var1);
+
+ byte[] var4;
+ try {
+ this.a[var1].getWriteLock().lock();
+ byte[] var3 = this.a[var1].getWriteBuffer();
+ var4 = new byte[var3[3]];
+ System.arraycopy(var3, 4, var4, 0, var4.length);
+ } finally {
+ this.a[var1].getWriteLock().unlock();
+ }
+
+ return var4;
+ }
+
+ public String getDeviceName() {
+ return "Modern Robotics USB Legacy Module";
+ }
+
+ public byte[] getI2cReadCache(int var1) {
+ this.a(var1);
+ return this.a[var1].getReadBuffer();
+ }
+
+ public Lock getI2cReadCacheLock(int var1) {
+ this.a(var1);
+ return this.a[var1].getReadLock();
+ }
+
+ public byte[] getI2cWriteCache(int var1) {
+ this.a(var1);
+ return this.a[var1].getWriteBuffer();
+ }
+
+ public Lock getI2cWriteCacheLock(int var1) {
+ this.a(var1);
+ return this.a[var1].getWriteLock();
+ }
+
+ public boolean isI2cPortActionFlagSet(int var1) {
+ this.a(var1);
+ boolean var6 = false;
+
+ byte var3;
+ try {
+ var6 = true;
+ this.a[var1].getReadLock().lock();
+ var3 = this.a[var1].getReadBuffer()[31];
+ var6 = false;
+ } finally {
+ if(var6) {
+ this.a[var1].getReadLock().unlock();
+ }
+ }
+
+ boolean var4;
+ var4 = var3 == -1;
+
+ this.a[var1].getReadLock().unlock();
+ return var4;
+ }
+
+ public boolean isI2cPortInReadMode(int var1) {
+ this.a(var1);
+ boolean var6 = false;
+
+ byte var3;
+ try {
+ var6 = true;
+ this.a[var1].getReadLock().lock();
+ var3 = this.a[var1].getReadBuffer()[0];
+ var6 = false;
+ } finally {
+ if(var6) {
+ this.a[var1].getReadLock().unlock();
+ }
+ }
+
+ boolean var4 = false;
+ if(var3 == -127) {
+ var4 = true;
+ }
+
+ this.a[var1].getReadLock().unlock();
+ return var4;
+ }
+
+ public boolean isI2cPortInWriteMode(int var1) {
+ byte var2 = 1;
+ this.a(var1);
+ boolean var6 = false;
+
+ byte var4;
+ try {
+ var6 = true;
+ this.a[var1].getReadLock().lock();
+ var4 = this.a[var1].getReadBuffer()[0];
+ var6 = false;
+ } finally {
+ if(var6) {
+ this.a[var1].getReadLock().unlock();
+ }
+ }
+
+ if(var4 != var2) {
+ var2 = 0;
+ }
+
+ this.a[var1].getReadLock().unlock();
+ return var2 != 0;
+ }
+
+ public boolean isI2cPortReady(int var1) {
+ return this.a(var1, this.read(3));
+ }
+
+ public byte[] readAnalog(int var1) {
+ this.a(var1);
+ return this.read(ADDRESS_ANALOG_PORT_MAP[var1], 2);
+ }
+
+ public void readComplete() throws InterruptedException {
+ if(this.b != null) {
+ byte var1 = this.read(3);
+
+ for(int var2 = 0; var2 < 6; ++var2) {
+ if(this.b[var2] != null && this.a(var2, var1)) {
+ this.b[var2].portIsReady(var2);
+ }
+ }
+ }
+
+ }
+
+ public void readI2cCacheFromController(int var1) {
+ this.a(var1);
+ this.readWriteRunnable.queueSegmentRead(var1);
+ }
+
+ @Deprecated
+ public void readI2cCacheFromModule(int var1) {
+ this.readI2cCacheFromController(var1);
+ }
+
+ public void registerForI2cPortReadyCallback(I2cController.I2cPortReadyCallback var1, int var2) {
+ this.b[var2] = var1;
+ }
+
+ public void setData(int var1, byte[] var2, int var3) {
+ this.a(var1);
+ this.b(var3);
+
+ try {
+ this.a[var1].getWriteLock().lock();
+ byte[] var5 = this.a[var1].getWriteBuffer();
+ System.arraycopy(var2, 0, var5, 4, var3);
+ var5[3] = (byte)var3;
+ } finally {
+ this.a[var1].getWriteLock().unlock();
+ }
+
+ }
+
+ public void setDigitalLine(int param1, int param2, boolean param3) {
+ // $FF: Couldn't be decompiled
+ }
+
+ public void setI2cPortActionFlag(int var1) {
+ this.a(var1);
+
+ try {
+ this.a[var1].getWriteLock().lock();
+ this.a[var1].getWriteBuffer()[31] = -1;
+ } finally {
+ this.a[var1].getWriteLock().unlock();
+ }
+
+ }
+
+ public void setReadMode(int var1, int var2, int var3, int var4) {
+ this.a(var1);
+
+ try {
+ this.a[var1].getWriteLock().lock();
+ byte[] var6 = this.a[var1].getWriteBuffer();
+ var6[0] = -127;
+ var6[1] = (byte)var2;
+ var6[2] = (byte)var3;
+ var6[3] = (byte)var4;
+ } finally {
+ this.a[var1].getWriteLock().unlock();
+ }
+
+ }
+
+ public void setWriteMode(int var1, int var2, int var3) {
+ this.a(var1);
+
+ try {
+ this.a[var1].getWriteLock().lock();
+ byte[] var5 = this.a[var1].getWriteBuffer();
+ var5[0] = 1;
+ var5[1] = (byte)var2;
+ var5[2] = (byte)var3;
+ } finally {
+ this.a[var1].getWriteLock().unlock();
+ }
+
+ }
+
+ public void writeI2cCacheToController(int var1) {
+ this.a(var1);
+ this.readWriteRunnable.queueSegmentWrite(var1);
+ }
+
+ @Deprecated
+ public void writeI2cCacheToModule(int var1) {
+ this.writeI2cCacheToController(var1);
+ }
+
+ public void writeI2cPortFlagOnlyToController(int var1) {
+ this.a(var1);
+ ReadWriteRunnableSegment var2 = this.a[var1];
+ ReadWriteRunnableSegment var3 = this.a[var1 + 6];
+
+ try {
+ var2.getWriteLock().lock();
+ var3.getWriteLock().lock();
+ var3.getWriteBuffer()[0] = var2.getWriteBuffer()[31];
+ } finally {
+ var2.getWriteLock().unlock();
+ var3.getWriteLock().unlock();
+ }
+
+ this.readWriteRunnable.queueSegmentWrite(var1 + 6);
+ }
+
+ @Deprecated
+ public void writeI2cPortFlagOnlyToModule(int var1) {
+ this.writeI2cPortFlagOnlyToController(var1);
+ }
+}
diff --git a/FtcRobotController/app/src/main/java/com/qualcomm/hardware/ModernRoboticsUsbServoController.java b/FtcRobotController/Hardware/src/main/java/com/qualcomm/hardware/ModernRoboticsUsbServoController.java
similarity index 93%
rename from FtcRobotController/app/src/main/java/com/qualcomm/hardware/ModernRoboticsUsbServoController.java
rename to FtcRobotController/Hardware/src/main/java/com/qualcomm/hardware/ModernRoboticsUsbServoController.java
index 2ce6522..3bbbe36 100644
--- a/FtcRobotController/app/src/main/java/com/qualcomm/hardware/ModernRoboticsUsbServoController.java
+++ b/FtcRobotController/Hardware/src/main/java/com/qualcomm/hardware/ModernRoboticsUsbServoController.java
@@ -1,80 +1,78 @@
-package com.qualcomm.hardware;
-
-import com.qualcomm.hardware.ModernRoboticsUsbDevice;
-import com.qualcomm.hardware.ReadWriteRunnableBlocking;
-import com.qualcomm.robotcore.eventloop.EventLoopManager;
-import com.qualcomm.robotcore.exception.RobotCoreException;
-import com.qualcomm.robotcore.hardware.ServoController;
-import com.qualcomm.robotcore.hardware.usb.RobotUsbDevice;
-import com.qualcomm.robotcore.util.Range;
-import com.qualcomm.robotcore.util.SerialNumber;
-import com.qualcomm.robotcore.util.TypeConversion;
-
-public class ModernRoboticsUsbServoController extends ModernRoboticsUsbDevice implements ServoController {
- public static final int ADDRESS_CHANNEL1 = 66;
- public static final int ADDRESS_CHANNEL2 = 67;
- public static final int ADDRESS_CHANNEL3 = 68;
- public static final int ADDRESS_CHANNEL4 = 69;
- public static final int ADDRESS_CHANNEL5 = 70;
- public static final int ADDRESS_CHANNEL6 = 71;
- public static final byte[] ADDRESS_CHANNEL_MAP = new byte[]{(byte)-1, (byte)66, (byte)67, (byte)68, (byte)69, (byte)70, (byte)71};
- public static final int ADDRESS_PWM = 72;
- public static final int ADDRESS_UNUSED = -1;
- public static final boolean DEBUG_LOGGING = false;
- public static final int MAX_SERVOS = 6;
- public static final int MONITOR_LENGTH = 9;
- public static final byte PWM_DISABLE = -1;
- public static final byte PWM_ENABLE = 0;
- public static final byte PWM_ENABLE_WITHOUT_TIMEOUT = -86;
- public static final int SERVO_POSITION_MAX = 255;
- public static final byte START_ADDRESS = 64;
-
- protected ModernRoboticsUsbServoController(SerialNumber var1, RobotUsbDevice var2, EventLoopManager var3) throws RobotCoreException, InterruptedException {
- super(var1, var3, new ReadWriteRunnableBlocking(var1, var2, 9, 64, false));
- this.pwmDisable();
- }
-
- private void a(int var1) {
- if(var1 < 1 || var1 > ADDRESS_CHANNEL_MAP.length) {
- Object[] var2 = new Object[]{Integer.valueOf(var1), Integer.valueOf(6)};
- throw new IllegalArgumentException(String.format("Channel %d is invalid; valid channels are 1..%d", var2));
- }
- }
-
- public void close() {
- this.pwmDisable();
- super.close();
- }
-
- public String getConnectionInfo() {
- return "USB " + this.getSerialNumber();
- }
-
- public String getDeviceName() {
- return "Modern Robotics USB Servo Controller";
- }
-
- public ServoController.PwmStatus getPwmStatus() {
- return this.read(72, 1)[0] == -1?ServoController.PwmStatus.DISABLED:ServoController.PwmStatus.ENABLED;
- }
-
- public double getServoPosition(int var1) {
- this.a(var1);
- return TypeConversion.unsignedByteToDouble(this.read(ADDRESS_CHANNEL_MAP[var1], 1)[0]) / 255.0D;
- }
-
- public void pwmDisable() {
- this.write(72, (byte)-1);
- }
-
- public void pwmEnable() {
- this.write(72, (byte)0);
- }
-
- public void setServoPosition(int var1, double var2) {
- this.a(var1);
- Range.throwIfRangeIsInvalid(var2, 0.0D, 1.0D);
- this.write(ADDRESS_CHANNEL_MAP[var1], 255.0D * var2);
- this.pwmEnable();
- }
-}
+package com.qualcomm.hardware;
+
+import com.qualcomm.robotcore.eventloop.EventLoopManager;
+import com.qualcomm.robotcore.exception.RobotCoreException;
+import com.qualcomm.robotcore.hardware.ServoController;
+import com.qualcomm.robotcore.hardware.usb.RobotUsbDevice;
+import com.qualcomm.robotcore.util.Range;
+import com.qualcomm.robotcore.util.SerialNumber;
+import com.qualcomm.robotcore.util.TypeConversion;
+
+public class ModernRoboticsUsbServoController extends ModernRoboticsUsbDevice implements ServoController {
+ public static final int ADDRESS_CHANNEL1 = 66;
+ public static final int ADDRESS_CHANNEL2 = 67;
+ public static final int ADDRESS_CHANNEL3 = 68;
+ public static final int ADDRESS_CHANNEL4 = 69;
+ public static final int ADDRESS_CHANNEL5 = 70;
+ public static final int ADDRESS_CHANNEL6 = 71;
+ public static final byte[] ADDRESS_CHANNEL_MAP = new byte[]{(byte)-1, (byte)66, (byte)67, (byte)68, (byte)69, (byte)70, (byte)71};
+ public static final int ADDRESS_PWM = 72;
+ public static final int ADDRESS_UNUSED = -1;
+ public static final boolean DEBUG_LOGGING = false;
+ public static final int MAX_SERVOS = 6;
+ public static final int MONITOR_LENGTH = 9;
+ public static final byte PWM_DISABLE = -1;
+ public static final byte PWM_ENABLE = 0;
+ public static final byte PWM_ENABLE_WITHOUT_TIMEOUT = -86;
+ public static final int SERVO_POSITION_MAX = 255;
+ public static final byte START_ADDRESS = 64;
+
+ protected ModernRoboticsUsbServoController(SerialNumber var1, RobotUsbDevice var2, EventLoopManager var3) throws RobotCoreException, InterruptedException {
+ super(var1, var3, new ReadWriteRunnableBlocking(var1, var2, 9, 64, false));
+ this.pwmDisable();
+ }
+
+ private void a(int var1) {
+ if(var1 < 1 || var1 > ADDRESS_CHANNEL_MAP.length) {
+ Object[] var2 = new Object[]{Integer.valueOf(var1), Integer.valueOf(6)};
+ throw new IllegalArgumentException(String.format("Channel %d is invalid; valid channels are 1..%d", var2));
+ }
+ }
+
+ public void close() {
+ this.pwmDisable();
+ super.close();
+ }
+
+ public String getConnectionInfo() {
+ return "USB " + this.getSerialNumber();
+ }
+
+ public String getDeviceName() {
+ return "Modern Robotics USB Servo Controller";
+ }
+
+ public ServoController.PwmStatus getPwmStatus() {
+ return this.read(72, 1)[0] == -1?ServoController.PwmStatus.DISABLED:ServoController.PwmStatus.ENABLED;
+ }
+
+ public double getServoPosition(int var1) {
+ this.a(var1);
+ return TypeConversion.unsignedByteToDouble(this.read(ADDRESS_CHANNEL_MAP[var1], 1)[0]) / 255.0D;
+ }
+
+ public void pwmDisable() {
+ this.write(72, (byte)-1);
+ }
+
+ public void pwmEnable() {
+ this.write(72, (byte)0);
+ }
+
+ public void setServoPosition(int var1, double var2) {
+ this.a(var1);
+ Range.throwIfRangeIsInvalid(var2, 0.0D, 1.0D);
+ this.write(ADDRESS_CHANNEL_MAP[var1], 255.0D * var2);
+ this.pwmEnable();
+ }
+}
diff --git a/FtcRobotController/app/src/main/java/com/qualcomm/hardware/R.java b/FtcRobotController/Hardware/src/main/java/com/qualcomm/hardware/R.java
similarity index 97%
rename from FtcRobotController/app/src/main/java/com/qualcomm/hardware/R.java
rename to FtcRobotController/Hardware/src/main/java/com/qualcomm/hardware/R.java
index ad42b6c..ea15ce8 100644
--- a/FtcRobotController/app/src/main/java/com/qualcomm/hardware/R.java
+++ b/FtcRobotController/Hardware/src/main/java/com/qualcomm/hardware/R.java
@@ -1,24 +1,26 @@
-package com.qualcomm.hardware;
-
-public final class R {
- public static final class color {
- public static final int black = 2131230720;
- public static final int bright_red = 2131230722;
- public static final int bright_red_text = 2131230723;
- public static final int dark_red_background = 2131230724;
- public static final int light_red_background = 2131230726;
- public static final int medium_red_background = 2131230727;
- public static final int transparent_color = 2131230728;
- public static final int very_bright_red = 2131230729;
- public static final int white = 2131230730;
- }
-
- public static final class string {
- public static final int app_name = 2131296265;
- }
-
- public static final class style {
- public static final int AppBaseTheme = 2131099648;
- public static final int AppTheme = 2131099649;
- }
-}
+package com.qualcomm.hardware;
+
+/*
+public final class R {
+ public static final class color {
+ public static final int black = 2131230720;
+ public static final int bright_red = 2131230722;
+ public static final int bright_red_text = 2131230723;
+ public static final int dark_red_background = 2131230724;
+ public static final int light_red_background = 2131230726;
+ public static final int medium_red_background = 2131230727;
+ public static final int transparent_color = 2131230728;
+ public static final int very_bright_red = 2131230729;
+ public static final int white = 2131230730;
+ }
+
+ public static final class string {
+ public static final int app_name = 2131296265;
+ }
+
+ public static final class style {
+ public static final int AppBaseTheme = 2131099648;
+ public static final int AppTheme = 2131099649;
+ }
+}
+*/
diff --git a/FtcRobotController/app/src/main/java/com/qualcomm/hardware/ReadWriteRunnable.java b/FtcRobotController/Hardware/src/main/java/com/qualcomm/hardware/ReadWriteRunnable.java
similarity index 92%
rename from FtcRobotController/app/src/main/java/com/qualcomm/hardware/ReadWriteRunnable.java
rename to FtcRobotController/Hardware/src/main/java/com/qualcomm/hardware/ReadWriteRunnable.java
index 95298fe..d444a68 100644
--- a/FtcRobotController/app/src/main/java/com/qualcomm/hardware/ReadWriteRunnable.java
+++ b/FtcRobotController/Hardware/src/main/java/com/qualcomm/hardware/ReadWriteRunnable.java
@@ -1,48 +1,47 @@
-package com.qualcomm.hardware;
-
-import com.qualcomm.hardware.ReadWriteRunnableSegment;
-import com.qualcomm.robotcore.eventloop.SyncdDevice;
-import com.qualcomm.robotcore.exception.RobotCoreException;
-
-interface ReadWriteRunnable extends SyncdDevice, Runnable {
- void blockUntilReady() throws RobotCoreException, InterruptedException;
-
- void close();
-
- ReadWriteRunnableSegment createSegment(int var1, int var2, int var3);
-
- void queueSegmentRead(int var1);
-
- void queueSegmentWrite(int var1);
-
- byte[] read(int var1, int var2);
-
- byte[] readFromWriteCache(int var1, int var2);
-
- void setCallback(ReadWriteRunnable.Callback var1);
-
- void write(int var1, byte[] var2);
-
- public static enum BlockingState {
- BLOCKING,
- WAITING;
-
- static {
- ReadWriteRunnable.BlockingState[] var0 = new ReadWriteRunnable.BlockingState[]{BLOCKING, WAITING};
- }
- }
-
- public interface Callback {
- void readComplete() throws InterruptedException;
-
- void writeComplete() throws InterruptedException;
- }
-
- public static class EmptyCallback implements ReadWriteRunnable.Callback {
- public void readComplete() throws InterruptedException {
- }
-
- public void writeComplete() throws InterruptedException {
- }
- }
-}
+package com.qualcomm.hardware;
+
+import com.qualcomm.robotcore.eventloop.SyncdDevice;
+import com.qualcomm.robotcore.exception.RobotCoreException;
+
+interface ReadWriteRunnable extends SyncdDevice, Runnable {
+ void blockUntilReady() throws RobotCoreException, InterruptedException;
+
+ void close();
+
+ ReadWriteRunnableSegment createSegment(int var1, int var2, int var3);
+
+ void queueSegmentRead(int var1);
+
+ void queueSegmentWrite(int var1);
+
+ byte[] read(int var1, int var2);
+
+ byte[] readFromWriteCache(int var1, int var2);
+
+ void setCallback(ReadWriteRunnable.Callback var1);
+
+ void write(int var1, byte[] var2);
+
+ public static enum BlockingState {
+ BLOCKING,
+ WAITING;
+
+ static {
+ ReadWriteRunnable.BlockingState[] var0 = new ReadWriteRunnable.BlockingState[]{BLOCKING, WAITING};
+ }
+ }
+
+ public interface Callback {
+ void readComplete() throws InterruptedException;
+
+ void writeComplete() throws InterruptedException;
+ }
+
+ public static class EmptyCallback implements ReadWriteRunnable.Callback {
+ public void readComplete() throws InterruptedException {
+ }
+
+ public void writeComplete() throws InterruptedException {
+ }
+ }
+}
diff --git a/FtcRobotController/app/src/main/java/com/qualcomm/hardware/ReadWriteRunnableBlocking.java b/FtcRobotController/Hardware/src/main/java/com/qualcomm/hardware/ReadWriteRunnableBlocking.java
similarity index 93%
rename from FtcRobotController/app/src/main/java/com/qualcomm/hardware/ReadWriteRunnableBlocking.java
rename to FtcRobotController/Hardware/src/main/java/com/qualcomm/hardware/ReadWriteRunnableBlocking.java
index 76b15ec..675f12d 100644
--- a/FtcRobotController/app/src/main/java/com/qualcomm/hardware/ReadWriteRunnableBlocking.java
+++ b/FtcRobotController/Hardware/src/main/java/com/qualcomm/hardware/ReadWriteRunnableBlocking.java
@@ -1,102 +1,103 @@
-//
-// Source code recreated from a .class file by IntelliJ IDEA
-// (powered by Fernflower decompiler)
-//
-
-package com.qualcomm.hardware;
-
-import com.qualcomm.robotcore.exception.RobotCoreException;
-import com.qualcomm.robotcore.hardware.usb.RobotUsbDevice;
-import com.qualcomm.robotcore.util.RobotLog;
-import com.qualcomm.robotcore.util.SerialNumber;
-import java.util.concurrent.TimeUnit;
-import java.util.concurrent.locks.Condition;
-import java.util.concurrent.locks.Lock;
-import java.util.concurrent.locks.ReentrantLock;
-
-public class ReadWriteRunnableBlocking extends ReadWriteRunnableStandard {
- protected final Lock blockingLock = new ReentrantLock();
- protected final Lock waitingLock = new ReentrantLock();
- protected final Condition blockingCondition;
- protected final Condition waitingCondition;
- protected BlockingState blockingState;
- private volatile boolean writeNeeded;
-
- public ReadWriteRunnableBlocking(SerialNumber serialNumber, RobotUsbDevice device, int monitorLength, int startAddress, boolean debug) {
- super(serialNumber, device, monitorLength, startAddress, debug);
- this.blockingCondition = this.blockingLock.newCondition();
- this.waitingCondition = this.waitingLock.newCondition();
- this.blockingState = BlockingState.BLOCKING;
- this.writeNeeded = false;
- }
-
- public void blockUntilReady() throws RobotCoreException, InterruptedException {
- try {
- this.blockingLock.lock();
-
- while(this.blockingState == BlockingState.BLOCKING) {
- this.blockingCondition.await(100L, TimeUnit.MILLISECONDS);
- if(this.shutdownComplete) {
- RobotLog.w("sync device block requested, but device is shut down - " + this.serialNumber);
- RobotLog.setGlobalErrorMsg("There were problems communicating with a Modern Robotics USB device for an extended period of time.");
- throw new RobotCoreException("cannot block, device is shut down");
- }
- }
- } finally {
- this.blockingLock.unlock();
- }
-
- }
-
- public void startBlockingWork() {
- try {
- this.waitingLock.lock();
- this.blockingState = BlockingState.BLOCKING;
- this.waitingCondition.signalAll();
- } finally {
- this.waitingLock.unlock();
- }
-
- }
-
- public void write(int address, byte[] data) {
- synchronized(this.localDeviceWriteCache) {
- System.arraycopy(data, 0, this.localDeviceWriteCache, address, data.length);
- this.writeNeeded = true;
- }
- }
-
- public boolean writeNeeded() {
- return this.writeNeeded;
- }
-
- public void setWriteNeeded(boolean set) {
- this.writeNeeded = set;
- }
-
- // called immediately after readComplete() callback
- protected void waitForSyncdEvents() throws RobotCoreException, InterruptedException {
- try {
- this.blockingLock.lock();
- this.blockingState = BlockingState.WAITING;
- this.blockingCondition.signalAll();
- } finally {
- this.blockingLock.unlock();
- }
-
- try {
- this.waitingLock.lock();
-
- while(this.blockingState == BlockingState.WAITING) {
- this.waitingCondition.await();
- if(this.shutdownComplete) {
- RobotLog.w("wait for sync\'d events requested, but device is shut down - " + this.serialNumber);
- throw new RobotCoreException("cannot block, device is shut down");
- }
- }
- } finally {
- this.waitingLock.unlock();
- }
-
- }
-}
+//
+// Source code recreated from Type1 .class file by IntelliJ IDEA
+// (powered by Fernflower decompiler)
+//
+
+package com.qualcomm.hardware;
+
+import com.qualcomm.robotcore.exception.RobotCoreException;
+import com.qualcomm.robotcore.hardware.usb.RobotUsbDevice;
+import com.qualcomm.robotcore.util.RobotLog;
+import com.qualcomm.robotcore.util.SerialNumber;
+
+import java.util.concurrent.TimeUnit;
+import java.util.concurrent.locks.Condition;
+import java.util.concurrent.locks.Lock;
+import java.util.concurrent.locks.ReentrantLock;
+
+public class ReadWriteRunnableBlocking extends ReadWriteRunnableStandard {
+ protected final Lock blockingLock = new ReentrantLock();
+ protected final Lock waitingLock = new ReentrantLock();
+ protected final Condition blockingCondition;
+ protected final Condition waitingCondition;
+ protected BlockingState blockingState;
+ private volatile boolean writeNeeded;
+
+ public ReadWriteRunnableBlocking(SerialNumber serialNumber, RobotUsbDevice device, int monitorLength, int startAddress, boolean debug) {
+ super(serialNumber, device, monitorLength, startAddress, debug);
+ this.blockingCondition = this.blockingLock.newCondition();
+ this.waitingCondition = this.waitingLock.newCondition();
+ this.blockingState = BlockingState.BLOCKING;
+ this.writeNeeded = false;
+ }
+
+ public void blockUntilReady() throws RobotCoreException, InterruptedException {
+ try {
+ this.blockingLock.lock();
+
+ while(this.blockingState == BlockingState.BLOCKING) {
+ this.blockingCondition.await(100L, TimeUnit.MILLISECONDS);
+ if(this.shutdownComplete) {
+ RobotLog.w("sync device block requested, but device is shut down - " + this.serialNumber);
+ RobotLog.setGlobalErrorMsg("There were problems communicating with Type1 Modern Robotics USB device for an extended period of time.");
+ throw new RobotCoreException("cannot block, device is shut down");
+ }
+ }
+ } finally {
+ this.blockingLock.unlock();
+ }
+
+ }
+
+ public void startBlockingWork() {
+ try {
+ this.waitingLock.lock();
+ this.blockingState = BlockingState.BLOCKING;
+ this.waitingCondition.signalAll();
+ } finally {
+ this.waitingLock.unlock();
+ }
+
+ }
+
+ public void write(int address, byte[] data) {
+ synchronized(this.localDeviceWriteCache) {
+ System.arraycopy(data, 0, this.localDeviceWriteCache, address, data.length);
+ this.writeNeeded = true;
+ }
+ }
+
+ public boolean writeNeeded() {
+ return this.writeNeeded;
+ }
+
+ public void setWriteNeeded(boolean set) {
+ this.writeNeeded = set;
+ }
+
+ // called immediately after readComplete() callback
+ protected void waitForSyncdEvents() throws RobotCoreException, InterruptedException {
+ try {
+ this.blockingLock.lock();
+ this.blockingState = BlockingState.WAITING;
+ this.blockingCondition.signalAll();
+ } finally {
+ this.blockingLock.unlock();
+ }
+
+ try {
+ this.waitingLock.lock();
+
+ while(this.blockingState == BlockingState.WAITING) {
+ this.waitingCondition.await();
+ if(this.shutdownComplete) {
+ RobotLog.w("wait for sync\'d events requested, but device is shut down - " + this.serialNumber);
+ throw new RobotCoreException("cannot block, device is shut down");
+ }
+ }
+ } finally {
+ this.waitingLock.unlock();
+ }
+
+ }
+}
diff --git a/FtcRobotController/app/src/main/java/com/qualcomm/hardware/ReadWriteRunnableSegment.java b/FtcRobotController/Hardware/src/main/java/com/qualcomm/hardware/ReadWriteRunnableSegment.java
similarity index 95%
rename from FtcRobotController/app/src/main/java/com/qualcomm/hardware/ReadWriteRunnableSegment.java
rename to FtcRobotController/Hardware/src/main/java/com/qualcomm/hardware/ReadWriteRunnableSegment.java
index 6427f18..0a63582 100644
--- a/FtcRobotController/app/src/main/java/com/qualcomm/hardware/ReadWriteRunnableSegment.java
+++ b/FtcRobotController/Hardware/src/main/java/com/qualcomm/hardware/ReadWriteRunnableSegment.java
@@ -1,49 +1,49 @@
-package com.qualcomm.hardware;
-
-import java.util.concurrent.locks.Lock;
-import java.util.concurrent.locks.ReentrantLock;
-
-public class ReadWriteRunnableSegment {
- final Lock a;
- final Lock b;
- private int c;
- private final byte[] d;
- private final byte[] e;
-
- public ReadWriteRunnableSegment(int var1, int var2) {
- this.c = var1;
- this.a = new ReentrantLock();
- this.d = new byte[var2];
- this.b = new ReentrantLock();
- this.e = new byte[var2];
- }
-
- public int getAddress() {
- return this.c;
- }
-
- public byte[] getReadBuffer() {
- return this.d;
- }
-
- public Lock getReadLock() {
- return this.a;
- }
-
- public byte[] getWriteBuffer() {
- return this.e;
- }
-
- public Lock getWriteLock() {
- return this.b;
- }
-
- public void setAddress(int var1) {
- this.c = var1;
- }
-
- public String toString() {
- Object[] var1 = new Object[]{Integer.valueOf(this.c), Integer.valueOf(this.d.length), Integer.valueOf(this.e.length)};
- return String.format("Segment - address:%d read:%d write:%d", var1);
- }
-}
+package com.qualcomm.hardware;
+
+import java.util.concurrent.locks.Lock;
+import java.util.concurrent.locks.ReentrantLock;
+
+public class ReadWriteRunnableSegment {
+ final Lock a;
+ final Lock b;
+ private int c;
+ private final byte[] d;
+ private final byte[] e;
+
+ public ReadWriteRunnableSegment(int var1, int var2) {
+ this.c = var1;
+ this.a = new ReentrantLock();
+ this.d = new byte[var2];
+ this.b = new ReentrantLock();
+ this.e = new byte[var2];
+ }
+
+ public int getAddress() {
+ return this.c;
+ }
+
+ public byte[] getReadBuffer() {
+ return this.d;
+ }
+
+ public Lock getReadLock() {
+ return this.a;
+ }
+
+ public byte[] getWriteBuffer() {
+ return this.e;
+ }
+
+ public Lock getWriteLock() {
+ return this.b;
+ }
+
+ public void setAddress(int var1) {
+ this.c = var1;
+ }
+
+ public String toString() {
+ Object[] var1 = new Object[]{Integer.valueOf(this.c), Integer.valueOf(this.d.length), Integer.valueOf(this.e.length)};
+ return String.format("Segment - address:%d read:%d write:%d", var1);
+ }
+}
diff --git a/FtcRobotController/app/src/main/java/com/qualcomm/hardware/ReadWriteRunnableStandard.java b/FtcRobotController/Hardware/src/main/java/com/qualcomm/hardware/ReadWriteRunnableStandard.java
similarity index 87%
rename from FtcRobotController/app/src/main/java/com/qualcomm/hardware/ReadWriteRunnableStandard.java
rename to FtcRobotController/Hardware/src/main/java/com/qualcomm/hardware/ReadWriteRunnableStandard.java
index 77f15be..5c3c581 100644
--- a/FtcRobotController/app/src/main/java/com/qualcomm/hardware/ReadWriteRunnableStandard.java
+++ b/FtcRobotController/Hardware/src/main/java/com/qualcomm/hardware/ReadWriteRunnableStandard.java
@@ -1,259 +1,258 @@
-//
-// Source code recreated from a .class file by IntelliJ IDEA
-// (powered by Fernflower decompiler)
-//
-
-package com.qualcomm.hardware;
-
-import com.qualcomm.modernrobotics.ReadWriteRunnableUsbHandler;
-import com.qualcomm.robotcore.exception.RobotCoreException;
-import com.qualcomm.robotcore.hardware.usb.RobotUsbDevice;
-import com.qualcomm.robotcore.hardware.usb.RobotUsbDevice.Channel;
-import com.qualcomm.robotcore.util.ElapsedTime;
-import com.qualcomm.robotcore.util.RobotLog;
-import com.qualcomm.robotcore.util.SerialNumber;
-import com.qualcomm.robotcore.util.TypeConversion;
-import java.util.Arrays;
-import java.util.HashMap;
-import java.util.Map;
-import java.util.concurrent.ConcurrentLinkedQueue;
-
-public class ReadWriteRunnableStandard implements ReadWriteRunnable {
- protected final byte[] localDeviceReadCache = new byte[256];
- protected final byte[] localDeviceWriteCache = new byte[256];
- protected Map segments = new HashMap();
- protected ConcurrentLinkedQueue segmentReadQueue = new ConcurrentLinkedQueue();
- protected ConcurrentLinkedQueue segmentWriteQueue = new ConcurrentLinkedQueue();
- protected final SerialNumber serialNumber;
- protected final ReadWriteRunnableUsbHandler usbHandler;
- protected int startAddress;
- protected int monitorLength;
- protected volatile boolean running = false;
- protected volatile boolean shutdownComplete = false;
- private volatile boolean writeNeeded = false;
- protected Callback callback;
- protected final boolean DEBUG_LOGGING;
-
- public ReadWriteRunnableStandard(SerialNumber serialNumber, RobotUsbDevice device, int monitorLength, int startAddress, boolean debug) {
- this.serialNumber = serialNumber;
- this.startAddress = startAddress;
- this.monitorLength = monitorLength;
- this.DEBUG_LOGGING = debug;
- this.callback = new EmptyCallback();
- this.usbHandler = new ReadWriteRunnableUsbHandler(device);
- }
-
- public void setCallback(Callback callback) {
- this.callback = callback;
- }
-
- public void blockUntilReady() throws RobotCoreException, InterruptedException {
- if(this.shutdownComplete) {
- RobotLog.w("sync device block requested, but device is shut down - " + this.serialNumber);
- RobotLog.setGlobalErrorMsg("There were problems communicating with a Modern Robotics USB device for an extended period of time.");
- throw new RobotCoreException("cannot block, device is shut down");
- }
- }
-
- public void startBlockingWork() {
- }
-
- public boolean writeNeeded() {
- return this.writeNeeded;
- }
-
- public void setWriteNeeded(boolean set) {
- this.writeNeeded = set;
- }
-
- public void write(int address, byte[] data) {
- synchronized(this.localDeviceWriteCache) {
- System.arraycopy(data, 0, this.localDeviceWriteCache, address, data.length);
- this.writeNeeded = true;
- }
- }
-
- public byte[] readFromWriteCache(int address, int size) {
- byte[] var3 = this.localDeviceWriteCache;
- synchronized(this.localDeviceWriteCache) {
- return Arrays.copyOfRange(this.localDeviceWriteCache, address, address + size);
- }
- }
-
- public byte[] read(int address, int size) {
- byte[] var3 = this.localDeviceReadCache;
- synchronized(this.localDeviceReadCache) {
- return Arrays.copyOfRange(this.localDeviceReadCache, address, address + size);
- }
- }
-
- public void close() {
- try {
- this.blockUntilReady();
- this.startBlockingWork();
- } catch (InterruptedException var6) {
- ;
- } catch (RobotCoreException var7) {
- ;
- } finally {
- this.running = false;
-
- while(!this.shutdownComplete) {
- Thread.yield();
- }
-
- this.usbHandler.close();
- }
-
- }
-
- public ReadWriteRunnableSegment createSegment(int key, int address, int size) {
- ReadWriteRunnableSegment var4 = new ReadWriteRunnableSegment(address, size);
- this.segments.put(Integer.valueOf(key), var4);
- return var4;
- }
-
- public void destroySegment(int key) {
- this.segments.remove(Integer.valueOf(key));
- }
-
- public ReadWriteRunnableSegment getSegment(int key) {
- return (ReadWriteRunnableSegment)this.segments.get(Integer.valueOf(key));
- }
-
- public void queueSegmentRead(int key) {
- this.queueIfNotAlreadyQueued(key, this.segmentReadQueue);
- }
-
- public void queueSegmentWrite(int key) {
- this.queueIfNotAlreadyQueued(key, this.segmentWriteQueue);
- }
-
- public void run() {
- boolean var1 = true;
- int var2 = 0;
- byte[] var3 = new byte[this.monitorLength + this.startAddress];
- ElapsedTime var4 = new ElapsedTime();
- String var5 = "Device " + this.serialNumber.toString();
- this.running = true;
- RobotLog.v(String.format("starting read/write loop for device %s", new Object[]{this.serialNumber}));
-
- try {
- this.usbHandler.purge(Channel.RX);
-
- while(this.running) {
- if(this.DEBUG_LOGGING) {
- var4.log(var5);
- var4.reset();
- }
-
- ReadWriteRunnableSegment var6;
- byte[] var7;
- try {
- this.usbHandler.read(var2, var3);
-
- while(!this.segmentReadQueue.isEmpty()) {
- var6 = (ReadWriteRunnableSegment)this.segments.get(this.segmentReadQueue.remove());
- var7 = new byte[var6.getReadBuffer().length];
- this.usbHandler.read(var6.getAddress(), var7);
-
- try {
- var6.getReadLock().lock();
- System.arraycopy(var7, 0, var6.getReadBuffer(), 0, var6.getReadBuffer().length);
- } finally {
- var6.getReadLock().unlock();
- }
- }
- } catch (RobotCoreException var34) {
- RobotLog.w(String.format("could not read from device %s: %s", new Object[]{this.serialNumber, var34.getMessage()}));
- }
-
- byte[] var39 = this.localDeviceReadCache;
- synchronized(this.localDeviceReadCache) {
- System.arraycopy(var3, 0, this.localDeviceReadCache, var2, var3.length);
- }
-
- if(this.DEBUG_LOGGING) {
- this.dumpBuffers("read", this.localDeviceReadCache);
- }
-
- this.callback.readComplete();
- this.waitForSyncdEvents();
- if(var1) {
- var2 = this.startAddress;
- var3 = new byte[this.monitorLength];
- var1 = false;
- }
-
- var39 = this.localDeviceWriteCache;
- synchronized(this.localDeviceWriteCache) {
- System.arraycopy(this.localDeviceWriteCache, var2, var3, 0, var3.length);
- }
-
- try {
- if(this.writeNeeded()) {
- this.usbHandler.write(var2, var3);
- this.setWriteNeeded(false);
- }
-
- for(; !this.segmentWriteQueue.isEmpty(); this.usbHandler.write(var6.getAddress(), var7)) {
- var6 = (ReadWriteRunnableSegment)this.segments.get(this.segmentWriteQueue.remove());
-
- try {
- var6.getWriteLock().lock();
- var7 = Arrays.copyOf(var6.getWriteBuffer(), var6.getWriteBuffer().length);
- } finally {
- var6.getWriteLock().unlock();
- }
- }
- } catch (RobotCoreException var35) {
- RobotLog.w(String.format("could not write to device %s: %s", new Object[]{this.serialNumber, var35.getMessage()}));
- }
-
- if(this.DEBUG_LOGGING) {
- this.dumpBuffers("write", this.localDeviceWriteCache);
- }
-
- this.callback.writeComplete();
- this.usbHandler.throwIfUsbErrorCountIsTooHigh();
- }
- } catch (NullPointerException var36) {
- RobotLog.w(String.format("could not write to device %s: FTDI Null Pointer Exception", new Object[]{this.serialNumber}));
- RobotLog.logStacktrace(var36);
- RobotLog.setGlobalErrorMsg("There was a problem communicating with a Modern Robotics USB device");
- } catch (InterruptedException var37) {
- RobotLog.w(String.format("could not write to device %s: Interrupted Exception", new Object[]{this.serialNumber}));
- } catch (RobotCoreException var38) {
- RobotLog.w(var38.getMessage());
- RobotLog.setGlobalErrorMsg(String.format("There was a problem communicating with a Modern Robotics USB device %s", new Object[]{this.serialNumber}));
- }
-
- RobotLog.v(String.format("stopped read/write loop for device %s", new Object[]{this.serialNumber}));
- this.running = false;
- this.shutdownComplete = true;
- }
-
- protected void waitForSyncdEvents() throws RobotCoreException, InterruptedException {
- }
-
- protected void dumpBuffers(String name, byte[] byteArray) {
- RobotLog.v("Dumping " + name + " buffers for " + this.serialNumber);
- StringBuilder var3 = new StringBuilder(1024);
-
- for(int var4 = 0; var4 < this.startAddress + this.monitorLength; ++var4) {
- var3.append(String.format(" %02x", new Object[]{Integer.valueOf(TypeConversion.unsignedByteToInt(byteArray[var4]))}));
- if((var4 + 1) % 16 == 0) {
- var3.append("\n");
- }
- }
-
- RobotLog.v(var3.toString());
- }
-
- protected void queueIfNotAlreadyQueued(int key, ConcurrentLinkedQueue queue) {
- if(!queue.contains(Integer.valueOf(key))) {
- queue.add(Integer.valueOf(key));
- }
-
- }
-}
+//
+// Source code recreated from Type1 .class file by IntelliJ IDEA
+// (powered by Fernflower decompiler)
+//
+
+package com.qualcomm.hardware;
+
+import com.qualcomm.modernrobotics.ReadWriteRunnableUsbHandler;
+import com.qualcomm.robotcore.exception.RobotCoreException;
+import com.qualcomm.robotcore.hardware.usb.RobotUsbDevice;
+import com.qualcomm.robotcore.hardware.usb.RobotUsbDevice.Channel;
+import com.qualcomm.robotcore.util.ElapsedTime;
+import com.qualcomm.robotcore.util.RobotLog;
+import com.qualcomm.robotcore.util.SerialNumber;
+import com.qualcomm.robotcore.util.TypeConversion;
+
+import java.util.Arrays;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.concurrent.ConcurrentLinkedQueue;
+
+public class ReadWriteRunnableStandard implements ReadWriteRunnable {
+ protected final byte[] localDeviceReadCache = new byte[256];
+ protected final byte[] localDeviceWriteCache = new byte[256];
+ protected final SerialNumber serialNumber;
+ protected final ReadWriteRunnableUsbHandler usbHandler;
+ protected final boolean DEBUG_LOGGING;
+ protected Map segments = new HashMap();
+ protected ConcurrentLinkedQueue segmentReadQueue = new ConcurrentLinkedQueue();
+ protected ConcurrentLinkedQueue segmentWriteQueue = new ConcurrentLinkedQueue();
+ protected int startAddress;
+ protected int monitorLength;
+ protected volatile boolean running = false;
+ protected volatile boolean shutdownComplete = false;
+ protected Callback callback;
+ private volatile boolean writeNeeded = false;
+
+ public ReadWriteRunnableStandard(SerialNumber serialNumber, RobotUsbDevice device, int monitorLength, int startAddress, boolean debug) {
+ this.serialNumber = serialNumber;
+ this.startAddress = startAddress;
+ this.monitorLength = monitorLength;
+ this.DEBUG_LOGGING = debug;
+ this.callback = new EmptyCallback();
+ this.usbHandler = new ReadWriteRunnableUsbHandler(device);
+ }
+
+ public void setCallback(Callback callback) {
+ this.callback = callback;
+ }
+
+ public void blockUntilReady() throws RobotCoreException, InterruptedException {
+ if(this.shutdownComplete) {
+ RobotLog.w("sync device block requested, but device is shut down - " + this.serialNumber);
+ RobotLog.setGlobalErrorMsg("There were problems communicating with Type1 Modern Robotics USB device for an extended period of time.");
+ throw new RobotCoreException("cannot block, device is shut down");
+ }
+ }
+
+ public void startBlockingWork() {
+ }
+
+ public boolean writeNeeded() {
+ return this.writeNeeded;
+ }
+
+ public void setWriteNeeded(boolean set) {
+ this.writeNeeded = set;
+ }
+
+ public void write(int address, byte[] data) {
+ synchronized(this.localDeviceWriteCache) {
+ System.arraycopy(data, 0, this.localDeviceWriteCache, address, data.length);
+ this.writeNeeded = true;
+ }
+ }
+
+ public byte[] readFromWriteCache(int address, int size) {
+ byte[] var3 = this.localDeviceWriteCache;
+ synchronized(this.localDeviceWriteCache) {
+ return Arrays.copyOfRange(this.localDeviceWriteCache, address, address + size);
+ }
+ }
+
+ public byte[] read(int address, int size) {
+ byte[] var3 = this.localDeviceReadCache;
+ synchronized(this.localDeviceReadCache) {
+ return Arrays.copyOfRange(this.localDeviceReadCache, address, address + size);
+ }
+ }
+
+ public void close() {
+ try {
+ this.blockUntilReady();
+ this.startBlockingWork();
+ } catch (InterruptedException var6) {
+ } catch (RobotCoreException var7) {
+ } finally {
+ this.running = false;
+
+ while(!this.shutdownComplete) {
+ Thread.yield();
+ }
+
+ this.usbHandler.close();
+ }
+
+ }
+
+ public ReadWriteRunnableSegment createSegment(int key, int address, int size) {
+ ReadWriteRunnableSegment var4 = new ReadWriteRunnableSegment(address, size);
+ this.segments.put(Integer.valueOf(key), var4);
+ return var4;
+ }
+
+ public void destroySegment(int key) {
+ this.segments.remove(Integer.valueOf(key));
+ }
+
+ public ReadWriteRunnableSegment getSegment(int key) {
+ return this.segments.get(Integer.valueOf(key));
+ }
+
+ public void queueSegmentRead(int key) {
+ this.queueIfNotAlreadyQueued(key, this.segmentReadQueue);
+ }
+
+ public void queueSegmentWrite(int key) {
+ this.queueIfNotAlreadyQueued(key, this.segmentWriteQueue);
+ }
+
+ public void run() {
+ boolean var1 = true;
+ int var2 = 0;
+ byte[] var3 = new byte[this.monitorLength + this.startAddress];
+ ElapsedTime var4 = new ElapsedTime();
+ String var5 = "Device " + this.serialNumber.toString();
+ this.running = true;
+ RobotLog.v(String.format("starting read/write loop for device %s", this.serialNumber));
+
+ try {
+ this.usbHandler.purge(Channel.RX);
+
+ while(this.running) {
+ if(this.DEBUG_LOGGING) {
+ var4.log(var5);
+ var4.reset();
+ }
+
+ ReadWriteRunnableSegment var6;
+ byte[] var7;
+ try {
+ this.usbHandler.read(var2, var3);
+
+ while(!this.segmentReadQueue.isEmpty()) {
+ var6 = this.segments.get(this.segmentReadQueue.remove());
+ var7 = new byte[var6.getReadBuffer().length];
+ this.usbHandler.read(var6.getAddress(), var7);
+
+ try {
+ var6.getReadLock().lock();
+ System.arraycopy(var7, 0, var6.getReadBuffer(), 0, var6.getReadBuffer().length);
+ } finally {
+ var6.getReadLock().unlock();
+ }
+ }
+ } catch (RobotCoreException var34) {
+ RobotLog.w(String.format("could not read from device %s: %s", this.serialNumber, var34.getMessage()));
+ }
+
+ byte[] var39 = this.localDeviceReadCache;
+ synchronized(this.localDeviceReadCache) {
+ System.arraycopy(var3, 0, this.localDeviceReadCache, var2, var3.length);
+ }
+
+ if(this.DEBUG_LOGGING) {
+ this.dumpBuffers("read", this.localDeviceReadCache);
+ }
+
+ this.callback.readComplete();
+ this.waitForSyncdEvents();
+ if(var1) {
+ var2 = this.startAddress;
+ var3 = new byte[this.monitorLength];
+ var1 = false;
+ }
+
+ var39 = this.localDeviceWriteCache;
+ synchronized(this.localDeviceWriteCache) {
+ System.arraycopy(this.localDeviceWriteCache, var2, var3, 0, var3.length);
+ }
+
+ try {
+ if(this.writeNeeded()) {
+ this.usbHandler.write(var2, var3);
+ this.setWriteNeeded(false);
+ }
+
+ for(; !this.segmentWriteQueue.isEmpty(); this.usbHandler.write(var6.getAddress(), var7)) {
+ var6 = this.segments.get(this.segmentWriteQueue.remove());
+
+ try {
+ var6.getWriteLock().lock();
+ var7 = Arrays.copyOf(var6.getWriteBuffer(), var6.getWriteBuffer().length);
+ } finally {
+ var6.getWriteLock().unlock();
+ }
+ }
+ } catch (RobotCoreException var35) {
+ RobotLog.w(String.format("could not write to device %s: %s", this.serialNumber, var35.getMessage()));
+ }
+
+ if(this.DEBUG_LOGGING) {
+ this.dumpBuffers("write", this.localDeviceWriteCache);
+ }
+
+ this.callback.writeComplete();
+ this.usbHandler.throwIfUsbErrorCountIsTooHigh();
+ }
+ } catch (NullPointerException var36) {
+ RobotLog.w(String.format("could not write to device %s: FTDI Null Pointer Exception", this.serialNumber));
+ RobotLog.logStacktrace(var36);
+ RobotLog.setGlobalErrorMsg("There was Type1 problem communicating with Type1 Modern Robotics USB device");
+ } catch (InterruptedException var37) {
+ RobotLog.w(String.format("could not write to device %s: Interrupted Exception", this.serialNumber));
+ } catch (RobotCoreException var38) {
+ RobotLog.w(var38.getMessage());
+ RobotLog.setGlobalErrorMsg(String.format("There was Type1 problem communicating with Type1 Modern Robotics USB device %s", this.serialNumber));
+ }
+
+ RobotLog.v(String.format("stopped read/write loop for device %s", this.serialNumber));
+ this.running = false;
+ this.shutdownComplete = true;
+ }
+
+ protected void waitForSyncdEvents() throws RobotCoreException, InterruptedException {
+ }
+
+ protected void dumpBuffers(String name, byte[] byteArray) {
+ RobotLog.v("Dumping " + name + " buffers for " + this.serialNumber);
+ StringBuilder var3 = new StringBuilder(1024);
+
+ for(int var4 = 0; var4 < this.startAddress + this.monitorLength; ++var4) {
+ var3.append(String.format(" %02x", new Object[]{Integer.valueOf(TypeConversion.unsignedByteToInt(byteArray[var4]))}));
+ if((var4 + 1) % 16 == 0) {
+ var3.append("\n");
+ }
+ }
+
+ RobotLog.v(var3.toString());
+ }
+
+ protected void queueIfNotAlreadyQueued(int key, ConcurrentLinkedQueue queue) {
+ if(!queue.contains(Integer.valueOf(key))) {
+ queue.add(Integer.valueOf(key));
+ }
+
+ }
+}
diff --git a/FtcRobotController/Hardware/src/main/res/values/strings.xml b/FtcRobotController/Hardware/src/main/res/values/strings.xml
new file mode 100644
index 0000000..df7d090
--- /dev/null
+++ b/FtcRobotController/Hardware/src/main/res/values/strings.xml
@@ -0,0 +1,3 @@
+
+ Hardware
+
diff --git a/FtcRobotController/Hardware/src/test/java/com/qualcomm/hardware/ExampleUnitTest.java b/FtcRobotController/Hardware/src/test/java/com/qualcomm/hardware/ExampleUnitTest.java
new file mode 100644
index 0000000..23556c5
--- /dev/null
+++ b/FtcRobotController/Hardware/src/test/java/com/qualcomm/hardware/ExampleUnitTest.java
@@ -0,0 +1,15 @@
+package com.qualcomm.hardware;
+
+import org.junit.Test;
+
+import static org.junit.Assert.*;
+
+/**
+ * To work on unit tests, switch the Test Artifact in the Build Variants view.
+ */
+public class ExampleUnitTest {
+ @Test
+ public void addition_isCorrect() throws Exception {
+ assertEquals(4, 2 + 2);
+ }
+}
\ No newline at end of file
diff --git a/FtcRobotController/ModernRobotics/.gitignore b/FtcRobotController/ModernRobotics/.gitignore
new file mode 100644
index 0000000..796b96d
--- /dev/null
+++ b/FtcRobotController/ModernRobotics/.gitignore
@@ -0,0 +1 @@
+/build
diff --git a/FtcRobotController/ModernRobotics/ModernRobotics.iml b/FtcRobotController/ModernRobotics/ModernRobotics.iml
new file mode 100644
index 0000000..56a4706
--- /dev/null
+++ b/FtcRobotController/ModernRobotics/ModernRobotics.iml
@@ -0,0 +1,95 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ generateDebugAndroidTestSources
+ generateDebugSources
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/FtcRobotController/ModernRobotics/build.gradle b/FtcRobotController/ModernRobotics/build.gradle
new file mode 100644
index 0000000..00f0196
--- /dev/null
+++ b/FtcRobotController/ModernRobotics/build.gradle
@@ -0,0 +1,31 @@
+apply plugin: 'com.android.library'
+
+android {
+ compileSdkVersion 22
+ buildToolsVersion '22.0.1'
+
+ defaultConfig {
+ minSdkVersion 19
+ targetSdkVersion 23
+ versionCode 1
+ versionName "1.0"
+ }
+ buildTypes {
+ release {
+ minifyEnabled false
+ proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
+ }
+ }
+ compileOptions {
+ sourceCompatibility JavaVersion.VERSION_1_7
+ targetCompatibility JavaVersion.VERSION_1_7
+ }
+}
+
+dependencies {
+ compile fileTree(include: ['*.jar'], dir: 'libs')
+ testCompile 'junit:junit:4.12'
+ compile project(':robotcore')
+ compile project(':Analytics')
+ compile project(':Analytics')
+}
diff --git a/FtcRobotController/ModernRobotics/proguard-rules.pro b/FtcRobotController/ModernRobotics/proguard-rules.pro
new file mode 100644
index 0000000..db73af4
--- /dev/null
+++ b/FtcRobotController/ModernRobotics/proguard-rules.pro
@@ -0,0 +1,17 @@
+# Add project specific ProGuard rules here.
+# By default, the flags in this file are appended to flags specified
+# in C:\Users\Public\Android\sdk/tools/proguard/proguard-android.txt
+# You can edit the include path and order by changing the proguardFiles
+# directive in build.gradle.
+#
+# For more details, see
+# http://developer.android.com/guide/developing/tools/proguard.html
+
+# Add any project specific keep options here:
+
+# If your project uses WebView with JS, uncomment the following
+# and specify the fully qualified class name to the JavaScript interface
+# class:
+#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
+# public *;
+#}
diff --git a/FtcRobotController/ModernRobotics/src/androidTest/java/com/qualcomm/modernrobotics/ApplicationTest.java b/FtcRobotController/ModernRobotics/src/androidTest/java/com/qualcomm/modernrobotics/ApplicationTest.java
new file mode 100644
index 0000000..4bb530a
--- /dev/null
+++ b/FtcRobotController/ModernRobotics/src/androidTest/java/com/qualcomm/modernrobotics/ApplicationTest.java
@@ -0,0 +1,13 @@
+package com.qualcomm.modernrobotics;
+
+import android.app.Application;
+import android.test.ApplicationTestCase;
+
+/**
+ * Testing Fundamentals
+ */
+public class ApplicationTest extends ApplicationTestCase {
+ public ApplicationTest() {
+ super(Application.class);
+ }
+}
\ No newline at end of file
diff --git a/FtcRobotController/ModernRobotics/src/main/AndroidManifest.xml b/FtcRobotController/ModernRobotics/src/main/AndroidManifest.xml
new file mode 100644
index 0000000..cfdcdb3
--- /dev/null
+++ b/FtcRobotController/ModernRobotics/src/main/AndroidManifest.xml
@@ -0,0 +1,9 @@
+
+
+
+
+
+
+
diff --git a/FtcRobotController/app/src/main/java/com/qualcomm/modernrobotics/ModernRoboticsPacket.java b/FtcRobotController/ModernRobotics/src/main/java/com/qualcomm/modernrobotics/ModernRoboticsPacket.java
similarity index 96%
rename from FtcRobotController/app/src/main/java/com/qualcomm/modernrobotics/ModernRoboticsPacket.java
rename to FtcRobotController/ModernRobotics/src/main/java/com/qualcomm/modernrobotics/ModernRoboticsPacket.java
index f8c8cc4..b77000d 100644
--- a/FtcRobotController/app/src/main/java/com/qualcomm/modernrobotics/ModernRoboticsPacket.java
+++ b/FtcRobotController/ModernRobotics/src/main/java/com/qualcomm/modernrobotics/ModernRoboticsPacket.java
@@ -1,27 +1,27 @@
-package com.qualcomm.modernrobotics;
-
-import com.qualcomm.robotcore.util.RobotLog;
-import com.qualcomm.robotcore.util.TypeConversion;
-
-public class ModernRoboticsPacket {
- static boolean a(byte[] var0, int var1) {
- return b(var0, var1);
- }
-
- private static boolean b(byte[] var0, int var1) {
- if(var0.length < 5) {
- RobotLog.w("header length is too short");
- return false;
- } else if(var0[0] == 51 && var0[1] == -52) {
- if(TypeConversion.unsignedByteToInt(var0[4]) != var1) {
- RobotLog.w("header reported unexpected packet size");
- return false;
- } else {
- return true;
- }
- } else {
- RobotLog.w("header sync bytes are incorrect");
- return false;
- }
- }
-}
+package com.qualcomm.modernrobotics;
+
+import com.qualcomm.robotcore.util.RobotLog;
+import com.qualcomm.robotcore.util.TypeConversion;
+
+public class ModernRoboticsPacket {
+ static boolean a(byte[] var0, int var1) {
+ return b(var0, var1);
+ }
+
+ private static boolean b(byte[] var0, int var1) {
+ if(var0.length < 5) {
+ RobotLog.w("header length is too short");
+ return false;
+ } else if(var0[0] == 51 && var0[1] == -52) {
+ if(TypeConversion.unsignedByteToInt(var0[4]) != var1) {
+ RobotLog.w("header reported unexpected packet size");
+ return false;
+ } else {
+ return true;
+ }
+ } else {
+ RobotLog.w("header sync bytes are incorrect");
+ return false;
+ }
+ }
+}
diff --git a/FtcRobotController/app/src/main/java/com/qualcomm/modernrobotics/ModernRoboticsUsbUtil.java b/FtcRobotController/ModernRobotics/src/main/java/com/qualcomm/modernrobotics/ModernRoboticsUsbUtil.java
similarity index 97%
rename from FtcRobotController/app/src/main/java/com/qualcomm/modernrobotics/ModernRoboticsUsbUtil.java
rename to FtcRobotController/ModernRobotics/src/main/java/com/qualcomm/modernrobotics/ModernRoboticsUsbUtil.java
index 55ad7e3..089052c 100644
--- a/FtcRobotController/app/src/main/java/com/qualcomm/modernrobotics/ModernRoboticsUsbUtil.java
+++ b/FtcRobotController/ModernRobotics/src/main/java/com/qualcomm/modernrobotics/ModernRoboticsUsbUtil.java
@@ -1,129 +1,130 @@
-package com.qualcomm.modernrobotics;
-
-import android.content.Context;
-import com.qualcomm.analytics.Analytics;
-import com.qualcomm.robotcore.exception.RobotCoreException;
-import com.qualcomm.robotcore.hardware.DeviceManager;
-import com.qualcomm.robotcore.hardware.HardwareMap;
-import com.qualcomm.robotcore.hardware.usb.RobotUsbDevice;
-import com.qualcomm.robotcore.hardware.usb.RobotUsbManager;
-import com.qualcomm.robotcore.util.SerialNumber;
-
-public class ModernRoboticsUsbUtil {
- public static final int DEVICE_ID_DC_MOTOR_CONTROLLER = 77;
- public static final int DEVICE_ID_DEVICE_INTERFACE_MODULE = 65;
- public static final int DEVICE_ID_LEGACY_MODULE = 73;
- public static final int DEVICE_ID_SERVO_CONTROLLER = 83;
- public static final int MFG_CODE_MODERN_ROBOTICS = 77;
- private static Analytics a;
-
- private static DeviceManager.DeviceType a(byte[] var0) {
- if(var0[1] != 77) {
- return DeviceManager.DeviceType.FTDI_USB_UNKNOWN_DEVICE;
- } else {
- switch(var0[2]) {
- case 65:
- return DeviceManager.DeviceType.MODERN_ROBOTICS_USB_DEVICE_INTERFACE_MODULE;
- case 73:
- return DeviceManager.DeviceType.MODERN_ROBOTICS_USB_LEGACY_MODULE;
- case 77:
- return DeviceManager.DeviceType.MODERN_ROBOTICS_USB_DC_MOTOR_CONTROLLER;
- case 83:
- return DeviceManager.DeviceType.MODERN_ROBOTICS_USB_SERVO_CONTROLLER;
- default:
- return DeviceManager.DeviceType.MODERN_ROBOTICS_USB_UNKNOWN_DEVICE;
- }
- }
- }
-
- private static RobotUsbDevice a(RobotUsbManager robotUsbManager, SerialNumber serialNumber) throws RobotCoreException {
- int numberOfDevices = robotUsbManager.scanForDevices();
- int index = 0;
-
- String deviceDescription;
- boolean found;
- while(true) {
- if(index >= numberOfDevices) {
- deviceDescription = "";
- found = false;
- break;
- }
-
- if(serialNumber.equals(robotUsbManager.getDeviceSerialNumberByIndex(index))) {
- found = true;
- deviceDescription = robotUsbManager.getDeviceDescriptionByIndex(index) + " [" + serialNumber.getSerialNumber() + "]";
- break;
- }
-
- ++index;
- }
-
- if(!found) {
- throwMessage("unable to find USB device with serial number " + serialNumber.toString());
- }
-
- RobotUsbDevice robotUsbDevice = null;
-
- try {
- robotUsbDevice = robotUsbManager.openBySerialNumber(serialNumber);
- robotUsbDevice.setBaudRate(250000);
- robotUsbDevice.setDataCharacteristics((byte) 8, (byte) 0, (byte) 0);
- robotUsbDevice.setLatencyTimer(2);
- } catch (RobotCoreException e) {
- throwMessage("Unable to open USB device " + serialNumber + " - " + deviceDescription + ": " + e.getMessage());
- }
-
- // Odd little sleep!
- try {
- Thread.sleep(400L);
- return robotUsbDevice;
- } catch (InterruptedException e) {
- return robotUsbDevice;
- }
- }
-
- private static void throwMessage(String message) throws RobotCoreException {
- System.err.println(message);
- throw new RobotCoreException(message);
- }
-
- private static byte[] a(RobotUsbDevice var0) throws RobotCoreException {
- byte[] var1 = new byte[5];
- byte[] var2 = new byte[3];
- byte[] var3 = new byte[]{(byte)85, (byte)-86, (byte)-128, (byte)0, (byte)3};
-
- try {
- var0.purge(RobotUsbDevice.Channel.RX);
- var0.write(var3);
- var0.read(var1);
- } catch (RobotCoreException var5) {
- throwMessage("error reading USB device headers");
- }
-
- if(!ModernRoboticsPacket.a(var1, 3)) {
- return var2;
- } else {
- var0.read(var2);
- return var2;
- }
- }
-
- public static DeviceManager.DeviceType getDeviceType(byte[] var0) {
- return a(var0);
- }
-
- public static byte[] getUsbDeviceHeader(RobotUsbDevice var0) throws RobotCoreException {
- return a(var0);
- }
-
- public static void init(Context var0, HardwareMap var1) {
- if(a == null) {
- a = new Analytics(var0, "update_rc", var1);
- }
-
- }
-
- public static RobotUsbDevice openUsbDevice(RobotUsbManager var0, SerialNumber var1) throws RobotCoreException {
- return a(var0, var1);
- }
-}
+package com.qualcomm.modernrobotics;
+
+import android.content.Context;
+
+import com.qualcomm.analytics.Analytics;
+import com.qualcomm.robotcore.exception.RobotCoreException;
+import com.qualcomm.robotcore.hardware.DeviceManager;
+import com.qualcomm.robotcore.hardware.HardwareMap;
+import com.qualcomm.robotcore.hardware.usb.RobotUsbDevice;
+import com.qualcomm.robotcore.hardware.usb.RobotUsbManager;
+import com.qualcomm.robotcore.util.SerialNumber;
+
+public class ModernRoboticsUsbUtil {
+ public static final int DEVICE_ID_DC_MOTOR_CONTROLLER = 77;
+ public static final int DEVICE_ID_DEVICE_INTERFACE_MODULE = 65;
+ public static final int DEVICE_ID_LEGACY_MODULE = 73;
+ public static final int DEVICE_ID_SERVO_CONTROLLER = 83;
+ public static final int MFG_CODE_MODERN_ROBOTICS = 77;
+ private static Analytics a;
+
+ private static DeviceManager.DeviceType a(byte[] var0) {
+ if(var0[1] != 77) {
+ return DeviceManager.DeviceType.FTDI_USB_UNKNOWN_DEVICE;
+ } else {
+ switch(var0[2]) {
+ case 65:
+ return DeviceManager.DeviceType.MODERN_ROBOTICS_USB_DEVICE_INTERFACE_MODULE;
+ case 73:
+ return DeviceManager.DeviceType.MODERN_ROBOTICS_USB_LEGACY_MODULE;
+ case 77:
+ return DeviceManager.DeviceType.MODERN_ROBOTICS_USB_DC_MOTOR_CONTROLLER;
+ case 83:
+ return DeviceManager.DeviceType.MODERN_ROBOTICS_USB_SERVO_CONTROLLER;
+ default:
+ return DeviceManager.DeviceType.MODERN_ROBOTICS_USB_UNKNOWN_DEVICE;
+ }
+ }
+ }
+
+ private static RobotUsbDevice a(RobotUsbManager robotUsbManager, SerialNumber serialNumber) throws RobotCoreException {
+ int numberOfDevices = robotUsbManager.scanForDevices();
+ int index = 0;
+
+ String deviceDescription;
+ boolean found;
+ while(true) {
+ if(index >= numberOfDevices) {
+ deviceDescription = "";
+ found = false;
+ break;
+ }
+
+ if(serialNumber.equals(robotUsbManager.getDeviceSerialNumberByIndex(index))) {
+ found = true;
+ deviceDescription = robotUsbManager.getDeviceDescriptionByIndex(index) + " [" + serialNumber.getSerialNumber() + "]";
+ break;
+ }
+
+ ++index;
+ }
+
+ if(!found) {
+ throwMessage("unable to find USB device with serial number " + serialNumber.toString());
+ }
+
+ RobotUsbDevice robotUsbDevice = null;
+
+ try {
+ robotUsbDevice = robotUsbManager.openBySerialNumber(serialNumber);
+ robotUsbDevice.setBaudRate(250000);
+ robotUsbDevice.setDataCharacteristics((byte) 8, (byte) 0, (byte) 0);
+ robotUsbDevice.setLatencyTimer(2);
+ } catch (RobotCoreException e) {
+ throwMessage("Unable to open USB device " + serialNumber + " - " + deviceDescription + ": " + e.getMessage());
+ }
+
+ // Odd little sleep!
+ try {
+ Thread.sleep(400L);
+ return robotUsbDevice;
+ } catch (InterruptedException e) {
+ return robotUsbDevice;
+ }
+ }
+
+ private static void throwMessage(String message) throws RobotCoreException {
+ System.err.println(message);
+ throw new RobotCoreException(message);
+ }
+
+ private static byte[] a(RobotUsbDevice var0) throws RobotCoreException {
+ byte[] var1 = new byte[5];
+ byte[] var2 = new byte[3];
+ byte[] var3 = new byte[]{(byte)85, (byte)-86, (byte)-128, (byte)0, (byte)3};
+
+ try {
+ var0.purge(RobotUsbDevice.Channel.RX);
+ var0.write(var3);
+ var0.read(var1);
+ } catch (RobotCoreException var5) {
+ throwMessage("error reading USB device headers");
+ }
+
+ if(!ModernRoboticsPacket.a(var1, 3)) {
+ return var2;
+ } else {
+ var0.read(var2);
+ return var2;
+ }
+ }
+
+ public static DeviceManager.DeviceType getDeviceType(byte[] var0) {
+ return a(var0);
+ }
+
+ public static byte[] getUsbDeviceHeader(RobotUsbDevice var0) throws RobotCoreException {
+ return a(var0);
+ }
+
+ public static void init(Context var0, HardwareMap var1) {
+ if(a == null) {
+ a = new Analytics(var0, "update_rc", var1);
+ }
+
+ }
+
+ public static RobotUsbDevice openUsbDevice(RobotUsbManager var0, SerialNumber var1) throws RobotCoreException {
+ return a(var0, var1);
+ }
+}
diff --git a/FtcRobotController/app/src/main/java/com/qualcomm/modernrobotics/R.java b/FtcRobotController/ModernRobotics/src/main/java/com/qualcomm/modernrobotics/R.java
similarity index 97%
rename from FtcRobotController/app/src/main/java/com/qualcomm/modernrobotics/R.java
rename to FtcRobotController/ModernRobotics/src/main/java/com/qualcomm/modernrobotics/R.java
index a47d3fc..9bf8036 100644
--- a/FtcRobotController/app/src/main/java/com/qualcomm/modernrobotics/R.java
+++ b/FtcRobotController/ModernRobotics/src/main/java/com/qualcomm/modernrobotics/R.java
@@ -1,24 +1,26 @@
-package com.qualcomm.modernrobotics;
-
-public final class R {
- public static final class color {
- public static final int black = 2131230720;
- public static final int bright_red = 2131230722;
- public static final int bright_red_text = 2131230723;
- public static final int dark_red_background = 2131230724;
- public static final int light_red_background = 2131230726;
- public static final int medium_red_background = 2131230727;
- public static final int transparent_color = 2131230728;
- public static final int very_bright_red = 2131230729;
- public static final int white = 2131230730;
- }
-
- public static final class string {
- public static final int app_name = 2131296265;
- }
-
- public static final class style {
- public static final int AppBaseTheme = 2131099648;
- public static final int AppTheme = 2131099649;
- }
-}
+package com.qualcomm.modernrobotics;
+
+/*
+public final class R {
+ public static final class color {
+ public static final int black = 2131230720;
+ public static final int bright_red = 2131230722;
+ public static final int bright_red_text = 2131230723;
+ public static final int dark_red_background = 2131230724;
+ public static final int light_red_background = 2131230726;
+ public static final int medium_red_background = 2131230727;
+ public static final int transparent_color = 2131230728;
+ public static final int very_bright_red = 2131230729;
+ public static final int white = 2131230730;
+ }
+
+ public static final class string {
+ public static final int app_name = 2131296265;
+ }
+
+ public static final class style {
+ public static final int AppBaseTheme = 2131099648;
+ public static final int AppTheme = 2131099649;
+ }
+}
+*/
\ No newline at end of file
diff --git a/FtcRobotController/app/src/main/java/com/qualcomm/modernrobotics/ReadWriteRunnableUsbHandler.java b/FtcRobotController/ModernRobotics/src/main/java/com/qualcomm/modernrobotics/ReadWriteRunnableUsbHandler.java
similarity index 95%
rename from FtcRobotController/app/src/main/java/com/qualcomm/modernrobotics/ReadWriteRunnableUsbHandler.java
rename to FtcRobotController/ModernRobotics/src/main/java/com/qualcomm/modernrobotics/ReadWriteRunnableUsbHandler.java
index 062d08b..0ec6123 100644
--- a/FtcRobotController/app/src/main/java/com/qualcomm/modernrobotics/ReadWriteRunnableUsbHandler.java
+++ b/FtcRobotController/ModernRobotics/src/main/java/com/qualcomm/modernrobotics/ReadWriteRunnableUsbHandler.java
@@ -1,108 +1,108 @@
-package com.qualcomm.modernrobotics;
-
-import com.qualcomm.modernrobotics.ModernRoboticsPacket;
-import com.qualcomm.robotcore.exception.RobotCoreException;
-import com.qualcomm.robotcore.hardware.usb.RobotUsbDevice;
-import com.qualcomm.robotcore.util.RobotLog;
-import com.qualcomm.robotcore.util.Util;
-import java.util.Arrays;
-
-public class ReadWriteRunnableUsbHandler {
- protected final int MAX_SEQUENTIAL_USB_ERROR_COUNT = 10;
- protected final int USB_MSG_TIMEOUT = 100;
- protected RobotUsbDevice device;
- protected byte[] readCmd = new byte[]{(byte)85, (byte)-86, (byte)-128, (byte)0, (byte)0};
- protected final byte[] respHeader = new byte[5];
- protected int usbSequentialReadErrorCount = 0;
- protected int usbSequentialWriteErrorCount = 0;
- protected byte[] writeCmd = new byte[]{(byte)85, (byte)-86, (byte)0, (byte)0, (byte)0};
-
- public ReadWriteRunnableUsbHandler(RobotUsbDevice var1) {
- this.device = var1;
- }
-
- private void a(int var1, byte[] var2) throws RobotCoreException {
- this.readCmd[3] = (byte)var1;
- this.readCmd[4] = (byte)var2.length;
- this.device.write(this.readCmd);
- Arrays.fill(this.respHeader, (byte)0);
- int var3 = this.device.read(this.respHeader, this.respHeader.length, 100);
- if(!ModernRoboticsPacket.a(this.respHeader, var2.length)) {
- ++this.usbSequentialReadErrorCount;
- if(var3 == this.respHeader.length) {
- this.a(this.readCmd, "comm error");
- } else {
- this.a(this.readCmd, "comm timeout");
- }
- }
-
- if(this.device.read(var2, var2.length, 100) != var2.length) {
- this.a(this.readCmd, "comm timeout on payload");
- }
-
- this.usbSequentialReadErrorCount = 0;
- }
-
- private void a(byte[] var1, String var2) throws RobotCoreException {
- RobotLog.w(bufferToString(var1) + " -> " + bufferToString(this.respHeader));
- this.device.purge(RobotUsbDevice.Channel.BOTH);
- throw new RobotCoreException(var2);
- }
-
- private void b(int var1, byte[] var2) throws RobotCoreException {
- this.writeCmd[3] = (byte)var1;
- this.writeCmd[4] = (byte)var2.length;
- this.device.write(Util.concatenateByteArrays(this.writeCmd, var2));
- Arrays.fill(this.respHeader, (byte)0);
- int var3 = this.device.read(this.respHeader, this.respHeader.length, 100);
- if(!ModernRoboticsPacket.a(this.respHeader, 0)) {
- ++this.usbSequentialWriteErrorCount;
- if(var3 == this.respHeader.length) {
- this.a(this.writeCmd, "comm error");
- } else {
- this.a(this.writeCmd, "comm timeout");
- }
- }
-
- this.usbSequentialWriteErrorCount = 0;
- }
-
- protected static String bufferToString(byte[] var0) {
- StringBuilder var1 = new StringBuilder();
- var1.append("[");
- if(var0.length > 0) {
- Object[] var7 = new Object[]{Byte.valueOf(var0[0])};
- var1.append(String.format("%02x", var7));
- }
-
- for(int var3 = 1; var3 < var0.length; ++var3) {
- Object[] var5 = new Object[]{Byte.valueOf(var0[var3])};
- var1.append(String.format(" %02x", var5));
- }
-
- var1.append("]");
- return var1.toString();
- }
-
- public void close() {
- this.device.close();
- }
-
- public void purge(RobotUsbDevice.Channel var1) throws RobotCoreException {
- this.device.purge(var1);
- }
-
- public void read(int var1, byte[] var2) throws RobotCoreException {
- this.a(var1, var2);
- }
-
- public void throwIfUsbErrorCountIsTooHigh() throws RobotCoreException {
- if(this.usbSequentialReadErrorCount >= 10 && this.usbSequentialWriteErrorCount >= 10) {
- throw new RobotCoreException("Too many sequential USB errors on device");
- }
- }
-
- public void write(int var1, byte[] var2) throws RobotCoreException {
- this.b(var1, var2);
- }
-}
+package com.qualcomm.modernrobotics;
+
+import com.qualcomm.robotcore.exception.RobotCoreException;
+import com.qualcomm.robotcore.hardware.usb.RobotUsbDevice;
+import com.qualcomm.robotcore.util.RobotLog;
+import com.qualcomm.robotcore.util.Util;
+
+import java.util.Arrays;
+
+public class ReadWriteRunnableUsbHandler {
+ protected final int MAX_SEQUENTIAL_USB_ERROR_COUNT = 10;
+ protected final int USB_MSG_TIMEOUT = 100;
+ protected RobotUsbDevice device;
+ protected byte[] readCmd = new byte[]{(byte)85, (byte)-86, (byte)-128, (byte)0, (byte)0};
+ protected final byte[] respHeader = new byte[5];
+ protected int usbSequentialReadErrorCount = 0;
+ protected int usbSequentialWriteErrorCount = 0;
+ protected byte[] writeCmd = new byte[]{(byte)85, (byte)-86, (byte)0, (byte)0, (byte)0};
+
+ public ReadWriteRunnableUsbHandler(RobotUsbDevice var1) {
+ this.device = var1;
+ }
+
+ private void a(int var1, byte[] var2) throws RobotCoreException {
+ this.readCmd[3] = (byte)var1;
+ this.readCmd[4] = (byte)var2.length;
+ this.device.write(this.readCmd);
+ Arrays.fill(this.respHeader, (byte)0);
+ int var3 = this.device.read(this.respHeader, this.respHeader.length, 100);
+ if(!ModernRoboticsPacket.a(this.respHeader, var2.length)) {
+ ++this.usbSequentialReadErrorCount;
+ if(var3 == this.respHeader.length) {
+ this.a(this.readCmd, "comm error");
+ } else {
+ this.a(this.readCmd, "comm timeout");
+ }
+ }
+
+ if(this.device.read(var2, var2.length, 100) != var2.length) {
+ this.a(this.readCmd, "comm timeout on payload");
+ }
+
+ this.usbSequentialReadErrorCount = 0;
+ }
+
+ private void a(byte[] var1, String var2) throws RobotCoreException {
+ RobotLog.w(bufferToString(var1) + " -> " + bufferToString(this.respHeader));
+ this.device.purge(RobotUsbDevice.Channel.BOTH);
+ throw new RobotCoreException(var2);
+ }
+
+ private void b(int var1, byte[] var2) throws RobotCoreException {
+ this.writeCmd[3] = (byte)var1;
+ this.writeCmd[4] = (byte)var2.length;
+ this.device.write(Util.concatenateByteArrays(this.writeCmd, var2));
+ Arrays.fill(this.respHeader, (byte)0);
+ int var3 = this.device.read(this.respHeader, this.respHeader.length, 100);
+ if(!ModernRoboticsPacket.a(this.respHeader, 0)) {
+ ++this.usbSequentialWriteErrorCount;
+ if(var3 == this.respHeader.length) {
+ this.a(this.writeCmd, "comm error");
+ } else {
+ this.a(this.writeCmd, "comm timeout");
+ }
+ }
+
+ this.usbSequentialWriteErrorCount = 0;
+ }
+
+ protected static String bufferToString(byte[] var0) {
+ StringBuilder var1 = new StringBuilder();
+ var1.append("[");
+ if(var0.length > 0) {
+ Object[] var7 = new Object[]{Byte.valueOf(var0[0])};
+ var1.append(String.format("%02x", var7));
+ }
+
+ for(int var3 = 1; var3 < var0.length; ++var3) {
+ Object[] var5 = new Object[]{Byte.valueOf(var0[var3])};
+ var1.append(String.format(" %02x", var5));
+ }
+
+ var1.append("]");
+ return var1.toString();
+ }
+
+ public void close() {
+ this.device.close();
+ }
+
+ public void purge(RobotUsbDevice.Channel var1) throws RobotCoreException {
+ this.device.purge(var1);
+ }
+
+ public void read(int var1, byte[] var2) throws RobotCoreException {
+ this.a(var1, var2);
+ }
+
+ public void throwIfUsbErrorCountIsTooHigh() throws RobotCoreException {
+ if(this.usbSequentialReadErrorCount >= 10 && this.usbSequentialWriteErrorCount >= 10) {
+ throw new RobotCoreException("Too many sequential USB errors on device");
+ }
+ }
+
+ public void write(int var1, byte[] var2) throws RobotCoreException {
+ this.b(var1, var2);
+ }
+}
diff --git a/FtcRobotController/app/src/main/java/com/qualcomm/modernrobotics/RobotUsbDeviceEmulator.java b/FtcRobotController/ModernRobotics/src/main/java/com/qualcomm/modernrobotics/RobotUsbDeviceEmulator.java
similarity index 96%
rename from FtcRobotController/app/src/main/java/com/qualcomm/modernrobotics/RobotUsbDeviceEmulator.java
rename to FtcRobotController/ModernRobotics/src/main/java/com/qualcomm/modernrobotics/RobotUsbDeviceEmulator.java
index 0759c82..69a6989 100644
--- a/FtcRobotController/app/src/main/java/com/qualcomm/modernrobotics/RobotUsbDeviceEmulator.java
+++ b/FtcRobotController/ModernRobotics/src/main/java/com/qualcomm/modernrobotics/RobotUsbDeviceEmulator.java
@@ -1,125 +1,126 @@
-package com.qualcomm.modernrobotics;
-
-import com.qualcomm.robotcore.exception.RobotCoreException;
-import com.qualcomm.robotcore.hardware.usb.RobotUsbDevice;
-import com.qualcomm.robotcore.util.RobotLog;
-import com.qualcomm.robotcore.util.SerialNumber;
-import java.util.Arrays;
-import java.util.concurrent.BlockingQueue;
-import java.util.concurrent.LinkedBlockingQueue;
-import java.util.concurrent.TimeUnit;
-
-public class RobotUsbDeviceEmulator implements RobotUsbDevice {
- public static final int MFG_CODE_MODERN_ROBOTICS = 77;
- public final boolean DEBUG_LOGGING;
- private byte[] a;
- private byte[] b;
- private BlockingQueue c;
- public String description;
- protected final byte[] readRsp;
- public SerialNumber serialNumber;
- protected final byte[] writeRsp;
-
- public RobotUsbDeviceEmulator(SerialNumber var1, String var2, int var3) {
- this(var1, var2, var3, false);
- }
-
- public RobotUsbDeviceEmulator(SerialNumber var1, String var2, int var3, boolean var4) {
- this.a = new byte[256];
- this.b = null;
- this.c = new LinkedBlockingQueue();
- this.writeRsp = new byte[]{(byte)51, (byte)-52, (byte)0, (byte)0, (byte)0};
- this.readRsp = new byte[]{(byte)51, (byte)-52, (byte)-128, (byte)0, (byte)0};
- this.DEBUG_LOGGING = var4;
- this.serialNumber = var1;
- this.description = var2;
- this.a[0] = -1;
- this.a[1] = 77;
- this.a[2] = (byte)var3;
- }
-
- private int a(byte[] var1, int var2, int var3) {
- byte[] var5;
- if(this.b != null) {
- var5 = Arrays.copyOf(this.b, this.b.length);
- this.b = null;
- } else {
- try {
- var5 = (byte[])this.c.poll((long)var3, TimeUnit.MILLISECONDS);
- } catch (InterruptedException var6) {
- RobotLog.w("USB mock bus interrupted during read");
- var5 = null;
- }
- }
-
- if(var5 == null) {
- RobotLog.w("USB mock bus read timeout");
- System.arraycopy(this.readRsp, 0, var1, 0, this.readRsp.length);
- var1[2] = -1;
- var1[4] = 0;
- } else {
- System.arraycopy(var5, 0, var1, 0, var2);
- }
-
- if(var5 != null && var2 < var5.length) {
- this.b = new byte[var5.length - var2];
- System.arraycopy(var5, var1.length, this.b, 0, this.b.length);
- }
-
- if(this.DEBUG_LOGGING) {
- RobotLog.d(this.serialNumber + " USB send: " + Arrays.toString(var1));
- }
-
- return var1.length;
- }
-
- private void a(final byte[] var1) {
- if(this.DEBUG_LOGGING) {
- RobotLog.d(this.serialNumber + " USB recd: " + Arrays.toString(var1));
- }
-
- (new Thread() {
- public void run() {
- // $FF: Couldn't be decompiled
- }
- }).start();
- }
-
- // $FF: synthetic method
- static byte[] a(RobotUsbDeviceEmulator var0) {
- return var0.a;
- }
-
- // $FF: synthetic method
- static BlockingQueue b(RobotUsbDeviceEmulator var0) {
- return var0.c;
- }
-
- public void close() {
- }
-
- public void purge(RobotUsbDevice.Channel var1) throws RobotCoreException {
- this.c.clear();
- }
-
- public int read(byte[] var1) throws RobotCoreException {
- return this.read(var1, var1.length, Integer.MAX_VALUE);
- }
-
- public int read(byte[] var1, int var2, int var3) throws RobotCoreException {
- return this.a(var1, var2, var3);
- }
-
- public void setBaudRate(int var1) throws RobotCoreException {
- }
-
- public void setDataCharacteristics(byte var1, byte var2, byte var3) throws RobotCoreException {
- }
-
- public void setLatencyTimer(int var1) throws RobotCoreException {
- }
-
- public void write(byte[] var1) throws RobotCoreException {
- this.a(var1);
- }
-}
+package com.qualcomm.modernrobotics;
+
+import com.qualcomm.robotcore.exception.RobotCoreException;
+import com.qualcomm.robotcore.hardware.usb.RobotUsbDevice;
+import com.qualcomm.robotcore.util.RobotLog;
+import com.qualcomm.robotcore.util.SerialNumber;
+
+import java.util.Arrays;
+import java.util.concurrent.BlockingQueue;
+import java.util.concurrent.LinkedBlockingQueue;
+import java.util.concurrent.TimeUnit;
+
+public class RobotUsbDeviceEmulator implements RobotUsbDevice {
+ public static final int MFG_CODE_MODERN_ROBOTICS = 77;
+ public final boolean DEBUG_LOGGING;
+ private byte[] a;
+ private byte[] b;
+ private BlockingQueue c;
+ public String description;
+ protected final byte[] readRsp;
+ public SerialNumber serialNumber;
+ protected final byte[] writeRsp;
+
+ public RobotUsbDeviceEmulator(SerialNumber var1, String var2, int var3) {
+ this(var1, var2, var3, false);
+ }
+
+ public RobotUsbDeviceEmulator(SerialNumber var1, String var2, int var3, boolean var4) {
+ this.a = new byte[256];
+ this.b = null;
+ this.c = new LinkedBlockingQueue();
+ this.writeRsp = new byte[]{(byte)51, (byte)-52, (byte)0, (byte)0, (byte)0};
+ this.readRsp = new byte[]{(byte)51, (byte)-52, (byte)-128, (byte)0, (byte)0};
+ this.DEBUG_LOGGING = var4;
+ this.serialNumber = var1;
+ this.description = var2;
+ this.a[0] = -1;
+ this.a[1] = 77;
+ this.a[2] = (byte)var3;
+ }
+
+ private int a(byte[] var1, int var2, int var3) {
+ byte[] var5;
+ if(this.b != null) {
+ var5 = Arrays.copyOf(this.b, this.b.length);
+ this.b = null;
+ } else {
+ try {
+ var5 = (byte[])this.c.poll((long)var3, TimeUnit.MILLISECONDS);
+ } catch (InterruptedException var6) {
+ RobotLog.w("USB mock bus interrupted during read");
+ var5 = null;
+ }
+ }
+
+ if(var5 == null) {
+ RobotLog.w("USB mock bus read timeout");
+ System.arraycopy(this.readRsp, 0, var1, 0, this.readRsp.length);
+ var1[2] = -1;
+ var1[4] = 0;
+ } else {
+ System.arraycopy(var5, 0, var1, 0, var2);
+ }
+
+ if(var5 != null && var2 < var5.length) {
+ this.b = new byte[var5.length - var2];
+ System.arraycopy(var5, var1.length, this.b, 0, this.b.length);
+ }
+
+ if(this.DEBUG_LOGGING) {
+ RobotLog.d(this.serialNumber + " USB send: " + Arrays.toString(var1));
+ }
+
+ return var1.length;
+ }
+
+ private void a(final byte[] var1) {
+ if(this.DEBUG_LOGGING) {
+ RobotLog.d(this.serialNumber + " USB recd: " + Arrays.toString(var1));
+ }
+
+ (new Thread() {
+ public void run() {
+ // $FF: Couldn't be decompiled
+ }
+ }).start();
+ }
+
+ // $FF: synthetic method
+ static byte[] a(RobotUsbDeviceEmulator var0) {
+ return var0.a;
+ }
+
+ // $FF: synthetic method
+ static BlockingQueue b(RobotUsbDeviceEmulator var0) {
+ return var0.c;
+ }
+
+ public void close() {
+ }
+
+ public void purge(RobotUsbDevice.Channel var1) throws RobotCoreException {
+ this.c.clear();
+ }
+
+ public int read(byte[] var1) throws RobotCoreException {
+ return this.read(var1, var1.length, Integer.MAX_VALUE);
+ }
+
+ public int read(byte[] var1, int var2, int var3) throws RobotCoreException {
+ return this.a(var1, var2, var3);
+ }
+
+ public void setBaudRate(int var1) throws RobotCoreException {
+ }
+
+ public void setDataCharacteristics(byte var1, byte var2, byte var3) throws RobotCoreException {
+ }
+
+ public void setLatencyTimer(int var1) throws RobotCoreException {
+ }
+
+ public void write(byte[] var1) throws RobotCoreException {
+ this.a(var1);
+ }
+}
diff --git a/FtcRobotController/app/src/main/java/com/qualcomm/modernrobotics/RobotUsbManagerEmulator.java b/FtcRobotController/ModernRobotics/src/main/java/com/qualcomm/modernrobotics/RobotUsbManagerEmulator.java
similarity index 93%
rename from FtcRobotController/app/src/main/java/com/qualcomm/modernrobotics/RobotUsbManagerEmulator.java
rename to FtcRobotController/ModernRobotics/src/main/java/com/qualcomm/modernrobotics/RobotUsbManagerEmulator.java
index e125c25..8d38443 100644
--- a/FtcRobotController/app/src/main/java/com/qualcomm/modernrobotics/RobotUsbManagerEmulator.java
+++ b/FtcRobotController/ModernRobotics/src/main/java/com/qualcomm/modernrobotics/RobotUsbManagerEmulator.java
@@ -1,42 +1,42 @@
-package com.qualcomm.modernrobotics;
-
-import com.qualcomm.modernrobotics.RobotUsbDeviceEmulator;
-import com.qualcomm.robotcore.exception.RobotCoreException;
-import com.qualcomm.robotcore.hardware.usb.RobotUsbDevice;
-import com.qualcomm.robotcore.hardware.usb.RobotUsbManager;
-import com.qualcomm.robotcore.util.RobotLog;
-import com.qualcomm.robotcore.util.SerialNumber;
-import java.util.ArrayList;
-import java.util.Iterator;
-
-public class RobotUsbManagerEmulator implements RobotUsbManager {
- private ArrayList a = new ArrayList();
-
- public String getDeviceDescriptionByIndex(int var1) throws RobotCoreException {
- return ((RobotUsbDeviceEmulator)this.a.get(var1)).description;
- }
-
- public SerialNumber getDeviceSerialNumberByIndex(int var1) throws RobotCoreException {
- return ((RobotUsbDeviceEmulator)this.a.get(var1)).serialNumber;
- }
-
- public RobotUsbDevice openBySerialNumber(SerialNumber var1) throws RobotCoreException {
- RobotLog.d("attempting to open emulated device " + var1);
- Iterator var2 = this.a.iterator();
-
- RobotUsbDeviceEmulator var3;
- do {
- if(!var2.hasNext()) {
- throw new RobotCoreException("cannot open device - could not find device with serial number " + var1);
- }
-
- var3 = (RobotUsbDeviceEmulator)var2.next();
- } while(!var3.serialNumber.equals(var1));
-
- return var3;
- }
-
- public int scanForDevices() throws RobotCoreException {
- return this.a.size();
- }
-}
+package com.qualcomm.modernrobotics;
+
+import com.qualcomm.robotcore.exception.RobotCoreException;
+import com.qualcomm.robotcore.hardware.usb.RobotUsbDevice;
+import com.qualcomm.robotcore.hardware.usb.RobotUsbManager;
+import com.qualcomm.robotcore.util.RobotLog;
+import com.qualcomm.robotcore.util.SerialNumber;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+
+public class RobotUsbManagerEmulator implements RobotUsbManager {
+ private ArrayList a = new ArrayList();
+
+ public String getDeviceDescriptionByIndex(int var1) throws RobotCoreException {
+ return ((RobotUsbDeviceEmulator)this.a.get(var1)).description;
+ }
+
+ public SerialNumber getDeviceSerialNumberByIndex(int var1) throws RobotCoreException {
+ return ((RobotUsbDeviceEmulator)this.a.get(var1)).serialNumber;
+ }
+
+ public RobotUsbDevice openBySerialNumber(SerialNumber var1) throws RobotCoreException {
+ RobotLog.d("attempting to open emulated device " + var1);
+ Iterator var2 = this.a.iterator();
+
+ RobotUsbDeviceEmulator var3;
+ do {
+ if(!var2.hasNext()) {
+ throw new RobotCoreException("cannot open device - could not find device with serial number " + var1);
+ }
+
+ var3 = (RobotUsbDeviceEmulator)var2.next();
+ } while(!var3.serialNumber.equals(var1));
+
+ return var3;
+ }
+
+ public int scanForDevices() throws RobotCoreException {
+ return this.a.size();
+ }
+}
diff --git a/FtcRobotController/ModernRobotics/src/main/res/values/strings.xml b/FtcRobotController/ModernRobotics/src/main/res/values/strings.xml
new file mode 100644
index 0000000..7192194
--- /dev/null
+++ b/FtcRobotController/ModernRobotics/src/main/res/values/strings.xml
@@ -0,0 +1,3 @@
+
+ Modern Robotics
+
diff --git a/FtcRobotController/ModernRobotics/src/test/java/com/qualcomm/modernrobotics/ExampleUnitTest.java b/FtcRobotController/ModernRobotics/src/test/java/com/qualcomm/modernrobotics/ExampleUnitTest.java
new file mode 100644
index 0000000..29367bd
--- /dev/null
+++ b/FtcRobotController/ModernRobotics/src/test/java/com/qualcomm/modernrobotics/ExampleUnitTest.java
@@ -0,0 +1,15 @@
+package com.qualcomm.modernrobotics;
+
+import org.junit.Test;
+
+import static org.junit.Assert.*;
+
+/**
+ * To work on unit tests, switch the Test Artifact in the Build Variants view.
+ */
+public class ExampleUnitTest {
+ @Test
+ public void addition_isCorrect() throws Exception {
+ assertEquals(4, 2 + 2);
+ }
+}
\ No newline at end of file
diff --git a/FtcRobotController/WirelessP2p/.gitignore b/FtcRobotController/WirelessP2p/.gitignore
new file mode 100644
index 0000000..796b96d
--- /dev/null
+++ b/FtcRobotController/WirelessP2p/.gitignore
@@ -0,0 +1 @@
+/build
diff --git a/FtcRobotController/WirelessP2p/WirelessP2p.iml b/FtcRobotController/WirelessP2p/WirelessP2p.iml
new file mode 100644
index 0000000..5349760
--- /dev/null
+++ b/FtcRobotController/WirelessP2p/WirelessP2p.iml
@@ -0,0 +1,94 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ generateDebugAndroidTestSources
+ generateDebugSources
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/FtcRobotController/WirelessP2p/build.gradle b/FtcRobotController/WirelessP2p/build.gradle
new file mode 100644
index 0000000..6899f2c
--- /dev/null
+++ b/FtcRobotController/WirelessP2p/build.gradle
@@ -0,0 +1,30 @@
+apply plugin: 'com.android.library'
+
+android {
+ compileSdkVersion 22
+ buildToolsVersion '22.0.1'
+ defaultConfig {
+ minSdkVersion 19
+ targetSdkVersion 22
+ versionCode 1
+ versionName "1.0"
+ }
+ buildTypes {
+ release {
+ minifyEnabled false
+ proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
+ }
+ }
+ productFlavors {
+ }
+ compileOptions {
+ sourceCompatibility JavaVersion.VERSION_1_7
+ targetCompatibility JavaVersion.VERSION_1_7
+ }
+}
+
+dependencies {
+ compile fileTree(include: ['*.jar'], dir: 'libs')
+ testCompile 'junit:junit:4.12'
+ compile project(':robotcore')
+}
diff --git a/FtcRobotController/WirelessP2p/proguard-rules.pro b/FtcRobotController/WirelessP2p/proguard-rules.pro
new file mode 100644
index 0000000..db73af4
--- /dev/null
+++ b/FtcRobotController/WirelessP2p/proguard-rules.pro
@@ -0,0 +1,17 @@
+# Add project specific ProGuard rules here.
+# By default, the flags in this file are appended to flags specified
+# in C:\Users\Public\Android\sdk/tools/proguard/proguard-android.txt
+# You can edit the include path and order by changing the proguardFiles
+# directive in build.gradle.
+#
+# For more details, see
+# http://developer.android.com/guide/developing/tools/proguard.html
+
+# Add any project specific keep options here:
+
+# If your project uses WebView with JS, uncomment the following
+# and specify the fully qualified class name to the JavaScript interface
+# class:
+#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
+# public *;
+#}
diff --git a/FtcRobotController/WirelessP2p/src/androidTest/java/com/qualcomm/wirelessP2p/ApplicationTest.java b/FtcRobotController/WirelessP2p/src/androidTest/java/com/qualcomm/wirelessP2p/ApplicationTest.java
new file mode 100644
index 0000000..5c5dfe5
--- /dev/null
+++ b/FtcRobotController/WirelessP2p/src/androidTest/java/com/qualcomm/wirelessP2p/ApplicationTest.java
@@ -0,0 +1,13 @@
+package com.qualcomm.wirelessP2p;
+
+import android.app.Application;
+import android.test.ApplicationTestCase;
+
+/**
+ * Testing Fundamentals
+ */
+public class ApplicationTest extends ApplicationTestCase {
+ public ApplicationTest() {
+ super(Application.class);
+ }
+}
\ No newline at end of file
diff --git a/FtcRobotController/WirelessP2p/src/main/AndroidManifest.xml b/FtcRobotController/WirelessP2p/src/main/AndroidManifest.xml
new file mode 100644
index 0000000..ef60a23
--- /dev/null
+++ b/FtcRobotController/WirelessP2p/src/main/AndroidManifest.xml
@@ -0,0 +1,12 @@
+
+
+
+
+
+
+
+
diff --git a/FtcRobotController/WirelessP2p/src/main/java/com/qualcomm/wirelessP2p/WifiDirectChannelSelection.java b/FtcRobotController/WirelessP2p/src/main/java/com/qualcomm/wirelessP2p/WifiDirectChannelSelection.java
new file mode 100644
index 0000000..f718fa6
--- /dev/null
+++ b/FtcRobotController/WirelessP2p/src/main/java/com/qualcomm/wirelessP2p/WifiDirectChannelSelection.java
@@ -0,0 +1,104 @@
+package com.qualcomm.wirelessP2p;
+
+import android.content.Context;
+import android.net.wifi.WifiManager;
+
+import com.qualcomm.robotcore.util.RobotLog;
+import com.qualcomm.robotcore.util.RunShellCommand;
+
+import java.io.File;
+import java.io.FileNotFoundException;
+import java.io.FileReader;
+import java.io.FileWriter;
+import java.io.IOException;
+
+public class WifiDirectChannelSelection {
+ public static final int INVALID = -1;
+ private final String a;
+ private final String b;
+ private final String c;
+ private final WifiManager d;
+ private final RunShellCommand e = new RunShellCommand();
+
+ public WifiDirectChannelSelection(Context var1, WifiManager var2) {
+ this.a = var1.getFilesDir().getAbsolutePath() + "/";
+ this.d = var2;
+ this.b = this.a + "get_current_wifi_direct_staus";
+ this.c = this.a + "config_wifi_direct";
+ }
+
+ private int a() throws RuntimeException {
+ String[] var1 = this.e.run("/system/bin/ps").split("\n");
+ int var2 = var1.length;
+
+ for (int var3 = 0; var3 < var2; ++var3) {
+ String var4 = var1[var3];
+ if (var4.contains("wpa_supplicant")) {
+ return Integer.parseInt(var4.split("\\s+")[1]);
+ }
+ }
+
+ throw new RuntimeException("could not find wpa_supplicant PID");
+ }
+
+ private void a(int param1, int param2) {
+ // $FF: Couldn't be decompiled
+ }
+
+ private void b() {
+ try {
+ char[] var3 = new char[4096];
+ FileReader var4 = new FileReader(this.a + "wpa_supplicant.conf");
+ int var5 = var4.read(var3);
+ var4.close();
+ String var6 = new String(var3, 0, var5);
+ RobotLog.v("WPA FILE: \n" + var6);
+ String var7 = var6.replaceAll("(?s)network\\s*=\\{.*\\}", "").replaceAll("(?m)^\\s+$", "");
+ RobotLog.v("WPA REPLACE: \n" + var7);
+ FileWriter var8 = new FileWriter(this.a + "wpa_supplicant.conf");
+ var8.write(var7);
+ var8.close();
+ } catch (FileNotFoundException var9) {
+ RobotLog.e("File not found: " + var9.toString());
+ var9.printStackTrace();
+ } catch (IOException var10) {
+ RobotLog.e("FIO exception: " + var10.toString());
+ var10.printStackTrace();
+ }
+ }
+
+ private void c() throws IOException {
+ Object[] var1 = new Object[]{this.a, this.a, this.a};
+ String var2 = String.format("cp /data/misc/wifi/wpa_supplicant.conf %s/wpa_supplicant.conf \ncp /data/misc/wifi/p2p_supplicant.conf %s/p2p_supplicant.conf \nchmod 666 %s/*supplicant* \n", var1);
+ Object[] var3 = new Object[]{this.a, this.a, this.a, Integer.valueOf(this.a())};
+ String var4 = String.format("cp %s/p2p_supplicant.conf /data/misc/wifi/p2p_supplicant.conf \ncp %s/wpa_supplicant.conf /data/misc/wifi/wpa_supplicant.conf \nrm %s/*supplicant* \nchown system.wifi /data/misc/wifi/wpa_supplicant.conf \nchown system.wifi /data/misc/wifi/p2p_supplicant.conf \nkill -HUP %d \n", var3);
+ FileWriter var5 = new FileWriter(this.b);
+ var5.write(var2);
+ var5.close();
+ FileWriter var6 = new FileWriter(this.c);
+ var6.write(var4);
+ var6.close();
+ this.e.run("chmod 700 " + this.b);
+ this.e.run("chmod 700 " + this.c);
+ }
+
+ private void d() {
+ (new File(this.b)).delete();
+ (new File(this.c)).delete();
+ }
+
+ public void config(int var1, int var2) throws IOException {
+ try {
+ this.d.setWifiEnabled(false);
+ this.c();
+ this.e.runAsRoot(this.b);
+ this.a(var1, var2);
+ this.b();
+ this.e.runAsRoot(this.c);
+ this.d.setWifiEnabled(true);
+ } finally {
+ this.d();
+ }
+
+ }
+}
diff --git a/FtcRobotController/WirelessP2p/src/main/res/values/strings.xml b/FtcRobotController/WirelessP2p/src/main/res/values/strings.xml
new file mode 100644
index 0000000..607a63e
--- /dev/null
+++ b/FtcRobotController/WirelessP2p/src/main/res/values/strings.xml
@@ -0,0 +1,3 @@
+
+ Wireless P2P
+
diff --git a/FtcRobotController/WirelessP2p/src/test/java/com/qualcomm/wirelessP2p/ExampleUnitTest.java b/FtcRobotController/WirelessP2p/src/test/java/com/qualcomm/wirelessP2p/ExampleUnitTest.java
new file mode 100644
index 0000000..38c6ff6
--- /dev/null
+++ b/FtcRobotController/WirelessP2p/src/test/java/com/qualcomm/wirelessP2p/ExampleUnitTest.java
@@ -0,0 +1,15 @@
+package com.qualcomm.wirelessP2p;
+
+import org.junit.Test;
+
+import static org.junit.Assert.*;
+
+/**
+ * To work on unit tests, switch the Test Artifact in the Build Variants view.
+ */
+public class ExampleUnitTest {
+ @Test
+ public void addition_isCorrect() throws Exception {
+ assertEquals(4, 2 + 2);
+ }
+}
\ No newline at end of file
diff --git a/FtcRobotController/app/app.iml b/FtcRobotController/app/app.iml
index 7a6e8df..d45bb7a 100644
--- a/FtcRobotController/app/app.iml
+++ b/FtcRobotController/app/app.iml
@@ -23,6 +23,7 @@
+
@@ -71,8 +72,6 @@
-
-
@@ -87,10 +86,10 @@
-
+
-
-
-
+
+
+
\ No newline at end of file
diff --git a/FtcRobotController/app/build.gradle b/FtcRobotController/app/build.gradle
index c836a0e..dcbc238 100644
--- a/FtcRobotController/app/build.gradle
+++ b/FtcRobotController/app/build.gradle
@@ -1,25 +1,63 @@
-apply plugin: 'com.android.application'
+// Top-level build file where you can add configuration options common to all sub-projects/modules.
+apply plugin: 'com.android.library'
+
android {
- compileSdkVersion 23
- buildToolsVersion "23.0.1"
+ //compileSdkVersion = 'Google Inc.:Google APIs:19'
defaultConfig {
- applicationId "com.qualcomm.ftcrobotcontroller"
minSdkVersion 19
- targetSdkVersion 23
- versionCode 1
- versionName "1.0"
+ targetSdkVersion 22
+ }
+ compileOptions {
+ sourceCompatibility JavaVersion.VERSION_1_7
+ targetCompatibility JavaVersion.VERSION_1_7
}
+ compileSdkVersion 22
+ buildToolsVersion '22.0.1'
+
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
+
+ debug {
+ minifyEnabled false
+ proguardFiles getDefaultProguardFile('proguard-android.txt'),
+ 'proguard-rules.pro'
+ }
+ }
+}
+
+buildscript {
+ repositories {
+ jcenter()
+ }
+ dependencies {
+ classpath 'com.android.tools.build:gradle:1.3.0'
+
+ // NOTE: Do not place your application dependencies here; they belong
+ // in the individual module build.gradle files
+ }
+}
+
+allprojects {
+ repositories {
+ jcenter()
}
}
+// temp dependecies
+repositories {
+ flatDir {
+ dirs 'libs'
+ }
+}
+
+
dependencies {
- compile fileTree(dir: 'libs', include: ['*.jar'])
- compile 'com.android.support:appcompat-v7:23.0.1'
+ compile project(':WirelessP2p')
+ compile project(':robotcore')
+ compile project(':FtcCommon')
}
diff --git a/FtcRobotController/app/src/main/AndroidManifest.xml b/FtcRobotController/app/src/main/AndroidManifest.xml
index dec9daf..3382623 100644
--- a/FtcRobotController/app/src/main/AndroidManifest.xml
+++ b/FtcRobotController/app/src/main/AndroidManifest.xml
@@ -1,11 +1,41 @@
+
+ package="com.qualcomm.ftccommon"
-
+ android:versionCode="3">
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/FtcRobotController/app/src/main/java/com/ftdi/j2xx/BulkInRunnable.java b/FtcRobotController/app/src/main/java/com/ftdi/j2xx/BulkInRunnable.java
deleted file mode 100644
index b89549e..0000000
--- a/FtcRobotController/app/src/main/java/com/ftdi/j2xx/BulkInRunnable.java
+++ /dev/null
@@ -1,100 +0,0 @@
-//
-// Source code recreated from a .class file by IntelliJ IDEA
-// (powered by Fernflower decompiler)
-//
-
-package com.ftdi.j2xx;
-
-import android.hardware.usb.UsbDeviceConnection;
-import android.hardware.usb.UsbEndpoint;
-import android.util.Log;
-
-import java.nio.ByteBuffer;
-import java.util.concurrent.Semaphore;
-
-class BulkInRunnable implements Runnable {
- UsbDeviceConnection usbDeviceConnection;
- UsbEndpoint usbEndpoint;
- o oDevice;
- FT_Device ftDevice;
- int bufferCount;
- int maxTransferSize;
- int readTimeout;
- Semaphore semaphore;
- boolean semaphoreAcquired;
-
- BulkInRunnable(FT_Device var1, o var2, UsbDeviceConnection var3, UsbEndpoint var4) {
- this.ftDevice = var1;
- this.usbEndpoint = var4;
- this.usbDeviceConnection = var3;
- this.oDevice = var2;
- this.bufferCount = this.oDevice.getDriverParameters().getBufferNumber();
- this.maxTransferSize = this.oDevice.getDriverParameters().getMaxTransferSize();
- this.readTimeout = this.ftDevice.d().getReadTimeout();
- this.semaphore = new Semaphore(1);
- this.semaphoreAcquired = false;
- }
-
- void acquireSemaphore() throws InterruptedException {
- this.semaphore.acquire();
- this.semaphoreAcquired = true;
- }
-
- void releaseSemaphore() {
- this.semaphoreAcquired = false;
- this.semaphore.release();
- }
-
- boolean isSemaphoreAcquired() {
- return this.semaphoreAcquired;
- }
-
- public void run() {
- ByteBuffer var1 = null;
- n var2 = null;
- int var3 = 0;
- boolean var4 = false;
- Object var5 = null;
-
- try {
- do {
- if (this.semaphoreAcquired) {
- this.semaphore.acquire();
- this.semaphore.release();
- }
-
- var2 = this.oDevice.b(var3);
- if(var2.b() == 0) {
- var1 = var2.a();
- var1.clear();
- var2.a(var3);
- byte[] var12 = var1.array();
- int var11 = this.usbDeviceConnection.bulkTransfer(this.usbEndpoint, var12, this.maxTransferSize, this.readTimeout);
- if(var11 > 0) {
- var1.position(var11);
- var1.flip();
- var2.b(var11);
- this.oDevice.e(var3);
- }
- }
-
- ++var3;
- var3 %= this.bufferCount;
- } while(!Thread.interrupted());
-
- throw new InterruptedException();
- } catch (InterruptedException var9) {
- try {
- this.oDevice.f();
- this.oDevice.e();
- } catch (Exception var8) {
- Log.d("BulkIn::", "Stop BulkIn thread");
- var8.printStackTrace();
- }
- } catch (Exception var10) {
- var10.printStackTrace();
- Log.e("BulkIn::", "Fatal error in BulkIn thread");
- }
-
- }
-}
diff --git a/FtcRobotController/app/src/main/java/com/ftdi/j2xx/D2xxManager.java b/FtcRobotController/app/src/main/java/com/ftdi/j2xx/D2xxManager.java
deleted file mode 100644
index d377727..0000000
--- a/FtcRobotController/app/src/main/java/com/ftdi/j2xx/D2xxManager.java
+++ /dev/null
@@ -1,613 +0,0 @@
-//
-// Source code recreated from a .class file by IntelliJ IDEA
-// (powered by Fernflower decompiler)
-//
-
-package com.ftdi.j2xx;
-
-import android.app.PendingIntent;
-import android.content.BroadcastReceiver;
-import android.content.Context;
-import android.content.Intent;
-import android.content.IntentFilter;
-import android.hardware.usb.UsbDevice;
-import android.hardware.usb.UsbManager;
-import android.util.Log;
-
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.List;
-
-public class D2xxManager {
- private static D2xxManager a = null;
- protected static final String ACTION_USB_PERMISSION = "com.ftdi.j2xx";
- public static final byte FT_DATA_BITS_7 = 7;
- public static final byte FT_DATA_BITS_8 = 8;
- public static final byte FT_STOP_BITS_1 = 0;
- public static final byte FT_STOP_BITS_2 = 2;
- public static final byte FT_PARITY_NONE = 0;
- public static final byte FT_PARITY_ODD = 1;
- public static final byte FT_PARITY_EVEN = 2;
- public static final byte FT_PARITY_MARK = 3;
- public static final byte FT_PARITY_SPACE = 4;
- public static final short FT_FLOW_NONE = 0;
- public static final short FT_FLOW_RTS_CTS = 256;
- public static final short FT_FLOW_DTR_DSR = 512;
- public static final short FT_FLOW_XON_XOFF = 1024;
- public static final byte FT_PURGE_RX = 1;
- public static final byte FT_PURGE_TX = 2;
- public static final byte FT_CTS = 16;
- public static final byte FT_DSR = 32;
- public static final byte FT_RI = 64;
- public static final byte FT_DCD = -128;
- public static final byte FT_OE = 2;
- public static final byte FT_PE = 4;
- public static final byte FT_FE = 8;
- public static final byte FT_BI = 16;
- public static final byte FT_EVENT_RXCHAR = 1;
- public static final byte FT_EVENT_MODEM_STATUS = 2;
- public static final byte FT_EVENT_LINE_STATUS = 4;
- public static final byte FT_EVENT_REMOVED = 8;
- public static final byte FT_FLAGS_OPENED = 1;
- public static final byte FT_FLAGS_HI_SPEED = 2;
- public static final int FT_DEVICE_232B = 0;
- public static final int FT_DEVICE_8U232AM = 1;
- public static final int FT_DEVICE_UNKNOWN = 3;
- public static final int FT_DEVICE_2232 = 4;
- public static final int FT_DEVICE_232R = 5;
- public static final int FT_DEVICE_245R = 5;
- public static final int FT_DEVICE_2232H = 6;
- public static final int FT_DEVICE_4232H = 7;
- public static final int FT_DEVICE_232H = 8;
- public static final int FT_DEVICE_X_SERIES = 9;
- public static final int FT_DEVICE_4222_0 = 10;
- public static final int FT_DEVICE_4222_1_2 = 11;
- public static final int FT_DEVICE_4222_3 = 12;
- public static final byte FT_BITMODE_RESET = 0;
- public static final byte FT_BITMODE_ASYNC_BITBANG = 1;
- public static final byte FT_BITMODE_MPSSE = 2;
- public static final byte FT_BITMODE_SYNC_BITBANG = 4;
- public static final byte FT_BITMODE_MCU_HOST = 8;
- public static final byte FT_BITMODE_FAST_SERIAL = 16;
- public static final byte FT_BITMODE_CBUS_BITBANG = 32;
- public static final byte FT_BITMODE_SYNC_FIFO = 64;
- public static final int FTDI_BREAK_OFF = 0;
- public static final int FTDI_BREAK_ON = 16384;
- private static Context b = null;
- private static PendingIntent c = null;
- private static IntentFilter d = null;
- private static List e = new ArrayList(Arrays.asList(new m[]{new m(1027, 24597), new m(1027, 24596), new m(1027, 24593), new m(1027, 24592), new m(1027, 24577), new m(1027, 24582), new m(1027, 24604), new m(1027, '贈'), new m(1027, '輸'), new m(1027, '遲'), new m(1027, '醙'), new m(1027, '鉶'), new m(1027, '陼'), new m(1027, 24594), new m(2220, 4133), new m(5590, 1), new m(1027, 24599)}));
- private ArrayList f;
- private static UsbManager g;
- private BroadcastReceiver h = new BroadcastReceiver() {
- public void onReceive(Context context, Intent intent) {
- String var3 = intent.getAction();
- UsbDevice var4 = null;
- FT_Device var5 = null;
- if("android.hardware.usb.action.USB_DEVICE_DETACHED".equals(var3)) {
- var4 = (UsbDevice)intent.getParcelableExtra("device");
-
- for(var5 = D2xxManager.this.a(var4); var5 != null; var5 = D2xxManager.this.a(var4)) {
- var5.close();
- synchronized(D2xxManager.this.f) {
- D2xxManager.this.f.remove(var5);
- }
- }
- } else if("android.hardware.usb.action.USB_DEVICE_ATTACHED".equals(var3)) {
- var4 = (UsbDevice)intent.getParcelableExtra("device");
- D2xxManager.this.addUsbDevice(var4);
- }
-
- }
- };
- private static BroadcastReceiver i = new BroadcastReceiver() {
- public void onReceive(Context context, Intent intent) {
- String var3 = intent.getAction();
- if("com.ftdi.j2xx".equals(var3)) {
- synchronized(this) {
- UsbDevice var5 = (UsbDevice)intent.getParcelableExtra("device");
- if(!intent.getBooleanExtra("permission", false)) {
- Log.d("D2xx::", "permission denied for device " + var5);
- }
- }
- }
-
- }
- };
-
- private FT_Device a(UsbDevice var1) {
- FT_Device var2 = null;
- ArrayList var3 = this.f;
- synchronized(this.f) {
- int var4 = this.f.size();
-
- for(int var5 = 0; var5 < var4; ++var5) {
- FT_Device var6 = (FT_Device)this.f.get(var5);
- UsbDevice var7 = var6.getUsbDevice();
- if(var7.equals(var1)) {
- var2 = var6;
- break;
- }
- }
-
- return var2;
- }
- }
-
- public boolean isFtDevice(UsbDevice dev) {
- boolean var3 = false;
- if(b == null) {
- return var3;
- } else {
- m var2 = new m(dev.getVendorId(), dev.getProductId());
- if(e.contains(var2)) {
- var3 = true;
- }
-
- Log.v("D2xx::", var2.toString());
- return var3;
- }
- }
-
- private static synchronized boolean a(Context context) {
- boolean result = false;
- if(context == null) {
- return result;
- } else {
- if(b != context) {
- b = context;
- c = PendingIntent.getBroadcast(b.getApplicationContext(), 0, new Intent("com.ftdi.j2xx"), 134217728);
- d = new IntentFilter("com.ftdi.j2xx");
- b.getApplicationContext().registerReceiver(i, d);
- }
-
- result = true;
- return result;
- }
- }
-
- private boolean b(UsbDevice var1) {
- boolean var2 = false;
- if(!g.hasPermission(var1)) {
- g.requestPermission(var1, c);
- }
-
- if(g.hasPermission(var1)) {
- var2 = true;
- }
-
- return var2;
- }
-
- private D2xxManager(Context parentContext) throws D2xxManager.D2xxException {
- Log.v("D2xx::", "Start constructor");
- if(parentContext == null) {
- throw new D2xxManager.D2xxException("D2xx init failed: Can not find parentContext!");
- } else {
- a(parentContext);
- if(!a()) {
- throw new D2xxManager.D2xxException("D2xx init failed: Can not find UsbManager!");
- } else {
- this.f = new ArrayList();
- IntentFilter var2 = new IntentFilter();
- var2.addAction("android.hardware.usb.action.USB_DEVICE_ATTACHED");
- var2.addAction("android.hardware.usb.action.USB_DEVICE_DETACHED");
- parentContext.getApplicationContext().registerReceiver(this.h, var2);
- Log.v("D2xx::", "End constructor");
- }
- }
- }
-
- public static synchronized D2xxManager getInstance(Context parentContext) throws D2xxManager.D2xxException {
- if(a == null) {
- a = new D2xxManager(parentContext);
- }
-
- if(parentContext != null) {
- a(parentContext);
- }
-
- return a;
- }
-
- private static boolean a() {
- if(g == null && b != null) {
- g = (UsbManager)b.getApplicationContext().getSystemService("usb");
- }
-
- return g != null;
- }
-
- public boolean setVIDPID(int vendorId, int productId) {
- boolean var3 = false;
- if(vendorId != 0 && productId != 0) {
- m var4 = new m(vendorId, productId);
- if(e.contains(var4)) {
- Log.i("D2xx::", "Existing vid:" + vendorId + " pid:" + productId);
- return true;
- }
-
- if(!e.add(var4)) {
- Log.d("D2xx::", "Failed to add VID/PID combination to list.");
- } else {
- var3 = true;
- }
- } else {
- Log.d("D2xx::", "Invalid parameter to setVIDPID");
- }
-
- return var3;
- }
-
- public int[][] getVIDPID() {
- int var1 = e.size();
- int[][] var2 = new int[2][var1];
-
- for(int var3 = 0; var3 < var1; ++var3) {
- m var4 = (m)e.get(var3);
- var2[0][var3] = var4.a();
- var2[1][var3] = var4.b();
- }
-
- return var2;
- }
-
- private void b() {
- ArrayList var1 = this.f;
- synchronized(this.f) {
- int var2 = this.f.size();
-
- for(int var3 = 0; var3 < var2; ++var3) {
- this.f.remove(var3);
- }
-
- }
- }
-
- public int createDeviceInfoList(Context parentContext) {
- HashMap var2 = g.getDeviceList();
- Iterator var3 = var2.values().iterator();
- ArrayList var4 = new ArrayList();
- FT_Device var5 = null;
- byte var6 = 0;
- if(parentContext == null) {
- return var6;
- } else {
- a(parentContext);
-
- while(true) {
- UsbDevice var7;
- do {
- if(!var3.hasNext()) {
- ArrayList var14 = this.f;
- synchronized(this.f) {
- this.b();
- this.f = var4;
- int numberOfDevices = this.f.size();
- return numberOfDevices;
- }
- }
-
- var7 = (UsbDevice)var3.next();
- } while(!this.isFtDevice(var7));
-
- boolean var8 = false;
- int var15 = var7.getInterfaceCount();
-
- for(int var9 = 0; var9 < var15; ++var9) {
- if(this.b(var7)) {
- ArrayList var10 = this.f;
- synchronized(this.f) {
- var5 = this.a(var7);
- if(var5 == null) {
- var5 = new FT_Device(parentContext, g, var7, var7.getInterface(var9));
- } else {
- this.f.remove(var5);
- var5.a(parentContext);
- }
-
- var4.add(var5);
- }
- }
- }
- }
- }
- }
-
- public synchronized int getDeviceInfoList(int numDevs, D2xxManager.FtDeviceInfoListNode[] deviceList) {
- for(int var3 = 0; var3 < numDevs; ++var3) {
- deviceList[var3] = ((FT_Device)this.f.get(var3)).ftDeviceInfoListNode;
- }
-
- return this.f.size();
- }
-
- public synchronized D2xxManager.FtDeviceInfoListNode getDeviceInfoListDetail(int index) {
- return index <= this.f.size() && index >= 0?((FT_Device)this.f.get(index)).ftDeviceInfoListNode :null;
- }
-
- public static int getLibraryVersion() {
- return 537919488;
- }
-
- private boolean a(Context var1, FT_Device var2, D2xxManager.DriverParameters var3) {
- boolean var4 = false;
- if(var2 == null) {
- return var4;
- } else if(var1 == null) {
- return var4;
- } else {
- var2.a(var1);
- if(var3 != null) {
- var2.setDriverParameters(var3);
- }
-
- if(var2.a(g) && var2.isOpen()) {
- var4 = true;
- }
-
- return var4;
- }
- }
-
- public synchronized FT_Device openByUsbDevice(Context parentContext, UsbDevice dev, D2xxManager.DriverParameters params) {
- FT_Device var4 = null;
- if(this.isFtDevice(dev)) {
- var4 = this.a(dev);
- if(!this.a(parentContext, var4, params)) {
- var4 = null;
- }
- }
-
- return var4;
- }
-
- public synchronized FT_Device openByUsbDevice(Context parentContext, UsbDevice dev) {
- return this.openByUsbDevice(parentContext, dev, (D2xxManager.DriverParameters)null);
- }
-
- public synchronized FT_Device openByIndex(Context parentContext, int index, D2xxManager.DriverParameters params) {
- FT_Device var4 = null;
- if(index < 0) {
- return var4;
- } else if(parentContext == null) {
- return var4;
- } else {
- a(parentContext);
- var4 = (FT_Device)this.f.get(index);
- if(!this.a(parentContext, var4, params)) {
- var4 = null;
- }
-
- return var4;
- }
- }
-
- public synchronized FT_Device openByIndex(Context parentContext, int index) {
- return this.openByIndex(parentContext, index, (D2xxManager.DriverParameters)null);
- }
-
- // returns null if can't open
- public synchronized FT_Device openBySerialNumber(Context parentContext, String serialNumber, D2xxManager.DriverParameters params) {
- D2xxManager.FtDeviceInfoListNode infoListNode = null;
- FT_Device ftDevice = null;
- if(parentContext == null) {
- return ftDevice;
- } else {
- a(parentContext);
-
- for(int i = 0; i < this.f.size(); ++i) {
- FT_Device device = (FT_Device)this.f.get(i);
- if(device != null) {
- infoListNode = device.ftDeviceInfoListNode;
- if(infoListNode == null) {
- Log.d("D2xx::", "***devInfo cannot be null***");
- } else if(infoListNode.serialNumber.equals(serialNumber)) {
- ftDevice = device;
- break;
- }
- }
- }
-
- if(!this.a(parentContext, ftDevice, params)) {
- ftDevice = null;
- }
-
- return ftDevice;
- }
- }
-
- public synchronized FT_Device openBySerialNumber(Context parentContext, String serialNumber) {
- return this.openBySerialNumber(parentContext, serialNumber, (D2xxManager.DriverParameters)null);
- }
-
- public synchronized FT_Device openByDescription(Context parentContext, String description, D2xxManager.DriverParameters params) {
- D2xxManager.FtDeviceInfoListNode var4 = null;
- FT_Device var5 = null;
- if(parentContext == null) {
- return var5;
- } else {
- a(parentContext);
-
- for(int var7 = 0; var7 < this.f.size(); ++var7) {
- FT_Device var6 = (FT_Device)this.f.get(var7);
- if(var6 != null) {
- var4 = var6.ftDeviceInfoListNode;
- if(var4 == null) {
- Log.d("D2xx::", "***devInfo cannot be null***");
- } else if(var4.description.equals(description)) {
- var5 = var6;
- break;
- }
- }
- }
-
- if(!this.a(parentContext, var5, params)) {
- var5 = null;
- }
-
- return var5;
- }
- }
-
- public synchronized FT_Device openByDescription(Context parentContext, String description) {
- return this.openByDescription(parentContext, description, (D2xxManager.DriverParameters)null);
- }
-
- public synchronized FT_Device openByLocation(Context parentContext, int location, D2xxManager.DriverParameters params) {
- D2xxManager.FtDeviceInfoListNode var4 = null;
- FT_Device var5 = null;
- if(parentContext == null) {
- return var5;
- } else {
- a(parentContext);
-
- for(int var7 = 0; var7 < this.f.size(); ++var7) {
- FT_Device var6 = (FT_Device)this.f.get(var7);
- if(var6 != null) {
- var4 = var6.ftDeviceInfoListNode;
- if(var4 == null) {
- Log.d("D2xx::", "***devInfo cannot be null***");
- } else if(var4.location == location) {
- var5 = var6;
- break;
- }
- }
- }
-
- if(!this.a(parentContext, var5, params)) {
- var5 = null;
- }
-
- return var5;
- }
- }
-
- public synchronized FT_Device openByLocation(Context parentContext, int location) {
- return this.openByLocation(parentContext, location, (D2xxManager.DriverParameters)null);
- }
-
- public int addUsbDevice(UsbDevice dev) {
- int var3 = 0;
- if(this.isFtDevice(dev)) {
- boolean var4 = false;
- int var8 = dev.getInterfaceCount();
-
- for(int var5 = 0; var5 < var8; ++var5) {
- if(this.b(dev)) {
- ArrayList var6 = this.f;
- synchronized(this.f) {
- FT_Device var2 = this.a(dev);
- if(var2 == null) {
- var2 = new FT_Device(b, g, dev, dev.getInterface(var5));
- } else {
- var2.a(b);
- }
-
- this.f.add(var2);
- ++var3;
- }
- }
- }
- }
-
- return var3;
- }
-
- public static class D2xxException extends IOException {
- public D2xxException() {
- }
-
- public D2xxException(String ftStatusMsg) {
- super(ftStatusMsg);
- }
- }
-
- public static class DriverParameters {
- private int a = 16384;
- private int b = 16384;
- private int c = 16;
- private int d = 5000;
-
- public DriverParameters() {
- }
-
- public boolean setMaxBufferSize(int size) {
- boolean var2 = false;
- if(size >= 64 && size <= 262144) {
- this.a = size;
- var2 = true;
- } else {
- Log.e("D2xx::", "***bufferSize Out of correct range***");
- }
-
- return var2;
- }
-
- public int getMaxBufferSize() {
- return this.a;
- }
-
- public boolean setMaxTransferSize(int size) {
- boolean var2 = false;
- if(size >= 64 && size <= 262144) {
- this.b = size;
- var2 = true;
- } else {
- Log.e("D2xx::", "***maxTransferSize Out of correct range***");
- }
-
- return var2;
- }
-
- public int getMaxTransferSize() {
- return this.b;
- }
-
- public boolean setBufferNumber(int number) {
- boolean var2 = false;
- if(number >= 2 && number <= 16) {
- this.c = number;
- var2 = true;
- } else {
- Log.e("D2xx::", "***nrBuffers Out of correct range***");
- }
-
- return var2;
- }
-
- public int getBufferNumber() {
- return this.c;
- }
-
- public boolean setReadTimeout(int timeout) {
- this.d = timeout;
- return true;
- }
-
- public int getReadTimeout() {
- return this.d;
- }
- }
-
- public static class FtDeviceInfoListNode {
- public int flags;
- public short bcdDevice;
- public int type;
- public byte iSerialNumber;
- public int id;
- public int location;
- public String serialNumber;
- public String description;
- public int handle;
- public int breakOnParam;
- public short modemStatus;
- public short lineStatus;
-
- public FtDeviceInfoListNode() {
- }
- }
-}
diff --git a/FtcRobotController/app/src/main/java/com/ftdi/j2xx/FT_Device.java b/FtcRobotController/app/src/main/java/com/ftdi/j2xx/FT_Device.java
deleted file mode 100644
index cbc567c..0000000
--- a/FtcRobotController/app/src/main/java/com/ftdi/j2xx/FT_Device.java
+++ /dev/null
@@ -1,1066 +0,0 @@
-//
-// Source code recreated from a .class file by IntelliJ IDEA
-// (powered by Fernflower decompiler)
-//
-
-package com.ftdi.j2xx;
-
-import android.content.Context;
-import android.hardware.usb.UsbDevice;
-import android.hardware.usb.UsbDeviceConnection;
-import android.hardware.usb.UsbEndpoint;
-import android.hardware.usb.UsbInterface;
-import android.hardware.usb.UsbManager;
-import android.hardware.usb.UsbRequest;
-import android.util.Log;
-
-import com.ftdi.j2xx.D2xxManager.D2xxException;
-import com.ftdi.j2xx.D2xxManager.DriverParameters;
-import com.ftdi.j2xx.D2xxManager.FtDeviceInfoListNode;
-import java.io.UnsupportedEncodingException;
-import java.nio.ByteBuffer;
-import java.nio.ByteOrder;
-
-public class FT_Device {
- long a;
- Boolean b;
- UsbDevice usbDevice;
- UsbInterface usbInterface;
- UsbEndpoint e;
- UsbEndpoint f;
- private UsbRequest usbRequest;
- private UsbDeviceConnection usbDeviceConnection;
- private a m;
- private Thread n;
- private Thread o;
- FtDeviceInfoListNode ftDeviceInfoListNode;
- private o p;
- private k q;
- private byte r;
- r h;
- q i;
- private DriverParameters driverParameters;
- private int t = 0;
- Context parentContext;
- private int u;
-
- public FT_Device(Context parentContext, UsbManager usbManager, UsbDevice dev, UsbInterface itf) {
- byte[] var6 = new byte[255];
- this.parentContext = parentContext;
- this.driverParameters = new DriverParameters();
-
- try {
- this.usbDevice = dev;
- this.usbInterface = itf;
- this.e = null;
- this.f = null;
- this.u = 0;
- this.h = new r();
- this.i = new q();
- this.ftDeviceInfoListNode = new FtDeviceInfoListNode();
- this.usbRequest = new UsbRequest();
- this.a(usbManager.openDevice(this.usbDevice));
- if(this.c() == null) {
- Log.e("FTDI_Device::", "Failed to open the device!");
- throw new D2xxException("Failed to open the device!");
- } else {
- this.c().claimInterface(this.usbInterface, false);
- byte[] var5 = this.c().getRawDescriptors();
- int var7 = this.usbDevice.getDeviceId();
- this.t = this.usbInterface.getId() + 1;
- this.ftDeviceInfoListNode.location = var7 << 4 | this.t & 15;
- ByteBuffer var8 = ByteBuffer.allocate(2);
- var8.order(ByteOrder.LITTLE_ENDIAN);
- var8.put(var5[12]);
- var8.put(var5[13]);
- this.ftDeviceInfoListNode.bcdDevice = var8.getShort(0);
- this.ftDeviceInfoListNode.iSerialNumber = var5[16];
- this.ftDeviceInfoListNode.serialNumber = this.c().getSerial();
- this.ftDeviceInfoListNode.id = this.usbDevice.getVendorId() << 16 | this.usbDevice.getProductId();
- this.ftDeviceInfoListNode.breakOnParam = 8;
- this.c().controlTransfer(-128, 6, 768 | var5[15], 0, var6, 255, 0);
- this.ftDeviceInfoListNode.description = this.a(var6);
- switch(this.ftDeviceInfoListNode.bcdDevice & 65280) {
- case 512:
- if(this.ftDeviceInfoListNode.iSerialNumber == 0) {
- this.q = new f(this);
- this.ftDeviceInfoListNode.type = 0;
- } else {
- this.ftDeviceInfoListNode.type = 1;
- this.q = new e(this);
- }
- break;
- case 1024:
- this.q = new f(this);
- this.ftDeviceInfoListNode.type = 0;
- break;
- case 1280:
- this.q = new d(this);
- this.ftDeviceInfoListNode.type = 4;
- this.n();
- break;
- case 1536:
- this.q = new k(this);
- short var9 = (short)(this.q.a((short)0) & 1);
- this.q = null;
- if(var9 == 0) {
- this.ftDeviceInfoListNode.type = 5;
- this.q = new h(this);
- } else {
- this.ftDeviceInfoListNode.type = 5;
- this.q = new i(this);
- }
- break;
- case 1792:
- this.ftDeviceInfoListNode.type = 6;
- this.n();
- this.q = new c(this);
- break;
- case 2048:
- this.ftDeviceInfoListNode.type = 7;
- this.n();
- this.q = new j(this);
- break;
- case 2304:
- this.ftDeviceInfoListNode.type = 8;
- this.q = new g(this);
- break;
- case 4096:
- this.ftDeviceInfoListNode.type = 9;
- this.q = new l(this);
- break;
- case 5888:
- this.ftDeviceInfoListNode.type = 12;
- this.ftDeviceInfoListNode.flags = 2;
- break;
- case 6144:
- this.ftDeviceInfoListNode.type = 10;
- if(this.t == 1) {
- this.ftDeviceInfoListNode.flags = 2;
- } else {
- this.ftDeviceInfoListNode.flags = 0;
- }
- break;
- case 6400:
- this.ftDeviceInfoListNode.type = 11;
- if(this.t == 4) {
- int var10 = this.usbDevice.getInterface(this.t - 1).getEndpoint(0).getMaxPacketSize();
- Log.e("dev", "mInterfaceID : " + this.t + " iMaxPacketSize : " + var10);
- if(var10 == 8) {
- this.ftDeviceInfoListNode.flags = 0;
- } else {
- this.ftDeviceInfoListNode.flags = 2;
- }
- } else {
- this.ftDeviceInfoListNode.flags = 2;
- }
- break;
- default:
- this.ftDeviceInfoListNode.type = 3;
- this.q = new k(this);
- }
-
- switch(this.ftDeviceInfoListNode.bcdDevice & 65280) {
- case 5888:
- case 6144:
- case 6400:
- if(this.ftDeviceInfoListNode.serialNumber == null) {
- byte[] var13 = new byte[16];
- this.c().controlTransfer(-64, 144, 0, 27, var13, 16, 0);
- String var14 = "";
-
- for(int var11 = 0; var11 < 8; ++var11) {
- var14 = var14 + (char)var13[var11 * 2];
- }
-
- this.ftDeviceInfoListNode.serialNumber = new String(var14);
- }
- default:
- switch(this.ftDeviceInfoListNode.bcdDevice & 65280) {
- case 6144:
- case 6400:
- if(this.t == 1) {
- this.ftDeviceInfoListNode.description = this.ftDeviceInfoListNode.description + " A";
- this.ftDeviceInfoListNode.serialNumber = this.ftDeviceInfoListNode.serialNumber + "A";
- } else if(this.t == 2) {
- this.ftDeviceInfoListNode.description = this.ftDeviceInfoListNode.description + " B";
- this.ftDeviceInfoListNode.serialNumber = this.ftDeviceInfoListNode.serialNumber + "B";
- } else if(this.t == 3) {
- this.ftDeviceInfoListNode.description = this.ftDeviceInfoListNode.description + " C";
- this.ftDeviceInfoListNode.serialNumber = this.ftDeviceInfoListNode.serialNumber + "C";
- } else if(this.t == 4) {
- this.ftDeviceInfoListNode.description = this.ftDeviceInfoListNode.description + " D";
- this.ftDeviceInfoListNode.serialNumber = this.ftDeviceInfoListNode.serialNumber + "D";
- }
- default:
- this.c().releaseInterface(this.usbInterface);
- this.c().close();
- this.a((UsbDeviceConnection)null);
- this.p();
- }
- }
- }
- } catch (Exception var12) {
- if(var12.getMessage() != null) {
- Log.e("FTDI_Device::", var12.getMessage());
- }
-
- }
- }
-
- private final boolean f() {
- return this.i() || this.j() || this.b();
- }
-
- private final boolean g() {
- return this.m() || this.l() || this.k() || this.j() || this.b() || this.i() || this.h();
- }
-
- final boolean a() {
- return this.l() || this.j() || this.b();
- }
-
- private final boolean h() {
- return (this.ftDeviceInfoListNode.bcdDevice & '\uff00') == 4096;
- }
-
- private final boolean i() {
- return (this.ftDeviceInfoListNode.bcdDevice & '\uff00') == 2304;
- }
-
- final boolean b() {
- return (this.ftDeviceInfoListNode.bcdDevice & '\uff00') == 2048;
- }
-
- private final boolean j() {
- return (this.ftDeviceInfoListNode.bcdDevice & '\uff00') == 1792;
- }
-
- private final boolean k() {
- return (this.ftDeviceInfoListNode.bcdDevice & '\uff00') == 1536;
- }
-
- private final boolean l() {
- return (this.ftDeviceInfoListNode.bcdDevice & '\uff00') == 1280;
- }
-
- private final boolean m() {
- return (this.ftDeviceInfoListNode.bcdDevice & '\uff00') == 1024 || (this.ftDeviceInfoListNode.bcdDevice & '\uff00') == 512 && this.ftDeviceInfoListNode.iSerialNumber == 0;
- }
-
- private final String a(byte[] var1) throws UnsupportedEncodingException {
- return new String(var1, 2, var1[0] - 2, "UTF-16LE");
- }
-
- UsbDeviceConnection c() {
- return this.usbDeviceConnection;
- }
-
- void a(UsbDeviceConnection var1) {
- this.usbDeviceConnection = var1;
- }
-
- synchronized boolean a(Context var1) {
- boolean var2 = false;
- if(var1 != null) {
- this.parentContext = var1;
- var2 = true;
- }
-
- return var2;
- }
-
- protected void setDriverParameters(DriverParameters params) {
- this.driverParameters.setMaxBufferSize(params.getMaxBufferSize());
- this.driverParameters.setMaxTransferSize(params.getMaxTransferSize());
- this.driverParameters.setBufferNumber(params.getBufferNumber());
- this.driverParameters.setReadTimeout(params.getReadTimeout());
- }
-
- DriverParameters d() {
- return this.driverParameters;
- }
-
- public int getReadTimeout() {
- return this.driverParameters.getReadTimeout();
- }
-
- private void n() {
- if(this.t == 1) {
- this.ftDeviceInfoListNode.serialNumber = this.ftDeviceInfoListNode.serialNumber + "A";
- this.ftDeviceInfoListNode.description = this.ftDeviceInfoListNode.description + " A";
- } else if(this.t == 2) {
- this.ftDeviceInfoListNode.serialNumber = this.ftDeviceInfoListNode.serialNumber + "B";
- this.ftDeviceInfoListNode.description = this.ftDeviceInfoListNode.description + " B";
- } else if(this.t == 3) {
- this.ftDeviceInfoListNode.serialNumber = this.ftDeviceInfoListNode.serialNumber + "C";
- this.ftDeviceInfoListNode.description = this.ftDeviceInfoListNode.description + " C";
- } else if(this.t == 4) {
- this.ftDeviceInfoListNode.serialNumber = this.ftDeviceInfoListNode.serialNumber + "D";
- this.ftDeviceInfoListNode.description = this.ftDeviceInfoListNode.description + " D";
- }
-
- }
-
- synchronized boolean a(UsbManager var1) {
- boolean var2 = false;
- if(this.isOpen()) {
- return var2;
- } else if(var1 == null) {
- Log.e("FTDI_Device::", "UsbManager cannot be null.");
- return var2;
- } else if(this.c() != null) {
- Log.e("FTDI_Device::", "There should not have an UsbConnection.");
- return var2;
- } else {
- this.a(var1.openDevice(this.usbDevice));
- if(this.c() == null) {
- Log.e("FTDI_Device::", "UsbConnection cannot be null.");
- return var2;
- } else if(!this.c().claimInterface(this.usbInterface, true)) {
- Log.e("FTDI_Device::", "ClaimInteface returned false.");
- return var2;
- } else {
- Log.d("FTDI_Device::", "open SUCCESS");
- if(!this.q()) {
- Log.e("FTDI_Device::", "Failed to find endpoints.");
- return var2;
- } else {
- this.usbRequest.initialize(this.usbDeviceConnection, this.e);
- Log.d("D2XX::", "**********************Device Opened**********************");
- this.p = new o(this);
- this.m = new a(this, this.p, this.c(), this.f);
- this.o = new Thread(this.m);
- this.o.setName("bulkInThread");
- this.n = new Thread(new p(this.p));
- this.n.setName("processRequestThread");
- this.a(true, true);
- this.o.start();
- this.n.start();
- this.o();
- var2 = true;
- return var2;
- }
- }
- }
- }
-
- public synchronized boolean isOpen() {
- return this.b.booleanValue();
- }
-
- private synchronized void o() {
- this.b = Boolean.valueOf(true);
- this.ftDeviceInfoListNode.flags |= 1;
- }
-
- private synchronized void p() {
- this.b = Boolean.valueOf(false);
- this.ftDeviceInfoListNode.flags &= 2;
- }
-
- public synchronized void close() {
- if(this.n != null) {
- this.n.interrupt();
- }
-
- if(this.o != null) {
- this.o.interrupt();
- }
-
- if(this.usbDeviceConnection != null) {
- this.usbDeviceConnection.releaseInterface(this.usbInterface);
- this.usbDeviceConnection.close();
- this.usbDeviceConnection = null;
- }
-
- if(this.p != null) {
- this.p.g();
- }
-
- this.n = null;
- this.o = null;
- this.m = null;
- this.p = null;
- this.p();
- }
-
- protected UsbDevice getUsbDevice() {
- return this.usbDevice;
- }
-
- public FtDeviceInfoListNode getDeviceInfo() {
- return this.ftDeviceInfoListNode;
- }
-
- public int read(byte[] data, int length, long wait_ms) {
- boolean var5 = false;
- if(!this.isOpen()) {
- return -1;
- } else if(length <= 0) {
- return -2;
- } else if(this.p == null) {
- return -3;
- } else {
- int var6 = this.p.a(data, length, wait_ms);
- return var6;
- }
- }
-
- public int read(byte[] data, int length) {
- return this.read(data, length, (long) this.driverParameters.getReadTimeout());
- }
-
- public int read(byte[] data) {
- return this.read(data, data.length, (long) this.driverParameters.getReadTimeout());
- }
-
- public int write(byte[] data, int length) {
- return this.write(data, length, true);
- }
-
- public int write(byte[] data, int length, boolean wait) {
- int var6 = -1;
- if(!this.isOpen()) {
- return var6;
- } else if(length < 0) {
- return var6;
- } else {
- UsbRequest var4 = this.usbRequest;
- if(wait) {
- var4.setClientData(this);
- }
-
- if(length == 0) {
- byte[] var7 = new byte[1];
- if(var4.queue(ByteBuffer.wrap(var7), length)) {
- var6 = length;
- }
- } else if(var4.queue(ByteBuffer.wrap(data), length)) {
- var6 = length;
- }
-
- Object var5;
- if(wait) {
- do {
- var4 = this.usbDeviceConnection.requestWait();
- if(var4 == null) {
- Log.e("FTDI_Device::", "UsbConnection.requestWait() == null");
- return -99;
- }
-
- var5 = var4.getClientData();
- } while(var5 != this);
- }
-
- return var6;
- }
- }
-
- public int write(byte[] data) {
- return this.write(data, data.length, true);
- }
-
- public short getModemStatus() {
- if(!this.isOpen()) {
- return (short)-1;
- } else if(this.p == null) {
- return (short)-2;
- } else {
- this.a &= -3L;
- return (short)(this.ftDeviceInfoListNode.modemStatus & 255);
- }
- }
-
- public short getLineStatus() {
- return !this.isOpen()?-1:(this.p == null?-2:this.ftDeviceInfoListNode.lineStatus);
- }
-
- public int getQueueStatus() {
- return !this.isOpen()?-1:(this.p == null?-2:this.p.c());
- }
-
- public boolean readBufferFull() {
- return this.p.a();
- }
-
- public long getEventStatus() {
- if(!this.isOpen()) {
- return -1L;
- } else if(this.p == null) {
- return -2L;
- } else {
- long var1 = this.a;
- this.a = 0L;
- return var1;
- }
- }
-
- public boolean setBaudRate(int baudRate) {
- byte var2 = 1;
- int[] var3 = new int[2];
- boolean var4 = false;
- boolean var5 = false;
- if(!this.isOpen()) {
- return var5;
- } else {
- switch(baudRate) {
- case 300:
- var3[0] = 10000;
- break;
- case 600:
- var3[0] = 5000;
- break;
- case 1200:
- var3[0] = 2500;
- break;
- case 2400:
- var3[0] = 1250;
- break;
- case 4800:
- var3[0] = 625;
- break;
- case 9600:
- var3[0] = 16696;
- break;
- case 19200:
- var3[0] = '肜';
- break;
- case 38400:
- var3[0] = '쁎';
- break;
- case 57600:
- var3[0] = 52;
- break;
- case 115200:
- var3[0] = 26;
- break;
- case 230400:
- var3[0] = 13;
- break;
- case 460800:
- var3[0] = 16390;
- break;
- case 921600:
- var3[0] = '考';
- break;
- default:
- if(this.f() && baudRate >= 1200) {
- var2 = b.a(baudRate, var3);
- } else {
- var2 = b.a(baudRate, var3, this.g());
- }
-
- var4 = true;
- }
-
- if(this.a() || this.i() || this.h()) {
- var3[1] <<= 8;
- var3[1] &= '\uff00';
- var3[1] |= this.t;
- }
-
- if(var2 == 1) {
- int var6 = this.c().controlTransfer(64, 3, var3[0], var3[1], (byte[])null, 0, 0);
- if(var6 == 0) {
- var5 = true;
- }
- }
-
- return var5;
- }
- }
-
- public boolean setDataCharacteristics(byte dataBits, byte stopBits, byte parity) {
- boolean var4 = false;
- boolean var5 = false;
- boolean var6 = false;
- if(!this.isOpen()) {
- return var6;
- } else {
- short var7 = (short)(dataBits | parity << 8);
- var7 = (short)(var7 | stopBits << 11);
- this.ftDeviceInfoListNode.breakOnParam = var7;
- int var8 = this.c().controlTransfer(64, 4, var7, this.t, (byte[])null, 0, 0);
- if(var8 == 0) {
- var6 = true;
- }
-
- return var6;
- }
- }
-
- public boolean setBreakOn() {
- return this.a(16384);
- }
-
- public boolean setBreakOff() {
- return this.a(0);
- }
-
- private boolean a(int var1) {
- boolean var2 = false;
- int var4 = this.ftDeviceInfoListNode.breakOnParam;
- var4 |= var1;
- if(!this.isOpen()) {
- return var2;
- } else {
- int var3 = this.c().controlTransfer(64, 4, var4, this.t, (byte[])null, 0, 0);
- if(var3 == 0) {
- var2 = true;
- }
-
- return var2;
- }
- }
-
- public boolean setFlowControl(short flowControl, byte xon, byte xoff) {
- boolean var4 = false;
- boolean var5 = false;
- short var6 = 0;
- if(!this.isOpen()) {
- return var4;
- } else {
- if(flowControl == 1024) {
- var6 = (short)(xoff << 8);
- var6 = (short)(var6 | xon & 255);
- }
-
- int var8 = this.c().controlTransfer(64, 2, var6, this.t | flowControl, (byte[])null, 0, 0);
- if(var8 == 0) {
- var4 = true;
- if(flowControl == 256) {
- var4 = this.setRts();
- } else if(flowControl == 512) {
- var4 = this.setDtr();
- }
- }
-
- return var4;
- }
- }
-
- public boolean setRts() {
- boolean var1 = false;
- short var3 = 514;
- if(!this.isOpen()) {
- return var1;
- } else {
- int var2 = this.c().controlTransfer(64, 1, var3, this.t, (byte[])null, 0, 0);
- if(var2 == 0) {
- var1 = true;
- }
-
- return var1;
- }
- }
-
- public boolean clrRts() {
- boolean var1 = false;
- short var3 = 512;
- if(!this.isOpen()) {
- return var1;
- } else {
- int var2 = this.c().controlTransfer(64, 1, var3, this.t, (byte[])null, 0, 0);
- if(var2 == 0) {
- var1 = true;
- }
-
- return var1;
- }
- }
-
- public boolean setDtr() {
- boolean var1 = false;
- short var3 = 257;
- if(!this.isOpen()) {
- return var1;
- } else {
- int var2 = this.c().controlTransfer(64, 1, var3, this.t, (byte[])null, 0, 0);
- if(var2 == 0) {
- var1 = true;
- }
-
- return var1;
- }
- }
-
- public boolean clrDtr() {
- boolean var1 = false;
- short var3 = 256;
- if(!this.isOpen()) {
- return var1;
- } else {
- int var2 = this.c().controlTransfer(64, 1, var3, this.t, (byte[])null, 0, 0);
- if(var2 == 0) {
- var1 = true;
- }
-
- return var1;
- }
- }
-
- public boolean setChars(byte eventChar, byte eventCharEnable, byte errorChar, byte errorCharEnable) {
- boolean var7 = false;
- r var8 = new r();
- var8.a = eventChar;
- var8.b = eventCharEnable;
- var8.c = errorChar;
- var8.d = errorCharEnable;
- if(!this.isOpen()) {
- return var7;
- } else {
- int var6 = eventChar & 255;
- if(eventCharEnable != 0) {
- var6 |= 256;
- }
-
- int var5 = this.c().controlTransfer(64, 6, var6, this.t, (byte[])null, 0, 0);
- if(var5 != 0) {
- return var7;
- } else {
- var6 = errorChar & 255;
- if(errorCharEnable > 0) {
- var6 |= 256;
- }
-
- var5 = this.c().controlTransfer(64, 7, var6, this.t, (byte[])null, 0, 0);
- if(var5 == 0) {
- this.h = var8;
- var7 = true;
- }
-
- return var7;
- }
- }
- }
-
- public boolean setBitMode(byte mask, byte bitMode) {
- int var5 = this.ftDeviceInfoListNode.type;
- boolean var6 = false;
- if(!this.isOpen()) {
- return var6;
- } else if(var5 == 1) {
- return var6;
- } else {
- if(var5 == 0 && bitMode != 0) {
- if((bitMode & 1) == 0) {
- return var6;
- }
- } else if(var5 == 4 && bitMode != 0) {
- if((bitMode & 31) == 0) {
- return var6;
- }
-
- if(bitMode == 2 & this.usbInterface.getId() != 0) {
- return var6;
- }
- } else if(var5 == 5 && bitMode != 0) {
- if((bitMode & 37) == 0) {
- return var6;
- }
- } else if(var5 == 6 && bitMode != 0) {
- if((bitMode & 95) == 0) {
- return var6;
- }
-
- if((bitMode & 72) > 0 & this.usbInterface.getId() != 0) {
- return var6;
- }
- } else if(var5 == 7 && bitMode != 0) {
- if((bitMode & 7) == 0) {
- return var6;
- }
-
- if(bitMode == 2 & this.usbInterface.getId() != 0 & this.usbInterface.getId() != 1) {
- return var6;
- }
- } else if(var5 == 8 && bitMode != 0 && bitMode > 64) {
- return var6;
- }
-
- int var3 = bitMode << 8;
- var3 |= mask & 255;
- int var4 = this.c().controlTransfer(64, 11, var3, this.t, (byte[])null, 0, 0);
- if(var4 == 0) {
- var6 = true;
- }
-
- return var6;
- }
- }
-
- public byte getBitMode() {
- boolean var1 = false;
- byte[] var2 = new byte[1];
- if(!this.isOpen()) {
- return (byte)-1;
- } else if(!this.g()) {
- return (byte)-2;
- } else {
- int var3 = this.c().controlTransfer(-64, 12, 0, this.t, var2, var2.length, 0);
- return var3 == var2.length?var2[0]:-3;
- }
- }
-
- public boolean resetDevice() {
- boolean var1 = false;
- boolean var2 = false;
- if(!this.isOpen()) {
- return var2;
- } else {
- int var3 = this.c().controlTransfer(64, 0, 0, 0, (byte[])null, 0, 0);
- if(var3 == 0) {
- var2 = true;
- }
-
- return var2;
- }
- }
-
- public int VendorCmdSet(int request, int wValue) {
- boolean var3 = false;
- if(!this.isOpen()) {
- return -1;
- } else {
- int var4 = this.c().controlTransfer(64, request, wValue, this.t, (byte[])null, 0, 0);
- return var4;
- }
- }
-
- public int VendorCmdSet(int request, int wValue, byte[] buf, int datalen) {
- boolean var5 = false;
- if(!this.isOpen()) {
- Log.e("FTDI_Device::", "VendorCmdSet: Device not open");
- return -1;
- } else if(datalen < 0) {
- Log.e("FTDI_Device::", "VendorCmdSet: Invalid data length");
- return -1;
- } else {
- if(buf == null) {
- if(datalen > 0) {
- Log.e("FTDI_Device::", "VendorCmdSet: buf is null!");
- return -1;
- }
- } else if(buf.length < datalen) {
- Log.e("FTDI_Device::", "VendorCmdSet: length of buffer is smaller than data length to set");
- return -1;
- }
-
- int var6 = this.c().controlTransfer(64, request, wValue, this.t, buf, datalen, 0);
- return var6;
- }
- }
-
- public int VendorCmdGet(int request, int wValue, byte[] buf, int datalen) {
- boolean var5 = false;
- if(!this.isOpen()) {
- Log.e("FTDI_Device::", "VendorCmdGet: Device not open");
- return -1;
- } else if(datalen < 0) {
- Log.e("FTDI_Device::", "VendorCmdGet: Invalid data length");
- return -1;
- } else if(buf == null) {
- Log.e("FTDI_Device::", "VendorCmdGet: buf is null");
- return -1;
- } else if(buf.length < datalen) {
- Log.e("FTDI_Device::", "VendorCmdGet: length of buffer is smaller than data length to get");
- return -1;
- } else {
- int var6 = this.c().controlTransfer(-64, request, wValue, this.t, buf, datalen, 0);
- return var6;
- }
- }
-
- public void stopInTask() {
- try {
- if(!this.m.c()) {
- this.m.a();
- }
- } catch (InterruptedException var2) {
- Log.d("FTDI_Device::", "stopInTask called!");
- var2.printStackTrace();
- }
-
- }
-
- public void restartInTask() {
- this.m.b();
- }
-
- public boolean stoppedInTask() {
- return this.m.c();
- }
-
- public boolean purge(byte flags) {
- boolean var2 = false;
- boolean var3 = false;
- boolean var4 = false;
- if((flags & 1) == 1) {
- var2 = true;
- }
-
- if((flags & 2) == 2) {
- var3 = true;
- }
-
- return this.a(var2, var3);
- }
-
- private boolean a(boolean var1, boolean var2) {
- boolean var3 = false;
- int var4 = 0;
- boolean var5 = false;
- if(!this.isOpen()) {
- return var3;
- } else {
- byte var7;
- if(var1) {
- var7 = 1;
-
- for(int var6 = 0; var6 < 6; ++var6) {
- var4 = this.c().controlTransfer(64, 0, var7, this.t, (byte[])null, 0, 0);
- }
-
- if(var4 > 0) {
- return var3;
- }
-
- this.p.e();
- }
-
- if(var2) {
- var7 = 2;
- var4 = this.c().controlTransfer(64, 0, var7, this.t, (byte[])null, 0, 0);
- if(var4 == 0) {
- var3 = true;
- }
- }
-
- return var3;
- }
- }
-
- public boolean setLatencyTimer(byte latency) {
- boolean var4 = false;
- int var2 = latency & 255;
- if(!this.isOpen()) {
- return var4;
- } else {
- int var3 = this.c().controlTransfer(64, 9, var2, this.t, (byte[])null, 0, 0);
- if(var3 == 0) {
- this.r = latency;
- var4 = true;
- } else {
- var4 = false;
- }
-
- return var4;
- }
- }
-
- public byte getLatencyTimer() {
- byte[] var1 = new byte[1];
- boolean var2 = false;
- if(!this.isOpen()) {
- return (byte)-1;
- } else {
- int var3 = this.c().controlTransfer(-64, 10, 0, this.t, var1, var1.length, 0);
- return var3 == var1.length?var1[0]:0;
- }
- }
-
- public boolean setEventNotification(long Mask) {
- boolean var3 = false;
- if(!this.isOpen()) {
- return var3;
- } else {
- if(Mask != 0L) {
- this.a = 0L;
- this.i.a = Mask;
- var3 = true;
- }
-
- return var3;
- }
- }
-
- private boolean q() {
- for(int var1 = 0; var1 < this.usbInterface.getEndpointCount(); ++var1) {
- Log.i("FTDI_Device::", "EP: " + String.format("0x%02X", new Object[]{Integer.valueOf(this.usbInterface.getEndpoint(var1).getAddress())}));
- if(this.usbInterface.getEndpoint(var1).getType() == 2) {
- if(this.usbInterface.getEndpoint(var1).getDirection() == 128) {
- this.f = this.usbInterface.getEndpoint(var1);
- this.u = this.f.getMaxPacketSize();
- } else {
- this.e = this.usbInterface.getEndpoint(var1);
- }
- } else {
- Log.i("FTDI_Device::", "Not Bulk Endpoint");
- }
- }
-
- if(this.e != null && this.f != null) {
- return true;
- } else {
- return false;
- }
- }
-
- public FT_EEPROM eepromRead() {
- return !this.isOpen()?null:this.q.a();
- }
-
- public short eepromWrite(FT_EEPROM eeData) {
- return !this.isOpen()?-1:this.q.a(eeData);
- }
-
- public boolean eepromErase() {
- boolean var1 = false;
- if(!this.isOpen()) {
- return var1;
- } else {
- if(this.q.c() == 0) {
- var1 = true;
- }
-
- return var1;
- }
- }
-
- public int eepromWriteUserArea(byte[] data) {
- return !this.isOpen()?0:this.q.a(data);
- }
-
- public byte[] eepromReadUserArea(int length) {
- return !this.isOpen()?null:this.q.a(length);
- }
-
- public int eepromGetUserAreaSize() {
- return !this.isOpen()?-1:this.q.b();
- }
-
- public int eepromReadWord(short offset) {
- byte var2 = -1;
- if(!this.isOpen()) {
- return var2;
- } else {
- int var3 = this.q.a(offset);
- return var3;
- }
- }
-
- public boolean eepromWriteWord(short address, short data) {
- boolean var3 = false;
- if(!this.isOpen()) {
- return var3;
- } else {
- var3 = this.q.a(address, data);
- return var3;
- }
- }
-
- int e() {
- return this.u;
- }
-}
diff --git a/FtcRobotController/app/src/main/java/com/ftdi/j2xx/FT_EEPROM.java b/FtcRobotController/app/src/main/java/com/ftdi/j2xx/FT_EEPROM.java
deleted file mode 100644
index 624b146..0000000
--- a/FtcRobotController/app/src/main/java/com/ftdi/j2xx/FT_EEPROM.java
+++ /dev/null
@@ -1,15 +0,0 @@
-package com.ftdi.j2xx;
-
-public class FT_EEPROM {
- public short DeviceType = 0;
- public String Manufacturer = "FTDI";
- public short MaxPower = 90;
- public String Product = "USB <-> Serial Converter";
- public short ProductId = 24577;
- public boolean PullDownEnable = false;
- public boolean RemoteWakeup = false;
- public boolean SelfPowered = false;
- public boolean SerNumEnable = true;
- public String SerialNumber = "FT123456";
- public short VendorId = 1027;
-}
diff --git a/FtcRobotController/app/src/main/java/com/ftdi/j2xx/FT_EEPROM_2232D.java b/FtcRobotController/app/src/main/java/com/ftdi/j2xx/FT_EEPROM_2232D.java
deleted file mode 100644
index 5cba014..0000000
--- a/FtcRobotController/app/src/main/java/com/ftdi/j2xx/FT_EEPROM_2232D.java
+++ /dev/null
@@ -1,20 +0,0 @@
-package com.ftdi.j2xx;
-
-import com.ftdi.j2xx.FT_EEPROM;
-
-public class FT_EEPROM_2232D extends FT_EEPROM {
- public boolean A_FIFO = false;
- public boolean A_FIFOTarget = false;
- public boolean A_FastSerial = false;
- public boolean A_HighIO = false;
- public boolean A_LoadD2XX = false;
- public boolean A_LoadVCP = false;
- public boolean A_UART = false;
- public boolean B_FIFO = false;
- public boolean B_FIFOTarget = false;
- public boolean B_FastSerial = false;
- public boolean B_HighIO = false;
- public boolean B_LoadD2XX = false;
- public boolean B_LoadVCP = false;
- public boolean B_UART = false;
-}
diff --git a/FtcRobotController/app/src/main/java/com/ftdi/j2xx/FT_EEPROM_2232H.java b/FtcRobotController/app/src/main/java/com/ftdi/j2xx/FT_EEPROM_2232H.java
deleted file mode 100644
index 0b7f490..0000000
--- a/FtcRobotController/app/src/main/java/com/ftdi/j2xx/FT_EEPROM_2232H.java
+++ /dev/null
@@ -1,35 +0,0 @@
-package com.ftdi.j2xx;
-
-import com.ftdi.j2xx.FT_EEPROM;
-
-public class FT_EEPROM_2232H extends FT_EEPROM {
- public byte AH_DriveCurrent = 0;
- public boolean AH_SchmittInput = false;
- public boolean AH_SlowSlew = false;
- public byte AL_DriveCurrent = 0;
- public boolean AL_SchmittInput = false;
- public boolean AL_SlowSlew = false;
- public boolean A_FIFO = false;
- public boolean A_FIFOTarget = false;
- public boolean A_FastSerial = false;
- public boolean A_LoadD2XX = false;
- public boolean A_LoadVCP = false;
- public boolean A_UART = false;
- public byte BH_DriveCurrent = 0;
- public boolean BH_SchmittInput = false;
- public boolean BH_SlowSlew = false;
- public byte BL_DriveCurrent = 0;
- public boolean BL_SchmittInput = false;
- public boolean BL_SlowSlew = false;
- public boolean B_FIFO = false;
- public boolean B_FIFOTarget = false;
- public boolean B_FastSerial = false;
- public boolean B_LoadD2XX = false;
- public boolean B_LoadVCP = false;
- public boolean B_UART = false;
- public boolean PowerSaveEnable = false;
- public int TPRDRV = 0;
-
- public static final class DRIVE_STRENGTH {
- }
-}
diff --git a/FtcRobotController/app/src/main/java/com/ftdi/j2xx/FT_EEPROM_232H.java b/FtcRobotController/app/src/main/java/com/ftdi/j2xx/FT_EEPROM_232H.java
deleted file mode 100644
index e71501f..0000000
--- a/FtcRobotController/app/src/main/java/com/ftdi/j2xx/FT_EEPROM_232H.java
+++ /dev/null
@@ -1,39 +0,0 @@
-package com.ftdi.j2xx;
-
-import com.ftdi.j2xx.FT_EEPROM;
-
-public class FT_EEPROM_232H extends FT_EEPROM {
- public byte AL_DriveCurrent = 0;
- public boolean AL_SchmittInput = false;
- public boolean AL_SlowSlew = false;
- public byte BL_DriveCurrent = 0;
- public boolean BL_SchmittInput = false;
- public boolean BL_SlowSlew = false;
- public byte CBus0 = 0;
- public byte CBus1 = 0;
- public byte CBus2 = 0;
- public byte CBus3 = 0;
- public byte CBus4 = 0;
- public byte CBus5 = 0;
- public byte CBus6 = 0;
- public byte CBus7 = 0;
- public byte CBus8 = 0;
- public byte CBus9 = 0;
- public boolean FIFO = false;
- public boolean FIFOTarget = false;
- public boolean FT1248 = false;
- public boolean FT1248ClockPolarity = false;
- public boolean FT1248FlowControl = false;
- public boolean FT1248LSB = false;
- public boolean FastSerial = false;
- public boolean LoadD2XX = false;
- public boolean LoadVCP = false;
- public boolean PowerSaveEnable = false;
- public boolean UART = false;
-
- public static final class CBUS {
- }
-
- public static final class DRIVE_STRENGTH {
- }
-}
diff --git a/FtcRobotController/app/src/main/java/com/ftdi/j2xx/FT_EEPROM_232R.java b/FtcRobotController/app/src/main/java/com/ftdi/j2xx/FT_EEPROM_232R.java
deleted file mode 100644
index cd71465..0000000
--- a/FtcRobotController/app/src/main/java/com/ftdi/j2xx/FT_EEPROM_232R.java
+++ /dev/null
@@ -1,25 +0,0 @@
-package com.ftdi.j2xx;
-
-import com.ftdi.j2xx.FT_EEPROM;
-
-public class FT_EEPROM_232R extends FT_EEPROM {
- public byte CBus0 = 0;
- public byte CBus1 = 0;
- public byte CBus2 = 0;
- public byte CBus3 = 0;
- public byte CBus4 = 0;
- public boolean ExternalOscillator = false;
- public boolean HighIO = false;
- public boolean InvertCTS = false;
- public boolean InvertDCD = false;
- public boolean InvertDSR = false;
- public boolean InvertDTR = false;
- public boolean InvertRI = false;
- public boolean InvertRTS = false;
- public boolean InvertRXD = false;
- public boolean InvertTXD = false;
- public boolean LoadVCP = false;
-
- public static final class CBUS {
- }
-}
diff --git a/FtcRobotController/app/src/main/java/com/ftdi/j2xx/FT_EEPROM_245R.java b/FtcRobotController/app/src/main/java/com/ftdi/j2xx/FT_EEPROM_245R.java
deleted file mode 100644
index a1aa3a1..0000000
--- a/FtcRobotController/app/src/main/java/com/ftdi/j2xx/FT_EEPROM_245R.java
+++ /dev/null
@@ -1,25 +0,0 @@
-package com.ftdi.j2xx;
-
-import com.ftdi.j2xx.FT_EEPROM;
-
-public class FT_EEPROM_245R extends FT_EEPROM {
- public byte CBus0 = 0;
- public byte CBus1 = 0;
- public byte CBus2 = 0;
- public byte CBus3 = 0;
- public byte CBus4 = 0;
- public boolean ExternalOscillator = false;
- public boolean HighIO = false;
- public boolean InvertCTS = false;
- public boolean InvertDCD = false;
- public boolean InvertDSR = false;
- public boolean InvertDTR = false;
- public boolean InvertRI = false;
- public boolean InvertRTS = false;
- public boolean InvertRXD = false;
- public boolean InvertTXD = false;
- public boolean LoadVCP = false;
-
- public static final class CBUS {
- }
-}
diff --git a/FtcRobotController/app/src/main/java/com/ftdi/j2xx/FT_EEPROM_4232H.java b/FtcRobotController/app/src/main/java/com/ftdi/j2xx/FT_EEPROM_4232H.java
deleted file mode 100644
index 202d35a..0000000
--- a/FtcRobotController/app/src/main/java/com/ftdi/j2xx/FT_EEPROM_4232H.java
+++ /dev/null
@@ -1,38 +0,0 @@
-package com.ftdi.j2xx;
-
-import com.ftdi.j2xx.FT_EEPROM;
-
-public class FT_EEPROM_4232H extends FT_EEPROM {
- public byte AH_DriveCurrent = 0;
- public boolean AH_LoadD2XX = false;
- public boolean AH_LoadRI_RS485 = false;
- public boolean AH_LoadVCP = false;
- public boolean AH_RI_TXDEN = false;
- public boolean AH_SchmittInput = false;
- public boolean AH_SlowSlew = false;
- public byte AL_DriveCurrent = 0;
- public boolean AL_LoadD2XX = false;
- public boolean AL_LoadRI_RS485 = false;
- public boolean AL_LoadVCP = false;
- public boolean AL_RI_TXDEN = false;
- public boolean AL_SchmittInput = false;
- public boolean AL_SlowSlew = false;
- public byte BH_DriveCurrent = 0;
- public boolean BH_LoadD2XX = false;
- public boolean BH_LoadRI_RS485 = false;
- public boolean BH_LoadVCP = false;
- public boolean BH_RI_TXDEN = false;
- public boolean BH_SchmittInput = false;
- public boolean BH_SlowSlew = false;
- public byte BL_DriveCurrent = 0;
- public boolean BL_LoadD2XX = false;
- public boolean BL_LoadRI_RS485 = false;
- public boolean BL_LoadVCP = false;
- public boolean BL_RI_TXDEN = false;
- public boolean BL_SchmittInput = false;
- public boolean BL_SlowSlew = false;
- public int TPRDRV = 0;
-
- public static final class DRIVE_STRENGTH {
- }
-}
diff --git a/FtcRobotController/app/src/main/java/com/ftdi/j2xx/FT_EEPROM_X_Series.java b/FtcRobotController/app/src/main/java/com/ftdi/j2xx/FT_EEPROM_X_Series.java
deleted file mode 100644
index e6b33d1..0000000
--- a/FtcRobotController/app/src/main/java/com/ftdi/j2xx/FT_EEPROM_X_Series.java
+++ /dev/null
@@ -1,47 +0,0 @@
-package com.ftdi.j2xx;
-
-import com.ftdi.j2xx.FT_EEPROM;
-
-public class FT_EEPROM_X_Series extends FT_EEPROM {
- public byte AC_DriveCurrent = 0;
- public boolean AC_SchmittInput = false;
- public boolean AC_SlowSlew = false;
- public byte AD_DriveCurrent = 0;
- public boolean AD_SchmittInput = false;
- public boolean AD_SlowSlew = false;
- public short A_DeviceTypeValue = 0;
- public boolean A_LoadD2XX = false;
- public boolean A_LoadVCP = false;
- public boolean BCDDisableSleep = false;
- public boolean BCDEnable = false;
- public boolean BCDForceCBusPWREN = false;
- public byte CBus0 = 0;
- public byte CBus1 = 0;
- public byte CBus2 = 0;
- public byte CBus3 = 0;
- public byte CBus4 = 0;
- public byte CBus5 = 0;
- public byte CBus6 = 0;
- public boolean FT1248ClockPolarity = false;
- public boolean FT1248FlowControl = false;
- public boolean FT1248LSB = false;
- public int I2CDeviceID = 0;
- public boolean I2CDisableSchmitt = false;
- public int I2CSlaveAddress = 0;
- public boolean InvertCTS = false;
- public boolean InvertDCD = false;
- public boolean InvertDSR = false;
- public boolean InvertDTR = false;
- public boolean InvertRI = false;
- public boolean InvertRTS = false;
- public boolean InvertRXD = false;
- public boolean InvertTXD = false;
- public boolean PowerSaveEnable = false;
- public boolean RS485EchoSuppress = false;
-
- public static final class CBUS {
- }
-
- public static final class DRIVE_STRENGTH {
- }
-}
diff --git a/FtcRobotController/app/src/main/java/com/ftdi/j2xx/ProcessRequestRunnable.java b/FtcRobotController/app/src/main/java/com/ftdi/j2xx/ProcessRequestRunnable.java
deleted file mode 100644
index 2deb42b..0000000
--- a/FtcRobotController/app/src/main/java/com/ftdi/j2xx/ProcessRequestRunnable.java
+++ /dev/null
@@ -1,38 +0,0 @@
-package com.ftdi.j2xx;
-
-import android.util.Log;
-
-class ProcessRequestRunnable implements Runnable {
- int bufferCount;
- private o oDevice;
-
- ProcessRequestRunnable(o var1) {
- this.oDevice = var1;
- this.bufferCount = this.oDevice.getDriverParameters().getBufferNumber();
- }
-
- public void run() {
- int bufferNum = 0;
-
- try {
- do {
- n var6 = this.oDevice.c(bufferNum);
- if(var6.b() > 0) {
- this.oDevice.processBulkIn(var6);
- var6.c();
- }
-
- this.oDevice.d(bufferNum);
- bufferNum = (bufferNum + 1) % this.bufferCount;
- } while(!Thread.interrupted());
-
- throw new InterruptedException();
- } catch (InterruptedException var7) {
- Log.d("ProcessRequestThread::", "Device has been closed.");
- var7.printStackTrace();
- } catch (Exception var8) {
- Log.e("ProcessRequestThread::", "Fatal error!");
- var8.printStackTrace();
- }
- }
-}
diff --git a/FtcRobotController/app/src/main/java/com/ftdi/j2xx/a.java b/FtcRobotController/app/src/main/java/com/ftdi/j2xx/a.java
deleted file mode 100644
index 4670328..0000000
--- a/FtcRobotController/app/src/main/java/com/ftdi/j2xx/a.java
+++ /dev/null
@@ -1,102 +0,0 @@
-//
-// Source code recreated from a .class file by IntelliJ IDEA
-// (powered by Fernflower decompiler)
-//
-
-package com.ftdi.j2xx;
-
-import android.hardware.usb.UsbDeviceConnection;
-import android.hardware.usb.UsbEndpoint;
-import android.util.Log;
-import com.ftdi.j2xx.FT_Device;
-import com.ftdi.j2xx.n;
-import com.ftdi.j2xx.o;
-import java.nio.ByteBuffer;
-import java.util.concurrent.Semaphore;
-
-class a implements Runnable {
- UsbDeviceConnection a;
- UsbEndpoint b;
- o c;
- FT_Device d;
- int e;
- int f;
- int g;
- Semaphore h;
- boolean i;
-
- a(FT_Device var1, o var2, UsbDeviceConnection var3, UsbEndpoint var4) {
- this.d = var1;
- this.b = var4;
- this.a = var3;
- this.c = var2;
- this.e = this.c.b().getBufferNumber();
- this.f = this.c.b().getMaxTransferSize();
- this.g = this.d.d().getReadTimeout();
- this.h = new Semaphore(1);
- this.i = false;
- }
-
- void a() throws InterruptedException {
- this.h.acquire();
- this.i = true;
- }
-
- void b() {
- this.i = false;
- this.h.release();
- }
-
- boolean c() {
- return this.i;
- }
-
- public void run() {
- ByteBuffer var1 = null;
- n var2 = null;
- int var3 = 0;
- boolean var4 = false;
- Object var5 = null;
-
- try {
- do {
- if(this.i) {
- this.h.acquire();
- this.h.release();
- }
-
- var2 = this.c.b(var3);
- if(var2.b() == 0) {
- var1 = var2.a();
- var1.clear();
- var2.a(var3);
- byte[] var12 = var1.array();
- int var11 = this.a.bulkTransfer(this.b, var12, this.f, this.g);
- if(var11 > 0) {
- var1.position(var11);
- var1.flip();
- var2.b(var11);
- this.c.e(var3);
- }
- }
-
- ++var3;
- var3 %= this.e;
- } while(!Thread.interrupted());
-
- throw new InterruptedException();
- } catch (InterruptedException var9) {
- try {
- this.c.f();
- this.c.e();
- } catch (Exception var8) {
- Log.d("BulkIn::", "Stop BulkIn thread");
- var8.printStackTrace();
- }
- } catch (Exception var10) {
- var10.printStackTrace();
- Log.e("BulkIn::", "Fatal error in BulkIn thread");
- }
-
- }
-}
diff --git a/FtcRobotController/app/src/main/java/com/ftdi/j2xx/b.java b/FtcRobotController/app/src/main/java/com/ftdi/j2xx/b.java
deleted file mode 100644
index 3583c3c..0000000
--- a/FtcRobotController/app/src/main/java/com/ftdi/j2xx/b.java
+++ /dev/null
@@ -1,271 +0,0 @@
-package com.ftdi.j2xx;
-
-final class b {
- static final byte a(int var0, int[] var1) {
- byte var2 = 1;
- byte var3 = b(var0, var1);
- if(var3 == -1) {
- var2 = -1;
- } else {
- if(var3 == 0) {
- var1[0] = 1 + (-49153 & var1[0]);
- }
-
- int var4 = a(var1[0], var1[var2]);
- int var5;
- int var6;
- if(var0 > var4) {
- var5 = -100 + var0 * 100 / var4;
- var6 = 100 * (var0 % var4) % var4;
- } else {
- var5 = -100 + var4 * 100 / var0;
- var6 = 100 * (var4 % var0) % var0;
- }
-
- if(var5 >= 3 && (var5 != 3 || var6 != 0)) {
- return (byte)0;
- }
- }
-
- return var2;
- }
-
- static byte a(int var0, int[] var1, boolean var2) {
- byte var3 = 1;
- byte var4 = b(var0, var1, var2);
- if(var4 == -1) {
- var3 = -1;
- } else {
- if(var4 == 0) {
- var1[0] = 1 + (-49153 & var1[0]);
- }
-
- int var5 = a(var1[0], var1[var3], var2);
- int var6;
- int var7;
- if(var0 > var5) {
- var6 = -100 + var0 * 100 / var5;
- var7 = 100 * (var0 % var5) % var5;
- } else {
- var6 = -100 + var5 * 100 / var0;
- var7 = 100 * (var5 % var0) % var0;
- }
-
- if(var6 >= 3 && (var6 != 3 || var7 != 0)) {
- return (byte)0;
- }
- }
-
- return var3;
- }
-
- private static int a(int var0, int var1) {
- if(var0 == 0) {
- return 12000000;
- } else if(var0 == 1) {
- return 8000000;
- } else {
- int var2 = 100 * (-49153 & var0);
- if(('�' & var1) == 0) {
- switch(var0 & 49152) {
- case 16384:
- var2 += 50;
- break;
- case 32768:
- var2 += 25;
- break;
- case 49152:
- var2 += 12;
- }
- } else {
- switch(var0 & 49152) {
- case 0:
- var2 += 37;
- break;
- case 16384:
- var2 += 62;
- break;
- case 32768:
- var2 += 75;
- break;
- case 49152:
- var2 += 87;
- }
- }
-
- return 1200000000 / var2;
- }
- }
-
- private static final int a(int var0, int var1, boolean var2) {
- if(var0 == 0) {
- return 3000000;
- } else {
- int var3 = 100 * (-49153 & var0);
- if(!var2) {
- switch(49152 & var0) {
- case 16384:
- var3 += 50;
- break;
- case 32768:
- var3 += 25;
- break;
- case 49152:
- var3 += 12;
- }
- } else if(var1 == 0) {
- switch(49152 & var0) {
- case 16384:
- var3 += 50;
- break;
- case 32768:
- var3 += 25;
- break;
- case 49152:
- var3 += 12;
- }
- } else {
- switch(49152 & var0) {
- case 0:
- var3 += 37;
- break;
- case 16384:
- var3 += 62;
- break;
- case 32768:
- var3 += 75;
- break;
- case 49152:
- var3 += 87;
- }
- }
-
- return 300000000 / var3;
- }
- }
-
- private static byte b(int var0, int[] var1) {
- byte var2 = 1;
- if(var0 == 0) {
- var2 = -1;
- } else {
- if((-16384 & 12000000 / var0) > 0) {
- return (byte)-1;
- }
-
- var1[var2] = 2;
- if(var0 >= 11640000 && var0 <= 12360000) {
- var1[0] = 0;
- return var2;
- }
-
- if(var0 >= 7760000 && var0 <= 8240000) {
- var1[0] = var2;
- return var2;
- }
-
- var1[0] = 12000000 / var0;
- var1[var2] = 2;
- if(var1[0] == var2 && 100 * (12000000 % var0) / var0 <= 3) {
- var1[0] = 0;
- }
-
- if(var1[0] != 0) {
- int var3 = 100 * (12000000 % var0) / var0;
- char var4;
- if(var3 <= 6) {
- var4 = 0;
- } else if(var3 <= 18) {
- var4 = '쀀';
- } else if(var3 <= 31) {
- var4 = '耀';
- } else if(var3 <= 43) {
- var1[var2] |= 1;
- var4 = 0;
- } else if(var3 <= 56) {
- var4 = 16384;
- } else if(var3 <= 68) {
- var4 = 16384;
- var1[var2] |= 1;
- } else if(var3 <= 81) {
- var4 = '耀';
- var1[var2] |= 1;
- } else if(var3 <= 93) {
- var4 = '쀀';
- var1[var2] |= 1;
- } else {
- var2 = 0;
- var4 = 0;
- }
-
- var1[0] |= var4;
- return var2;
- }
- }
-
- return var2;
- }
-
- private static byte b(int var0, int[] var1, boolean var2) {
- char var3 = '耀';
- byte var4 = 1;
- if(var0 == 0) {
- var4 = -1;
- } else {
- if((-16384 & 3000000 / var0) > 0) {
- return (byte)-1;
- }
-
- var1[0] = 3000000 / var0;
- var1[var4] = 0;
- if(var1[0] == var4 && 100 * (3000000 % var0) / var0 <= 3) {
- var1[0] = 0;
- }
-
- if(var1[0] != 0) {
- int var5 = 100 * (3000000 % var0) / var0;
- if(!var2) {
- if(var5 <= 6) {
- var3 = 0;
- } else if(var5 <= 18) {
- var3 = '쀀';
- } else if(var5 > 37) {
- if(var5 <= 75) {
- var3 = 16384;
- } else {
- var4 = 0;
- var3 = 0;
- }
- }
- } else if(var5 <= 6) {
- var3 = 0;
- } else if(var5 <= 18) {
- var3 = '쀀';
- } else if(var5 > 31) {
- if(var5 <= 43) {
- var1[var4] = var4;
- var3 = 0;
- } else if(var5 <= 56) {
- var3 = 16384;
- } else if(var5 <= 68) {
- var1[var4] = var4;
- var3 = 16384;
- } else if(var5 <= 81) {
- var1[var4] = var4;
- } else if(var5 <= 93) {
- var3 = '쀀';
- var1[var4] = var4;
- } else {
- var4 = 0;
- var3 = 0;
- }
- }
-
- var1[0] |= var3;
- return var4;
- }
- }
-
- return var4;
- }
-}
diff --git a/FtcRobotController/app/src/main/java/com/ftdi/j2xx/c.java b/FtcRobotController/app/src/main/java/com/ftdi/j2xx/c.java
deleted file mode 100644
index 412b5e7..0000000
--- a/FtcRobotController/app/src/main/java/com/ftdi/j2xx/c.java
+++ /dev/null
@@ -1,478 +0,0 @@
-//
-// Source code recreated from a .class file by IntelliJ IDEA
-// (powered by Fernflower decompiler)
-//
-
-package com.ftdi.j2xx;
-
-import com.ftdi.j2xx.FT_Device;
-import com.ftdi.j2xx.FT_EEPROM;
-import com.ftdi.j2xx.FT_EEPROM_2232H;
-import com.ftdi.j2xx.k;
-import com.ftdi.j2xx.D2xxManager.D2xxException;
-
-class c extends k {
- c(FT_Device var1) throws D2xxException {
- super(var1);
- this.a((byte)12);
- }
-
- short a(FT_EEPROM var1) {
- int[] var2 = new int[this.b];
- if(var1.getClass() != FT_EEPROM_2232H.class) {
- return (short)1;
- } else {
- FT_EEPROM_2232H var3 = (FT_EEPROM_2232H)var1;
-
- try {
- if(!var3.A_UART) {
- if(var3.A_FIFO) {
- var2[0] |= 1;
- } else if(var3.A_FIFOTarget) {
- var2[0] |= 2;
- } else {
- var2[0] |= 4;
- }
- }
-
- if(var3.A_LoadVCP) {
- var2[0] |= 8;
- }
-
- if(!var3.B_UART) {
- if(var3.B_FIFO) {
- var2[0] |= 256;
- } else if(var3.B_FIFOTarget) {
- var2[0] |= 512;
- } else {
- var2[0] |= 1024;
- }
- }
-
- if(var3.B_LoadVCP) {
- var2[0] |= 2048;
- }
-
- if(var3.PowerSaveEnable) {
- var2[0] |= '耀';
- }
-
- var2[1] = var3.VendorId;
- var2[2] = var3.ProductId;
- var2[3] = 1792;
- var2[4] = this.a((Object)var1);
- var2[5] = this.b(var1);
- var2[6] = 0;
- byte var4 = var3.AL_DriveCurrent;
- if(var4 == -1) {
- var4 = 0;
- }
-
- var2[6] |= var4;
- if(var3.AL_SlowSlew) {
- var2[6] |= 4;
- }
-
- if(var3.AL_SchmittInput) {
- var2[6] |= 8;
- }
-
- byte var5 = var3.AH_DriveCurrent;
- if(var5 == -1) {
- var5 = 0;
- }
-
- short var12 = (short)(var5 << 4);
- var2[6] |= var12;
- if(var3.AH_SlowSlew) {
- var2[6] |= 64;
- }
-
- if(var3.AH_SchmittInput) {
- var2[6] |= 128;
- }
-
- byte var6 = var3.BL_DriveCurrent;
- if(var6 == -1) {
- var6 = 0;
- }
-
- short var13 = (short)(var6 << 8);
- var2[6] |= var13;
- if(var3.BL_SlowSlew) {
- var2[6] |= 1024;
- }
-
- if(var3.BL_SchmittInput) {
- var2[6] |= 2048;
- }
-
- byte var7 = var3.BH_DriveCurrent;
- short var14 = (short)(var7 << 12);
- var2[6] |= var14;
- if(var3.BH_SlowSlew) {
- var2[6] |= 16384;
- }
-
- if(var3.BH_SchmittInput) {
- var2[6] |= '耀';
- }
-
- boolean var8 = false;
- byte var9 = 77;
- if(this.a == 70) {
- var9 = 13;
- var8 = true;
- }
-
- int var15 = this.a(var3.Manufacturer, var2, var9, 7, var8);
- var15 = this.a(var3.Product, var2, var15, 8, var8);
- if(var3.SerNumEnable) {
- this.a(var3.SerialNumber, var2, var15, 9, var8);
- }
-
- switch(var3.TPRDRV) {
- case 0:
- var2[11] = 0;
- break;
- case 1:
- var2[11] = 8;
- break;
- case 2:
- var2[11] = 16;
- break;
- case 3:
- var2[11] = 24;
- break;
- default:
- var2[11] = 0;
- }
-
- var2[12] = this.a;
- if(var2[1] != 0 && var2[2] != 0) {
- boolean var10 = false;
- var10 = this.a(var2, this.b - 1);
- return (short)(var10?0:1);
- } else {
- return (short)2;
- }
- } catch (Exception var11) {
- var11.printStackTrace();
- return (short)0;
- }
- }
- }
-
- FT_EEPROM a() {
- FT_EEPROM_2232H var1 = new FT_EEPROM_2232H();
- int[] var2 = new int[this.b];
- if(this.c) {
- return var1;
- } else {
- try {
- short var4;
- for(var4 = 0; var4 < this.b; ++var4) {
- var2[var4] = this.a(var4);
- }
-
- boolean var3 = false;
- int var24 = var2[0];
- var4 = (short)(var24 & 7);
- switch(var4) {
- case 0:
- var1.A_UART = true;
- break;
- case 1:
- var1.A_FIFO = true;
- break;
- case 2:
- var1.A_FIFOTarget = true;
- break;
- case 3:
- default:
- var1.A_UART = true;
- break;
- case 4:
- var1.A_FastSerial = true;
- }
-
- short var5 = (short)((var24 & 8) >> 3);
- if(var5 == 1) {
- var1.A_LoadVCP = true;
- var1.A_LoadD2XX = false;
- } else {
- var1.A_LoadVCP = false;
- var1.A_LoadD2XX = true;
- }
-
- short var6 = (short)((var24 & 1792) >> 8);
- switch(var6) {
- case 0:
- var1.B_UART = true;
- break;
- case 1:
- var1.B_FIFO = true;
- break;
- case 2:
- var1.B_FIFOTarget = true;
- break;
- case 3:
- default:
- var1.B_UART = true;
- break;
- case 4:
- var1.B_FastSerial = true;
- }
-
- short var7 = (short)((var24 & 2048) >> 11);
- if(var7 == 1) {
- var1.B_LoadVCP = true;
- var1.B_LoadD2XX = false;
- } else {
- var1.B_LoadVCP = false;
- var1.B_LoadD2XX = true;
- }
-
- short var8 = (short)((var24 & '耀') >> 15);
- if(var8 == 1) {
- var1.PowerSaveEnable = true;
- } else {
- var1.PowerSaveEnable = false;
- }
-
- var1.VendorId = (short)var2[1];
- var1.ProductId = (short)var2[2];
- this.a(var1, var2[4]);
- this.a(var1, var2[5]);
- short var9 = (short)(var2[6] & 3);
- switch(var9) {
- case 0:
- var1.AL_DriveCurrent = 0;
- break;
- case 1:
- var1.AL_DriveCurrent = 1;
- break;
- case 2:
- var1.AL_DriveCurrent = 2;
- break;
- case 3:
- var1.AL_DriveCurrent = 3;
- }
-
- short var10 = (short)(var2[6] & 4);
- if(var10 == 4) {
- var1.AL_SlowSlew = true;
- } else {
- var1.AL_SlowSlew = false;
- }
-
- short var11 = (short)(var2[6] & 8);
- if(var11 == 8) {
- var1.AL_SchmittInput = true;
- } else {
- var1.AL_SchmittInput = false;
- }
-
- short var12 = (short)((var2[6] & 48) >> 4);
- switch(var12) {
- case 0:
- var1.AH_DriveCurrent = 0;
- break;
- case 1:
- var1.AH_DriveCurrent = 1;
- break;
- case 2:
- var1.AH_DriveCurrent = 2;
- break;
- case 3:
- var1.AH_DriveCurrent = 3;
- }
-
- short var13 = (short)(var2[6] & 64);
- if(var13 == 64) {
- var1.AH_SlowSlew = true;
- } else {
- var1.AH_SlowSlew = false;
- }
-
- short var14 = (short)(var2[6] & 128);
- if(var14 == 128) {
- var1.AH_SchmittInput = true;
- } else {
- var1.AH_SchmittInput = false;
- }
-
- short var15 = (short)((var2[6] & 768) >> 8);
- switch(var15) {
- case 0:
- var1.BL_DriveCurrent = 0;
- break;
- case 1:
- var1.BL_DriveCurrent = 1;
- break;
- case 2:
- var1.BL_DriveCurrent = 2;
- break;
- case 3:
- var1.BL_DriveCurrent = 3;
- }
-
- short var16 = (short)(var2[6] & 1024);
- if(var16 == 1024) {
- var1.BL_SlowSlew = true;
- } else {
- var1.BL_SlowSlew = false;
- }
-
- short var17 = (short)(var2[6] & 2048);
- if(var14 == 2048) {
- var1.BL_SchmittInput = true;
- } else {
- var1.BL_SchmittInput = false;
- }
-
- short var18 = (short)((var2[6] & 12288) >> 12);
- switch(var18) {
- case 0:
- var1.BH_DriveCurrent = 0;
- break;
- case 1:
- var1.BH_DriveCurrent = 1;
- break;
- case 2:
- var1.BH_DriveCurrent = 2;
- break;
- case 3:
- var1.BH_DriveCurrent = 3;
- }
-
- short var19 = (short)(var2[6] & 16384);
- if(var19 == 16384) {
- var1.BH_SlowSlew = true;
- } else {
- var1.BH_SlowSlew = false;
- }
-
- short var20 = (short)(var2[6] & '耀');
- if(var20 == '耀') {
- var1.BH_SchmittInput = true;
- } else {
- var1.BH_SchmittInput = false;
- }
-
- short var21 = (short)((var2[11] & 24) >> 3);
- if(var21 < 4) {
- var1.TPRDRV = var21;
- } else {
- var1.TPRDRV = 0;
- }
-
- int var22 = var2[7] & 255;
- if(this.a == 70) {
- var22 -= 128;
- var22 /= 2;
- var1.Manufacturer = this.a(var22, var2);
- var22 = var2[8] & 255;
- var22 -= 128;
- var22 /= 2;
- var1.Product = this.a(var22, var2);
- var22 = var2[9] & 255;
- var22 -= 128;
- var22 /= 2;
- var1.SerialNumber = this.a(var22, var2);
- } else {
- var22 /= 2;
- var1.Manufacturer = this.a(var22, var2);
- var22 = var2[8] & 255;
- var22 /= 2;
- var1.Product = this.a(var22, var2);
- var22 = var2[9] & 255;
- var22 /= 2;
- var1.SerialNumber = this.a(var22, var2);
- }
-
- return var1;
- } catch (Exception var23) {
- return null;
- }
- }
- }
-
- int b() {
- int var1 = this.a((short)9);
- int var2 = var1 & 255;
- var2 /= 2;
- int var3 = (var1 & '\uff00') >> 8;
- var2 += var3 / 2;
- ++var2;
- return (this.b - 1 - 1 - var2) * 2;
- }
-
- int a(byte[] var1) {
- boolean var2 = false;
- boolean var3 = false;
- if(var1.length > this.b()) {
- return 0;
- } else {
- int[] var4 = new int[this.b];
-
- for(short var5 = 0; var5 < this.b; ++var5) {
- var4[var5] = this.a(var5);
- }
-
- short var7 = (short)(this.b - this.b() / 2 - 1 - 1);
-
- for(int var8 = 0; var8 < var1.length; var8 += 2) {
- int var6;
- if(var8 + 1 < var1.length) {
- var6 = var1[var8 + 1] & 255;
- } else {
- var6 = 0;
- }
-
- var6 <<= 8;
- var6 |= var1[var8] & 255;
- var4[var7++] = var6;
- }
-
- if(var4[1] != 0 && var4[2] != 0) {
- boolean var9 = false;
- var9 = this.a(var4, this.b - 1);
- if(!var9) {
- return 0;
- } else {
- return var1.length;
- }
- } else {
- return 0;
- }
- }
- }
-
- byte[] a(int var1) {
- boolean var2 = false;
- boolean var3 = false;
- boolean var4 = false;
- byte[] var5 = new byte[var1];
- if(var1 != 0 && var1 <= this.b()) {
- short var6 = (short)(this.b - this.b() / 2 - 1 - 1);
-
- for(int var7 = 0; var7 < var1; var7 += 2) {
- int var10 = this.a(var6++);
- if(var7 + 1 < var5.length) {
- byte var8 = (byte)(var10 & 255);
- var5[var7 + 1] = var8;
- } else {
- var3 = false;
- }
-
- byte var9 = (byte)((var10 & '\uff00') >> 8);
- var5[var7] = var9;
- }
-
- return var5;
- } else {
- return null;
- }
- }
-}
diff --git a/FtcRobotController/app/src/main/java/com/ftdi/j2xx/d.java b/FtcRobotController/app/src/main/java/com/ftdi/j2xx/d.java
deleted file mode 100644
index 24529ba..0000000
--- a/FtcRobotController/app/src/main/java/com/ftdi/j2xx/d.java
+++ /dev/null
@@ -1,267 +0,0 @@
-//
-// Source code recreated from a .class file by IntelliJ IDEA
-// (powered by Fernflower decompiler)
-//
-
-package com.ftdi.j2xx;
-
-import com.ftdi.j2xx.FT_Device;
-import com.ftdi.j2xx.FT_EEPROM;
-import com.ftdi.j2xx.FT_EEPROM_2232D;
-import com.ftdi.j2xx.k;
-import com.ftdi.j2xx.D2xxManager.D2xxException;
-
-class d extends k {
- d(FT_Device var1) throws D2xxException {
- super(var1);
- this.a((byte)10);
- }
-
- short a(FT_EEPROM var1) {
- int[] var2 = new int[this.b];
- if(var1.getClass() != FT_EEPROM_2232D.class) {
- return (short)1;
- } else {
- FT_EEPROM_2232D var3 = (FT_EEPROM_2232D)var1;
-
- try {
- var2[0] = 0;
- if(var3.A_FIFO) {
- var2[0] |= 1;
- } else if(var3.A_FIFOTarget) {
- var2[0] |= 2;
- } else {
- var2[0] |= 4;
- }
-
- if(var3.A_HighIO) {
- var2[0] |= 16;
- }
-
- if(var3.A_LoadVCP) {
- var2[0] |= 8;
- } else if(var3.B_FIFO) {
- var2[0] |= 256;
- } else if(var3.B_FIFOTarget) {
- var2[0] |= 512;
- } else {
- var2[0] |= 1024;
- }
-
- if(var3.B_HighIO) {
- var2[0] |= 4096;
- }
-
- if(var3.B_LoadVCP) {
- var2[0] |= 2048;
- }
-
- var2[1] = var3.VendorId;
- var2[2] = var3.ProductId;
- var2[3] = 1280;
- var2[4] = this.a((Object)var1);
- var2[4] = this.b(var1);
- boolean var4 = false;
- byte var5 = 75;
- if(this.a == 70) {
- var5 = 11;
- var4 = true;
- }
-
- int var8 = this.a(var3.Manufacturer, var2, var5, 7, var4);
- var8 = this.a(var3.Product, var2, var8, 8, var4);
- if(var3.SerNumEnable) {
- this.a(var3.SerialNumber, var2, var8, 9, var4);
- }
-
- var2[10] = this.a;
- if(var2[1] != 0 && var2[2] != 0) {
- boolean var6 = false;
- var6 = this.a(var2, this.b - 1);
- return (short)(var6?0:1);
- } else {
- return (short)2;
- }
- } catch (Exception var7) {
- var7.printStackTrace();
- return (short)0;
- }
- }
- }
-
- FT_EEPROM a() {
- FT_EEPROM_2232D var1 = new FT_EEPROM_2232D();
- int[] var2 = new int[this.b];
-
- try {
- for(int var3 = 0; var3 < this.b; ++var3) {
- var2[var3] = this.a((short)var3);
- }
-
- short var11 = (short)(var2[0] & 7);
- switch(var11) {
- case 0:
- var1.A_UART = true;
- break;
- case 1:
- var1.A_FIFO = true;
- break;
- case 2:
- var1.A_FIFOTarget = true;
- case 3:
- default:
- break;
- case 4:
- var1.A_FastSerial = true;
- }
-
- short var4 = (short)((var2[0] & 8) >> 3);
- if(var4 == 1) {
- var1.A_LoadVCP = true;
- } else {
- var1.A_HighIO = true;
- }
-
- short var5 = (short)((var2[0] & 16) >> 4);
- if(var5 == 1) {
- var1.A_HighIO = true;
- }
-
- short var6 = (short)((var2[0] & 1792) >> 8);
- switch(var6) {
- case 0:
- var1.B_UART = true;
- break;
- case 1:
- var1.B_FIFO = true;
- break;
- case 2:
- var1.B_FIFOTarget = true;
- case 3:
- default:
- break;
- case 4:
- var1.B_FastSerial = true;
- }
-
- short var7 = (short)((var2[0] & 2048) >> 11);
- if(var7 == 1) {
- var1.B_LoadVCP = true;
- } else {
- var1.B_LoadD2XX = true;
- }
-
- short var8 = (short)((var2[0] & 4096) >> 12);
- if(var8 == 1) {
- var1.B_HighIO = true;
- }
-
- var1.VendorId = (short)var2[1];
- var1.ProductId = (short)var2[2];
- this.a(var1, var2[4]);
- int var9 = var2[7] & 255;
- if(this.a == 70) {
- var9 -= 128;
- var9 /= 2;
- var1.Manufacturer = this.a(var9, var2);
- var9 = var2[8] & 255;
- var9 -= 128;
- var9 /= 2;
- var1.Product = this.a(var9, var2);
- var9 = var2[9] & 255;
- var9 -= 128;
- var9 /= 2;
- var1.SerialNumber = this.a(var9, var2);
- } else {
- var9 /= 2;
- var1.Manufacturer = this.a(var9, var2);
- var9 = var2[8] & 255;
- var9 /= 2;
- var1.Product = this.a(var9, var2);
- var9 = var2[9] & 255;
- var9 /= 2;
- var1.SerialNumber = this.a(var9, var2);
- }
-
- return var1;
- } catch (Exception var10) {
- return null;
- }
- }
-
- int b() {
- int var1 = this.a((short)9);
- int var2 = var1 & 255;
- int var3 = (var1 & '\uff00') >> 8;
- var2 += var3 / 2;
- return (this.b - 1 - 1 - var2) * 2;
- }
-
- int a(byte[] var1) {
- boolean var2 = false;
- boolean var3 = false;
- if(var1.length > this.b()) {
- return 0;
- } else {
- int[] var4 = new int[this.b];
-
- for(short var5 = 0; var5 < this.b; ++var5) {
- var4[var5] = this.a(var5);
- }
-
- short var7 = (short)(this.b - this.b() / 2 - 1 - 1);
-
- for(int var8 = 0; var8 < var1.length; var8 += 2) {
- int var6;
- if(var8 + 1 < var1.length) {
- var6 = var1[var8 + 1] & 255;
- } else {
- var6 = 0;
- }
-
- var6 <<= 8;
- var6 |= var1[var8] & 255;
- var4[var7++] = var6;
- }
-
- if(var4[1] != 0 && var4[2] != 0) {
- boolean var9 = false;
- var9 = this.a(var4, this.b - 1);
- if(!var9) {
- return 0;
- } else {
- return var1.length;
- }
- } else {
- return 0;
- }
- }
- }
-
- byte[] a(int var1) {
- boolean var2 = false;
- boolean var3 = false;
- boolean var4 = false;
- byte[] var5 = new byte[var1];
- if(var1 != 0 && var1 <= this.b()) {
- short var6 = (short)(this.b - this.b() / 2 - 1 - 1);
-
- for(int var7 = 0; var7 < var1; var7 += 2) {
- int var10 = this.a(var6++);
- if(var7 + 1 < var5.length) {
- byte var8 = (byte)(var10 & 255);
- var5[var7 + 1] = var8;
- } else {
- var3 = false;
- }
-
- byte var9 = (byte)((var10 & '\uff00') >> 8);
- var5[var7] = var9;
- }
-
- return var5;
- } else {
- return null;
- }
- }
-}
diff --git a/FtcRobotController/app/src/main/java/com/ftdi/j2xx/e.java b/FtcRobotController/app/src/main/java/com/ftdi/j2xx/e.java
deleted file mode 100644
index f48b6ff..0000000
--- a/FtcRobotController/app/src/main/java/com/ftdi/j2xx/e.java
+++ /dev/null
@@ -1,161 +0,0 @@
-//
-// Source code recreated from a .class file by IntelliJ IDEA
-// (powered by Fernflower decompiler)
-//
-
-package com.ftdi.j2xx;
-
-import com.ftdi.j2xx.FT_Device;
-import com.ftdi.j2xx.FT_EEPROM;
-import com.ftdi.j2xx.k;
-
-class e extends k {
- e(FT_Device var1) {
- super(var1);
- }
-
- short a(FT_EEPROM var1) {
- int[] var2 = new int[64];
- if(var1.getClass() != FT_EEPROM.class) {
- return (short)1;
- } else {
- FT_EEPROM var3 = var1;
-
- try {
- var2[1] = var3.VendorId;
- var2[2] = var3.ProductId;
- var2[3] = 512;
- var2[4] = this.a((Object)var1);
- byte var4 = 10;
- int var7 = this.a(var3.Manufacturer, var2, var4, 7, true);
- var7 += var3.Manufacturer.length() + 2;
- var7 = this.a(var3.Product, var2, var7, 8, true);
- var7 += var3.Product.length() + 2;
- if(var3.SerNumEnable) {
- var7 = this.a(var3.SerialNumber, var2, var7, 9, true);
- int var10000 = var7 + var3.SerialNumber.length() + 2;
- }
-
- if(var2[1] != 0 && var2[2] != 0) {
- boolean var5 = false;
- var5 = this.a(var2, 63);
- return (short)(var5?0:1);
- } else {
- return (short)2;
- }
- } catch (Exception var6) {
- var6.printStackTrace();
- return (short)0;
- }
- }
- }
-
- FT_EEPROM a() {
- FT_EEPROM var1 = new FT_EEPROM();
- int[] var2 = new int[64];
-
- try {
- int var3;
- for(var3 = 0; var3 < 64; ++var3) {
- var2[var3] = this.a((short)var3);
- }
-
- var1.VendorId = (short)var2[1];
- var1.ProductId = (short)var2[2];
- this.a(var1, var2[4]);
- byte var5 = 10;
- var1.Manufacturer = this.a(var5, var2);
- var3 = var5 + var1.Manufacturer.length() + 1;
- var1.Product = this.a(var3, var2);
- var3 += var1.Product.length() + 1;
- var1.SerialNumber = this.a(var3, var2);
- return var1;
- } catch (Exception var4) {
- return null;
- }
- }
-
- int b() {
- int var1 = this.a((short)7);
- int var2 = (var1 & '\uff00') >> 8;
- var2 /= 2;
- var1 = this.a((short)8);
- int var3 = (var1 & '\uff00') >> 8;
- var3 /= 2;
- int var4 = 10 + var2 + var3 + 1;
- var1 = this.a((short)9);
- int var5 = (var1 & '\uff00') >> 8;
- var5 /= 2;
- return (63 - var4 - 1 - var5) * 2;
- }
-
- int a(byte[] var1) {
- boolean var2 = false;
- boolean var3 = false;
- if(var1.length > this.b()) {
- return 0;
- } else {
- int[] var4 = new int[64];
-
- for(short var5 = 0; var5 < 64; ++var5) {
- var4[var5] = this.a(var5);
- }
-
- short var7 = (short)(63 - this.b() / 2 - 1);
- var7 = (short)(var7 & '\uffff');
-
- for(int var8 = 0; var8 < var1.length; var8 += 2) {
- int var6;
- if(var8 + 1 < var1.length) {
- var6 = var1[var8 + 1] & 255;
- } else {
- var6 = 0;
- }
-
- var6 <<= 8;
- var6 |= var1[var8] & 255;
- var4[var7++] = var6;
- }
-
- if(var4[1] != 0 && var4[2] != 0) {
- boolean var9 = false;
- var9 = this.a(var4, 63);
- if(!var9) {
- return 0;
- } else {
- return var1.length;
- }
- } else {
- return 0;
- }
- }
- }
-
- byte[] a(int var1) {
- boolean var2 = false;
- boolean var3 = false;
- boolean var4 = false;
- byte[] var5 = new byte[var1];
- if(var1 != 0 && var1 <= this.b() - 1) {
- short var6 = (short)(63 - this.b() / 2 - 1);
- var6 = (short)(var6 & '\uffff');
-
- for(int var7 = 0; var7 < var1; var7 += 2) {
- int var10 = this.a(var6++);
- if(var7 + 1 < var5.length) {
- byte var8 = (byte)(var10 & 255);
- var5[var7 + 1] = var8;
- } else {
- var3 = false;
- }
-
- byte var9 = (byte)((var10 & '\uff00') >> 8);
- var5[var7] = var9;
- }
-
- return var5;
- } else {
- return null;
- }
- }
-}
diff --git a/FtcRobotController/app/src/main/java/com/ftdi/j2xx/f.java b/FtcRobotController/app/src/main/java/com/ftdi/j2xx/f.java
deleted file mode 100644
index 8ff8378..0000000
--- a/FtcRobotController/app/src/main/java/com/ftdi/j2xx/f.java
+++ /dev/null
@@ -1,161 +0,0 @@
-//
-// Source code recreated from a .class file by IntelliJ IDEA
-// (powered by Fernflower decompiler)
-//
-
-package com.ftdi.j2xx;
-
-class f extends k {
- private static FT_Device d;
-
- f(FT_Device var1) {
- super(var1);
- d = var1;
- }
-
- short a(FT_EEPROM var1) {
- int[] var2 = new int[64];
- if(var1.getClass() != FT_EEPROM.class) {
- return (short)1;
- } else {
- FT_EEPROM var3 = var1;
-
- try {
- for(short var4 = 0; var4 < 64; ++var4) {
- var2[var4] = this.a(var4);
- }
-
- var2[1] = var3.VendorId;
- var2[2] = var3.ProductId;
- var2[3] = d.ftDeviceInfoListNode.bcdDevice;
- var2[4] = this.a((Object)var1);
- byte var7 = 10;
- int var8 = this.a(var3.Manufacturer, var2, var7, 7, true);
- var8 = this.a(var3.Product, var2, var8, 8, true);
- if(var3.SerNumEnable) {
- this.a(var3.SerialNumber, var2, var8, 9, true);
- }
-
- if(var2[1] != 0 && var2[2] != 0) {
- boolean var5 = false;
- var5 = this.a(var2, 63);
- return (short)(var5?0:1);
- } else {
- return (short)2;
- }
- } catch (Exception var6) {
- var6.printStackTrace();
- return (short)0;
- }
- }
- }
-
- FT_EEPROM a() {
- FT_EEPROM var1 = new FT_EEPROM();
- int[] var2 = new int[64];
-
- try {
- int var3;
- for(var3 = 0; var3 < 64; ++var3) {
- var2[var3] = this.a((short)var3);
- }
-
- var1.VendorId = (short)var2[1];
- var1.ProductId = (short)var2[2];
- this.a(var1, var2[4]);
- byte var5 = 10;
- var1.Manufacturer = this.a(var5, var2);
- var3 = var5 + var1.Manufacturer.length() + 1;
- var1.Product = this.a(var3, var2);
- var3 += var1.Product.length() + 1;
- var1.SerialNumber = this.a(var3, var2);
- return var1;
- } catch (Exception var4) {
- return null;
- }
- }
-
- int b() {
- int var1 = this.a((short)7);
- int var2 = (var1 & '\uff00') >> 8;
- var2 /= 2;
- var1 = this.a((short)8);
- int var3 = (var1 & '\uff00') >> 8;
- var3 /= 2;
- int var4 = 10 + var2 + var3 + 1;
- var1 = this.a((short)9);
- int var5 = (var1 & '\uff00') >> 8;
- var5 /= 2;
- return (63 - var4 - 1 - var5) * 2;
- }
-
- int a(byte[] var1) {
- boolean var2 = false;
- boolean var3 = false;
- if(var1.length > this.b()) {
- return 0;
- } else {
- int[] var4 = new int[64];
-
- for(short var5 = 0; var5 < 64; ++var5) {
- var4[var5] = this.a(var5);
- }
-
- short var7 = (short)(63 - this.b() / 2 - 1);
- var7 = (short)(var7 & '\uffff');
-
- for(int var8 = 0; var8 < var1.length; var8 += 2) {
- int var6;
- if(var8 + 1 < var1.length) {
- var6 = var1[var8 + 1] & 255;
- } else {
- var6 = 0;
- }
-
- var6 <<= 8;
- var6 |= var1[var8] & 255;
- var4[var7++] = var6;
- }
-
- if(var4[1] != 0 && var4[2] != 0) {
- boolean var9 = false;
- var9 = this.a(var4, 63);
- if(!var9) {
- return 0;
- } else {
- return var1.length;
- }
- } else {
- return 0;
- }
- }
- }
-
- byte[] a(int var1) {
- boolean var2 = false;
- boolean var3 = false;
- boolean var4 = false;
- byte[] var5 = new byte[var1];
- if(var1 != 0 && var1 <= this.b()) {
- short var6 = (short)(63 - this.b() / 2 - 1);
- var6 = (short)(var6 & '\uffff');
-
- for(int var7 = 0; var7 < var1; var7 += 2) {
- int var10 = this.a(var6++);
- if(var7 + 1 < var5.length) {
- byte var8 = (byte)(var10 & 255);
- var5[var7 + 1] = var8;
- } else {
- var3 = false;
- }
-
- byte var9 = (byte)((var10 & '\uff00') >> 8);
- var5[var7] = var9;
- }
-
- return var5;
- } else {
- return null;
- }
- }
-}
diff --git a/FtcRobotController/app/src/main/java/com/ftdi/j2xx/ft4222/FT_4222_Defines.java b/FtcRobotController/app/src/main/java/com/ftdi/j2xx/ft4222/FT_4222_Defines.java
deleted file mode 100644
index 1086652..0000000
--- a/FtcRobotController/app/src/main/java/com/ftdi/j2xx/ft4222/FT_4222_Defines.java
+++ /dev/null
@@ -1,210 +0,0 @@
-package com.ftdi.j2xx.ft4222;
-
-public class FT_4222_Defines {
- public static final int CHIPTOP_DEBUG_REQUEST = 255;
- public static final int CHIPTOP_DEBUG_SET_CHIPTOP_REG = 1;
- public static final int CHIPTOP_DEBUG_SET_OTP_REG = 3;
- public static final int CHIPTOP_DEBUG_SET_SFR = 4;
- public static final int CHIPTOP_DEBUG_SET_USB_REG = 2;
- public static final int DEBUG_REQ_CHIP_STATUS = 0;
- public static final int DEBUG_REQ_READ_CHIPTOP_REG = 1;
- public static final int DEBUG_REQ_READ_OTP_DATA = 5;
- public static final int DEBUG_REQ_READ_OTP_REG = 3;
- public static final int DEBUG_REQ_READ_SFR = 4;
- public static final int DEBUG_REQ_READ_USB_REG = 2;
-
- public class CHIPTOP_CMD {
- public static final int CHIPTOP_DISABLE_BCD_DECTION = 8;
- public static final int CHIPTOP_ENABLE_REMOTE_WAKE_UP = 6;
- public static final int CHIPTOP_ENABLE_SUSPEND_OUT = 7;
- public static final int CHIPTOP_GET_CHIPTOP_REG = 177;
- public static final int CHIPTOP_GET_CLK = 4;
- public static final int CHIPTOP_GET_DESC_STRING = 176;
- public static final int CHIPTOP_GET_MODE = 3;
- public static final int CHIPTOP_GET_OTP_REG = 179;
- public static final int CHIPTOP_GET_OTP_TEST_BYTE = 192;
- public static final int CHIPTOP_GET_SFR = 180;
- public static final int CHIPTOP_GET_STATUS = 1;
- public static final int CHIPTOP_GET_USB_REG = 178;
- public static final int CHIPTOP_GET_USER_DATA_STATUS = 2;
- public static final int CHIPTOP_GET_VERSION = 0;
- public static final int CHIPTOP_RESET = 128;
- public static final int CHIPTOP_SELECT_FUNCTION = 5;
- public static final int CHIPTOP_SET_BCD_DECTION_POLARITY = 9;
- public static final int CHIPTOP_SET_CLK = 4;
- public static final int CHIPTOP_SET_CLK30K_TRIM_REG = 166;
- public static final int CHIPTOP_SET_DS_CTL0_REG = 160;
- public static final int CHIPTOP_SET_DS_CTL1_REG = 161;
- public static final int CHIPTOP_SET_DS_CTL2_REG = 162;
- public static final int CHIPTOP_SET_INTERRUPT_LEVEL = 16;
- public static final int CHIPTOP_SET_OSC_TRIM0_REG = 167;
- public static final int CHIPTOP_SET_OSC_TRIM1_REG = 168;
- public static final int CHIPTOP_SET_PHY_ODT_REG = 170;
- public static final int CHIPTOP_SET_PHY_TXCTL_REG = 169;
- public static final int CHIPTOP_SET_REG_TRIM_REG = 165;
- public static final int CHIPTOP_SET_SR_CTL0_REG = 163;
- public static final int CHIPTOP_SET_SR_CTL1_REG = 164;
- public static final int CHIPTOP_WRITE_OTP_TEST_BYTE = 192;
- }
-
- public class FT4222_ClockRate {
- public static final int SYS_CLK_24 = 1;
- public static final int SYS_CLK_48 = 2;
- public static final int SYS_CLK_60 = 0;
- public static final int SYS_CLK_80 = 3;
- }
-
- public class FT4222_FUNCTION {
- public static final int FT4222_I2C_MASTER = 1;
- public static final int FT4222_I2C_SLAVE = 2;
- public static final int FT4222_SPI_MASTER = 3;
- public static final int FT4222_SPI_SLAVE = 4;
- }
-
- public class FT4222_SPICPHA {
- public static final int CLK_LEADING = 0;
- public static final int CLK_TRAILING = 1;
- }
-
- public class FT4222_SPICPOL {
- public static final int CLK_ACTIVE_HIGH = 1;
- public static final int CLK_ACTIVE_LOW;
- }
-
- public class FT4222_SPIClock {
- public static final int CLK_DIV_128 = 7;
- public static final int CLK_DIV_16 = 4;
- public static final int CLK_DIV_2 = 1;
- public static final int CLK_DIV_256 = 8;
- public static final int CLK_DIV_32 = 5;
- public static final int CLK_DIV_4 = 2;
- public static final int CLK_DIV_512 = 9;
- public static final int CLK_DIV_64 = 6;
- public static final int CLK_DIV_8 = 3;
- public static final int CLK_NONE;
- }
-
- public class FT4222_SPIMode {
- public static final int SPI_IO_DUAL = 2;
- public static final int SPI_IO_NONE = 0;
- public static final int SPI_IO_QUAD = 4;
- public static final int SPI_IO_SINGLE = 1;
- }
-
- public class FT4222_STATUS {
- public static final int FT4222_CLK_NOT_SUPPORTED = 1001;
- public static final int FT4222_DEVICE_LIST_NOT_READY = 19;
- public static final int FT4222_DEVICE_NOT_FOUND = 2;
- public static final int FT4222_DEVICE_NOT_OPENED = 3;
- public static final int FT4222_DEVICE_NOT_OPENED_FOR_ERASE = 8;
- public static final int FT4222_DEVICE_NOT_OPENED_FOR_WRITE = 9;
- public static final int FT4222_DEVICE_NOT_SUPPORTED = 1000;
- public static final int FT4222_EEPROM_ERASE_FAILED = 13;
- public static final int FT4222_EEPROM_NOT_PRESENT = 14;
- public static final int FT4222_EEPROM_NOT_PROGRAMMED = 15;
- public static final int FT4222_EEPROM_READ_FAILED = 11;
- public static final int FT4222_EEPROM_WRITE_FAILED = 12;
- public static final int FT4222_EVENT_NOT_SUPPORTED = 1021;
- public static final int FT4222_EXCEEDED_MAX_TRANSFER_SIZE = 1010;
- public static final int FT4222_FAILED_TO_READ_DEVICE = 1011;
- public static final int FT4222_FAILED_TO_WRITE_DEVICE = 10;
- public static final int FT4222_GPIO_EXCEEDED_MAX_PORTNUM = 1014;
- public static final int FT4222_GPIO_INPUT_NOT_SUPPORTED = 1020;
- public static final int FT4222_GPIO_NOT_SUPPORTED_IN_THIS_MODE = 1013;
- public static final int FT4222_GPIO_OPENDRAIN_INVALID_IN_OUTPUTMODE = 1018;
- public static final int FT4222_GPIO_PULLDOWN_INVALID_IN_INPUTMODE = 1017;
- public static final int FT4222_GPIO_PULLUP_INVALID_IN_INPUTMODE = 1016;
- public static final int FT4222_GPIO_WRITE_NOT_SUPPORTED = 1015;
- public static final int FT4222_I2C_NOT_SUPPORTED_IN_THIS_MODE = 1012;
- public static final int FT4222_INSUFFICIENT_RESOURCES = 5;
- public static final int FT4222_INTERRUPT_NOT_SUPPORTED = 1019;
- public static final int FT4222_INVAILD_FUNCTION = 1008;
- public static final int FT4222_INVALID_ARGS = 16;
- public static final int FT4222_INVALID_BAUD_RATE = 7;
- public static final int FT4222_INVALID_HANDLE = 1;
- public static final int FT4222_INVALID_PARAMETER = 6;
- public static final int FT4222_INVALID_POINTER = 1009;
- public static final int FT4222_IO_ERROR = 4;
- public static final int FT4222_IS_NOT_I2C_MODE = 1004;
- public static final int FT4222_IS_NOT_SPI_MODE = 1003;
- public static final int FT4222_IS_NOT_SPI_MULTI_MODE = 1006;
- public static final int FT4222_IS_NOT_SPI_SINGLE_MODE = 1005;
- public static final int FT4222_NOT_SUPPORTED = 17;
- public static final int FT4222_OK = 0;
- public static final int FT4222_OTHER_ERROR = 18;
- public static final int FT4222_VENDER_CMD_NOT_SUPPORTED = 1002;
- public static final int FT4222_WRONG_I2C_ADDR = 1007;
- }
-
- public class GPIO_Dir {
- public static final int GPIO_INPUT = 0;
- public static final int GPIO_OUTPUT = 1;
- }
-
- public class GPIO_Output {
- public static final int GPIO_OUTPUT_HIGH = 1;
- public static final int GPIO_OUTPUT_LOW;
- }
-
- public class GPIO_Port {
- public static final int GPIO_PORT0 = 0;
- public static final int GPIO_PORT1 = 1;
- public static final int GPIO_PORT2 = 2;
- public static final int GPIO_PORT3 = 3;
- }
-
- public class GPIO_Tigger {
- public static final int GPIO_TRIGGER_FALLING = 2;
- public static final int GPIO_TRIGGER_LEVEL_HIGH = 4;
- public static final int GPIO_TRIGGER_LEVEL_LOW = 8;
- public static final int GPIO_TRIGGER_RISING = 1;
- }
-
- public class I2C_CMD {
- public static final int I2C_MASTER_GET_HS = 83;
- public static final int I2C_MASTER_GET_I2CMTP = 82;
- public static final int I2C_MASTER_GET_STATUS = 80;
- public static final int I2C_MASTER_RESET = 81;
- public static final int I2C_MASTER_SET_HS = 83;
- public static final int I2C_MASTER_SET_I2CMTP = 82;
- public static final int I2C_SLAVE_GET_I2CSADR = 92;
- public static final int I2C_SLAVE_GET_STATUS = 90;
- public static final int I2C_SLAVE_RESET = 91;
- public static final int I2C_SLAVE_SET_I2CSADR = 92;
- }
-
- public class SPI_CMD {
- public static final int SPI_GET_CONFIG = 64;
- public static final int SPI_GET_STATUS = 65;
- public static final int SPI_SET_CLK = 68;
- public static final int SPI_SET_CPHA = 70;
- public static final int SPI_SET_CPOL = 69;
- public static final int SPI_SET_IO = 66;
- public static final int SPI_SET_RESET_TRANSACTION = 73;
- public static final int SPI_SET_RESTART_CONTROLLER = 74;
- public static final int SPI_SET_SLAVE_MAP = 72;
- public static final int SPI_SET_SS = 67;
- public static final int SPI_SET_TURBO = 71;
- }
-
- public class SPI_DrivingStrength {
- public static final int DS_12MA = 2;
- public static final int DS_16MA = 3;
- public static final int DS_4MA = 0;
- public static final int DS_8MA = 1;
- }
-
- public class SPI_SLAVE_CMD {
- public static final int FT4222_SPI_SLAVE_SYNC_WORD = 90;
- public static final int SPI_ACK = 132;
- public static final int SPI_MASTER_TRANSFER = 128;
- public static final int SPI_SHART_SLAVE_TRANSFER = 131;
- public static final int SPI_SHORT_MASTER_TRANSFER = 130;
- public static final int SPI_SLAVE_TRANSFER = 129;
- }
-
- public class SPI_SS {
- public static final int SPI_SS_NEGTIVE = 0;
- public static final int SPI_SS_POSITIVE = 1;
- }
-}
diff --git a/FtcRobotController/app/src/main/java/com/ftdi/j2xx/ft4222/FT_4222_Device.java b/FtcRobotController/app/src/main/java/com/ftdi/j2xx/ft4222/FT_4222_Device.java
deleted file mode 100644
index 70e04fd..0000000
--- a/FtcRobotController/app/src/main/java/com/ftdi/j2xx/ft4222/FT_4222_Device.java
+++ /dev/null
@@ -1,129 +0,0 @@
-package com.ftdi.j2xx.ft4222;
-
-import com.ftdi.j2xx.FT_Device;
-import com.ftdi.j2xx.ft4222.FT_4222_Gpio;
-import com.ftdi.j2xx.ft4222.FT_4222_I2c_Master;
-import com.ftdi.j2xx.ft4222.FT_4222_I2c_Slave;
-import com.ftdi.j2xx.ft4222.FT_4222_Spi_Master;
-import com.ftdi.j2xx.ft4222.FT_4222_Spi_Slave;
-import com.ftdi.j2xx.ft4222.a;
-import com.ftdi.j2xx.ft4222.b;
-import com.ftdi.j2xx.ft4222.e;
-import com.ftdi.j2xx.interfaces.Gpio;
-import com.ftdi.j2xx.interfaces.I2cMaster;
-import com.ftdi.j2xx.interfaces.I2cSlave;
-import com.ftdi.j2xx.interfaces.SpiMaster;
-import com.ftdi.j2xx.interfaces.SpiSlave;
-
-public class FT_4222_Device {
- protected String TAG = "FT4222";
- protected b mChipStatus;
- protected FT_Device mFtDev;
- protected e mGpio;
- protected a mSpiMasterCfg;
-
- public FT_4222_Device(FT_Device var1) {
- this.mFtDev = var1;
- this.mChipStatus = new b();
- this.mSpiMasterCfg = new a();
- this.mGpio = new e();
- }
-
- public boolean cleanRxData() {
- int var1 = this.mFtDev.getQueueStatus();
- if(var1 > 0) {
- byte[] var2 = new byte[var1];
- if(this.mFtDev.read(var2, var1) != var2.length) {
- return false;
- }
- }
-
- return true;
- }
-
- public int getClock(byte[] var1) {
- if(this.mFtDev.VendorCmdGet(32, 4, var1, 1) >= 0) {
- this.mChipStatus.f = var1[0];
- return 0;
- } else {
- return 18;
- }
- }
-
- public Gpio getGpioDevice() {
- return !this.isFT4222Device()?null:new FT_4222_Gpio(this);
- }
-
- public I2cMaster getI2cMasterDevice() {
- return !this.isFT4222Device()?null:new FT_4222_I2c_Master(this);
- }
-
- public I2cSlave getI2cSlaveDevice() {
- return !this.isFT4222Device()?null:new FT_4222_I2c_Slave(this);
- }
-
- protected int getMaxBuckSize() {
- if(this.mChipStatus.c != 0) {
- return 64;
- } else {
- switch(this.mChipStatus.a) {
- case 1:
- case 2:
- return 256;
- default:
- return 512;
- }
- }
- }
-
- public SpiMaster getSpiMasterDevice() {
- return !this.isFT4222Device()?null:new FT_4222_Spi_Master(this);
- }
-
- public SpiSlave getSpiSlaveDevice() {
- return !this.isFT4222Device()?null:new FT_4222_Spi_Slave(this);
- }
-
- public int init() {
- byte[] var1 = new byte[13];
- if(this.mFtDev.VendorCmdGet(32, 1, var1, 13) != 13) {
- return 18;
- } else {
- this.mChipStatus.a(var1);
- return 0;
- }
- }
-
- public boolean isFT4222Device() {
- if(this.mFtDev != null) {
- switch(65280 & this.mFtDev.getDeviceInfo().bcdDevice) {
- case 5888:
- this.mFtDev.getDeviceInfo().type = 12;
- return true;
- case 6144:
- this.mFtDev.getDeviceInfo().type = 10;
- return true;
- case 6400:
- this.mFtDev.getDeviceInfo().type = 11;
- return true;
- }
- }
-
- return false;
- }
-
- public int setClock(byte var1) {
- int var2;
- if(var1 == this.mChipStatus.f) {
- var2 = 0;
- } else {
- var2 = this.mFtDev.VendorCmdSet(33, 4 | var1 << 8);
- if(var2 == 0) {
- this.mChipStatus.f = var1;
- return var2;
- }
- }
-
- return var2;
- }
-}
diff --git a/FtcRobotController/app/src/main/java/com/ftdi/j2xx/ft4222/FT_4222_Gpio.java b/FtcRobotController/app/src/main/java/com/ftdi/j2xx/ft4222/FT_4222_Gpio.java
deleted file mode 100644
index ceeda44..0000000
--- a/FtcRobotController/app/src/main/java/com/ftdi/j2xx/ft4222/FT_4222_Gpio.java
+++ /dev/null
@@ -1,226 +0,0 @@
-package com.ftdi.j2xx.ft4222;
-
-import android.util.Log;
-import com.ftdi.j2xx.FT_Device;
-import com.ftdi.j2xx.ft4222.FT_4222_Device;
-import com.ftdi.j2xx.ft4222.b;
-import com.ftdi.j2xx.ft4222.d;
-import com.ftdi.j2xx.ft4222.e;
-import com.ftdi.j2xx.interfaces.Gpio;
-
-public class FT_4222_Gpio implements Gpio {
- boolean a = true;
- private FT_4222_Device b;
- private FT_Device c;
-
- public FT_4222_Gpio(FT_4222_Device var1) {
- this.b = var1;
- this.c = this.b.mFtDev;
- }
-
- int a(int var1) {
- b var2 = this.b.mChipStatus;
- return var2.a != 2 && var2.a != 3?(var1 >= 4?1014:0):1013;
- }
-
- int a(d var1) {
- byte[] var2 = new byte[8];
- int var3 = this.cmdGet(32, 0, var2, 8);
- var1.a.a = var2[0];
- var1.a.b = var2[1];
- var1.b = var2[5];
- var1.c = var2[6];
- var1.d[0] = var2[7];
- return var3 == 8?0:var3;
- }
-
- void a(int var1, byte var2, boolean[] var3) {
- var3[0] = this.d(1 & (var2 & 1 << var1) >> var1);
- }
-
- boolean b(int var1) {
- byte var2 = 1;
- b var3 = this.b.mChipStatus;
- switch(var3.a) {
- case 0:
- if((var1 == 0 || var1 == var2) && (var3.g == var2 || var3.g == 2)) {
- var2 = 0;
- }
-
- if(this.d(var3.i) && var1 == 2) {
- var2 = 0;
- }
-
- if(this.d(var3.j) && var1 == 3) {
- return false;
- }
- break;
- case 1:
- if(var1 == 0 || var1 == var2) {
- var2 = 0;
- }
-
- if(this.d(var3.i) && var1 == 2) {
- var2 = 0;
- }
-
- if(this.d(var3.j) && var1 == 3) {
- return false;
- }
- break;
- case 2:
- case 3:
- return false;
- }
-
- return (boolean)var2;
- }
-
- boolean c(int var1) {
- d var2 = new d();
- boolean var3 = this.b(var1);
- this.a(var2);
- if(var3 && (1 & var2.c >> var1) != 1) {
- var3 = false;
- }
-
- return var3;
- }
-
- public int cmdGet(int var1, int var2, byte[] var3, int var4) {
- return this.c.VendorCmdGet(32, var1 | var2 << 8, var3, var4);
- }
-
- public int cmdSet(int var1, int var2) {
- return this.c.VendorCmdSet(33, var1 | var2 << 8);
- }
-
- public int cmdSet(int var1, int var2, byte[] var3, int var4) {
- return this.c.VendorCmdSet(33, var1 | var2 << 8, var3, var4);
- }
-
- boolean d(int var1) {
- return var1 != 0;
- }
-
- public int init(int[] var1) {
- b var2 = this.b.mChipStatus;
- d var3 = new d();
- byte[] var4 = new byte[1];
- e var5 = new e();
- this.cmdSet(7, 0);
- this.cmdSet(6, 0);
- int var8 = this.b.init();
- if(var8 != 0) {
- Log.e("GPIO_M", "FT4222_GPIO init - 1 NG ftStatus:" + var8);
- return var8;
- } else if(var2.a != 2 && var2.a != 3) {
- this.a(var3);
- byte var10 = var3.c;
- var4[0] = var3.d[0];
-
- for(int var11 = 0; var11 < 4; ++var11) {
- if(var1[var11] == 1) {
- var10 = (byte)(15 & (var10 | 1 << var11));
- } else {
- var10 = (byte)(15 & var10 & ~(1 << var11));
- }
- }
-
- var5.c = var4[0];
- this.cmdSet(33, var10);
- return 0;
- } else {
- return 1013;
- }
- }
-
- public int newRead(int var1, boolean[] var2) {
- int var3 = this.a(var1);
- if(var3 != 0) {
- return var3;
- } else {
- int var4 = this.c.getQueueStatus();
- if(var4 > 0) {
- byte[] var5 = new byte[var4];
- this.c.read(var5, var4);
- this.a(var1, var5[var4 - 1], var2);
- return var4;
- } else {
- return -1;
- }
- }
- }
-
- public int newWrite(int var1, boolean var2) {
- d var3 = new d();
- int var4 = this.a(var1);
- if(var4 != 0) {
- return var4;
- } else if(!this.c(var1)) {
- return 1015;
- } else {
- this.a(var3);
- if(var2) {
- byte[] var12 = var3.d;
- var12[0] = (byte)(var12[0] | 1 << var1);
- } else {
- byte[] var6 = var3.d;
- var6[0] = (byte)(var6[0] & 15 & ~(1 << var1));
- }
-
- if(this.a) {
- byte[] var11 = var3.d;
- var11[0] = (byte)(8 | var11[0]);
- } else {
- byte[] var7 = var3.d;
- var7[0] = (byte)(7 & var7[0]);
- }
-
- int var8 = this.c.write(var3.d, 1);
- boolean var9 = this.a;
- boolean var10 = false;
- if(!var9) {
- var10 = true;
- }
-
- this.a = var10;
- return var8;
- }
- }
-
- public int read(int var1, boolean[] var2) {
- d var3 = new d();
- int var4 = this.a(var1);
- if(var4 == 0) {
- var4 = this.a(var3);
- if(var4 == 0) {
- this.a(var1, var3.d[0], var2);
- return 0;
- }
- }
-
- return var4;
- }
-
- public int write(int var1, boolean var2) {
- d var3 = new d();
- int var4 = this.a(var1);
- if(var4 != 0) {
- return var4;
- } else if(!this.c(var1)) {
- return 1015;
- } else {
- this.a(var3);
- if(var2) {
- byte[] var7 = var3.d;
- var7[0] = (byte)(var7[0] | 1 << var1);
- } else {
- byte[] var6 = var3.d;
- var6[0] = (byte)(var6[0] & 15 & ~(1 << var1));
- }
-
- return this.c.write(var3.d, 1);
- }
- }
-}
diff --git a/FtcRobotController/app/src/main/java/com/ftdi/j2xx/ft4222/FT_4222_I2c_Master.java b/FtcRobotController/app/src/main/java/com/ftdi/j2xx/ft4222/FT_4222_I2c_Master.java
deleted file mode 100644
index a8b7026..0000000
--- a/FtcRobotController/app/src/main/java/com/ftdi/j2xx/ft4222/FT_4222_I2c_Master.java
+++ /dev/null
@@ -1,217 +0,0 @@
-package com.ftdi.j2xx.ft4222;
-
-import com.ftdi.j2xx.FT_Device;
-import com.ftdi.j2xx.ft4222.FT_4222_Device;
-import com.ftdi.j2xx.interfaces.I2cMaster;
-
-public class FT_4222_I2c_Master implements I2cMaster {
- FT_4222_Device a;
- FT_Device b;
- int c;
-
- public FT_4222_I2c_Master(FT_4222_Device var1) {
- this.a = var1;
- this.b = this.a.mFtDev;
- }
-
- private int a(int var1, int var2) {
- double var3;
- switch(var1) {
- case 1:
- var3 = 41.666666666666664D;
- break;
- case 2:
- var3 = 20.833333333333332D;
- break;
- case 3:
- var3 = 12.5D;
- break;
- default:
- var3 = 16.666666666666668D;
- }
-
- if(60 <= var2 && var2 <= 100) {
- int var5 = (int)(0.5D + (1000000.0D / (double)var2 / (var3 * 8.0D) - 1.0D));
- if(var5 > 127) {
- var5 = 127;
- }
-
- return var5;
- } else {
- return 100 < var2 && var2 <= 400?192 | (int)(0.5D + (1000000.0D / (double)var2 / (var3 * 6.0D) - 1.0D)):(400 < var2 && var2 <= 1000?192 | (int)(0.5D + (1000000.0D / (double)var2 / (var3 * 6.0D) - 1.0D)):(1000 < var2 && var2 <= 3400?-65 & (128 | (int)(0.5D + (1000000.0D / (double)var2 / (var3 * 6.0D) - 1.0D))):74));
- }
- }
-
- int a(int var1) {
- return ('ﰀ' & var1) > 0?1007:0;
- }
-
- int a(boolean var1) {
- if(var1) {
- if(this.a.mChipStatus.g != 1) {
- return 1004;
- }
- } else if(this.a.mChipStatus.g != 2) {
- return 1004;
- }
-
- return 0;
- }
-
- int a(int[] var1) {
- var1[0] = 0;
- int var2 = this.a.getMaxBuckSize();
- switch(this.a.mChipStatus.g) {
- case 1:
- var1[0] = var2 - 4;
- return 0;
- default:
- return 17;
- }
- }
-
- boolean a() {
- return this.a.mChipStatus.a == 0 || this.a.mChipStatus.a == 3;
- }
-
- public int cmdGet(int var1, int var2, byte[] var3, int var4) {
- return this.b.VendorCmdGet(32, var1 | var2 << 8, var3, var4);
- }
-
- public int cmdSet(int var1, int var2) {
- return this.b.VendorCmdSet(33, var1 | var2 << 8);
- }
-
- public int cmdSet(int var1, int var2, byte[] var3, int var4) {
- return this.b.VendorCmdSet(33, var1 | var2 << 8, var3, var4);
- }
-
- public int init(int var1) {
- byte[] var2 = new byte[1];
- int var3 = this.a.init();
- if(var3 == 0) {
- if(!this.a()) {
- return 1012;
- }
-
- this.cmdSet(81, 0);
- var3 = this.a.getClock(var2);
- if(var3 == 0) {
- int var5 = this.a(var2[0], var1);
- var3 = this.cmdSet(5, 1);
- if(var3 >= 0) {
- this.a.mChipStatus.g = 1;
- var3 = this.cmdSet(82, var5);
- if(var3 >= 0) {
- this.c = var1;
- return 0;
- }
- }
- }
- }
-
- return var3;
- }
-
- public int read(int var1, byte[] var2, int var3, int[] var4) {
- short var5 = (short)('\uffff' & var1);
- short var6 = (short)((var1 & 896) >> 7);
- short var7 = (short)var3;
- int[] var8 = new int[1];
- byte[] var9 = new byte[4];
- long var10 = System.currentTimeMillis();
- int var12 = this.b.getReadTimeout();
- int var13 = this.a(var1);
- if(var13 == 0) {
- if(var3 < 1) {
- return 6;
- }
-
- var13 = this.a(true);
- if(var13 == 0) {
- var13 = this.a(var8);
- if(var13 == 0) {
- if(var3 > var8[0]) {
- return 1010;
- }
-
- var4[0] = 0;
- var9[0] = (byte)((short)(1 + (var5 << 1)));
- var9[1] = (byte)var6;
- var9[2] = (byte)(255 & var7 >> 8);
- var9[3] = (byte)(var7 & 255);
- if(4 != this.b.write(var9, 4)) {
- return 1011;
- }
-
- int var14;
- for(var14 = this.b.getQueueStatus(); var14 < var3 && System.currentTimeMillis() - var10 < (long)var12; var14 = this.b.getQueueStatus()) {
- ;
- }
-
- if(var14 <= var3) {
- var3 = var14;
- }
-
- int var15 = this.b.read(var2, var3);
- var4[0] = var15;
- if(var15 >= 0) {
- return 0;
- }
-
- return 1011;
- }
- }
- }
-
- return var13;
- }
-
- public int reset() {
- int var1 = this.a(true);
- return var1 != 0?var1:this.cmdSet(81, 1);
- }
-
- public int write(int var1, byte[] var2, int var3, int[] var4) {
- short var5 = (short)var1;
- short var6 = (short)((var1 & 896) >> 7);
- short var7 = (short)var3;
- byte[] var8 = new byte[var3 + 4];
- int[] var9 = new int[1];
- int var10 = this.a(var1);
- if(var10 == 0) {
- if(var3 < 1) {
- return 6;
- }
-
- var10 = this.a(true);
- if(var10 == 0) {
- var10 = this.a(var9);
- if(var10 == 0) {
- if(var3 > var9[0]) {
- return 1010;
- }
-
- var4[0] = 0;
- var8[0] = (byte)((short)(var5 << 1));
- var8[1] = (byte)var6;
- var8[2] = (byte)(255 & var7 >> 8);
- var8[3] = (byte)(var7 & 255);
-
- for(int var11 = 0; var11 < var3; ++var11) {
- var8[var11 + 4] = var2[var11];
- }
-
- var4[0] = -4 + this.b.write(var8, var3 + 4);
- if(var3 == var4[0]) {
- return 0;
- }
-
- return 10;
- }
- }
- }
-
- return var10;
- }
-}
diff --git a/FtcRobotController/app/src/main/java/com/ftdi/j2xx/ft4222/FT_4222_I2c_Slave.java b/FtcRobotController/app/src/main/java/com/ftdi/j2xx/ft4222/FT_4222_I2c_Slave.java
deleted file mode 100644
index 6f43837..0000000
--- a/FtcRobotController/app/src/main/java/com/ftdi/j2xx/ft4222/FT_4222_I2c_Slave.java
+++ /dev/null
@@ -1,166 +0,0 @@
-package com.ftdi.j2xx.ft4222;
-
-import com.ftdi.j2xx.FT_Device;
-import com.ftdi.j2xx.ft4222.FT_4222_Device;
-import com.ftdi.j2xx.interfaces.I2cSlave;
-
-public class FT_4222_I2c_Slave implements I2cSlave {
- FT_4222_Device a;
- FT_Device b;
-
- public FT_4222_I2c_Slave(FT_4222_Device var1) {
- this.a = var1;
- this.b = this.a.mFtDev;
- }
-
- int a(boolean var1) {
- if(var1) {
- if(this.a.mChipStatus.g != 1) {
- return 1004;
- }
- } else if(this.a.mChipStatus.g != 2) {
- return 1004;
- }
-
- return 0;
- }
-
- int a(int[] var1) {
- var1[0] = 0;
- int var2 = this.a.getMaxBuckSize();
- switch(this.a.mChipStatus.g) {
- case 2:
- var1[0] = var2 - 4;
- return 0;
- default:
- return 17;
- }
- }
-
- boolean a() {
- return this.a.mChipStatus.a == 0 || this.a.mChipStatus.a == 3;
- }
-
- public int cmdGet(int var1, int var2, byte[] var3, int var4) {
- return this.b.VendorCmdGet(32, var1 | var2 << 8, var3, var4);
- }
-
- public int cmdSet(int var1, int var2) {
- return this.b.VendorCmdSet(33, var1 | var2 << 8);
- }
-
- public int cmdSet(int var1, int var2, byte[] var3, int var4) {
- return this.b.VendorCmdSet(33, var1 | var2 << 8, var3, var4);
- }
-
- public int getAddress(int[] var1) {
- byte[] var2 = new byte[1];
- int var3 = this.a(false);
- if(var3 != 0) {
- return var3;
- } else if(this.b.VendorCmdGet(33, 92, var2, 1) < 0) {
- return 18;
- } else {
- var1[0] = var2[0];
- return 0;
- }
- }
-
- public int init() {
- int var1 = this.a.init();
- if(var1 == 0) {
- if(!this.a()) {
- return 1012;
- }
-
- var1 = this.cmdSet(5, 2);
- if(var1 >= 0) {
- this.a.mChipStatus.g = 2;
- return 0;
- }
- }
-
- return var1;
- }
-
- public int read(byte[] var1, int var2, int[] var3) {
- int[] var4 = new int[1];
- long var5 = System.currentTimeMillis();
- int var7 = this.b.getReadTimeout();
- int var8;
- if(var2 < 1) {
- var8 = 6;
- } else {
- var8 = this.a(false);
- if(var8 == 0) {
- var8 = this.a(var4);
- if(var8 == 0) {
- if(var2 > var4[0]) {
- return 1010;
- }
-
- var3[0] = 0;
-
- int var9;
- for(var9 = this.b.getQueueStatus(); var9 < var2 && System.currentTimeMillis() - var5 < (long)var7; var9 = this.b.getQueueStatus()) {
- ;
- }
-
- if(var9 <= var2) {
- var2 = var9;
- }
-
- int var10 = this.b.read(var1, var2);
- if(var10 < 0) {
- return 1011;
- }
-
- var3[0] = var10;
- return 0;
- }
- }
- }
-
- return var8;
- }
-
- public int reset() {
- int var1 = this.a(false);
- return var1 != 0?var1:this.cmdSet(91, 1);
- }
-
- public int setAddress(int var1) {
- byte[] var2 = new byte[]{(byte)(var1 & 255)};
- int var3 = this.a(false);
- return var3 != 0?var3:(this.cmdSet(92, var2[0]) < 0?18:0);
- }
-
- public int write(byte[] var1, int var2, int[] var3) {
- int[] var4 = new int[1];
- int var5;
- if(var2 < 1) {
- var5 = 6;
- } else {
- var5 = this.a(false);
- if(var5 == 0) {
- var5 = this.a(var4);
- if(var5 == 0) {
- if(var2 > var4[0]) {
- return 1010;
- }
-
- var3[0] = 0;
- int var6 = this.b.write(var1, var2);
- var3[0] = var6;
- if(var2 == var6) {
- return 0;
- }
-
- return 10;
- }
- }
- }
-
- return var5;
- }
-}
diff --git a/FtcRobotController/app/src/main/java/com/ftdi/j2xx/ft4222/FT_4222_Spi_Master.java b/FtcRobotController/app/src/main/java/com/ftdi/j2xx/ft4222/FT_4222_Spi_Master.java
deleted file mode 100644
index e64ea2d..0000000
--- a/FtcRobotController/app/src/main/java/com/ftdi/j2xx/ft4222/FT_4222_Spi_Master.java
+++ /dev/null
@@ -1,367 +0,0 @@
-package com.ftdi.j2xx.ft4222;
-
-import android.util.Log;
-import com.ftdi.j2xx.FT_Device;
-import com.ftdi.j2xx.ft4222.FT_4222_Device;
-import com.ftdi.j2xx.ft4222.a;
-import com.ftdi.j2xx.ft4222.b;
-import com.ftdi.j2xx.interfaces.SpiMaster;
-import junit.framework.Assert;
-
-public class FT_4222_Spi_Master implements SpiMaster {
- private FT_4222_Device a;
- private FT_Device b;
-
- public FT_4222_Spi_Master(FT_4222_Device var1) {
- this.a = var1;
- this.b = var1.mFtDev;
- }
-
- private int a(FT_Device var1, byte[] var2, byte[] var3) {
- int var4;
- if(var1 != null && var1.isOpen()) {
- var1.write(var2, var2.length);
- var4 = 0;
- int var6 = 0;
-
- while(var4 < var3.length && var6 < 30000) {
- int var8 = var1.getQueueStatus();
- if(var8 > 0) {
- byte[] var12 = new byte[var8];
- int var13 = var1.read(var12, var8);
- boolean var14;
- if(var12.length == var13) {
- var14 = true;
- } else {
- var14 = false;
- }
-
- Assert.assertEquals(var14, true);
-
- for(int var15 = 0; var15 < var12.length; ++var15) {
- if(var4 + var15 < var3.length) {
- var3[var4 + var15] = var12[var15];
- }
- }
-
- var4 += var13;
- var6 = 0;
- }
-
- long var9 = (long)10;
-
- try {
- Thread.sleep(var9);
- } catch (InterruptedException var16) {
- var6 = 30000;
- continue;
- }
-
- var6 += 10;
- }
-
- if(var3.length != var4 || var6 > 30000) {
- Log.e("FTDI_Device::", "MultiReadWritePackage timeout!!!!");
- return -1;
- }
- } else {
- var4 = -1;
- }
-
- return var4;
- }
-
- private int a(FT_Device var1, byte[] var2, byte[] var3, int var4) {
- byte[] var5 = new byte[16384];
- byte[] var6 = new byte[var5.length];
- int var7 = var4 / var5.length;
- int var8 = var4 % var5.length;
- int var9 = 0;
- int var10 = 0;
-
- int var11;
- int var12;
- for(var11 = 0; var9 < var7; var10 = var12) {
- var12 = var10;
-
- for(int var13 = 0; var13 < var5.length; ++var13) {
- var5[var13] = var2[var12];
- ++var12;
- }
-
- if(this.b(var1, var5, var6) <= 0) {
- return -1;
- }
-
- for(int var14 = 0; var14 < var6.length; ++var14) {
- var3[var11] = var6[var14];
- ++var11;
- }
-
- ++var9;
- }
-
- if(var8 > 0) {
- byte[] var15 = new byte[var8];
- byte[] var16 = new byte[var15.length];
- int var17 = var10;
-
- for(int var18 = 0; var18 < var15.length; ++var18) {
- var15[var18] = var2[var17];
- ++var17;
- }
-
- int var19 = this.b(var1, var15, var16);
- int var20 = 0;
- if(var19 > 0) {
- while(var20 < var16.length) {
- var3[var11] = var16[var20];
- ++var11;
- ++var20;
- }
-
- return var11;
- }
-
- var11 = -1;
- }
-
- return var11;
- }
-
- private int b(FT_Device var1, byte[] var2, byte[] var3) {
- int var4;
- if(var1 != null && var1.isOpen()) {
- boolean var5;
- if(var2.length == var3.length) {
- var5 = true;
- } else {
- var5 = false;
- }
-
- Assert.assertEquals(var5, true);
- int var6 = var1.write(var2, var2.length);
- if(var2.length != var6) {
- Log.e("FTDI_Device::", "setReadWritePackage Incomplete Write Error!!!");
- return -1;
- }
-
- var4 = 0;
- int var7 = 0;
-
- while(var4 < var3.length && var7 < 30000) {
- int var9 = var1.getQueueStatus();
- if(var9 > 0) {
- byte[] var13 = new byte[var9];
- int var14 = var1.read(var13, var9);
- boolean var15;
- if(var13.length == var14) {
- var15 = true;
- } else {
- var15 = false;
- }
-
- Assert.assertEquals(var15, true);
-
- for(int var16 = 0; var16 < var13.length; ++var16) {
- if(var4 + var16 < var3.length) {
- var3[var4 + var16] = var13[var16];
- }
- }
-
- var4 += var14;
- var7 = 0;
- }
-
- long var10 = (long)10;
-
- try {
- Thread.sleep(var10);
- } catch (InterruptedException var17) {
- var7 = 30000;
- continue;
- }
-
- var7 += 10;
- }
-
- if(var3.length != var4 || var7 > 30000) {
- Log.e("FTDI_Device::", "SingleReadWritePackage timeout!!!!");
- return -1;
- }
- } else {
- var4 = -1;
- }
-
- return var4;
- }
-
- public int init(int var1, int var2, int var3, int var4, byte var5) {
- byte var6 = 1;
- b var7 = this.a.mChipStatus;
- a var8 = this.a.mSpiMasterCfg;
- var8.a = var1;
- var8.b = var2;
- var8.c = var3;
- var8.d = var4;
- var8.e = var5;
- if(var8.a != var6 && var8.a != 2 && var8.a != 4) {
- return 6;
- } else {
- this.a.cleanRxData();
- switch(var7.a) {
- case 0:
- case 3:
- break;
- case 1:
- var6 = 7;
- break;
- case 2:
- var6 = 15;
- break;
- default:
- var6 = 0;
- }
-
- if((var6 & var8.e) == 0) {
- return 6;
- } else {
- var8.e &= var6;
- if(this.b.VendorCmdSet(33, 66 | var8.a << 8) < 0) {
- return 4;
- } else if(this.b.VendorCmdSet(33, 68 | var8.b << 8) < 0) {
- return 4;
- } else if(this.b.VendorCmdSet(33, 69 | var8.c << 8) < 0) {
- return 4;
- } else if(this.b.VendorCmdSet(33, 70 | var8.d << 8) < 0) {
- return 4;
- } else if(this.b.VendorCmdSet(33, 67) < 0) {
- return 4;
- } else if(this.b.VendorCmdSet(33, 72 | var8.e << 8) < 0) {
- return 4;
- } else if(this.b.VendorCmdSet(33, 773) < 0) {
- return 4;
- } else {
- var7.g = 3;
- return 0;
- }
- }
- }
- }
-
- public int multiReadWrite(byte[] var1, byte[] var2, int var3, int var4, int var5, int[] var6) {
- b var7 = this.a.mChipStatus;
- a var8 = this.a.mSpiMasterCfg;
- if((var5 <= 0 || var1 != null) && (var3 + var4 <= 0 || var2 != null) && (var5 <= 0 || var6 != null)) {
- if(var7.g == 3 && var8.a != 1) {
- if(var3 > 15) {
- Log.e("FTDI_Device::", "The maxium single write bytes are 15 bytes");
- return 6;
- } else {
- byte[] var9 = new byte[var4 + var3 + 5];
- var9[0] = (byte)(128 | var3 & 15);
- var9[1] = (byte)((var4 & '\uff00') >> 8);
- var9[2] = (byte)(var4 & 255);
- var9[3] = (byte)((var5 & '\uff00') >> 8);
- var9[4] = (byte)(var5 & 255);
-
- for(int var10 = 0; var10 < var3 + var4; ++var10) {
- var9[var10 + 5] = var2[var10];
- }
-
- var6[0] = this.a(this.b, var9, var1);
- return 0;
- }
- } else {
- return 1006;
- }
- } else {
- return 1009;
- }
- }
-
- public int reset() {
- return this.b.VendorCmdSet(33, 74) < 0?4:0;
- }
-
- public int setDrivingStrength(int var1, int var2, int var3) {
- short var4 = 3;
- short var5 = 4;
- b var6 = this.a.mChipStatus;
- if(var6.g != var4 && var6.g != var5) {
- var5 = 1003;
- } else {
- int var7 = var3 | var1 << 4 | var2 << 2;
- if(var6.g != var4) {
- var4 = var5;
- }
-
- if(this.b.VendorCmdSet(33, 160 | var7 << 8) >= 0 && this.b.VendorCmdSet(33, 5 | var4 << 8) >= 0) {
- return 0;
- }
- }
-
- return var5;
- }
-
- public int setLines(int var1) {
- short var2 = 4;
- if(this.a.mChipStatus.g != 3) {
- var2 = 1003;
- } else {
- if(var1 == 0) {
- return 17;
- }
-
- if(this.b.VendorCmdSet(33, 66 | var1 << 8) >= 0 && this.b.VendorCmdSet(33, 330) >= 0) {
- this.a.mSpiMasterCfg.a = var1;
- return 0;
- }
- }
-
- return var2;
- }
-
- public int singleRead(byte[] var1, int var2, int[] var3, boolean var4) {
- return this.singleReadWrite(var1, new byte[var1.length], var2, var3, var4);
- }
-
- public int singleReadWrite(byte[] var1, byte[] var2, int var3, int[] var4, boolean var5) {
- b var6 = this.a.mChipStatus;
- a var7 = this.a.mSpiMasterCfg;
- short var8;
- if(var2 != null && var1 != null && var4 != null) {
- var4[0] = 0;
- if(var6.g != 3 || var7.a != 1) {
- return 1005;
- }
-
- if(var3 == 0) {
- return 6;
- }
-
- if(var3 > var2.length || var3 > var1.length) {
- Assert.assertTrue("sizeToTransfer > writeBuffer.length || sizeToTransfer > readBuffer.length", false);
- }
-
- if(var2.length != var1.length || var2.length == 0) {
- Assert.assertTrue("writeBuffer.length != readBuffer.length || writeBuffer.length == 0", false);
- }
-
- var4[0] = this.a(this.b, var2, var1, var3);
- var8 = 0;
- if(var5) {
- this.b.write((byte[])null, 0);
- return 0;
- }
- } else {
- var8 = 1009;
- }
-
- return var8;
- }
-
- public int singleWrite(byte[] var1, int var2, int[] var3, boolean var4) {
- return this.singleReadWrite(new byte[var1.length], var1, var2, var3, var4);
- }
-}
diff --git a/FtcRobotController/app/src/main/java/com/ftdi/j2xx/ft4222/FT_4222_Spi_Slave.java b/FtcRobotController/app/src/main/java/com/ftdi/j2xx/ft4222/FT_4222_Spi_Slave.java
deleted file mode 100644
index 084eee0..0000000
--- a/FtcRobotController/app/src/main/java/com/ftdi/j2xx/ft4222/FT_4222_Spi_Slave.java
+++ /dev/null
@@ -1,176 +0,0 @@
-package com.ftdi.j2xx.ft4222;
-
-import android.util.Log;
-import com.ftdi.j2xx.FT_Device;
-import com.ftdi.j2xx.ft4222.FT_4222_Device;
-import com.ftdi.j2xx.ft4222.a;
-import com.ftdi.j2xx.ft4222.b;
-import com.ftdi.j2xx.interfaces.SpiSlave;
-import java.util.concurrent.locks.Lock;
-import java.util.concurrent.locks.ReentrantLock;
-
-public class FT_4222_Spi_Slave implements SpiSlave {
- private FT_4222_Device a;
- private FT_Device b;
- private Lock c;
-
- public FT_4222_Spi_Slave(FT_4222_Device var1) {
- this.a = var1;
- this.b = var1.mFtDev;
- this.c = new ReentrantLock();
- }
-
- private int a() {
- return this.a.mChipStatus.g != 4?1003:0;
- }
-
- public int getRxStatus(int[] var1) {
- if(var1 == null) {
- return 1009;
- } else {
- int var2 = this.a();
- if(var2 != 0) {
- return var2;
- } else {
- this.c.lock();
- int var3 = this.b.getQueueStatus();
- this.c.unlock();
- if(var3 >= 0) {
- var1[0] = var3;
- return 0;
- } else {
- var1[0] = -1;
- return 4;
- }
- }
- }
- }
-
- public int init() {
- b var1 = this.a.mChipStatus;
- a var2 = this.a.mSpiMasterCfg;
- var2.a = 1;
- var2.b = 2;
- var2.c = 0;
- var2.d = 0;
- var2.e = 1;
- this.c.lock();
- this.a.cleanRxData();
- int var4 = this.b.VendorCmdSet(33, 66 | var2.a << 8);
- byte var5 = 0;
- if(var4 < 0) {
- var5 = 4;
- }
-
- if(this.b.VendorCmdSet(33, 68 | var2.b << 8) < 0) {
- var5 = 4;
- }
-
- if(this.b.VendorCmdSet(33, 69 | var2.c << 8) < 0) {
- var5 = 4;
- }
-
- if(this.b.VendorCmdSet(33, 70 | var2.d << 8) < 0) {
- var5 = 4;
- }
-
- if(this.b.VendorCmdSet(33, 67) < 0) {
- var5 = 4;
- }
-
- if(this.b.VendorCmdSet(33, 72 | var2.e << 8) < 0) {
- var5 = 4;
- }
-
- if(this.b.VendorCmdSet(33, 1029) < 0) {
- var5 = 4;
- }
-
- this.c.unlock();
- var1.g = 4;
- return var5;
- }
-
- public int read(byte[] var1, int var2, int[] var3) {
- this.c.lock();
- byte var4;
- if(this.b != null && this.b.isOpen()) {
- int var5 = this.b.read(var1, var2);
- this.c.unlock();
- var3[0] = var5;
- var4 = 0;
- if(var5 < 0) {
- return 4;
- }
- } else {
- this.c.unlock();
- var4 = 3;
- }
-
- return var4;
- }
-
- public int reset() {
- this.c.lock();
- int var1 = this.b.VendorCmdSet(33, 74);
- byte var2 = 0;
- if(var1 < 0) {
- var2 = 4;
- }
-
- this.c.unlock();
- return var2;
- }
-
- public int setDrivingStrength(int var1, int var2, int var3) {
- byte var4 = 3;
- byte var5 = 4;
- b var6 = this.a.mChipStatus;
- if(var6.g != var4 && var6.g != var5) {
- return 1003;
- } else {
- int var7 = var3 | var1 << 4 | var2 << 2;
- if(var6.g != var4) {
- var4 = var5;
- }
-
- this.c.lock();
- int var8 = this.b.VendorCmdSet(33, 160 | var7 << 8);
- byte var9 = 0;
- if(var8 < 0) {
- var9 = var5;
- }
-
- if(this.b.VendorCmdSet(33, 5 | var4 << 8) >= 0) {
- var5 = var9;
- }
-
- this.c.unlock();
- return var5;
- }
- }
-
- public int write(byte[] var1, int var2, int[] var3) {
- int var4;
- if(var3 != null && var1 != null) {
- var4 = this.a();
- if(var4 == 0) {
- if(var2 > 512) {
- return 1010;
- }
-
- this.c.lock();
- var3[0] = this.b.write(var1, var2);
- this.c.unlock();
- if(var3[0] != var2) {
- Log.e("FTDI_Device::", "Error write =" + var2 + " tx=" + var3[0]);
- return 4;
- }
- }
- } else {
- var4 = 1009;
- }
-
- return var4;
- }
-}
diff --git a/FtcRobotController/app/src/main/java/com/ftdi/j2xx/ft4222/a.java b/FtcRobotController/app/src/main/java/com/ftdi/j2xx/ft4222/a.java
deleted file mode 100644
index f3a1d29..0000000
--- a/FtcRobotController/app/src/main/java/com/ftdi/j2xx/ft4222/a.java
+++ /dev/null
@@ -1,9 +0,0 @@
-package com.ftdi.j2xx.ft4222;
-
-class a {
- int a;
- int b;
- int c;
- int d;
- byte e;
-}
diff --git a/FtcRobotController/app/src/main/java/com/ftdi/j2xx/ft4222/b.java b/FtcRobotController/app/src/main/java/com/ftdi/j2xx/ft4222/b.java
deleted file mode 100644
index d353961..0000000
--- a/FtcRobotController/app/src/main/java/com/ftdi/j2xx/ft4222/b.java
+++ /dev/null
@@ -1,31 +0,0 @@
-package com.ftdi.j2xx.ft4222;
-
-class b {
- byte a;
- byte b;
- byte c;
- byte d;
- byte e;
- byte f;
- byte g;
- byte h;
- byte i;
- byte j;
- byte[] k = new byte[3];
-
- void a(byte[] var1) {
- this.a = var1[0];
- this.b = var1[1];
- this.c = var1[2];
- this.d = var1[3];
- this.e = var1[4];
- this.f = var1[5];
- this.g = var1[6];
- this.h = var1[7];
- this.i = var1[8];
- this.j = var1[9];
- this.k[0] = var1[10];
- this.k[1] = var1[11];
- this.k[2] = var1[12];
- }
-}
diff --git a/FtcRobotController/app/src/main/java/com/ftdi/j2xx/ft4222/c.java b/FtcRobotController/app/src/main/java/com/ftdi/j2xx/ft4222/c.java
deleted file mode 100644
index 728324d..0000000
--- a/FtcRobotController/app/src/main/java/com/ftdi/j2xx/ft4222/c.java
+++ /dev/null
@@ -1,7 +0,0 @@
-package com.ftdi.j2xx.ft4222;
-
-class c {
- byte a;
- byte b;
- byte[] c = new byte[3];
-}
diff --git a/FtcRobotController/app/src/main/java/com/ftdi/j2xx/ft4222/d.java b/FtcRobotController/app/src/main/java/com/ftdi/j2xx/ft4222/d.java
deleted file mode 100644
index 3337263..0000000
--- a/FtcRobotController/app/src/main/java/com/ftdi/j2xx/ft4222/d.java
+++ /dev/null
@@ -1,10 +0,0 @@
-package com.ftdi.j2xx.ft4222;
-
-import com.ftdi.j2xx.ft4222.c;
-
-class d {
- c a = new c();
- byte b;
- byte c;
- byte[] d = new byte[1];
-}
diff --git a/FtcRobotController/app/src/main/java/com/ftdi/j2xx/ft4222/e.java b/FtcRobotController/app/src/main/java/com/ftdi/j2xx/ft4222/e.java
deleted file mode 100644
index e0435d9..0000000
--- a/FtcRobotController/app/src/main/java/com/ftdi/j2xx/ft4222/e.java
+++ /dev/null
@@ -1,7 +0,0 @@
-package com.ftdi.j2xx.ft4222;
-
-class e {
- int[] a = new int[4];
- int[] b = new int[4];
- byte c;
-}
diff --git a/FtcRobotController/app/src/main/java/com/ftdi/j2xx/g.java b/FtcRobotController/app/src/main/java/com/ftdi/j2xx/g.java
deleted file mode 100644
index 47c4393..0000000
--- a/FtcRobotController/app/src/main/java/com/ftdi/j2xx/g.java
+++ /dev/null
@@ -1,381 +0,0 @@
-//
-// Source code recreated from a .class file by IntelliJ IDEA
-// (powered by Fernflower decompiler)
-//
-
-package com.ftdi.j2xx;
-
-import com.ftdi.j2xx.FT_Device;
-import com.ftdi.j2xx.FT_EEPROM;
-import com.ftdi.j2xx.FT_EEPROM_232H;
-import com.ftdi.j2xx.k;
-import com.ftdi.j2xx.D2xxManager.D2xxException;
-
-class g extends k {
- g(FT_Device var1) throws D2xxException {
- super(var1);
- this.a((byte)15);
- }
-
- short a(FT_EEPROM var1) {
- int[] var2 = new int[this.b];
- if(var1.getClass() != FT_EEPROM_232H.class) {
- return (short)1;
- } else {
- FT_EEPROM_232H var3 = (FT_EEPROM_232H)var1;
-
- try {
- if(var3.FIFO) {
- var2[0] |= 1;
- } else if(var3.FIFOTarget) {
- var2[0] |= 2;
- } else if(var3.FastSerial) {
- var2[0] |= 4;
- }
-
- if(var3.FT1248) {
- var2[0] |= 8;
- }
-
- if(var3.LoadVCP) {
- var2[0] |= 16;
- }
-
- if(var3.FT1248ClockPolarity) {
- var2[0] |= 256;
- }
-
- if(var3.FT1248LSB) {
- var2[0] |= 512;
- }
-
- if(var3.FT1248FlowControl) {
- var2[0] |= 1024;
- }
-
- if(var3.PowerSaveEnable) {
- var2[0] |= '耀';
- }
-
- var2[1] = var3.VendorId;
- var2[2] = var3.ProductId;
- var2[3] = 2304;
- var2[4] = this.a((Object)var1);
- var2[5] = this.b(var1);
- byte var4 = var3.AL_DriveCurrent;
- if(var4 == -1) {
- var4 = 0;
- }
-
- var2[6] |= var4;
- if(var3.AL_SlowSlew) {
- var2[6] |= 4;
- }
-
- if(var3.AL_SchmittInput) {
- var2[6] |= 8;
- }
-
- byte var5 = var3.BL_DriveCurrent;
- if(var5 == -1) {
- var5 = 0;
- }
-
- var2[6] |= (short)(var5 << 8);
- if(var3.BL_SlowSlew) {
- var2[6] |= 1024;
- }
-
- if(var3.BL_SchmittInput) {
- var2[6] |= 2048;
- }
-
- byte var6 = 80;
- int var19 = this.a(var3.Manufacturer, var2, var6, 7, false);
- var19 = this.a(var3.Product, var2, var19, 8, false);
- if(var3.SerNumEnable) {
- this.a(var3.SerialNumber, var2, var19, 9, false);
- }
-
- var2[10] = 0;
- var2[11] = 0;
- var2[12] = 0;
- byte var7 = var3.CBus0;
- byte var8 = var3.CBus1;
- int var20 = var8 << 4;
- byte var9 = var3.CBus2;
- int var21 = var9 << 8;
- byte var10 = var3.CBus3;
- int var22 = var10 << 12;
- var2[12] = var7 | var20 | var21 | var22;
- var2[13] = 0;
- byte var11 = var3.CBus4;
- byte var12 = var3.CBus5;
- int var23 = var12 << 4;
- byte var13 = var3.CBus6;
- int var24 = var13 << 8;
- byte var14 = var3.CBus7;
- int var25 = var14 << 12;
- var2[13] = var11 | var23 | var24 | var25;
- var2[14] = 0;
- byte var15 = var3.CBus8;
- byte var16 = var3.CBus9;
- int var26 = var16 << 4;
- var2[14] = var15 | var26;
- var2[15] = this.a;
- var2[69] = 72;
- if(this.a == 70) {
- return (short)1;
- } else if(var2[1] != 0 && var2[2] != 0) {
- boolean var17 = false;
- var17 = this.a(var2, this.b - 1);
- return (short)(var17?0:1);
- } else {
- return (short)2;
- }
- } catch (Exception var18) {
- var18.printStackTrace();
- return (short)0;
- }
- }
- }
-
- FT_EEPROM a() {
- FT_EEPROM_232H var1 = new FT_EEPROM_232H();
- int[] var2 = new int[this.b];
- if(this.c) {
- return var1;
- } else {
- try {
- for(short var3 = 0; var3 < this.b; ++var3) {
- var2[var3] = this.a(var3);
- }
-
- var1.UART = false;
- switch(var2[0] & 15) {
- case 0:
- var1.UART = true;
- break;
- case 1:
- var1.FIFO = true;
- break;
- case 2:
- var1.FIFOTarget = true;
- break;
- case 3:
- case 5:
- case 6:
- case 7:
- default:
- var1.UART = true;
- break;
- case 4:
- var1.FastSerial = true;
- break;
- case 8:
- var1.FT1248 = true;
- }
-
- if((var2[0] & 16) > 0) {
- var1.LoadVCP = true;
- var1.LoadD2XX = false;
- } else {
- var1.LoadVCP = false;
- var1.LoadD2XX = true;
- }
-
- if((var2[0] & 256) > 0) {
- var1.FT1248ClockPolarity = true;
- } else {
- var1.FT1248ClockPolarity = false;
- }
-
- if((var2[0] & 512) > 0) {
- var1.FT1248LSB = true;
- } else {
- var1.FT1248LSB = false;
- }
-
- if((var2[0] & 1024) > 0) {
- var1.FT1248FlowControl = true;
- } else {
- var1.FT1248FlowControl = false;
- }
-
- if((var2[0] & '耀') > 0) {
- var1.PowerSaveEnable = true;
- }
-
- var1.VendorId = (short)var2[1];
- var1.ProductId = (short)var2[2];
- this.a(var1, var2[4]);
- this.a(var1, var2[5]);
- int var17 = var2[6] & 3;
- switch(var17) {
- case 0:
- var1.AL_DriveCurrent = 0;
- break;
- case 1:
- var1.AL_DriveCurrent = 1;
- break;
- case 2:
- var1.AL_DriveCurrent = 2;
- break;
- case 3:
- var1.AL_DriveCurrent = 3;
- }
-
- if((var2[6] & 4) > 0) {
- var1.AL_SlowSlew = true;
- } else {
- var1.AL_SlowSlew = false;
- }
-
- if((var2[6] & 8) > 0) {
- var1.AL_SchmittInput = true;
- } else {
- var1.AL_SchmittInput = false;
- }
-
- short var4 = (short)((var2[6] & 768) >> 8);
- switch(var4) {
- case 0:
- var1.BL_DriveCurrent = 0;
- break;
- case 1:
- var1.BL_DriveCurrent = 1;
- break;
- case 2:
- var1.BL_DriveCurrent = 2;
- break;
- case 3:
- var1.BL_DriveCurrent = 3;
- }
-
- if((var2[6] & 1024) > 0) {
- var1.BL_SlowSlew = true;
- } else {
- var1.BL_SlowSlew = false;
- }
-
- if((var2[6] & 2048) > 0) {
- var1.BL_SchmittInput = true;
- } else {
- var1.BL_SchmittInput = false;
- }
-
- short var5 = (short)(var2[12] >> 0 & 15);
- var1.CBus0 = (byte)var5;
- short var6 = (short)(var2[12] >> 4 & 15);
- var1.CBus1 = (byte)var6;
- short var7 = (short)(var2[12] >> 8 & 15);
- var1.CBus2 = (byte)var7;
- short var8 = (short)(var2[12] >> 12 & 15);
- var1.CBus3 = (byte)var8;
- short var9 = (short)(var2[13] >> 0 & 15);
- var1.CBus4 = (byte)var9;
- short var10 = (short)(var2[13] >> 4 & 15);
- var1.CBus5 = (byte)var10;
- short var11 = (short)(var2[13] >> 8 & 15);
- var1.CBus6 = (byte)var11;
- short var12 = (short)(var2[13] >> 12 & 15);
- var1.CBus7 = (byte)var12;
- short var13 = (short)(var2[14] >> 0 & 15);
- var1.CBus8 = (byte)var13;
- short var14 = (short)(var2[14] >> 4 & 15);
- var1.CBus9 = (byte)var14;
- int var15 = var2[7] & 255;
- var15 /= 2;
- var1.Manufacturer = this.a(var15, var2);
- var15 = var2[8] & 255;
- var15 /= 2;
- var1.Product = this.a(var15, var2);
- var15 = var2[9] & 255;
- var15 /= 2;
- var1.SerialNumber = this.a(var15, var2);
- return var1;
- } catch (Exception var16) {
- return null;
- }
- }
- }
-
- int b() {
- int var1 = this.a((short)9);
- int var2 = var1 & 255;
- var2 /= 2;
- ++var2;
- int var3 = (var1 & '\uff00') >> 8;
- var3 /= 2;
- ++var3;
- return (this.b - var2 - 1 - var3) * 2;
- }
-
- int a(byte[] var1) {
- boolean var2 = false;
- boolean var3 = false;
- if(var1.length > this.b()) {
- return 0;
- } else {
- int[] var4 = new int[this.b];
-
- for(short var5 = 0; var5 < this.b; ++var5) {
- var4[var5] = this.a(var5);
- }
-
- short var7 = (short)(this.b - this.b() / 2 - 1 - 1);
-
- for(int var8 = 0; var8 < var1.length; var8 += 2) {
- int var6;
- if(var8 + 1 < var1.length) {
- var6 = var1[var8 + 1] & 255;
- } else {
- var6 = 0;
- }
-
- var6 <<= 8;
- var6 |= var1[var8] & 255;
- var4[var7++] = var6;
- }
-
- if(var4[1] != 0 && var4[2] != 0) {
- boolean var9 = false;
- var9 = this.a(var4, this.b - 1);
- if(!var9) {
- return 0;
- } else {
- return var1.length;
- }
- } else {
- return 0;
- }
- }
- }
-
- byte[] a(int var1) {
- boolean var2 = false;
- boolean var3 = false;
- boolean var4 = false;
- byte[] var5 = new byte[var1];
- if(var1 != 0 && var1 <= this.b()) {
- short var6 = (short)(this.b - this.b() / 2 - 1 - 1);
-
- for(int var7 = 0; var7 < var1; var7 += 2) {
- int var10 = this.a(var6++);
- if(var7 + 1 < var5.length) {
- byte var8 = (byte)(var10 & 255);
- var5[var7 + 1] = var8;
- } else {
- var3 = false;
- }
-
- byte var9 = (byte)((var10 & '\uff00') >> 8);
- var5[var7] = var9;
- }
-
- return var5;
- } else {
- return null;
- }
- }
-}
diff --git a/FtcRobotController/app/src/main/java/com/ftdi/j2xx/h.java b/FtcRobotController/app/src/main/java/com/ftdi/j2xx/h.java
deleted file mode 100644
index 755f507..0000000
--- a/FtcRobotController/app/src/main/java/com/ftdi/j2xx/h.java
+++ /dev/null
@@ -1,343 +0,0 @@
-//
-// Source code recreated from a .class file by IntelliJ IDEA
-// (powered by Fernflower decompiler)
-//
-
-package com.ftdi.j2xx;
-
-import com.ftdi.j2xx.FT_Device;
-import com.ftdi.j2xx.FT_EEPROM;
-import com.ftdi.j2xx.FT_EEPROM_232R;
-import com.ftdi.j2xx.k;
-
-class h extends k {
- private static FT_Device d;
-
- h(FT_Device var1) {
- super(var1);
- d = var1;
- }
-
- boolean a(short var1, short var2) {
- int var3 = var2 & '\uffff';
- int var4 = var1 & '\uffff';
- boolean var5 = false;
- boolean var6 = false;
- boolean var7 = false;
- if(var1 >= 1024) {
- return var6;
- } else {
- byte var9 = d.getLatencyTimer();
- d.setLatencyTimer((byte)119);
- int var8 = d.c().controlTransfer(64, 145, var3, var4, (byte[])null, 0, 0);
- if(var8 == 0) {
- var6 = true;
- }
-
- d.setLatencyTimer(var9);
- return var6;
- }
- }
-
- short a(FT_EEPROM var1) {
- if(var1.getClass() != FT_EEPROM_232R.class) {
- return (short)1;
- } else {
- int[] var2 = new int[80];
- FT_EEPROM_232R var7 = (FT_EEPROM_232R)var1;
-
- try {
- for(short var8 = 0; var8 < 80; ++var8) {
- var2[var8] = this.a(var8);
- }
-
- byte var3 = 0;
- int var17 = var3 | var2[0] & '\uff00';
- if(var7.HighIO) {
- var17 |= 4;
- }
-
- if(var7.LoadVCP) {
- var17 |= 8;
- }
-
- if(var7.ExternalOscillator) {
- var17 |= 2;
- } else {
- var17 &= '�';
- }
-
- var2[0] = var17;
- var2[1] = var7.VendorId;
- var2[2] = var7.ProductId;
- var2[3] = 1536;
- var2[4] = this.a((Object)var1);
- int var4 = this.b(var1);
- if(var7.InvertTXD) {
- var4 |= 256;
- }
-
- if(var7.InvertRXD) {
- var4 |= 512;
- }
-
- if(var7.InvertRTS) {
- var4 |= 1024;
- }
-
- if(var7.InvertCTS) {
- var4 |= 2048;
- }
-
- if(var7.InvertDTR) {
- var4 |= 4096;
- }
-
- if(var7.InvertDSR) {
- var4 |= 8192;
- }
-
- if(var7.InvertDCD) {
- var4 |= 16384;
- }
-
- if(var7.InvertRI) {
- var4 |= '耀';
- }
-
- var2[5] = var4;
- boolean var5 = false;
- byte var19 = var7.CBus0;
- byte var9 = var7.CBus1;
- int var20 = var9 << 4;
- byte var10 = var7.CBus2;
- int var21 = var10 << 8;
- byte var11 = var7.CBus3;
- int var22 = var11 << 12;
- int var18 = var19 | var20 | var21 | var22;
- var2[10] = var18;
- boolean var6 = false;
- byte var12 = var7.CBus4;
- var2[11] = var12;
- byte var13 = 12;
- int var23 = this.a(var7.Manufacturer, var2, var13, 7, true);
- var23 = this.a(var7.Product, var2, var23, 8, true);
- if(var7.SerNumEnable) {
- this.a(var7.SerialNumber, var2, var23, 9, true);
- }
-
- boolean var14 = false;
- if(var2[1] != 0 && var2[2] != 0) {
- boolean var15 = false;
- byte var24 = d.getLatencyTimer();
- d.setLatencyTimer((byte)119);
- var15 = this.a(var2, 63);
- d.setLatencyTimer(var24);
- return (short)(var15?0:1);
- } else {
- return (short)2;
- }
- } catch (Exception var16) {
- var16.printStackTrace();
- return (short)0;
- }
- }
- }
-
- FT_EEPROM a() {
- FT_EEPROM_232R var1 = new FT_EEPROM_232R();
- int[] var2 = new int[80];
-
- try {
- int var3;
- for(var3 = 0; var3 < 80; ++var3) {
- var2[var3] = this.a((short)var3);
- }
-
- if((var2[0] & 4) == 4) {
- var1.HighIO = true;
- } else {
- var1.HighIO = false;
- }
-
- if((var2[0] & 8) == 8) {
- var1.LoadVCP = true;
- } else {
- var1.LoadVCP = false;
- }
-
- if((var2[0] & 2) == 2) {
- var1.ExternalOscillator = true;
- } else {
- var1.ExternalOscillator = false;
- }
-
- var1.VendorId = (short)var2[1];
- var1.ProductId = (short)var2[2];
- this.a(var1, var2[4]);
- this.a(var1, var2[5]);
- if((var2[5] & 256) == 256) {
- var1.InvertTXD = true;
- } else {
- var1.InvertTXD = false;
- }
-
- if((var2[5] & 512) == 512) {
- var1.InvertRXD = true;
- } else {
- var1.InvertRXD = false;
- }
-
- if((var2[5] & 1024) == 1024) {
- var1.InvertRTS = true;
- } else {
- var1.InvertRTS = false;
- }
-
- if((var2[5] & 2048) == 2048) {
- var1.InvertCTS = true;
- } else {
- var1.InvertCTS = false;
- }
-
- if((var2[5] & 4096) == 4096) {
- var1.InvertDTR = true;
- } else {
- var1.InvertDTR = false;
- }
-
- if((var2[5] & 8192) == 8192) {
- var1.InvertDSR = true;
- } else {
- var1.InvertDSR = false;
- }
-
- if((var2[5] & 16384) == 16384) {
- var1.InvertDCD = true;
- } else {
- var1.InvertDCD = false;
- }
-
- if((var2[5] & '耀') == '耀') {
- var1.InvertRI = true;
- } else {
- var1.InvertRI = false;
- }
-
- var3 = var2[10];
- int var4 = var3 & 15;
- var1.CBus0 = (byte)var4;
- int var5 = var3 & 240;
- var1.CBus1 = (byte)(var5 >> 4);
- int var6 = var3 & 3840;
- var1.CBus2 = (byte)(var6 >> 8);
- int var7 = var3 & '\uf000';
- var1.CBus3 = (byte)(var7 >> 12);
- int var8 = var2[11] & 255;
- var1.CBus4 = (byte)var8;
- int var9 = var2[7] & 255;
- var9 -= 128;
- var9 /= 2;
- var1.Manufacturer = this.a(var9, var2);
- var9 = var2[8] & 255;
- var9 -= 128;
- var9 /= 2;
- var1.Product = this.a(var9, var2);
- var9 = var2[9] & 255;
- var9 -= 128;
- var9 /= 2;
- var1.SerialNumber = this.a(var9, var2);
- return var1;
- } catch (Exception var10) {
- return null;
- }
- }
-
- int b() {
- int var1 = this.a((short)7);
- int var2 = (var1 & '\uff00') >> 8;
- var2 /= 2;
- var1 = this.a((short)8);
- int var3 = (var1 & '\uff00') >> 8;
- var3 /= 2;
- int var4 = 12 + var2 + var3 + 1;
- var1 = this.a((short)9);
- int var5 = (var1 & '\uff00') >> 8;
- var5 /= 2;
- return (63 - var4 - var5 - 1) * 2;
- }
-
- int a(byte[] var1) {
- boolean var2 = false;
- boolean var3 = false;
- if(var1.length > this.b()) {
- return 0;
- } else {
- int[] var4 = new int[80];
-
- for(short var5 = 0; var5 < 80; ++var5) {
- var4[var5] = this.a(var5);
- }
-
- short var8 = (short)(63 - this.b() / 2 - 1);
- var8 = (short)(var8 & '\uffff');
-
- for(int var9 = 0; var9 < var1.length; var9 += 2) {
- int var7;
- if(var9 + 1 < var1.length) {
- var7 = var1[var9 + 1] & 255;
- } else {
- var7 = 0;
- }
-
- var7 <<= 8;
- var7 |= var1[var9] & 255;
- var4[var8++] = var7;
- }
-
- boolean var10 = false;
- if(var4[1] != 0 && var4[2] != 0) {
- boolean var6 = false;
- byte var11 = d.getLatencyTimer();
- d.setLatencyTimer((byte)119);
- var6 = this.a(var4, 63);
- d.setLatencyTimer(var11);
- if(!var6) {
- return 0;
- } else {
- return var1.length;
- }
- } else {
- return 0;
- }
- }
- }
-
- byte[] a(int var1) {
- boolean var2 = false;
- boolean var3 = false;
- boolean var4 = false;
- byte[] var5 = new byte[var1];
- if(var1 != 0 && var1 <= this.b()) {
- short var6 = (short)(63 - this.b() / 2 - 1);
- var6 = (short)(var6 & '\uffff');
-
- for(int var7 = 0; var7 < var1; var7 += 2) {
- int var10 = this.a(var6++);
- if(var7 + 1 < var5.length) {
- byte var8 = (byte)(var10 & 255);
- var5[var7 + 1] = var8;
- } else {
- var3 = false;
- }
-
- byte var9 = (byte)((var10 & '\uff00') >> 8);
- var5[var7] = var9;
- }
-
- return var5;
- } else {
- return null;
- }
- }
-}
diff --git a/FtcRobotController/app/src/main/java/com/ftdi/j2xx/i.java b/FtcRobotController/app/src/main/java/com/ftdi/j2xx/i.java
deleted file mode 100644
index 64a39ea..0000000
--- a/FtcRobotController/app/src/main/java/com/ftdi/j2xx/i.java
+++ /dev/null
@@ -1,342 +0,0 @@
-//
-// Source code recreated from a .class file by IntelliJ IDEA
-// (powered by Fernflower decompiler)
-//
-
-package com.ftdi.j2xx;
-
-import com.ftdi.j2xx.FT_Device;
-import com.ftdi.j2xx.FT_EEPROM;
-import com.ftdi.j2xx.FT_EEPROM_245R;
-import com.ftdi.j2xx.k;
-
-class i extends k {
- private static FT_Device d;
-
- i(FT_Device var1) {
- super(var1);
- d = var1;
- }
-
- boolean a(short var1, short var2) {
- int var3 = var2 & '\uffff';
- int var4 = var1 & '\uffff';
- boolean var5 = false;
- boolean var6 = false;
- boolean var7 = false;
- if(var1 >= 1024) {
- return var6;
- } else {
- byte var9 = d.getLatencyTimer();
- d.setLatencyTimer((byte)119);
- int var8 = d.c().controlTransfer(64, 145, var3, var4, (byte[])null, 0, 0);
- if(var8 == 0) {
- var6 = true;
- }
-
- d.setLatencyTimer(var9);
- return var6;
- }
- }
-
- short a(FT_EEPROM var1) {
- int[] var2 = new int[80];
- if(var1.getClass() != FT_EEPROM_245R.class) {
- return (short)1;
- } else {
- FT_EEPROM_245R var7 = (FT_EEPROM_245R)var1;
-
- try {
- for(short var8 = 0; var8 < 80; ++var8) {
- var2[var8] = this.a(var8);
- }
-
- byte var3 = 0;
- int var17 = var3 | var2[0] & '\uff00';
- if(var7.HighIO) {
- var17 |= 4;
- }
-
- if(var7.LoadVCP) {
- var17 |= 8;
- }
-
- if(var7.ExternalOscillator) {
- var17 |= 2;
- } else {
- var17 &= '�';
- }
-
- var2[0] = var17;
- var2[1] = var7.VendorId;
- var2[2] = var7.ProductId;
- var2[3] = 1536;
- var2[4] = this.a((Object)var1);
- int var4 = this.b(var1);
- if(var7.InvertTXD) {
- var4 |= 256;
- }
-
- if(var7.InvertRXD) {
- var4 |= 512;
- }
-
- if(var7.InvertRTS) {
- var4 |= 1024;
- }
-
- if(var7.InvertCTS) {
- var4 |= 2048;
- }
-
- if(var7.InvertDTR) {
- var4 |= 4096;
- }
-
- if(var7.InvertDSR) {
- var4 |= 8192;
- }
-
- if(var7.InvertDCD) {
- var4 |= 16384;
- }
-
- if(var7.InvertRI) {
- var4 |= '耀';
- }
-
- var2[5] = var4;
- boolean var5 = false;
- byte var19 = var7.CBus0;
- byte var9 = var7.CBus1;
- int var20 = var9 << 4;
- byte var10 = var7.CBus2;
- int var21 = var10 << 8;
- byte var11 = var7.CBus3;
- int var22 = var11 << 12;
- int var18 = var19 | var20 | var21 | var22;
- var2[10] = var18;
- boolean var6 = false;
- byte var12 = var7.CBus4;
- var2[11] = var12;
- byte var13 = 12;
- int var23 = this.a(var7.Manufacturer, var2, var13, 7, true);
- var23 = this.a(var7.Product, var2, var23, 8, true);
- if(var7.SerNumEnable) {
- this.a(var7.SerialNumber, var2, var23, 9, true);
- }
-
- boolean var14 = false;
- if(var2[1] != 0 && var2[2] != 0) {
- boolean var15 = false;
- byte var24 = d.getLatencyTimer();
- d.setLatencyTimer((byte)119);
- var15 = this.a(var2, 80);
- d.setLatencyTimer(var24);
- return (short)(var15?0:1);
- } else {
- return (short)2;
- }
- } catch (Exception var16) {
- var16.printStackTrace();
- return (short)0;
- }
- }
- }
-
- FT_EEPROM a() {
- FT_EEPROM_245R var1 = new FT_EEPROM_245R();
- int[] var2 = new int[80];
-
- try {
- int var3;
- for(var3 = 0; var3 < 80; ++var3) {
- var2[var3] = this.a((short)var3);
- }
-
- if((var2[0] & 4) == 4) {
- var1.HighIO = true;
- } else {
- var1.HighIO = false;
- }
-
- if((var2[0] & 8) == 8) {
- var1.LoadVCP = true;
- } else {
- var1.LoadVCP = false;
- }
-
- if((var2[0] & 2) == 2) {
- var1.ExternalOscillator = true;
- } else {
- var1.ExternalOscillator = false;
- }
-
- var1.VendorId = (short)var2[1];
- var1.ProductId = (short)var2[2];
- this.a(var1, var2[4]);
- this.a(var1, var2[5]);
- if((var2[5] & 256) == 256) {
- var1.InvertTXD = true;
- } else {
- var1.InvertTXD = false;
- }
-
- if((var2[5] & 512) == 512) {
- var1.InvertRXD = true;
- } else {
- var1.InvertRXD = false;
- }
-
- if((var2[5] & 1024) == 1024) {
- var1.InvertRTS = true;
- } else {
- var1.InvertRTS = false;
- }
-
- if((var2[5] & 2048) == 2048) {
- var1.InvertCTS = true;
- } else {
- var1.InvertCTS = false;
- }
-
- if((var2[5] & 4096) == 4096) {
- var1.InvertDTR = true;
- } else {
- var1.InvertDTR = false;
- }
-
- if((var2[5] & 8192) == 8192) {
- var1.InvertDSR = true;
- } else {
- var1.InvertDSR = false;
- }
-
- if((var2[5] & 16384) == 16384) {
- var1.InvertDCD = true;
- } else {
- var1.InvertDCD = false;
- }
-
- if((var2[5] & '耀') == '耀') {
- var1.InvertRI = true;
- } else {
- var1.InvertRI = false;
- }
-
- var3 = var2[10];
- int var4 = var3 & 15;
- var1.CBus0 = (byte)var4;
- int var5 = var3 & 240;
- var1.CBus1 = (byte)(var5 >> 4);
- int var6 = var3 & 3840;
- var1.CBus2 = (byte)(var6 >> 8);
- int var7 = var3 & '\uf000';
- var1.CBus3 = (byte)(var7 >> 12);
- int var8 = var2[11] & 255;
- var1.CBus4 = (byte)var8;
- int var9 = var2[7] & 255;
- var9 -= 128;
- var9 /= 2;
- var1.Manufacturer = this.a(var9, var2);
- var9 = var2[8] & 255;
- var9 -= 128;
- var9 /= 2;
- var1.Product = this.a(var9, var2);
- var9 = var2[9] & 255;
- var9 -= 128;
- var9 /= 2;
- var1.SerialNumber = this.a(var9, var2);
- return var1;
- } catch (Exception var10) {
- return null;
- }
- }
-
- int b() {
- int var1 = this.a((short)7);
- int var2 = (var1 & '\uff00') >> 8;
- var2 /= 2;
- var1 = this.a((short)8);
- int var3 = (var1 & '\uff00') >> 8;
- var3 /= 2;
- int var4 = 12 + var2 + var3 + 1;
- var1 = this.a((short)9);
- int var5 = (var1 & '\uff00') >> 8;
- var5 /= 2;
- return (63 - var4 - var5 - 1) * 2;
- }
-
- int a(byte[] var1) {
- boolean var2 = false;
- boolean var3 = false;
- if(var1.length > this.b()) {
- return 0;
- } else {
- int[] var4 = new int[80];
-
- for(short var5 = 0; var5 < 80; ++var5) {
- var4[var5] = this.a(var5);
- }
-
- short var8 = (short)(63 - this.b() / 2 - 1);
- var8 = (short)(var8 & '\uffff');
-
- for(int var9 = 0; var9 < var1.length; var9 += 2) {
- int var7;
- if(var9 + 1 < var1.length) {
- var7 = var1[var9 + 1] & 255;
- } else {
- var7 = 0;
- }
-
- var7 <<= 8;
- var7 |= var1[var9] & 255;
- var4[var8++] = var7;
- }
-
- boolean var10 = false;
- if(var4[1] != 0 && var4[2] != 0) {
- boolean var6 = false;
- byte var11 = d.getLatencyTimer();
- d.setLatencyTimer((byte)119);
- var6 = this.a(var4, 63);
- d.setLatencyTimer(var11);
- if(!var6) {
- return 0;
- } else {
- return var1.length;
- }
- } else {
- return 0;
- }
- }
- }
-
- byte[] a(int var1) {
- boolean var2 = false;
- boolean var3 = false;
- boolean var4 = false;
- byte[] var5 = new byte[var1];
- if(var1 != 0 && var1 <= this.b()) {
- short var6 = (short)(63 - this.b() / 2 - 1);
-
- for(int var7 = 0; var7 < var1; var7 += 2) {
- int var10 = this.a(var6++);
- if(var7 + 1 < var5.length) {
- byte var8 = (byte)(var10 & 255);
- var5[var7 + 1] = var8;
- } else {
- var3 = false;
- }
-
- byte var9 = (byte)((var10 & '\uff00') >> 8);
- var5[var7] = var9;
- }
-
- return var5;
- } else {
- return null;
- }
- }
-}
diff --git a/FtcRobotController/app/src/main/java/com/ftdi/j2xx/interfaces/Gpio.java b/FtcRobotController/app/src/main/java/com/ftdi/j2xx/interfaces/Gpio.java
deleted file mode 100644
index 2fa552b..0000000
--- a/FtcRobotController/app/src/main/java/com/ftdi/j2xx/interfaces/Gpio.java
+++ /dev/null
@@ -1,9 +0,0 @@
-package com.ftdi.j2xx.interfaces;
-
-public interface Gpio {
- int init(int[] var1);
-
- int read(int var1, boolean[] var2);
-
- int write(int var1, boolean var2);
-}
diff --git a/FtcRobotController/app/src/main/java/com/ftdi/j2xx/interfaces/I2cMaster.java b/FtcRobotController/app/src/main/java/com/ftdi/j2xx/interfaces/I2cMaster.java
deleted file mode 100644
index e3e295f..0000000
--- a/FtcRobotController/app/src/main/java/com/ftdi/j2xx/interfaces/I2cMaster.java
+++ /dev/null
@@ -1,11 +0,0 @@
-package com.ftdi.j2xx.interfaces;
-
-public interface I2cMaster {
- int init(int var1);
-
- int read(int var1, byte[] var2, int var3, int[] var4);
-
- int reset();
-
- int write(int var1, byte[] var2, int var3, int[] var4);
-}
diff --git a/FtcRobotController/app/src/main/java/com/ftdi/j2xx/interfaces/I2cSlave.java b/FtcRobotController/app/src/main/java/com/ftdi/j2xx/interfaces/I2cSlave.java
deleted file mode 100644
index 8ca426f..0000000
--- a/FtcRobotController/app/src/main/java/com/ftdi/j2xx/interfaces/I2cSlave.java
+++ /dev/null
@@ -1,15 +0,0 @@
-package com.ftdi.j2xx.interfaces;
-
-public interface I2cSlave {
- int getAddress(int[] var1);
-
- int init();
-
- int read(byte[] var1, int var2, int[] var3);
-
- int reset();
-
- int setAddress(int var1);
-
- int write(byte[] var1, int var2, int[] var3);
-}
diff --git a/FtcRobotController/app/src/main/java/com/ftdi/j2xx/interfaces/SpiMaster.java b/FtcRobotController/app/src/main/java/com/ftdi/j2xx/interfaces/SpiMaster.java
deleted file mode 100644
index 2a1a09c..0000000
--- a/FtcRobotController/app/src/main/java/com/ftdi/j2xx/interfaces/SpiMaster.java
+++ /dev/null
@@ -1,17 +0,0 @@
-package com.ftdi.j2xx.interfaces;
-
-public interface SpiMaster {
- int init(int var1, int var2, int var3, int var4, byte var5);
-
- int multiReadWrite(byte[] var1, byte[] var2, int var3, int var4, int var5, int[] var6);
-
- int reset();
-
- int setLines(int var1);
-
- int singleRead(byte[] var1, int var2, int[] var3, boolean var4);
-
- int singleReadWrite(byte[] var1, byte[] var2, int var3, int[] var4, boolean var5);
-
- int singleWrite(byte[] var1, int var2, int[] var3, boolean var4);
-}
diff --git a/FtcRobotController/app/src/main/java/com/ftdi/j2xx/interfaces/SpiSlave.java b/FtcRobotController/app/src/main/java/com/ftdi/j2xx/interfaces/SpiSlave.java
deleted file mode 100644
index 004c55e..0000000
--- a/FtcRobotController/app/src/main/java/com/ftdi/j2xx/interfaces/SpiSlave.java
+++ /dev/null
@@ -1,13 +0,0 @@
-package com.ftdi.j2xx.interfaces;
-
-public interface SpiSlave {
- int getRxStatus(int[] var1);
-
- int init();
-
- int read(byte[] var1, int var2, int[] var3);
-
- int reset();
-
- int write(byte[] var1, int var2, int[] var3);
-}
diff --git a/FtcRobotController/app/src/main/java/com/ftdi/j2xx/j.java b/FtcRobotController/app/src/main/java/com/ftdi/j2xx/j.java
deleted file mode 100644
index 54823e4..0000000
--- a/FtcRobotController/app/src/main/java/com/ftdi/j2xx/j.java
+++ /dev/null
@@ -1,466 +0,0 @@
-//
-// Source code recreated from a .class file by IntelliJ IDEA
-// (powered by Fernflower decompiler)
-//
-
-package com.ftdi.j2xx;
-
-import com.ftdi.j2xx.FT_Device;
-import com.ftdi.j2xx.FT_EEPROM;
-import com.ftdi.j2xx.FT_EEPROM_4232H;
-import com.ftdi.j2xx.k;
-import com.ftdi.j2xx.D2xxManager.D2xxException;
-
-class j extends k {
- j(FT_Device var1) throws D2xxException {
- super(var1);
- this.a((byte)12);
- }
-
- short a(FT_EEPROM var1) {
- int[] var2 = new int[this.b];
- if(var1.getClass() != FT_EEPROM_4232H.class) {
- return (short)1;
- } else {
- FT_EEPROM_4232H var3 = (FT_EEPROM_4232H)var1;
-
- try {
- var2[0] = 0;
- if(var3.AL_LoadVCP) {
- var2[0] |= 8;
- }
-
- if(var3.BL_LoadVCP) {
- var2[0] |= 128;
- }
-
- if(var3.AH_LoadVCP) {
- var2[0] |= 2048;
- }
-
- if(var3.BH_LoadVCP) {
- var2[0] |= '耀';
- }
-
- var2[1] = var3.VendorId;
- var2[2] = var3.ProductId;
- var2[3] = 2048;
- var2[4] = this.a((Object)var1);
- var2[5] = this.b(var1);
- if(var3.AL_LoadRI_RS485) {
- var2[5] = (short)(var2[5] | 4096);
- }
-
- if(var3.AH_LoadRI_RS485) {
- var2[5] = (short)(var2[5] | 8192);
- }
-
- if(var3.BL_LoadRI_RS485) {
- var2[5] = (short)(var2[5] | 16384);
- }
-
- if(var3.BH_LoadRI_RS485) {
- var2[5] = (short)(var2[5] | '耀');
- }
-
- var2[6] = 0;
- byte var4 = var3.AL_DriveCurrent;
- if(var4 == -1) {
- var4 = 0;
- }
-
- var2[6] |= var4;
- if(var3.AL_SlowSlew) {
- var2[6] |= 4;
- }
-
- if(var3.AL_SchmittInput) {
- var2[6] |= 8;
- }
-
- byte var5 = var3.AH_DriveCurrent;
- if(var5 == -1) {
- var5 = 0;
- }
-
- short var12 = (short)(var5 << 4);
- var2[6] |= var12;
- if(var3.AH_SlowSlew) {
- var2[6] |= 64;
- }
-
- if(var3.AH_SchmittInput) {
- var2[6] |= 128;
- }
-
- byte var6 = var3.BL_DriveCurrent;
- if(var6 == -1) {
- var6 = 0;
- }
-
- short var13 = (short)(var6 << 8);
- var2[6] |= var13;
- if(var3.BL_SlowSlew) {
- var2[6] |= 1024;
- }
-
- if(var3.BL_SchmittInput) {
- var2[6] |= 2048;
- }
-
- byte var7 = var3.BH_DriveCurrent;
- short var14 = (short)(var7 << 12);
- var2[6] |= var14;
- if(var3.BH_SlowSlew) {
- var2[6] |= 16384;
- }
-
- if(var3.BH_SchmittInput) {
- var2[6] |= '耀';
- }
-
- boolean var8 = false;
- byte var9 = 77;
- if(this.a == 70) {
- var9 = 13;
- var8 = true;
- }
-
- int var15 = this.a(var3.Manufacturer, var2, var9, 7, var8);
- var15 = this.a(var3.Product, var2, var15, 8, var8);
- if(var3.SerNumEnable) {
- this.a(var3.SerialNumber, var2, var15, 9, var8);
- }
-
- switch(var3.TPRDRV) {
- case 0:
- var2[11] = 0;
- break;
- case 1:
- var2[11] = 8;
- break;
- case 2:
- var2[11] = 16;
- break;
- case 3:
- var2[11] = 24;
- break;
- default:
- var2[11] = 0;
- }
-
- var2[12] = this.a;
- if(var2[1] != 0 && var2[2] != 0) {
- boolean var10 = false;
- var10 = this.a(var2, this.b - 1);
- return (short)(var10?0:1);
- } else {
- return (short)2;
- }
- } catch (Exception var11) {
- var11.printStackTrace();
- return (short)0;
- }
- }
- }
-
- FT_EEPROM a() {
- FT_EEPROM_4232H var1 = new FT_EEPROM_4232H();
- int[] var2 = new int[this.b];
- if(this.c) {
- return var1;
- } else {
- try {
- short var3;
- for(var3 = 0; var3 < this.b; ++var3) {
- var2[var3] = this.a(var3);
- }
-
- var3 = (short)((var2[0] & 8) >> 3);
- if(var3 == 1) {
- var1.AL_LoadVCP = true;
- var1.AL_LoadD2XX = false;
- } else {
- var1.AL_LoadVCP = false;
- var1.AL_LoadD2XX = true;
- }
-
- short var4 = (short)((var2[0] & 128) >> 7);
- if(var4 == 1) {
- var1.BL_LoadVCP = true;
- var1.BL_LoadD2XX = false;
- } else {
- var1.BL_LoadVCP = false;
- var1.BL_LoadD2XX = true;
- }
-
- short var5 = (short)((var2[0] & 2048) >> 11);
- if(var5 == 1) {
- var1.AH_LoadVCP = true;
- var1.AH_LoadD2XX = false;
- } else {
- var1.AH_LoadVCP = false;
- var1.AH_LoadD2XX = true;
- }
-
- short var6 = (short)((var2[0] & '耀') >> 15);
- if(var6 == 1) {
- var1.BH_LoadVCP = true;
- var1.BH_LoadD2XX = false;
- } else {
- var1.BH_LoadVCP = false;
- var1.BH_LoadD2XX = true;
- }
-
- var1.VendorId = (short)var2[1];
- var1.ProductId = (short)var2[2];
- this.a(var1, var2[4]);
- this.a(var1, var2[5]);
- if((var2[5] & 4096) == 4096) {
- var1.AL_LoadRI_RS485 = true;
- }
-
- if((var2[5] & 8192) == 8192) {
- var1.AH_LoadRI_RS485 = true;
- }
-
- if((var2[5] & 16384) == 16384) {
- var1.AH_LoadRI_RS485 = true;
- }
-
- if((var2[5] & '耀') == '耀') {
- var1.AH_LoadRI_RS485 = true;
- }
-
- short var7 = (short)(var2[6] & 3);
- switch(var7) {
- case 0:
- var1.AL_DriveCurrent = 0;
- break;
- case 1:
- var1.AL_DriveCurrent = 1;
- break;
- case 2:
- var1.AL_DriveCurrent = 2;
- break;
- case 3:
- var1.AL_DriveCurrent = 3;
- }
-
- short var8 = (short)(var2[6] & 4);
- if(var8 == 4) {
- var1.AL_SlowSlew = true;
- } else {
- var1.AL_SlowSlew = false;
- }
-
- short var9 = (short)(var2[6] & 8);
- if(var9 == 8) {
- var1.AL_SchmittInput = true;
- } else {
- var1.AL_SchmittInput = false;
- }
-
- short var10 = (short)((var2[6] & 48) >> 4);
- switch(var10) {
- case 0:
- var1.AH_DriveCurrent = 0;
- break;
- case 1:
- var1.AH_DriveCurrent = 1;
- break;
- case 2:
- var1.AH_DriveCurrent = 2;
- break;
- case 3:
- var1.AH_DriveCurrent = 3;
- }
-
- short var11 = (short)(var2[6] & 64);
- if(var11 == 64) {
- var1.AH_SlowSlew = true;
- } else {
- var1.AH_SlowSlew = false;
- }
-
- short var12 = (short)(var2[6] & 128);
- if(var12 == 128) {
- var1.AH_SchmittInput = true;
- } else {
- var1.AH_SchmittInput = false;
- }
-
- short var13 = (short)((var2[6] & 768) >> 8);
- switch(var13) {
- case 0:
- var1.BL_DriveCurrent = 0;
- break;
- case 1:
- var1.BL_DriveCurrent = 1;
- break;
- case 2:
- var1.BL_DriveCurrent = 2;
- break;
- case 3:
- var1.BL_DriveCurrent = 3;
- }
-
- short var14 = (short)(var2[6] & 1024);
- if(var14 == 1024) {
- var1.BL_SlowSlew = true;
- } else {
- var1.BL_SlowSlew = false;
- }
-
- short var15 = (short)(var2[6] & 2048);
- if(var15 == 2048) {
- var1.BL_SchmittInput = true;
- } else {
- var1.BL_SchmittInput = false;
- }
-
- short var16 = (short)((var2[6] & 12288) >> 12);
- switch(var16) {
- case 0:
- var1.BH_DriveCurrent = 0;
- break;
- case 1:
- var1.BH_DriveCurrent = 1;
- break;
- case 2:
- var1.BH_DriveCurrent = 2;
- break;
- case 3:
- var1.BH_DriveCurrent = 3;
- }
-
- short var17 = (short)(var2[6] & 16384);
- if(var17 == 16384) {
- var1.BH_SlowSlew = true;
- } else {
- var1.BH_SlowSlew = false;
- }
-
- short var18 = (short)(var2[6] & '耀');
- if(var18 == '耀') {
- var1.BH_SchmittInput = true;
- } else {
- var1.BH_SchmittInput = false;
- }
-
- short var19 = (short)((var2[11] & 24) >> 3);
- if(var19 < 4) {
- var1.TPRDRV = var19;
- } else {
- var1.TPRDRV = 0;
- }
-
- int var20 = var2[7] & 255;
- if(this.a == 70) {
- var20 -= 128;
- var20 /= 2;
- var1.Manufacturer = this.a(var20, var2);
- var20 = var2[8] & 255;
- var20 -= 128;
- var20 /= 2;
- var1.Product = this.a(var20, var2);
- var20 = var2[9] & 255;
- var20 -= 128;
- var20 /= 2;
- var1.SerialNumber = this.a(var20, var2);
- } else {
- var20 /= 2;
- var1.Manufacturer = this.a(var20, var2);
- var20 = var2[8] & 255;
- var20 /= 2;
- var1.Product = this.a(var20, var2);
- var20 = var2[9] & 255;
- var20 /= 2;
- var1.SerialNumber = this.a(var20, var2);
- }
-
- return var1;
- } catch (Exception var21) {
- return null;
- }
- }
- }
-
- int b() {
- int var1 = this.a((short)9);
- int var2 = var1 & 255;
- var2 /= 2;
- int var3 = (var1 & '\uff00') >> 8;
- var2 += var3 / 2;
- ++var2;
- return (this.b - 1 - 1 - var2) * 2;
- }
-
- int a(byte[] var1) {
- boolean var2 = false;
- boolean var3 = false;
- if(var1.length > this.b()) {
- return 0;
- } else {
- int[] var4 = new int[this.b];
-
- for(short var5 = 0; var5 < this.b; ++var5) {
- var4[var5] = this.a(var5);
- }
-
- short var7 = (short)(this.b - this.b() / 2 - 1 - 1);
-
- for(int var8 = 0; var8 < var1.length; var8 += 2) {
- int var6;
- if(var8 + 1 < var1.length) {
- var6 = var1[var8 + 1] & 255;
- } else {
- var6 = 0;
- }
-
- var6 <<= 8;
- var6 |= var1[var8] & 255;
- var4[var7++] = var6;
- }
-
- if(var4[1] != 0 && var4[2] != 0) {
- boolean var9 = false;
- var9 = this.a(var4, this.b - 1);
- if(!var9) {
- return 0;
- } else {
- return var1.length;
- }
- } else {
- return 0;
- }
- }
- }
-
- byte[] a(int var1) {
- boolean var2 = false;
- boolean var3 = false;
- boolean var4 = false;
- byte[] var5 = new byte[var1];
- if(var1 != 0 && var1 <= this.b()) {
- short var6 = (short)(this.b - this.b() / 2 - 1 - 1);
-
- for(int var7 = 0; var7 < var1; var7 += 2) {
- int var10 = this.a(var6++);
- if(var7 + 1 < var5.length) {
- byte var8 = (byte)(var10 & 255);
- var5[var7 + 1] = var8;
- } else {
- var3 = false;
- }
-
- byte var9 = (byte)((var10 & '\uff00') >> 8);
- var5[var7] = var9;
- }
-
- return var5;
- } else {
- return null;
- }
- }
-}
diff --git a/FtcRobotController/app/src/main/java/com/ftdi/j2xx/k.java b/FtcRobotController/app/src/main/java/com/ftdi/j2xx/k.java
deleted file mode 100644
index b638be7..0000000
--- a/FtcRobotController/app/src/main/java/com/ftdi/j2xx/k.java
+++ /dev/null
@@ -1,290 +0,0 @@
-//
-// Source code recreated from a .class file by IntelliJ IDEA
-// (powered by Fernflower decompiler)
-//
-
-package com.ftdi.j2xx;
-
-import android.util.Log;
-import com.ftdi.j2xx.FT_Device;
-import com.ftdi.j2xx.FT_EEPROM;
-import com.ftdi.j2xx.D2xxManager.D2xxException;
-
-class k {
- private FT_Device d;
- short a;
- int b;
- boolean c;
-
- k(FT_Device var1) {
- this.d = var1;
- }
-
- int a(short var1) {
- byte[] var3 = new byte[2];
- byte var4 = -1;
- if(var1 >= 1024) {
- return var4;
- } else {
- this.d.c().controlTransfer(-64, 144, 0, var1, var3, 2, 0);
- int var5 = var3[1] & 255;
- var5 <<= 8;
- var5 |= var3[0] & 255;
- return var5;
- }
- }
-
- boolean a(short var1, short var2) {
- int var3 = var2 & '\uffff';
- int var4 = var1 & '\uffff';
- boolean var5 = false;
- boolean var6 = false;
- if(var1 >= 1024) {
- return var6;
- } else {
- int var7 = this.d.c().controlTransfer(64, 145, var3, var4, (byte[])null, 0, 0);
- if(var7 == 0) {
- var6 = true;
- }
-
- return var6;
- }
- }
-
- int c() {
- boolean var1 = false;
- int var2 = this.d.c().controlTransfer(64, 146, 0, 0, (byte[])null, 0, 0);
- return var2;
- }
-
- short a(FT_EEPROM var1) {
- return (short)1;
- }
-
- boolean a(int[] var1, int var2) {
- int var3 = var2;
- int var4 = 'ꪪ';
- boolean var5 = false;
- int var6 = 0;
- boolean var7 = false;
- boolean var8 = false;
-
- while(var6 < var3) {
- this.a((short)var6, (short)var1[var6]);
- int var9 = var1[var6] ^ var4;
- var9 &= '\uffff';
- short var10 = (short)(var9 << 1 & '\uffff');
- short var11 = (short)(var9 >> 15 & '\uffff');
- var4 = var10 | var11;
- var4 &= '\uffff';
- ++var6;
- Log.d("FT_EE_Ctrl", "Entered WriteWord Checksum : " + var4);
- }
-
- this.a((short)var3, (short)var4);
- return true;
- }
-
- FT_EEPROM a() {
- return null;
- }
-
- int a(Object var1) {
- FT_EEPROM var2 = (FT_EEPROM)var1;
- boolean var3 = false;
- byte var4 = 0;
- boolean var5 = false;
- int var7 = var4 | 128;
- if(var2.RemoteWakeup) {
- var7 |= 32;
- }
-
- if(var2.SelfPowered) {
- var7 |= 64;
- }
-
- short var8 = var2.MaxPower;
- int var9 = var8 / 2;
- var9 <<= 8;
- int var6 = var9 | var7;
- return var6;
- }
-
- void a(FT_EEPROM var1, int var2) {
- byte var3 = (byte)(var2 >> 8);
- var1.MaxPower = (short)(2 * var3);
- byte var4 = (byte)var2;
- if((var4 & 64) == 64 && (var4 & 128) == 128) {
- var1.SelfPowered = true;
- } else {
- var1.SelfPowered = false;
- }
-
- if((var4 & 32) == 32) {
- var1.RemoteWakeup = true;
- } else {
- var1.RemoteWakeup = false;
- }
-
- }
-
- int b(Object var1) {
- FT_EEPROM var2 = (FT_EEPROM)var1;
- byte var3 = 0;
- int var4;
- if(var2.PullDownEnable) {
- var4 = var3 | 4;
- } else {
- var4 = var3 & 251;
- }
-
- if(var2.SerNumEnable) {
- var4 |= 8;
- } else {
- var4 &= 247;
- }
-
- return var4;
- }
-
- void a(Object var1, int var2) {
- FT_EEPROM var3 = (FT_EEPROM)var1;
- if((var2 & 4) > 0) {
- var3.PullDownEnable = true;
- } else {
- var3.PullDownEnable = false;
- }
-
- if((var2 & 8) > 0) {
- var3.SerNumEnable = true;
- } else {
- var3.SerNumEnable = false;
- }
-
- }
-
- int a(String var1, int[] var2, int var3, int var4, boolean var5) {
- int var6 = 0;
- int var7 = var1.length() * 2 + 2;
- var2[var4] = var7 << 8 | var3 * 2;
- if(var5) {
- var2[var4] += 128;
- }
-
- char[] var8 = var1.toCharArray();
- var2[var3++] = var7 | 768;
- var7 -= 2;
- var7 /= 2;
-
- do {
- var2[var3++] = var8[var6];
- ++var6;
- } while(var6 < var7);
-
- return var3;
- }
-
- String a(int var1, int[] var2) {
- String var3 = "";
- int var5 = var2[var1] & 255;
- var5 = var5 / 2 - 1;
- ++var1;
- int var4 = var1 + var5;
-
- for(int var6 = var1; var6 < var4; ++var6) {
- var3 = var3 + (char)var2[var6];
- }
-
- return var3;
- }
-
- int a(byte var1) throws D2xxException {
- short var2 = 192;
- boolean var3 = false;
- boolean var4 = false;
- short var5 = (short)(var1 & -1);
- int[] var6 = new int[3];
- boolean var7 = false;
- short var9 = (short)this.a(var5);
- if(var9 != '\uffff') {
- switch(var9) {
- case 70:
- this.a = 70;
- this.b = 64;
- this.c = false;
- return 64;
- case 82:
- this.a = 82;
- this.b = 1024;
- this.c = false;
- return 1024;
- case 86:
- this.a = 86;
- this.b = 128;
- this.c = false;
- return 128;
- case 102:
- this.a = 102;
- this.b = 128;
- this.c = false;
- return 256;
- default:
- return 0;
- }
- } else {
- short var10 = 192;
- var7 = this.a(var10, (short)var2);
- var6[0] = this.a((short)192);
- var6[1] = this.a((short)64);
- var6[2] = this.a((short)0);
- if(!var7) {
- this.a = 255;
- this.b = 0;
- return 0;
- } else {
- this.c = true;
- byte var11 = 0;
- int var8 = this.a((short)var11);
- if((var8 & 255) == 192) {
- this.c();
- this.a = 70;
- this.b = 64;
- return 64;
- } else {
- var11 = 64;
- var8 = this.a((short)var11);
- if((var8 & 255) == 192) {
- this.c();
- this.a = 86;
- this.b = 128;
- return 128;
- } else {
- var10 = 192;
- var8 = this.a(var10);
- if((var8 & 255) == 192) {
- this.c();
- this.a = 102;
- this.b = 128;
- return 256;
- } else {
- this.c();
- return 0;
- }
- }
- }
- }
- }
- }
-
- int a(byte[] var1) {
- return 0;
- }
-
- byte[] a(int var1) {
- return null;
- }
-
- int b() {
- return 0;
- }
-}
diff --git a/FtcRobotController/app/src/main/java/com/ftdi/j2xx/l.java b/FtcRobotController/app/src/main/java/com/ftdi/j2xx/l.java
deleted file mode 100644
index 284ab01..0000000
--- a/FtcRobotController/app/src/main/java/com/ftdi/j2xx/l.java
+++ /dev/null
@@ -1,564 +0,0 @@
-//
-// Source code recreated from a .class file by IntelliJ IDEA
-// (powered by Fernflower decompiler)
-//
-
-package com.ftdi.j2xx;
-
-import com.ftdi.j2xx.FT_Device;
-import com.ftdi.j2xx.FT_EEPROM;
-import com.ftdi.j2xx.FT_EEPROM_X_Series;
-import com.ftdi.j2xx.k;
-
-class l extends k {
- private static FT_Device d;
-
- l(FT_Device var1) {
- super(var1);
- d = var1;
- this.b = 128;
- this.a = 1;
- }
-
- short a(FT_EEPROM var1) {
- int[] var2 = new int[this.b];
- short var3 = 0;
- if(var1.getClass() != FT_EEPROM_X_Series.class) {
- return (short)1;
- } else {
- FT_EEPROM_X_Series var4 = (FT_EEPROM_X_Series)var1;
-
- do {
- var2[var3] = this.a(var3);
- } while(++var3 < this.b);
-
- try {
- var2[0] = 0;
- if(var4.BCDEnable) {
- var2[0] |= 1;
- }
-
- if(var4.BCDForceCBusPWREN) {
- var2[0] |= 2;
- }
-
- if(var4.BCDDisableSleep) {
- var2[0] |= 4;
- }
-
- if(var4.RS485EchoSuppress) {
- var2[0] |= 8;
- }
-
- if(var4.A_LoadVCP) {
- var2[0] |= 128;
- }
-
- if(var4.PowerSaveEnable) {
- boolean var5 = false;
- if(var4.CBus0 == 17) {
- var5 = true;
- }
-
- if(var4.CBus1 == 17) {
- var5 = true;
- }
-
- if(var4.CBus2 == 17) {
- var5 = true;
- }
-
- if(var4.CBus3 == 17) {
- var5 = true;
- }
-
- if(var4.CBus4 == 17) {
- var5 = true;
- }
-
- if(var4.CBus5 == 17) {
- var5 = true;
- }
-
- if(var4.CBus6 == 17) {
- var5 = true;
- }
-
- if(!var5) {
- return (short)1;
- }
-
- var2[0] |= 64;
- }
-
- var2[1] = var4.VendorId;
- var2[2] = var4.ProductId;
- var2[3] = 4096;
- var2[4] = this.a((Object)var1);
- var2[5] = this.b(var1);
- if(var4.FT1248ClockPolarity) {
- var2[5] |= 16;
- }
-
- if(var4.FT1248LSB) {
- var2[5] |= 32;
- }
-
- if(var4.FT1248FlowControl) {
- var2[5] |= 64;
- }
-
- if(var4.I2CDisableSchmitt) {
- var2[5] |= 128;
- }
-
- if(var4.InvertTXD) {
- var2[5] |= 256;
- }
-
- if(var4.InvertRXD) {
- var2[5] |= 512;
- }
-
- if(var4.InvertRTS) {
- var2[5] |= 1024;
- }
-
- if(var4.InvertCTS) {
- var2[5] |= 2048;
- }
-
- if(var4.InvertDTR) {
- var2[5] |= 4096;
- }
-
- if(var4.InvertDSR) {
- var2[5] |= 8192;
- }
-
- if(var4.InvertDCD) {
- var2[5] |= 16384;
- }
-
- if(var4.InvertRI) {
- var2[5] |= '耀';
- }
-
- var2[6] = 0;
- byte var19 = var4.AD_DriveCurrent;
- if(var19 == -1) {
- var19 = 0;
- }
-
- var2[6] |= var19;
- if(var4.AD_SlowSlew) {
- var2[6] |= 4;
- }
-
- if(var4.AD_SchmittInput) {
- var2[6] |= 8;
- }
-
- byte var6 = var4.AC_DriveCurrent;
- if(var6 == -1) {
- var6 = 0;
- }
-
- short var17 = (short)(var6 << 4);
- var2[6] |= var17;
- if(var4.AC_SlowSlew) {
- var2[6] |= 64;
- }
-
- if(var4.AC_SchmittInput) {
- var2[6] |= 128;
- }
-
- byte var7 = 80;
- int var18 = this.a(var4.Manufacturer, var2, var7, 7, false);
- var18 = this.a(var4.Product, var2, var18, 8, false);
- if(var4.SerNumEnable) {
- this.a(var4.SerialNumber, var2, var18, 9, false);
- }
-
- var2[10] = var4.I2CSlaveAddress;
- var2[11] = var4.I2CDeviceID & '\uffff';
- var2[12] = var4.I2CDeviceID >> 16;
- byte var8 = var4.CBus0;
- if(var8 == -1) {
- var8 = 0;
- }
-
- byte var9 = var4.CBus1;
- if(var9 == -1) {
- var9 = 0;
- }
-
- int var20 = var9 << 8;
- var2[13] = (short)(var8 | var20);
- byte var10 = var4.CBus2;
- if(var10 == -1) {
- var10 = 0;
- }
-
- byte var11 = var4.CBus3;
- if(var11 == -1) {
- var11 = 0;
- }
-
- int var21 = var11 << 8;
- var2[14] = (short)(var10 | var21);
- byte var12 = var4.CBus4;
- if(var12 == -1) {
- var12 = 0;
- }
-
- byte var13 = var4.CBus5;
- if(var13 == -1) {
- var13 = 0;
- }
-
- int var22 = var13 << 8;
- var2[15] = (short)(var12 | var22);
- byte var14 = var4.CBus6;
- if(var14 == -1) {
- var14 = 0;
- }
-
- var2[16] = (short)var14;
- if(var2[1] != 0 && var2[2] != 0) {
- boolean var15 = false;
- var15 = this.b(var2, this.b - 1);
- return (short)(var15?0:1);
- } else {
- return (short)2;
- }
- } catch (Exception var16) {
- var16.printStackTrace();
- return (short)0;
- }
- }
- }
-
- boolean b(int[] var1, int var2) {
- int var3 = var2;
- int var4 = 'ꪪ';
- boolean var5 = false;
- int var6 = 0;
- boolean var7 = false;
- boolean var8 = false;
- boolean var9 = false;
-
- do {
- int var13 = var1[var6];
- var13 &= '\uffff';
- this.a((short)var6, (short)var13);
- int var10 = var13 ^ var4;
- var10 &= '\uffff';
- int var11 = var10 << 1;
- var11 &= '\uffff';
- byte var12;
- if((var10 & '耀') > 0) {
- var12 = 1;
- } else {
- var12 = 0;
- }
-
- var4 = var11 | var12;
- var4 &= '\uffff';
- ++var6;
- if(var6 == 18) {
- var6 = 64;
- }
- } while(var6 != var3);
-
- this.a((short)var3, (short)var4);
- return true;
- }
-
- FT_EEPROM a() {
- FT_EEPROM_X_Series var1 = new FT_EEPROM_X_Series();
- int[] var2 = new int[this.b];
-
- try {
- short var3;
- for(var3 = 0; var3 < this.b; ++var3) {
- var2[var3] = this.a(var3);
- }
-
- if((var2[0] & 1) > 0) {
- var1.BCDEnable = true;
- } else {
- var1.BCDEnable = false;
- }
-
- if((var2[0] & 2) > 0) {
- var1.BCDForceCBusPWREN = true;
- } else {
- var1.BCDForceCBusPWREN = false;
- }
-
- if((var2[0] & 4) > 0) {
- var1.BCDDisableSleep = true;
- } else {
- var1.BCDDisableSleep = false;
- }
-
- if((var2[0] & 8) > 0) {
- var1.RS485EchoSuppress = true;
- } else {
- var1.RS485EchoSuppress = false;
- }
-
- if((var2[0] & 64) > 0) {
- var1.PowerSaveEnable = true;
- } else {
- var1.PowerSaveEnable = false;
- }
-
- if((var2[0] & 128) > 0) {
- var1.A_LoadVCP = true;
- var1.A_LoadD2XX = false;
- } else {
- var1.A_LoadVCP = false;
- var1.A_LoadD2XX = true;
- }
-
- var1.VendorId = (short)var2[1];
- var1.ProductId = (short)var2[2];
- this.a(var1, var2[4]);
- this.a(var1, var2[5]);
- if((var2[5] & 16) > 0) {
- var1.FT1248ClockPolarity = true;
- } else {
- var1.FT1248ClockPolarity = false;
- }
-
- if((var2[5] & 32) > 0) {
- var1.FT1248LSB = true;
- } else {
- var1.FT1248LSB = false;
- }
-
- if((var2[5] & 64) > 0) {
- var1.FT1248FlowControl = true;
- } else {
- var1.FT1248FlowControl = false;
- }
-
- if((var2[5] & 128) > 0) {
- var1.I2CDisableSchmitt = true;
- } else {
- var1.I2CDisableSchmitt = false;
- }
-
- if((var2[5] & 256) == 256) {
- var1.InvertTXD = true;
- } else {
- var1.InvertTXD = false;
- }
-
- if((var2[5] & 512) == 512) {
- var1.InvertRXD = true;
- } else {
- var1.InvertRXD = false;
- }
-
- if((var2[5] & 1024) == 1024) {
- var1.InvertRTS = true;
- } else {
- var1.InvertRTS = false;
- }
-
- if((var2[5] & 2048) == 2048) {
- var1.InvertCTS = true;
- } else {
- var1.InvertCTS = false;
- }
-
- if((var2[5] & 4096) == 4096) {
- var1.InvertDTR = true;
- } else {
- var1.InvertDTR = false;
- }
-
- if((var2[5] & 8192) == 8192) {
- var1.InvertDSR = true;
- } else {
- var1.InvertDSR = false;
- }
-
- if((var2[5] & 16384) == 16384) {
- var1.InvertDCD = true;
- } else {
- var1.InvertDCD = false;
- }
-
- if((var2[5] & '耀') == '耀') {
- var1.InvertRI = true;
- } else {
- var1.InvertRI = false;
- }
-
- var3 = (short)(var2[6] & 3);
- switch(var3) {
- case 0:
- var1.AD_DriveCurrent = 0;
- break;
- case 1:
- var1.AD_DriveCurrent = 1;
- break;
- case 2:
- var1.AD_DriveCurrent = 2;
- break;
- case 3:
- var1.AD_DriveCurrent = 3;
- }
-
- short var4 = (short)(var2[6] & 4);
- if(var4 == 4) {
- var1.AD_SlowSlew = true;
- } else {
- var1.AD_SlowSlew = false;
- }
-
- short var5 = (short)(var2[6] & 8);
- if(var5 == 8) {
- var1.AD_SchmittInput = true;
- } else {
- var1.AD_SchmittInput = false;
- }
-
- short var6 = (short)((var2[6] & 48) >> 4);
- switch(var6) {
- case 0:
- var1.AC_DriveCurrent = 0;
- break;
- case 1:
- var1.AC_DriveCurrent = 1;
- break;
- case 2:
- var1.AC_DriveCurrent = 2;
- break;
- case 3:
- var1.AC_DriveCurrent = 3;
- }
-
- short var7 = (short)(var2[6] & 64);
- if(var7 == 64) {
- var1.AC_SlowSlew = true;
- } else {
- var1.AC_SlowSlew = false;
- }
-
- short var8 = (short)(var2[6] & 128);
- if(var8 == 128) {
- var1.AC_SchmittInput = true;
- } else {
- var1.AC_SchmittInput = false;
- }
-
- var1.I2CSlaveAddress = var2[10];
- var1.I2CDeviceID = var2[11];
- var1.I2CDeviceID |= (var2[12] & 255) << 16;
- var1.CBus0 = (byte)(var2[13] & 255);
- var1.CBus1 = (byte)(var2[13] >> 8 & 255);
- var1.CBus2 = (byte)(var2[14] & 255);
- var1.CBus3 = (byte)(var2[14] >> 8 & 255);
- var1.CBus4 = (byte)(var2[15] & 255);
- var1.CBus5 = (byte)(var2[15] >> 8 & 255);
- var1.CBus6 = (byte)(var2[16] & 255);
- this.a = (short)(var2[73] >> 8);
- int var9 = var2[7] & 255;
- var9 /= 2;
- var1.Manufacturer = this.a(var9, var2);
- var9 = var2[8] & 255;
- var9 /= 2;
- var1.Product = this.a(var9, var2);
- var9 = var2[9] & 255;
- var9 /= 2;
- var1.SerialNumber = this.a(var9, var2);
- return var1;
- } catch (Exception var10) {
- return null;
- }
- }
-
- int b() {
- int var1 = this.a((short)9);
- int var2 = var1 & 255;
- var2 /= 2;
- int var3 = (var1 & '\uff00') >> 8;
- var2 += var3 / 2;
- ++var2;
- return (this.b - 1 - 1 - var2) * 2;
- }
-
- int a(byte[] var1) {
- boolean var2 = false;
- boolean var3 = false;
- if(var1.length > this.b()) {
- return 0;
- } else {
- int[] var4 = new int[this.b];
-
- for(short var5 = 0; var5 < this.b; ++var5) {
- var4[var5] = this.a(var5);
- }
-
- short var7 = (short)(this.b - this.b() / 2 - 1 - 1);
-
- for(int var8 = 0; var8 < var1.length; var8 += 2) {
- int var6;
- if(var8 + 1 < var1.length) {
- var6 = var1[var8 + 1] & 255;
- } else {
- var6 = 0;
- }
-
- var6 <<= 8;
- var6 |= var1[var8] & 255;
- var4[var7++] = var6;
- }
-
- if(var4[1] != 0 && var4[2] != 0) {
- boolean var9 = false;
- var9 = this.b(var4, this.b - 1);
- if(!var9) {
- return 0;
- } else {
- return var1.length;
- }
- } else {
- return 0;
- }
- }
- }
-
- byte[] a(int var1) {
- boolean var2 = false;
- boolean var3 = false;
- boolean var4 = false;
- byte[] var5 = new byte[var1];
- if(var1 != 0 && var1 <= this.b()) {
- short var6 = (short)(this.b - this.b() / 2 - 1 - 1);
-
- for(int var7 = 0; var7 < var1; var7 += 2) {
- int var10 = this.a(var6++);
- if(var7 + 1 < var5.length) {
- byte var8 = (byte)(var10 & 255);
- var5[var7 + 1] = var8;
- } else {
- var3 = false;
- }
-
- byte var9 = (byte)((var10 & '\uff00') >> 8);
- var5[var7] = var9;
- }
-
- return var5;
- } else {
- return null;
- }
- }
-}
diff --git a/FtcRobotController/app/src/main/java/com/ftdi/j2xx/m.java b/FtcRobotController/app/src/main/java/com/ftdi/j2xx/m.java
deleted file mode 100644
index 5c14833..0000000
--- a/FtcRobotController/app/src/main/java/com/ftdi/j2xx/m.java
+++ /dev/null
@@ -1,55 +0,0 @@
-package com.ftdi.j2xx;
-
-class m {
- private int a;
- private int b;
-
- m() {
- this.a = 0;
- this.b = 0;
- }
-
- m(int var1, int var2) {
- this.a = var1;
- this.b = var2;
- }
-
- public int a() {
- return this.a;
- }
-
- public int b() {
- return this.b;
- }
-
- public boolean equals(Object var1) {
- if(this != var1) {
- if(!(var1 instanceof m)) {
- return false;
- }
-
- m var2 = (m)var1;
- if(this.a != var2.a) {
- return false;
- }
-
- if(this.b != var2.b) {
- return false;
- }
- }
-
- return true;
- }
-
- public int hashCode() {
- throw new UnsupportedOperationException();
- }
-
- public String toString() {
- StringBuilder var1 = new StringBuilder("Vendor: ");
- Object[] var2 = new Object[]{Integer.valueOf(this.a)};
- StringBuilder var3 = var1.append(String.format("%04x", var2)).append(", Product: ");
- Object[] var4 = new Object[]{Integer.valueOf(this.b)};
- return var3.append(String.format("%04x", var4)).toString();
- }
-}
diff --git a/FtcRobotController/app/src/main/java/com/ftdi/j2xx/n.java b/FtcRobotController/app/src/main/java/com/ftdi/j2xx/n.java
deleted file mode 100644
index ff2da3b..0000000
--- a/FtcRobotController/app/src/main/java/com/ftdi/j2xx/n.java
+++ /dev/null
@@ -1,66 +0,0 @@
-//
-// Source code recreated from a .class file by IntelliJ IDEA
-// (powered by Fernflower decompiler)
-//
-
-package com.ftdi.j2xx;
-
-import java.nio.ByteBuffer;
-
-class n {
- private int a;
- private ByteBuffer b;
- private int c;
- private boolean d;
-
- public n(int var1) {
- this.b = ByteBuffer.allocate(var1);
- this.b(0);
- }
-
- void a(int var1) {
- this.a = var1;
- }
-
- ByteBuffer a() {
- return this.b;
- }
-
- int b() {
- return this.c;
- }
-
- void b(int var1) {
- this.c = var1;
- }
-
- synchronized void c() {
- this.b.clear();
- this.b(0);
- }
-
- synchronized boolean d() {
- return this.d;
- }
-
- synchronized ByteBuffer c(int var1) {
- ByteBuffer var2 = null;
- if(!this.d) {
- this.d = true;
- this.a = var1;
- var2 = this.b;
- }
-
- return var2;
- }
-
- synchronized boolean d(int var1) {
- boolean var2 = false;
- if(this.d && var1 == this.a) {
- this.d = false;
- var2 = true;
- }
-
- return var2;
- }
-}
diff --git a/FtcRobotController/app/src/main/java/com/ftdi/j2xx/o.java b/FtcRobotController/app/src/main/java/com/ftdi/j2xx/o.java
deleted file mode 100644
index 0f18019..0000000
--- a/FtcRobotController/app/src/main/java/com/ftdi/j2xx/o.java
+++ /dev/null
@@ -1,477 +0,0 @@
-//
-// Source code recreated from a .class file by IntelliJ IDEA
-// (powered by Fernflower decompiler)
-//
-
-package com.ftdi.j2xx;
-
-import android.content.Intent;
-import android.support.v4.content.LocalBroadcastManager;
-import android.util.Log;
-
-import com.ftdi.j2xx.D2xxManager.D2xxException;
-import com.ftdi.j2xx.D2xxManager.DriverParameters;
-import java.io.IOException;
-import java.nio.ByteBuffer;
-import java.nio.channels.Pipe;
-import java.nio.channels.Pipe.SinkChannel;
-import java.nio.channels.Pipe.SourceChannel;
-import java.util.concurrent.Semaphore;
-import java.util.concurrent.TimeUnit;
-import java.util.concurrent.locks.Condition;
-import java.util.concurrent.locks.Lock;
-import java.util.concurrent.locks.ReentrantLock;
-
-class o {
- private Semaphore[] a;
- private Semaphore[] b;
- private n[] c;
- private ByteBuffer d;
- private ByteBuffer[] e;
- private Pipe f;
- private SinkChannel g;
- private SourceChannel h;
- private int i;
- private int j;
- private Object k;
- private FT_Device l;
- private DriverParameters m;
- private Lock n;
- private Condition o;
- private boolean p;
- private Lock q;
- private Condition r;
- private Object s;
- private int t;
-
- public o(FT_Device var1) {
- this.l = var1;
- this.m = this.l.d();
- this.i = this.m.getBufferNumber();
- int var2 = this.m.getMaxBufferSize();
- this.t = this.l.e();
- this.a = new Semaphore[this.i];
- this.b = new Semaphore[this.i];
- this.c = new n[this.i];
- this.e = new ByteBuffer[256];
- this.n = new ReentrantLock();
- this.o = this.n.newCondition();
- this.p = false;
- this.q = new ReentrantLock();
- this.r = this.q.newCondition();
- this.k = new Object();
- this.s = new Object();
- this.h();
- this.d = ByteBuffer.allocateDirect(var2);
-
- try {
- this.f = Pipe.open();
- this.g = this.f.sink();
- this.h = this.f.source();
- } catch (IOException var6) {
- Log.d("ProcessInCtrl", "Create mMainPipe failed!");
- var6.printStackTrace();
- }
-
- for(int var3 = 0; var3 < this.i; ++var3) {
- this.c[var3] = new n(var2);
- this.b[var3] = new Semaphore(1);
- this.a[var3] = new Semaphore(1);
-
- try {
- this.c(var3);
- } catch (Exception var5) {
- Log.d("ProcessInCtrl", "Acquire read buffer " + var3 + " failed!");
- var5.printStackTrace();
- }
- }
-
- }
-
- boolean a() {
- return this.p;
- }
-
- DriverParameters b() {
- return this.m;
- }
-
- n a(int var1) {
- n var2 = null;
- n[] var3 = this.c;
- synchronized(this.c) {
- if(var1 >= 0 && var1 < this.i) {
- var2 = this.c[var1];
- }
-
- return var2;
- }
- }
-
- n b(int var1) throws InterruptedException {
- n var2 = null;
- this.a[var1].acquire();
- var2 = this.a(var1);
- if(var2.c(var1) == null) {
- var2 = null;
- }
-
- return var2;
- }
-
- n c(int var1) throws InterruptedException {
- n var2 = null;
- this.b[var1].acquire();
- var2 = this.a(var1);
- return var2;
- }
-
- public void d(int var1) throws InterruptedException {
- n[] var2 = this.c;
- synchronized(this.c) {
- this.c[var1].d(var1);
- }
-
- this.a[var1].release();
- }
-
- public void e(int var1) throws InterruptedException {
- this.b[var1].release();
- }
-
- public void a(n var1) throws D2xxException {
- boolean var2 = false;
- byte var3 = 0;
- byte var4 = 0;
- boolean var5 = false;
-
- try {
- int var12 = var1.b();
- if(var12 < 2) {
- var1.a().clear();
- return;
- }
-
- Object var8 = this.s;
- int var6;
- int var7;
- synchronized(this.s) {
- var6 = this.d();
- var7 = var12 - 2;
- if(var6 < var7) {
- Log.d("ProcessBulkIn::", " Buffer is full, waiting for read....");
- this.a(var5, var3, var4);
- this.n.lock();
- this.p = true;
- }
- }
-
- if(var6 < var7) {
- this.o.await();
- this.n.unlock();
- }
-
- this.b(var1);
- } catch (InterruptedException var10) {
- this.n.unlock();
- Log.e("ProcessInCtrl", "Exception in Full await!");
- var10.printStackTrace();
- } catch (Exception var11) {
- Log.e("ProcessInCtrl", "Exception in ProcessBulkIN");
- var11.printStackTrace();
- throw new D2xxException("Fatal error in BulkIn.");
- }
-
- }
-
- private void b(n var1) throws InterruptedException {
- boolean var2 = false;
- boolean var3 = false;
- int var4 = 0;
- boolean var5 = false;
- boolean var6 = false;
- long var7 = 0L;
- short var9 = 0;
- short var10 = 0;
- boolean var11 = false;
- ByteBuffer var12 = null;
- var12 = var1.a();
- int var17 = var1.b();
- if(var17 > 0) {
- int var18 = var17 / this.t + (var17 % this.t > 0?1:0);
-
- for(int var13 = 0; var13 < var18; ++var13) {
- int var19;
- int var20;
- if(var13 == var18 - 1) {
- var20 = var17;
- var12.limit(var17);
- var19 = var13 * this.t;
- var12.position(var19);
- byte var14 = var12.get();
- var9 = (short)(this.l.ftDeviceInfoListNode.modemStatus ^ (short)(var14 & 240));
- this.l.ftDeviceInfoListNode.modemStatus = (short)(var14 & 240);
- byte var15 = var12.get();
- this.l.ftDeviceInfoListNode.lineStatus = (short)(var15 & 255);
- var19 += 2;
- if(var12.hasRemaining()) {
- var10 = (short)(this.l.ftDeviceInfoListNode.lineStatus & 30);
- } else {
- var10 = 0;
- }
- } else {
- var20 = (var13 + 1) * this.t;
- var12.limit(var20);
- var19 = var13 * this.t + 2;
- var12.position(var19);
- }
-
- var4 += var20 - var19;
- this.e[var13] = var12.slice();
- }
-
- if(var4 != 0) {
- var11 = true;
-
- try {
- var7 = this.g.write(this.e, 0, var18);
- if(var7 != (long)var4) {
- Log.d("extractReadData::", "written != totalData, written= " + var7 + " totalData=" + var4);
- }
-
- this.f((int)var7);
- this.q.lock();
- this.r.signalAll();
- this.q.unlock();
- } catch (Exception var16) {
- Log.d("extractReadData::", "Write data to sink failed!!");
- var16.printStackTrace();
- }
- }
-
- var12.clear();
- this.a(var11, var9, var10);
- }
-
- }
-
- public int a(byte[] var1, int var2, long var3) {
- boolean var5 = false;
- int var6 = 0;
- int var7 = this.m.getMaxBufferSize();
- long var8 = System.currentTimeMillis();
- ByteBuffer var10 = ByteBuffer.wrap(var1, 0, var2);
- if(var3 == 0L) {
- var3 = (long)this.m.getReadTimeout();
- }
-
- while(this.l.isOpen()) {
- if(this.c() >= var2) {
- SourceChannel var11 = this.h;
- synchronized(this.h) {
- try {
- this.h.read(var10);
- this.g(var2);
- } catch (Exception var13) {
- Log.d("readBulkInData::", "Cannot read data from Source!!");
- var13.printStackTrace();
- }
- }
-
- Object var17 = this.s;
- synchronized(this.s) {
- if(this.p) {
- Log.i("FTDI debug::", "buffer is full , and also re start buffer");
- this.n.lock();
- this.o.signalAll();
- this.p = false;
- this.n.unlock();
- }
- }
-
- var6 = var2;
- break;
- }
-
- try {
- this.q.lock();
- this.r.await(System.currentTimeMillis() - var8, TimeUnit.MILLISECONDS);
- this.q.unlock();
- } catch (InterruptedException var15) {
- Log.d("readBulkInData::", "Cannot wait to read data!!");
- var15.printStackTrace();
- this.q.unlock();
- }
-
- if(System.currentTimeMillis() - var8 >= var3) {
- break;
- }
- }
-
- return var6;
- }
-
- private int f(int var1) {
- Object var3 = this.k;
- synchronized(this.k) {
- this.j += var1;
- int var2 = this.j;
- return var2;
- }
- }
-
- private int g(int var1) {
- Object var3 = this.k;
- synchronized(this.k) {
- this.j -= var1;
- int var2 = this.j;
- return var2;
- }
- }
-
- private void h() {
- Object var1 = this.k;
- synchronized(this.k) {
- this.j = 0;
- }
- }
-
- public int c() {
- Object var2 = this.k;
- synchronized(this.k) {
- int var1 = this.j;
- return var1;
- }
- }
-
- public int d() {
- return this.m.getMaxBufferSize() - this.c() - 1;
- }
-
- public int e() {
- int var1 = this.m.getBufferNumber();
- n var2 = null;
- boolean var3 = false;
- ByteBuffer var4 = this.d;
- synchronized(this.d) {
- int var8;
- try {
- do {
- this.h.configureBlocking(false);
- var8 = this.h.read(this.d);
- this.d.clear();
- } while(var8 != 0);
- } catch (Exception var6) {
- var6.printStackTrace();
- }
-
- this.h();
-
- for(int var5 = 0; var5 < var1; ++var5) {
- var2 = this.a(var5);
- if(var2.d() && var2.b() > 2) {
- var2.c();
- }
- }
-
- return 0;
- }
- }
-
- public int a(boolean var1, short var2, short var3) throws InterruptedException {
- long var6 = 0L;
- boolean var8 = false;
- boolean var9 = false;
- var6 = 0L;
- q var10 = new q();
- var10.a = this.l.i.a;
- Intent var11;
- if(var1 && (var10.a & 1L) != 0L && (this.l.a ^ 1L) == 1L) {
- this.l.a |= 1L;
- var11 = new Intent("FT_EVENT_RXCHAR");
- var11.putExtra("message", "FT_EVENT_RXCHAR");
- LocalBroadcastManager.getInstance(this.l.parentContext).sendBroadcast(var11);
- }
-
- if(var2 != 0 && (var10.a & 2L) != 0L && (this.l.a ^ 2L) == 2L) {
- this.l.a |= 2L;
- var11 = new Intent("FT_EVENT_MODEM_STATUS");
- var11.putExtra("message", "FT_EVENT_MODEM_STATUS");
- LocalBroadcastManager.getInstance(this.l.parentContext).sendBroadcast(var11);
- }
-
- if(var3 != 0 && (var10.a & 4L) != 0L && (this.l.a ^ 4L) == 4L) {
- this.l.a |= 4L;
- var11 = new Intent("FT_EVENT_LINE_STATUS");
- var11.putExtra("message", "FT_EVENT_LINE_STATUS");
- LocalBroadcastManager.getInstance(this.l.parentContext).sendBroadcast(var11);
- }
-
- return 0;
- }
-
- public void f() throws InterruptedException {
- int var1 = this.m.getBufferNumber();
-
- for(int var2 = 0; var2 < var1; ++var2) {
- if(this.a(var2).d()) {
- this.d(var2);
- }
- }
-
- }
-
- void g() {
- int var1;
- for(var1 = 0; var1 < this.i; ++var1) {
- try {
- this.e(var1);
- } catch (Exception var4) {
- Log.d("ProcessInCtrl", "Acquire read buffer " + var1 + " failed!");
- var4.printStackTrace();
- }
-
- this.c[var1] = null;
- this.b[var1] = null;
- this.a[var1] = null;
- }
-
- for(var1 = 0; var1 < 256; ++var1) {
- this.e[var1] = null;
- }
-
- this.a = null;
- this.b = null;
- this.c = null;
- this.e = null;
- this.d = null;
- if(this.p) {
- this.n.lock();
- this.o.signalAll();
- this.n.unlock();
- }
-
- this.q.lock();
- this.r.signalAll();
- this.q.unlock();
- this.n = null;
- this.o = null;
- this.k = null;
- this.q = null;
- this.r = null;
-
- try {
- this.g.close();
- this.g = null;
- this.h.close();
- this.h = null;
- this.f = null;
- } catch (IOException var3) {
- Log.d("ProcessInCtrl", "Close mMainPipe failed!");
- var3.printStackTrace();
- }
-
- this.l = null;
- this.m = null;
- }
-}
diff --git a/FtcRobotController/app/src/main/java/com/ftdi/j2xx/p.java b/FtcRobotController/app/src/main/java/com/ftdi/j2xx/p.java
deleted file mode 100644
index 958a8d7..0000000
--- a/FtcRobotController/app/src/main/java/com/ftdi/j2xx/p.java
+++ /dev/null
@@ -1,40 +0,0 @@
-package com.ftdi.j2xx;
-
-import android.util.Log;
-import com.ftdi.j2xx.n;
-import com.ftdi.j2xx.o;
-
-class p implements Runnable {
- int a;
- private o b;
-
- p(o var1) {
- this.b = var1;
- this.a = this.b.b().getBufferNumber();
- }
-
- public void run() {
- int var1 = 0;
-
- try {
- do {
- n var6 = this.b.c(var1);
- if(var6.b() > 0) {
- this.b.a(var6);
- var6.c();
- }
-
- this.b.d(var1);
- var1 = (var1 + 1) % this.a;
- } while(!Thread.interrupted());
-
- throw new InterruptedException();
- } catch (InterruptedException var7) {
- Log.d("ProcessRequestThread::", "Device has been closed.");
- var7.printStackTrace();
- } catch (Exception var8) {
- Log.e("ProcessRequestThread::", "Fatal error!");
- var8.printStackTrace();
- }
- }
-}
diff --git a/FtcRobotController/app/src/main/java/com/ftdi/j2xx/protocol/FT_Spi_Slave.java b/FtcRobotController/app/src/main/java/com/ftdi/j2xx/protocol/FT_Spi_Slave.java
deleted file mode 100644
index 2f0ef7b..0000000
--- a/FtcRobotController/app/src/main/java/com/ftdi/j2xx/protocol/FT_Spi_Slave.java
+++ /dev/null
@@ -1,368 +0,0 @@
-package com.ftdi.j2xx.protocol;
-
-import com.ftdi.j2xx.interfaces.SpiSlave;
-import com.ftdi.j2xx.protocol.SpiSlaveEvent;
-import com.ftdi.j2xx.protocol.SpiSlaveListener;
-import com.ftdi.j2xx.protocol.SpiSlaveRequestEvent;
-import com.ftdi.j2xx.protocol.SpiSlaveResponseEvent;
-import com.ftdi.j2xx.protocol.SpiSlaveThread;
-import junit.framework.Assert;
-
-public class FT_Spi_Slave extends SpiSlaveThread {
- // $FF: synthetic field
- private static int[] m;
- private FT_Spi_Slave.a a;
- private int b;
- private int c;
- private int d;
- private int e;
- private int f;
- private byte[] g;
- private int h;
- private int i;
- private SpiSlave j;
- private SpiSlaveListener k;
- private boolean l;
-
- public FT_Spi_Slave(SpiSlave var1) {
- this.j = var1;
- this.a = FT_Spi_Slave.a.a;
- }
-
- private int a(byte[] var1, int var2, int var3, int var4, int var5) {
- int var6 = 0;
- int var7;
- if(var1 != null) {
- for(var7 = 0; var6 < var1.length; ++var6) {
- var7 += 255 & var1[var6];
- }
- } else {
- var7 = 0;
- }
-
- return var4 + var3 + var7 + var2 + (('\uff00' & var5) >> 8) + (var5 & 255);
- }
-
- private void a(byte[] var1) {
- int var2 = 0;
- boolean var3 = false;
-
- boolean var9;
- for(boolean var4 = false; var2 < var1.length; var4 = var9) {
- int var5 = 255 & var1[var2];
- boolean var7;
- switch(a()[this.a.ordinal()]) {
- case 1:
- if(var5 != 90) {
- var7 = true;
- } else {
- this.a = FT_Spi_Slave.a.b;
- this.b = var5;
- var7 = var4;
- }
- break;
- case 2:
- if(!this.a(var5)) {
- var3 = true;
- var4 = true;
- } else {
- this.c = var5;
- }
-
- this.a = FT_Spi_Slave.a.c;
- var7 = var4;
- break;
- case 3:
- this.d = var5;
- this.a = FT_Spi_Slave.a.d;
- var7 = var4;
- break;
- case 4:
- this.e = var5 * 256;
- this.a = FT_Spi_Slave.a.e;
- var7 = var4;
- break;
- case 5:
- this.e += var5;
- this.f = 0;
- this.g = new byte[this.e];
- this.a = FT_Spi_Slave.a.f;
- var7 = var4;
- break;
- case 6:
- this.g[this.f] = var1[var2];
- ++this.f;
- if(this.f == this.e) {
- this.a = FT_Spi_Slave.a.g;
- var7 = var4;
- break;
- }
- default:
- var7 = var4;
- break;
- case 7:
- this.h = var5 * 256;
- this.a = FT_Spi_Slave.a.h;
- var7 = var4;
- break;
- case 8:
- this.h += var5;
- int var6 = this.a(this.g, this.b, this.c, this.d, this.e);
- if(this.h == var6) {
- if(this.c == 128) {
- this.b();
- if(this.k != null) {
- SpiSlaveResponseEvent var12 = new SpiSlaveResponseEvent(3, 0, this.g, (Object)null, (Object)null);
- this.k.OnDataReceived(var12);
- }
- }
- } else {
- var3 = true;
- }
-
- var7 = true;
- }
-
- if(var3 && this.k != null) {
- SpiSlaveResponseEvent var10 = new SpiSlaveResponseEvent(3, 1, (Object)null, (Object)null, (Object)null);
- this.k.OnDataReceived(var10);
- }
-
- boolean var8;
- if(var7) {
- this.a = FT_Spi_Slave.a.a;
- this.b = 0;
- this.c = 0;
- this.d = 0;
- this.e = 0;
- this.f = 0;
- this.h = 0;
- this.g = null;
- var8 = false;
- var9 = false;
- } else {
- var8 = var3;
- var9 = var7;
- }
-
- ++var2;
- var3 = var8;
- }
-
- }
-
- private boolean a(int var1) {
- return var1 == 128 || var1 == 130 || var1 == 136;
- }
-
- // $FF: synthetic method
- static int[] a() {
- int[] var0 = m;
- if(var0 != null) {
- return var0;
- } else {
- int[] var1 = new int[FT_Spi_Slave.a.values().length];
-
- try {
- var1[FT_Spi_Slave.a.g.ordinal()] = 7;
- } catch (NoSuchFieldError var17) {
- ;
- }
-
- try {
- var1[FT_Spi_Slave.a.h.ordinal()] = 8;
- } catch (NoSuchFieldError var16) {
- ;
- }
-
- try {
- var1[FT_Spi_Slave.a.b.ordinal()] = 2;
- } catch (NoSuchFieldError var15) {
- ;
- }
-
- try {
- var1[FT_Spi_Slave.a.f.ordinal()] = 6;
- } catch (NoSuchFieldError var14) {
- ;
- }
-
- try {
- var1[FT_Spi_Slave.a.d.ordinal()] = 4;
- } catch (NoSuchFieldError var13) {
- ;
- }
-
- try {
- var1[FT_Spi_Slave.a.e.ordinal()] = 5;
- } catch (NoSuchFieldError var12) {
- ;
- }
-
- try {
- var1[FT_Spi_Slave.a.c.ordinal()] = 3;
- } catch (NoSuchFieldError var11) {
- ;
- }
-
- try {
- var1[FT_Spi_Slave.a.a.ordinal()] = 1;
- } catch (NoSuchFieldError var10) {
- ;
- }
-
- m = var1;
- return var1;
- }
- }
-
- private void b() {
- byte[] var1 = new byte[]{(byte)0, (byte)90, (byte)-124, (byte)this.d, (byte)0, (byte)0, (byte)0, (byte)0};
- int var2 = this.a((byte[])null, 90, 132, this.d, 0);
- var1[6] = (byte)(('\uff00' & var2) >> 8);
- var1[7] = (byte)(var2 & 255);
- int[] var3 = new int[1];
- this.j.write(var1, var1.length, var3);
- }
-
- public int close() {
- if(!this.l) {
- return 3;
- } else {
- this.sendMessage(new SpiSlaveRequestEvent(-1, true, (Object)null, (Object)null, (Object)null));
- this.l = false;
- return 0;
- }
- }
-
- protected boolean isTerminateEvent(SpiSlaveEvent var1) {
- if(Thread.interrupted()) {
- if(var1 instanceof SpiSlaveRequestEvent) {
- switch(var1.getEventType()) {
- case -1:
- return true;
- }
- } else {
- Assert.assertTrue("processEvent wrong type" + var1.getEventType(), false);
- }
-
- return false;
- } else {
- return true;
- }
- }
-
- public int open() {
- if(this.l) {
- return 1;
- } else {
- this.l = true;
- this.j.init();
- this.start();
- return 0;
- }
- }
-
- protected boolean pollData() {
- int[] var1 = new int[1];
- int var2 = this.j.getRxStatus(var1);
- if(var1[0] > 0 && var2 == 0) {
- byte[] var6 = new byte[var1[0]];
- var2 = this.j.read(var6, var6.length, var1);
- if(var2 == 0) {
- this.a(var6);
- }
- }
-
- if(var2 == 4 && this.k != null) {
- SpiSlaveResponseEvent var4 = new SpiSlaveResponseEvent(3, 2, this.g, (Object)null, (Object)null);
- this.k.OnDataReceived(var4);
- }
-
- try {
- Thread.sleep(10L);
- return true;
- } catch (InterruptedException var7) {
- return true;
- }
- }
-
- public void registerSpiSlaveListener(SpiSlaveListener var1) {
- this.k = var1;
- }
-
- protected void requestEvent(SpiSlaveEvent var1) {
- if(var1 instanceof SpiSlaveRequestEvent) {
- switch(var1.getEventType()) {
- case -1:
- default:
- }
- } else {
- Assert.assertTrue("processEvent wrong type" + var1.getEventType(), false);
- }
- }
-
- public int write(byte[] var1) {
- byte var13;
- if(!this.l) {
- var13 = 3;
- } else {
- if(var1.length > 65536) {
- return 1010;
- }
-
- int[] var2 = new int[1];
- int var3 = var1.length;
- int var4 = this.a(var1, 90, 129, this.i, var3);
- byte[] var5 = new byte[8 + var1.length];
- var5[0] = 0;
- var5[1] = 90;
- var5[2] = -127;
- var5[3] = (byte)this.i;
- var5[4] = (byte)(('\uff00' & var3) >> 8);
- var5[5] = (byte)(var3 & 255);
- int var6 = 6;
-
- int var8;
- for(int var7 = 0; var7 < var1.length; var6 = var8) {
- var8 = var6 + 1;
- var5[var6] = var1[var7];
- ++var7;
- }
-
- int var9 = var6 + 1;
- var5[var6] = (byte)(('\uff00' & var4) >> 8);
- int var10000 = var9 + 1;
- var5[var9] = (byte)(var4 & 255);
- this.j.write(var5, var5.length, var2);
- if(var2[0] != var5.length) {
- return 4;
- }
-
- ++this.i;
- int var12 = this.i;
- var13 = 0;
- if(var12 >= 256) {
- this.i = 0;
- return 0;
- }
- }
-
- return var13;
- }
-
- private static enum a {
- a,
- b,
- c,
- d,
- e,
- f,
- g,
- h;
-
- static {
- FT_Spi_Slave.a[] var0 = new FT_Spi_Slave.a[]{a, b, c, d, e, f, g, h};
- }
- }
-}
diff --git a/FtcRobotController/app/src/main/java/com/ftdi/j2xx/protocol/SpiSlaveEvent.java b/FtcRobotController/app/src/main/java/com/ftdi/j2xx/protocol/SpiSlaveEvent.java
deleted file mode 100644
index 067888a..0000000
--- a/FtcRobotController/app/src/main/java/com/ftdi/j2xx/protocol/SpiSlaveEvent.java
+++ /dev/null
@@ -1,57 +0,0 @@
-package com.ftdi.j2xx.protocol;
-
-public class SpiSlaveEvent {
- private int a;
- private boolean b;
- private Object c;
- private Object d;
- private Object e;
-
- public SpiSlaveEvent(int var1, boolean var2, Object var3, Object var4, Object var5) {
- this.a = var1;
- this.b = var2;
- this.c = var3;
- this.d = var4;
- this.e = var5;
- }
-
- public Object getArg0() {
- return this.c;
- }
-
- public Object getArg1() {
- return this.d;
- }
-
- public Object getArg2() {
- return this.e;
- }
-
- public int getEventType() {
- return this.a;
- }
-
- public boolean getSync() {
- return this.b;
- }
-
- public void setArg0(Object var1) {
- this.c = var1;
- }
-
- public void setArg1(Object var1) {
- this.d = var1;
- }
-
- public void setArg2(Object var1) {
- this.e = var1;
- }
-
- public void setEventType(int var1) {
- this.a = var1;
- }
-
- public void setSync(boolean var1) {
- this.b = var1;
- }
-}
diff --git a/FtcRobotController/app/src/main/java/com/ftdi/j2xx/protocol/SpiSlaveListener.java b/FtcRobotController/app/src/main/java/com/ftdi/j2xx/protocol/SpiSlaveListener.java
deleted file mode 100644
index f28cce4..0000000
--- a/FtcRobotController/app/src/main/java/com/ftdi/j2xx/protocol/SpiSlaveListener.java
+++ /dev/null
@@ -1,7 +0,0 @@
-package com.ftdi.j2xx.protocol;
-
-import com.ftdi.j2xx.protocol.SpiSlaveResponseEvent;
-
-public interface SpiSlaveListener {
- boolean OnDataReceived(SpiSlaveResponseEvent var1);
-}
diff --git a/FtcRobotController/app/src/main/java/com/ftdi/j2xx/protocol/SpiSlaveRequestEvent.java b/FtcRobotController/app/src/main/java/com/ftdi/j2xx/protocol/SpiSlaveRequestEvent.java
deleted file mode 100644
index 95b9d79..0000000
--- a/FtcRobotController/app/src/main/java/com/ftdi/j2xx/protocol/SpiSlaveRequestEvent.java
+++ /dev/null
@@ -1,14 +0,0 @@
-package com.ftdi.j2xx.protocol;
-
-import com.ftdi.j2xx.protocol.SpiSlaveEvent;
-
-public class SpiSlaveRequestEvent extends SpiSlaveEvent {
- protected static final int REQ_DESTORY_THREAD = -1;
- protected static final int REQ_INIT_SLAVE = 1;
- protected static final int REQ_SLAVE_READ = 3;
- protected static final int REQ_SLAVE_WRITE = 2;
-
- public SpiSlaveRequestEvent(int var1, boolean var2, Object var3, Object var4, Object var5) {
- super(var1, var2, var3, var4, var5);
- }
-}
diff --git a/FtcRobotController/app/src/main/java/com/ftdi/j2xx/protocol/SpiSlaveResponseEvent.java b/FtcRobotController/app/src/main/java/com/ftdi/j2xx/protocol/SpiSlaveResponseEvent.java
deleted file mode 100644
index 6eeb7b9..0000000
--- a/FtcRobotController/app/src/main/java/com/ftdi/j2xx/protocol/SpiSlaveResponseEvent.java
+++ /dev/null
@@ -1,21 +0,0 @@
-package com.ftdi.j2xx.protocol;
-
-import com.ftdi.j2xx.protocol.SpiSlaveEvent;
-
-public class SpiSlaveResponseEvent extends SpiSlaveEvent {
- public static final int DATA_CORRUPTED = 1;
- public static final int IO_ERROR = 2;
- public static final int OK = 0;
- public static final int RESET = 3;
- public static final int RES_SLAVE_READ = 3;
- private int a;
-
- public SpiSlaveResponseEvent(int var1, int var2, Object var3, Object var4, Object var5) {
- super(var1, false, var3, var4, var5);
- this.a = var2;
- }
-
- public int getResponseCode() {
- return this.a;
- }
-}
diff --git a/FtcRobotController/app/src/main/java/com/ftdi/j2xx/protocol/SpiSlaveThread.java b/FtcRobotController/app/src/main/java/com/ftdi/j2xx/protocol/SpiSlaveThread.java
deleted file mode 100644
index 4a9e048..0000000
--- a/FtcRobotController/app/src/main/java/com/ftdi/j2xx/protocol/SpiSlaveThread.java
+++ /dev/null
@@ -1,38 +0,0 @@
-package com.ftdi.j2xx.protocol;
-
-import com.ftdi.j2xx.protocol.SpiSlaveEvent;
-import java.util.LinkedList;
-import java.util.Queue;
-import java.util.concurrent.locks.Lock;
-import java.util.concurrent.locks.ReentrantLock;
-
-public abstract class SpiSlaveThread extends Thread {
- public static final int THREAD_DESTORYED = 2;
- public static final int THREAD_INIT = 0;
- public static final int THREAD_RUNNING = 1;
- private Queue a = new LinkedList();
- private Lock b = new ReentrantLock();
- private Object c = new Object();
- private Object d = new Object();
- private boolean e;
- private boolean f;
- private int g = 0;
-
- public SpiSlaveThread() {
- this.setName("SpiSlaveThread");
- }
-
- protected abstract boolean isTerminateEvent(SpiSlaveEvent var1);
-
- protected abstract boolean pollData();
-
- protected abstract void requestEvent(SpiSlaveEvent var1);
-
- public void run() {
- // $FF: Couldn't be decompiled
- }
-
- public boolean sendMessage(SpiSlaveEvent param1) {
- // $FF: Couldn't be decompiled
- }
-}
diff --git a/FtcRobotController/app/src/main/java/com/ftdi/j2xx/q.java b/FtcRobotController/app/src/main/java/com/ftdi/j2xx/q.java
deleted file mode 100644
index 611f89d..0000000
--- a/FtcRobotController/app/src/main/java/com/ftdi/j2xx/q.java
+++ /dev/null
@@ -1,5 +0,0 @@
-package com.ftdi.j2xx;
-
-class q {
- public long a;
-}
diff --git a/FtcRobotController/app/src/main/java/com/ftdi/j2xx/r.java b/FtcRobotController/app/src/main/java/com/ftdi/j2xx/r.java
deleted file mode 100644
index 8aa57f9..0000000
--- a/FtcRobotController/app/src/main/java/com/ftdi/j2xx/r.java
+++ /dev/null
@@ -1,8 +0,0 @@
-package com.ftdi.j2xx;
-
-class r {
- public byte a;
- public byte b;
- public byte c;
- public byte d;
-}
diff --git a/FtcRobotController/app/src/main/java/com/qualcomm/WirelessP2p/BuildConfig.java b/FtcRobotController/app/src/main/java/com/qualcomm/WirelessP2p/BuildConfig.java
deleted file mode 100644
index 50337bb..0000000
--- a/FtcRobotController/app/src/main/java/com/qualcomm/WirelessP2p/BuildConfig.java
+++ /dev/null
@@ -1,10 +0,0 @@
-package com.qualcomm.WirelessP2p;
-
-public final class BuildConfig {
- public static final String APPLICATION_ID = "com.qualcomm.WirelessP2p";
- public static final String BUILD_TYPE = "release";
- public static final boolean DEBUG = false;
- public static final String FLAVOR = "";
- public static final int VERSION_CODE = -1;
- public static final String VERSION_NAME = "";
-}
diff --git a/FtcRobotController/app/src/main/java/com/qualcomm/WirelessP2p/R.java b/FtcRobotController/app/src/main/java/com/qualcomm/WirelessP2p/R.java
deleted file mode 100644
index e353416..0000000
--- a/FtcRobotController/app/src/main/java/com/qualcomm/WirelessP2p/R.java
+++ /dev/null
@@ -1,24 +0,0 @@
-package com.qualcomm.WirelessP2p;
-
-public final class R {
- public static final class color {
- public static final int black = 2131230720;
- public static final int bright_red = 2131230722;
- public static final int bright_red_text = 2131230723;
- public static final int dark_red_background = 2131230724;
- public static final int light_red_background = 2131230726;
- public static final int medium_red_background = 2131230727;
- public static final int transparent_color = 2131230728;
- public static final int very_bright_red = 2131230729;
- public static final int white = 2131230730;
- }
-
- public static final class string {
- public static final int app_name = 2131296265;
- }
-
- public static final class style {
- public static final int AppBaseTheme = 2131099648;
- public static final int AppTheme = 2131099649;
- }
-}
diff --git a/FtcRobotController/app/src/main/java/com/qualcomm/WirelessP2p/WifiDirectChannelSelection.java b/FtcRobotController/app/src/main/java/com/qualcomm/WirelessP2p/WifiDirectChannelSelection.java
deleted file mode 100644
index 8a39874..0000000
--- a/FtcRobotController/app/src/main/java/com/qualcomm/WirelessP2p/WifiDirectChannelSelection.java
+++ /dev/null
@@ -1,102 +0,0 @@
-package com.qualcomm.wirelessp2p;
-
-import android.content.Context;
-import android.net.wifi.WifiManager;
-import com.qualcomm.robotcore.util.RobotLog;
-import com.qualcomm.robotcore.util.RunShellCommand;
-import java.io.File;
-import java.io.FileNotFoundException;
-import java.io.FileReader;
-import java.io.FileWriter;
-import java.io.IOException;
-
-public class WifiDirectChannelSelection {
- public static final int INVALID = -1;
- private final String a;
- private final String b;
- private final String c;
- private final WifiManager d;
- private final RunShellCommand e = new RunShellCommand();
-
- public WifiDirectChannelSelection(Context var1, WifiManager var2) {
- this.a = var1.getFilesDir().getAbsolutePath() + "/";
- this.d = var2;
- this.b = this.a + "get_current_wifi_direct_staus";
- this.c = this.a + "config_wifi_direct";
- }
-
- private int a() throws RuntimeException {
- String[] var1 = this.e.run("/system/bin/ps").split("\n");
- int var2 = var1.length;
-
- for(int var3 = 0; var3 < var2; ++var3) {
- String var4 = var1[var3];
- if(var4.contains("wpa_supplicant")) {
- return Integer.parseInt(var4.split("\\s+")[1]);
- }
- }
-
- throw new RuntimeException("could not find wpa_supplicant PID");
- }
-
- private void a(int param1, int param2) {
- // $FF: Couldn't be decompiled
- }
-
- private void b() {
- try {
- char[] var3 = new char[4096];
- FileReader var4 = new FileReader(this.a + "wpa_supplicant.conf");
- int var5 = var4.read(var3);
- var4.close();
- String var6 = new String(var3, 0, var5);
- RobotLog.v("WPA FILE: \n" + var6);
- String var7 = var6.replaceAll("(?s)network\\s*=\\{.*\\}", "").replaceAll("(?m)^\\s+$", "");
- RobotLog.v("WPA REPLACE: \n" + var7);
- FileWriter var8 = new FileWriter(this.a + "wpa_supplicant.conf");
- var8.write(var7);
- var8.close();
- } catch (FileNotFoundException var9) {
- RobotLog.e("File not found: " + var9.toString());
- var9.printStackTrace();
- } catch (IOException var10) {
- RobotLog.e("FIO exception: " + var10.toString());
- var10.printStackTrace();
- }
- }
-
- private void c() throws IOException {
- Object[] var1 = new Object[]{this.a, this.a, this.a};
- String var2 = String.format("cp /data/misc/wifi/wpa_supplicant.conf %s/wpa_supplicant.conf \ncp /data/misc/wifi/p2p_supplicant.conf %s/p2p_supplicant.conf \nchmod 666 %s/*supplicant* \n", var1);
- Object[] var3 = new Object[]{this.a, this.a, this.a, Integer.valueOf(this.a())};
- String var4 = String.format("cp %s/p2p_supplicant.conf /data/misc/wifi/p2p_supplicant.conf \ncp %s/wpa_supplicant.conf /data/misc/wifi/wpa_supplicant.conf \nrm %s/*supplicant* \nchown system.wifi /data/misc/wifi/wpa_supplicant.conf \nchown system.wifi /data/misc/wifi/p2p_supplicant.conf \nkill -HUP %d \n", var3);
- FileWriter var5 = new FileWriter(this.b);
- var5.write(var2);
- var5.close();
- FileWriter var6 = new FileWriter(this.c);
- var6.write(var4);
- var6.close();
- this.e.run("chmod 700 " + this.b);
- this.e.run("chmod 700 " + this.c);
- }
-
- private void d() {
- (new File(this.b)).delete();
- (new File(this.c)).delete();
- }
-
- public void config(int var1, int var2) throws IOException {
- try {
- this.d.setWifiEnabled(false);
- this.c();
- this.e.runAsRoot(this.b);
- this.a(var1, var2);
- this.b();
- this.e.runAsRoot(this.c);
- this.d.setWifiEnabled(true);
- } finally {
- this.d();
- }
-
- }
-}
diff --git a/FtcRobotController/app/src/main/java/com/qualcomm/analyticsmodule/BuildConfig.java b/FtcRobotController/app/src/main/java/com/qualcomm/analyticsmodule/BuildConfig.java
deleted file mode 100644
index 16e6754..0000000
--- a/FtcRobotController/app/src/main/java/com/qualcomm/analyticsmodule/BuildConfig.java
+++ /dev/null
@@ -1,10 +0,0 @@
-package com.qualcomm.analyticsmodule;
-
-public final class BuildConfig {
- public static final String APPLICATION_ID = "com.qualcomm.analyticsmodule";
- public static final String BUILD_TYPE = "release";
- public static final boolean DEBUG = false;
- public static final String FLAVOR = "";
- public static final int VERSION_CODE = -1;
- public static final String VERSION_NAME = "";
-}
diff --git a/FtcRobotController/app/src/main/java/com/qualcomm/analyticsmodule/R.java b/FtcRobotController/app/src/main/java/com/qualcomm/analyticsmodule/R.java
deleted file mode 100644
index cd4951f..0000000
--- a/FtcRobotController/app/src/main/java/com/qualcomm/analyticsmodule/R.java
+++ /dev/null
@@ -1,24 +0,0 @@
-package com.qualcomm.analyticsmodule;
-
-public final class R {
- public static final class color {
- public static final int black = 2131296256;
- public static final int bright_red = 2131296258;
- public static final int bright_red_text = 2131296259;
- public static final int dark_red_background = 2131296260;
- public static final int light_red_background = 2131296262;
- public static final int medium_red_background = 2131296264;
- public static final int transparent_color = 2131296265;
- public static final int very_bright_red = 2131296266;
- public static final int white = 2131296267;
- }
-
- public static final class string {
- public static final int app_name = 2131361800;
- }
-
- public static final class style {
- public static final int AppBaseTheme = 2131165184;
- public static final int AppTheme = 2131165185;
- }
-}
diff --git a/FtcRobotController/app/src/main/java/com/qualcomm/ftccommon/BuildConfig.java b/FtcRobotController/app/src/main/java/com/qualcomm/ftccommon/BuildConfig.java
deleted file mode 100644
index 71d1b8c..0000000
--- a/FtcRobotController/app/src/main/java/com/qualcomm/ftccommon/BuildConfig.java
+++ /dev/null
@@ -1,10 +0,0 @@
-package com.qualcomm.ftccommon;
-
-public final class BuildConfig {
- public static final String APPLICATION_ID = "com.qualcomm.ftccommon";
- public static final String BUILD_TYPE = "release";
- public static final boolean DEBUG = false;
- public static final String FLAVOR = "";
- public static final int VERSION_CODE = 1;
- public static final String VERSION_NAME = "";
-}
diff --git a/FtcRobotController/app/src/main/java/com/qualcomm/ftccommon/R.java b/FtcRobotController/app/src/main/java/com/qualcomm/ftccommon/R.java
deleted file mode 100644
index 42e6ef5..0000000
--- a/FtcRobotController/app/src/main/java/com/qualcomm/ftccommon/R.java
+++ /dev/null
@@ -1,378 +0,0 @@
-package com.qualcomm.ftccommon;
-
-public final class R {
- public static final class array {
- public static final int choice_array = 2131230720;
- public static final int choice_array_analogInput = 2131230721;
- public static final int choice_array_analogOutput = 2131230722;
- public static final int choice_array_digital_device = 2131230723;
- public static final int choice_array_i2c = 2131230724;
- public static final int device_interface_module_options_array = 2131230725;
- public static final int wifi_direct_channels = 2131230727;
- }
-
- public static final class color {
- public static final int black = 2131296256;
- public static final int bright_qcom_blue = 2131296257;
- public static final int bright_red = 2131296258;
- public static final int bright_red_text = 2131296259;
- public static final int dark_red_background = 2131296260;
- public static final int light_qcom_blue = 2131296261;
- public static final int light_red_background = 2131296262;
- public static final int medium_red_background = 2131296264;
- public static final int transparent_color = 2131296265;
- public static final int very_bright_red = 2131296266;
- public static final int white = 2131296267;
- }
-
- public static final class dimen {
- public static final int activity_horizontal_margin = 2131099648;
- public static final int activity_vertical_margin = 2131099649;
- }
-
- public static final class drawable {
- public static final int button_shape = 2130837504;
- public static final int ic_launcher = 2130837507;
- }
-
- public static final class id {
- public static final int aboutList = 2131492864;
- public static final int active_filename = 2131492997;
- public static final int activity_fix_misconfig_wifi_direct = 2131492869;
- public static final int analogOutput_devices_cancelButton = 2131492960;
- public static final int analogOutput_devices_saveButton = 2131492959;
- public static final int analog_input_devices_cancelButton = 2131492941;
- public static final int analog_input_devices_saveButton = 2131492940;
- public static final int attached_title = 2131492945;
- public static final int autoconfigure = 2131492932;
- public static final int autoconfigure_holder = 2131492931;
- public static final int autoconfigure_info = 2131492868;
- public static final int buttonConfigure = 2131492923;
- public static final int buttonWifiSettings = 2131492924;
- public static final int checkbox_port6 = 2131493056;
- public static final int checkbox_port7 = 2131493053;
- public static final int checkbox_port_matrix = 2131493045;
- public static final int checkbox_port_pwm = 2131493064;
- public static final int checkbox_port_servo = 2131493071;
- public static final int choiceSpinner_analogInput = 2131492937;
- public static final int choiceSpinner_analogOutput = 2131492956;
- public static final int choiceSpinner_digital_device = 2131492974;
- public static final int choiceSpinner_i2c = 2131493000;
- public static final int choiceSpinner_legacyModule = 2131493087;
- public static final int configureLegacy = 2131492867;
- public static final int configureUSB = 2131492866;
- public static final int controller_name = 2131493050;
- public static final int controller_name_text = 2131493014;
- public static final int controllers = 2131492996;
- public static final int controllersList = 2131492878;
- public static final int device_interface_module_cancelButton = 2131492966;
- public static final int device_interface_module_name = 2131492967;
- public static final int device_interface_module_saveButton = 2131492965;
- public static final int device_interface_module_serialNumber = 2131492968;
- public static final int devices_holder = 2131492876;
- public static final int devices_info_btn = 2131492877;
- public static final int digital_devices_cancelButton = 2131492978;
- public static final int digital_devices_saveButton = 2131492977;
- public static final int dropdown_layout = 2131493086;
- public static final int editTextResult_analogInput = 2131492938;
- public static final int editTextResult_analogInput6 = 2131493057;
- public static final int editTextResult_analogInput7 = 2131493054;
- public static final int editTextResult_analogOutput = 2131492957;
- public static final int editTextResult_digital_device = 2131492975;
- public static final int editTextResult_i2c = 2131493001;
- public static final int editTextResult_matrix = 2131493046;
- public static final int editTextResult_name = 2131493088;
- public static final int editTextResult_pwm = 2131493065;
- public static final int editTextResult_servo = 2131493072;
- public static final int edit_controller_btn = 2131493089;
- public static final int empty_devicelist = 2131492879;
- public static final int empty_filelist = 2131492930;
- public static final int file_activate_button = 2131492994;
- public static final int file_buttons = 2131492989;
- public static final int file_delete_button = 2131492995;
- public static final int file_edit_button = 2131492993;
- public static final int file_info_layout = 2131492988;
- public static final int filename_editText = 2131492991;
- public static final int files_holder = 2131492928;
- public static final int header = 2131492970;
- public static final int holdsDevices = 2131492871;
- public static final int holds_buttons = 2131492926;
- public static final int horizontalButtons = 2131492992;
- public static final int i2c_devices_cancelButton = 2131493004;
- public static final int i2c_devices_saveButton = 2131493003;
- public static final int included_header = 2131492865;
- public static final int inclusionlayout = 2131492929;
- public static final int info_btn = 2131493012;
- public static final int legacy_serialNumber = 2131493013;
- public static final int linearLayout = 2131492990;
- public static final int linearLayout0 = 2131493018;
- public static final int linearLayout1 = 2131493021;
- public static final int linearLayout2 = 2131493022;
- public static final int linearLayout3 = 2131493025;
- public static final int linearLayout4 = 2131493028;
- public static final int linearLayout5 = 2131493029;
- public static final int linearLayout_analogInput0 = 2131492953;
- public static final int linearLayout_analogInput1 = 2131492952;
- public static final int linearLayout_analogInput2 = 2131492951;
- public static final int linearLayout_analogInput3 = 2131492950;
- public static final int linearLayout_analogInput4 = 2131492949;
- public static final int linearLayout_analogInput5 = 2131492948;
- public static final int linearLayout_analogInput6 = 2131492947;
- public static final int linearLayout_analogInput7 = 2131492946;
- public static final int linearLayout_analogOutput0 = 2131492963;
- public static final int linearLayout_analogOutput1 = 2131492962;
- public static final int linearLayout_digital_device0 = 2131492987;
- public static final int linearLayout_digital_device1 = 2131492986;
- public static final int linearLayout_digital_device2 = 2131492985;
- public static final int linearLayout_digital_device3 = 2131492984;
- public static final int linearLayout_digital_device4 = 2131492983;
- public static final int linearLayout_digital_device5 = 2131492982;
- public static final int linearLayout_digital_device6 = 2131492981;
- public static final int linearLayout_digital_device7 = 2131492980;
- public static final int linearLayout_i2c0 = 2131493011;
- public static final int linearLayout_i2c1 = 2131493010;
- public static final int linearLayout_i2c2 = 2131493009;
- public static final int linearLayout_i2c3 = 2131493008;
- public static final int linearLayout_i2c4 = 2131493007;
- public static final int linearLayout_i2c5 = 2131493006;
- public static final int linearLayout_matrix1 = 2131493034;
- public static final int linearLayout_matrix2 = 2131493035;
- public static final int linearLayout_matrix3 = 2131493036;
- public static final int linearLayout_matrix4 = 2131493037;
- public static final int linearLayout_matrix5 = 2131493039;
- public static final int linearLayout_matrix6 = 2131493040;
- public static final int linearLayout_matrix7 = 2131493041;
- public static final int linearLayout_matrix8 = 2131493042;
- public static final int linearLayout_pwm0 = 2131493068;
- public static final int linearLayout_pwm1 = 2131493067;
- public static final int linearLayout_servo1 = 2131493078;
- public static final int linearLayout_servo2 = 2131493079;
- public static final int linearLayout_servo3 = 2131493080;
- public static final int linearLayout_servo4 = 2131493081;
- public static final int linearLayout_servo5 = 2131493082;
- public static final int linearLayout_servo6 = 2131493083;
- public static final int listView_devices = 2131492969;
- public static final int load_bottom = 2131492925;
- public static final int matrix_controller_cancelButton = 2131493031;
- public static final int matrix_controller_saveButton = 2131493030;
- public static final int matrixcontroller_name = 2131493032;
- public static final int motor_controller_serialNumber = 2131493051;
- public static final int motors_title = 2131493038;
- public static final int new_button = 2131492927;
- public static final int orange_warning = 2131493059;
- public static final int orangetext0 = 2131493060;
- public static final int orangetext1 = 2131493061;
- public static final int port3 = 2131493024;
- public static final int port4 = 2131493027;
- public static final int port5 = 2131493017;
- public static final int port7 = 2131493020;
- public static final int portNumber = 2131493085;
- public static final int port_number_analogInput = 2131492936;
- public static final int port_number_analogOutput = 2131492955;
- public static final int port_number_digital_device = 2131492973;
- public static final int port_number_i2c = 2131492999;
- public static final int port_number_matrix = 2131493044;
- public static final int port_number_pwm = 2131493063;
- public static final int port_number_servo = 2131493070;
- public static final int port_title = 2131492944;
- public static final int pwm_devices_cancelButton = 2131493049;
- public static final int pwm_devices_saveButton = 2131493048;
- public static final int row_port = 2131493052;
- public static final int row_port1 = 2131493019;
- public static final int row_port3 = 2131493023;
- public static final int row_port4 = 2131493026;
- public static final int row_port5 = 2131493016;
- public static final int row_port_analogInput = 2131492935;
- public static final int row_port_analogOutput = 2131492954;
- public static final int row_port_digital_device = 2131492972;
- public static final int row_port_i2c = 2131492998;
- public static final int row_port_matrix = 2131493043;
- public static final int row_port_pwm = 2131493062;
- public static final int row_port_servo = 2131493069;
- public static final int save_config_btn = 2131492882;
- public static final int save_holder = 2131492880;
- public static final int scanButton = 2131492873;
- public static final int scanButton_text = 2131492874;
- public static final int scan_bottom = 2131492872;
- public static final int scrollView = 2131492933;
- public static final int servo_controller_cancelButton = 2131493075;
- public static final int servo_controller_saveButton = 2131493074;
- public static final int servo_controller_serialNumber = 2131493077;
- public static final int servocontroller_name = 2131493076;
- public static final int servos_title = 2131493033;
- public static final int shape = 2131493084;
- public static final int spinnerChannelSelect = 2131492922;
- public static final int tableLayout_analogOutput_devices = 2131492961;
- public static final int tableLayout_analog_input_devices = 2131492942;
- public static final int tableLayout_digital_devices = 2131492979;
- public static final int tableLayout_i2c_devices = 2131493005;
- public static final int tableLayout_pwm_devices = 2131493015;
- public static final int table_header = 2131492943;
- public static final int textAdbLogs = 2131492934;
- public static final int textView = 2131492870;
- public static final int textView1 = 2131492971;
- public static final int titleTextView_analogInput = 2131492939;
- public static final int titleTextView_analogInput7 = 2131493055;
- public static final int titleTextView_analogOutput = 2131492958;
- public static final int titleTextView_digital_device = 2131492976;
- public static final int titleTextView_i2c = 2131493002;
- public static final int titleTextView_matrix = 2131493047;
- public static final int titleTextView_motor2 = 2131493058;
- public static final int titleTextView_pwm = 2131493066;
- public static final int titleTextView_servo = 2131493073;
- public static final int warning_layout = 2131492875;
- public static final int writeXML = 2131492881;
- public static final int writeXML_text = 2131492883;
- }
-
- public static final class layout {
- public static final int activity_about = 2130903040;
- public static final int activity_autoconfigure = 2130903041;
- public static final int activity_config_wifi_direct = 2130903042;
- public static final int activity_ftc_configuration = 2130903043;
- public static final int activity_ftc_wifi_channel_selector = 2130903046;
- public static final int activity_load = 2130903047;
- public static final int activity_view_logs = 2130903049;
- public static final int analog_input_device = 2130903050;
- public static final int analog_inputs = 2130903051;
- public static final int analog_output_device = 2130903052;
- public static final int analog_outputs = 2130903053;
- public static final int device_interface_module = 2130903055;
- public static final int digital_device = 2130903057;
- public static final int digital_devices = 2130903058;
- public static final int file_info = 2130903059;
- public static final int header = 2130903060;
- public static final int i2c_device = 2130903061;
- public static final int i2cs = 2130903062;
- public static final int info_button = 2130903063;
- public static final int legacy = 2130903064;
- public static final int matrices = 2130903065;
- public static final int matrix_devices = 2130903066;
- public static final int motors = 2130903067;
- public static final int orange_warning = 2130903068;
- public static final int pwm_device = 2130903069;
- public static final int pwms = 2130903070;
- public static final int servo = 2130903071;
- public static final int servos = 2130903072;
- public static final int shape = 2130903073;
- public static final int simple_device = 2130903074;
- }
-
- public static final class string {
- public static final int about_activity = 2131361792;
- public static final int action_configuration = 2131361793;
- public static final int action_settings = 2131361796;
- public static final int action_wifi_channel_selector = 2131361797;
- public static final int add_motor_controller_menu_item = 2131361798;
- public static final int add_servo_controller_menu_item = 2131361799;
- public static final int app_name = 2131361800;
- public static final int attached = 2131361801;
- public static final int autoconfigure = 2131361802;
- public static final int autoconfigureLaunch_text = 2131361803;
- public static final int autoconfigure_menu_item = 2131361804;
- public static final int cancel = 2131361805;
- public static final int choice_prompt = 2131361806;
- public static final int choice_prompt_analogInput = 2131361807;
- public static final int choice_prompt_analogOutput = 2131361808;
- public static final int choice_prompt_digital_device = 2131361809;
- public static final int choice_prompt_i2c = 2131361810;
- public static final int configure_activity = 2131361811;
- public static final int configure_menu_item = 2131361812;
- public static final int configure_settings = 2131361813;
- public static final int default_port = 2131361814;
- public static final int device_info = 2131361815;
- public static final int device_type = 2131361816;
- public static final int done_button = 2131361818;
- public static final int edit_analog_input_devices_activity = 2131361819;
- public static final int edit_analog_output_devices_activity = 2131361820;
- public static final int edit_controller = 2131361821;
- public static final int edit_core_device_interface_module_controller_activity = 2131361822;
- public static final int edit_digital_devices_activity = 2131361823;
- public static final int edit_i2c_devices_activity = 2131361824;
- public static final int edit_legacy_module_controller_activity = 2131361825;
- public static final int edit_matrix_controller_activity = 2131361826;
- public static final int edit_motor_controller_activity = 2131361827;
- public static final int edit_motor_controller_menu_item = 2131361828;
- public static final int edit_pwm_devices_activity = 2131361829;
- public static final int edit_servo_controller_activity = 2131361830;
- public static final int file_activate_button = 2131361831;
- public static final int file_delete_button = 2131361832;
- public static final int file_edit_button = 2131361833;
- public static final int file_prompt = 2131361834;
- public static final int filename_editText = 2131361835;
- public static final int input_name_hint = 2131361840;
- public static final int input_name_label = 2131361841;
- public static final int k9LegacyBot = 2131361842;
- public static final int k9USBBot = 2131361843;
- public static final int launch_wifi_settings = 2131361851;
- public static final int legacy_controller_name = 2131361852;
- public static final int load_menu_item = 2131361853;
- public static final int matrix_controller_name = 2131361854;
- public static final int matrix_controller_name_prompt = 2131361855;
- public static final int matrix_motor_title = 2131361856;
- public static final int matrix_name_prompt = 2131361857;
- public static final int matrix_port0 = 2131361858;
- public static final int matrix_port1 = 2131361859;
- public static final int matrix_port2 = 2131361860;
- public static final int matrix_port3 = 2131361861;
- public static final int matrix_port4 = 2131361862;
- public static final int matrix_port5 = 2131361863;
- public static final int matrix_port6 = 2131361864;
- public static final int matrix_port7 = 2131361865;
- public static final int matrix_servo_title = 2131361866;
- public static final int motor_controller_name = 2131361867;
- public static final int motor_controller_name_text = 2131361868;
- public static final int motor_name = 2131361869;
- public static final int motor_name_prompt = 2131361870;
- public static final int motor_port1 = 2131361871;
- public static final int motor_port2 = 2131361872;
- public static final int name_prompt_text = 2131361873;
- public static final int name_prompt_undertext = 2131361874;
- public static final int port = 2131361879;
- public static final int pref_change_wifi_channel = 2131361880;
- public static final int pref_configure_robot_title = 2131361881;
- public static final int pref_hardware_config_filename = 2131361889;
- public static final int pref_launch_autoconfigure = 2131361890;
- public static final int pref_launch_configure = 2131361891;
- public static final int pref_launch_settings = 2131361892;
- public static final int pref_wifi_channel_selection_title = 2131361899;
- public static final int readXML_text = 2131361901;
- public static final int restore_settings = 2131361902;
- public static final int row_port0 = 2131361903;
- public static final int row_port1 = 2131361904;
- public static final int row_port2 = 2131361905;
- public static final int row_port3 = 2131361906;
- public static final int row_port4 = 2131361907;
- public static final int row_port5 = 2131361908;
- public static final int row_port6 = 2131361909;
- public static final int save_button = 2131361910;
- public static final int save_configuration = 2131361911;
- public static final int scan = 2131361912;
- public static final int scanButton_text = 2131361913;
- public static final int servo_controller_name = 2131361914;
- public static final int servo_controller_name_prompt = 2131361915;
- public static final int servo_name_prompt = 2131361916;
- public static final int settings_activity = 2131361917;
- public static final int titleText_view = 2131361918;
- public static final int title_activity_autoconfigure = 2131361919;
- public static final int title_activity_config_wifi_direct = 2131361920;
- public static final int title_activity_load = 2131361921;
- public static final int title_activity_wifi_channel_selector = 2131361923;
- public static final int view_logs_activity = 2131361926;
- public static final int wifi_direct_update_settings = 2131361930;
- public static final int writeXML_prompt = 2131361931;
- public static final int writeXML_text = 2131361932;
- }
-
- public static final class style {
- public static final int AppBaseTheme = 2131165184;
- public static final int AppTheme = 2131165185;
- public static final int CustomAlertDialog = 2131165186;
- public static final int RobotoButtonStyle = 2131165187;
- public static final int RobotoTextViewStyle = 2131165188;
- }
-
- public static final class xml {
- public static final int preferences = 2131034112;
- }
-}
diff --git a/FtcRobotController/app/src/main/java/com/qualcomm/ftcdriverstation/BuildConfig.java b/FtcRobotController/app/src/main/java/com/qualcomm/ftcdriverstation/BuildConfig.java
deleted file mode 100644
index fac4630..0000000
--- a/FtcRobotController/app/src/main/java/com/qualcomm/ftcdriverstation/BuildConfig.java
+++ /dev/null
@@ -1,10 +0,0 @@
-package com.qualcomm.ftcdriverstation;
-
-public final class BuildConfig {
- public static final String APPLICATION_ID = "com.qualcomm.ftcdriverstation";
- public static final String BUILD_TYPE = "release";
- public static final boolean DEBUG = false;
- public static final String FLAVOR = "";
- public static final int VERSION_CODE = 4;
- public static final String VERSION_NAME = "";
-}
diff --git a/FtcRobotController/app/src/main/java/com/qualcomm/ftcdriverstation/FtcDriverStationActivity.java b/FtcRobotController/app/src/main/java/com/qualcomm/ftcdriverstation/FtcDriverStationActivity.java
deleted file mode 100644
index f37c0ff..0000000
--- a/FtcRobotController/app/src/main/java/com/qualcomm/ftcdriverstation/FtcDriverStationActivity.java
+++ /dev/null
@@ -1,1072 +0,0 @@
-package com.qualcomm.ftcdriverstation;
-
-import android.app.Activity;
-import android.content.Context;
-import android.content.Intent;
-import android.content.SharedPreferences;
-import android.content.SharedPreferences.OnSharedPreferenceChangeListener;
-import android.content.res.Configuration;
-import android.os.Bundle;
-import android.os.CountDownTimer;
-import android.os.SystemClock;
-import android.preference.PreferenceManager;
-import android.view.InputEvent;
-import android.view.KeyEvent;
-import android.view.Menu;
-import android.view.MenuItem;
-import android.view.MotionEvent;
-import android.view.View;
-import android.view.View.OnClickListener;
-import android.view.animation.Animation;
-import android.view.animation.AnimationUtils;
-import android.view.animation.Animation.AnimationListener;
-import android.widget.Button;
-import android.widget.ImageButton;
-import android.widget.ImageView;
-import android.widget.TextView;
-import android.widget.Toast;
-import com.qualcomm.analytics.Analytics;
-import com.qualcomm.ftccommon.ConfigWifiDirectActivity;
-import com.qualcomm.ftccommon.DbgLog;
-import com.qualcomm.ftcdriverstation.OpModeSelectionDialogFragment;
-import com.qualcomm.ftcdriverstation.SettingsActivity;
-import com.qualcomm.robotcore.exception.RobotCoreException;
-import com.qualcomm.robotcore.hardware.Gamepad;
-import com.qualcomm.robotcore.hardware.HardwareMap;
-import com.qualcomm.robotcore.hardware.configuration.Utility;
-import com.qualcomm.robotcore.hardware.logitech.LogitechGamepadF310;
-import com.qualcomm.robotcore.hardware.microsoft.MicrosoftGamepadXbox360;
-import com.qualcomm.robotcore.robocol.Command;
-import com.qualcomm.robotcore.robocol.Heartbeat;
-import com.qualcomm.robotcore.robocol.PeerDiscoveryManager;
-import com.qualcomm.robotcore.robocol.RobocolDatagram;
-import com.qualcomm.robotcore.robocol.RobocolDatagramSocket;
-import com.qualcomm.robotcore.robocol.Telemetry;
-import com.qualcomm.robotcore.robot.RobotState;
-import com.qualcomm.robotcore.util.BatteryChecker;
-import com.qualcomm.robotcore.util.ElapsedTime;
-import com.qualcomm.robotcore.util.ImmersiveMode;
-import com.qualcomm.robotcore.util.RobotLog;
-import com.qualcomm.robotcore.util.RollingAverage;
-import com.qualcomm.robotcore.util.Util;
-import com.qualcomm.robotcore.wifi.WifiDirectAssistant;
-import java.net.InetAddress;
-import java.net.SocketException;
-import java.util.Arrays;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.LinkedHashSet;
-import java.util.Map;
-import java.util.Set;
-import java.util.TreeSet;
-import java.util.Map.Entry;
-import java.util.concurrent.ConcurrentHashMap;
-import java.util.concurrent.ExecutorService;
-import java.util.concurrent.Executors;
-import java.util.concurrent.ScheduledExecutorService;
-import java.util.concurrent.ScheduledFuture;
-import java.util.concurrent.TimeUnit;
-
-public class FtcDriverStationActivity extends Activity implements WifiDirectAssistant.WifiDirectAssistantCallback, OnSharedPreferenceChangeListener, OpModeSelectionDialogFragment.OpModeSelectionDialogListener, BatteryChecker.BatteryWatcher {
- public static final double ASSUME_DISCONNECT_TIMER = 2.0D;
- protected static final float FULLY_OPAQUE = 1.0F;
- protected static final int MAX_COMMAND_ATTEMPTS = 10;
- protected static final int MAX_LOG_SIZE = 2048;
- protected static final float PARTLY_OPAQUE = 0.3F;
- protected Analytics analytics;
- AnimationListener animationListener_icon1 = new AnimationListener() {
- public void onAnimationEnd(Animation var1) {
- FtcDriverStationActivity.this.userIcon_1_active.setImageResource(2130837514);
- }
-
- public void onAnimationRepeat(Animation var1) {
- FtcDriverStationActivity.this.userIcon_1_active.setImageResource(2130837514);
- }
-
- public void onAnimationStart(Animation var1) {
- }
- };
- AnimationListener animationListener_icon2 = new AnimationListener() {
- public void onAnimationEnd(Animation var1) {
- FtcDriverStationActivity.this.userIcon_2_active.setImageResource(2130837514);
- }
-
- public void onAnimationRepeat(Animation var1) {
- FtcDriverStationActivity.this.userIcon_2_active.setImageResource(2130837514);
- }
-
- public void onAnimationStart(Animation var1) {
- }
- };
- protected BatteryChecker batteryChecker;
- protected View batteryInfo;
- protected ImageButton buttonInit;
- protected ImageButton buttonInitStop;
- protected ImageButton buttonMenu;
- protected Button buttonSelect;
- protected ImageButton buttonStart;
- protected ImageButton buttonStartTimed;
- protected ImageButton buttonStop;
- protected boolean clientConnected = false;
- protected Context context;
- protected View controlPanelBack;
- protected ImageView dsBatteryIcon;
- protected TextView dsBatteryInfo;
- protected boolean enableNetworkTrafficLogging = false;
- protected Map gamepads = new HashMap();
- protected String groupOwnerMac;
- protected Heartbeat heartbeatRecv = new Heartbeat();
- protected Heartbeat heartbeatSend = new Heartbeat();
- protected ImmersiveMode immersion;
- protected ElapsedTime lastRecvPacket = new ElapsedTime();
- protected ElapsedTime lastUiUpdate = new ElapsedTime();
- protected FtcDriverStationActivity.OpModeCountDownTimer opModeCountDown = new FtcDriverStationActivity.OpModeCountDownTimer(null);
- protected boolean opModeUseTimer = false;
- protected Set opModes = new LinkedHashSet();
- protected PeerDiscoveryManager peerDiscoveryManager;
- protected Set pendingCommands = Collections.newSetFromMap(new ConcurrentHashMap());
- protected RollingAverage pingAverage = new RollingAverage(10);
- protected SharedPreferences preferences;
- protected String queuedOpMode = "Stop Robot";
- protected ImageView rcBatteryIcon;
- protected TextView rcBatteryTelemetry;
- protected ExecutorService recvLoopService;
- protected InetAddress remoteAddr;
- protected TextView robotBatteryTelemetry;
- protected RobotState robotState;
- protected ScheduledFuture> sendLoopFuture;
- protected ScheduledExecutorService sendLoopService = Executors.newSingleThreadScheduledExecutor();
- protected boolean setupNeeded = true;
- protected RobocolDatagramSocket socket;
- protected TextView systemTelemetry;
- protected TextView textDeviceName;
- protected TextView textPingStatus;
- protected TextView textTelemetry;
- protected TextView textTimer;
- protected TextView textWifiDirectStatus;
- protected ImageView userIcon_1_active;
- protected ImageView userIcon_1_base;
- protected ImageView userIcon_2_active;
- protected ImageView userIcon_2_base;
- protected Map userToGamepadMap = new HashMap();
- protected Utility utility;
- protected WifiDirectAssistant wifiDirect;
- protected View wifiInfo;
-
- private void setBatteryIcon(final float var1, final ImageView var2) {
- this.runOnUiThread(new Runnable() {
- public void run() {
- if(var1 <= 15.0F) {
- var2.setImageResource(2130837509);
- } else if(var1 > 15.0F && var1 <= 45.0F) {
- var2.setImageResource(2130837511);
- } else if(var1 > 45.0F && var1 <= 65.0F) {
- var2.setImageResource(2130837512);
- } else if(var1 > 65.0F && var1 <= 85.0F) {
- var2.setImageResource(2130837513);
- } else {
- var2.setImageResource(2130837510);
- }
- }
- });
- }
-
- protected void assignNewGamepad(int var1, int var2) {
- HashSet var3 = new HashSet();
- Iterator var4 = this.userToGamepadMap.entrySet().iterator();
-
- while(var4.hasNext()) {
- Entry var10 = (Entry)var4.next();
- if(((Integer)var10.getValue()).intValue() == var2) {
- var3.add(var10.getKey());
- }
- }
-
- Iterator var5 = var3.iterator();
-
- while(var5.hasNext()) {
- Integer var8 = (Integer)var5.next();
- this.userToGamepadMap.remove(var8);
- }
-
- this.userToGamepadMap.put(Integer.valueOf(var1), Integer.valueOf(var2));
- this.initGamepad(var1, var2);
- Object[] var7 = new Object[]{Integer.valueOf(var1), ((Gamepad)this.gamepads.get(Integer.valueOf(var2))).type(), Integer.valueOf(var2)};
- DbgLog.msg(String.format("Gamepad %d detected as %s (ID %d)", var7));
- }
-
- protected void assumeClientConnect() {
- DbgLog.msg("Assuming client connected");
- this.clientConnected = true;
- this.uiRobotControllerIsConnected();
- this.pendingCommands.add(new Command("CMD_REQUEST_OP_MODE_LIST"));
- }
-
- protected void assumeClientDisconnect() {
- DbgLog.msg("Assuming client disconnected");
- this.clientConnected = false;
- this.opModeUseTimer = false;
- this.opModeCountDown.stop();
- this.opModeCountDown.setCountdown(30L);
- this.setTextView(this.textTimer, "");
- this.setImageResource(this.buttonStartTimed, 2130837521);
- this.queuedOpMode = "Stop Robot";
- this.opModes.clear();
- this.pingStatus(" ");
- this.pendingCommands.clear();
- this.remoteAddr = null;
- RobotLog.clearGlobalErrorMsg();
- this.uiRobotControllerIsDisconnected();
- }
-
- protected void clearInfo() {
- this.setVisibility(this.systemTelemetry, 8);
- this.setTextView(this.textTelemetry, "");
- }
-
- protected void commandEvent(RobocolDatagram var1) {
- try {
- Command var2 = new Command(var1.getData());
- if(var2.isAcknowledged()) {
- this.pendingCommands.remove(var2);
- } else {
- DbgLog.msg(" processing command: " + var2.getName());
- var2.acknowledge();
- this.pendingCommands.add(var2);
- String var5 = var2.getName();
- String var6 = var2.getExtra();
- if(var5.equals("CMD_REQUEST_OP_MODE_LIST_RESP")) {
- this.handleCommandRequestOpModeListResp(var6);
- } else if(var5.equals("CMD_INIT_OP_MODE_RESP")) {
- this.handleCommandInitOpModeResp(var6);
- } else if(var5.equals("CMD_RUN_OP_MODE_RESP")) {
- this.handleCommandStartOpModeResp(var6);
- } else {
- DbgLog.msg("Unable to process command " + var5);
- }
- }
- } catch (RobotCoreException var7) {
- DbgLog.logStacktrace(var7);
- }
- }
-
- public boolean dispatchGenericMotionEvent(MotionEvent var1) {
- if(Gamepad.isGamepadDevice(var1.getDeviceId())) {
- this.handleGamepadEvent(var1);
- return true;
- } else {
- return super.dispatchGenericMotionEvent(var1);
- }
- }
-
- public boolean dispatchKeyEvent(KeyEvent var1) {
- if(Gamepad.isGamepadDevice(var1.getDeviceId())) {
- this.handleGamepadEvent(var1);
- return true;
- } else {
- return super.dispatchKeyEvent(var1);
- }
- }
-
- protected void displayDeviceName(final String var1) {
- this.runOnUiThread(new Runnable() {
- public void run() {
- FtcDriverStationActivity.this.textDeviceName.setText(var1);
- }
- });
- }
-
- protected void handleCommandInitOpModeResp(String var1) {
- DbgLog.msg("Robot Controller initializing op mode: " + var1);
- if(var1.equals("Stop Robot")) {
- if(this.queuedOpMode.equals("Stop Robot")) {
- this.uiWaitingForOpModeSelection();
- } else {
- this.uiWaitingForInitEvent();
- this.pendingCommands.add(new Command("CMD_RUN_OP_MODE", "Stop Robot"));
- }
- } else {
- this.uiWaitingForStartEvent();
- }
- }
-
- protected void handleCommandRequestOpModeListResp(String var1) {
- this.opModes = new LinkedHashSet();
- this.opModes.addAll(Arrays.asList(var1.split(Util.ASCII_RECORD_SEPARATOR)));
- DbgLog.msg("Received the following op modes: " + this.opModes.toString());
- this.pendingCommands.add(new Command("CMD_INIT_OP_MODE", "Stop Robot"));
- this.uiWaitingForOpModeSelection();
- }
-
- protected void handleCommandStartOpModeResp(String var1) {
- DbgLog.msg("Robot Controller starting op mode: " + var1);
- if(!var1.equals("Stop Robot")) {
- this.uiWaitingForStopEvent();
- }
-
- if(this.opModeUseTimer && !var1.equals("Stop Robot")) {
- this.opModeCountDown.start();
- }
-
- }
-
- protected void handleGamepadEvent(KeyEvent param1) {
- // $FF: Couldn't be decompiled
- }
-
- protected void handleGamepadEvent(MotionEvent param1) {
- // $FF: Couldn't be decompiled
- }
-
- protected void handleOpModeInit() {
- this.opModeCountDown.stop();
- this.uiWaitingForStartEvent();
- this.pendingCommands.add(new Command("CMD_INIT_OP_MODE", this.queuedOpMode));
- this.clearInfo();
- }
-
- protected void handleOpModeQueued(String var1) {
- this.queuedOpMode = var1;
- this.setButtonText(this.buttonSelect, var1);
- }
-
- protected void handleOpModeStart() {
- this.opModeCountDown.stop();
- this.uiWaitingForStopEvent();
- this.pendingCommands.add(new Command("CMD_RUN_OP_MODE", this.queuedOpMode));
- this.clearInfo();
- }
-
- protected void handleOpModeStop() {
- this.opModeCountDown.stop();
- if(!this.textTimer.getText().toString().isEmpty()) {
- this.opModeCountDown.setCountdown(Long.parseLong(this.textTimer.getText().toString()));
- }
-
- this.uiWaitingForInitEvent();
- this.pendingCommands.add(new Command("CMD_INIT_OP_MODE", "Stop Robot"));
- }
-
- protected void heartbeatEvent(RobocolDatagram var1) {
- try {
- this.heartbeatRecv.fromByteArray(var1.getData());
- double var3 = this.heartbeatRecv.getElapsedTime();
- short var5 = this.heartbeatRecv.getSequenceNumber();
- this.robotState = RobotState.fromByte(this.heartbeatRecv.getRobotState());
- this.pingAverage.addNumber((int)(1000.0D * var3));
- if(this.enableNetworkTrafficLogging) {
- Object[] var7 = new Object[]{Integer.valueOf(var5), Double.valueOf(var3)};
- DbgLog.msg(String.format("Network - num: %5d, time: %7.4f", var7));
- }
-
- if(this.lastUiUpdate.time() > 0.5D) {
- this.lastUiUpdate.reset();
- Object[] var6 = new Object[]{Integer.valueOf(this.pingAverage.getAverage())};
- this.pingStatus(String.format("%3dms", var6));
- }
-
- } catch (RobotCoreException var8) {
- DbgLog.logStacktrace(var8);
- }
- }
-
- protected void indicateGamepad(InputEvent var1) {
- Iterator var2 = this.userToGamepadMap.entrySet().iterator();
-
- while(var2.hasNext()) {
- Entry var3 = (Entry)var2.next();
- if(((Integer)var3.getValue()).intValue() == var1.getDeviceId()) {
- Animation var4 = AnimationUtils.loadAnimation(this.context, 2130968577);
- if(((Integer)var3.getKey()).intValue() == 1) {
- this.userIcon_1_active.setImageResource(2130837515);
- var4.setAnimationListener(this.animationListener_icon1);
- this.userIcon_1_active.startAnimation(var4);
- } else if(((Integer)var3.getKey()).intValue() == 2) {
- this.userIcon_2_active.setImageResource(2130837515);
- var4.setAnimationListener(this.animationListener_icon2);
- this.userIcon_2_active.startAnimation(var4);
- }
- }
- }
-
- }
-
- protected void initGamepad(int var1, int var2) {
- String var3 = "";
- switch(var1) {
- case 1:
- var3 = this.getString(2131361885);
- break;
- case 2:
- var3 = this.getString(2131361887);
- }
-
- String var4 = this.preferences.getString(var3, this.getString(2131361837));
- Object var5;
- if(var4.equals(this.getString(2131361838))) {
- var5 = new LogitechGamepadF310();
- } else if(var4.equals(this.getString(2131361839))) {
- var5 = new MicrosoftGamepadXbox360();
- } else {
- var5 = new Gamepad();
- }
-
- ((Gamepad)var5).id = var2;
- ((Gamepad)var5).timestamp = SystemClock.uptimeMillis();
- this.gamepads.put(Integer.valueOf(var2), var5);
- }
-
- public void onClickButtonInit(View var1) {
- this.handleOpModeInit();
- }
-
- public void onClickButtonSelect(View var1) {
- this.opModeCountDown.stop();
- String[] var2 = new String[this.opModes.size()];
- this.opModes.toArray(var2);
- OpModeSelectionDialogFragment var4 = new OpModeSelectionDialogFragment();
- var4.setOnSelectionDialogListener(this);
- var4.setOpModes(var2);
- var4.show(this.getFragmentManager(), "op_mode_selection");
- this.setTextView(this.systemTelemetry, "");
- this.setVisibility(this.systemTelemetry, 8);
- this.pendingCommands.add(new Command("CMD_INIT_OP_MODE", "Stop Robot"));
- }
-
- public void onClickButtonStart(View var1) {
- this.handleOpModeStart();
- }
-
- public void onClickButtonStartTimed(View var1) {
- if(this.opModeUseTimer) {
- this.setImageResource(this.buttonStartTimed, 2130837521);
- this.setTextView(this.textTimer, "");
- } else {
- this.setImageResource(this.buttonStartTimed, 2130837522);
- this.setTextView(this.textTimer, "30");
- this.opModeCountDown.setCountdown(30L);
- }
-
- boolean var2;
- if(!this.opModeUseTimer) {
- var2 = true;
- } else {
- var2 = false;
- }
-
- this.opModeUseTimer = var2;
- }
-
- public void onClickButtonStop(View var1) {
- this.handleOpModeStop();
- }
-
- public void onClickDSBatteryToast(View var1) {
- this.showToast("Driver Station battery", 0);
- }
-
- public void onClickRCBatteryToast(View var1) {
- this.showToast("Robot Controller battery", 0);
- }
-
- public void onClickRobotBatteryToast(View var1) {
- this.showToast("Robot battery", 0);
- }
-
- public void onConfigurationChanged(Configuration var1) {
- super.onConfigurationChanged(var1);
- }
-
- protected void onCreate(Bundle var1) {
- super.onCreate(var1);
- this.setContentView(2130903044);
- this.context = this;
- this.utility = new Utility(this);
- this.textDeviceName = (TextView)this.findViewById(2131492886);
- this.textWifiDirectStatus = (TextView)this.findViewById(2131492898);
- this.textPingStatus = (TextView)this.findViewById(2131492901);
- this.textTelemetry = (TextView)this.findViewById(2131492917);
- this.systemTelemetry = (TextView)this.findViewById(2131492916);
- this.rcBatteryTelemetry = (TextView)this.findViewById(2131492904);
- this.rcBatteryIcon = (ImageView)this.findViewById(2131492903);
- this.dsBatteryInfo = (TextView)this.findViewById(2131492888);
- this.robotBatteryTelemetry = (TextView)this.findViewById(2131492906);
- this.dsBatteryIcon = (ImageView)this.findViewById(2131492887);
- this.immersion = new ImmersiveMode(this.getWindow().getDecorView());
- this.buttonInit = (ImageButton)this.findViewById(2131492911);
- this.buttonInitStop = (ImageButton)this.findViewById(2131492915);
- this.buttonStart = (ImageButton)this.findViewById(2131492910);
- this.controlPanelBack = this.findViewById(2131492908);
- this.batteryInfo = this.findViewById(2131492902);
- this.wifiInfo = this.findViewById(2131492894);
- this.userIcon_1_active = (ImageView)this.findViewById(2131492892);
- this.userIcon_2_active = (ImageView)this.findViewById(2131492890);
- this.userIcon_1_base = (ImageView)this.findViewById(2131492893);
- this.userIcon_2_base = (ImageView)this.findViewById(2131492891);
- this.buttonStartTimed = (ImageButton)this.findViewById(2131492913);
- this.textTimer = (TextView)this.findViewById(2131492914);
- this.buttonSelect = (Button)this.findViewById(2131492907);
- this.buttonStop = (ImageButton)this.findViewById(2131492912);
- this.buttonMenu = (ImageButton)this.findViewById(2131492889);
- this.buttonMenu.setOnClickListener(new OnClickListener() {
- public void onClick(View var1) {
- FtcDriverStationActivity.this.openOptionsMenu();
- }
- });
- PreferenceManager.setDefaultValues(this, 2131034112, false);
- this.preferences = PreferenceManager.getDefaultSharedPreferences(this);
- this.preferences.registerOnSharedPreferenceChangeListener(this);
- this.wifiDirect = WifiDirectAssistant.getWifiDirectAssistant(this.getApplicationContext());
- this.wifiDirect.setCallback(this);
- this.analytics = new Analytics(this.context, "update_ds", new HardwareMap());
- this.batteryChecker = new BatteryChecker(this, this, (long)300000);
- this.batteryChecker.startBatteryMonitoring();
- }
-
- public boolean onCreateOptionsMenu(Menu var1) {
- this.getMenuInflater().inflate(2131427328, var1);
- return true;
- }
-
- public boolean onOptionsItemSelected(MenuItem var1) {
- switch(var1.getItemId()) {
- case 2131493090:
- this.startActivity(new Intent(this.getBaseContext(), SettingsActivity.class));
- return true;
- case 2131493091:
- this.pendingCommands.add(new Command("CMD_RESTART_ROBOT"));
- return true;
- case 2131493092:
- this.startActivity(new Intent("com.qualcomm.ftccommon.configuration.AboutActivity.intent.action.Launch"));
- return true;
- case 2131493093:
- this.finish();
- return true;
- default:
- return super.onOptionsItemSelected(var1);
- }
- }
-
- protected void onPause() {
- super.onPause();
- this.analytics.unregister();
- }
-
- protected void onResume() {
- super.onResume();
- this.analytics.register();
- this.setupNeeded = true;
- this.enableNetworkTrafficLogging = this.preferences.getBoolean(this.getString(2131361893), false);
- this.wifiDirect.setCallback(this);
- if(this.wifiDirect.isConnected()) {
- RobotLog.i("Spoofing a wifi direct event...");
- this.onWifiDirectEvent(WifiDirectAssistant.Event.CONNECTION_INFO_AVAILABLE);
- }
-
- }
-
- public void onSelectionClick(String var1) {
- this.handleOpModeQueued(var1);
- this.opModeCountDown.setCountdown(30L);
- if(this.opModeUseTimer) {
- this.setTextView(this.textTimer, String.valueOf(this.opModeCountDown.getTimeRemainingInSeconds()));
- } else {
- this.setTextView(this.textTimer, "");
- }
-
- this.uiWaitingForInitEvent();
- }
-
- public void onSharedPreferenceChanged(SharedPreferences var1, String var2) {
- if(var2.equals(this.context.getString(2131361885))) {
- this.gamepads.remove(this.userToGamepadMap.get(Integer.valueOf(1)));
- this.userToGamepadMap.remove(Integer.valueOf(1));
- } else {
- if(var2.equals(this.context.getString(2131361887))) {
- this.gamepads.remove(this.userToGamepadMap.get(Integer.valueOf(2)));
- this.userToGamepadMap.remove(Integer.valueOf(2));
- return;
- }
-
- if(var2.equals(this.context.getString(2131361893))) {
- this.enableNetworkTrafficLogging = this.preferences.getBoolean(this.getString(2131361893), false);
- return;
- }
- }
-
- }
-
- protected void onStart() {
- super.onStart();
- RobotLog.writeLogcatToDisk(this, 2048);
- this.wifiDirectStatus("Disconnected");
- this.groupOwnerMac = PreferenceManager.getDefaultSharedPreferences(this).getString(this.getString(2131361882), this.getString(2131361883));
- this.assumeClientDisconnect();
- this.wifiDirect.enable();
- if(!this.wifiDirect.isConnected()) {
- this.wifiDirect.discoverPeers();
- } else if(!this.groupOwnerMac.equalsIgnoreCase(this.wifiDirect.getGroupOwnerMacAddress())) {
- DbgLog.error("Wifi Direct - connected to " + this.wifiDirect.getGroupOwnerMacAddress() + ", expected " + this.groupOwnerMac);
- this.wifiDirectStatus("Error: Connected to wrong device");
- this.startActivity(new Intent(this.getBaseContext(), ConfigWifiDirectActivity.class));
- return;
- }
-
- this.setVisibility(this.userIcon_1_active, 4);
- this.setVisibility(this.userIcon_2_active, 4);
- this.setVisibility(this.userIcon_1_base, 4);
- this.setVisibility(this.userIcon_2_base, 4);
- DbgLog.msg("App Started");
- }
-
- protected void onStop() {
- super.onStop();
- this.wifiDirect.disable();
- this.shutdown();
- DbgLog.msg("App Stopped");
- RobotLog.cancelWriteLogcatToDisk(this);
- }
-
- public void onWifiDirectEvent(WifiDirectAssistant.Event param1) {
- // $FF: Couldn't be decompiled
- }
-
- public void onWindowFocusChanged(boolean var1) {
- super.onWindowFocusChanged(var1);
- if(var1) {
- if(ImmersiveMode.apiOver19()) {
- this.immersion.hideSystemUI();
- }
-
- } else {
- this.immersion.cancelSystemUIHide();
- }
- }
-
- protected void peerDiscoveryEvent(RobocolDatagram var1) {
- if(!var1.getAddress().equals(this.remoteAddr)) {
- this.remoteAddr = var1.getAddress();
- DbgLog.msg("new remote peer discovered: " + this.remoteAddr.getHostAddress());
-
- try {
- this.socket.connect(this.remoteAddr);
- } catch (SocketException var3) {
- DbgLog.error("Unable to connect to peer:" + var3.toString());
- }
-
- if(this.sendLoopFuture == null || this.sendLoopFuture.isDone()) {
- this.sendLoopFuture = this.sendLoopService.scheduleAtFixedRate(new FtcDriverStationActivity.SendLoopRunnable(null), 0L, 40L, TimeUnit.MILLISECONDS);
- }
-
- this.assumeClientConnect();
- }
- }
-
- protected void pingStatus(String var1) {
- this.setTextView(this.textPingStatus, var1);
- }
-
- protected void setButtonText(final Button var1, final String var2) {
- this.runOnUiThread(new Runnable() {
- public void run() {
- var1.setText(var2);
- }
- });
- }
-
- protected void setEnabled(final View var1, final boolean var2) {
- this.runOnUiThread(new Runnable() {
- public void run() {
- var1.setEnabled(var2);
- }
- });
- }
-
- protected void setImageResource(final ImageButton var1, final int var2) {
- this.runOnUiThread(new Runnable() {
- public void run() {
- var1.setImageResource(var2);
- }
- });
- }
-
- protected void setOpacity(final View var1, final float var2) {
- this.runOnUiThread(new Runnable() {
- public void run() {
- var1.setAlpha(var2);
- }
- });
- }
-
- protected void setTextView(final TextView var1, final String var2) {
- this.runOnUiThread(new Runnable() {
- public void run() {
- var1.setText(var2);
- }
- });
- }
-
- protected void setVisibility(final View var1, final int var2) {
- this.runOnUiThread(new Runnable() {
- public void run() {
- var1.setVisibility(var2);
- }
- });
- }
-
- public void showToast(final Toast var1) {
- this.runOnUiThread(new Runnable() {
- public void run() {
- var1.show();
- }
- });
- }
-
- public void showToast(String var1, int var2) {
- this.showToast(Toast.makeText(this.context, var1, var2));
- }
-
- protected void shutdown() {
- if(this.recvLoopService != null) {
- this.recvLoopService.shutdownNow();
- }
-
- if(this.sendLoopFuture != null && !this.sendLoopFuture.isDone()) {
- this.sendLoopFuture.cancel(true);
- }
-
- if(this.peerDiscoveryManager != null) {
- this.peerDiscoveryManager.stop();
- }
-
- if(this.socket != null) {
- this.socket.close();
- }
-
- this.remoteAddr = null;
- this.setupNeeded = true;
- this.pingStatus("");
- }
-
- protected void telemetryEvent(RobocolDatagram var1) {
- String var2 = "";
-
- Telemetry var3;
- try {
- var3 = new Telemetry(var1.getData());
- } catch (RobotCoreException var15) {
- DbgLog.logStacktrace(var15);
- return;
- }
-
- Map var4 = var3.getDataStrings();
-
- String var13;
- for(Iterator var5 = (new TreeSet(var4.keySet())).iterator(); var5.hasNext(); var2 = var2 + var13 + ": " + (String)var4.get(var13) + "\n") {
- var13 = (String)var5.next();
- }
-
- String var6 = var2 + "\n";
- Map var7 = var3.getDataNumbers();
-
- String var12;
- for(Iterator var8 = (new TreeSet(var7.keySet())).iterator(); var8.hasNext(); var6 = var6 + var12 + ": " + var7.get(var12) + "\n") {
- var12 = (String)var8.next();
- }
-
- String var9 = var3.getTag();
- if(var9.equals("SYSTEM_TELEMETRY")) {
- DbgLog.error("System Telemetry event: " + var6);
- RobotLog.setGlobalErrorMsg(var6);
- this.setVisibility(this.systemTelemetry, 0);
- this.setTextView(this.systemTelemetry, "Robot Status: " + this.robotState + "\n" + "To recover, please restart the robot." + "\n" + "Error: " + (String)var4.get(var9));
- this.uiRobotNeedsRestart();
- } else if(var9.equals("RobotController Battery Level")) {
- DbgLog.msg("RC battery Telemetry event: " + (String)var4.get(var9));
- this.setTextView(this.rcBatteryTelemetry, (String)var4.get(var9) + "%");
- this.setBatteryIcon(Float.parseFloat((String)var4.get(var9)), this.rcBatteryIcon);
- } else if(var9.equals("Robot Battery Level")) {
- String var10 = (String)var4.get(var9);
- DbgLog.msg("Robot Battery Telemetry event: " + var10);
- this.setTextView(this.robotBatteryTelemetry, var10);
- ImageView var11 = (ImageView)this.findViewById(2131492905);
- if(var10.equals("no voltage sensor found")) {
- this.setVisibility(var11, 8);
- } else {
- this.setVisibility(var11, 0);
- }
- } else {
- this.setTextView(this.textTelemetry, var6);
- }
- }
-
- protected void uiRobotControllerIsConnected() {
- this.setOpacity(this.wifiInfo, 1.0F);
- this.setOpacity(this.batteryInfo, 1.0F);
- this.setOpacity(this.buttonSelect, 1.0F);
- this.setTextView(this.textTelemetry, "");
- this.setTextView(this.systemTelemetry, "");
- this.setVisibility(this.systemTelemetry, 8);
- this.setTextView(this.rcBatteryTelemetry, "");
- this.setTextView(this.robotBatteryTelemetry, "");
- }
-
- protected void uiRobotControllerIsDisconnected() {
- this.setOpacity(this.controlPanelBack, 0.3F);
- this.setOpacity(this.wifiInfo, 0.3F);
- this.setOpacity(this.batteryInfo, 0.3F);
- this.setEnabled(this.buttonSelect, false);
- this.setOpacity(this.buttonSelect, 0.3F);
- this.setEnabled(this.buttonInit, false);
- this.setVisibility(this.buttonInit, 0);
- this.setVisibility(this.buttonStart, 4);
- this.setVisibility(this.buttonStop, 4);
- this.setVisibility(this.buttonInitStop, 4);
- this.setVisibility(this.buttonStartTimed, 4);
- this.setVisibility(this.textTimer, 4);
- }
-
- protected void uiRobotNeedsRestart() {
- this.setOpacity(this.buttonSelect, 0.3F);
- this.setEnabled(this.buttonSelect, false);
- this.setEnabled(this.buttonInit, false);
- this.setVisibility(this.buttonInit, 0);
- this.setVisibility(this.buttonStart, 4);
- this.setVisibility(this.buttonStop, 4);
- this.setVisibility(this.buttonInitStop, 4);
- this.setVisibility(this.buttonStartTimed, 4);
- this.setVisibility(this.textTimer, 4);
- }
-
- protected void uiWaitingForInitEvent() {
- this.setOpacity(this.controlPanelBack, 1.0F);
- this.setButtonText(this.buttonSelect, this.queuedOpMode);
- this.setEnabled(this.buttonSelect, true);
- this.setOpacity(this.buttonSelect, 1.0F);
- this.setEnabled(this.buttonInit, true);
- this.setVisibility(this.buttonInit, 0);
- this.setVisibility(this.buttonStart, 4);
- this.setVisibility(this.buttonStop, 4);
- this.setVisibility(this.buttonInitStop, 4);
- this.setEnabled(this.buttonStartTimed, true);
- this.setVisibility(this.buttonStartTimed, 0);
- this.setVisibility(this.textTimer, 0);
- }
-
- protected void uiWaitingForOpModeSelection() {
- this.setEnabled(this.buttonSelect, true);
- this.setOpacity(this.buttonSelect, 1.0F);
- this.setButtonText(this.buttonSelect, "Select Op Mode");
- this.setOpacity(this.controlPanelBack, 0.3F);
- this.setEnabled(this.buttonInit, false);
- this.setVisibility(this.buttonInit, 0);
- this.setVisibility(this.buttonStart, 4);
- this.setVisibility(this.buttonStop, 4);
- this.setVisibility(this.buttonInitStop, 4);
- this.setVisibility(this.buttonStartTimed, 4);
- this.setVisibility(this.textTimer, 4);
- }
-
- protected void uiWaitingForStartEvent() {
- this.setButtonText(this.buttonSelect, this.queuedOpMode);
- this.setEnabled(this.buttonSelect, true);
- this.setOpacity(this.buttonSelect, 1.0F);
- this.setVisibility(this.buttonStart, 0);
- this.setVisibility(this.buttonInit, 4);
- this.setVisibility(this.buttonStop, 4);
- this.setVisibility(this.buttonInitStop, 0);
- this.setEnabled(this.buttonStartTimed, true);
- this.setVisibility(this.buttonStartTimed, 0);
- this.setVisibility(this.textTimer, 0);
- }
-
- protected void uiWaitingForStopEvent() {
- this.setButtonText(this.buttonSelect, this.queuedOpMode);
- this.setEnabled(this.buttonSelect, true);
- this.setOpacity(this.buttonSelect, 1.0F);
- this.setVisibility(this.buttonStop, 0);
- this.setVisibility(this.buttonInit, 4);
- this.setVisibility(this.buttonStart, 4);
- this.setVisibility(this.buttonInitStop, 4);
- this.setEnabled(this.buttonStartTimed, false);
- this.setVisibility(this.buttonStartTimed, 0);
- this.setVisibility(this.textTimer, 0);
- }
-
- public void updateBatteryLevel(float var1) {
- this.setTextView(this.dsBatteryInfo, var1 + "%");
- this.setBatteryIcon(var1, this.dsBatteryIcon);
- }
-
- protected void wifiDirectStatus(final String var1) {
- this.runOnUiThread(new Runnable() {
- public void run() {
- FtcDriverStationActivity.this.textWifiDirectStatus.setText(var1);
- }
- });
- }
-
- private class OpModeCountDownTimer {
- public static final long COUNTDOWN_INTERVAL = 30L;
- public static final long MILLISECONDS_PER_SECOND = 1000L;
- public static final long TICK = 1000L;
- public static final long TICK_INTERVAL = 1L;
- private long countdown;
- boolean running;
- CountDownTimer timer;
-
- private OpModeCountDownTimer() {
- this.countdown = 30000L;
- this.timer = null;
- this.running = false;
- }
-
- // $FF: synthetic method
- OpModeCountDownTimer(Object var2) {
- this();
- }
-
- public long getTimeRemainingInSeconds() {
- return this.countdown / 1000L;
- }
-
- public boolean isRunning() {
- return this.running;
- }
-
- public void setCountdown(long var1) {
- this.countdown = 1000L * var1;
- }
-
- public void start() {
- DbgLog.msg("Running current op mode for " + this.getTimeRemainingInSeconds() + " seconds");
- this.running = true;
- FtcDriverStationActivity.this.runOnUiThread(new Runnable() {
- public void run() {
- OpModeCountDownTimer.this.timer = (new CountDownTimer(OpModeCountDownTimer.this.countdown, var4) {
- public void onFinish() {
- OpModeCountDownTimer.this.running = false;
- DbgLog.msg("Stopping current op mode, timer expired");
- OpModeCountDownTimer.this.setCountdown(30L);
- FtcDriverStationActivity.this.setTextView(FtcDriverStationActivity.this.textTimer, "");
- FtcDriverStationActivity.this.setImageResource(FtcDriverStationActivity.this.buttonStartTimed, 2130837521);
- FtcDriverStationActivity.this.handleOpModeStop();
- }
-
- public void onTick(long var1) {
- long var3 = var1 / 1000L;
- String var5 = String.valueOf(var3);
- FtcDriverStationActivity.this.setTextView(FtcDriverStationActivity.this.textTimer, var5);
- DbgLog.msg("Running current op mode for " + var3 + " seconds");
- }
- }).start();
- }
- });
- }
-
- public void stop() {
- if(this.running) {
- this.running = false;
- DbgLog.msg("Stopping current op mode timer");
- if(this.timer != null) {
- this.timer.cancel();
- return;
- }
- }
-
- }
- }
-
- private class RecvLoopRunnable implements Runnable {
- private RecvLoopRunnable() {
- }
-
- // $FF: synthetic method
- RecvLoopRunnable(Object var2) {
- this();
- }
-
- public void run() {
- while(true) {
- RobocolDatagram var1 = FtcDriverStationActivity.this.socket.recv();
- if(var1 == null) {
- if(FtcDriverStationActivity.this.socket.isClosed()) {
- return;
- }
-
- Thread.yield();
- } else {
- FtcDriverStationActivity.this.lastRecvPacket.reset();
- switch(null.$SwitchMap$com$qualcomm$robotcore$robocol$RobocolParsable$MsgType[var1.getMsgType().ordinal()]) {
- case 1:
- FtcDriverStationActivity.this.peerDiscoveryEvent(var1);
- break;
- case 2:
- FtcDriverStationActivity.this.heartbeatEvent(var1);
- break;
- case 3:
- FtcDriverStationActivity.this.commandEvent(var1);
- break;
- case 4:
- FtcDriverStationActivity.this.telemetryEvent(var1);
- break;
- default:
- DbgLog.msg("Unhandled message type: " + var1.getMsgType().name());
- }
- }
- }
- }
- }
-
- private class SendLoopRunnable implements Runnable {
- private static final long GAMEPAD_UPDATE_THRESHOLD = 1000L;
-
- private SendLoopRunnable() {
- }
-
- // $FF: synthetic method
- SendLoopRunnable(Object var2) {
- this();
- }
-
- public void run() {
- // $FF: Couldn't be decompiled
- }
- }
-
- private class SetupRunnable implements Runnable {
- private SetupRunnable() {
- }
-
- // $FF: synthetic method
- SetupRunnable(Object var2) {
- this();
- }
-
- public void run() {
- try {
- if(FtcDriverStationActivity.this.socket != null) {
- FtcDriverStationActivity.this.socket.close();
- }
-
- FtcDriverStationActivity.this.socket = new RobocolDatagramSocket();
- FtcDriverStationActivity.this.socket.listen(FtcDriverStationActivity.this.wifiDirect.getGroupOwnerAddress());
- FtcDriverStationActivity.this.socket.connect(FtcDriverStationActivity.this.wifiDirect.getGroupOwnerAddress());
- } catch (SocketException var2) {
- DbgLog.error("Failed to open socket: " + var2.toString());
- }
-
- if(FtcDriverStationActivity.this.peerDiscoveryManager != null) {
- FtcDriverStationActivity.this.peerDiscoveryManager.stop();
- }
-
- FtcDriverStationActivity.this.peerDiscoveryManager = new PeerDiscoveryManager(FtcDriverStationActivity.this.socket);
- FtcDriverStationActivity.this.peerDiscoveryManager.start(FtcDriverStationActivity.this.wifiDirect.getGroupOwnerAddress());
- FtcDriverStationActivity.this.recvLoopService = Executors.newSingleThreadExecutor();
- FtcDriverStationActivity.this.recvLoopService.execute(FtcDriverStationActivity.this.new RecvLoopRunnable(null));
- DbgLog.msg("Setup complete");
- }
- }
-}
diff --git a/FtcRobotController/app/src/main/java/com/qualcomm/ftcdriverstation/FtcPairWifiDirectActivity.java b/FtcRobotController/app/src/main/java/com/qualcomm/ftcdriverstation/FtcPairWifiDirectActivity.java
deleted file mode 100644
index 1c0b7ed..0000000
--- a/FtcRobotController/app/src/main/java/com/qualcomm/ftcdriverstation/FtcPairWifiDirectActivity.java
+++ /dev/null
@@ -1,153 +0,0 @@
-package com.qualcomm.ftcdriverstation;
-
-import android.app.Activity;
-import android.content.Context;
-import android.content.SharedPreferences;
-import android.content.SharedPreferences.Editor;
-import android.net.wifi.p2p.WifiP2pDevice;
-import android.os.Bundle;
-import android.os.Handler;
-import android.preference.PreferenceManager;
-import android.view.View;
-import android.view.View.OnClickListener;
-import android.widget.RadioButton;
-import android.widget.RadioGroup;
-import com.qualcomm.ftccommon.DbgLog;
-import com.qualcomm.robotcore.wifi.WifiDirectAssistant;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-import java.util.TreeMap;
-
-public class FtcPairWifiDirectActivity extends Activity implements OnClickListener, WifiDirectAssistant.WifiDirectAssistantCallback {
- private static final int WIFI_SCAN_RATE = 10000;
- private String driverStationMac;
- private SharedPreferences sharedPref;
- private WifiDirectAssistant wifiDirect;
- private Handler wifiDirectHandler = new Handler();
- private FtcPairWifiDirectActivity.WifiDirectRunnable wifiDirectRunnable = new FtcPairWifiDirectActivity.WifiDirectRunnable();
-
- private void updateDevicesList(List var1) {
- RadioGroup var2 = (RadioGroup)this.findViewById(2131492921);
- var2.clearCheck();
- var2.removeAllViews();
- FtcPairWifiDirectActivity.PeerRadioButton var3 = new FtcPairWifiDirectActivity.PeerRadioButton(this);
- String var4 = this.getString(2131361883);
- var3.setId(0);
- var3.setText("None\nDo not pair with any device");
- var3.setPadding(0, 0, 0, 24);
- var3.setOnClickListener(this);
- var3.setPeerMacAddress(var4);
- if(this.driverStationMac.equalsIgnoreCase(var4)) {
- var3.setChecked(true);
- }
-
- var2.addView(var3);
- int var5 = 1;
- Map var6 = this.buildMap(var1);
-
- int var11;
- for(Iterator var7 = var6.keySet().iterator(); var7.hasNext(); var5 = var11) {
- String var8 = (String)var7.next();
- String var9 = (String)var6.get(var8);
- FtcPairWifiDirectActivity.PeerRadioButton var10 = new FtcPairWifiDirectActivity.PeerRadioButton(this);
- var11 = var5 + 1;
- var10.setId(var5);
- var10.setText(var8 + "\n" + var9);
- var10.setPadding(0, 0, 0, 24);
- var10.setPeerMacAddress(var9);
- if(var9.equalsIgnoreCase(this.driverStationMac)) {
- var10.setChecked(true);
- }
-
- var10.setOnClickListener(this);
- var2.addView(var10);
- }
-
- }
-
- public Map buildMap(List var1) {
- TreeMap var2 = new TreeMap();
- Iterator var3 = var1.iterator();
-
- while(var3.hasNext()) {
- WifiP2pDevice var4 = (WifiP2pDevice)var3.next();
- var2.put(var4.deviceName, var4.deviceAddress);
- }
-
- return var2;
- }
-
- public void onClick(View var1) {
- if(var1 instanceof FtcPairWifiDirectActivity.PeerRadioButton) {
- FtcPairWifiDirectActivity.PeerRadioButton var2 = (FtcPairWifiDirectActivity.PeerRadioButton)var1;
- if(var2.getId() == 0) {
- this.driverStationMac = this.getString(2131361883);
- } else {
- this.driverStationMac = var2.getPeerMacAddress();
- }
-
- Editor var3 = this.sharedPref.edit();
- var3.putString(this.getString(2131361882), this.driverStationMac);
- var3.commit();
- DbgLog.msg("Setting Driver Station MAC address to " + this.driverStationMac);
- }
-
- }
-
- protected void onCreate(Bundle var1) {
- super.onCreate(var1);
- this.setContentView(2130903045);
- this.wifiDirect = WifiDirectAssistant.getWifiDirectAssistant(this);
- }
-
- public void onStart() {
- super.onStart();
- DbgLog.msg("Starting Pairing with Driver Station activity");
- this.sharedPref = PreferenceManager.getDefaultSharedPreferences(this);
- this.driverStationMac = this.sharedPref.getString(this.getString(2131361882), this.getString(2131361883));
- this.wifiDirect.enable();
- this.wifiDirect.setCallback(this);
- this.updateDevicesList(this.wifiDirect.getPeers());
- this.wifiDirectHandler.postDelayed(this.wifiDirectRunnable, 10000L);
- }
-
- public void onStop() {
- super.onStop();
- this.wifiDirectHandler.removeCallbacks(this.wifiDirectRunnable);
- this.wifiDirect.cancelDiscoverPeers();
- this.wifiDirect.disable();
- }
-
- public void onWifiDirectEvent(WifiDirectAssistant.Event var1) {
- switch(null.$SwitchMap$com$qualcomm$robotcore$wifi$WifiDirectAssistant$Event[var1.ordinal()]) {
- case 1:
- this.updateDevicesList(this.wifiDirect.getPeers());
- return;
- default:
- }
- }
-
- public static class PeerRadioButton extends RadioButton {
- private String peerMacAddress = "";
-
- public PeerRadioButton(Context var1) {
- super(var1);
- }
-
- public String getPeerMacAddress() {
- return this.peerMacAddress;
- }
-
- public void setPeerMacAddress(String var1) {
- this.peerMacAddress = var1;
- }
- }
-
- public class WifiDirectRunnable implements Runnable {
- public void run() {
- FtcPairWifiDirectActivity.this.wifiDirect.discoverPeers();
- FtcPairWifiDirectActivity.this.wifiDirectHandler.postDelayed(FtcPairWifiDirectActivity.this.wifiDirectRunnable, 10000L);
- }
- }
-}
diff --git a/FtcRobotController/app/src/main/java/com/qualcomm/ftcdriverstation/OpModeSelectionDialogFragment.java b/FtcRobotController/app/src/main/java/com/qualcomm/ftcdriverstation/OpModeSelectionDialogFragment.java
deleted file mode 100644
index 9c81e93..0000000
--- a/FtcRobotController/app/src/main/java/com/qualcomm/ftcdriverstation/OpModeSelectionDialogFragment.java
+++ /dev/null
@@ -1,50 +0,0 @@
-package com.qualcomm.ftcdriverstation;
-
-import android.app.Dialog;
-import android.app.DialogFragment;
-import android.app.AlertDialog.Builder;
-import android.content.DialogInterface;
-import android.content.DialogInterface.OnClickListener;
-import android.os.Bundle;
-import android.view.LayoutInflater;
-import android.view.View;
-import android.view.ViewGroup;
-
-public class OpModeSelectionDialogFragment extends DialogFragment {
- private OpModeSelectionDialogFragment.OpModeSelectionDialogListener listener = null;
- private String[] opModes = new String[0];
-
- public Dialog onCreateDialog(Bundle var1) {
- View var2 = LayoutInflater.from(this.getActivity()).inflate(2130903054, (ViewGroup)null);
- Builder var3 = new Builder(this.getActivity());
- var3.setCustomTitle(var2);
- var3.setTitle(2131361817);
- var3.setItems(this.opModes, new OnClickListener() {
- public void onClick(DialogInterface var1, int var2) {
- if(OpModeSelectionDialogFragment.this.listener != null) {
- OpModeSelectionDialogFragment.this.listener.onSelectionClick(OpModeSelectionDialogFragment.this.opModes[var2]);
- }
-
- }
- });
- return var3.create();
- }
-
- public void onStart() {
- super.onStart();
- Dialog var1 = this.getDialog();
- var1.findViewById(var1.getContext().getResources().getIdentifier("android:id/titleDivider", (String)null, (String)null)).setBackgroundColor(this.getResources().getColor(2131296266));
- }
-
- public void setOnSelectionDialogListener(OpModeSelectionDialogFragment.OpModeSelectionDialogListener var1) {
- this.listener = var1;
- }
-
- public void setOpModes(String[] var1) {
- this.opModes = var1;
- }
-
- public interface OpModeSelectionDialogListener {
- void onSelectionClick(String var1);
- }
-}
diff --git a/FtcRobotController/app/src/main/java/com/qualcomm/ftcdriverstation/R.java b/FtcRobotController/app/src/main/java/com/qualcomm/ftcdriverstation/R.java
deleted file mode 100644
index 29c4ff8..0000000
--- a/FtcRobotController/app/src/main/java/com/qualcomm/ftcdriverstation/R.java
+++ /dev/null
@@ -1,497 +0,0 @@
-package com.qualcomm.ftcdriverstation;
-
-public final class R {
- public static final class anim {
- public static final int fadein = 2130968576;
- public static final int fadeout = 2130968577;
- }
-
- public static final class array {
- public static final int choice_array = 2131230720;
- public static final int choice_array_analogInput = 2131230721;
- public static final int choice_array_analogOutput = 2131230722;
- public static final int choice_array_digital_device = 2131230723;
- public static final int choice_array_i2c = 2131230724;
- public static final int device_interface_module_options_array = 2131230725;
- public static final int pref_gamepad_type_entries = 2131230726;
- public static final int wifi_direct_channels = 2131230727;
- }
-
- public static final class attr {
- }
-
- public static final class color {
- public static final int black = 2131296256;
- public static final int bright_qcom_blue = 2131296257;
- public static final int bright_red = 2131296258;
- public static final int bright_red_text = 2131296259;
- public static final int dark_red_background = 2131296260;
- public static final int light_qcom_blue = 2131296261;
- public static final int light_red_background = 2131296262;
- public static final int medium_qcom_blue = 2131296263;
- public static final int medium_red_background = 2131296264;
- public static final int transparent_color = 2131296265;
- public static final int very_bright_red = 2131296266;
- public static final int white = 2131296267;
- }
-
- public static final class dimen {
- public static final int activity_horizontal_margin = 2131099648;
- public static final int activity_vertical_margin = 2131099649;
- }
-
- public static final class drawable {
- public static final int button_shape = 2130837504;
- public static final int circles = 2130837505;
- public static final int controlpanel_back = 2130837506;
- public static final int ic_launcher = 2130837507;
- public static final int icon_arrow = 2130837508;
- public static final int icon_battery0 = 2130837509;
- public static final int icon_battery100 = 2130837510;
- public static final int icon_battery25 = 2130837511;
- public static final int icon_battery50 = 2130837512;
- public static final int icon_battery75 = 2130837513;
- public static final int icon_controller = 2130837514;
- public static final int icon_controlleractive = 2130837515;
- public static final int icon_init = 2130837516;
- public static final int icon_menu = 2130837517;
- public static final int icon_play = 2130837518;
- public static final int icon_robotcontroller = 2130837519;
- public static final int icon_stop = 2130837520;
- public static final int icon_timeroff = 2130837521;
- public static final int icon_timeron = 2130837522;
- public static final int icon_voltage = 2130837523;
- }
-
- public static final class id {
- public static final int DS_battery_icon = 2131492887;
- public static final int aboutList = 2131492864;
- public static final int action_about = 2131493092;
- public static final int action_exit_app = 2131493093;
- public static final int action_restart_robot = 2131493091;
- public static final int action_settings = 2131493090;
- public static final int active_filename = 2131492997;
- public static final int activity_fix_misconfig_wifi_direct = 2131492869;
- public static final int analogOutput_devices_cancelButton = 2131492960;
- public static final int analogOutput_devices_saveButton = 2131492959;
- public static final int analog_input_devices_cancelButton = 2131492941;
- public static final int analog_input_devices_saveButton = 2131492940;
- public static final int attached_title = 2131492945;
- public static final int autoconfigure = 2131492932;
- public static final int autoconfigure_holder = 2131492931;
- public static final int autoconfigure_info = 2131492868;
- public static final int battery_info_layout = 2131492902;
- public static final int buttonConfigure = 2131492923;
- public static final int buttonInit = 2131492911;
- public static final int buttonInitStop = 2131492915;
- public static final int buttonSelect = 2131492907;
- public static final int buttonStart = 2131492910;
- public static final int buttonStartTimed = 2131492913;
- public static final int buttonStart_frame = 2131492909;
- public static final int buttonStop = 2131492912;
- public static final int buttonWifiSettings = 2131492924;
- public static final int checkbox_port6 = 2131493056;
- public static final int checkbox_port7 = 2131493053;
- public static final int checkbox_port_matrix = 2131493045;
- public static final int checkbox_port_pwm = 2131493064;
- public static final int checkbox_port_servo = 2131493071;
- public static final int choiceSpinner_analogInput = 2131492937;
- public static final int choiceSpinner_analogOutput = 2131492956;
- public static final int choiceSpinner_digital_device = 2131492974;
- public static final int choiceSpinner_i2c = 2131493000;
- public static final int choiceSpinner_legacyModule = 2131493087;
- public static final int circle_ping = 2131492899;
- public static final int circle_wifi = 2131492896;
- public static final int configureLegacy = 2131492867;
- public static final int configureUSB = 2131492866;
- public static final int controlPanel = 2131492908;
- public static final int controller_name = 2131493050;
- public static final int controller_name_text = 2131493014;
- public static final int controllers = 2131492996;
- public static final int controllersList = 2131492878;
- public static final int custom_title_bar = 2131492964;
- public static final int device_interface_module_cancelButton = 2131492966;
- public static final int device_interface_module_name = 2131492967;
- public static final int device_interface_module_saveButton = 2131492965;
- public static final int device_interface_module_serialNumber = 2131492968;
- public static final int devices_holder = 2131492876;
- public static final int devices_info_btn = 2131492877;
- public static final int digital_devices_cancelButton = 2131492978;
- public static final int digital_devices_saveButton = 2131492977;
- public static final int dropdown_layout = 2131493086;
- public static final int dsBatteryInfo = 2131492888;
- public static final int editTextResult_analogInput = 2131492938;
- public static final int editTextResult_analogInput6 = 2131493057;
- public static final int editTextResult_analogInput7 = 2131493054;
- public static final int editTextResult_analogOutput = 2131492957;
- public static final int editTextResult_digital_device = 2131492975;
- public static final int editTextResult_i2c = 2131493001;
- public static final int editTextResult_matrix = 2131493046;
- public static final int editTextResult_name = 2131493088;
- public static final int editTextResult_pwm = 2131493065;
- public static final int editTextResult_servo = 2131493072;
- public static final int edit_controller_btn = 2131493089;
- public static final int empty_devicelist = 2131492879;
- public static final int empty_filelist = 2131492930;
- public static final int file_activate_button = 2131492994;
- public static final int file_buttons = 2131492989;
- public static final int file_delete_button = 2131492995;
- public static final int file_edit_button = 2131492993;
- public static final int file_info_layout = 2131492988;
- public static final int filename_editText = 2131492991;
- public static final int files_holder = 2131492928;
- public static final int header = 2131492970;
- public static final int holdsDevices = 2131492871;
- public static final int holds_buttons = 2131492926;
- public static final int horizontalButtons = 2131492992;
- public static final int i2c_devices_cancelButton = 2131493004;
- public static final int i2c_devices_saveButton = 2131493003;
- public static final int included_header = 2131492865;
- public static final int inclusionlayout = 2131492929;
- public static final int info_btn = 2131493012;
- public static final int legacy_serialNumber = 2131493013;
- public static final int linearLayout = 2131492990;
- public static final int linearLayout0 = 2131493018;
- public static final int linearLayout1 = 2131493021;
- public static final int linearLayout2 = 2131493022;
- public static final int linearLayout3 = 2131493025;
- public static final int linearLayout4 = 2131493028;
- public static final int linearLayout5 = 2131493029;
- public static final int linearLayout_analogInput0 = 2131492953;
- public static final int linearLayout_analogInput1 = 2131492952;
- public static final int linearLayout_analogInput2 = 2131492951;
- public static final int linearLayout_analogInput3 = 2131492950;
- public static final int linearLayout_analogInput4 = 2131492949;
- public static final int linearLayout_analogInput5 = 2131492948;
- public static final int linearLayout_analogInput6 = 2131492947;
- public static final int linearLayout_analogInput7 = 2131492946;
- public static final int linearLayout_analogOutput0 = 2131492963;
- public static final int linearLayout_analogOutput1 = 2131492962;
- public static final int linearLayout_digital_device0 = 2131492987;
- public static final int linearLayout_digital_device1 = 2131492986;
- public static final int linearLayout_digital_device2 = 2131492985;
- public static final int linearLayout_digital_device3 = 2131492984;
- public static final int linearLayout_digital_device4 = 2131492983;
- public static final int linearLayout_digital_device5 = 2131492982;
- public static final int linearLayout_digital_device6 = 2131492981;
- public static final int linearLayout_digital_device7 = 2131492980;
- public static final int linearLayout_i2c0 = 2131493011;
- public static final int linearLayout_i2c1 = 2131493010;
- public static final int linearLayout_i2c2 = 2131493009;
- public static final int linearLayout_i2c3 = 2131493008;
- public static final int linearLayout_i2c4 = 2131493007;
- public static final int linearLayout_i2c5 = 2131493006;
- public static final int linearLayout_matrix1 = 2131493034;
- public static final int linearLayout_matrix2 = 2131493035;
- public static final int linearLayout_matrix3 = 2131493036;
- public static final int linearLayout_matrix4 = 2131493037;
- public static final int linearLayout_matrix5 = 2131493039;
- public static final int linearLayout_matrix6 = 2131493040;
- public static final int linearLayout_matrix7 = 2131493041;
- public static final int linearLayout_matrix8 = 2131493042;
- public static final int linearLayout_pwm0 = 2131493068;
- public static final int linearLayout_pwm1 = 2131493067;
- public static final int linearLayout_servo1 = 2131493078;
- public static final int linearLayout_servo2 = 2131493079;
- public static final int linearLayout_servo3 = 2131493080;
- public static final int linearLayout_servo4 = 2131493081;
- public static final int linearLayout_servo5 = 2131493082;
- public static final int linearLayout_servo6 = 2131493083;
- public static final int listView_devices = 2131492969;
- public static final int load_bottom = 2131492925;
- public static final int matrix_controller_cancelButton = 2131493031;
- public static final int matrix_controller_saveButton = 2131493030;
- public static final int matrixcontroller_name = 2131493032;
- public static final int menu_buttons = 2131492889;
- public static final int motor_controller_serialNumber = 2131493051;
- public static final int motors_title = 2131493038;
- public static final int new_button = 2131492927;
- public static final int orange_warning = 2131493059;
- public static final int orangetext0 = 2131493060;
- public static final int orangetext1 = 2131493061;
- public static final int ping = 2131492900;
- public static final int port3 = 2131493024;
- public static final int port4 = 2131493027;
- public static final int port5 = 2131493017;
- public static final int port7 = 2131493020;
- public static final int portNumber = 2131493085;
- public static final int port_number_analogInput = 2131492936;
- public static final int port_number_analogOutput = 2131492955;
- public static final int port_number_digital_device = 2131492973;
- public static final int port_number_i2c = 2131492999;
- public static final int port_number_matrix = 2131493044;
- public static final int port_number_pwm = 2131493063;
- public static final int port_number_servo = 2131493070;
- public static final int port_title = 2131492944;
- public static final int pwm_devices_cancelButton = 2131493049;
- public static final int pwm_devices_saveButton = 2131493048;
- public static final int radioGroupDevices = 2131492921;
- public static final int rcBatteryTelemetry = 2131492904;
- public static final int rc_battery_icon = 2131492903;
- public static final int robotBatteryTelemetry = 2131492906;
- public static final int robot_battery_icon = 2131492905;
- public static final int robot_logo = 2131492895;
- public static final int row_port = 2131493052;
- public static final int row_port1 = 2131493019;
- public static final int row_port3 = 2131493023;
- public static final int row_port4 = 2131493026;
- public static final int row_port5 = 2131493016;
- public static final int row_port_analogInput = 2131492935;
- public static final int row_port_analogOutput = 2131492954;
- public static final int row_port_digital_device = 2131492972;
- public static final int row_port_i2c = 2131492998;
- public static final int row_port_matrix = 2131493043;
- public static final int row_port_pwm = 2131493062;
- public static final int row_port_servo = 2131493069;
- public static final int save_config_btn = 2131492882;
- public static final int save_holder = 2131492880;
- public static final int scanButton = 2131492873;
- public static final int scanButton_text = 2131492874;
- public static final int scan_bottom = 2131492872;
- public static final int scrollView = 2131492933;
- public static final int scrollView1 = 2131492920;
- public static final int scrollViewLayout = 2131492884;
- public static final int servo_controller_cancelButton = 2131493075;
- public static final int servo_controller_saveButton = 2131493074;
- public static final int servo_controller_serialNumber = 2131493077;
- public static final int servocontroller_name = 2131493076;
- public static final int servos_title = 2131493033;
- public static final int shape = 2131493084;
- public static final int spinnerChannelSelect = 2131492922;
- public static final int tableLayout_analogOutput_devices = 2131492961;
- public static final int tableLayout_analog_input_devices = 2131492942;
- public static final int tableLayout_digital_devices = 2131492979;
- public static final int tableLayout_i2c_devices = 2131493005;
- public static final int tableLayout_pwm_devices = 2131493015;
- public static final int table_header = 2131492943;
- public static final int textAdbLogs = 2131492934;
- public static final int textDeviceName = 2131492886;
- public static final int textPingStatus = 2131492901;
- public static final int textSystemTelemetry = 2131492916;
- public static final int textTelemetry = 2131492917;
- public static final int textTimer = 2131492914;
- public static final int textView = 2131492870;
- public static final int textView1 = 2131492971;
- public static final int textWifiDirectDevices = 2131492919;
- public static final int textWifiDirectInstructions = 2131492918;
- public static final int textWifiDirectStatus = 2131492898;
- public static final int titleTextView_analogInput = 2131492939;
- public static final int titleTextView_analogInput7 = 2131493055;
- public static final int titleTextView_analogOutput = 2131492958;
- public static final int titleTextView_digital_device = 2131492976;
- public static final int titleTextView_i2c = 2131493002;
- public static final int titleTextView_matrix = 2131493047;
- public static final int titleTextView_motor2 = 2131493058;
- public static final int titleTextView_pwm = 2131493066;
- public static final int titleTextView_servo = 2131493073;
- public static final int top_bar = 2131492885;
- public static final int user1_icon_base = 2131492893;
- public static final int user1_icon_clicked = 2131492892;
- public static final int user2_icon_base = 2131492891;
- public static final int user2_icon_clicked = 2131492890;
- public static final int warning_layout = 2131492875;
- public static final int wifiDirect = 2131492897;
- public static final int wifi_info_layout = 2131492894;
- public static final int writeXML = 2131492881;
- public static final int writeXML_text = 2131492883;
- }
-
- public static final class layout {
- public static final int activity_about = 2130903040;
- public static final int activity_autoconfigure = 2130903041;
- public static final int activity_config_wifi_direct = 2130903042;
- public static final int activity_ftc_configuration = 2130903043;
- public static final int activity_ftc_driver_station = 2130903044;
- public static final int activity_ftc_pair_wifi_direct = 2130903045;
- public static final int activity_ftc_wifi_channel_selector = 2130903046;
- public static final int activity_load = 2130903047;
- public static final int activity_settings = 2130903048;
- public static final int activity_view_logs = 2130903049;
- public static final int analog_input_device = 2130903050;
- public static final int analog_inputs = 2130903051;
- public static final int analog_output_device = 2130903052;
- public static final int analog_outputs = 2130903053;
- public static final int custom_dialog_title_bar = 2130903054;
- public static final int device_interface_module = 2130903055;
- public static final int device_name = 2130903056;
- public static final int digital_device = 2130903057;
- public static final int digital_devices = 2130903058;
- public static final int file_info = 2130903059;
- public static final int header = 2130903060;
- public static final int i2c_device = 2130903061;
- public static final int i2cs = 2130903062;
- public static final int info_button = 2130903063;
- public static final int legacy = 2130903064;
- public static final int matrices = 2130903065;
- public static final int matrix_devices = 2130903066;
- public static final int motors = 2130903067;
- public static final int orange_warning = 2130903068;
- public static final int pwm_device = 2130903069;
- public static final int pwms = 2130903070;
- public static final int servo = 2130903071;
- public static final int servos = 2130903072;
- public static final int shape = 2130903073;
- public static final int simple_device = 2130903074;
- }
-
- public static final class menu {
- public static final int ftc_driver_station = 2131427328;
- }
-
- public static final class string {
- public static final int about_activity = 2131361792;
- public static final int action_configuration = 2131361793;
- public static final int action_exit_app = 2131361794;
- public static final int action_restart_robot = 2131361795;
- public static final int action_settings = 2131361796;
- public static final int action_wifi_channel_selector = 2131361797;
- public static final int add_motor_controller_menu_item = 2131361798;
- public static final int add_servo_controller_menu_item = 2131361799;
- public static final int app_name = 2131361800;
- public static final int attached = 2131361801;
- public static final int autoconfigure = 2131361802;
- public static final int autoconfigureLaunch_text = 2131361803;
- public static final int autoconfigure_menu_item = 2131361804;
- public static final int cancel = 2131361805;
- public static final int choice_prompt = 2131361806;
- public static final int choice_prompt_analogInput = 2131361807;
- public static final int choice_prompt_analogOutput = 2131361808;
- public static final int choice_prompt_digital_device = 2131361809;
- public static final int choice_prompt_i2c = 2131361810;
- public static final int configure_activity = 2131361811;
- public static final int configure_menu_item = 2131361812;
- public static final int configure_settings = 2131361813;
- public static final int default_port = 2131361814;
- public static final int device_info = 2131361815;
- public static final int device_type = 2131361816;
- public static final int dialog_title_select_op_mode = 2131361817;
- public static final int done_button = 2131361818;
- public static final int edit_analog_input_devices_activity = 2131361819;
- public static final int edit_analog_output_devices_activity = 2131361820;
- public static final int edit_controller = 2131361821;
- public static final int edit_core_device_interface_module_controller_activity = 2131361822;
- public static final int edit_digital_devices_activity = 2131361823;
- public static final int edit_i2c_devices_activity = 2131361824;
- public static final int edit_legacy_module_controller_activity = 2131361825;
- public static final int edit_matrix_controller_activity = 2131361826;
- public static final int edit_motor_controller_activity = 2131361827;
- public static final int edit_motor_controller_menu_item = 2131361828;
- public static final int edit_pwm_devices_activity = 2131361829;
- public static final int edit_servo_controller_activity = 2131361830;
- public static final int file_activate_button = 2131361831;
- public static final int file_delete_button = 2131361832;
- public static final int file_edit_button = 2131361833;
- public static final int file_prompt = 2131361834;
- public static final int filename_editText = 2131361835;
- public static final int gamepad_android_standard = 2131361836;
- public static final int gamepad_default = 2131361837;
- public static final int gamepad_logitech_f310 = 2131361838;
- public static final int gamepad_microsoft_xbox_360 = 2131361839;
- public static final int input_name_hint = 2131361840;
- public static final int input_name_label = 2131361841;
- public static final int k9LegacyBot = 2131361842;
- public static final int k9USBBot = 2131361843;
- public static final int label_current_op_mode = 2131361844;
- public static final int label_loading_op_mode = 2131361845;
- public static final int label_queued_op_mode = 2131361846;
- public static final int label_select = 2131361847;
- public static final int label_start = 2131361848;
- public static final int label_start_timed = 2131361849;
- public static final int label_stop = 2131361850;
- public static final int launch_wifi_settings = 2131361851;
- public static final int legacy_controller_name = 2131361852;
- public static final int load_menu_item = 2131361853;
- public static final int matrix_controller_name = 2131361854;
- public static final int matrix_controller_name_prompt = 2131361855;
- public static final int matrix_motor_title = 2131361856;
- public static final int matrix_name_prompt = 2131361857;
- public static final int matrix_port0 = 2131361858;
- public static final int matrix_port1 = 2131361859;
- public static final int matrix_port2 = 2131361860;
- public static final int matrix_port3 = 2131361861;
- public static final int matrix_port4 = 2131361862;
- public static final int matrix_port5 = 2131361863;
- public static final int matrix_port6 = 2131361864;
- public static final int matrix_port7 = 2131361865;
- public static final int matrix_servo_title = 2131361866;
- public static final int motor_controller_name = 2131361867;
- public static final int motor_controller_name_text = 2131361868;
- public static final int motor_name = 2131361869;
- public static final int motor_name_prompt = 2131361870;
- public static final int motor_port1 = 2131361871;
- public static final int motor_port2 = 2131361872;
- public static final int name_prompt_text = 2131361873;
- public static final int name_prompt_undertext = 2131361874;
- public static final int pair_instructions = 2131361875;
- public static final int pair_wifi_direct = 2131361876;
- public static final int pair_wifi_direct_menu_item = 2131361877;
- public static final int ping_label = 2131361878;
- public static final int port = 2131361879;
- public static final int pref_change_wifi_channel = 2131361880;
- public static final int pref_configure_robot_title = 2131361881;
- public static final int pref_driver_station_mac = 2131361882;
- public static final int pref_driver_station_mac_default = 2131361883;
- public static final int pref_gamepad_title = 2131361884;
- public static final int pref_gamepad_user1_type_key = 2131361885;
- public static final int pref_gamepad_user1_type_title = 2131361886;
- public static final int pref_gamepad_user2_type_key = 2131361887;
- public static final int pref_gamepad_user2_type_title = 2131361888;
- public static final int pref_hardware_config_filename = 2131361889;
- public static final int pref_launch_autoconfigure = 2131361890;
- public static final int pref_launch_configure = 2131361891;
- public static final int pref_launch_settings = 2131361892;
- public static final int pref_log_network_traffic_key = 2131361893;
- public static final int pref_log_network_traffic_summary = 2131361894;
- public static final int pref_log_network_traffic_title = 2131361895;
- public static final int pref_logging_title = 2131361896;
- public static final int pref_pair_rc_summary = 2131361897;
- public static final int pref_pair_rc_title = 2131361898;
- public static final int pref_wifi_channel_selection_title = 2131361899;
- public static final int pref_wifi_config_title = 2131361900;
- public static final int readXML_text = 2131361901;
- public static final int restore_settings = 2131361902;
- public static final int row_port0 = 2131361903;
- public static final int row_port1 = 2131361904;
- public static final int row_port2 = 2131361905;
- public static final int row_port3 = 2131361906;
- public static final int row_port4 = 2131361907;
- public static final int row_port5 = 2131361908;
- public static final int row_port6 = 2131361909;
- public static final int save_button = 2131361910;
- public static final int save_configuration = 2131361911;
- public static final int scan = 2131361912;
- public static final int scanButton_text = 2131361913;
- public static final int servo_controller_name = 2131361914;
- public static final int servo_controller_name_prompt = 2131361915;
- public static final int servo_name_prompt = 2131361916;
- public static final int settings_activity = 2131361917;
- public static final int titleText_view = 2131361918;
- public static final int title_activity_autoconfigure = 2131361919;
- public static final int title_activity_config_wifi_direct = 2131361920;
- public static final int title_activity_load = 2131361921;
- public static final int title_activity_settings = 2131361922;
- public static final int title_activity_wifi_channel_selector = 2131361923;
- public static final int user1_label = 2131361924;
- public static final int user2_label = 2131361925;
- public static final int view_logs_activity = 2131361926;
- public static final int wifi_direct_device_none = 2131361927;
- public static final int wifi_direct_devices = 2131361928;
- public static final int wifi_direct_label = 2131361929;
- public static final int wifi_direct_update_settings = 2131361930;
- public static final int writeXML_prompt = 2131361931;
- public static final int writeXML_text = 2131361932;
- }
-
- public static final class style {
- public static final int AppBaseTheme = 2131165184;
- public static final int AppTheme = 2131165185;
- public static final int CustomAlertDialog = 2131165186;
- public static final int RobotoButtonStyle = 2131165187;
- public static final int RobotoTextViewStyle = 2131165188;
- public static final int Theme_CustomizedFullScreen = 2131165189;
- }
-
- public static final class xml {
- public static final int preferences = 2131034112;
- }
-}
diff --git a/FtcRobotController/app/src/main/java/com/qualcomm/ftcdriverstation/SettingsActivity.java b/FtcRobotController/app/src/main/java/com/qualcomm/ftcdriverstation/SettingsActivity.java
deleted file mode 100644
index 8df30a9..0000000
--- a/FtcRobotController/app/src/main/java/com/qualcomm/ftcdriverstation/SettingsActivity.java
+++ /dev/null
@@ -1,20 +0,0 @@
-package com.qualcomm.ftcdriverstation;
-
-import android.app.Activity;
-import android.os.Bundle;
-import android.preference.PreferenceFragment;
-
-public class SettingsActivity extends Activity {
- protected void onCreate(Bundle var1) {
- super.onCreate(var1);
- this.setContentView(2130903048);
- this.getFragmentManager().beginTransaction().replace(16908290, new SettingsActivity.SettingsFragment()).commit();
- }
-
- public static class SettingsFragment extends PreferenceFragment {
- public void onCreate(Bundle var1) {
- super.onCreate(var1);
- this.addPreferencesFromResource(2131034112);
- }
- }
-}
diff --git a/FtcRobotController/app/src/main/java/com/qualcomm/ftcrobotcontroller/BuildConfig.java b/FtcRobotController/app/src/main/java/com/qualcomm/ftcrobotcontroller/BuildConfig.java
deleted file mode 100644
index a2e5214..0000000
--- a/FtcRobotController/app/src/main/java/com/qualcomm/ftcrobotcontroller/BuildConfig.java
+++ /dev/null
@@ -1,10 +0,0 @@
-package com.qualcomm.ftcrobotcontroller;
-
-public final class BuildConfig {
- public static final String APPLICATION_ID = "com.qualcomm.ftcrobotcontroller";
- public static final String BUILD_TYPE = "release";
- public static final boolean DEBUG = false;
- public static final String FLAVOR = "";
- public static final int VERSION_CODE = 4;
- public static final String VERSION_NAME = "";
-}
diff --git a/FtcRobotController/app/src/main/java/com/qualcomm/ftcrobotcontroller/FtcRobotControllerActivity.java b/FtcRobotController/app/src/main/java/com/qualcomm/ftcrobotcontroller/FtcRobotControllerActivity.java
deleted file mode 100644
index b15a15e..0000000
--- a/FtcRobotController/app/src/main/java/com/qualcomm/ftcrobotcontroller/FtcRobotControllerActivity.java
+++ /dev/null
@@ -1,291 +0,0 @@
-package com.qualcomm.ftcrobotcontroller;
-
-import android.app.ActionBar;
-import android.app.Activity;
-import android.app.ActionBar.OnMenuVisibilityListener;
-import android.content.ComponentName;
-import android.content.Context;
-import android.content.Intent;
-import android.content.ServiceConnection;
-import android.content.SharedPreferences;
-import android.content.res.Configuration;
-import android.os.Bundle;
-import android.os.IBinder;
-import android.preference.PreferenceManager;
-import android.view.Menu;
-import android.view.MenuItem;
-import android.view.MotionEvent;
-import android.view.View;
-import android.view.View.OnClickListener;
-import android.view.View.OnTouchListener;
-import android.widget.ImageButton;
-import android.widget.LinearLayout;
-import android.widget.TextView;
-import android.widget.Toast;
-import com.qualcomm.ftccommon.DbgLog;
-import com.qualcomm.ftccommon.FtcEventLoop;
-import com.qualcomm.ftccommon.FtcRobotControllerService;
-import com.qualcomm.ftccommon.Restarter;
-import com.qualcomm.ftccommon.UpdateUI;
-import com.qualcomm.ftcrobotcontroller.opmodes.FtcOpModeRegister;
-import com.qualcomm.hardware.ModernRoboticsHardwareFactory;
-import com.qualcomm.robotcore.hardware.configuration.Utility;
-import com.qualcomm.robotcore.util.Dimmer;
-import com.qualcomm.robotcore.util.ImmersiveMode;
-import com.qualcomm.robotcore.util.RobotLog;
-import com.qualcomm.robotcore.wifi.WifiDirectAssistant;
-import java.io.FileInputStream;
-import java.io.FileNotFoundException;
-import java.io.Serializable;
-
-public class FtcRobotControllerActivity extends Activity {
- public static final String CONFIGURE_FILENAME = "CONFIGURE_FILENAME";
- private static final int NUM_GAMEPADS = 2;
- private static final int REQUEST_CONFIG_WIFI_CHANNEL = 1;
- private static final boolean USE_DEVICE_EMULATION;
- protected ImageButton buttonMenu;
- protected UpdateUI.Callback callback;
- protected ServiceConnection connection = new ServiceConnection() {
- public void onServiceConnected(ComponentName var1, IBinder var2) {
- FtcRobotControllerService.FtcRobotControllerBinder var3 = (FtcRobotControllerService.FtcRobotControllerBinder)var2;
- FtcRobotControllerActivity.this.onServiceBind(var3.getService());
- }
-
- public void onServiceDisconnected(ComponentName var1) {
- FtcRobotControllerActivity.this.controllerService = null;
- }
- };
- protected Context context;
- protected FtcRobotControllerService controllerService;
- protected Dimmer dimmer;
- protected LinearLayout entireScreenLayout;
- protected FtcEventLoop eventLoop;
- protected ImmersiveMode immersion;
- protected SharedPreferences preferences;
- protected TextView textDeviceName;
- protected TextView textErrorMessage;
- protected TextView[] textGamepad = new TextView[2];
- protected TextView textOpMode;
- protected TextView textRobotStatus;
- protected TextView textWifiDirectStatus;
- protected UpdateUI updateUI;
- private Utility utility;
-
- private FileInputStream fileSetup() {
- String var1 = Utility.CONFIG_FILES_DIR + this.utility.getFilenameFromPrefs(2131296333, "No current file!") + ".xml";
-
- FileInputStream var2;
- try {
- var2 = new FileInputStream(var1);
- } catch (FileNotFoundException var5) {
- String var4 = "Cannot open robot configuration file - " + var1;
- this.utility.complainToast(var4, this.context);
- DbgLog.msg(var4);
- this.utility.saveToPreferences("No current file!", 2131296333);
- var2 = null;
- }
-
- this.utility.updateHeader("No current file!", 2131296333, 2131427434, 2131427329);
- return var2;
- }
-
- private void requestRobotRestart() {
- this.requestRobotShutdown();
- this.requestRobotSetup();
- }
-
- private void requestRobotSetup() {
- if(this.controllerService != null) {
- FileInputStream var1 = this.fileSetup();
- if(var1 != null) {
- ModernRoboticsHardwareFactory var2 = new ModernRoboticsHardwareFactory(this.context);
- var2.setXmlInputStream(var1);
- this.eventLoop = new FtcEventLoop(var2, new FtcOpModeRegister(), this.callback, this);
- this.controllerService.setCallback(this.callback);
- this.controllerService.setupRobot(this.eventLoop);
- return;
- }
- }
-
- }
-
- private void requestRobotShutdown() {
- if(this.controllerService != null) {
- this.controllerService.shutdownRobot();
- }
- }
-
- protected void hittingMenuButtonBrightensScreen() {
- ActionBar var1 = this.getActionBar();
- if(var1 != null) {
- var1.addOnMenuVisibilityListener(new OnMenuVisibilityListener() {
- public void onMenuVisibilityChanged(boolean var1) {
- if(var1) {
- FtcRobotControllerActivity.this.dimmer.handleDimTimer();
- }
-
- }
- });
- }
-
- }
-
- protected void onActivityResult(int var1, int var2, Intent var3) {
- if(var1 == 1 && var2 == -1) {
- Toast var5 = Toast.makeText(this.context, "Configuration Complete", 1);
- var5.setGravity(17, 0, 0);
- this.showToast(var5);
- }
-
- if(var1 == 3 && var2 == -1) {
- Serializable var4 = var3.getSerializableExtra("CONFIGURE_FILENAME");
- if(var4 != null) {
- this.utility.saveToPreferences(var4.toString(), 2131296333);
- this.utility.updateHeader("No current file!", 2131296333, 2131427434, 2131427329);
- }
- }
-
- }
-
- public void onConfigurationChanged(Configuration var1) {
- super.onConfigurationChanged(var1);
- }
-
- protected void onCreate(Bundle var1) {
- super.onCreate(var1);
- this.setContentView(2130903044);
- this.utility = new Utility(this);
- this.context = this;
- this.entireScreenLayout = (LinearLayout)this.findViewById(2131427348);
- this.buttonMenu = (ImageButton)this.findViewById(2131427352);
- this.buttonMenu.setOnClickListener(new OnClickListener() {
- public void onClick(View var1) {
- FtcRobotControllerActivity.this.openOptionsMenu();
- }
- });
- this.textDeviceName = (TextView)this.findViewById(2131427351);
- this.textWifiDirectStatus = (TextView)this.findViewById(2131427354);
- this.textRobotStatus = (TextView)this.findViewById(2131427355);
- this.textOpMode = (TextView)this.findViewById(2131427356);
- this.textErrorMessage = (TextView)this.findViewById(2131427357);
- this.textGamepad[0] = (TextView)this.findViewById(2131427358);
- this.textGamepad[1] = (TextView)this.findViewById(2131427359);
- this.immersion = new ImmersiveMode(this.getWindow().getDecorView());
- this.dimmer = new Dimmer(this);
- this.dimmer.longBright();
- FtcRobotControllerActivity.RobotRestarter var2 = new FtcRobotControllerActivity.RobotRestarter();
- this.updateUI = new UpdateUI(this, this.dimmer);
- this.updateUI.setRestarter(var2);
- this.updateUI.setTextViews(this.textWifiDirectStatus, this.textRobotStatus, this.textGamepad, this.textOpMode, this.textErrorMessage, this.textDeviceName);
- UpdateUI var3 = this.updateUI;
- this.callback = var3.new Callback();
- PreferenceManager.setDefaultValues(this, 2130968577, false);
- this.preferences = PreferenceManager.getDefaultSharedPreferences(this);
- this.hittingMenuButtonBrightensScreen();
- }
-
- public boolean onCreateOptionsMenu(Menu var1) {
- this.getMenuInflater().inflate(2131361792, var1);
- return true;
- }
-
- protected void onNewIntent(Intent var1) {
- super.onNewIntent(var1);
- if("android.hardware.usb.action.USB_ACCESSORY_ATTACHED".equals(var1.getAction())) {
- DbgLog.msg("USB Device attached; app restart may be needed");
- }
-
- }
-
- public boolean onOptionsItemSelected(MenuItem var1) {
- switch(var1.getItemId()) {
- case 2131427528:
- this.startActivityForResult(new Intent("com.qualcomm.ftccommon.FtcRobotControllerSettingsActivity.intent.action.Launch"), 3);
- return true;
- case 2131427529:
- this.dimmer.handleDimTimer();
- Toast.makeText(this.context, "Restarting Robot", 0).show();
- this.requestRobotRestart();
- return true;
- case 2131427530:
- Intent var2 = new Intent("com.qualcomm.ftccommon.ViewLogsActivity.intent.action.Launch");
- var2.putExtra("Filename", RobotLog.getLogFilename(this));
- this.startActivity(var2);
- return true;
- case 2131427531:
- this.startActivity(new Intent("com.qualcomm.ftccommon.configuration.AboutActivity.intent.action.Launch"));
- return true;
- case 2131427532:
- this.finish();
- return true;
- default:
- return super.onOptionsItemSelected(var1);
- }
- }
-
- public void onPause() {
- super.onPause();
- }
-
- protected void onResume() {
- super.onResume();
- }
-
- public void onServiceBind(FtcRobotControllerService var1) {
- DbgLog.msg("Bound to Ftc Controller Service");
- this.controllerService = var1;
- this.updateUI.setControllerService(this.controllerService);
- this.callback.wifiDirectUpdate(this.controllerService.getWifiDirectStatus());
- this.callback.robotUpdate(this.controllerService.getRobotStatus());
- this.requestRobotSetup();
- }
-
- protected void onStart() {
- super.onStart();
- RobotLog.writeLogcatToDisk(this, 4096);
- this.bindService(new Intent(this, FtcRobotControllerService.class), this.connection, 1);
- this.utility.updateHeader("No current file!", 2131296333, 2131427434, 2131427329);
- this.callback.wifiDirectUpdate(WifiDirectAssistant.Event.DISCONNECTED);
- this.entireScreenLayout.setOnTouchListener(new OnTouchListener() {
- public boolean onTouch(View var1, MotionEvent var2) {
- FtcRobotControllerActivity.this.dimmer.handleDimTimer();
- return false;
- }
- });
- }
-
- protected void onStop() {
- super.onStop();
- if(this.controllerService != null) {
- this.unbindService(this.connection);
- }
-
- RobotLog.cancelWriteLogcatToDisk(this);
- }
-
- public void onWindowFocusChanged(boolean var1) {
- super.onWindowFocusChanged(var1);
- if(var1) {
- if(ImmersiveMode.apiOver19()) {
- this.immersion.hideSystemUI();
- }
-
- } else {
- this.immersion.cancelSystemUIHide();
- }
- }
-
- public void showToast(final Toast var1) {
- this.runOnUiThread(new Runnable() {
- public void run() {
- var1.show();
- }
- });
- }
-
- protected class RobotRestarter implements Restarter {
- public void requestRestart() {
- FtcRobotControllerActivity.this.requestRobotRestart();
- }
- }
-}
diff --git a/FtcRobotController/app/src/main/java/com/qualcomm/ftcrobotcontroller/R.java b/FtcRobotController/app/src/main/java/com/qualcomm/ftcrobotcontroller/R.java
deleted file mode 100644
index 27f6c23..0000000
--- a/FtcRobotController/app/src/main/java/com/qualcomm/ftcrobotcontroller/R.java
+++ /dev/null
@@ -1,423 +0,0 @@
-package com.qualcomm.ftcrobotcontroller;
-
-public final class R {
- public static final class array {
- public static final int choice_array = 2131165184;
- public static final int choice_array_analogInput = 2131165185;
- public static final int choice_array_analogOutput = 2131165186;
- public static final int choice_array_digital_device = 2131165187;
- public static final int choice_array_i2c = 2131165188;
- public static final int device_interface_module_options_array = 2131165189;
- public static final int wifi_direct_channels = 2131165190;
- }
-
- public static final class attr {
- }
-
- public static final class color {
- public static final int black = 2131230720;
- public static final int bright_qcom_blue = 2131230721;
- public static final int bright_red = 2131230722;
- public static final int bright_red_text = 2131230723;
- public static final int dark_red_background = 2131230724;
- public static final int light_qcom_blue = 2131230725;
- public static final int light_red_background = 2131230726;
- public static final int medium_red_background = 2131230727;
- public static final int transparent_color = 2131230728;
- public static final int very_bright_red = 2131230729;
- public static final int white = 2131230730;
- }
-
- public static final class dimen {
- public static final int activity_horizontal_margin = 2131034112;
- public static final int activity_vertical_margin = 2131034113;
- }
-
- public static final class drawable {
- public static final int button_shape = 2130837504;
- public static final int ic_launcher = 2130837505;
- public static final int icon_battery0 = 2130837506;
- public static final int icon_battery100 = 2130837507;
- public static final int icon_battery25 = 2130837508;
- public static final int icon_battery50 = 2130837509;
- public static final int icon_battery75 = 2130837510;
- public static final int icon_menu = 2130837511;
- public static final int icon_robotcontroller = 2130837512;
- }
-
- public static final class id {
- public static final int RelativeLayout = 2131427353;
- public static final int aboutList = 2131427328;
- public static final int action_about = 2131427531;
- public static final int action_exit_app = 2131427532;
- public static final int action_restart_robot = 2131427529;
- public static final int action_settings = 2131427528;
- public static final int action_view_logs = 2131427530;
- public static final int active_filename = 2131427434;
- public static final int activity_fix_misconfig_wifi_direct = 2131427333;
- public static final int analogOutput_devices_cancelButton = 2131427398;
- public static final int analogOutput_devices_saveButton = 2131427397;
- public static final int analog_input_devices_cancelButton = 2131427379;
- public static final int analog_input_devices_saveButton = 2131427378;
- public static final int attached_title = 2131427383;
- public static final int autoconfigure = 2131427370;
- public static final int autoconfigure_holder = 2131427369;
- public static final int autoconfigure_info = 2131427332;
- public static final int buttonConfigure = 2131427361;
- public static final int buttonWifiSettings = 2131427362;
- public static final int checkbox_port6 = 2131427493;
- public static final int checkbox_port7 = 2131427490;
- public static final int checkbox_port_matrix = 2131427482;
- public static final int checkbox_port_pwm = 2131427501;
- public static final int checkbox_port_servo = 2131427508;
- public static final int choiceSpinner_analogInput = 2131427375;
- public static final int choiceSpinner_analogOutput = 2131427394;
- public static final int choiceSpinner_digital_device = 2131427409;
- public static final int choiceSpinner_i2c = 2131427437;
- public static final int choiceSpinner_legacyModule = 2131427524;
- public static final int configureLegacy = 2131427331;
- public static final int configureUSB = 2131427330;
- public static final int controller_name = 2131427487;
- public static final int controller_name_text = 2131427451;
- public static final int controllers = 2131427431;
- public static final int controllersList = 2131427342;
- public static final int device_interface_module_cancelButton = 2131427403;
- public static final int device_interface_module_name = 2131427404;
- public static final int device_interface_module_saveButton = 2131427402;
- public static final int device_interface_module_serialNumber = 2131427405;
- public static final int devices_holder = 2131427340;
- public static final int devices_info_btn = 2131427341;
- public static final int digital_devices_cancelButton = 2131427413;
- public static final int digital_devices_saveButton = 2131427412;
- public static final int dropdown_layout = 2131427523;
- public static final int editTextResult_analogInput = 2131427376;
- public static final int editTextResult_analogInput6 = 2131427494;
- public static final int editTextResult_analogInput7 = 2131427491;
- public static final int editTextResult_analogOutput = 2131427395;
- public static final int editTextResult_digital_device = 2131427410;
- public static final int editTextResult_i2c = 2131427438;
- public static final int editTextResult_matrix = 2131427483;
- public static final int editTextResult_name = 2131427525;
- public static final int editTextResult_pwm = 2131427502;
- public static final int editTextResult_servo = 2131427509;
- public static final int edit_controller_btn = 2131427526;
- public static final int empty_devicelist = 2131427343;
- public static final int empty_filelist = 2131427368;
- public static final int entire_screen = 2131427348;
- public static final int file_activate_button = 2131427429;
- public static final int file_buttons = 2131427424;
- public static final int file_delete_button = 2131427430;
- public static final int file_edit_button = 2131427428;
- public static final int file_info_layout = 2131427423;
- public static final int filename_editText = 2131427426;
- public static final int files_holder = 2131427366;
- public static final int header = 2131427432;
- public static final int holdsDevices = 2131427335;
- public static final int holds_buttons = 2131427364;
- public static final int horizontalButtons = 2131427427;
- public static final int i2c_devices_cancelButton = 2131427441;
- public static final int i2c_devices_saveButton = 2131427440;
- public static final int included_header = 2131427329;
- public static final int inclusionlayout = 2131427367;
- public static final int info_btn = 2131427449;
- public static final int legacy_serialNumber = 2131427450;
- public static final int linearLayout = 2131427425;
- public static final int linearLayout0 = 2131427455;
- public static final int linearLayout1 = 2131427458;
- public static final int linearLayout2 = 2131427459;
- public static final int linearLayout3 = 2131427462;
- public static final int linearLayout4 = 2131427465;
- public static final int linearLayout5 = 2131427466;
- public static final int linearLayout_analogInput0 = 2131427391;
- public static final int linearLayout_analogInput1 = 2131427390;
- public static final int linearLayout_analogInput2 = 2131427389;
- public static final int linearLayout_analogInput3 = 2131427388;
- public static final int linearLayout_analogInput4 = 2131427387;
- public static final int linearLayout_analogInput5 = 2131427386;
- public static final int linearLayout_analogInput6 = 2131427385;
- public static final int linearLayout_analogInput7 = 2131427384;
- public static final int linearLayout_analogOutput0 = 2131427401;
- public static final int linearLayout_analogOutput1 = 2131427400;
- public static final int linearLayout_digital_device0 = 2131427422;
- public static final int linearLayout_digital_device1 = 2131427421;
- public static final int linearLayout_digital_device2 = 2131427420;
- public static final int linearLayout_digital_device3 = 2131427419;
- public static final int linearLayout_digital_device4 = 2131427418;
- public static final int linearLayout_digital_device5 = 2131427417;
- public static final int linearLayout_digital_device6 = 2131427416;
- public static final int linearLayout_digital_device7 = 2131427415;
- public static final int linearLayout_i2c0 = 2131427448;
- public static final int linearLayout_i2c1 = 2131427447;
- public static final int linearLayout_i2c2 = 2131427446;
- public static final int linearLayout_i2c3 = 2131427445;
- public static final int linearLayout_i2c4 = 2131427444;
- public static final int linearLayout_i2c5 = 2131427443;
- public static final int linearLayout_matrix1 = 2131427471;
- public static final int linearLayout_matrix2 = 2131427472;
- public static final int linearLayout_matrix3 = 2131427473;
- public static final int linearLayout_matrix4 = 2131427474;
- public static final int linearLayout_matrix5 = 2131427476;
- public static final int linearLayout_matrix6 = 2131427477;
- public static final int linearLayout_matrix7 = 2131427478;
- public static final int linearLayout_matrix8 = 2131427479;
- public static final int linearLayout_pwm0 = 2131427505;
- public static final int linearLayout_pwm1 = 2131427504;
- public static final int linearLayout_servo1 = 2131427515;
- public static final int linearLayout_servo2 = 2131427516;
- public static final int linearLayout_servo3 = 2131427517;
- public static final int linearLayout_servo4 = 2131427518;
- public static final int linearLayout_servo5 = 2131427519;
- public static final int linearLayout_servo6 = 2131427520;
- public static final int listView_devices = 2131427406;
- public static final int load_bottom = 2131427363;
- public static final int matrix_controller_cancelButton = 2131427468;
- public static final int matrix_controller_saveButton = 2131427467;
- public static final int matrixcontroller_name = 2131427469;
- public static final int menu_buttons = 2131427352;
- public static final int motor_controller_serialNumber = 2131427488;
- public static final int motors_title = 2131427475;
- public static final int new_button = 2131427365;
- public static final int orange_warning = 2131427496;
- public static final int orangetext0 = 2131427497;
- public static final int orangetext1 = 2131427498;
- public static final int port3 = 2131427461;
- public static final int port4 = 2131427464;
- public static final int port5 = 2131427454;
- public static final int port7 = 2131427457;
- public static final int portNumber = 2131427522;
- public static final int port_number_analogInput = 2131427374;
- public static final int port_number_analogOutput = 2131427393;
- public static final int port_number_digital_device = 2131427408;
- public static final int port_number_i2c = 2131427436;
- public static final int port_number_matrix = 2131427481;
- public static final int port_number_pwm = 2131427500;
- public static final int port_number_servo = 2131427507;
- public static final int port_title = 2131427382;
- public static final int pwm_devices_cancelButton = 2131427486;
- public static final int pwm_devices_saveButton = 2131427485;
- public static final int robotIcon = 2131427350;
- public static final int row_port = 2131427489;
- public static final int row_port1 = 2131427456;
- public static final int row_port3 = 2131427460;
- public static final int row_port4 = 2131427463;
- public static final int row_port5 = 2131427453;
- public static final int row_port_analogInput = 2131427373;
- public static final int row_port_analogOutput = 2131427392;
- public static final int row_port_digital_device = 2131427407;
- public static final int row_port_i2c = 2131427435;
- public static final int row_port_matrix = 2131427480;
- public static final int row_port_pwm = 2131427499;
- public static final int row_port_servo = 2131427506;
- public static final int save_config_btn = 2131427346;
- public static final int save_holder = 2131427344;
- public static final int scanButton = 2131427337;
- public static final int scanButton_text = 2131427338;
- public static final int scan_bottom = 2131427336;
- public static final int scrollView = 2131427371;
- public static final int servo_controller_cancelButton = 2131427512;
- public static final int servo_controller_saveButton = 2131427511;
- public static final int servo_controller_serialNumber = 2131427514;
- public static final int servocontroller_name = 2131427513;
- public static final int servos_title = 2131427470;
- public static final int shape = 2131427521;
- public static final int spinnerChannelSelect = 2131427360;
- public static final int spinner_item = 2131427527;
- public static final int tableLayout_analogOutput_devices = 2131427399;
- public static final int tableLayout_analog_input_devices = 2131427380;
- public static final int tableLayout_digital_devices = 2131427414;
- public static final int tableLayout_i2c_devices = 2131427442;
- public static final int tableLayout_pwm_devices = 2131427452;
- public static final int table_header = 2131427381;
- public static final int textAdbLogs = 2131427372;
- public static final int textDeviceName = 2131427351;
- public static final int textErrorMessage = 2131427357;
- public static final int textGamepad1 = 2131427358;
- public static final int textGamepad2 = 2131427359;
- public static final int textOpMode = 2131427356;
- public static final int textRobotStatus = 2131427355;
- public static final int textView = 2131427334;
- public static final int textView1 = 2131427433;
- public static final int textWifiDirectStatus = 2131427354;
- public static final int titleTextView_analogInput = 2131427377;
- public static final int titleTextView_analogInput7 = 2131427492;
- public static final int titleTextView_analogOutput = 2131427396;
- public static final int titleTextView_digital_device = 2131427411;
- public static final int titleTextView_i2c = 2131427439;
- public static final int titleTextView_matrix = 2131427484;
- public static final int titleTextView_motor2 = 2131427495;
- public static final int titleTextView_pwm = 2131427503;
- public static final int titleTextView_servo = 2131427510;
- public static final int top_bar = 2131427349;
- public static final int warning_layout = 2131427339;
- public static final int writeXML = 2131427345;
- public static final int writeXML_text = 2131427347;
- }
-
- public static final class layout {
- public static final int activity_about = 2130903040;
- public static final int activity_autoconfigure = 2130903041;
- public static final int activity_config_wifi_direct = 2130903042;
- public static final int activity_ftc_configuration = 2130903043;
- public static final int activity_ftc_controller = 2130903044;
- public static final int activity_ftc_wifi_channel_selector = 2130903045;
- public static final int activity_load = 2130903046;
- public static final int activity_view_logs = 2130903047;
- public static final int analog_input_device = 2130903048;
- public static final int analog_inputs = 2130903049;
- public static final int analog_output_device = 2130903050;
- public static final int analog_outputs = 2130903051;
- public static final int device_interface_module = 2130903052;
- public static final int digital_device = 2130903053;
- public static final int digital_devices = 2130903054;
- public static final int file_info = 2130903055;
- public static final int header = 2130903056;
- public static final int i2c_device = 2130903057;
- public static final int i2cs = 2130903058;
- public static final int info_button = 2130903059;
- public static final int legacy = 2130903060;
- public static final int matrices = 2130903061;
- public static final int matrix_devices = 2130903062;
- public static final int motors = 2130903063;
- public static final int orange_warning = 2130903064;
- public static final int pwm_device = 2130903065;
- public static final int pwms = 2130903066;
- public static final int servo = 2130903067;
- public static final int servos = 2130903068;
- public static final int shape = 2130903069;
- public static final int simple_device = 2130903070;
- public static final int spinner_textview = 2130903071;
- }
-
- public static final class menu {
- public static final int ftc_robot_controller = 2131361792;
- public static final int menu_load = 2131361793;
- }
-
- public static final class string {
- public static final int about_activity = 2131296256;
- public static final int about_menu_item = 2131296257;
- public static final int action_configuration = 2131296258;
- public static final int action_exit_app = 2131296259;
- public static final int action_settings = 2131296260;
- public static final int action_view_logs = 2131296261;
- public static final int action_wifi_channel_selector = 2131296262;
- public static final int add_motor_controller_menu_item = 2131296263;
- public static final int add_servo_controller_menu_item = 2131296264;
- public static final int app_name = 2131296265;
- public static final int attached = 2131296266;
- public static final int autoconfigure = 2131296267;
- public static final int autoconfigureLaunch_text = 2131296268;
- public static final int autoconfigure_menu_item = 2131296269;
- public static final int button_text_clear_logs = 2131296270;
- public static final int cancel = 2131296271;
- public static final int choice_prompt = 2131296272;
- public static final int choice_prompt_analogInput = 2131296273;
- public static final int choice_prompt_analogOutput = 2131296274;
- public static final int choice_prompt_digital_device = 2131296275;
- public static final int choice_prompt_i2c = 2131296276;
- public static final int configure_activity = 2131296277;
- public static final int configure_menu_item = 2131296278;
- public static final int configure_settings = 2131296279;
- public static final int default_port = 2131296280;
- public static final int device_info = 2131296281;
- public static final int device_type = 2131296282;
- public static final int done_button = 2131296283;
- public static final int edit_analog_input_devices_activity = 2131296284;
- public static final int edit_analog_output_devices_activity = 2131296285;
- public static final int edit_controller = 2131296286;
- public static final int edit_core_device_interface_module_controller_activity = 2131296287;
- public static final int edit_digital_devices_activity = 2131296288;
- public static final int edit_i2c_devices_activity = 2131296289;
- public static final int edit_legacy_module_controller_activity = 2131296290;
- public static final int edit_matrix_controller_activity = 2131296291;
- public static final int edit_motor_controller_activity = 2131296292;
- public static final int edit_motor_controller_menu_item = 2131296293;
- public static final int edit_pwm_devices_activity = 2131296294;
- public static final int edit_servo_controller_activity = 2131296295;
- public static final int file_activate_button = 2131296296;
- public static final int file_delete_button = 2131296297;
- public static final int file_edit_button = 2131296298;
- public static final int file_prompt = 2131296299;
- public static final int filename_editText = 2131296300;
- public static final int input_name_hint = 2131296301;
- public static final int input_name_label = 2131296302;
- public static final int k9LegacyBot = 2131296303;
- public static final int k9USBBot = 2131296304;
- public static final int launch_wifi_settings = 2131296305;
- public static final int legacy_controller_name = 2131296306;
- public static final int load_menu_item = 2131296307;
- public static final int matrix_controller_name = 2131296308;
- public static final int matrix_controller_name_prompt = 2131296309;
- public static final int matrix_motor_title = 2131296310;
- public static final int matrix_name_prompt = 2131296311;
- public static final int matrix_port0 = 2131296312;
- public static final int matrix_port1 = 2131296313;
- public static final int matrix_port2 = 2131296314;
- public static final int matrix_port3 = 2131296315;
- public static final int matrix_port4 = 2131296316;
- public static final int matrix_port5 = 2131296317;
- public static final int matrix_port6 = 2131296318;
- public static final int matrix_port7 = 2131296319;
- public static final int matrix_servo_title = 2131296320;
- public static final int motor_controller_name = 2131296321;
- public static final int motor_controller_name_text = 2131296322;
- public static final int motor_name = 2131296323;
- public static final int motor_name_prompt = 2131296324;
- public static final int motor_port1 = 2131296325;
- public static final int motor_port2 = 2131296326;
- public static final int name_prompt_text = 2131296327;
- public static final int name_prompt_undertext = 2131296328;
- public static final int ok = 2131296329;
- public static final int port = 2131296330;
- public static final int pref_change_wifi_channel = 2131296331;
- public static final int pref_configure_robot_title = 2131296332;
- public static final int pref_hardware_config_filename = 2131296333;
- public static final int pref_launch_autoconfigure = 2131296334;
- public static final int pref_launch_configure = 2131296335;
- public static final int pref_launch_settings = 2131296336;
- public static final int pref_wifi_channel_selection_title = 2131296337;
- public static final int readXML_text = 2131296338;
- public static final int restart_robot_menu_item = 2131296339;
- public static final int restore_settings = 2131296340;
- public static final int row_port0 = 2131296341;
- public static final int row_port1 = 2131296342;
- public static final int row_port2 = 2131296343;
- public static final int row_port3 = 2131296344;
- public static final int row_port4 = 2131296345;
- public static final int row_port5 = 2131296346;
- public static final int row_port6 = 2131296347;
- public static final int save_button = 2131296348;
- public static final int save_configuration = 2131296349;
- public static final int scan = 2131296350;
- public static final int scanButton_text = 2131296351;
- public static final int servo_controller_name = 2131296352;
- public static final int servo_controller_name_prompt = 2131296353;
- public static final int servo_name_prompt = 2131296354;
- public static final int settings_activity = 2131296355;
- public static final int settings_menu_item = 2131296356;
- public static final int titleText_view = 2131296357;
- public static final int title_activity_autoconfigure = 2131296358;
- public static final int title_activity_config_wifi_direct = 2131296359;
- public static final int title_activity_load = 2131296360;
- public static final int title_activity_view_logs = 2131296361;
- public static final int title_activity_wifi_channel_selector = 2131296362;
- public static final int view_logs_activity = 2131296363;
- public static final int view_logs_menu_item = 2131296364;
- public static final int wifi_direct_update_settings = 2131296365;
- public static final int writeXML_prompt = 2131296366;
- public static final int writeXML_text = 2131296367;
- }
-
- public static final class style {
- public static final int AppBaseTheme = 2131099648;
- public static final int AppTheme = 2131099649;
- public static final int CustomAlertDialog = 2131099650;
- public static final int RobotoButtonStyle = 2131099651;
- public static final int RobotoTextViewStyle = 2131099652;
- }
-
- public static final class xml {
- public static final int device_filter = 2130968576;
- public static final int preferences = 2130968577;
- }
-}
diff --git a/FtcRobotController/app/src/main/java/com/qualcomm/ftcrobotcontroller/opmodes/AdafruitRGBExample.java b/FtcRobotController/app/src/main/java/com/qualcomm/ftcrobotcontroller/opmodes/AdafruitRGBExample.java
deleted file mode 100644
index e1893bc..0000000
--- a/FtcRobotController/app/src/main/java/com/qualcomm/ftcrobotcontroller/opmodes/AdafruitRGBExample.java
+++ /dev/null
@@ -1,62 +0,0 @@
-package com.qualcomm.ftcrobotcontroller.opmodes;
-
-import android.app.Activity;
-import android.graphics.Color;
-import android.view.View;
-import com.qualcomm.ftccommon.DbgLog;
-import com.qualcomm.robotcore.eventloop.opmode.LinearOpMode;
-import com.qualcomm.robotcore.hardware.ColorSensor;
-import com.qualcomm.robotcore.hardware.DeviceInterfaceModule;
-import com.qualcomm.robotcore.hardware.DigitalChannelController;
-
-public class AdafruitRGBExample extends LinearOpMode {
- static final int LED_CHANNEL = 5;
- DeviceInterfaceModule cdim;
- ColorSensor sensorRGB;
-
- public void runOpMode() throws InterruptedException {
- this.hardwareMap.logDevices();
- this.cdim = (DeviceInterfaceModule)this.hardwareMap.deviceInterfaceModule.get("dim");
- this.cdim.setDigitalChannelMode(5, DigitalChannelController.Mode.OUTPUT);
- this.sensorRGB = (ColorSensor)this.hardwareMap.colorSensor.get("color");
- this.cdim.setDigitalChannelState(5, true);
- this.waitOneFullHardwareCycle();
- this.waitForStart();
- final float[] var1 = new float[]{0.0F, 0.0F, 0.0F};
- final View var2 = ((Activity)this.hardwareMap.appContext).findViewById(2131427353);
- boolean var3 = false;
-
- while(this.opModeIsActive()) {
- boolean var4;
- if(!this.gamepad1.x && !this.gamepad2.x) {
- var4 = false;
- } else {
- var4 = true;
- }
-
- if(var4 && var4 != var3) {
- DbgLog.msg("MY_DEBUG - x button was pressed!");
- var3 = var4;
- this.cdim.setDigitalChannelState(5, true);
- } else if(!var4 && var4 != var3) {
- DbgLog.msg("MY_DEBUG - x button was released!");
- var3 = var4;
- this.cdim.setDigitalChannelState(5, false);
- }
-
- Color.RGBToHSV(255 * this.sensorRGB.red() / 800, 255 * this.sensorRGB.green() / 800, 255 * this.sensorRGB.blue() / 800, var1);
- this.telemetry.addData("Clear", (float)this.sensorRGB.alpha());
- this.telemetry.addData("Red ", (float)this.sensorRGB.red());
- this.telemetry.addData("Green", (float)this.sensorRGB.green());
- this.telemetry.addData("Blue ", (float)this.sensorRGB.blue());
- this.telemetry.addData("Hue", var1[0]);
- var2.post(new Runnable() {
- public void run() {
- var2.setBackgroundColor(Color.HSVToColor(255, var1));
- }
- });
- this.waitOneFullHardwareCycle();
- }
-
- }
-}
diff --git a/FtcRobotController/app/src/main/java/com/qualcomm/ftcrobotcontroller/opmodes/ColorSensorDriver.java b/FtcRobotController/app/src/main/java/com/qualcomm/ftcrobotcontroller/opmodes/ColorSensorDriver.java
deleted file mode 100644
index 31e0819..0000000
--- a/FtcRobotController/app/src/main/java/com/qualcomm/ftcrobotcontroller/opmodes/ColorSensorDriver.java
+++ /dev/null
@@ -1,95 +0,0 @@
-package com.qualcomm.ftcrobotcontroller.opmodes;
-
-import android.app.Activity;
-import android.graphics.Color;
-import android.view.View;
-import com.qualcomm.robotcore.eventloop.opmode.LinearOpMode;
-import com.qualcomm.robotcore.hardware.ColorSensor;
-import com.qualcomm.robotcore.hardware.DeviceInterfaceModule;
-import com.qualcomm.robotcore.hardware.LED;
-import com.qualcomm.robotcore.hardware.TouchSensor;
-
-public class ColorSensorDriver extends LinearOpMode {
- DeviceInterfaceModule cdim;
- ColorSensor colorSensor;
- public ColorSensorDriver.ColorSensorDevice device;
- LED led;
- TouchSensor t;
-
- public ColorSensorDriver() {
- this.device = ColorSensorDriver.ColorSensorDevice.MODERN_ROBOTICS_I2C;
- }
-
- private void enableLed(boolean var1) {
- switch(null.$SwitchMap$com$qualcomm$ftcrobotcontroller$opmodes$ColorSensorDriver$ColorSensorDevice[this.device.ordinal()]) {
- case 1:
- this.colorSensor.enableLed(var1);
- return;
- case 2:
- this.led.enable(var1);
- return;
- case 3:
- this.colorSensor.enableLed(var1);
- return;
- default:
- }
- }
-
- public void runOpMode() throws InterruptedException {
- this.hardwareMap.logDevices();
- this.cdim = (DeviceInterfaceModule)this.hardwareMap.deviceInterfaceModule.get("dim");
- switch(null.$SwitchMap$com$qualcomm$ftcrobotcontroller$opmodes$ColorSensorDriver$ColorSensorDevice[this.device.ordinal()]) {
- case 1:
- this.colorSensor = (ColorSensor)this.hardwareMap.colorSensor.get("nxt");
- break;
- case 2:
- this.colorSensor = (ColorSensor)this.hardwareMap.colorSensor.get("lady");
- break;
- case 3:
- this.colorSensor = (ColorSensor)this.hardwareMap.colorSensor.get("mr");
- }
-
- this.led = (LED)this.hardwareMap.led.get("led");
- this.t = (TouchSensor)this.hardwareMap.touchSensor.get("t");
- this.waitForStart();
- final float[] var1 = new float[]{0.0F, 0.0F, 0.0F};
- final View var2 = ((Activity)this.hardwareMap.appContext).findViewById(2131427353);
-
- while(this.opModeIsActive()) {
- this.enableLed(this.t.isPressed());
- switch(null.$SwitchMap$com$qualcomm$ftcrobotcontroller$opmodes$ColorSensorDriver$ColorSensorDevice[this.device.ordinal()]) {
- case 1:
- Color.RGBToHSV(this.colorSensor.red(), this.colorSensor.green(), this.colorSensor.blue(), var1);
- break;
- case 2:
- Color.RGBToHSV(255 * this.colorSensor.red() / 800, 255 * this.colorSensor.green() / 800, 255 * this.colorSensor.blue() / 800, var1);
- break;
- case 3:
- Color.RGBToHSV(8 * this.colorSensor.red(), 8 * this.colorSensor.green(), 8 * this.colorSensor.blue(), var1);
- }
-
- this.telemetry.addData("Clear", (float)this.colorSensor.alpha());
- this.telemetry.addData("Red ", (float)this.colorSensor.red());
- this.telemetry.addData("Green", (float)this.colorSensor.green());
- this.telemetry.addData("Blue ", (float)this.colorSensor.blue());
- this.telemetry.addData("Hue", var1[0]);
- var2.post(new Runnable() {
- public void run() {
- var2.setBackgroundColor(Color.HSVToColor(255, var1));
- }
- });
- this.waitOneFullHardwareCycle();
- }
-
- }
-
- public static enum ColorSensorDevice {
- ADAFRUIT,
- HITECHNIC_NXT,
- MODERN_ROBOTICS_I2C;
-
- static {
- ColorSensorDriver.ColorSensorDevice[] var0 = new ColorSensorDriver.ColorSensorDevice[]{ADAFRUIT, HITECHNIC_NXT, MODERN_ROBOTICS_I2C};
- }
- }
-}
diff --git a/FtcRobotController/app/src/main/java/com/qualcomm/ftcrobotcontroller/opmodes/CompassCalibration.java b/FtcRobotController/app/src/main/java/com/qualcomm/ftcrobotcontroller/opmodes/CompassCalibration.java
deleted file mode 100644
index 711b81f..0000000
--- a/FtcRobotController/app/src/main/java/com/qualcomm/ftcrobotcontroller/opmodes/CompassCalibration.java
+++ /dev/null
@@ -1,72 +0,0 @@
-package com.qualcomm.ftcrobotcontroller.opmodes;
-
-import com.qualcomm.ftccommon.DbgLog;
-import com.qualcomm.robotcore.eventloop.opmode.OpMode;
-import com.qualcomm.robotcore.hardware.CompassSensor;
-import com.qualcomm.robotcore.hardware.DcMotor;
-
-public class CompassCalibration extends OpMode {
- static final double HOLD_POSITION = 3.0D;
- static final double MOTOR_POWER = 0.2D;
- CompassSensor compass;
- private boolean keepTurning = true;
- private boolean monitorCalibrationSuccess = false;
- DcMotor motorLeft;
- DcMotor motorRight;
- double pauseTime = 2.0D;
- private boolean returnToMeasurementMode = false;
- private double turnTime = 20.0D;
-
- private String calibrationMessageToString(boolean var1) {
- return var1?"Calibration Failed!":"Calibration Succeeded.";
- }
-
- public void init() {
- this.compass = (CompassSensor)this.hardwareMap.compassSensor.get("compass");
- this.motorRight = (DcMotor)this.hardwareMap.dcMotor.get("right");
- this.motorLeft = (DcMotor)this.hardwareMap.dcMotor.get("left");
- }
-
- public void init_loop() {
- this.motorRight.setDirection(DcMotor.Direction.REVERSE);
- this.compass.setMode(CompassSensor.CompassMode.CALIBRATION_MODE);
- this.telemetry.addData("Compass", "Compass in calibration mode");
- this.pauseTime = 3.0D + this.time;
- }
-
- public void loop() {
- if(this.time > this.pauseTime) {
- if(this.keepTurning) {
- this.telemetry.addData("Compass", "Calibration mode. Turning the robot...");
- DbgLog.msg("Calibration mode. Turning the robot...");
- this.motorRight.setPower(-0.2D);
- this.motorLeft.setPower(0.2D);
- if(this.time > 3.0D + this.turnTime) {
- this.keepTurning = false;
- this.returnToMeasurementMode = true;
- }
- } else if(this.returnToMeasurementMode) {
- this.telemetry.addData("Compass", "Returning to measurement mode");
- DbgLog.msg("Returning to measurement mode");
- this.motorRight.setPower(0.0D);
- this.motorLeft.setPower(0.0D);
- this.compass.setMode(CompassSensor.CompassMode.MEASUREMENT_MODE);
- this.pauseTime = 3.0D + this.time;
- this.returnToMeasurementMode = false;
- this.monitorCalibrationSuccess = true;
- this.telemetry.addData("Compass", "Waiting for feedback from sensor...");
- } else if(this.monitorCalibrationSuccess) {
- String var1 = this.calibrationMessageToString(this.compass.calibrationFailed());
- this.telemetry.addData("Compass", var1);
- if(this.compass.calibrationFailed()) {
- DbgLog.error("Calibration failed and needs to be re-run");
- } else {
- DbgLog.msg(var1);
- }
- }
-
- this.pauseTime = 3.0D + this.time;
- }
-
- }
-}
diff --git a/FtcRobotController/app/src/main/java/com/qualcomm/ftcrobotcontroller/opmodes/FtcOpModeRegister.java b/FtcRobotController/app/src/main/java/com/qualcomm/ftcrobotcontroller/opmodes/FtcOpModeRegister.java
deleted file mode 100644
index 5868afd..0000000
--- a/FtcRobotController/app/src/main/java/com/qualcomm/ftcrobotcontroller/opmodes/FtcOpModeRegister.java
+++ /dev/null
@@ -1,17 +0,0 @@
-package com.qualcomm.ftcrobotcontroller.opmodes;
-
-import com.qualcomm.ftcrobotcontroller.opmodes.K9TeleOp;
-import com.qualcomm.ftcrobotcontroller.opmodes.NullOp;
-import com.qualcomm.ftcrobotcontroller.opmodes.PushBotAuto;
-import com.qualcomm.ftcrobotcontroller.opmodes.PushBotManual;
-import com.qualcomm.robotcore.eventloop.opmode.OpModeManager;
-import com.qualcomm.robotcore.eventloop.opmode.OpModeRegister;
-
-public class FtcOpModeRegister implements OpModeRegister {
- public void register(OpModeManager var1) {
- var1.register("NullOp", NullOp.class);
- var1.register("K9TeleOp", K9TeleOp.class);
- var1.register("PushBotAuto", PushBotAuto.class);
- var1.register("PushBotManual", PushBotManual.class);
- }
-}
diff --git a/FtcRobotController/app/src/main/java/com/qualcomm/ftcrobotcontroller/opmodes/IrSeekerOp.java b/FtcRobotController/app/src/main/java/com/qualcomm/ftcrobotcontroller/opmodes/IrSeekerOp.java
deleted file mode 100644
index 89be63e..0000000
--- a/FtcRobotController/app/src/main/java/com/qualcomm/ftcrobotcontroller/opmodes/IrSeekerOp.java
+++ /dev/null
@@ -1,53 +0,0 @@
-package com.qualcomm.ftcrobotcontroller.opmodes;
-
-import com.qualcomm.ftccommon.DbgLog;
-import com.qualcomm.robotcore.eventloop.opmode.OpMode;
-import com.qualcomm.robotcore.hardware.DcMotor;
-import com.qualcomm.robotcore.hardware.IrSeekerSensor;
-
-public class IrSeekerOp extends OpMode {
- static final double HOLD_IR_SIGNAL_STRENGTH = 0.2D;
- static final double MOTOR_POWER = 0.15D;
- IrSeekerSensor irSeeker;
- DcMotor motorLeft;
- DcMotor motorRight;
-
- public void init() {
- this.irSeeker = (IrSeekerSensor)this.hardwareMap.irSeekerSensor.get("ir_seeker");
- this.motorRight = (DcMotor)this.hardwareMap.dcMotor.get("motor_2");
- this.motorLeft = (DcMotor)this.hardwareMap.dcMotor.get("motor_1");
- }
-
- public void loop() {
- double var1 = 0.0D;
- double var3 = 0.0D;
- if(this.irSeeker.signalDetected()) {
- var1 = this.irSeeker.getAngle();
- var3 = this.irSeeker.getStrength();
- if(var1 < -20.0D) {
- this.motorRight.setPower(0.15D);
- this.motorLeft.setPower(-0.15D);
- } else if(var1 > 20.0D) {
- this.motorRight.setPower(-0.15D);
- this.motorLeft.setPower(0.15D);
- } else if(var3 < 0.2D) {
- this.motorRight.setPower(0.15D);
- this.motorLeft.setPower(0.15D);
- } else {
- this.motorRight.setPower(0.0D);
- this.motorLeft.setPower(0.0D);
- }
- } else {
- this.motorRight.setPower(0.0D);
- this.motorLeft.setPower(0.0D);
- }
-
- this.telemetry.addData("angle", var1);
- this.telemetry.addData("strength", var3);
- DbgLog.msg(this.irSeeker.toString());
- }
-
- public void start() {
- this.motorLeft.setDirection(DcMotor.Direction.REVERSE);
- }
-}
diff --git a/FtcRobotController/app/src/main/java/com/qualcomm/ftcrobotcontroller/opmodes/K9AutoTime.java b/FtcRobotController/app/src/main/java/com/qualcomm/ftcrobotcontroller/opmodes/K9AutoTime.java
deleted file mode 100644
index 0db77e5..0000000
--- a/FtcRobotController/app/src/main/java/com/qualcomm/ftcrobotcontroller/opmodes/K9AutoTime.java
+++ /dev/null
@@ -1,65 +0,0 @@
-package com.qualcomm.ftcrobotcontroller.opmodes;
-
-import com.qualcomm.robotcore.eventloop.opmode.OpMode;
-import com.qualcomm.robotcore.hardware.DcMotor;
-import com.qualcomm.robotcore.hardware.LightSensor;
-import com.qualcomm.robotcore.hardware.Servo;
-
-public class K9AutoTime extends OpMode {
- static final double HOLD_IR_SIGNAL_STRENGTH = 0.2D;
- static final double LIGHT_THRESHOLD = 0.5D;
- static final double MOTOR_POWER = 0.15D;
- Servo arm;
- double armPosition;
- Servo claw;
- double clawPosition;
- DcMotor motorLeft;
- DcMotor motorRight;
- LightSensor reflectedLight;
-
- public void init() {
- this.motorRight = (DcMotor)this.hardwareMap.dcMotor.get("motor_2");
- this.motorLeft = (DcMotor)this.hardwareMap.dcMotor.get("motor_1");
- this.motorLeft.setDirection(DcMotor.Direction.REVERSE);
- this.arm = (Servo)this.hardwareMap.servo.get("servo_1");
- this.claw = (Servo)this.hardwareMap.servo.get("servo_6");
- this.armPosition = 0.4D;
- this.clawPosition = 0.25D;
- this.reflectedLight = (LightSensor)this.hardwareMap.lightSensor.get("light_sensor");
- this.reflectedLight.enableLed(true);
- }
-
- public void loop() {
- this.arm.setPosition(this.armPosition);
- this.claw.setPosition(this.clawPosition);
- double var1;
- double var3;
- if(this.time <= 1.0D) {
- var1 = 0.15D;
- var3 = 0.15D;
- } else if(this.time > 5.0D && this.time <= 8.5D) {
- var1 = 0.15D;
- var3 = -0.15D;
- } else if(this.time > 8.5D && this.time <= 15.0D) {
- var1 = 0.0D;
- var3 = 0.0D;
- } else if(this.time > 15.0D && this.time <= 20.75D) {
- var1 = -0.15D;
- var3 = 0.15D;
- } else {
- var1 = 0.0D;
- var3 = 0.0D;
- }
-
- this.motorRight.setPower(var1);
- this.motorLeft.setPower(var3);
- this.telemetry.addData("Text", "*** Robot Data***");
- this.telemetry.addData("time", "elapsed time: " + Double.toString(this.time));
- this.telemetry.addData("reflection", "reflection: " + Double.toString(0.0D));
- this.telemetry.addData("left tgt pwr", "left pwr: " + Double.toString(var1));
- this.telemetry.addData("right tgt pwr", "right pwr: " + Double.toString(var3));
- }
-
- public void stop() {
- }
-}
diff --git a/FtcRobotController/app/src/main/java/com/qualcomm/ftcrobotcontroller/opmodes/K9IrSeeker.java b/FtcRobotController/app/src/main/java/com/qualcomm/ftcrobotcontroller/opmodes/K9IrSeeker.java
deleted file mode 100644
index 55c634e..0000000
--- a/FtcRobotController/app/src/main/java/com/qualcomm/ftcrobotcontroller/opmodes/K9IrSeeker.java
+++ /dev/null
@@ -1,75 +0,0 @@
-package com.qualcomm.ftcrobotcontroller.opmodes;
-
-import com.qualcomm.robotcore.eventloop.opmode.OpMode;
-import com.qualcomm.robotcore.hardware.DcMotor;
-import com.qualcomm.robotcore.hardware.IrSeekerSensor;
-import com.qualcomm.robotcore.hardware.Servo;
-
-public class K9IrSeeker extends OpMode {
- static final double HOLD_IR_SIGNAL_STRENGTH = 0.5D;
- static final double MOTOR_POWER = 0.15D;
- Servo arm;
- double armPosition;
- Servo claw;
- double clawPosition;
- IrSeekerSensor irSeeker;
- DcMotor motorLeft;
- DcMotor motorRight;
-
- public void init() {
- this.motorRight = (DcMotor)this.hardwareMap.dcMotor.get("motor_2");
- this.motorLeft = (DcMotor)this.hardwareMap.dcMotor.get("motor_1");
- this.motorLeft.setDirection(DcMotor.Direction.REVERSE);
- this.arm = (Servo)this.hardwareMap.servo.get("servo_1");
- this.claw = (Servo)this.hardwareMap.servo.get("servo_6");
- this.armPosition = 0.1D;
- this.clawPosition = 0.25D;
- this.irSeeker = (IrSeekerSensor)this.hardwareMap.irSeekerSensor.get("ir_seeker");
- }
-
- public void loop() {
- double var1 = 0.0D;
- double var3 = 0.0D;
- this.arm.setPosition(this.armPosition);
- this.claw.setPosition(this.clawPosition);
- double var5;
- double var7;
- if(this.irSeeker.signalDetected()) {
- var1 = this.irSeeker.getAngle();
- var3 = this.irSeeker.getStrength();
- if(var1 < -60.0D) {
- var5 = -0.15D;
- var7 = 0.15D;
- } else if(var1 < -5.0D) {
- var5 = 0.09999999999999999D;
- var7 = 0.15D;
- } else if(var1 > 5.0D && var1 < 60.0D) {
- var5 = 0.15D;
- var7 = 0.09999999999999999D;
- } else if(var1 > 60.0D) {
- var5 = 0.15D;
- var7 = -0.15D;
- } else if(var3 < 0.5D) {
- var5 = 0.15D;
- var7 = 0.15D;
- } else {
- var5 = 0.0D;
- var7 = 0.0D;
- }
- } else {
- var5 = 0.0D;
- var7 = 0.0D;
- }
-
- this.motorRight.setPower(var7);
- this.motorLeft.setPower(var5);
- this.telemetry.addData("Text", "*** Robot Data***");
- this.telemetry.addData("angle", "angle: " + Double.toString(var1));
- this.telemetry.addData("strength", "sig strength: " + Double.toString(var3));
- this.telemetry.addData("left tgt pwr", "left pwr: " + Double.toString(var5));
- this.telemetry.addData("right tgt pwr", "right pwr: " + Double.toString(var7));
- }
-
- public void stop() {
- }
-}
diff --git a/FtcRobotController/app/src/main/java/com/qualcomm/ftcrobotcontroller/opmodes/K9Line.java b/FtcRobotController/app/src/main/java/com/qualcomm/ftcrobotcontroller/opmodes/K9Line.java
deleted file mode 100644
index ab15777..0000000
--- a/FtcRobotController/app/src/main/java/com/qualcomm/ftcrobotcontroller/opmodes/K9Line.java
+++ /dev/null
@@ -1,55 +0,0 @@
-package com.qualcomm.ftcrobotcontroller.opmodes;
-
-import com.qualcomm.robotcore.eventloop.opmode.OpMode;
-import com.qualcomm.robotcore.hardware.DcMotor;
-import com.qualcomm.robotcore.hardware.LightSensor;
-import com.qualcomm.robotcore.hardware.Servo;
-
-public class K9Line extends OpMode {
- static final double HOLD_IR_SIGNAL_STRENGTH = 0.2D;
- static final double LIGHT_THRESHOLD = 0.5D;
- static final double MOTOR_POWER = 0.15D;
- Servo arm;
- double armPosition;
- Servo claw;
- double clawPosition;
- DcMotor motorLeft;
- DcMotor motorRight;
- LightSensor reflectedLight;
-
- public void init() {
- this.motorRight = (DcMotor)this.hardwareMap.dcMotor.get("motor_2");
- this.motorLeft = (DcMotor)this.hardwareMap.dcMotor.get("motor_1");
- this.motorLeft.setDirection(DcMotor.Direction.REVERSE);
- this.arm = (Servo)this.hardwareMap.servo.get("servo_1");
- this.claw = (Servo)this.hardwareMap.servo.get("servo_6");
- this.armPosition = 0.2D;
- this.clawPosition = 0.25D;
- this.reflectedLight = (LightSensor)this.hardwareMap.lightSensor.get("light_sensor");
- this.reflectedLight.enableLed(true);
- }
-
- public void loop() {
- this.arm.setPosition(this.armPosition);
- this.claw.setPosition(this.clawPosition);
- double var1;
- double var3;
- if(0.0D < 0.5D) {
- var1 = 0.15D;
- var3 = 0.0D;
- } else {
- var1 = 0.0D;
- var3 = 0.15D;
- }
-
- this.motorRight.setPower(var1);
- this.motorLeft.setPower(var3);
- this.telemetry.addData("Text", "*** Robot Data***");
- this.telemetry.addData("reflection", "reflection: " + Double.toString(0.0D));
- this.telemetry.addData("left tgt pwr", "left pwr: " + Double.toString(var1));
- this.telemetry.addData("right tgt pwr", "right pwr: " + Double.toString(var3));
- }
-
- public void stop() {
- }
-}
diff --git a/FtcRobotController/app/src/main/java/com/qualcomm/ftcrobotcontroller/opmodes/K9TankDrive.java b/FtcRobotController/app/src/main/java/com/qualcomm/ftcrobotcontroller/opmodes/K9TankDrive.java
deleted file mode 100644
index 0b48e65..0000000
--- a/FtcRobotController/app/src/main/java/com/qualcomm/ftcrobotcontroller/opmodes/K9TankDrive.java
+++ /dev/null
@@ -1,108 +0,0 @@
-package com.qualcomm.ftcrobotcontroller.opmodes;
-
-import com.qualcomm.robotcore.eventloop.opmode.OpMode;
-import com.qualcomm.robotcore.hardware.DcMotor;
-import com.qualcomm.robotcore.hardware.Servo;
-import com.qualcomm.robotcore.robocol.Telemetry;
-import com.qualcomm.robotcore.util.Range;
-
-public class K9TankDrive extends OpMode {
- static final double ARM_MAX_RANGE = 0.9D;
- static final double ARM_MIN_RANGE = 0.2D;
- static final double CLAW_MAX_RANGE = 0.7D;
- static final double CLAW_MIN_RANGE = 0.2D;
- Servo arm;
- double armDelta = 0.1D;
- double armPosition;
- Servo claw;
- double clawDelta = 0.1D;
- double clawPosition;
- DcMotor motorLeft;
- DcMotor motorRight;
-
- public void init() {
- this.motorRight = (DcMotor)this.hardwareMap.dcMotor.get("motor_2");
- this.motorLeft = (DcMotor)this.hardwareMap.dcMotor.get("motor_1");
- this.motorLeft.setDirection(DcMotor.Direction.REVERSE);
- this.arm = (Servo)this.hardwareMap.servo.get("servo_1");
- this.claw = (Servo)this.hardwareMap.servo.get("servo_6");
- this.armPosition = 0.2D;
- this.clawPosition = 0.2D;
- }
-
- public void loop() {
- float var1 = -this.gamepad1.left_stick_y;
- float var2 = Range.clip(-this.gamepad1.right_stick_y, -1.0F, 1.0F);
- float var3 = Range.clip(var1, -1.0F, 1.0F);
- float var4 = (float)this.scaleInput((double)var2);
- float var5 = (float)this.scaleInput((double)var3);
- this.motorRight.setPower((double)var4);
- this.motorLeft.setPower((double)var5);
- if(this.gamepad1.a) {
- this.armPosition += this.armDelta;
- }
-
- if(this.gamepad1.y) {
- this.armPosition -= this.armDelta;
- }
-
- if(this.gamepad1.left_bumper) {
- this.clawPosition += this.clawDelta;
- }
-
- if((double)this.gamepad1.left_trigger > 0.25D) {
- this.clawPosition -= this.clawDelta;
- }
-
- if(this.gamepad1.b) {
- this.clawPosition -= this.clawDelta;
- }
-
- if(this.gamepad1.x) {
- this.clawPosition += this.clawDelta;
- }
-
- if(this.gamepad1.b) {
- this.clawPosition -= this.clawDelta;
- }
-
- this.armPosition = Range.clip(this.armPosition, 0.2D, 0.9D);
- this.clawPosition = Range.clip(this.clawPosition, 0.2D, 0.7D);
- this.arm.setPosition(this.armPosition);
- this.claw.setPosition(this.clawPosition);
- this.telemetry.addData("Text", "*** Robot Data***");
- Telemetry var6 = this.telemetry;
- StringBuilder var7 = (new StringBuilder()).append("arm: ");
- Object[] var8 = new Object[]{Double.valueOf(this.armPosition)};
- var6.addData("arm", var7.append(String.format("%.2f", var8)).toString());
- Telemetry var9 = this.telemetry;
- StringBuilder var10 = (new StringBuilder()).append("claw: ");
- Object[] var11 = new Object[]{Double.valueOf(this.clawPosition)};
- var9.addData("claw", var10.append(String.format("%.2f", var11)).toString());
- Telemetry var12 = this.telemetry;
- StringBuilder var13 = (new StringBuilder()).append("left pwr: ");
- Object[] var14 = new Object[]{Float.valueOf(var5)};
- var12.addData("left tgt pwr", var13.append(String.format("%.2f", var14)).toString());
- Telemetry var15 = this.telemetry;
- StringBuilder var16 = (new StringBuilder()).append("right pwr: ");
- Object[] var17 = new Object[]{Float.valueOf(var4)};
- var15.addData("right tgt pwr", var16.append(String.format("%.2f", var17)).toString());
- }
-
- double scaleInput(double var1) {
- double[] var3 = new double[]{0.0D, 0.05D, 0.09D, 0.1D, 0.12D, 0.15D, 0.18D, 0.24D, 0.3D, 0.36D, 0.43D, 0.5D, 0.6D, 0.72D, 0.85D, 1.0D, 1.0D};
- int var4 = (int)(16.0D * var1);
- if(var4 < 0) {
- var4 = -var4;
- }
-
- if(var4 > 16) {
- var4 = 16;
- }
-
- return var1 < 0.0D?-var3[var4]:var3[var4];
- }
-
- public void stop() {
- }
-}
diff --git a/FtcRobotController/app/src/main/java/com/qualcomm/ftcrobotcontroller/opmodes/K9TeleOp.java b/FtcRobotController/app/src/main/java/com/qualcomm/ftcrobotcontroller/opmodes/K9TeleOp.java
deleted file mode 100644
index 750f8dc..0000000
--- a/FtcRobotController/app/src/main/java/com/qualcomm/ftcrobotcontroller/opmodes/K9TeleOp.java
+++ /dev/null
@@ -1,99 +0,0 @@
-package com.qualcomm.ftcrobotcontroller.opmodes;
-
-import com.qualcomm.robotcore.eventloop.opmode.OpMode;
-import com.qualcomm.robotcore.hardware.DcMotor;
-import com.qualcomm.robotcore.hardware.Servo;
-import com.qualcomm.robotcore.robocol.Telemetry;
-import com.qualcomm.robotcore.util.Range;
-
-public class K9TeleOp extends OpMode {
- static final double ARM_MAX_RANGE = 0.9D;
- static final double ARM_MIN_RANGE = 0.2D;
- static final double CLAW_MAX_RANGE = 0.7D;
- static final double CLAW_MIN_RANGE = 0.2D;
- Servo arm;
- double armDelta = 0.1D;
- double armPosition;
- Servo claw;
- double clawDelta = 0.1D;
- double clawPosition;
- DcMotor motorLeft;
- DcMotor motorRight;
-
- public void init() {
- this.motorRight = (DcMotor)this.hardwareMap.dcMotor.get("motor_2");
- this.motorLeft = (DcMotor)this.hardwareMap.dcMotor.get("motor_1");
- this.motorLeft.setDirection(DcMotor.Direction.REVERSE);
- this.arm = (Servo)this.hardwareMap.servo.get("servo_1");
- this.claw = (Servo)this.hardwareMap.servo.get("servo_6");
- this.armPosition = 0.2D;
- this.clawPosition = 0.2D;
- }
-
- public void loop() {
- float var1 = -this.gamepad1.left_stick_y;
- float var2 = this.gamepad1.left_stick_x;
- float var3 = var1 - var2;
- float var4 = var1 + var2;
- float var5 = Range.clip(var3, -1.0F, 1.0F);
- float var6 = Range.clip(var4, -1.0F, 1.0F);
- float var7 = (float)this.scaleInput((double)var5);
- float var8 = (float)this.scaleInput((double)var6);
- this.motorRight.setPower((double)var7);
- this.motorLeft.setPower((double)var8);
- if(this.gamepad1.a) {
- this.armPosition += this.armDelta;
- }
-
- if(this.gamepad1.y) {
- this.armPosition -= this.armDelta;
- }
-
- if(this.gamepad1.x) {
- this.clawPosition += this.clawDelta;
- }
-
- if(this.gamepad1.b) {
- this.clawPosition -= this.clawDelta;
- }
-
- this.armPosition = Range.clip(this.armPosition, 0.2D, 0.9D);
- this.clawPosition = Range.clip(this.clawPosition, 0.2D, 0.7D);
- this.arm.setPosition(this.armPosition);
- this.claw.setPosition(this.clawPosition);
- this.telemetry.addData("Text", "*** Robot Data***");
- Telemetry var9 = this.telemetry;
- StringBuilder var10 = (new StringBuilder()).append("arm: ");
- Object[] var11 = new Object[]{Double.valueOf(this.armPosition)};
- var9.addData("arm", var10.append(String.format("%.2f", var11)).toString());
- Telemetry var12 = this.telemetry;
- StringBuilder var13 = (new StringBuilder()).append("claw: ");
- Object[] var14 = new Object[]{Double.valueOf(this.clawPosition)};
- var12.addData("claw", var13.append(String.format("%.2f", var14)).toString());
- Telemetry var15 = this.telemetry;
- StringBuilder var16 = (new StringBuilder()).append("left pwr: ");
- Object[] var17 = new Object[]{Float.valueOf(var8)};
- var15.addData("left tgt pwr", var16.append(String.format("%.2f", var17)).toString());
- Telemetry var18 = this.telemetry;
- StringBuilder var19 = (new StringBuilder()).append("right pwr: ");
- Object[] var20 = new Object[]{Float.valueOf(var7)};
- var18.addData("right tgt pwr", var19.append(String.format("%.2f", var20)).toString());
- }
-
- double scaleInput(double var1) {
- double[] var3 = new double[]{0.0D, 0.05D, 0.09D, 0.1D, 0.12D, 0.15D, 0.18D, 0.24D, 0.3D, 0.36D, 0.43D, 0.5D, 0.6D, 0.72D, 0.85D, 1.0D, 1.0D};
- int var4 = (int)(16.0D * var1);
- if(var4 < 0) {
- var4 = -var4;
- }
-
- if(var4 > 16) {
- var4 = 16;
- }
-
- return var1 < 0.0D?-var3[var4]:var3[var4];
- }
-
- public void stop() {
- }
-}
diff --git a/FtcRobotController/app/src/main/java/com/qualcomm/ftcrobotcontroller/opmodes/LinearI2cAddressChange.java b/FtcRobotController/app/src/main/java/com/qualcomm/ftcrobotcontroller/opmodes/LinearI2cAddressChange.java
deleted file mode 100644
index 0bd2027..0000000
--- a/FtcRobotController/app/src/main/java/com/qualcomm/ftcrobotcontroller/opmodes/LinearI2cAddressChange.java
+++ /dev/null
@@ -1,124 +0,0 @@
-package com.qualcomm.ftcrobotcontroller.opmodes;
-
-import com.qualcomm.robotcore.eventloop.opmode.LinearOpMode;
-import com.qualcomm.robotcore.hardware.DeviceInterfaceModule;
-import com.qualcomm.robotcore.hardware.HardwareMap;
-import com.qualcomm.robotcore.hardware.IrSeekerSensor;
-import com.qualcomm.robotcore.robocol.Telemetry;
-import java.util.concurrent.locks.Lock;
-
-public class LinearI2cAddressChange extends LinearOpMode {
- public static final int ADDRESS_MEMORY_START = 0;
- public static final int ADDRESS_SET_NEW_I2C_ADDRESS = 112;
- public static final int BUFFER_CHANGE_ADDRESS_LENGTH = 3;
- public static final byte FIRMWARE_REV = 18;
- public static final byte IR_SEEKER_V3_FIRMWARE_REV = 18;
- public static final byte IR_SEEKER_V3_ORIGINAL_ADDRESS = 56;
- public static final byte IR_SEEKER_V3_SENSOR_ID = 73;
- public static final byte MANUFACTURER_CODE = 77;
- public static final int READ_MODE = 128;
- public static final byte SENSOR_ID = 73;
- public static final int TOTAL_MEMORY_LENGTH = 12;
- public static final byte TRIGGER_BYTE_1 = 85;
- public static final byte TRIGGER_BYTE_2 = -86;
- int currentAddress = 56;
- DeviceInterfaceModule dim;
- int newAddress = 66;
- int port = 3;
- byte[] readCache;
- Lock readLock;
- byte[] writeCache;
- Lock writeLock;
-
- private boolean foundExpectedBytes(int[] param1, Lock param2, byte[] param3) {
- // $FF: Couldn't be decompiled
- }
-
- private void performAction(String var1, int var2, int var3, int var4, int var5) {
- if(var1.equalsIgnoreCase("read")) {
- this.dim.enableI2cReadMode(var2, var3, var4, var5);
- }
-
- if(var1.equalsIgnoreCase("write")) {
- this.dim.enableI2cWriteMode(var2, var3, var4, var5);
- }
-
- this.dim.setI2cPortActionFlag(var2);
- this.dim.writeI2cCacheToController(var2);
- this.dim.readI2cCacheFromController(var2);
- }
-
- private void writeNewAddress() {
- try {
- this.writeLock.lock();
- this.writeCache[4] = (byte)this.newAddress;
- this.writeCache[5] = 85;
- this.writeCache[6] = -86;
- } finally {
- this.writeLock.unlock();
- }
-
- }
-
- public void runOpMode() throws InterruptedException {
- this.dim = (DeviceInterfaceModule)this.hardwareMap.deviceInterfaceModule.get("dim");
- this.readCache = this.dim.getI2cReadCache(this.port);
- this.readLock = this.dim.getI2cReadCacheLock(this.port);
- this.writeCache = this.dim.getI2cWriteCache(this.port);
- this.writeLock = this.dim.getI2cWriteCacheLock(this.port);
- IrSeekerSensor.throwIfModernRoboticsI2cAddressIsInvalid(this.newAddress);
- this.waitForStart();
- this.performAction("read", this.port, this.currentAddress, 0, 12);
-
- while(!this.dim.isI2cPortReady(this.port)) {
- this.telemetry.addData("I2cAddressChange", "waiting for the port to be ready...");
- this.sleep(1000L);
- }
-
- this.dim.readI2cCacheFromController(this.port);
- int var1 = 0;
- int[] var2 = new int[]{128, this.currentAddress, 0, 12, 18, 77, 73};
-
- while(!this.foundExpectedBytes(var2, this.readLock, this.readCache)) {
- this.telemetry.addData("I2cAddressChange", "Confirming that we\'re reading the correct bytes...");
- this.dim.readI2cCacheFromController(this.port);
- this.sleep(1000L);
- ++var1;
- if(var1 >= 10) {
- Telemetry var8 = this.telemetry;
- Object[] var9 = new Object[]{Integer.valueOf(this.currentAddress)};
- var8.addData("I2cAddressChange", String.format("Looping too long with no change, probably have the wrong address. Current address: %02x", var9));
- HardwareMap.DeviceMapping var10 = this.hardwareMap.irSeekerSensor;
- Object[] var11 = new Object[]{Integer.valueOf(this.currentAddress)};
- var10.get(String.format("Looping too long with no change, probably have the wrong address. Current address: %02x", var11));
- }
- }
-
- this.performAction("write", this.port, this.currentAddress, 112, 3);
- this.waitOneFullHardwareCycle();
- this.writeNewAddress();
- this.dim.setI2cPortActionFlag(this.port);
- this.dim.writeI2cCacheToController(this.port);
- this.telemetry.addData("I2cAddressChange", "Giving the hardware some time to make the change...");
-
- for(int var3 = 0; var3 < 5000; ++var3) {
- this.waitOneFullHardwareCycle();
- }
-
- this.dim.enableI2cReadMode(this.port, this.newAddress, 0, 12);
- this.dim.setI2cPortActionFlag(this.port);
- this.dim.writeI2cCacheToController(this.port);
- int[] var4 = new int[]{128, this.newAddress, 0, 12, 18, 77, 73};
-
- while(!this.foundExpectedBytes(var4, this.readLock, this.readCache)) {
- this.telemetry.addData("I2cAddressChange", "Have not confirmed the changes yet...");
- this.dim.readI2cCacheFromController(this.port);
- this.sleep(1000L);
- }
-
- Telemetry var5 = this.telemetry;
- StringBuilder var6 = (new StringBuilder()).append("Successfully changed the I2C address.");
- Object[] var7 = new Object[]{Integer.valueOf(this.newAddress)};
- var5.addData("I2cAddressChange", var6.append(String.format("New address: %02x", var7)).toString());
- }
-}
diff --git a/FtcRobotController/app/src/main/java/com/qualcomm/ftcrobotcontroller/opmodes/LinearIrExample.java b/FtcRobotController/app/src/main/java/com/qualcomm/ftcrobotcontroller/opmodes/LinearIrExample.java
deleted file mode 100644
index dafa35c..0000000
--- a/FtcRobotController/app/src/main/java/com/qualcomm/ftcrobotcontroller/opmodes/LinearIrExample.java
+++ /dev/null
@@ -1,47 +0,0 @@
-package com.qualcomm.ftcrobotcontroller.opmodes;
-
-import com.qualcomm.robotcore.eventloop.opmode.LinearOpMode;
-import com.qualcomm.robotcore.hardware.DcMotor;
-import com.qualcomm.robotcore.hardware.IrSeekerSensor;
-
-public class LinearIrExample extends LinearOpMode {
- static final double HOLD_IR_SIGNAL_STRENGTH = 0.2D;
- static final double MOTOR_POWER = 0.15D;
- IrSeekerSensor irSeeker;
- DcMotor motorLeft;
- DcMotor motorRight;
-
- public void runOpMode() throws InterruptedException {
- this.irSeeker = (IrSeekerSensor)this.hardwareMap.irSeekerSensor.get("ir_seeker");
- this.motorLeft = (DcMotor)this.hardwareMap.dcMotor.get("motor_1");
- this.motorRight = (DcMotor)this.hardwareMap.dcMotor.get("motor_2");
- this.motorLeft.setDirection(DcMotor.Direction.REVERSE);
- this.waitForStart();
-
- while(!this.irSeeker.signalDetected()) {
- this.sleep(1000L);
- }
-
- if(this.irSeeker.getAngle() < 0.0D) {
- this.motorRight.setPower(0.15D);
- this.motorLeft.setPower(-0.15D);
- } else if(this.irSeeker.getAngle() > 0.0D) {
- this.motorRight.setPower(-0.15D);
- this.motorLeft.setPower(0.15D);
- }
-
- while(this.irSeeker.getAngle() != 0.0D) {
- this.waitOneFullHardwareCycle();
- }
-
- this.motorRight.setPower(0.15D);
- this.motorLeft.setPower(0.15D);
-
- while(this.irSeeker.getStrength() < 0.2D) {
- this.waitOneFullHardwareCycle();
- }
-
- this.motorRight.setPower(0.0D);
- this.motorLeft.setPower(0.0D);
- }
-}
diff --git a/FtcRobotController/app/src/main/java/com/qualcomm/ftcrobotcontroller/opmodes/LinearK9TeleOp.java b/FtcRobotController/app/src/main/java/com/qualcomm/ftcrobotcontroller/opmodes/LinearK9TeleOp.java
deleted file mode 100644
index 7743e0f..0000000
--- a/FtcRobotController/app/src/main/java/com/qualcomm/ftcrobotcontroller/opmodes/LinearK9TeleOp.java
+++ /dev/null
@@ -1,56 +0,0 @@
-package com.qualcomm.ftcrobotcontroller.opmodes;
-
-import com.qualcomm.robotcore.eventloop.opmode.LinearOpMode;
-import com.qualcomm.robotcore.hardware.DcMotor;
-import com.qualcomm.robotcore.hardware.Servo;
-import com.qualcomm.robotcore.util.Range;
-
-public class LinearK9TeleOp extends LinearOpMode {
- Servo jaw;
- double jawPosition;
- DcMotor motorLeft;
- DcMotor motorRight;
- Servo neck;
- double neckDelta = 0.01D;
- double neckPosition;
-
- public void runOpMode() throws InterruptedException {
- this.motorLeft = (DcMotor)this.hardwareMap.dcMotor.get("motor_1");
- this.motorRight = (DcMotor)this.hardwareMap.dcMotor.get("motor_2");
- this.neck = (Servo)this.hardwareMap.servo.get("servo_1");
- this.jaw = (Servo)this.hardwareMap.servo.get("servo_6");
- this.motorLeft.setDirection(DcMotor.Direction.REVERSE);
- this.neckPosition = 0.5D;
- this.waitForStart();
-
- while(this.opModeIsActive()) {
- float var1 = -this.gamepad1.left_stick_y;
- float var2 = this.gamepad1.left_stick_x;
- float var3 = var1 - var2;
- float var4 = var1 + var2;
- float var5 = Range.clip(var3, -1.0F, 1.0F);
- float var6 = Range.clip(var4, -1.0F, 1.0F);
- this.motorRight.setPower((double)var5);
- this.motorLeft.setPower((double)var6);
- if(this.gamepad1.y) {
- this.neckPosition -= this.neckDelta;
- }
-
- if(this.gamepad1.a) {
- this.neckPosition += this.neckDelta;
- }
-
- this.neckPosition = Range.clip(this.neckPosition, 0.0D, 1.0D);
- this.jawPosition = 1.0D - Range.scale((double)this.gamepad1.right_trigger, 0.0D, 1.0D, 0.3D, 1.0D);
- this.neck.setPosition(this.neckPosition);
- this.jaw.setPosition(this.jawPosition);
- this.telemetry.addData("Text", "K9TeleOp");
- this.telemetry.addData(" left motor", this.motorLeft.getPower());
- this.telemetry.addData("right motor", this.motorRight.getPower());
- this.telemetry.addData("neck", this.neck.getPosition());
- this.telemetry.addData("jaw", this.jaw.getPosition());
- this.waitOneFullHardwareCycle();
- }
-
- }
-}
diff --git a/FtcRobotController/app/src/main/java/com/qualcomm/ftcrobotcontroller/opmodes/NullOp.java b/FtcRobotController/app/src/main/java/com/qualcomm/ftcrobotcontroller/opmodes/NullOp.java
deleted file mode 100644
index 47caf7f..0000000
--- a/FtcRobotController/app/src/main/java/com/qualcomm/ftcrobotcontroller/opmodes/NullOp.java
+++ /dev/null
@@ -1,25 +0,0 @@
-package com.qualcomm.ftcrobotcontroller.opmodes;
-
-import com.qualcomm.robotcore.eventloop.opmode.OpMode;
-import com.qualcomm.robotcore.util.ElapsedTime;
-import java.text.SimpleDateFormat;
-import java.util.Date;
-
-public class NullOp extends OpMode {
- private ElapsedTime runtime = new ElapsedTime();
- private String startDate;
-
- public void init() {
- }
-
- public void init_loop() {
- this.startDate = (new SimpleDateFormat("yyyy/MM/dd HH:mm:ss")).format(new Date());
- this.runtime.reset();
- this.telemetry.addData("Null Op Init Loop", this.runtime.toString());
- }
-
- public void loop() {
- this.telemetry.addData("1 Start", "NullOp started at " + this.startDate);
- this.telemetry.addData("2 Status", "running for " + this.runtime.toString());
- }
-}
diff --git a/FtcRobotController/app/src/main/java/com/qualcomm/ftcrobotcontroller/opmodes/NxtTeleOp.java b/FtcRobotController/app/src/main/java/com/qualcomm/ftcrobotcontroller/opmodes/NxtTeleOp.java
deleted file mode 100644
index 0dde4f8..0000000
--- a/FtcRobotController/app/src/main/java/com/qualcomm/ftcrobotcontroller/opmodes/NxtTeleOp.java
+++ /dev/null
@@ -1,120 +0,0 @@
-package com.qualcomm.ftcrobotcontroller.opmodes;
-
-import com.qualcomm.robotcore.eventloop.opmode.OpMode;
-import com.qualcomm.robotcore.hardware.DcMotor;
-import com.qualcomm.robotcore.hardware.DcMotorController;
-import com.qualcomm.robotcore.hardware.Servo;
-import com.qualcomm.robotcore.util.Range;
-
-public class NxtTeleOp extends OpMode {
- Servo claw;
- double clawDelta = 0.01D;
- double clawPosition;
- DcMotorController.DeviceMode devMode;
- DcMotor motorLeft;
- DcMotor motorRight;
- int numOpLoops = 1;
- DcMotorController wheelController;
- Servo wrist;
- double wristDelta = 0.01D;
- double wristPosition;
-
- private boolean allowedToWrite() {
- return this.devMode == DcMotorController.DeviceMode.WRITE_ONLY;
- }
-
- public void init() {
- this.motorRight = (DcMotor)this.hardwareMap.dcMotor.get("motor_2");
- this.motorLeft = (DcMotor)this.hardwareMap.dcMotor.get("motor_1");
- this.claw = (Servo)this.hardwareMap.servo.get("servo_6");
- this.wrist = (Servo)this.hardwareMap.servo.get("servo_1");
- this.wheelController = (DcMotorController)this.hardwareMap.dcMotorController.get("wheels");
- }
-
- public void init_loop() {
- this.devMode = DcMotorController.DeviceMode.WRITE_ONLY;
- this.motorRight.setDirection(DcMotor.Direction.REVERSE);
- this.motorLeft.setChannelMode(DcMotorController.RunMode.RUN_WITHOUT_ENCODERS);
- this.motorRight.setChannelMode(DcMotorController.RunMode.RUN_WITHOUT_ENCODERS);
- this.wristPosition = 0.6D;
- this.clawPosition = 0.5D;
- }
-
- public void loop() {
- if(this.allowedToWrite()) {
- if(this.gamepad1.dpad_left) {
- this.motorLeft.setChannelMode(DcMotorController.RunMode.RUN_WITHOUT_ENCODERS);
- this.motorRight.setChannelMode(DcMotorController.RunMode.RUN_WITHOUT_ENCODERS);
- }
-
- if(this.gamepad1.dpad_right) {
- this.motorLeft.setChannelMode(DcMotorController.RunMode.RUN_USING_ENCODERS);
- this.motorRight.setChannelMode(DcMotorController.RunMode.RUN_USING_ENCODERS);
- }
-
- float var1 = -this.gamepad1.left_stick_y;
- float var2 = this.gamepad1.left_stick_x;
- float var3 = var1 - var2;
- float var4 = var1 + var2;
- float var5 = Range.clip(var3, -1.0F, 1.0F);
- float var6 = Range.clip(var4, -1.0F, 1.0F);
- this.motorRight.setPower((double)var5);
- this.motorLeft.setPower((double)var6);
- if(this.gamepad1.a) {
- this.wristPosition -= this.wristDelta;
- }
-
- if(this.gamepad1.y) {
- this.wristPosition += this.wristDelta;
- }
-
- if(this.gamepad1.x) {
- this.clawPosition -= this.clawDelta;
- }
-
- if(this.gamepad1.b) {
- this.clawPosition += this.clawDelta;
- }
-
- this.wristPosition = Range.clip(this.wristPosition, 0.0D, 1.0D);
- this.clawPosition = Range.clip(this.clawPosition, 0.0D, 1.0D);
- this.wrist.setPosition(this.wristPosition);
- this.claw.setPosition(this.clawPosition);
- if(!this.gamepad2.atRest()) {
- float var7 = this.gamepad2.right_trigger;
- if((double)this.gamepad2.left_trigger != 0.0D) {
- var7 = -this.gamepad2.left_trigger;
- }
-
- float var8 = var7;
- float var9 = var7;
- if(this.gamepad2.left_stick_x < 0.0F) {
- var9 = var7 * (1.0F + this.gamepad2.left_stick_x);
- }
-
- if(this.gamepad2.left_stick_x > 0.0F) {
- var8 = var7 * (1.0F - this.gamepad2.left_stick_x);
- }
-
- this.motorRight.setPower((double)var8);
- this.motorLeft.setPower((double)var9);
- }
- }
-
- if(this.numOpLoops % 17 == 0) {
- this.wheelController.setMotorControllerDeviceMode(DcMotorController.DeviceMode.READ_ONLY);
- }
-
- if(this.wheelController.getMotorControllerDeviceMode() == DcMotorController.DeviceMode.READ_ONLY) {
- this.telemetry.addData("Text", "free flow text");
- this.telemetry.addData("left motor", this.motorLeft.getPower());
- this.telemetry.addData("right motor", this.motorRight.getPower());
- this.telemetry.addData("RunMode: ", this.motorLeft.getChannelMode().toString());
- this.wheelController.setMotorControllerDeviceMode(DcMotorController.DeviceMode.WRITE_ONLY);
- this.numOpLoops = 0;
- }
-
- this.devMode = this.wheelController.getMotorControllerDeviceMode();
- ++this.numOpLoops;
- }
-}
diff --git a/FtcRobotController/app/src/main/java/com/qualcomm/ftcrobotcontroller/opmodes/PushBotAuto.java b/FtcRobotController/app/src/main/java/com/qualcomm/ftcrobotcontroller/opmodes/PushBotAuto.java
deleted file mode 100644
index 7eaf1c6..0000000
--- a/FtcRobotController/app/src/main/java/com/qualcomm/ftcrobotcontroller/opmodes/PushBotAuto.java
+++ /dev/null
@@ -1,65 +0,0 @@
-package com.qualcomm.ftcrobotcontroller.opmodes;
-
-import com.qualcomm.ftcrobotcontroller.opmodes.PushBotTelemetry;
-
-public class PushBotAuto extends PushBotTelemetry {
- private int v_state = 0;
-
- public void loop() {
- switch(this.v_state) {
- case 0:
- this.reset_drive_encoders();
- ++this.v_state;
- break;
- case 1:
- this.run_using_encoders();
- this.set_drive_power(1.0D, 1.0D);
- if(this.have_drive_encoders_reached(2880.0D, 2880.0D)) {
- this.reset_drive_encoders();
- this.set_drive_power(0.0D, 0.0D);
- ++this.v_state;
- }
- break;
- case 2:
- if(this.have_drive_encoders_reset()) {
- ++this.v_state;
- }
- break;
- case 3:
- this.run_using_encoders();
- this.set_drive_power(-1.0D, 1.0D);
- if(this.have_drive_encoders_reached(2880.0D, 2880.0D)) {
- this.reset_drive_encoders();
- this.set_drive_power(0.0D, 0.0D);
- ++this.v_state;
- }
- break;
- case 4:
- if(this.have_drive_encoders_reset()) {
- ++this.v_state;
- }
- break;
- case 5:
- this.run_using_encoders();
- this.set_drive_power(1.0D, -1.0D);
- if(this.have_drive_encoders_reached(2880.0D, 2880.0D)) {
- this.reset_drive_encoders();
- this.set_drive_power(0.0D, 0.0D);
- ++this.v_state;
- }
- break;
- case 6:
- if(this.have_drive_encoders_reset()) {
- ++this.v_state;
- }
- }
-
- this.update_telemetry();
- this.telemetry.addData("18", "State: " + this.v_state);
- }
-
- public void start() {
- super.start();
- this.reset_drive_encoders();
- }
-}
diff --git a/FtcRobotController/app/src/main/java/com/qualcomm/ftcrobotcontroller/opmodes/PushBotAutoSensors.java b/FtcRobotController/app/src/main/java/com/qualcomm/ftcrobotcontroller/opmodes/PushBotAutoSensors.java
deleted file mode 100644
index cce5a76..0000000
--- a/FtcRobotController/app/src/main/java/com/qualcomm/ftcrobotcontroller/opmodes/PushBotAutoSensors.java
+++ /dev/null
@@ -1,81 +0,0 @@
-package com.qualcomm.ftcrobotcontroller.opmodes;
-
-import com.qualcomm.ftcrobotcontroller.opmodes.PushBotTelemetrySensors;
-
-public class PushBotAutoSensors extends PushBotTelemetrySensors {
- private int v_arm_state = 0;
- private int v_state = 0;
-
- public void loop() {
- switch(this.v_state) {
- case 0:
- if(this.have_drive_encoders_reset()) {
- this.drive_using_encoders(-1.0D, 1.0D, -2880.0D, 2880.0D);
- ++this.v_state;
- }
- break;
- case 1:
- if(this.drive_using_encoders(1.0D, 1.0D, 2880.0D, 2880.0D)) {
- ++this.v_state;
- }
- break;
- case 2:
- if(this.have_drive_encoders_reset()) {
- this.drive_using_encoders(-1.0D, 1.0D, -2880.0D, 2880.0D);
- this.v_arm_state = 1;
- ++this.v_state;
- }
- break;
- case 3:
- if(this.drive_using_encoders(-1.0D, 1.0D, -2880.0D, 2880.0D)) {
- ++this.v_state;
- }
- break;
- case 4:
- if(this.have_drive_encoders_reset()) {
- this.run_without_drive_encoders();
- ++this.v_state;
- }
- break;
- case 5:
- if(this.a_ods_white_tape_detected()) {
- this.set_drive_power(0.0D, 0.0D);
- this.drive_to_ir_beacon();
- ++this.v_state;
- } else {
- this.set_drive_power(1.0D, 1.0D);
- }
- break;
- case 6:
- int var1 = this.drive_to_ir_beacon();
- if(var1 == 1) {
- this.open_hand();
- ++this.v_state;
- } else if(var1 == -2) {
- this.set_error_message("IR beacon not detected!");
- }
- }
-
- this.update_arm_state();
- this.update_telemetry();
- this.telemetry.addData("11", "Drive State: " + this.v_state);
- this.telemetry.addData("12", "Arm State: " + this.v_arm_state);
- }
-
- public void start() {
- super.start();
- this.reset_drive_encoders();
- }
-
- public void update_arm_state() {
- switch(this.v_arm_state) {
- case 1:
- if(this.move_arm_upward_until_touch()) {
- ++this.v_arm_state;
- return;
- }
- case 0:
- default:
- }
- }
-}
diff --git a/FtcRobotController/app/src/main/java/com/qualcomm/ftcrobotcontroller/opmodes/PushBotDriveTouch.java b/FtcRobotController/app/src/main/java/com/qualcomm/ftcrobotcontroller/opmodes/PushBotDriveTouch.java
deleted file mode 100644
index 228fb00..0000000
--- a/FtcRobotController/app/src/main/java/com/qualcomm/ftcrobotcontroller/opmodes/PushBotDriveTouch.java
+++ /dev/null
@@ -1,33 +0,0 @@
-package com.qualcomm.ftcrobotcontroller.opmodes;
-
-import com.qualcomm.robotcore.eventloop.opmode.LinearOpMode;
-import com.qualcomm.robotcore.hardware.DcMotor;
-import com.qualcomm.robotcore.hardware.TouchSensor;
-
-public class PushBotDriveTouch extends LinearOpMode {
- DcMotor leftMotor;
- DcMotor rightMotor;
- TouchSensor touchSensor;
-
- public void runOpMode() throws InterruptedException {
- this.leftMotor = (DcMotor)this.hardwareMap.dcMotor.get("left_drive");
- this.rightMotor = (DcMotor)this.hardwareMap.dcMotor.get("right_drive");
- this.rightMotor.setDirection(DcMotor.Direction.REVERSE);
- this.touchSensor = (TouchSensor)this.hardwareMap.touchSensor.get("sensor_touch");
- this.waitForStart();
-
- while(this.opModeIsActive()) {
- if(this.touchSensor.isPressed()) {
- this.leftMotor.setPower(0.0D);
- this.rightMotor.setPower(0.0D);
- } else {
- this.leftMotor.setPower(0.5D);
- this.rightMotor.setPower(0.5D);
- }
-
- this.telemetry.addData("isPressed", String.valueOf(this.touchSensor.isPressed()));
- this.waitOneFullHardwareCycle();
- }
-
- }
-}
diff --git a/FtcRobotController/app/src/main/java/com/qualcomm/ftcrobotcontroller/opmodes/PushBotHardware.java b/FtcRobotController/app/src/main/java/com/qualcomm/ftcrobotcontroller/opmodes/PushBotHardware.java
deleted file mode 100644
index 2eb5f2a..0000000
--- a/FtcRobotController/app/src/main/java/com/qualcomm/ftcrobotcontroller/opmodes/PushBotHardware.java
+++ /dev/null
@@ -1,351 +0,0 @@
-package com.qualcomm.ftcrobotcontroller.opmodes;
-
-import com.qualcomm.ftccommon.DbgLog;
-import com.qualcomm.robotcore.eventloop.opmode.OpMode;
-import com.qualcomm.robotcore.hardware.DcMotor;
-import com.qualcomm.robotcore.hardware.DcMotorController;
-import com.qualcomm.robotcore.hardware.Servo;
-import com.qualcomm.robotcore.util.Range;
-
-public class PushBotHardware extends OpMode {
- private DcMotor v_motor_left_arm;
- private DcMotor v_motor_left_drive;
- private DcMotor v_motor_right_drive;
- private Servo v_servo_left_hand;
- private Servo v_servo_right_hand;
- private boolean v_warning_generated = false;
- private String v_warning_message;
-
- double a_hand_position() {
- double var1 = 0.0D;
- if(this.v_servo_left_hand != null) {
- var1 = this.v_servo_left_hand.getPosition();
- }
-
- return var1;
- }
-
- double a_left_arm_power() {
- double var1 = 0.0D;
- if(this.v_motor_left_arm != null) {
- var1 = this.v_motor_left_arm.getPower();
- }
-
- return var1;
- }
-
- double a_left_drive_power() {
- double var1 = 0.0D;
- if(this.v_motor_left_drive != null) {
- var1 = this.v_motor_left_drive.getPower();
- }
-
- return var1;
- }
-
- int a_left_encoder_count() {
- DcMotor var1 = this.v_motor_left_drive;
- int var2 = 0;
- if(var1 != null) {
- var2 = this.v_motor_left_drive.getCurrentPosition();
- }
-
- return var2;
- }
-
- double a_right_drive_power() {
- double var1 = 0.0D;
- if(this.v_motor_right_drive != null) {
- var1 = this.v_motor_right_drive.getPower();
- }
-
- return var1;
- }
-
- int a_right_encoder_count() {
- DcMotor var1 = this.v_motor_right_drive;
- int var2 = 0;
- if(var1 != null) {
- var2 = this.v_motor_right_drive.getCurrentPosition();
- }
-
- return var2;
- }
-
- boolean a_warning_generated() {
- return this.v_warning_generated;
- }
-
- String a_warning_message() {
- return this.v_warning_message;
- }
-
- boolean drive_using_encoders(double var1, double var3, double var5, double var7) {
- this.run_using_encoders();
- this.set_drive_power(var1, var3);
- boolean var9 = this.have_drive_encoders_reached(var5, var7);
- boolean var10 = false;
- if(var9) {
- this.reset_drive_encoders();
- this.set_drive_power(0.0D, 0.0D);
- var10 = true;
- }
-
- return var10;
- }
-
- boolean has_left_drive_encoder_reached(double var1) {
- DcMotor var3 = this.v_motor_left_drive;
- boolean var4 = false;
- if(var3 != null) {
- double var6;
- int var5 = (var6 = (double)Math.abs(this.v_motor_left_drive.getCurrentPosition()) - var1) == 0.0D?0:(var6 < 0.0D?-1:1);
- var4 = false;
- if(var5 > 0) {
- var4 = true;
- }
- }
-
- return var4;
- }
-
- boolean has_left_drive_encoder_reset() {
- int var1 = this.a_left_encoder_count();
- boolean var2 = false;
- if(var1 == 0) {
- var2 = true;
- }
-
- return var2;
- }
-
- boolean has_right_drive_encoder_reached(double var1) {
- DcMotor var3 = this.v_motor_right_drive;
- boolean var4 = false;
- if(var3 != null) {
- double var6;
- int var5 = (var6 = (double)Math.abs(this.v_motor_right_drive.getCurrentPosition()) - var1) == 0.0D?0:(var6 < 0.0D?-1:1);
- var4 = false;
- if(var5 > 0) {
- var4 = true;
- }
- }
-
- return var4;
- }
-
- boolean has_right_drive_encoder_reset() {
- int var1 = this.a_right_encoder_count();
- boolean var2 = false;
- if(var1 == 0) {
- var2 = true;
- }
-
- return var2;
- }
-
- boolean have_drive_encoders_reached(double var1, double var3) {
- boolean var5 = this.has_left_drive_encoder_reached(var1);
- boolean var6 = false;
- if(var5) {
- boolean var7 = this.has_right_drive_encoder_reached(var3);
- var6 = false;
- if(var7) {
- var6 = true;
- }
- }
-
- return var6;
- }
-
- boolean have_drive_encoders_reset() {
- boolean var1 = this.has_left_drive_encoder_reset();
- boolean var2 = false;
- if(var1) {
- boolean var3 = this.has_right_drive_encoder_reset();
- var2 = false;
- if(var3) {
- var2 = true;
- }
- }
-
- return var2;
- }
-
- public void init() {
- this.v_warning_generated = false;
- this.v_warning_message = "Can\'t map; ";
-
- try {
- this.v_motor_left_drive = (DcMotor)this.hardwareMap.dcMotor.get("left_drive");
- } catch (Exception var10) {
- this.m_warning_message("left_drive");
- DbgLog.msg(var10.getLocalizedMessage());
- this.v_motor_left_drive = null;
- }
-
- try {
- this.v_motor_right_drive = (DcMotor)this.hardwareMap.dcMotor.get("right_drive");
- this.v_motor_right_drive.setDirection(DcMotor.Direction.REVERSE);
- } catch (Exception var9) {
- this.m_warning_message("right_drive");
- DbgLog.msg(var9.getLocalizedMessage());
- this.v_motor_right_drive = null;
- }
-
- try {
- this.v_motor_left_arm = (DcMotor)this.hardwareMap.dcMotor.get("left_arm");
- } catch (Exception var8) {
- this.m_warning_message("left_arm");
- DbgLog.msg(var8.getLocalizedMessage());
- this.v_motor_left_arm = null;
- }
-
- try {
- this.v_servo_left_hand = (Servo)this.hardwareMap.servo.get("left_hand");
- this.v_servo_left_hand.setPosition(0.5D);
- } catch (Exception var7) {
- this.m_warning_message("left_hand");
- DbgLog.msg(var7.getLocalizedMessage());
- this.v_servo_left_hand = null;
- }
-
- try {
- this.v_servo_right_hand = (Servo)this.hardwareMap.servo.get("right_hand");
- this.v_servo_right_hand.setPosition(0.5D);
- } catch (Exception var6) {
- this.m_warning_message("right_hand");
- DbgLog.msg(var6.getLocalizedMessage());
- this.v_servo_right_hand = null;
- }
- }
-
- public void loop() {
- }
-
- void m_hand_position(double var1) {
- double var3 = Range.clip(var1, 0.0D, 1.0D);
- if(this.v_servo_left_hand != null) {
- this.v_servo_left_hand.setPosition(var3);
- }
-
- if(this.v_servo_right_hand != null) {
- this.v_servo_right_hand.setPosition(1.0D - var3);
- }
-
- }
-
- void m_left_arm_power(double var1) {
- if(this.v_motor_left_arm != null) {
- this.v_motor_left_arm.setPower(var1);
- }
-
- }
-
- void m_warning_message(String var1) {
- if(this.v_warning_generated) {
- this.v_warning_message = this.v_warning_message + ", ";
- }
-
- this.v_warning_generated = true;
- this.v_warning_message = this.v_warning_message + var1;
- }
-
- void open_hand() {
- if(this.v_servo_left_hand != null) {
- this.v_servo_left_hand.setPosition(1.0D);
- }
-
- if(this.v_servo_right_hand != null) {
- this.v_servo_right_hand.setPosition(0.0D);
- }
-
- }
-
- public void reset_drive_encoders() {
- this.reset_left_drive_encoder();
- this.reset_right_drive_encoder();
- }
-
- public void reset_left_drive_encoder() {
- if(this.v_motor_left_drive != null) {
- this.v_motor_left_drive.setChannelMode(DcMotorController.RunMode.RESET_ENCODERS);
- }
-
- }
-
- public void reset_right_drive_encoder() {
- if(this.v_motor_right_drive != null) {
- this.v_motor_right_drive.setChannelMode(DcMotorController.RunMode.RESET_ENCODERS);
- }
-
- }
-
- public void run_using_encoders() {
- this.run_using_left_drive_encoder();
- this.run_using_right_drive_encoder();
- }
-
- public void run_using_left_drive_encoder() {
- if(this.v_motor_left_drive != null) {
- this.v_motor_left_drive.setChannelMode(DcMotorController.RunMode.RUN_USING_ENCODERS);
- }
-
- }
-
- public void run_using_right_drive_encoder() {
- if(this.v_motor_right_drive != null) {
- this.v_motor_right_drive.setChannelMode(DcMotorController.RunMode.RUN_USING_ENCODERS);
- }
-
- }
-
- public void run_without_drive_encoders() {
- this.run_without_left_drive_encoder();
- this.run_without_right_drive_encoder();
- }
-
- public void run_without_left_drive_encoder() {
- if(this.v_motor_left_drive != null && this.v_motor_left_drive.getChannelMode() == DcMotorController.RunMode.RESET_ENCODERS) {
- this.v_motor_left_drive.setChannelMode(DcMotorController.RunMode.RUN_WITHOUT_ENCODERS);
- }
-
- }
-
- public void run_without_right_drive_encoder() {
- if(this.v_motor_right_drive != null && this.v_motor_right_drive.getChannelMode() == DcMotorController.RunMode.RESET_ENCODERS) {
- this.v_motor_right_drive.setChannelMode(DcMotorController.RunMode.RUN_WITHOUT_ENCODERS);
- }
-
- }
-
- float scale_motor_power(float var1) {
- float var2 = Range.clip(var1, -1.0F, 1.0F);
- float[] var3 = new float[]{0.0F, 0.05F, 0.09F, 0.1F, 0.12F, 0.15F, 0.18F, 0.24F, 0.3F, 0.36F, 0.43F, 0.5F, 0.6F, 0.72F, 0.85F, 1.0F, 1.0F};
- int var4 = (int)(16.0D * (double)var2);
- if(var4 < 0) {
- var4 = -var4;
- } else if(var4 > 16) {
- var4 = 16;
- }
-
- return var2 < 0.0F?-var3[var4]:var3[var4];
- }
-
- void set_drive_power(double var1, double var3) {
- if(this.v_motor_left_drive != null) {
- this.v_motor_left_drive.setPower(var1);
- }
-
- if(this.v_motor_right_drive != null) {
- this.v_motor_right_drive.setPower(var3);
- }
-
- }
-
- public void start() {
- }
-
- public void stop() {
- }
-}
diff --git a/FtcRobotController/app/src/main/java/com/qualcomm/ftcrobotcontroller/opmodes/PushBotHardwareSensors.java b/FtcRobotController/app/src/main/java/com/qualcomm/ftcrobotcontroller/opmodes/PushBotHardwareSensors.java
deleted file mode 100644
index dbdb8cc..0000000
--- a/FtcRobotController/app/src/main/java/com/qualcomm/ftcrobotcontroller/opmodes/PushBotHardwareSensors.java
+++ /dev/null
@@ -1,139 +0,0 @@
-package com.qualcomm.ftcrobotcontroller.opmodes;
-
-import com.qualcomm.ftccommon.DbgLog;
-import com.qualcomm.ftcrobotcontroller.opmodes.PushBotTelemetry;
-import com.qualcomm.robotcore.hardware.IrSeekerSensor;
-import com.qualcomm.robotcore.hardware.OpticalDistanceSensor;
-import com.qualcomm.robotcore.hardware.TouchSensor;
-import com.qualcomm.robotcore.util.Range;
-
-public class PushBotHardwareSensors extends PushBotTelemetry {
- final int drive_to_ir_beacon_done = 1;
- final int drive_to_ir_beacon_invalid = -1;
- final int drive_to_ir_beacon_not_detected = -2;
- final int drive_to_ir_beacon_running = 0;
- private IrSeekerSensor v_sensor_ir;
- private OpticalDistanceSensor v_sensor_ods;
- private TouchSensor v_sensor_touch;
-
- double a_ir_angle() {
- double var1 = 0.0D;
- if(this.v_sensor_ir != null) {
- var1 = this.v_sensor_ir.getAngle();
- }
-
- return var1;
- }
-
- IrSeekerSensor.IrSeekerIndividualSensor[] a_ir_angles_and_strengths() {
- IrSeekerSensor.IrSeekerIndividualSensor[] var1 = new IrSeekerSensor.IrSeekerIndividualSensor[]{new IrSeekerSensor.IrSeekerIndividualSensor(), new IrSeekerSensor.IrSeekerIndividualSensor()};
- if(this.v_sensor_ir != null) {
- var1 = this.v_sensor_ir.getIndividualSensors();
- }
-
- return var1;
- }
-
- double a_ir_strength() {
- double var1 = 0.0D;
- if(this.v_sensor_ir != null) {
- var1 = this.v_sensor_ir.getStrength();
- }
-
- return var1;
- }
-
- double a_ods_light_detected() {
- if(this.v_sensor_ods != null) {
- this.v_sensor_ods.getLightDetected();
- }
-
- return 0.0D;
- }
-
- boolean a_ods_white_tape_detected() {
- OpticalDistanceSensor var1 = this.v_sensor_ods;
- boolean var2 = false;
- if(var1 != null) {
- double var4;
- int var3 = (var4 = this.v_sensor_ods.getLightDetected() - 0.8D) == 0.0D?0:(var4 < 0.0D?-1:1);
- var2 = false;
- if(var3 > 0) {
- var2 = true;
- }
- }
-
- return var2;
- }
-
- int drive_to_ir_beacon() {
- double var1 = this.a_ir_strength();
- if(var1 > 0.01D && var1 < 0.2D) {
- double var3 = this.a_ir_angle() / 240.0D;
- this.set_drive_power(Range.clip(0.15D + var3, -1.0D, 1.0D), Range.clip(0.15D - var3, -1.0D, 1.0D));
- return 0;
- } else if(var1 <= 0.0D) {
- this.set_drive_power(0.0D, 0.0D);
- return -2;
- } else {
- this.set_drive_power(0.0D, 0.0D);
- return 1;
- }
- }
-
- public void init() {
- super.init();
-
- try {
- this.v_sensor_touch = (TouchSensor)this.hardwareMap.touchSensor.get("sensor_touch");
- } catch (Exception var10) {
- this.m_warning_message("sensor_touch");
- DbgLog.msg(var10.getLocalizedMessage());
- this.v_sensor_touch = null;
- }
-
- try {
- this.v_sensor_ir = (IrSeekerSensor)this.hardwareMap.irSeekerSensor.get("sensor_ir");
- } catch (Exception var9) {
- this.m_warning_message("sensor_ir");
- DbgLog.msg(var9.getLocalizedMessage());
- this.v_sensor_ir = null;
- }
-
- try {
- this.v_sensor_ods = (OpticalDistanceSensor)this.hardwareMap.opticalDistanceSensor.get("sensor_ods");
- } catch (Exception var8) {
- try {
- this.v_sensor_ods = (OpticalDistanceSensor)this.hardwareMap.opticalDistanceSensor.get("sensor_eopd");
- } catch (Exception var7) {
- try {
- this.v_sensor_ods = (OpticalDistanceSensor)this.hardwareMap.opticalDistanceSensor.get("sensor_EOPD");
- } catch (Exception var6) {
- this.m_warning_message("sensor_ods/eopd/EOPD");
- DbgLog.msg("Can\'t map sensor_ods nor sensor_eopd, nor sensor_EOPD (" + var6.getLocalizedMessage() + ").\n");
- this.v_sensor_ods = null;
- }
- }
- }
- }
-
- boolean is_touch_sensor_pressed() {
- TouchSensor var1 = this.v_sensor_touch;
- boolean var2 = false;
- if(var1 != null) {
- var2 = this.v_sensor_touch.isPressed();
- }
-
- return var2;
- }
-
- boolean move_arm_upward_until_touch() {
- if(this.is_touch_sensor_pressed()) {
- this.m_left_arm_power(0.0D);
- } else {
- this.m_left_arm_power(1.0D);
- }
-
- return this.is_touch_sensor_pressed();
- }
-}
diff --git a/FtcRobotController/app/src/main/java/com/qualcomm/ftcrobotcontroller/opmodes/PushBotIrEvent.java b/FtcRobotController/app/src/main/java/com/qualcomm/ftcrobotcontroller/opmodes/PushBotIrEvent.java
deleted file mode 100644
index 59ce0d8..0000000
--- a/FtcRobotController/app/src/main/java/com/qualcomm/ftcrobotcontroller/opmodes/PushBotIrEvent.java
+++ /dev/null
@@ -1,20 +0,0 @@
-package com.qualcomm.ftcrobotcontroller.opmodes;
-
-import com.qualcomm.ftcrobotcontroller.opmodes.PushBotTelemetrySensors;
-
-public class PushBotIrEvent extends PushBotTelemetrySensors {
- public void loop() {
- int var1 = this.drive_to_ir_beacon();
- if(var1 == 0) {
- this.set_first_message("Driving to IR beacon.");
- } else if(var1 == 1) {
- this.set_error_message("IR beacon is close!");
- } else if(var1 == -2) {
- this.set_error_message("IR beacon not detected!");
- } else if(var1 == -1) {
- this.set_error_message("IR beacon return value is invalid!");
- }
-
- this.update_telemetry();
- }
-}
diff --git a/FtcRobotController/app/src/main/java/com/qualcomm/ftcrobotcontroller/opmodes/PushBotIrSeek.java b/FtcRobotController/app/src/main/java/com/qualcomm/ftcrobotcontroller/opmodes/PushBotIrSeek.java
deleted file mode 100644
index f7306d5..0000000
--- a/FtcRobotController/app/src/main/java/com/qualcomm/ftcrobotcontroller/opmodes/PushBotIrSeek.java
+++ /dev/null
@@ -1,42 +0,0 @@
-package com.qualcomm.ftcrobotcontroller.opmodes;
-
-import com.qualcomm.robotcore.eventloop.opmode.LinearOpMode;
-import com.qualcomm.robotcore.hardware.DcMotor;
-import com.qualcomm.robotcore.hardware.IrSeekerSensor;
-import com.qualcomm.robotcore.util.Range;
-
-public class PushBotIrSeek extends LinearOpMode {
- static final double kBaseSpeed = 0.15D;
- static final double kMaximumStrength = 0.6D;
- static final double kMinimumStrength = 0.08D;
- IrSeekerSensor irSeeker;
- DcMotor leftMotor;
- DcMotor rightMotor;
-
- public void runOpMode() throws InterruptedException {
- this.irSeeker = (IrSeekerSensor)this.hardwareMap.irSeekerSensor.get("sensor_ir");
- this.leftMotor = (DcMotor)this.hardwareMap.dcMotor.get("left_drive");
- this.rightMotor = (DcMotor)this.hardwareMap.dcMotor.get("right_drive");
- this.rightMotor.setDirection(DcMotor.Direction.REVERSE);
- this.waitForStart();
-
- while(this.opModeIsActive()) {
- double var1 = this.irSeeker.getAngle() / 30.0D;
- double var3 = this.irSeeker.getStrength();
- if(var3 > 0.08D && var3 < 0.6D) {
- double var5 = Range.clip(0.15D + var1 / 8.0D, -1.0D, 1.0D);
- double var7 = Range.clip(0.15D - var1 / 8.0D, -1.0D, 1.0D);
- this.leftMotor.setPower(var5);
- this.rightMotor.setPower(var7);
- } else {
- this.leftMotor.setPower(0.0D);
- this.rightMotor.setPower(0.0D);
- }
-
- this.telemetry.addData("Seeker", this.irSeeker.toString());
- this.telemetry.addData("Speed", " Left=" + this.leftMotor.getPower() + " Right=" + this.rightMotor.getPower());
- this.waitOneFullHardwareCycle();
- }
-
- }
-}
diff --git a/FtcRobotController/app/src/main/java/com/qualcomm/ftcrobotcontroller/opmodes/PushBotManual.java b/FtcRobotController/app/src/main/java/com/qualcomm/ftcrobotcontroller/opmodes/PushBotManual.java
deleted file mode 100644
index d8f23b2..0000000
--- a/FtcRobotController/app/src/main/java/com/qualcomm/ftcrobotcontroller/opmodes/PushBotManual.java
+++ /dev/null
@@ -1,20 +0,0 @@
-package com.qualcomm.ftcrobotcontroller.opmodes;
-
-import com.qualcomm.ftcrobotcontroller.opmodes.PushBotTelemetry;
-
-public class PushBotManual extends PushBotTelemetry {
- public void loop() {
- float var1 = this.scale_motor_power(-this.gamepad1.left_stick_y);
- float var2 = this.scale_motor_power(-this.gamepad1.right_stick_y);
- this.set_drive_power((double)var1, (double)var2);
- this.m_left_arm_power((double)this.scale_motor_power(-this.gamepad2.left_stick_y));
- if(this.gamepad2.x) {
- this.m_hand_position(0.05D + this.a_hand_position());
- } else if(this.gamepad2.b) {
- this.m_hand_position(this.a_hand_position() - 0.05D);
- }
-
- this.update_telemetry();
- this.update_gamepad_telemetry();
- }
-}
diff --git a/FtcRobotController/app/src/main/java/com/qualcomm/ftcrobotcontroller/opmodes/PushBotManual1.java b/FtcRobotController/app/src/main/java/com/qualcomm/ftcrobotcontroller/opmodes/PushBotManual1.java
deleted file mode 100644
index 3368de9..0000000
--- a/FtcRobotController/app/src/main/java/com/qualcomm/ftcrobotcontroller/opmodes/PushBotManual1.java
+++ /dev/null
@@ -1,22 +0,0 @@
-package com.qualcomm.ftcrobotcontroller.opmodes;
-
-import com.qualcomm.ftcrobotcontroller.opmodes.PushBotTelemetry;
-
-public class PushBotManual1 extends PushBotTelemetry {
- public void loop() {
- float var1 = this.scale_motor_power(-this.gamepad1.left_stick_y);
- float var2 = this.scale_motor_power(-this.gamepad1.right_stick_y);
- this.set_drive_power((double)var1, (double)var2);
- float var3 = this.scale_motor_power(this.gamepad1.right_trigger) - this.scale_motor_power(this.gamepad1.left_trigger);
- this.m_left_arm_power((double)var3);
- if(this.gamepad1.x) {
- this.m_hand_position(0.05D + this.a_hand_position());
- } else if(this.gamepad1.b) {
- this.m_hand_position(this.a_hand_position() - 0.05D);
- }
-
- this.update_telemetry();
- this.update_gamepad_telemetry();
- this.telemetry.addData("12", "Left Arm: " + var3);
- }
-}
diff --git a/FtcRobotController/app/src/main/java/com/qualcomm/ftcrobotcontroller/opmodes/PushBotManualSensors.java b/FtcRobotController/app/src/main/java/com/qualcomm/ftcrobotcontroller/opmodes/PushBotManualSensors.java
deleted file mode 100644
index 574e801..0000000
--- a/FtcRobotController/app/src/main/java/com/qualcomm/ftcrobotcontroller/opmodes/PushBotManualSensors.java
+++ /dev/null
@@ -1,40 +0,0 @@
-package com.qualcomm.ftcrobotcontroller.opmodes;
-
-import com.qualcomm.ftcrobotcontroller.opmodes.PushBotTelemetrySensors;
-
-public class PushBotManualSensors extends PushBotTelemetrySensors {
- private boolean v_raise_arm_automatically = false;
-
- public void loop() {
- float var1 = this.scale_motor_power(-this.gamepad1.left_stick_y);
- float var2 = this.scale_motor_power(-this.gamepad1.right_stick_y);
- this.set_drive_power((double)var1, (double)var2);
- if(this.gamepad2.y && !this.v_raise_arm_automatically) {
- this.v_raise_arm_automatically = true;
- }
-
- float var3 = -this.gamepad2.left_stick_y;
- float var4;
- if(this.v_raise_arm_automatically) {
- var4 = 1.0F;
- if(this.is_touch_sensor_pressed() || (double)Math.abs(var3) > 0.8D) {
- var4 = 0.0F;
- this.v_raise_arm_automatically = false;
- }
- } else {
- this.v_raise_arm_automatically = false;
- var4 = this.scale_motor_power(var3);
- }
-
- this.m_left_arm_power((double)var4);
- if(this.gamepad2.x) {
- this.m_hand_position(0.05D + this.a_hand_position());
- } else if(this.gamepad2.b) {
- this.m_hand_position(this.a_hand_position() - 0.05D);
- }
-
- this.update_telemetry();
- this.telemetry.addData("18", "Raise Arm: " + this.v_raise_arm_automatically);
- this.telemetry.addData("19", "Left arm command: " + var4);
- }
-}
diff --git a/FtcRobotController/app/src/main/java/com/qualcomm/ftcrobotcontroller/opmodes/PushBotOdsDetectEvent.java b/FtcRobotController/app/src/main/java/com/qualcomm/ftcrobotcontroller/opmodes/PushBotOdsDetectEvent.java
deleted file mode 100644
index 0f82504..0000000
--- a/FtcRobotController/app/src/main/java/com/qualcomm/ftcrobotcontroller/opmodes/PushBotOdsDetectEvent.java
+++ /dev/null
@@ -1,15 +0,0 @@
-package com.qualcomm.ftcrobotcontroller.opmodes;
-
-import com.qualcomm.ftcrobotcontroller.opmodes.PushBotTelemetrySensors;
-
-public class PushBotOdsDetectEvent extends PushBotTelemetrySensors {
- public void loop() {
- if(this.a_ods_white_tape_detected()) {
- this.set_drive_power(0.0D, 0.0D);
- } else {
- this.set_drive_power(1.0D, 1.0D);
- }
-
- this.update_telemetry();
- }
-}
diff --git a/FtcRobotController/app/src/main/java/com/qualcomm/ftcrobotcontroller/opmodes/PushBotOdsFollowEvent.java b/FtcRobotController/app/src/main/java/com/qualcomm/ftcrobotcontroller/opmodes/PushBotOdsFollowEvent.java
deleted file mode 100644
index f59c2d7..0000000
--- a/FtcRobotController/app/src/main/java/com/qualcomm/ftcrobotcontroller/opmodes/PushBotOdsFollowEvent.java
+++ /dev/null
@@ -1,15 +0,0 @@
-package com.qualcomm.ftcrobotcontroller.opmodes;
-
-import com.qualcomm.ftcrobotcontroller.opmodes.PushBotTelemetrySensors;
-
-public class PushBotOdsFollowEvent extends PushBotTelemetrySensors {
- public void loop() {
- if(this.a_ods_white_tape_detected()) {
- this.set_drive_power(0.0D, 0.2D);
- } else {
- this.set_drive_power(0.2D, 0.0D);
- }
-
- this.update_telemetry();
- }
-}
diff --git a/FtcRobotController/app/src/main/java/com/qualcomm/ftcrobotcontroller/opmodes/PushBotSquare.java b/FtcRobotController/app/src/main/java/com/qualcomm/ftcrobotcontroller/opmodes/PushBotSquare.java
deleted file mode 100644
index c48a35d..0000000
--- a/FtcRobotController/app/src/main/java/com/qualcomm/ftcrobotcontroller/opmodes/PushBotSquare.java
+++ /dev/null
@@ -1,31 +0,0 @@
-package com.qualcomm.ftcrobotcontroller.opmodes;
-
-import com.qualcomm.robotcore.eventloop.opmode.LinearOpMode;
-import com.qualcomm.robotcore.hardware.DcMotor;
-import com.qualcomm.robotcore.hardware.DcMotorController;
-
-public class PushBotSquare extends LinearOpMode {
- DcMotor leftMotor;
- DcMotor rightMotor;
-
- public void runOpMode() throws InterruptedException {
- this.leftMotor = (DcMotor)this.hardwareMap.dcMotor.get("left_drive");
- this.rightMotor = (DcMotor)this.hardwareMap.dcMotor.get("right_drive");
- this.rightMotor.setDirection(DcMotor.Direction.REVERSE);
- this.leftMotor.setChannelMode(DcMotorController.RunMode.RUN_USING_ENCODERS);
- this.rightMotor.setChannelMode(DcMotorController.RunMode.RUN_USING_ENCODERS);
- this.waitForStart();
-
- for(int var1 = 0; var1 < 4; ++var1) {
- this.leftMotor.setPower(1.0D);
- this.rightMotor.setPower(1.0D);
- this.sleep(1000L);
- this.leftMotor.setPower(0.5D);
- this.rightMotor.setPower(-0.5D);
- this.sleep(500L);
- }
-
- this.leftMotor.setPowerFloat();
- this.rightMotor.setPowerFloat();
- }
-}
diff --git a/FtcRobotController/app/src/main/java/com/qualcomm/ftcrobotcontroller/opmodes/PushBotTelemetry.java b/FtcRobotController/app/src/main/java/com/qualcomm/ftcrobotcontroller/opmodes/PushBotTelemetry.java
deleted file mode 100644
index 5dbc48c..0000000
--- a/FtcRobotController/app/src/main/java/com/qualcomm/ftcrobotcontroller/opmodes/PushBotTelemetry.java
+++ /dev/null
@@ -1,34 +0,0 @@
-package com.qualcomm.ftcrobotcontroller.opmodes;
-
-import com.qualcomm.ftcrobotcontroller.opmodes.PushBotHardware;
-
-public class PushBotTelemetry extends PushBotHardware {
- public void set_error_message(String var1) {
- this.set_first_message("ERROR: " + var1);
- }
-
- public void set_first_message(String var1) {
- this.telemetry.addData("00", var1);
- }
-
- public void update_gamepad_telemetry() {
- this.telemetry.addData("05", "GP1 Left: " + -this.gamepad1.left_stick_y);
- this.telemetry.addData("06", "GP1 Right: " + -this.gamepad1.right_stick_y);
- this.telemetry.addData("07", "GP2 Left: " + -this.gamepad2.left_stick_y);
- this.telemetry.addData("08", "GP2 X: " + this.gamepad2.x);
- this.telemetry.addData("09", "GP2 Y: " + this.gamepad2.y);
- this.telemetry.addData("10", "GP1 LT: " + this.gamepad1.left_trigger);
- this.telemetry.addData("11", "GP1 RT: " + this.gamepad1.right_trigger);
- }
-
- public void update_telemetry() {
- if(this.a_warning_generated()) {
- this.set_first_message(this.a_warning_message());
- }
-
- this.telemetry.addData("01", "Left Drive: " + this.a_left_drive_power() + ", " + this.a_left_encoder_count());
- this.telemetry.addData("02", "Right Drive: " + this.a_right_drive_power() + ", " + this.a_right_encoder_count());
- this.telemetry.addData("03", "Left Arm: " + this.a_left_arm_power());
- this.telemetry.addData("04", "Hand Position: " + this.a_hand_position());
- }
-}
diff --git a/FtcRobotController/app/src/main/java/com/qualcomm/ftcrobotcontroller/opmodes/PushBotTelemetrySensors.java b/FtcRobotController/app/src/main/java/com/qualcomm/ftcrobotcontroller/opmodes/PushBotTelemetrySensors.java
deleted file mode 100644
index edf810a..0000000
--- a/FtcRobotController/app/src/main/java/com/qualcomm/ftcrobotcontroller/opmodes/PushBotTelemetrySensors.java
+++ /dev/null
@@ -1,17 +0,0 @@
-package com.qualcomm.ftcrobotcontroller.opmodes;
-
-import com.qualcomm.ftcrobotcontroller.opmodes.PushBotHardwareSensors;
-import com.qualcomm.robotcore.hardware.IrSeekerSensor;
-
-public class PushBotTelemetrySensors extends PushBotHardwareSensors {
- public void update_telemetry() {
- super.update_telemetry();
- this.telemetry.addData("12", "Touch: " + this.is_touch_sensor_pressed());
- this.telemetry.addData("13", "IR Angle: " + this.a_ir_angle());
- this.telemetry.addData("14", "IR Strength: " + this.a_ir_strength());
- IrSeekerSensor.IrSeekerIndividualSensor[] var1 = this.a_ir_angles_and_strengths();
- this.telemetry.addData("15", "IR Sensor 1: " + var1[0].toString());
- this.telemetry.addData("16", "IR Sensor 2: " + var1[1].toString());
- this.telemetry.addData("17", "ODS: " + this.a_ods_light_detected());
- }
-}
diff --git a/FtcRobotController/app/src/main/java/com/qualcomm/ftcrobotcontroller/opmodes/PushBotTouchEvent.java b/FtcRobotController/app/src/main/java/com/qualcomm/ftcrobotcontroller/opmodes/PushBotTouchEvent.java
deleted file mode 100644
index d8795a5..0000000
--- a/FtcRobotController/app/src/main/java/com/qualcomm/ftcrobotcontroller/opmodes/PushBotTouchEvent.java
+++ /dev/null
@@ -1,15 +0,0 @@
-package com.qualcomm.ftcrobotcontroller.opmodes;
-
-import com.qualcomm.ftcrobotcontroller.opmodes.PushBotTelemetrySensors;
-
-public class PushBotTouchEvent extends PushBotTelemetrySensors {
- public void loop() {
- if(this.is_touch_sensor_pressed()) {
- this.set_drive_power(0.0D, 0.0D);
- } else {
- this.set_drive_power(1.0D, 1.0D);
- }
-
- this.update_telemetry();
- }
-}
diff --git a/FtcRobotController/app/src/main/java/com/qualcomm/hardware/BuildConfig.java b/FtcRobotController/app/src/main/java/com/qualcomm/hardware/BuildConfig.java
deleted file mode 100644
index e068445..0000000
--- a/FtcRobotController/app/src/main/java/com/qualcomm/hardware/BuildConfig.java
+++ /dev/null
@@ -1,10 +0,0 @@
-package com.qualcomm.hardware;
-
-public final class BuildConfig {
- public static final String APPLICATION_ID = "com.qualcomm.hardware";
- public static final String BUILD_TYPE = "release";
- public static final boolean DEBUG = false;
- public static final String FLAVOR = "";
- public static final int VERSION_CODE = -1;
- public static final String VERSION_NAME = "";
-}
diff --git a/FtcRobotController/app/src/main/java/com/qualcomm/modernrobotics/BuildConfig.java b/FtcRobotController/app/src/main/java/com/qualcomm/modernrobotics/BuildConfig.java
deleted file mode 100644
index ea47d9f..0000000
--- a/FtcRobotController/app/src/main/java/com/qualcomm/modernrobotics/BuildConfig.java
+++ /dev/null
@@ -1,10 +0,0 @@
-package com.qualcomm.modernrobotics;
-
-public final class BuildConfig {
- public static final String APPLICATION_ID = "com.qualcomm.modernrobotics";
- public static final String BUILD_TYPE = "release";
- public static final boolean DEBUG = false;
- public static final String FLAVOR = "";
- public static final int VERSION_CODE = -1;
- public static final String VERSION_NAME = "";
-}
diff --git a/FtcRobotController/app/src/main/java/com/qualcomm/robotcore/BuildConfig.java b/FtcRobotController/app/src/main/java/com/qualcomm/robotcore/BuildConfig.java
deleted file mode 100644
index edb6cef..0000000
--- a/FtcRobotController/app/src/main/java/com/qualcomm/robotcore/BuildConfig.java
+++ /dev/null
@@ -1,10 +0,0 @@
-package com.qualcomm.robotcore;
-
-public final class BuildConfig {
- public static final String APPLICATION_ID = "com.qualcomm.robotcore";
- public static final String BUILD_TYPE = "release";
- public static final boolean DEBUG = false;
- public static final String FLAVOR = "";
- public static final int VERSION_CODE = -1;
- public static final String VERSION_NAME = "";
-}
diff --git a/FtcRobotController/app/src/main/java/com/qualcomm/robotcore/R.java b/FtcRobotController/app/src/main/java/com/qualcomm/robotcore/R.java
deleted file mode 100644
index fa8e73a..0000000
--- a/FtcRobotController/app/src/main/java/com/qualcomm/robotcore/R.java
+++ /dev/null
@@ -1,24 +0,0 @@
-package com.qualcomm.robotcore;
-
-public final class R {
- public static final class color {
- public static final int black = 2131296256;
- public static final int bright_red = 2131296258;
- public static final int bright_red_text = 2131296259;
- public static final int dark_red_background = 2131296260;
- public static final int light_red_background = 2131296262;
- public static final int medium_red_background = 2131296264;
- public static final int transparent_color = 2131296265;
- public static final int very_bright_red = 2131296266;
- public static final int white = 2131296267;
- }
-
- public static final class string {
- public static final int app_name = 2131361800;
- }
-
- public static final class style {
- public static final int AppBaseTheme = 2131165184;
- public static final int AppTheme = 2131165185;
- }
-}
diff --git a/FtcRobotController/app/src/main/java/com/qualcomm/robotcore/eventloop/EventLoop.java b/FtcRobotController/app/src/main/java/com/qualcomm/robotcore/eventloop/EventLoop.java
deleted file mode 100644
index 8a18f3a..0000000
--- a/FtcRobotController/app/src/main/java/com/qualcomm/robotcore/eventloop/EventLoop.java
+++ /dev/null
@@ -1,18 +0,0 @@
-package com.qualcomm.robotcore.eventloop;
-
-import com.qualcomm.robotcore.eventloop.EventLoopManager;
-import com.qualcomm.robotcore.eventloop.opmode.OpModeManager;
-import com.qualcomm.robotcore.exception.RobotCoreException;
-import com.qualcomm.robotcore.robocol.Command;
-
-public interface EventLoop {
- OpModeManager getOpModeManager();
-
- void init(EventLoopManager var1) throws RobotCoreException, InterruptedException;
-
- void loop() throws RobotCoreException, InterruptedException;
-
- void processCommand(Command var1);
-
- void teardown() throws RobotCoreException, InterruptedException;
-}
diff --git a/FtcRobotController/app/src/main/java/com/qualcomm/robotcore/eventloop/opmode/OpMode.java b/FtcRobotController/app/src/main/java/com/qualcomm/robotcore/eventloop/opmode/OpMode.java
deleted file mode 100644
index 821f9fb..0000000
--- a/FtcRobotController/app/src/main/java/com/qualcomm/robotcore/eventloop/opmode/OpMode.java
+++ /dev/null
@@ -1,41 +0,0 @@
-package com.qualcomm.robotcore.eventloop.opmode;
-
-import com.qualcomm.robotcore.hardware.Gamepad;
-import com.qualcomm.robotcore.hardware.HardwareMap;
-import com.qualcomm.robotcore.robocol.Telemetry;
-import java.util.concurrent.TimeUnit;
-
-public abstract class OpMode {
- private long a = 0L;
- public Gamepad gamepad1 = new Gamepad();
- public Gamepad gamepad2 = new Gamepad();
- public HardwareMap hardwareMap = new HardwareMap();
- public Telemetry telemetry = new Telemetry();
- public double time = 0.0D;
-
- public OpMode() {
- this.a = System.nanoTime();
- }
-
- public double getRuntime() {
- double var1 = (double)TimeUnit.SECONDS.toNanos(1L);
- return (double)(System.nanoTime() - this.a) / var1;
- }
-
- public abstract void init();
-
- public void init_loop() {
- }
-
- public abstract void loop();
-
- public void resetStartTime() {
- this.a = System.nanoTime();
- }
-
- public void start() {
- }
-
- public void stop() {
- }
-}
diff --git a/FtcRobotController/app/src/main/java/com/qualcomm/robotcore/eventloop/opmode/OpModeRegister.java b/FtcRobotController/app/src/main/java/com/qualcomm/robotcore/eventloop/opmode/OpModeRegister.java
deleted file mode 100644
index c78faef..0000000
--- a/FtcRobotController/app/src/main/java/com/qualcomm/robotcore/eventloop/opmode/OpModeRegister.java
+++ /dev/null
@@ -1,7 +0,0 @@
-package com.qualcomm.robotcore.eventloop.opmode;
-
-import com.qualcomm.robotcore.eventloop.opmode.OpModeManager;
-
-public interface OpModeRegister {
- void register(OpModeManager var1);
-}
diff --git a/FtcRobotController/app/src/main/java/com/qualcomm/robotcore/exception/RobotCoreException.java b/FtcRobotController/app/src/main/java/com/qualcomm/robotcore/exception/RobotCoreException.java
deleted file mode 100644
index 60f5803..0000000
--- a/FtcRobotController/app/src/main/java/com/qualcomm/robotcore/exception/RobotCoreException.java
+++ /dev/null
@@ -1,22 +0,0 @@
-package com.qualcomm.robotcore.exception;
-
-public class RobotCoreException extends Exception {
- private Exception a = null;
-
- public RobotCoreException(String var1) {
- super(var1);
- }
-
- public RobotCoreException(String var1, Exception var2) {
- super(var1);
- this.a = var2;
- }
-
- public Exception getChainedException() {
- return this.a;
- }
-
- public boolean isChainedException() {
- return this.a != null;
- }
-}
diff --git a/FtcRobotController/app/src/main/java/com/qualcomm/robotcore/exception/RobotCoreNonResponsiveException.java b/FtcRobotController/app/src/main/java/com/qualcomm/robotcore/exception/RobotCoreNonResponsiveException.java
deleted file mode 100644
index 5a48ba3..0000000
--- a/FtcRobotController/app/src/main/java/com/qualcomm/robotcore/exception/RobotCoreNonResponsiveException.java
+++ /dev/null
@@ -1,9 +0,0 @@
-package com.qualcomm.robotcore.exception;
-
-import com.qualcomm.robotcore.exception.RobotCoreException;
-
-public class RobotCoreNonResponsiveException extends RobotCoreException {
- public RobotCoreNonResponsiveException(String var1) {
- super(var1);
- }
-}
diff --git a/FtcRobotController/app/src/main/java/com/qualcomm/robotcore/factory/RobotFactory.java b/FtcRobotController/app/src/main/java/com/qualcomm/robotcore/factory/RobotFactory.java
deleted file mode 100644
index eb40be0..0000000
--- a/FtcRobotController/app/src/main/java/com/qualcomm/robotcore/factory/RobotFactory.java
+++ /dev/null
@@ -1,17 +0,0 @@
-package com.qualcomm.robotcore.factory;
-
-import com.qualcomm.robotcore.eventloop.EventLoopManager;
-import com.qualcomm.robotcore.exception.RobotCoreException;
-import com.qualcomm.robotcore.robocol.RobocolDatagramSocket;
-import com.qualcomm.robotcore.robot.Robot;
-
-public class RobotFactory {
- public static Robot createRobot() throws RobotCoreException {
- RobocolDatagramSocket var0 = new RobocolDatagramSocket();
- EventLoopManager var1 = new EventLoopManager(var0);
- Robot var2 = new Robot();
- var2.eventLoopManager = var1;
- var2.socket = var0;
- return var2;
- }
-}
diff --git a/FtcRobotController/app/src/main/java/com/qualcomm/robotcore/hardware/AccelerationSensor.java b/FtcRobotController/app/src/main/java/com/qualcomm/robotcore/hardware/AccelerationSensor.java
deleted file mode 100644
index af4fe7d..0000000
--- a/FtcRobotController/app/src/main/java/com/qualcomm/robotcore/hardware/AccelerationSensor.java
+++ /dev/null
@@ -1,34 +0,0 @@
-package com.qualcomm.robotcore.hardware;
-
-import com.qualcomm.robotcore.hardware.HardwareDevice;
-
-public abstract class AccelerationSensor implements HardwareDevice {
- public abstract AccelerationSensor.Acceleration getAcceleration();
-
- public abstract String status();
-
- public String toString() {
- return this.getAcceleration().toString();
- }
-
- public static class Acceleration {
- public double x;
- public double y;
- public double z;
-
- public Acceleration() {
- this(0.0D, 0.0D, 0.0D);
- }
-
- public Acceleration(double var1, double var3, double var5) {
- this.x = var1;
- this.y = var3;
- this.z = var5;
- }
-
- public String toString() {
- Object[] var1 = new Object[]{Double.valueOf(this.x), Double.valueOf(this.y), Double.valueOf(this.z)};
- return String.format("Acceleration - x: %5.2f, y: %5.2f, z: %5.2f", var1);
- }
- }
-}
diff --git a/FtcRobotController/app/src/main/java/com/qualcomm/robotcore/hardware/AnalogInput.java b/FtcRobotController/app/src/main/java/com/qualcomm/robotcore/hardware/AnalogInput.java
deleted file mode 100644
index 0a7d04e..0000000
--- a/FtcRobotController/app/src/main/java/com/qualcomm/robotcore/hardware/AnalogInput.java
+++ /dev/null
@@ -1,33 +0,0 @@
-package com.qualcomm.robotcore.hardware;
-
-import com.qualcomm.robotcore.hardware.AnalogInputController;
-import com.qualcomm.robotcore.hardware.HardwareDevice;
-
-public class AnalogInput implements HardwareDevice {
- private AnalogInputController a = null;
- private int b = -1;
-
- public AnalogInput(AnalogInputController var1, int var2) {
- this.a = var1;
- this.b = var2;
- }
-
- public void close() {
- }
-
- public String getConnectionInfo() {
- return this.a.getConnectionInfo() + "; analog port " + this.b;
- }
-
- public String getDeviceName() {
- return "Analog Input";
- }
-
- public int getValue() {
- return this.a.getAnalogInputValue(this.b);
- }
-
- public int getVersion() {
- return 1;
- }
-}
diff --git a/FtcRobotController/app/src/main/java/com/qualcomm/robotcore/hardware/AnalogOutput.java b/FtcRobotController/app/src/main/java/com/qualcomm/robotcore/hardware/AnalogOutput.java
deleted file mode 100644
index d995735..0000000
--- a/FtcRobotController/app/src/main/java/com/qualcomm/robotcore/hardware/AnalogOutput.java
+++ /dev/null
@@ -1,41 +0,0 @@
-package com.qualcomm.robotcore.hardware;
-
-import com.qualcomm.robotcore.hardware.AnalogOutputController;
-import com.qualcomm.robotcore.hardware.HardwareDevice;
-
-public class AnalogOutput implements HardwareDevice {
- private AnalogOutputController a = null;
- private int b = -1;
-
- public AnalogOutput(AnalogOutputController var1, int var2) {
- this.a = var1;
- this.b = var2;
- }
-
- public void close() {
- }
-
- public String getConnectionInfo() {
- return this.a.getConnectionInfo() + "; analog port " + this.b;
- }
-
- public String getDeviceName() {
- return "Analog Output";
- }
-
- public int getVersion() {
- return 1;
- }
-
- public void setAnalogOutputFrequency(int var1) {
- this.a.setAnalogOutputFrequency(this.b, var1);
- }
-
- public void setAnalogOutputMode(byte var1) {
- this.a.setAnalogOutputMode(this.b, var1);
- }
-
- public void setAnalogOutputVoltage(int var1) {
- this.a.setAnalogOutputVoltage(this.b, var1);
- }
-}
diff --git a/FtcRobotController/app/src/main/java/com/qualcomm/robotcore/hardware/AnalogOutputController.java b/FtcRobotController/app/src/main/java/com/qualcomm/robotcore/hardware/AnalogOutputController.java
deleted file mode 100644
index c107cc6..0000000
--- a/FtcRobotController/app/src/main/java/com/qualcomm/robotcore/hardware/AnalogOutputController.java
+++ /dev/null
@@ -1,14 +0,0 @@
-package com.qualcomm.robotcore.hardware;
-
-import com.qualcomm.robotcore.hardware.HardwareDevice;
-import com.qualcomm.robotcore.util.SerialNumber;
-
-public interface AnalogOutputController extends HardwareDevice {
- SerialNumber getSerialNumber();
-
- void setAnalogOutputFrequency(int var1, int var2);
-
- void setAnalogOutputMode(int var1, byte var2);
-
- void setAnalogOutputVoltage(int var1, int var2);
-}
diff --git a/FtcRobotController/app/src/main/java/com/qualcomm/robotcore/hardware/ColorSensor.java b/FtcRobotController/app/src/main/java/com/qualcomm/robotcore/hardware/ColorSensor.java
deleted file mode 100644
index 6b87e60..0000000
--- a/FtcRobotController/app/src/main/java/com/qualcomm/robotcore/hardware/ColorSensor.java
+++ /dev/null
@@ -1,22 +0,0 @@
-package com.qualcomm.robotcore.hardware;
-
-import com.qualcomm.robotcore.hardware.HardwareDevice;
-
-public abstract class ColorSensor implements HardwareDevice {
- public abstract int alpha();
-
- public abstract int argb();
-
- public abstract int blue();
-
- public abstract void enableLed(boolean var1);
-
- public abstract int green();
-
- public abstract int red();
-
- public String toString() {
- Object[] var1 = new Object[]{Integer.valueOf(this.argb())};
- return String.format("argb: %d", var1);
- }
-}
diff --git a/FtcRobotController/app/src/main/java/com/qualcomm/robotcore/hardware/CompassSensor.java b/FtcRobotController/app/src/main/java/com/qualcomm/robotcore/hardware/CompassSensor.java
deleted file mode 100644
index 3b19076..0000000
--- a/FtcRobotController/app/src/main/java/com/qualcomm/robotcore/hardware/CompassSensor.java
+++ /dev/null
@@ -1,27 +0,0 @@
-package com.qualcomm.robotcore.hardware;
-
-import com.qualcomm.robotcore.hardware.HardwareDevice;
-
-public abstract class CompassSensor implements HardwareDevice {
- public abstract boolean calibrationFailed();
-
- public abstract double getDirection();
-
- public abstract void setMode(CompassSensor.CompassMode var1);
-
- public abstract String status();
-
- public String toString() {
- Object[] var1 = new Object[]{Double.valueOf(this.getDirection())};
- return String.format("Compass: %3.1f", var1);
- }
-
- public static enum CompassMode {
- CALIBRATION_MODE,
- MEASUREMENT_MODE;
-
- static {
- CompassSensor.CompassMode[] var0 = new CompassSensor.CompassMode[]{MEASUREMENT_MODE, CALIBRATION_MODE};
- }
- }
-}
diff --git a/FtcRobotController/app/src/main/java/com/qualcomm/robotcore/hardware/DcMotor.java b/FtcRobotController/app/src/main/java/com/qualcomm/robotcore/hardware/DcMotor.java
deleted file mode 100644
index fc95fdb..0000000
--- a/FtcRobotController/app/src/main/java/com/qualcomm/robotcore/hardware/DcMotor.java
+++ /dev/null
@@ -1,136 +0,0 @@
-package com.qualcomm.robotcore.hardware;
-
-import com.qualcomm.robotcore.hardware.DcMotorController;
-import com.qualcomm.robotcore.hardware.HardwareDevice;
-
-public class DcMotor implements HardwareDevice {
- protected DcMotorController controller;
- protected DcMotorController.DeviceMode devMode;
- protected DcMotor.Direction direction;
- protected DcMotorController.RunMode mode;
- protected int portNumber;
-
- public DcMotor(DcMotorController var1, int var2) {
- this(var1, var2, DcMotor.Direction.FORWARD);
- }
-
- public DcMotor(DcMotorController var1, int var2, DcMotor.Direction var3) {
- this.direction = DcMotor.Direction.FORWARD;
- this.controller = null;
- this.portNumber = -1;
- this.mode = DcMotorController.RunMode.RUN_WITHOUT_ENCODERS;
- this.devMode = DcMotorController.DeviceMode.WRITE_ONLY;
- this.controller = var1;
- this.portNumber = var2;
- this.direction = var3;
- }
-
- public void close() {
- this.setPowerFloat();
- }
-
- public DcMotorController.RunMode getChannelMode() {
- return this.controller.getMotorChannelMode(this.portNumber);
- }
-
- public String getConnectionInfo() {
- return this.controller.getConnectionInfo() + "; port " + this.portNumber;
- }
-
- public DcMotorController getController() {
- return this.controller;
- }
-
- public int getCurrentPosition() {
- int var1 = this.controller.getMotorCurrentPosition(this.portNumber);
- if(this.direction == DcMotor.Direction.REVERSE) {
- var1 *= -1;
- }
-
- return var1;
- }
-
- public String getDeviceName() {
- return "DC Motor";
- }
-
- public DcMotor.Direction getDirection() {
- return this.direction;
- }
-
- public int getPortNumber() {
- return this.portNumber;
- }
-
- public double getPower() {
- double var1 = this.controller.getMotorPower(this.portNumber);
- if(this.direction == DcMotor.Direction.REVERSE && var1 != 0.0D) {
- var1 *= -1.0D;
- }
-
- return var1;
- }
-
- public boolean getPowerFloat() {
- return this.controller.getMotorPowerFloat(this.portNumber);
- }
-
- public int getTargetPosition() {
- int var1 = this.controller.getMotorTargetPosition(this.portNumber);
- if(this.direction == DcMotor.Direction.REVERSE) {
- var1 *= -1;
- }
-
- return var1;
- }
-
- public int getVersion() {
- return 1;
- }
-
- public boolean isBusy() {
- return this.controller.isBusy(this.portNumber);
- }
-
- public void setChannelMode(DcMotorController.RunMode var1) {
- this.mode = var1;
- this.controller.setMotorChannelMode(this.portNumber, var1);
- }
-
- public void setDirection(DcMotor.Direction var1) {
- this.direction = var1;
- }
-
- public void setPower(double var1) {
- if(this.direction == DcMotor.Direction.REVERSE) {
- var1 *= -1.0D;
- }
-
- if(this.mode == DcMotorController.RunMode.RUN_TO_POSITION) {
- var1 = Math.abs(var1);
- }
-
- this.controller.setMotorPower(this.portNumber, var1);
- }
-
- public void setPowerFloat() {
- this.controller.setMotorPowerFloat(this.portNumber);
- }
-
- public void setTargetPosition(int var1) {
- if(this.direction == DcMotor.Direction.REVERSE) {
- var1 *= -1;
- }
-
- this.controller.setMotorTargetPosition(this.portNumber, var1);
- }
-
- public static enum Direction {
- FORWARD,
- REVERSE;
-
- static {
- DcMotor.Direction[] var0 = new DcMotor.Direction[]{FORWARD, REVERSE};
- }
- }
-}
diff --git a/FtcRobotController/app/src/main/java/com/qualcomm/robotcore/hardware/DcMotorController.java b/FtcRobotController/app/src/main/java/com/qualcomm/robotcore/hardware/DcMotorController.java
deleted file mode 100644
index f1d428f..0000000
--- a/FtcRobotController/app/src/main/java/com/qualcomm/robotcore/hardware/DcMotorController.java
+++ /dev/null
@@ -1,52 +0,0 @@
-package com.qualcomm.robotcore.hardware;
-
-import com.qualcomm.robotcore.hardware.HardwareDevice;
-
-public interface DcMotorController extends HardwareDevice {
- DcMotorController.RunMode getMotorChannelMode(int var1);
-
- DcMotorController.DeviceMode getMotorControllerDeviceMode();
-
- int getMotorCurrentPosition(int var1);
-
- double getMotorPower(int var1);
-
- boolean getMotorPowerFloat(int var1);
-
- int getMotorTargetPosition(int var1);
-
- boolean isBusy(int var1);
-
- void setMotorChannelMode(int var1, DcMotorController.RunMode var2);
-
- void setMotorControllerDeviceMode(DcMotorController.DeviceMode var1);
-
- void setMotorPower(int var1, double var2);
-
- void setMotorPowerFloat(int var1);
-
- void setMotorTargetPosition(int var1, int var2);
-
- public static enum DeviceMode {
- READ_ONLY,
- READ_WRITE,
- SWITCHING_TO_READ_MODE,
- SWITCHING_TO_WRITE_MODE,
- WRITE_ONLY;
-
- static {
- DcMotorController.DeviceMode[] var0 = new DcMotorController.DeviceMode[]{SWITCHING_TO_READ_MODE, SWITCHING_TO_WRITE_MODE, READ_ONLY, WRITE_ONLY, READ_WRITE};
- }
- }
-
- public static enum RunMode {
- RESET_ENCODERS,
- RUN_TO_POSITION,
- RUN_USING_ENCODERS,
- RUN_WITHOUT_ENCODERS;
-
- static {
- DcMotorController.RunMode[] var0 = new DcMotorController.RunMode[]{RUN_USING_ENCODERS, RUN_WITHOUT_ENCODERS, RUN_TO_POSITION, RESET_ENCODERS};
- }
- }
-}
diff --git a/FtcRobotController/app/src/main/java/com/qualcomm/robotcore/hardware/DeviceInterfaceModule.java b/FtcRobotController/app/src/main/java/com/qualcomm/robotcore/hardware/DeviceInterfaceModule.java
deleted file mode 100644
index e8eb9f0..0000000
--- a/FtcRobotController/app/src/main/java/com/qualcomm/robotcore/hardware/DeviceInterfaceModule.java
+++ /dev/null
@@ -1,23 +0,0 @@
-package com.qualcomm.robotcore.hardware;
-
-import com.qualcomm.robotcore.hardware.AnalogInputController;
-import com.qualcomm.robotcore.hardware.AnalogOutputController;
-import com.qualcomm.robotcore.hardware.DigitalChannelController;
-import com.qualcomm.robotcore.hardware.I2cController;
-import com.qualcomm.robotcore.hardware.PWMOutputController;
-
-public interface DeviceInterfaceModule extends AnalogInputController, AnalogOutputController, DigitalChannelController, I2cController, PWMOutputController {
- byte getDigitalIOControlByte();
-
- int getDigitalInputStateByte();
-
- byte getDigitalOutputStateByte();
-
- boolean getLEDState(int var1);
-
- void setDigitalIOControlByte(byte var1);
-
- void setDigitalOutputByte(byte var1);
-
- void setLED(int var1, boolean var2);
-}
diff --git a/FtcRobotController/app/src/main/java/com/qualcomm/robotcore/hardware/DeviceManager.java b/FtcRobotController/app/src/main/java/com/qualcomm/robotcore/hardware/DeviceManager.java
deleted file mode 100644
index 65be63b..0000000
--- a/FtcRobotController/app/src/main/java/com/qualcomm/robotcore/hardware/DeviceManager.java
+++ /dev/null
@@ -1,109 +0,0 @@
-package com.qualcomm.robotcore.hardware;
-
-import com.qualcomm.robotcore.exception.RobotCoreException;
-import com.qualcomm.robotcore.hardware.AccelerationSensor;
-import com.qualcomm.robotcore.hardware.AnalogInput;
-import com.qualcomm.robotcore.hardware.AnalogInputController;
-import com.qualcomm.robotcore.hardware.AnalogOutput;
-import com.qualcomm.robotcore.hardware.AnalogOutputController;
-import com.qualcomm.robotcore.hardware.ColorSensor;
-import com.qualcomm.robotcore.hardware.CompassSensor;
-import com.qualcomm.robotcore.hardware.DcMotor;
-import com.qualcomm.robotcore.hardware.DcMotorController;
-import com.qualcomm.robotcore.hardware.DeviceInterfaceModule;
-import com.qualcomm.robotcore.hardware.DigitalChannel;
-import com.qualcomm.robotcore.hardware.DigitalChannelController;
-import com.qualcomm.robotcore.hardware.GyroSensor;
-import com.qualcomm.robotcore.hardware.I2cController;
-import com.qualcomm.robotcore.hardware.I2cDevice;
-import com.qualcomm.robotcore.hardware.IrSeekerSensor;
-import com.qualcomm.robotcore.hardware.LED;
-import com.qualcomm.robotcore.hardware.LegacyModule;
-import com.qualcomm.robotcore.hardware.LightSensor;
-import com.qualcomm.robotcore.hardware.OpticalDistanceSensor;
-import com.qualcomm.robotcore.hardware.PWMOutput;
-import com.qualcomm.robotcore.hardware.Servo;
-import com.qualcomm.robotcore.hardware.ServoController;
-import com.qualcomm.robotcore.hardware.TouchSensor;
-import com.qualcomm.robotcore.hardware.TouchSensorMultiplexer;
-import com.qualcomm.robotcore.hardware.UltrasonicSensor;
-import com.qualcomm.robotcore.util.SerialNumber;
-import java.util.Map;
-
-public abstract class DeviceManager {
- public abstract ColorSensor createAdafruitI2cColorSensor(DeviceInterfaceModule var1, int var2);
-
- public abstract AnalogInput createAnalogInputDevice(AnalogInputController var1, int var2);
-
- public abstract OpticalDistanceSensor createAnalogOpticalDistanceSensor(DeviceInterfaceModule var1, int var2);
-
- public abstract AnalogOutput createAnalogOutputDevice(AnalogOutputController var1, int var2);
-
- public DcMotor createDcMotor(DcMotorController var1, int var2) {
- return new DcMotor(var1, var2, DcMotor.Direction.FORWARD);
- }
-
- public abstract DeviceInterfaceModule createDeviceInterfaceModule(SerialNumber var1) throws RobotCoreException, InterruptedException;
-
- public abstract DigitalChannel createDigitalChannelDevice(DigitalChannelController var1, int var2);
-
- public abstract TouchSensor createDigitalTouchSensor(DeviceInterfaceModule var1, int var2);
-
- public abstract I2cDevice createI2cDevice(I2cController var1, int var2);
-
- public abstract IrSeekerSensor createI2cIrSeekerSensorV3(DeviceInterfaceModule var1, int var2);
-
- public abstract LED createLED(DigitalChannelController var1, int var2);
-
- public abstract ColorSensor createModernRoboticsI2cColorSensor(DeviceInterfaceModule var1, int var2);
-
- public abstract AccelerationSensor createNxtAccelerationSensor(LegacyModule var1, int var2);
-
- public abstract ColorSensor createNxtColorSensor(LegacyModule var1, int var2);
-
- public abstract CompassSensor createNxtCompassSensor(LegacyModule var1, int var2);
-
- public abstract DcMotorController createNxtDcMotorController(LegacyModule var1, int var2);
-
- public abstract GyroSensor createNxtGyroSensor(LegacyModule var1, int var2);
-
- public abstract IrSeekerSensor createNxtIrSeekerSensor(LegacyModule var1, int var2);
-
- public abstract LightSensor createNxtLightSensor(LegacyModule var1, int var2);
-
- public abstract ServoController createNxtServoController(LegacyModule var1, int var2);
-
- public abstract TouchSensor createNxtTouchSensor(LegacyModule var1, int var2);
-
- public abstract TouchSensorMultiplexer createNxtTouchSensorMultiplexer(LegacyModule var1, int var2);
-
- public abstract UltrasonicSensor createNxtUltrasonicSensor(LegacyModule var1, int var2);
-
- public abstract PWMOutput createPwmOutputDevice(DeviceInterfaceModule var1, int var2);
-
- public Servo createServo(ServoController var1, int var2) {
- return new Servo(var1, var2, Servo.Direction.FORWARD);
- }
-
- public abstract DcMotorController createUsbDcMotorController(SerialNumber var1) throws RobotCoreException, InterruptedException;
-
- public abstract LegacyModule createUsbLegacyModule(SerialNumber var1) throws RobotCoreException, InterruptedException;
-
- public abstract ServoController createUsbServoController(SerialNumber var1) throws RobotCoreException, InterruptedException;
-
- public abstract Map scanForUsbDevices() throws RobotCoreException;
-
- public static enum DeviceType {
- FTDI_USB_UNKNOWN_DEVICE,
- MODERN_ROBOTICS_USB_DC_MOTOR_CONTROLLER,
- MODERN_ROBOTICS_USB_DEVICE_INTERFACE_MODULE,
- MODERN_ROBOTICS_USB_LEGACY_MODULE,
- MODERN_ROBOTICS_USB_SENSOR_MUX,
- MODERN_ROBOTICS_USB_SERVO_CONTROLLER,
- MODERN_ROBOTICS_USB_UNKNOWN_DEVICE;
-
- static {
- DeviceManager.DeviceType[] var0 = new DeviceManager.DeviceType[]{FTDI_USB_UNKNOWN_DEVICE, MODERN_ROBOTICS_USB_UNKNOWN_DEVICE, MODERN_ROBOTICS_USB_DC_MOTOR_CONTROLLER, MODERN_ROBOTICS_USB_SERVO_CONTROLLER, MODERN_ROBOTICS_USB_LEGACY_MODULE, MODERN_ROBOTICS_USB_DEVICE_INTERFACE_MODULE, MODERN_ROBOTICS_USB_SENSOR_MUX};
- }
- }
-}
diff --git a/FtcRobotController/app/src/main/java/com/qualcomm/robotcore/hardware/DigitalChannel.java b/FtcRobotController/app/src/main/java/com/qualcomm/robotcore/hardware/DigitalChannel.java
deleted file mode 100644
index 6cf03ff..0000000
--- a/FtcRobotController/app/src/main/java/com/qualcomm/robotcore/hardware/DigitalChannel.java
+++ /dev/null
@@ -1,45 +0,0 @@
-package com.qualcomm.robotcore.hardware;
-
-import com.qualcomm.robotcore.hardware.DigitalChannelController;
-import com.qualcomm.robotcore.hardware.HardwareDevice;
-
-public class DigitalChannel implements HardwareDevice {
- private DigitalChannelController a = null;
- private int b = -1;
-
- public DigitalChannel(DigitalChannelController var1, int var2) {
- this.a = var1;
- this.b = var2;
- }
-
- public void close() {
- }
-
- public String getConnectionInfo() {
- return this.a.getConnectionInfo() + "; digital port " + this.b;
- }
-
- public String getDeviceName() {
- return "Digital Channel";
- }
-
- public DigitalChannelController.Mode getMode() {
- return this.a.getDigitalChannelMode(this.b);
- }
-
- public boolean getState() {
- return this.a.getDigitalChannelState(this.b);
- }
-
- public int getVersion() {
- return 1;
- }
-
- public void setMode(DigitalChannelController.Mode var1) {
- this.a.setDigitalChannelMode(this.b, var1);
- }
-
- public void setState(boolean var1) {
- this.a.setDigitalChannelState(this.b, var1);
- }
-}
diff --git a/FtcRobotController/app/src/main/java/com/qualcomm/robotcore/hardware/DigitalChannelController.java b/FtcRobotController/app/src/main/java/com/qualcomm/robotcore/hardware/DigitalChannelController.java
deleted file mode 100644
index 2d9a82c..0000000
--- a/FtcRobotController/app/src/main/java/com/qualcomm/robotcore/hardware/DigitalChannelController.java
+++ /dev/null
@@ -1,25 +0,0 @@
-package com.qualcomm.robotcore.hardware;
-
-import com.qualcomm.robotcore.hardware.HardwareDevice;
-import com.qualcomm.robotcore.util.SerialNumber;
-
-public interface DigitalChannelController extends HardwareDevice {
- DigitalChannelController.Mode getDigitalChannelMode(int var1);
-
- boolean getDigitalChannelState(int var1);
-
- SerialNumber getSerialNumber();
-
- void setDigitalChannelMode(int var1, DigitalChannelController.Mode var2);
-
- void setDigitalChannelState(int var1, boolean var2);
-
- public static enum Mode {
- INPUT,
- OUTPUT;
-
- static {
- DigitalChannelController.Mode[] var0 = new DigitalChannelController.Mode[]{INPUT, OUTPUT};
- }
- }
-}
diff --git a/FtcRobotController/app/src/main/java/com/qualcomm/robotcore/hardware/GyroSensor.java b/FtcRobotController/app/src/main/java/com/qualcomm/robotcore/hardware/GyroSensor.java
deleted file mode 100644
index f3108f6..0000000
--- a/FtcRobotController/app/src/main/java/com/qualcomm/robotcore/hardware/GyroSensor.java
+++ /dev/null
@@ -1,14 +0,0 @@
-package com.qualcomm.robotcore.hardware;
-
-import com.qualcomm.robotcore.hardware.HardwareDevice;
-
-public abstract class GyroSensor implements HardwareDevice {
- public abstract double getRotation();
-
- public abstract String status();
-
- public String toString() {
- Object[] var1 = new Object[]{Double.valueOf(this.getRotation())};
- return String.format("Gyro: %3.1f", var1);
- }
-}
diff --git a/FtcRobotController/app/src/main/java/com/qualcomm/robotcore/hardware/HardwareDevice.java b/FtcRobotController/app/src/main/java/com/qualcomm/robotcore/hardware/HardwareDevice.java
deleted file mode 100644
index db3772c..0000000
--- a/FtcRobotController/app/src/main/java/com/qualcomm/robotcore/hardware/HardwareDevice.java
+++ /dev/null
@@ -1,11 +0,0 @@
-package com.qualcomm.robotcore.hardware;
-
-public interface HardwareDevice {
- void close();
-
- String getConnectionInfo();
-
- String getDeviceName();
-
- int getVersion();
-}
diff --git a/FtcRobotController/app/src/main/java/com/qualcomm/robotcore/hardware/HardwareMap.java b/FtcRobotController/app/src/main/java/com/qualcomm/robotcore/hardware/HardwareMap.java
deleted file mode 100644
index a428653..0000000
--- a/FtcRobotController/app/src/main/java/com/qualcomm/robotcore/hardware/HardwareMap.java
+++ /dev/null
@@ -1,134 +0,0 @@
-package com.qualcomm.robotcore.hardware;
-
-import android.content.Context;
-import com.qualcomm.robotcore.hardware.AccelerationSensor;
-import com.qualcomm.robotcore.hardware.AnalogInput;
-import com.qualcomm.robotcore.hardware.AnalogOutput;
-import com.qualcomm.robotcore.hardware.ColorSensor;
-import com.qualcomm.robotcore.hardware.CompassSensor;
-import com.qualcomm.robotcore.hardware.DcMotor;
-import com.qualcomm.robotcore.hardware.DcMotorController;
-import com.qualcomm.robotcore.hardware.DeviceInterfaceModule;
-import com.qualcomm.robotcore.hardware.DigitalChannel;
-import com.qualcomm.robotcore.hardware.GyroSensor;
-import com.qualcomm.robotcore.hardware.HardwareDevice;
-import com.qualcomm.robotcore.hardware.I2cDevice;
-import com.qualcomm.robotcore.hardware.IrSeekerSensor;
-import com.qualcomm.robotcore.hardware.LED;
-import com.qualcomm.robotcore.hardware.LegacyModule;
-import com.qualcomm.robotcore.hardware.LightSensor;
-import com.qualcomm.robotcore.hardware.OpticalDistanceSensor;
-import com.qualcomm.robotcore.hardware.PWMOutput;
-import com.qualcomm.robotcore.hardware.Servo;
-import com.qualcomm.robotcore.hardware.ServoController;
-import com.qualcomm.robotcore.hardware.TouchSensor;
-import com.qualcomm.robotcore.hardware.TouchSensorMultiplexer;
-import com.qualcomm.robotcore.hardware.UltrasonicSensor;
-import com.qualcomm.robotcore.hardware.VoltageSensor;
-import com.qualcomm.robotcore.util.RobotLog;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.Map;
-import java.util.Set;
-import java.util.Map.Entry;
-
-public class HardwareMap {
- public HardwareMap.DeviceMapping accelerationSensor = new HardwareMap.DeviceMapping();
- public HardwareMap.DeviceMapping analogInput = new HardwareMap.DeviceMapping();
- public HardwareMap.DeviceMapping analogOutput = new HardwareMap.DeviceMapping();
- public Context appContext = null;
- public HardwareMap.DeviceMapping colorSensor = new HardwareMap.DeviceMapping();
- public HardwareMap.DeviceMapping compassSensor = new HardwareMap.DeviceMapping();
- public HardwareMap.DeviceMapping dcMotor = new HardwareMap.DeviceMapping();
- public HardwareMap.DeviceMapping dcMotorController = new HardwareMap.DeviceMapping();
- public HardwareMap.DeviceMapping deviceInterfaceModule = new HardwareMap.DeviceMapping();
- public HardwareMap.DeviceMapping digitalChannel = new HardwareMap.DeviceMapping();
- public HardwareMap.DeviceMapping gyroSensor = new HardwareMap.DeviceMapping();
- public HardwareMap.DeviceMapping i2cDevice = new HardwareMap.DeviceMapping();
- public HardwareMap.DeviceMapping irSeekerSensor = new HardwareMap.DeviceMapping();
- public HardwareMap.DeviceMapping led = new HardwareMap.DeviceMapping();
- public HardwareMap.DeviceMapping legacyModule = new HardwareMap.DeviceMapping();
- public HardwareMap.DeviceMapping lightSensor = new HardwareMap.DeviceMapping();
- public HardwareMap.DeviceMapping opticalDistanceSensor = new HardwareMap.DeviceMapping();
- public HardwareMap.DeviceMapping pwmOutput = new HardwareMap.DeviceMapping();
- public HardwareMap.DeviceMapping servo = new HardwareMap.DeviceMapping();
- public HardwareMap.DeviceMapping servoController = new HardwareMap.DeviceMapping();
- public HardwareMap.DeviceMapping touchSensor = new HardwareMap.DeviceMapping();
- public HardwareMap.DeviceMapping touchSensorMultiplexer = new HardwareMap.DeviceMapping();
- public HardwareMap.DeviceMapping ultrasonicSensor = new HardwareMap.DeviceMapping();
- public HardwareMap.DeviceMapping voltageSensor = new HardwareMap.DeviceMapping();
-
- public void logDevices() {
- RobotLog.i("========= Device Information ===================================================");
- RobotLog.i(String.format("%-45s %-30s %s", new Object[]{"Type", "Name", "Connection"}));
- this.dcMotorController.logDevices();
- this.dcMotor.logDevices();
- this.servoController.logDevices();
- this.servo.logDevices();
- this.legacyModule.logDevices();
- this.touchSensorMultiplexer.logDevices();
- this.deviceInterfaceModule.logDevices();
- this.analogInput.logDevices();
- this.digitalChannel.logDevices();
- this.opticalDistanceSensor.logDevices();
- this.touchSensor.logDevices();
- this.pwmOutput.logDevices();
- this.i2cDevice.logDevices();
- this.analogOutput.logDevices();
- this.colorSensor.logDevices();
- this.led.logDevices();
- this.accelerationSensor.logDevices();
- this.compassSensor.logDevices();
- this.gyroSensor.logDevices();
- this.irSeekerSensor.logDevices();
- this.lightSensor.logDevices();
- this.ultrasonicSensor.logDevices();
- this.voltageSensor.logDevices();
- }
-
- public static class DeviceMapping implements Iterable {
- private Map a = new HashMap();
-
- public Set> entrySet() {
- return this.a.entrySet();
- }
-
- public DEVICE_TYPE get(String var1) {
- Object var2 = this.a.get(var1);
- if(var2 == null) {
- throw new IllegalArgumentException(String.format("Unable to find a hardware device with the name \"%s\"", new Object[]{var1}));
- } else {
- return var2;
- }
- }
-
- public Iterator iterator() {
- return this.a.values().iterator();
- }
-
- public void logDevices() {
- if(!this.a.isEmpty()) {
- Iterator var1 = this.a.entrySet().iterator();
-
- while(var1.hasNext()) {
- Entry var2 = (Entry)var1.next();
- if(var2.getValue() instanceof HardwareDevice) {
- HardwareDevice var3 = (HardwareDevice)var2.getValue();
- String var4 = var3.getConnectionInfo();
- String var5 = (String)var2.getKey();
- RobotLog.i(String.format("%-45s %-30s %s", new Object[]{var3.getDeviceName(), var5, var4}));
- }
- }
- }
-
- }
-
- public void put(String var1, DEVICE_TYPE var2) {
- this.a.put(var1, var2);
- }
-
- public int size() {
- return this.a.size();
- }
- }
-}
diff --git a/FtcRobotController/app/src/main/java/com/qualcomm/robotcore/hardware/I2cController.java b/FtcRobotController/app/src/main/java/com/qualcomm/robotcore/hardware/I2cController.java
deleted file mode 100644
index 2c512e2..0000000
--- a/FtcRobotController/app/src/main/java/com/qualcomm/robotcore/hardware/I2cController.java
+++ /dev/null
@@ -1,62 +0,0 @@
-package com.qualcomm.robotcore.hardware;
-
-import com.qualcomm.robotcore.hardware.HardwareDevice;
-import com.qualcomm.robotcore.util.SerialNumber;
-import java.util.concurrent.locks.Lock;
-
-public interface I2cController extends HardwareDevice {
- byte I2C_BUFFER_START_ADDRESS = 4;
-
- void copyBufferIntoWriteBuffer(int var1, byte[] var2);
-
- void deregisterForPortReadyCallback(int var1);
-
- void enableI2cReadMode(int var1, int var2, int var3, int var4);
-
- void enableI2cWriteMode(int var1, int var2, int var3, int var4);
-
- byte[] getCopyOfReadBuffer(int var1);
-
- byte[] getCopyOfWriteBuffer(int var1);
-
- byte[] getI2cReadCache(int var1);
-
- Lock getI2cReadCacheLock(int var1);
-
- byte[] getI2cWriteCache(int var1);
-
- Lock getI2cWriteCacheLock(int var1);
-
- SerialNumber getSerialNumber();
-
- boolean isI2cPortActionFlagSet(int var1);
-
- boolean isI2cPortInReadMode(int var1);
-
- boolean isI2cPortInWriteMode(int var1);
-
- boolean isI2cPortReady(int var1);
-
- void readI2cCacheFromController(int var1);
-
- @Deprecated
- void readI2cCacheFromModule(int var1);
-
- void registerForI2cPortReadyCallback(I2cController.I2cPortReadyCallback var1, int var2);
-
- void setI2cPortActionFlag(int var1);
-
- void writeI2cCacheToController(int var1);
-
- @Deprecated
- void writeI2cCacheToModule(int var1);
-
- void writeI2cPortFlagOnlyToController(int var1);
-
- @Deprecated
- void writeI2cPortFlagOnlyToModule(int var1);
-
- public interface I2cPortReadyCallback {
- void portIsReady(int var1);
- }
-}
diff --git a/FtcRobotController/app/src/main/java/com/qualcomm/robotcore/hardware/I2cDevice.java b/FtcRobotController/app/src/main/java/com/qualcomm/robotcore/hardware/I2cDevice.java
deleted file mode 100644
index 7e08f8d..0000000
--- a/FtcRobotController/app/src/main/java/com/qualcomm/robotcore/hardware/I2cDevice.java
+++ /dev/null
@@ -1,121 +0,0 @@
-package com.qualcomm.robotcore.hardware;
-
-import com.qualcomm.robotcore.hardware.HardwareDevice;
-import com.qualcomm.robotcore.hardware.I2cController;
-import java.util.concurrent.locks.Lock;
-
-public class I2cDevice implements HardwareDevice {
- private I2cController a = null;
- private int b = -1;
-
- public I2cDevice(I2cController var1, int var2) {
- this.a = var1;
- this.b = var2;
- }
-
- public void close() {
- }
-
- public void copyBufferIntoWriteBuffer(byte[] var1) {
- this.a.copyBufferIntoWriteBuffer(this.b, var1);
- }
-
- public void deregisterForPortReadyCallback() {
- this.a.deregisterForPortReadyCallback(this.b);
- }
-
- public void enableI2cReadMode(int var1, int var2, int var3) {
- this.a.enableI2cReadMode(this.b, var1, var2, var3);
- }
-
- public void enableI2cWriteMode(int var1, int var2, int var3) {
- this.a.enableI2cWriteMode(this.b, var1, var2, var3);
- }
-
- public String getConnectionInfo() {
- return this.a.getConnectionInfo() + "; port " + this.b;
- }
-
- public byte[] getCopyOfReadBuffer() {
- return this.a.getCopyOfReadBuffer(this.b);
- }
-
- public byte[] getCopyOfWriteBuffer() {
- return this.a.getCopyOfWriteBuffer(this.b);
- }
-
- public String getDeviceName() {
- return "I2cDevice";
- }
-
- public byte[] getI2cReadCache() {
- return this.a.getI2cReadCache(this.b);
- }
-
- public Lock getI2cReadCacheLock() {
- return this.a.getI2cReadCacheLock(this.b);
- }
-
- public byte[] getI2cWriteCache() {
- return this.a.getI2cWriteCache(this.b);
- }
-
- public Lock getI2cWriteCacheLock() {
- return this.a.getI2cWriteCacheLock(this.b);
- }
-
- public int getVersion() {
- return 1;
- }
-
- public boolean isI2cPortActionFlagSet() {
- return this.a.isI2cPortActionFlagSet(this.b);
- }
-
- public boolean isI2cPortInReadMode() {
- return this.a.isI2cPortInReadMode(this.b);
- }
-
- public boolean isI2cPortInWriteMode() {
- return this.a.isI2cPortInWriteMode(this.b);
- }
-
- public boolean isI2cPortReady() {
- return this.a.isI2cPortReady(this.b);
- }
-
- public void readI2cCacheFromController() {
- this.a.readI2cCacheFromController(this.b);
- }
-
- @Deprecated
- public void readI2cCacheFromModule() {
- this.readI2cCacheFromController();
- }
-
- public void registerForI2cPortReadyCallback(I2cController.I2cPortReadyCallback var1) {
- this.a.registerForI2cPortReadyCallback(var1, this.b);
- }
-
- public void setI2cPortActionFlag() {
- this.a.setI2cPortActionFlag(this.b);
- }
-
- public void writeI2cCacheToController() {
- this.a.writeI2cCacheToController(this.b);
- }
-
- @Deprecated
- public void writeI2cCacheToModule() {
- this.writeI2cCacheToController();
- }
-
- public void writeI2cPortFlagOnlyToController() {
- this.a.writeI2cPortFlagOnlyToController(this.b);
- }
-
- @Deprecated
- public void writeI2cPortFlagOnlyToModule() {
- this.writeI2cPortFlagOnlyToController();
- }
-}
diff --git a/FtcRobotController/app/src/main/java/com/qualcomm/robotcore/hardware/I2cDeviceReader.java b/FtcRobotController/app/src/main/java/com/qualcomm/robotcore/hardware/I2cDeviceReader.java
deleted file mode 100644
index aaac1f2..0000000
--- a/FtcRobotController/app/src/main/java/com/qualcomm/robotcore/hardware/I2cDeviceReader.java
+++ /dev/null
@@ -1,30 +0,0 @@
-package com.qualcomm.robotcore.hardware;
-
-import com.qualcomm.robotcore.hardware.I2cController;
-import com.qualcomm.robotcore.hardware.I2cDevice;
-
-public class I2cDeviceReader {
- private final I2cDevice a;
-
- public I2cDeviceReader(I2cDevice var1, int var2, int var3, int var4) {
- this.a = var1;
- var1.enableI2cReadMode(var2, var3, var4);
- var1.setI2cPortActionFlag();
- var1.writeI2cCacheToModule();
- var1.registerForI2cPortReadyCallback(new I2cController.I2cPortReadyCallback() {
- public void portIsReady(int var1) {
- I2cDeviceReader.this.a();
- }
- });
- }
-
- private void a() {
- this.a.setI2cPortActionFlag();
- this.a.readI2cCacheFromModule();
- this.a.writeI2cPortFlagOnlyToModule();
- }
-
- public byte[] getReadBuffer() {
- return this.a.getCopyOfReadBuffer();
- }
-}
diff --git a/FtcRobotController/app/src/main/java/com/qualcomm/robotcore/hardware/IrSeekerSensor.java b/FtcRobotController/app/src/main/java/com/qualcomm/robotcore/hardware/IrSeekerSensor.java
deleted file mode 100644
index e240560..0000000
--- a/FtcRobotController/app/src/main/java/com/qualcomm/robotcore/hardware/IrSeekerSensor.java
+++ /dev/null
@@ -1,87 +0,0 @@
-package com.qualcomm.robotcore.hardware;
-
-import com.qualcomm.robotcore.hardware.HardwareDevice;
-
-public abstract class IrSeekerSensor implements HardwareDevice {
- public static final int MAX_NEW_I2C_ADDRESS = 126;
- public static final int MIN_NEW_I2C_ADDRESS = 16;
-
- public static void throwIfModernRoboticsI2cAddressIsInvalid(int var0) {
- if(var0 >= 16 && var0 <= 126) {
- if(var0 % 2 != 0) {
- Object[] var2 = new Object[]{Integer.valueOf(var0)};
- throw new IllegalArgumentException(String.format("New I2C address %d is invalid; the address must be even.", var2));
- }
- } else {
- Object[] var1 = new Object[]{Integer.valueOf(var0), Integer.valueOf(16), Integer.valueOf(126)};
- throw new IllegalArgumentException(String.format("New I2C address %d is invalid; valid range is: %d..%d", var1));
- }
- }
-
- public abstract double getAngle();
-
- public abstract int getI2cAddress();
-
- public abstract IrSeekerSensor.IrSeekerIndividualSensor[] getIndividualSensors();
-
- public abstract IrSeekerSensor.Mode getMode();
-
- public abstract double getSignalDetectedThreshold();
-
- public abstract double getStrength();
-
- public abstract void setI2cAddress(int var1);
-
- public abstract void setMode(IrSeekerSensor.Mode var1);
-
- public abstract void setSignalDetectedThreshold(double var1);
-
- public abstract boolean signalDetected();
-
- public String toString() {
- if(this.signalDetected()) {
- Object[] var1 = new Object[]{Double.valueOf(100.0D * this.getStrength()), Double.valueOf(this.getAngle())};
- return String.format("IR Seeker: %3.0f%% signal at %6.1f degrees", var1);
- } else {
- return "IR Seeker: --% signal at ---.- degrees";
- }
- }
-
- public static class IrSeekerIndividualSensor {
- private double a;
- private double b;
-
- public IrSeekerIndividualSensor() {
- this(0.0D, 0.0D);
- }
-
- public IrSeekerIndividualSensor(double var1, double var3) {
- this.a = 0.0D;
- this.b = 0.0D;
- this.a = var1;
- this.b = var3;
- }
-
- public double getSensorAngle() {
- return this.a;
- }
-
- public double getSensorStrength() {
- return this.b;
- }
-
- public String toString() {
- Object[] var1 = new Object[]{Double.valueOf(this.a), Double.valueOf(100.0D * this.b)};
- return String.format("IR Sensor: %3.1f degrees at %3.1f%% power", var1);
- }
- }
-
- public static enum Mode {
- MODE_1200HZ,
- MODE_600HZ;
-
- static {
- IrSeekerSensor.Mode[] var0 = new IrSeekerSensor.Mode[]{MODE_600HZ, MODE_1200HZ};
- }
- }
-}
diff --git a/FtcRobotController/app/src/main/java/com/qualcomm/robotcore/hardware/LED.java b/FtcRobotController/app/src/main/java/com/qualcomm/robotcore/hardware/LED.java
deleted file mode 100644
index 03c0b07..0000000
--- a/FtcRobotController/app/src/main/java/com/qualcomm/robotcore/hardware/LED.java
+++ /dev/null
@@ -1,34 +0,0 @@
-package com.qualcomm.robotcore.hardware;
-
-import com.qualcomm.robotcore.hardware.DigitalChannelController;
-import com.qualcomm.robotcore.hardware.HardwareDevice;
-
-public class LED implements HardwareDevice {
- private DigitalChannelController a = null;
- private int b = -1;
-
- public LED(DigitalChannelController var1, int var2) {
- this.a = var1;
- this.b = var2;
- var1.setDigitalChannelMode(var2, DigitalChannelController.Mode.OUTPUT);
- }
-
- public void close() {
- }
-
- public void enable(boolean var1) {
- this.a.setDigitalChannelState(this.b, var1);
- }
-
- public String getConnectionInfo() {
- return null;
- }
-
- public String getDeviceName() {
- return null;
- }
-
- public int getVersion() {
- return 0;
- }
-}
diff --git a/FtcRobotController/app/src/main/java/com/qualcomm/robotcore/hardware/LegacyModule.java b/FtcRobotController/app/src/main/java/com/qualcomm/robotcore/hardware/LegacyModule.java
deleted file mode 100644
index 147ead3..0000000
--- a/FtcRobotController/app/src/main/java/com/qualcomm/robotcore/hardware/LegacyModule.java
+++ /dev/null
@@ -1,14 +0,0 @@
-package com.qualcomm.robotcore.hardware;
-
-import com.qualcomm.robotcore.hardware.HardwareDevice;
-import com.qualcomm.robotcore.hardware.I2cController;
-
-public interface LegacyModule extends HardwareDevice, I2cController {
- void enable9v(int var1, boolean var2);
-
- void enableAnalogReadMode(int var1);
-
- byte[] readAnalog(int var1);
-
- void setDigitalLine(int var1, int var2, boolean var3);
-}
diff --git a/FtcRobotController/app/src/main/java/com/qualcomm/robotcore/hardware/LightSensor.java b/FtcRobotController/app/src/main/java/com/qualcomm/robotcore/hardware/LightSensor.java
deleted file mode 100644
index c743ab3..0000000
--- a/FtcRobotController/app/src/main/java/com/qualcomm/robotcore/hardware/LightSensor.java
+++ /dev/null
@@ -1,18 +0,0 @@
-package com.qualcomm.robotcore.hardware;
-
-import com.qualcomm.robotcore.hardware.HardwareDevice;
-
-public abstract class LightSensor implements HardwareDevice {
- public abstract void enableLed(boolean var1);
-
- public abstract double getLightDetected();
-
- public abstract int getLightDetectedRaw();
-
- public abstract String status();
-
- public String toString() {
- Object[] var1 = new Object[]{Double.valueOf(this.getLightDetected())};
- return String.format("Light Level: %1.2f", var1);
- }
-}
diff --git a/FtcRobotController/app/src/main/java/com/qualcomm/robotcore/hardware/OpticalDistanceSensor.java b/FtcRobotController/app/src/main/java/com/qualcomm/robotcore/hardware/OpticalDistanceSensor.java
deleted file mode 100644
index 68d91c0..0000000
--- a/FtcRobotController/app/src/main/java/com/qualcomm/robotcore/hardware/OpticalDistanceSensor.java
+++ /dev/null
@@ -1,10 +0,0 @@
-package com.qualcomm.robotcore.hardware;
-
-import com.qualcomm.robotcore.hardware.LightSensor;
-
-public abstract class OpticalDistanceSensor extends LightSensor {
- public String toString() {
- Object[] var1 = new Object[]{Double.valueOf(this.getLightDetected())};
- return String.format("OpticalDistanceSensor: %d", var1);
- }
-}
diff --git a/FtcRobotController/app/src/main/java/com/qualcomm/robotcore/hardware/PWMOutput.java b/FtcRobotController/app/src/main/java/com/qualcomm/robotcore/hardware/PWMOutput.java
deleted file mode 100644
index 8ad02ae..0000000
--- a/FtcRobotController/app/src/main/java/com/qualcomm/robotcore/hardware/PWMOutput.java
+++ /dev/null
@@ -1,45 +0,0 @@
-package com.qualcomm.robotcore.hardware;
-
-import com.qualcomm.robotcore.hardware.HardwareDevice;
-import com.qualcomm.robotcore.hardware.PWMOutputController;
-
-public class PWMOutput implements HardwareDevice {
- private PWMOutputController a = null;
- private int b = -1;
-
- public PWMOutput(PWMOutputController var1, int var2) {
- this.a = var1;
- this.b = var2;
- }
-
- public void close() {
- }
-
- public String getConnectionInfo() {
- return this.a.getConnectionInfo() + "; port " + this.b;
- }
-
- public String getDeviceName() {
- return "PWM Output";
- }
-
- public int getPulseWidthOutputTime() {
- return this.a.getPulseWidthOutputTime(this.b);
- }
-
- public int getPulseWidthPeriod() {
- return this.a.getPulseWidthPeriod(this.b);
- }
-
- public int getVersion() {
- return 1;
- }
-
- public void setPulseWidthOutputTime(int var1) {
- this.a.setPulseWidthOutputTime(this.b, var1);
- }
-
- public void setPulseWidthPeriod(int var1) {
- this.a.setPulseWidthPeriod(this.b, var1);
- }
-}
diff --git a/FtcRobotController/app/src/main/java/com/qualcomm/robotcore/hardware/PWMOutputController.java b/FtcRobotController/app/src/main/java/com/qualcomm/robotcore/hardware/PWMOutputController.java
deleted file mode 100644
index 7a499be..0000000
--- a/FtcRobotController/app/src/main/java/com/qualcomm/robotcore/hardware/PWMOutputController.java
+++ /dev/null
@@ -1,16 +0,0 @@
-package com.qualcomm.robotcore.hardware;
-
-import com.qualcomm.robotcore.hardware.HardwareDevice;
-import com.qualcomm.robotcore.util.SerialNumber;
-
-public interface PWMOutputController extends HardwareDevice {
- int getPulseWidthOutputTime(int var1);
-
- int getPulseWidthPeriod(int var1);
-
- SerialNumber getSerialNumber();
-
- void setPulseWidthOutputTime(int var1, int var2);
-
- void setPulseWidthPeriod(int var1, int var2);
-}
diff --git a/FtcRobotController/app/src/main/java/com/qualcomm/robotcore/hardware/Servo.java b/FtcRobotController/app/src/main/java/com/qualcomm/robotcore/hardware/Servo.java
deleted file mode 100644
index 0709f71..0000000
--- a/FtcRobotController/app/src/main/java/com/qualcomm/robotcore/hardware/Servo.java
+++ /dev/null
@@ -1,105 +0,0 @@
-package com.qualcomm.robotcore.hardware;
-
-import com.qualcomm.robotcore.hardware.HardwareDevice;
-import com.qualcomm.robotcore.hardware.ServoController;
-import com.qualcomm.robotcore.util.Range;
-
-public class Servo implements HardwareDevice {
- public static final double MAX_POSITION = 1.0D;
- public static final double MIN_POSITION;
- protected ServoController controller;
- protected Servo.Direction direction;
- protected double maxPosition;
- protected double minPosition;
- protected int portNumber;
-
- public Servo(ServoController var1, int var2) {
- this(var1, var2, Servo.Direction.FORWARD);
- }
-
- public Servo(ServoController var1, int var2, Servo.Direction var3) {
- this.controller = null;
- this.portNumber = -1;
- this.direction = Servo.Direction.FORWARD;
- this.minPosition = 0.0D;
- this.maxPosition = 1.0D;
- this.direction = var3;
- this.controller = var1;
- this.portNumber = var2;
- }
-
- private double a(double var1) {
- return 0.0D + (1.0D - var1);
- }
-
- public void close() {
- }
-
- public String getConnectionInfo() {
- return this.controller.getConnectionInfo() + "; port " + this.portNumber;
- }
-
- public ServoController getController() {
- return this.controller;
- }
-
- public String getDeviceName() {
- return "Servo";
- }
-
- public Servo.Direction getDirection() {
- return this.direction;
- }
-
- public int getPortNumber() {
- return this.portNumber;
- }
-
- public double getPosition() {
- double var1 = this.controller.getServoPosition(this.portNumber);
- if(this.direction == Servo.Direction.REVERSE) {
- var1 = this.a(var1);
- }
-
- return Range.clip(Range.scale(var1, this.minPosition, this.maxPosition, 0.0D, 1.0D), 0.0D, 1.0D);
- }
-
- public int getVersion() {
- return 1;
- }
-
- public void scaleRange(double var1, double var3) throws IllegalArgumentException {
- Range.throwIfRangeIsInvalid(var1, 0.0D, 1.0D);
- Range.throwIfRangeIsInvalid(var3, 0.0D, 1.0D);
- if(var1 >= var3) {
- throw new IllegalArgumentException("min must be less than max");
- } else {
- this.minPosition = var1;
- this.maxPosition = var3;
- }
- }
-
- public void setDirection(Servo.Direction var1) {
- this.direction = var1;
- }
-
- public void setPosition(double var1) {
- if(this.direction == Servo.Direction.REVERSE) {
- var1 = this.a(var1);
- }
-
- double var3 = this.minPosition;
- double var5 = this.maxPosition;
- double var7 = Range.scale(var1, 0.0D, 1.0D, var3, var5);
- this.controller.setServoPosition(this.portNumber, var7);
- }
-
- public static enum Direction {
- FORWARD,
- REVERSE;
-
- static {
- Servo.Direction[] var0 = new Servo.Direction[]{FORWARD, REVERSE};
- }
- }
-}
diff --git a/FtcRobotController/app/src/main/java/com/qualcomm/robotcore/hardware/ServoController.java b/FtcRobotController/app/src/main/java/com/qualcomm/robotcore/hardware/ServoController.java
deleted file mode 100644
index 54e9830..0000000
--- a/FtcRobotController/app/src/main/java/com/qualcomm/robotcore/hardware/ServoController.java
+++ /dev/null
@@ -1,24 +0,0 @@
-package com.qualcomm.robotcore.hardware;
-
-import com.qualcomm.robotcore.hardware.HardwareDevice;
-
-public interface ServoController extends HardwareDevice {
- ServoController.PwmStatus getPwmStatus();
-
- double getServoPosition(int var1);
-
- void pwmDisable();
-
- void pwmEnable();
-
- void setServoPosition(int var1, double var2);
-
- public static enum PwmStatus {
- DISABLED,
- ENABLED;
-
- static {
- ServoController.PwmStatus[] var0 = new ServoController.PwmStatus[]{ENABLED, DISABLED};
- }
- }
-}
diff --git a/FtcRobotController/app/src/main/java/com/qualcomm/robotcore/hardware/TouchSensor.java b/FtcRobotController/app/src/main/java/com/qualcomm/robotcore/hardware/TouchSensor.java
deleted file mode 100644
index 5c389b0..0000000
--- a/FtcRobotController/app/src/main/java/com/qualcomm/robotcore/hardware/TouchSensor.java
+++ /dev/null
@@ -1,14 +0,0 @@
-package com.qualcomm.robotcore.hardware;
-
-import com.qualcomm.robotcore.hardware.HardwareDevice;
-
-public abstract class TouchSensor implements HardwareDevice {
- public abstract double getValue();
-
- public abstract boolean isPressed();
-
- public String toString() {
- Object[] var1 = new Object[]{Double.valueOf(this.getValue())};
- return String.format("Touch Sensor: %1.2f", var1);
- }
-}
diff --git a/FtcRobotController/app/src/main/java/com/qualcomm/robotcore/hardware/TouchSensorMultiplexer.java b/FtcRobotController/app/src/main/java/com/qualcomm/robotcore/hardware/TouchSensorMultiplexer.java
deleted file mode 100644
index 651aba4..0000000
--- a/FtcRobotController/app/src/main/java/com/qualcomm/robotcore/hardware/TouchSensorMultiplexer.java
+++ /dev/null
@@ -1,9 +0,0 @@
-package com.qualcomm.robotcore.hardware;
-
-import com.qualcomm.robotcore.hardware.HardwareDevice;
-
-public abstract class TouchSensorMultiplexer implements HardwareDevice {
- public abstract int getSwitches();
-
- public abstract boolean isTouchSensorPressed(int var1);
-}
diff --git a/FtcRobotController/app/src/main/java/com/qualcomm/robotcore/hardware/UltrasonicSensor.java b/FtcRobotController/app/src/main/java/com/qualcomm/robotcore/hardware/UltrasonicSensor.java
deleted file mode 100644
index 8006a5e..0000000
--- a/FtcRobotController/app/src/main/java/com/qualcomm/robotcore/hardware/UltrasonicSensor.java
+++ /dev/null
@@ -1,14 +0,0 @@
-package com.qualcomm.robotcore.hardware;
-
-import com.qualcomm.robotcore.hardware.HardwareDevice;
-
-public abstract class UltrasonicSensor implements HardwareDevice {
- public abstract double getUltrasonicLevel();
-
- public abstract String status();
-
- public String toString() {
- Object[] var1 = new Object[]{Double.valueOf(this.getUltrasonicLevel())};
- return String.format("Ultrasonic: %6.1f", var1);
- }
-}
diff --git a/FtcRobotController/app/src/main/java/com/qualcomm/robotcore/hardware/configuration/ControllerConfiguration.java b/FtcRobotController/app/src/main/java/com/qualcomm/robotcore/hardware/configuration/ControllerConfiguration.java
deleted file mode 100644
index 745b9c1..0000000
--- a/FtcRobotController/app/src/main/java/com/qualcomm/robotcore/hardware/configuration/ControllerConfiguration.java
+++ /dev/null
@@ -1,49 +0,0 @@
-package com.qualcomm.robotcore.hardware.configuration;
-
-import com.qualcomm.robotcore.hardware.DeviceManager;
-import com.qualcomm.robotcore.hardware.configuration.DeviceConfiguration;
-import com.qualcomm.robotcore.util.SerialNumber;
-import java.io.Serializable;
-import java.util.ArrayList;
-import java.util.List;
-
-public class ControllerConfiguration extends DeviceConfiguration implements Serializable {
- public static final SerialNumber NO_SERIAL_NUMBER = new SerialNumber("-1");
- private List a;
- private SerialNumber b;
-
- public ControllerConfiguration(String var1, SerialNumber var2, DeviceConfiguration.ConfigurationType var3) {
- this(var1, new ArrayList(), var2, var3);
- }
-
- public ControllerConfiguration(String var1, List var2, SerialNumber var3, DeviceConfiguration.ConfigurationType var4) {
- super(var4);
- super.setName(var1);
- this.a = var2;
- this.b = var3;
- }
-
- public void addDevices(List var1) {
- this.a = var1;
- }
-
- public DeviceManager.DeviceType configTypeToDeviceType(DeviceConfiguration.ConfigurationType var1) {
- return var1 == DeviceConfiguration.ConfigurationType.MOTOR_CONTROLLER?DeviceManager.DeviceType.MODERN_ROBOTICS_USB_DC_MOTOR_CONTROLLER:(var1 == DeviceConfiguration.ConfigurationType.SERVO_CONTROLLER?DeviceManager.DeviceType.MODERN_ROBOTICS_USB_SERVO_CONTROLLER:(var1 == DeviceConfiguration.ConfigurationType.LEGACY_MODULE_CONTROLLER?DeviceManager.DeviceType.MODERN_ROBOTICS_USB_LEGACY_MODULE:DeviceManager.DeviceType.FTDI_USB_UNKNOWN_DEVICE));
- }
-
- public DeviceConfiguration.ConfigurationType deviceTypeToConfigType(DeviceManager.DeviceType var1) {
- return var1 == DeviceManager.DeviceType.MODERN_ROBOTICS_USB_DC_MOTOR_CONTROLLER?DeviceConfiguration.ConfigurationType.MOTOR_CONTROLLER:(var1 == DeviceManager.DeviceType.MODERN_ROBOTICS_USB_SERVO_CONTROLLER?DeviceConfiguration.ConfigurationType.SERVO_CONTROLLER:(var1 == DeviceManager.DeviceType.MODERN_ROBOTICS_USB_LEGACY_MODULE?DeviceConfiguration.ConfigurationType.LEGACY_MODULE_CONTROLLER:DeviceConfiguration.ConfigurationType.NOTHING));
- }
-
- public List getDevices() {
- return this.a;
- }
-
- public SerialNumber getSerialNumber() {
- return this.b;
- }
-
- public DeviceConfiguration.ConfigurationType getType() {
- return super.getType();
- }
-}
diff --git a/FtcRobotController/app/src/main/java/com/qualcomm/robotcore/hardware/configuration/DeviceConfiguration.java b/FtcRobotController/app/src/main/java/com/qualcomm/robotcore/hardware/configuration/DeviceConfiguration.java
deleted file mode 100644
index e3c5b4a..0000000
--- a/FtcRobotController/app/src/main/java/com/qualcomm/robotcore/hardware/configuration/DeviceConfiguration.java
+++ /dev/null
@@ -1,126 +0,0 @@
-package com.qualcomm.robotcore.hardware.configuration;
-
-import java.io.Serializable;
-
-public class DeviceConfiguration implements Serializable {
- public static final String DISABLED_DEVICE_NAME = "NO DEVICE ATTACHED";
- private DeviceConfiguration.ConfigurationType a;
- private int b;
- private boolean c;
- protected String name;
-
- public DeviceConfiguration(int var1) {
- this.a = DeviceConfiguration.ConfigurationType.NOTHING;
- this.c = false;
- this.name = "NO DEVICE ATTACHED";
- this.a = DeviceConfiguration.ConfigurationType.NOTHING;
- this.b = var1;
- this.c = false;
- }
-
- public DeviceConfiguration(int var1, DeviceConfiguration.ConfigurationType var2) {
- this.a = DeviceConfiguration.ConfigurationType.NOTHING;
- this.c = false;
- this.name = "NO DEVICE ATTACHED";
- this.a = var2;
- this.b = var1;
- this.c = false;
- }
-
- public DeviceConfiguration(int var1, DeviceConfiguration.ConfigurationType var2, String var3, boolean var4) {
- this.a = DeviceConfiguration.ConfigurationType.NOTHING;
- this.c = false;
- this.b = var1;
- this.a = var2;
- this.name = var3;
- this.c = var4;
- }
-
- public DeviceConfiguration(DeviceConfiguration.ConfigurationType var1) {
- this.a = DeviceConfiguration.ConfigurationType.NOTHING;
- this.c = false;
- this.name = "";
- this.a = var1;
- this.c = false;
- }
-
- public String getName() {
- return this.name;
- }
-
- public int getPort() {
- return this.b;
- }
-
- public DeviceConfiguration.ConfigurationType getType() {
- return this.a;
- }
-
- public boolean isEnabled() {
- return this.c;
- }
-
- public void setEnabled(boolean var1) {
- this.c = var1;
- }
-
- public void setName(String var1) {
- this.name = var1;
- }
-
- public void setPort(int var1) {
- this.b = var1;
- }
-
- public void setType(DeviceConfiguration.ConfigurationType var1) {
- this.a = var1;
- }
-
- public DeviceConfiguration.ConfigurationType typeFromString(String var1) {
- DeviceConfiguration.ConfigurationType[] var2 = DeviceConfiguration.ConfigurationType.values();
- int var3 = var2.length;
-
- for(int var4 = 0; var4 < var3; ++var4) {
- DeviceConfiguration.ConfigurationType var5 = var2[var4];
- if(var1.equalsIgnoreCase(var5.toString())) {
- return var5;
- }
- }
-
- return DeviceConfiguration.ConfigurationType.NOTHING;
- }
-
- public static enum ConfigurationType {
- ACCELEROMETER,
- ADAFRUIT_COLOR_SENSOR,
- ANALOG_INPUT,
- ANALOG_OUTPUT,
- COLOR_SENSOR,
- COMPASS,
- DEVICE_INTERFACE_MODULE,
- DIGITAL_DEVICE,
- GYRO,
- I2C_DEVICE,
- IR_SEEKER,
- IR_SEEKER_V3,
- LED,
- LEGACY_MODULE_CONTROLLER,
- LIGHT_SENSOR,
- MATRIX_CONTROLLER,
- MOTOR,
- MOTOR_CONTROLLER,
- NOTHING,
- OPTICAL_DISTANCE_SENSOR,
- OTHER,
- PULSE_WIDTH_DEVICE,
- SERVO,
- SERVO_CONTROLLER,
- TOUCH_SENSOR,
- TOUCH_SENSOR_MULTIPLEXER,
- ULTRASONIC_SENSOR;
-
- static {
- DeviceConfiguration.ConfigurationType[] var0 = new DeviceConfiguration.ConfigurationType[]{MOTOR, SERVO, GYRO, COMPASS, IR_SEEKER, LIGHT_SENSOR, ACCELEROMETER, MOTOR_CONTROLLER, SERVO_CONTROLLER, LEGACY_MODULE_CONTROLLER, DEVICE_INTERFACE_MODULE, I2C_DEVICE, ANALOG_INPUT, TOUCH_SENSOR, OPTICAL_DISTANCE_SENSOR, ANALOG_OUTPUT, DIGITAL_DEVICE, PULSE_WIDTH_DEVICE, IR_SEEKER_V3, TOUCH_SENSOR_MULTIPLEXER, MATRIX_CONTROLLER, ULTRASONIC_SENSOR, ADAFRUIT_COLOR_SENSOR, COLOR_SENSOR, LED, OTHER, NOTHING};
- }
- }
-}
diff --git a/FtcRobotController/app/src/main/java/com/qualcomm/robotcore/hardware/configuration/DeviceInfoAdapter.java b/FtcRobotController/app/src/main/java/com/qualcomm/robotcore/hardware/configuration/DeviceInfoAdapter.java
deleted file mode 100644
index f6c9b8c..0000000
--- a/FtcRobotController/app/src/main/java/com/qualcomm/robotcore/hardware/configuration/DeviceInfoAdapter.java
+++ /dev/null
@@ -1,53 +0,0 @@
-package com.qualcomm.robotcore.hardware.configuration;
-
-import android.app.Activity;
-import android.content.Context;
-import android.view.View;
-import android.view.ViewGroup;
-import android.widget.BaseAdapter;
-import android.widget.ListAdapter;
-import android.widget.TextView;
-import com.qualcomm.robotcore.hardware.configuration.ControllerConfiguration;
-import com.qualcomm.robotcore.util.SerialNumber;
-import java.util.HashMap;
-import java.util.Map;
-
-public class DeviceInfoAdapter extends BaseAdapter implements ListAdapter {
- private Map a = new HashMap();
- private SerialNumber[] b;
- private Context c;
- private int d;
- private int e;
-
- public DeviceInfoAdapter(Activity var1, int var2, Map var3) {
- this.c = var1;
- this.a = var3;
- this.b = (SerialNumber[])var3.keySet().toArray(new SerialNumber[var3.size()]);
- this.d = var2;
- this.e = this.e;
- }
-
- public int getCount() {
- return this.a.size();
- }
-
- public Object getItem(int var1) {
- return this.a.get(this.b[var1]);
- }
-
- public long getItemId(int var1) {
- return 0L;
- }
-
- public View getView(int var1, View var2, ViewGroup var3) {
- if(var2 == null) {
- var2 = ((Activity)this.c).getLayoutInflater().inflate(this.d, var3, false);
- }
-
- String var4 = this.b[var1].toString();
- ((TextView)var2.findViewById(16908309)).setText(var4);
- String var5 = ((ControllerConfiguration)this.a.get(this.b[var1])).getName();
- ((TextView)var2.findViewById(16908308)).setText(var5);
- return var2;
- }
-}
diff --git a/FtcRobotController/app/src/main/java/com/qualcomm/robotcore/hardware/configuration/DeviceInterfaceModuleConfiguration.java b/FtcRobotController/app/src/main/java/com/qualcomm/robotcore/hardware/configuration/DeviceInterfaceModuleConfiguration.java
deleted file mode 100644
index 31d29d5..0000000
--- a/FtcRobotController/app/src/main/java/com/qualcomm/robotcore/hardware/configuration/DeviceInterfaceModuleConfiguration.java
+++ /dev/null
@@ -1,58 +0,0 @@
-package com.qualcomm.robotcore.hardware.configuration;
-
-import com.qualcomm.robotcore.hardware.configuration.ControllerConfiguration;
-import com.qualcomm.robotcore.hardware.configuration.DeviceConfiguration;
-import com.qualcomm.robotcore.util.SerialNumber;
-import java.util.List;
-
-public class DeviceInterfaceModuleConfiguration extends ControllerConfiguration {
- private List a;
- private List b;
- private List c;
- private List d;
- private List e;
-
- public DeviceInterfaceModuleConfiguration(String var1, SerialNumber var2) {
- super(var1, var2, DeviceConfiguration.ConfigurationType.DEVICE_INTERFACE_MODULE);
- }
-
- public List getAnalogInputDevices() {
- return this.c;
- }
-
- public List getAnalogOutputDevices() {
- return this.e;
- }
-
- public List getDigitalDevices() {
- return this.d;
- }
-
- public List getI2cDevices() {
- return this.b;
- }
-
- public List getPwmDevices() {
- return this.a;
- }
-
- public void setAnalogInputDevices(List var1) {
- this.c = var1;
- }
-
- public void setAnalogOutputDevices(List var1) {
- this.e = var1;
- }
-
- public void setDigitalDevices(List var1) {
- this.d = var1;
- }
-
- public void setI2cDevices(List var1) {
- this.b = var1;
- }
-
- public void setPwmDevices(List var1) {
- this.a = var1;
- }
-}
diff --git a/FtcRobotController/app/src/main/java/com/qualcomm/robotcore/hardware/configuration/LegacyModuleControllerConfiguration.java b/FtcRobotController/app/src/main/java/com/qualcomm/robotcore/hardware/configuration/LegacyModuleControllerConfiguration.java
deleted file mode 100644
index 1b9d0fc..0000000
--- a/FtcRobotController/app/src/main/java/com/qualcomm/robotcore/hardware/configuration/LegacyModuleControllerConfiguration.java
+++ /dev/null
@@ -1,12 +0,0 @@
-package com.qualcomm.robotcore.hardware.configuration;
-
-import com.qualcomm.robotcore.hardware.configuration.ControllerConfiguration;
-import com.qualcomm.robotcore.hardware.configuration.DeviceConfiguration;
-import com.qualcomm.robotcore.util.SerialNumber;
-import java.util.List;
-
-public class LegacyModuleControllerConfiguration extends ControllerConfiguration {
- public LegacyModuleControllerConfiguration(String var1, List var2, SerialNumber var3) {
- super(var1, var2, var3, DeviceConfiguration.ConfigurationType.LEGACY_MODULE_CONTROLLER);
- }
-}
diff --git a/FtcRobotController/app/src/main/java/com/qualcomm/robotcore/hardware/configuration/MatrixControllerConfiguration.java b/FtcRobotController/app/src/main/java/com/qualcomm/robotcore/hardware/configuration/MatrixControllerConfiguration.java
deleted file mode 100644
index d12bdee..0000000
--- a/FtcRobotController/app/src/main/java/com/qualcomm/robotcore/hardware/configuration/MatrixControllerConfiguration.java
+++ /dev/null
@@ -1,34 +0,0 @@
-package com.qualcomm.robotcore.hardware.configuration;
-
-import com.qualcomm.robotcore.hardware.configuration.ControllerConfiguration;
-import com.qualcomm.robotcore.hardware.configuration.DeviceConfiguration;
-import com.qualcomm.robotcore.util.SerialNumber;
-import java.util.ArrayList;
-import java.util.List;
-
-public class MatrixControllerConfiguration extends ControllerConfiguration {
- private List a;
- private List b;
-
- public MatrixControllerConfiguration(String var1, List var2, List var3, SerialNumber var4) {
- super(var1, var4, DeviceConfiguration.ConfigurationType.MATRIX_CONTROLLER);
- this.a = var3;
- this.b = var2;
- }
-
- public void addMotors(ArrayList var1) {
- this.b = var1;
- }
-
- public void addServos(ArrayList var1) {
- this.a = var1;
- }
-
- public List getMotors() {
- return this.b;
- }
-
- public List getServos() {
- return this.a;
- }
-}
diff --git a/FtcRobotController/app/src/main/java/com/qualcomm/robotcore/hardware/configuration/MotorConfiguration.java b/FtcRobotController/app/src/main/java/com/qualcomm/robotcore/hardware/configuration/MotorConfiguration.java
deleted file mode 100644
index 165f7ef..0000000
--- a/FtcRobotController/app/src/main/java/com/qualcomm/robotcore/hardware/configuration/MotorConfiguration.java
+++ /dev/null
@@ -1,21 +0,0 @@
-package com.qualcomm.robotcore.hardware.configuration;
-
-import com.qualcomm.robotcore.hardware.configuration.DeviceConfiguration;
-
-public class MotorConfiguration extends DeviceConfiguration {
- public MotorConfiguration(int var1) {
- super(DeviceConfiguration.ConfigurationType.MOTOR);
- super.setName("NO DEVICE ATTACHED");
- super.setPort(var1);
- }
-
- public MotorConfiguration(int var1, String var2, boolean var3) {
- super(var1, DeviceConfiguration.ConfigurationType.MOTOR, var2, var3);
- }
-
- public MotorConfiguration(String var1) {
- super(DeviceConfiguration.ConfigurationType.MOTOR);
- super.setName(var1);
- super.setType(DeviceConfiguration.ConfigurationType.MOTOR);
- }
-}
diff --git a/FtcRobotController/app/src/main/java/com/qualcomm/robotcore/hardware/configuration/MotorControllerConfiguration.java b/FtcRobotController/app/src/main/java/com/qualcomm/robotcore/hardware/configuration/MotorControllerConfiguration.java
deleted file mode 100644
index 7c5173c..0000000
--- a/FtcRobotController/app/src/main/java/com/qualcomm/robotcore/hardware/configuration/MotorControllerConfiguration.java
+++ /dev/null
@@ -1,26 +0,0 @@
-package com.qualcomm.robotcore.hardware.configuration;
-
-import com.qualcomm.robotcore.hardware.configuration.ControllerConfiguration;
-import com.qualcomm.robotcore.hardware.configuration.DeviceConfiguration;
-import com.qualcomm.robotcore.util.SerialNumber;
-import java.io.Serializable;
-import java.util.ArrayList;
-import java.util.List;
-
-public class MotorControllerConfiguration extends ControllerConfiguration implements Serializable {
- public MotorControllerConfiguration() {
- super("", new ArrayList(), new SerialNumber(ControllerConfiguration.NO_SERIAL_NUMBER.getSerialNumber()), DeviceConfiguration.ConfigurationType.MOTOR_CONTROLLER);
- }
-
- public MotorControllerConfiguration(String var1, List var2, SerialNumber var3) {
- super(var1, var2, var3, DeviceConfiguration.ConfigurationType.MOTOR_CONTROLLER);
- }
-
- public void addMotors(List var1) {
- super.addDevices(var1);
- }
-
- public List getMotors() {
- return super.getDevices();
- }
-}
diff --git a/FtcRobotController/app/src/main/java/com/qualcomm/robotcore/hardware/configuration/ReadXMLFileHandler.java b/FtcRobotController/app/src/main/java/com/qualcomm/robotcore/hardware/configuration/ReadXMLFileHandler.java
deleted file mode 100644
index 5274f32..0000000
--- a/FtcRobotController/app/src/main/java/com/qualcomm/robotcore/hardware/configuration/ReadXMLFileHandler.java
+++ /dev/null
@@ -1,439 +0,0 @@
-package com.qualcomm.robotcore.hardware.configuration;
-
-import android.content.Context;
-import com.qualcomm.robotcore.exception.RobotCoreException;
-import com.qualcomm.robotcore.hardware.configuration.ControllerConfiguration;
-import com.qualcomm.robotcore.hardware.configuration.DeviceConfiguration;
-import com.qualcomm.robotcore.hardware.configuration.DeviceInterfaceModuleConfiguration;
-import com.qualcomm.robotcore.hardware.configuration.LegacyModuleControllerConfiguration;
-import com.qualcomm.robotcore.hardware.configuration.MatrixControllerConfiguration;
-import com.qualcomm.robotcore.hardware.configuration.MotorConfiguration;
-import com.qualcomm.robotcore.hardware.configuration.MotorControllerConfiguration;
-import com.qualcomm.robotcore.hardware.configuration.ServoConfiguration;
-import com.qualcomm.robotcore.hardware.configuration.ServoControllerConfiguration;
-import com.qualcomm.robotcore.util.RobotLog;
-import com.qualcomm.robotcore.util.SerialNumber;
-import java.io.IOException;
-import java.io.InputStream;
-import java.util.ArrayList;
-import java.util.List;
-import org.xmlpull.v1.XmlPullParser;
-import org.xmlpull.v1.XmlPullParserException;
-
-public class ReadXMLFileHandler {
- private static boolean b = false;
- private static int c = 2;
- private static int d = 8;
- private static int e = 8;
- private static int f = 2;
- private static int g = 6;
- private static int h = 6;
- private static int i = 6;
- private static int j = 2;
- private static int k = 4;
- private static int l = 4;
- List a = new ArrayList();
- private XmlPullParser m;
-
- public ReadXMLFileHandler(Context var1) {
- }
-
- private ControllerConfiguration a() throws IOException, XmlPullParserException, RobotCoreException {
- String var1 = this.m.getAttributeValue((String)null, "name");
- String var2 = this.m.getAttributeValue((String)null, "serialNumber");
- ArrayList var3 = this.a(c, DeviceConfiguration.ConfigurationType.PULSE_WIDTH_DEVICE);
- ArrayList var4 = this.a(g, DeviceConfiguration.ConfigurationType.I2C_DEVICE);
- ArrayList var5 = this.a(e, DeviceConfiguration.ConfigurationType.ANALOG_INPUT);
- ArrayList var6 = this.a(d, DeviceConfiguration.ConfigurationType.DIGITAL_DEVICE);
- ArrayList var7 = this.a(f, DeviceConfiguration.ConfigurationType.ANALOG_OUTPUT);
- int var8 = this.m.next();
- String var9 = this.a(this.m.getName());
-
- while(true) {
- while(true) {
- if(var8 == 1) {
- RobotLog.logAndThrow("Reached the end of the XML file while parsing.");
- return null;
- }
-
- if(var8 != 3) {
- break;
- }
-
- if(var9 != null) {
- if(b) {
- RobotLog.e("[handleDeviceInterfaceModule] tagname: " + var9);
- }
-
- if(var9.equalsIgnoreCase(DeviceConfiguration.ConfigurationType.DEVICE_INTERFACE_MODULE.toString())) {
- DeviceInterfaceModuleConfiguration var20 = new DeviceInterfaceModuleConfiguration(var1, new SerialNumber(var2));
- var20.setPwmDevices(var3);
- var20.setI2cDevices(var4);
- var20.setAnalogInputDevices(var5);
- var20.setDigitalDevices(var6);
- var20.setAnalogOutputDevices(var7);
- var20.setEnabled(true);
- return var20;
- }
- break;
- }
- }
-
- if(var8 == 2) {
- if(var9.equalsIgnoreCase(DeviceConfiguration.ConfigurationType.ANALOG_INPUT.toString()) || var9.equalsIgnoreCase(DeviceConfiguration.ConfigurationType.OPTICAL_DISTANCE_SENSOR.toString())) {
- DeviceConfiguration var10 = this.c();
- var5.set(var10.getPort(), var10);
- }
-
- if(var9.equalsIgnoreCase(DeviceConfiguration.ConfigurationType.PULSE_WIDTH_DEVICE.toString())) {
- DeviceConfiguration var18 = this.c();
- var3.set(var18.getPort(), var18);
- }
-
- if(var9.equalsIgnoreCase(DeviceConfiguration.ConfigurationType.I2C_DEVICE.toString()) || var9.equalsIgnoreCase(DeviceConfiguration.ConfigurationType.IR_SEEKER_V3.toString()) || var9.equalsIgnoreCase(DeviceConfiguration.ConfigurationType.ADAFRUIT_COLOR_SENSOR.toString()) || var9.equalsIgnoreCase(DeviceConfiguration.ConfigurationType.COLOR_SENSOR.toString())) {
- DeviceConfiguration var12 = this.c();
- var4.set(var12.getPort(), var12);
- }
-
- if(var9.equalsIgnoreCase(DeviceConfiguration.ConfigurationType.ANALOG_OUTPUT.toString())) {
- DeviceConfiguration var16 = this.c();
- var7.set(var16.getPort(), var16);
- }
-
- if(var9.equalsIgnoreCase(DeviceConfiguration.ConfigurationType.DIGITAL_DEVICE.toString()) || var9.equalsIgnoreCase(DeviceConfiguration.ConfigurationType.TOUCH_SENSOR.toString()) || var9.equalsIgnoreCase(DeviceConfiguration.ConfigurationType.LED.toString())) {
- DeviceConfiguration var14 = this.c();
- var6.set(var14.getPort(), var14);
- }
- }
-
- var8 = this.m.next();
- var9 = this.a(this.m.getName());
- }
- }
-
- private ControllerConfiguration a(boolean var1) throws IOException, XmlPullParserException {
- String var2 = this.m.getAttributeValue((String)null, "name");
- int var3 = -1;
- String var4 = ControllerConfiguration.NO_SERIAL_NUMBER.toString();
- if(var1) {
- var4 = this.m.getAttributeValue((String)null, "serialNumber");
- } else {
- var3 = Integer.parseInt(this.m.getAttributeValue((String)null, "port"));
- }
-
- ArrayList var5 = this.a(i, DeviceConfiguration.ConfigurationType.SERVO);
- int var6 = this.m.next();
- String var7 = this.a(this.m.getName());
-
- while(true) {
- while(true) {
- if(var6 == 1) {
- ServoControllerConfiguration var8 = new ServoControllerConfiguration(var2, var5, new SerialNumber(var4));
- var8.setPort(var3);
- return var8;
- }
-
- if(var6 != 3) {
- break;
- }
-
- if(var7 != null) {
- if(var7.equalsIgnoreCase(DeviceConfiguration.ConfigurationType.SERVO_CONTROLLER.toString())) {
- ServoControllerConfiguration var12 = new ServoControllerConfiguration(var2, var5, new SerialNumber(var4));
- var12.setPort(var3);
- var12.setEnabled(true);
- return var12;
- }
- break;
- }
- }
-
- if(var6 == 2 && var7.equalsIgnoreCase(DeviceConfiguration.ConfigurationType.SERVO.toString())) {
- int var9 = Integer.parseInt(this.m.getAttributeValue((String)null, "port"));
- ServoConfiguration var10 = new ServoConfiguration(var9, this.m.getAttributeValue((String)null, "name"), true);
- var5.set(var9 - 1, var10);
- }
-
- var6 = this.m.next();
- var7 = this.a(this.m.getName());
- }
- }
-
- private String a(String var1) {
- if(var1 == null) {
- var1 = null;
- } else {
- if(var1.equalsIgnoreCase("MotorController")) {
- return DeviceConfiguration.ConfigurationType.MOTOR_CONTROLLER.toString();
- }
-
- if(var1.equalsIgnoreCase("ServoController")) {
- return DeviceConfiguration.ConfigurationType.SERVO_CONTROLLER.toString();
- }
-
- if(var1.equalsIgnoreCase("LegacyModuleController")) {
- return DeviceConfiguration.ConfigurationType.LEGACY_MODULE_CONTROLLER.toString();
- }
-
- if(var1.equalsIgnoreCase("DeviceInterfaceModule")) {
- return DeviceConfiguration.ConfigurationType.DEVICE_INTERFACE_MODULE.toString();
- }
-
- if(var1.equalsIgnoreCase("AnalogInput")) {
- return DeviceConfiguration.ConfigurationType.ANALOG_INPUT.toString();
- }
-
- if(var1.equalsIgnoreCase("OpticalDistanceSensor")) {
- return DeviceConfiguration.ConfigurationType.OPTICAL_DISTANCE_SENSOR.toString();
- }
-
- if(var1.equalsIgnoreCase("IrSeeker")) {
- return DeviceConfiguration.ConfigurationType.IR_SEEKER.toString();
- }
-
- if(var1.equalsIgnoreCase("LightSensor")) {
- return DeviceConfiguration.ConfigurationType.LIGHT_SENSOR.toString();
- }
-
- if(var1.equalsIgnoreCase("DigitalDevice")) {
- return DeviceConfiguration.ConfigurationType.DIGITAL_DEVICE.toString();
- }
-
- if(var1.equalsIgnoreCase("TouchSensor")) {
- return DeviceConfiguration.ConfigurationType.TOUCH_SENSOR.toString();
- }
-
- if(var1.equalsIgnoreCase("IrSeekerV3")) {
- return DeviceConfiguration.ConfigurationType.IR_SEEKER_V3.toString();
- }
-
- if(var1.equalsIgnoreCase("PulseWidthDevice")) {
- return DeviceConfiguration.ConfigurationType.PULSE_WIDTH_DEVICE.toString();
- }
-
- if(var1.equalsIgnoreCase("I2cDevice")) {
- return DeviceConfiguration.ConfigurationType.I2C_DEVICE.toString();
- }
-
- if(var1.equalsIgnoreCase("AnalogOutput")) {
- return DeviceConfiguration.ConfigurationType.ANALOG_OUTPUT.toString();
- }
-
- if(var1.equalsIgnoreCase("TouchSensorMultiplexer")) {
- return DeviceConfiguration.ConfigurationType.TOUCH_SENSOR_MULTIPLEXER.toString();
- }
-
- if(var1.equalsIgnoreCase("MatrixController")) {
- return DeviceConfiguration.ConfigurationType.MATRIX_CONTROLLER.toString();
- }
-
- if(var1.equalsIgnoreCase("UltrasonicSensor")) {
- return DeviceConfiguration.ConfigurationType.ULTRASONIC_SENSOR.toString();
- }
-
- if(var1.equalsIgnoreCase("AdafruitColorSensor")) {
- return DeviceConfiguration.ConfigurationType.ADAFRUIT_COLOR_SENSOR.toString();
- }
-
- if(var1.equalsIgnoreCase("ColorSensor")) {
- return DeviceConfiguration.ConfigurationType.COLOR_SENSOR.toString();
- }
-
- if(var1.equalsIgnoreCase("Led")) {
- return DeviceConfiguration.ConfigurationType.LED.toString();
- }
- }
-
- return var1;
- }
-
- private ArrayList a(int var1, DeviceConfiguration.ConfigurationType var2) {
- ArrayList var3 = new ArrayList();
-
- for(int var4 = 0; var4 < var1; ++var4) {
- if(var2 == DeviceConfiguration.ConfigurationType.SERVO) {
- var3.add(new ServoConfiguration(var4 + 1, "NO DEVICE ATTACHED", false));
- } else if(var2 == DeviceConfiguration.ConfigurationType.MOTOR) {
- var3.add(new MotorConfiguration(var4 + 1, "NO DEVICE ATTACHED", false));
- } else {
- var3.add(new DeviceConfiguration(var4, var2, "NO DEVICE ATTACHED", false));
- }
- }
-
- return var3;
- }
-
- private ControllerConfiguration b() throws IOException, XmlPullParserException, RobotCoreException {
- String var1 = this.m.getAttributeValue((String)null, "name");
- String var2 = this.m.getAttributeValue((String)null, "serialNumber");
- ArrayList var3 = this.a(h, DeviceConfiguration.ConfigurationType.NOTHING);
- int var4 = this.m.next();
- String var5 = this.a(this.m.getName());
-
- while(true) {
- while(true) {
- if(var4 == 1) {
- return new LegacyModuleControllerConfiguration(var1, var3, new SerialNumber(var2));
- }
-
- if(var4 != 3) {
- break;
- }
-
- if(var5 != null) {
- if(var5.equalsIgnoreCase(DeviceConfiguration.ConfigurationType.LEGACY_MODULE_CONTROLLER.toString())) {
- LegacyModuleControllerConfiguration var14 = new LegacyModuleControllerConfiguration(var1, var3, new SerialNumber(var2));
- var14.setEnabled(true);
- return var14;
- }
- break;
- }
- }
-
- if(var4 == 2) {
- if(b) {
- RobotLog.e("[handleLegacyModule] tagname: " + var5);
- }
-
- if(!var5.equalsIgnoreCase(DeviceConfiguration.ConfigurationType.COMPASS.toString()) && !var5.equalsIgnoreCase(DeviceConfiguration.ConfigurationType.LIGHT_SENSOR.toString()) && !var5.equalsIgnoreCase(DeviceConfiguration.ConfigurationType.IR_SEEKER.toString()) && !var5.equalsIgnoreCase(DeviceConfiguration.ConfigurationType.ACCELEROMETER.toString()) && !var5.equalsIgnoreCase(DeviceConfiguration.ConfigurationType.GYRO.toString()) && !var5.equalsIgnoreCase(DeviceConfiguration.ConfigurationType.TOUCH_SENSOR.toString()) && !var5.equalsIgnoreCase(DeviceConfiguration.ConfigurationType.TOUCH_SENSOR_MULTIPLEXER.toString()) && !var5.equalsIgnoreCase(DeviceConfiguration.ConfigurationType.ULTRASONIC_SENSOR.toString()) && !var5.equalsIgnoreCase(DeviceConfiguration.ConfigurationType.COLOR_SENSOR.toString()) && !var5.equalsIgnoreCase(DeviceConfiguration.ConfigurationType.NOTHING.toString())) {
- if(var5.equalsIgnoreCase(DeviceConfiguration.ConfigurationType.MOTOR_CONTROLLER.toString())) {
- ControllerConfiguration var12 = this.b(false);
- var3.set(var12.getPort(), var12);
- } else if(var5.equalsIgnoreCase(DeviceConfiguration.ConfigurationType.SERVO_CONTROLLER.toString())) {
- ControllerConfiguration var10 = this.a(false);
- var3.set(var10.getPort(), var10);
- } else if(var5.equalsIgnoreCase(DeviceConfiguration.ConfigurationType.MATRIX_CONTROLLER.toString())) {
- ControllerConfiguration var8 = this.d();
- var3.set(var8.getPort(), var8);
- }
- } else {
- DeviceConfiguration var6 = this.c();
- var3.set(var6.getPort(), var6);
- }
- }
-
- var4 = this.m.next();
- var5 = this.a(this.m.getName());
- }
- }
-
- private ControllerConfiguration b(boolean var1) throws IOException, XmlPullParserException {
- String var2 = this.m.getAttributeValue((String)null, "name");
- int var3 = -1;
- String var4 = ControllerConfiguration.NO_SERIAL_NUMBER.toString();
- if(var1) {
- var4 = this.m.getAttributeValue((String)null, "serialNumber");
- } else {
- var3 = Integer.parseInt(this.m.getAttributeValue((String)null, "port"));
- }
-
- ArrayList var5 = this.a(j, DeviceConfiguration.ConfigurationType.MOTOR);
- int var6 = this.m.next();
- String var7 = this.a(this.m.getName());
-
- while(true) {
- while(true) {
- if(var6 == 1) {
- MotorControllerConfiguration var8 = new MotorControllerConfiguration(var2, var5, new SerialNumber(var4));
- var8.setPort(var3);
- return var8;
- }
-
- if(var6 != 3) {
- break;
- }
-
- if(var7 != null) {
- if(var7.equalsIgnoreCase(DeviceConfiguration.ConfigurationType.MOTOR_CONTROLLER.toString())) {
- MotorControllerConfiguration var12 = new MotorControllerConfiguration(var2, var5, new SerialNumber(var4));
- var12.setPort(var3);
- var12.setEnabled(true);
- return var12;
- }
- break;
- }
- }
-
- if(var6 == 2 && var7.equalsIgnoreCase(DeviceConfiguration.ConfigurationType.MOTOR.toString())) {
- int var9 = Integer.parseInt(this.m.getAttributeValue((String)null, "port"));
- MotorConfiguration var10 = new MotorConfiguration(var9, this.m.getAttributeValue((String)null, "name"), true);
- var5.set(var9 - 1, var10);
- }
-
- var6 = this.m.next();
- var7 = this.a(this.m.getName());
- }
- }
-
- private DeviceConfiguration c() {
- String var1 = this.a(this.m.getName());
- DeviceConfiguration var2 = new DeviceConfiguration(Integer.parseInt(this.m.getAttributeValue((String)null, "port")));
- var2.setType(var2.typeFromString(var1));
- var2.setName(this.m.getAttributeValue((String)null, "name"));
- if(!var2.getName().equalsIgnoreCase("NO DEVICE ATTACHED")) {
- var2.setEnabled(true);
- }
-
- if(b) {
- RobotLog.e("[handleDevice] name: " + var2.getName() + ", port: " + var2.getPort() + ", type: " + var2.getType());
- }
-
- return var2;
- }
-
- private ControllerConfiguration d() throws IOException, XmlPullParserException, RobotCoreException {
- String var1 = this.m.getAttributeValue((String)null, "name");
- String var2 = ControllerConfiguration.NO_SERIAL_NUMBER.toString();
- int var3 = Integer.parseInt(this.m.getAttributeValue((String)null, "port"));
- ArrayList var4 = this.a(l, DeviceConfiguration.ConfigurationType.SERVO);
- ArrayList var5 = this.a(k, DeviceConfiguration.ConfigurationType.MOTOR);
- int var6 = this.m.next();
- String var7 = this.a(this.m.getName());
-
- while(true) {
- while(true) {
- if(var6 == 1) {
- RobotLog.logAndThrow("Reached the end of the XML file while parsing.");
- return null;
- }
-
- if(var6 != 3) {
- break;
- }
-
- if(var7 != null) {
- if(var7.equalsIgnoreCase(DeviceConfiguration.ConfigurationType.MATRIX_CONTROLLER.toString())) {
- MatrixControllerConfiguration var14 = new MatrixControllerConfiguration(var1, var5, var4, new SerialNumber(var2));
- var14.setPort(var3);
- var14.setEnabled(true);
- return var14;
- }
- break;
- }
- }
-
- if(var6 == 2) {
- if(var7.equalsIgnoreCase(DeviceConfiguration.ConfigurationType.SERVO.toString())) {
- int var11 = Integer.parseInt(this.m.getAttributeValue((String)null, "port"));
- ServoConfiguration var12 = new ServoConfiguration(var11, this.m.getAttributeValue((String)null, "name"), true);
- var4.set(var11 - 1, var12);
- } else if(var7.equalsIgnoreCase(DeviceConfiguration.ConfigurationType.MOTOR.toString())) {
- int var8 = Integer.parseInt(this.m.getAttributeValue((String)null, "port"));
- MotorConfiguration var9 = new MotorConfiguration(var8, this.m.getAttributeValue((String)null, "name"), true);
- var5.set(var8 - 1, var9);
- }
- }
-
- var6 = this.m.next();
- var7 = this.a(this.m.getName());
- }
- }
-
- public List getDeviceControllers() {
- return this.a;
- }
-
- public List parse(InputStream param1) throws RobotCoreException {
- // $FF: Couldn't be decompiled
- }
-}
diff --git a/FtcRobotController/app/src/main/java/com/qualcomm/robotcore/hardware/configuration/ServoConfiguration.java b/FtcRobotController/app/src/main/java/com/qualcomm/robotcore/hardware/configuration/ServoConfiguration.java
deleted file mode 100644
index 70abb94..0000000
--- a/FtcRobotController/app/src/main/java/com/qualcomm/robotcore/hardware/configuration/ServoConfiguration.java
+++ /dev/null
@@ -1,19 +0,0 @@
-package com.qualcomm.robotcore.hardware.configuration;
-
-import com.qualcomm.robotcore.hardware.configuration.DeviceConfiguration;
-
-public class ServoConfiguration extends DeviceConfiguration {
- public ServoConfiguration(int var1) {
- super(var1, DeviceConfiguration.ConfigurationType.SERVO, "NO DEVICE ATTACHED", false);
- }
-
- public ServoConfiguration(int var1, String var2, boolean var3) {
- super(var1, DeviceConfiguration.ConfigurationType.SERVO, var2, var3);
- }
-
- public ServoConfiguration(String var1) {
- super(DeviceConfiguration.ConfigurationType.SERVO);
- super.setName(var1);
- super.setType(DeviceConfiguration.ConfigurationType.SERVO);
- }
-}
diff --git a/FtcRobotController/app/src/main/java/com/qualcomm/robotcore/hardware/configuration/ServoControllerConfiguration.java b/FtcRobotController/app/src/main/java/com/qualcomm/robotcore/hardware/configuration/ServoControllerConfiguration.java
deleted file mode 100644
index b17f4b2..0000000
--- a/FtcRobotController/app/src/main/java/com/qualcomm/robotcore/hardware/configuration/ServoControllerConfiguration.java
+++ /dev/null
@@ -1,25 +0,0 @@
-package com.qualcomm.robotcore.hardware.configuration;
-
-import com.qualcomm.robotcore.hardware.configuration.ControllerConfiguration;
-import com.qualcomm.robotcore.hardware.configuration.DeviceConfiguration;
-import com.qualcomm.robotcore.util.SerialNumber;
-import java.util.ArrayList;
-import java.util.List;
-
-public class ServoControllerConfiguration extends ControllerConfiguration {
- public ServoControllerConfiguration() {
- super("", new ArrayList(), new SerialNumber(ControllerConfiguration.NO_SERIAL_NUMBER.getSerialNumber()), DeviceConfiguration.ConfigurationType.SERVO_CONTROLLER);
- }
-
- public ServoControllerConfiguration(String var1, List var2, SerialNumber var3) {
- super(var1, var2, var3, DeviceConfiguration.ConfigurationType.SERVO_CONTROLLER);
- }
-
- public void addServos(ArrayList var1) {
- super.addDevices(var1);
- }
-
- public List getServos() {
- return super.getDevices();
- }
-}
diff --git a/FtcRobotController/app/src/main/java/com/qualcomm/robotcore/hardware/configuration/Utility.java b/FtcRobotController/app/src/main/java/com/qualcomm/robotcore/hardware/configuration/Utility.java
deleted file mode 100644
index 569ab5d..0000000
--- a/FtcRobotController/app/src/main/java/com/qualcomm/robotcore/hardware/configuration/Utility.java
+++ /dev/null
@@ -1,328 +0,0 @@
-package com.qualcomm.robotcore.hardware.configuration;
-
-import android.app.Activity;
-import android.app.AlertDialog.Builder;
-import android.content.Context;
-import android.content.SharedPreferences;
-import android.content.SharedPreferences.Editor;
-import android.graphics.Color;
-import android.os.Environment;
-import android.preference.PreferenceManager;
-import android.widget.LinearLayout;
-import android.widget.TextView;
-import android.widget.Toast;
-import com.qualcomm.robotcore.exception.RobotCoreException;
-import com.qualcomm.robotcore.hardware.DeviceManager;
-import com.qualcomm.robotcore.hardware.configuration.ControllerConfiguration;
-import com.qualcomm.robotcore.hardware.configuration.DeviceConfiguration;
-import com.qualcomm.robotcore.hardware.configuration.DeviceInterfaceModuleConfiguration;
-import com.qualcomm.robotcore.hardware.configuration.LegacyModuleControllerConfiguration;
-import com.qualcomm.robotcore.hardware.configuration.MotorConfiguration;
-import com.qualcomm.robotcore.hardware.configuration.MotorControllerConfiguration;
-import com.qualcomm.robotcore.hardware.configuration.ServoConfiguration;
-import com.qualcomm.robotcore.hardware.configuration.ServoControllerConfiguration;
-import com.qualcomm.robotcore.hardware.configuration.WriteXMLFileHandler;
-import com.qualcomm.robotcore.util.RobotLog;
-import com.qualcomm.robotcore.util.SerialNumber;
-import java.io.File;
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.Map;
-import java.util.Set;
-import java.util.Map.Entry;
-import java.util.regex.Pattern;
-
-public class Utility {
- public static final String AUTOCONFIGURE_K9LEGACYBOT = "K9LegacyBot";
- public static final String AUTOCONFIGURE_K9USBBOT = "K9USBBot";
- public static final String CONFIG_FILES_DIR = Environment.getExternalStorageDirectory() + "/FIRST/";
- public static final String DEFAULT_ROBOT_CONFIG = "robot_config";
- public static final String DEFAULT_ROBOT_CONFIG_FILENAME = "robot_config.xml";
- public static final String FILE_EXT = ".xml";
- public static final String NO_FILE = "No current file!";
- public static final String UNSAVED = "Unsaved";
- private static int c = 1;
- private Activity a;
- private SharedPreferences b;
- private WriteXMLFileHandler d;
- private String e;
-
- public Utility(Activity var1) {
- this.a = var1;
- this.b = PreferenceManager.getDefaultSharedPreferences(var1);
- this.d = new WriteXMLFileHandler(var1);
- }
-
- public Builder buildBuilder(String var1, String var2) {
- Builder var3 = new Builder(this.a);
- var3.setTitle(var1).setMessage(var2);
- return var3;
- }
-
- public DeviceInterfaceModuleConfiguration buildDeviceInterfaceModule(SerialNumber var1) {
- DeviceInterfaceModuleConfiguration var2 = new DeviceInterfaceModuleConfiguration("Device Interface Module " + c, var1);
- var2.setPwmDevices(this.createPWMList());
- var2.setI2cDevices(this.createI2CList());
- var2.setAnalogInputDevices(this.createAnalogInputList());
- var2.setDigitalDevices(this.createDigitalList());
- var2.setAnalogOutputDevices(this.createAnalogOutputList());
- ++c;
- return var2;
- }
-
- public LegacyModuleControllerConfiguration buildLegacyModule(SerialNumber var1) {
- ArrayList var2 = this.createLegacyModuleList();
- LegacyModuleControllerConfiguration var3 = new LegacyModuleControllerConfiguration("Legacy Module " + c, var2, var1);
- ++c;
- return var3;
- }
-
- public MotorControllerConfiguration buildMotorController(SerialNumber var1) {
- ArrayList var2 = this.createMotorList();
- MotorControllerConfiguration var3 = new MotorControllerConfiguration("Motor Controller " + c, var2, var1);
- ++c;
- return var3;
- }
-
- public ServoControllerConfiguration buildServoController(SerialNumber var1) {
- ArrayList var2 = this.createServoList();
- ServoControllerConfiguration var3 = new ServoControllerConfiguration("Servo Controller " + c, var2, var1);
- ++c;
- return var3;
- }
-
- public void changeBackground(int var1, int var2) {
- ((LinearLayout)this.a.findViewById(var2)).setBackgroundColor(var1);
- }
-
- public void complainToast(String var1, Context var2) {
- Toast var3 = Toast.makeText(var2, var1, 0);
- var3.setGravity(17, 0, 0);
- TextView var4 = (TextView)var3.getView().findViewById(16908299);
- var4.setTextColor(-1);
- var4.setTextSize(18.0F);
- var3.show();
- }
-
- public void confirmSave() {
- Toast var1 = Toast.makeText(this.a, "Saved", 0);
- var1.setGravity(80, 0, 50);
- var1.show();
- }
-
- public ArrayList createAnalogInputList() {
- ArrayList var1 = new ArrayList();
-
- for(int var2 = 0; var2 < 8; ++var2) {
- var1.add(new DeviceConfiguration(var2, DeviceConfiguration.ConfigurationType.ANALOG_INPUT));
- }
-
- return var1;
- }
-
- public ArrayList createAnalogOutputList() {
- ArrayList var1 = new ArrayList();
-
- for(int var2 = 0; var2 < 2; ++var2) {
- var1.add(new DeviceConfiguration(var2, DeviceConfiguration.ConfigurationType.ANALOG_OUTPUT));
- }
-
- return var1;
- }
-
- public void createConfigFolder() {
- File var1 = new File(CONFIG_FILES_DIR);
- boolean var2 = true;
- if(!var1.exists()) {
- var2 = var1.mkdir();
- }
-
- if(!var2) {
- RobotLog.e("Can\'t create the Robot Config Files directory!");
- this.complainToast("Can\'t create the Robot Config Files directory!", this.a);
- }
-
- }
-
- public ArrayList createDigitalList() {
- ArrayList var1 = new ArrayList();
-
- for(int var2 = 0; var2 < 8; ++var2) {
- var1.add(new DeviceConfiguration(var2, DeviceConfiguration.ConfigurationType.DIGITAL_DEVICE));
- }
-
- return var1;
- }
-
- public ArrayList createI2CList() {
- ArrayList var1 = new ArrayList();
-
- for(int var2 = 0; var2 < 6; ++var2) {
- var1.add(new DeviceConfiguration(var2, DeviceConfiguration.ConfigurationType.I2C_DEVICE));
- }
-
- return var1;
- }
-
- public ArrayList createLegacyModuleList() {
- ArrayList var1 = new ArrayList();
-
- for(int var2 = 0; var2 < 6; ++var2) {
- var1.add(new DeviceConfiguration(var2, DeviceConfiguration.ConfigurationType.NOTHING));
- }
-
- return var1;
- }
-
- public void createLists(Set> var1, Map var2) {
- Iterator var3 = var1.iterator();
-
- while(var3.hasNext()) {
- Entry var4 = (Entry)var3.next();
- DeviceManager.DeviceType var5 = (DeviceManager.DeviceType)var4.getValue();
- switch(null.a[var5.ordinal()]) {
- case 1:
- var2.put(var4.getKey(), this.buildMotorController((SerialNumber)var4.getKey()));
- break;
- case 2:
- var2.put(var4.getKey(), this.buildServoController((SerialNumber)var4.getKey()));
- break;
- case 3:
- var2.put(var4.getKey(), this.buildLegacyModule((SerialNumber)var4.getKey()));
- break;
- case 4:
- DeviceInterfaceModuleConfiguration var6 = this.buildDeviceInterfaceModule((SerialNumber)var4.getKey());
- var2.put(var4.getKey(), var6);
- }
- }
-
- }
-
- public ArrayList createMotorList() {
- ArrayList var1 = new ArrayList();
- var1.add(new MotorConfiguration(1));
- var1.add(new MotorConfiguration(2));
- return var1;
- }
-
- public ArrayList createPWMList() {
- ArrayList var1 = new ArrayList();
-
- for(int var2 = 0; var2 < 2; ++var2) {
- var1.add(new DeviceConfiguration(var2, DeviceConfiguration.ConfigurationType.PULSE_WIDTH_DEVICE));
- }
-
- return var1;
- }
-
- public ArrayList createServoList() {
- ArrayList var1 = new ArrayList();
-
- for(int var2 = 1; var2 <= 6; ++var2) {
- var1.add(new ServoConfiguration(var2));
- }
-
- return var1;
- }
-
- public String getFilenameFromPrefs(int var1, String var2) {
- return this.b.getString(this.a.getString(var1), var2);
- }
-
- public String getOutput() {
- return this.e;
- }
-
- public ArrayList getXMLFiles() {
- File[] var1 = (new File(CONFIG_FILES_DIR)).listFiles();
- ArrayList var2;
- if(var1 == null) {
- RobotLog.i("robotConfigFiles directory is empty");
- var2 = new ArrayList();
- } else {
- var2 = new ArrayList();
- int var3 = var1.length;
-
- for(int var4 = 0; var4 < var3; ++var4) {
- File var5 = var1[var4];
- if(var5.isFile()) {
- String var6 = var5.getName();
- if(Pattern.compile("(?i).xml").matcher(var6).find()) {
- var2.add(var6.replaceFirst("[.][^.]+$", ""));
- }
- }
- }
- }
-
- return var2;
- }
-
- public String prepareFilename(String var1) {
- if(var1.toLowerCase().contains("Unsaved".toLowerCase())) {
- var1 = var1.substring(7).trim();
- }
-
- if(var1.equalsIgnoreCase("No current file!")) {
- var1 = "";
- }
-
- return var1;
- }
-
- public void resetCount() {
- c = 1;
- }
-
- public void saveToPreferences(String var1, int var2) {
- String var3 = var1.replaceFirst("[.][^.]+$", "");
- Editor var4 = this.b.edit();
- var4.putString(this.a.getString(var2), var3);
- var4.apply();
- }
-
- public void setOrangeText(String var1, String var2, int var3, int var4, int var5, int var6) {
- LinearLayout var7 = (LinearLayout)this.a.findViewById(var3);
- var7.setVisibility(0);
- var7.removeAllViews();
- this.a.getLayoutInflater().inflate(var4, var7, true);
- TextView var9 = (TextView)var7.findViewById(var5);
- TextView var10 = (TextView)var7.findViewById(var6);
- var10.setGravity(3);
- var9.setText(var1);
- var10.setText(var2);
- }
-
- public void updateHeader(String var1, int var2, int var3, int var4) {
- String var5 = this.b.getString(this.a.getString(var2), var1).replaceFirst("[.][^.]+$", "");
- ((TextView)this.a.findViewById(var3)).setText(var5);
- if(var5.equalsIgnoreCase("No current file!")) {
- this.changeBackground(Color.parseColor("#bf0510"), var4);
- } else if(var5.toLowerCase().contains("Unsaved".toLowerCase())) {
- this.changeBackground(-12303292, var4);
- } else {
- this.changeBackground(Color.parseColor("#790E15"), var4);
- }
- }
-
- public void writeToFile(String var1) throws RobotCoreException, IOException {
- this.d.writeToFile(this.e, CONFIG_FILES_DIR, var1);
- }
-
- public boolean writeXML(Map var1) {
- ArrayList var2 = new ArrayList();
- var2.addAll(var1.values());
-
- try {
- this.e = this.d.writeXml(var2);
- } catch (RuntimeException var5) {
- if(var5.getMessage().contains("Duplicate name")) {
- this.complainToast("Found " + var5.getMessage(), this.a);
- RobotLog.e("Found " + var5.getMessage());
- return true;
- }
- }
-
- return false;
- }
-}
diff --git a/FtcRobotController/app/src/main/java/com/qualcomm/robotcore/hardware/configuration/WriteXMLFileHandler.java b/FtcRobotController/app/src/main/java/com/qualcomm/robotcore/hardware/configuration/WriteXMLFileHandler.java
deleted file mode 100644
index eb7bc90..0000000
--- a/FtcRobotController/app/src/main/java/com/qualcomm/robotcore/hardware/configuration/WriteXMLFileHandler.java
+++ /dev/null
@@ -1,197 +0,0 @@
-package com.qualcomm.robotcore.hardware.configuration;
-
-import android.content.Context;
-import android.util.Xml;
-import com.qualcomm.robotcore.exception.RobotCoreException;
-import com.qualcomm.robotcore.hardware.configuration.ControllerConfiguration;
-import com.qualcomm.robotcore.hardware.configuration.DeviceConfiguration;
-import com.qualcomm.robotcore.hardware.configuration.DeviceInterfaceModuleConfiguration;
-import com.qualcomm.robotcore.hardware.configuration.MatrixControllerConfiguration;
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.HashSet;
-import java.util.Iterator;
-import org.xmlpull.v1.XmlSerializer;
-
-public class WriteXMLFileHandler {
- private XmlSerializer a = Xml.newSerializer();
- private HashSet b = new HashSet();
- private ArrayList c = new ArrayList();
- private String[] d = new String[]{" ", " ", " "};
- private int e = 0;
-
- public WriteXMLFileHandler(Context var1) {
- }
-
- private void a(ControllerConfiguration var1) throws IOException {
- this.a.ignorableWhitespace(this.d[this.e]);
- this.a.startTag("", this.b(var1.getType().toString()));
- this.a(var1.getName());
- this.a.attribute("", "name", var1.getName());
- this.a.attribute("", "serialNumber", var1.getSerialNumber().toString());
- this.a.ignorableWhitespace("\n");
- ++this.e;
- DeviceInterfaceModuleConfiguration var5 = (DeviceInterfaceModuleConfiguration)var1;
- Iterator var6 = ((ArrayList)var5.getPwmDevices()).iterator();
-
- while(var6.hasNext()) {
- this.a((DeviceConfiguration)var6.next());
- }
-
- Iterator var7 = ((ArrayList)var5.getI2cDevices()).iterator();
-
- while(var7.hasNext()) {
- this.a((DeviceConfiguration)var7.next());
- }
-
- Iterator var8 = ((ArrayList)var5.getAnalogInputDevices()).iterator();
-
- while(var8.hasNext()) {
- this.a((DeviceConfiguration)var8.next());
- }
-
- Iterator var9 = ((ArrayList)var5.getDigitalDevices()).iterator();
-
- while(var9.hasNext()) {
- this.a((DeviceConfiguration)var9.next());
- }
-
- Iterator var10 = ((ArrayList)var5.getAnalogOutputDevices()).iterator();
-
- while(var10.hasNext()) {
- this.a((DeviceConfiguration)var10.next());
- }
-
- this.e += -1;
- this.a.ignorableWhitespace(this.d[this.e]);
- this.a.endTag("", this.b(var1.getType().toString()));
- this.a.ignorableWhitespace("\n");
- }
-
- private void a(ControllerConfiguration var1, boolean var2) throws IOException {
- this.a.ignorableWhitespace(this.d[this.e]);
- this.a.startTag("", this.b(var1.getType().toString()));
- this.a(var1.getName());
- this.a.attribute("", "name", var1.getName());
- if(var2) {
- this.a.attribute("", "serialNumber", var1.getSerialNumber().toString());
- } else {
- this.a.attribute("", "port", String.valueOf(var1.getPort()));
- }
-
- this.a.ignorableWhitespace("\n");
- ++this.e;
- Iterator var6 = ((ArrayList)var1.getDevices()).iterator();
-
- while(var6.hasNext()) {
- DeviceConfiguration var12 = (DeviceConfiguration)var6.next();
- if(var12.isEnabled()) {
- this.a(var12);
- }
- }
-
- if(var1.getType() == DeviceConfiguration.ConfigurationType.MATRIX_CONTROLLER) {
- Iterator var8 = ((ArrayList)((MatrixControllerConfiguration)var1).getMotors()).iterator();
-
- while(var8.hasNext()) {
- DeviceConfiguration var11 = (DeviceConfiguration)var8.next();
- if(var11.isEnabled()) {
- this.a(var11);
- }
- }
-
- Iterator var9 = ((ArrayList)((MatrixControllerConfiguration)var1).getServos()).iterator();
-
- while(var9.hasNext()) {
- DeviceConfiguration var10 = (DeviceConfiguration)var9.next();
- if(var10.isEnabled()) {
- this.a(var10);
- }
- }
- }
-
- this.e += -1;
- this.a.ignorableWhitespace(this.d[this.e]);
- this.a.endTag("", this.b(var1.getType().toString()));
- this.a.ignorableWhitespace("\n");
- }
-
- private void a(DeviceConfiguration var1) {
- if(var1.isEnabled()) {
- try {
- this.a.ignorableWhitespace(this.d[this.e]);
- this.a.startTag("", this.b(var1.getType().toString()));
- this.a(var1.getName());
- this.a.attribute("", "name", var1.getName());
- this.a.attribute("", "port", String.valueOf(var1.getPort()));
- this.a.endTag("", this.b(var1.getType().toString()));
- this.a.ignorableWhitespace("\n");
- } catch (Exception var3) {
- throw new RuntimeException(var3);
- }
- }
- }
-
- private void a(String var1) {
- if(!var1.equalsIgnoreCase("NO DEVICE ATTACHED")) {
- if(this.b.contains(var1)) {
- this.c.add(var1);
- } else {
- this.b.add(var1);
- }
- }
- }
-
- private String b(String var1) {
- String var2 = var1.substring(0, 1) + var1.substring(1).toLowerCase();
-
- for(int var3 = var1.lastIndexOf("_"); var3 > 0; var3 = var2.lastIndexOf("_")) {
- int var4 = var3 + 1;
- String var5 = var2.substring(0, var3);
- String var6 = var2.substring(var4, var4 + 1).toUpperCase();
- String var7 = var2.substring(var4 + 1);
- var2 = var5 + var6 + var7;
- }
-
- return var2;
- }
-
- private void b(ControllerConfiguration var1) throws IOException {
- this.a.ignorableWhitespace(this.d[this.e]);
- this.a.startTag("", this.b(var1.getType().toString()));
- this.a(var1.getName());
- this.a.attribute("", "name", var1.getName());
- this.a.attribute("", "serialNumber", var1.getSerialNumber().toString());
- this.a.ignorableWhitespace("\n");
- ++this.e;
- Iterator var5 = ((ArrayList)var1.getDevices()).iterator();
-
- while(true) {
- while(var5.hasNext()) {
- DeviceConfiguration var7 = (DeviceConfiguration)var5.next();
- String var8 = var7.getType().toString();
- if(!var8.equalsIgnoreCase(DeviceConfiguration.ConfigurationType.MOTOR_CONTROLLER.toString()) && !var8.equalsIgnoreCase(DeviceConfiguration.ConfigurationType.SERVO_CONTROLLER.toString()) && !var8.equalsIgnoreCase(DeviceConfiguration.ConfigurationType.MATRIX_CONTROLLER.toString())) {
- if(var7.isEnabled()) {
- this.a(var7);
- }
- } else {
- this.a((ControllerConfiguration)var7, false);
- }
- }
-
- this.e += -1;
- this.a.ignorableWhitespace(this.d[this.e]);
- this.a.endTag("", this.b(var1.getType().toString()));
- this.a.ignorableWhitespace("\n");
- return;
- }
- }
-
- public void writeToFile(String param1, String param2, String param3) throws RobotCoreException, IOException {
- // $FF: Couldn't be decompiled
- }
-
- public String writeXml(ArrayList param1) {
- // $FF: Couldn't be decompiled
- }
-}
diff --git a/FtcRobotController/app/src/main/java/com/qualcomm/robotcore/hardware/configuration/XMLConfigurationConstants.java b/FtcRobotController/app/src/main/java/com/qualcomm/robotcore/hardware/configuration/XMLConfigurationConstants.java
deleted file mode 100644
index 0365bed..0000000
--- a/FtcRobotController/app/src/main/java/com/qualcomm/robotcore/hardware/configuration/XMLConfigurationConstants.java
+++ /dev/null
@@ -1,24 +0,0 @@
-package com.qualcomm.robotcore.hardware.configuration;
-
-public class XMLConfigurationConstants {
- public static final String ADAFRUIT_COLOR_SENSOR = "AdafruitColorSensor";
- public static final String ANALOG_INPUT = "AnalogInput";
- public static final String ANALOG_OUTPUT = "AnalogOutput";
- public static final String COLOR_SENSOR = "ColorSensor";
- public static final String DEVICE_INTERFACE_MODULE = "DeviceInterfaceModule";
- public static final String DIGITAL_DEVICE = "DigitalDevice";
- public static final String I2C_DEVICE = "I2cDevice";
- public static final String IR_SEEKER = "IrSeeker";
- public static final String IR_SEEKER_V3 = "IrSeekerV3";
- public static final String LED = "Led";
- public static final String LEGACY_MODULE_CONTROLLER = "LegacyModuleController";
- public static final String LIGHT_SENSOR = "LightSensor";
- public static final String MATRIX_CONTROLLER = "MatrixController";
- public static final String MOTOR_CONTROLLER = "MotorController";
- public static final String OPTICAL_DISTANCE_SENSOR = "OpticalDistanceSensor";
- public static final String PULSE_WIDTH_DEVICE = "PulseWidthDevice";
- public static final String SERVO_CONTROLLER = "ServoController";
- public static final String TOUCH_SENSOR = "TouchSensor";
- public static final String TOUCH_SENSOR_MULTIPLEXER = "TouchSensorMultiplexer";
- public static final String ULTRASONIC_SENSOR = "UltrasonicSensor";
-}
diff --git a/FtcRobotController/app/src/main/java/com/qualcomm/robotcore/hardware/logitech/LogitechGamepadF310.java b/FtcRobotController/app/src/main/java/com/qualcomm/robotcore/hardware/logitech/LogitechGamepadF310.java
deleted file mode 100644
index 8b632da..0000000
--- a/FtcRobotController/app/src/main/java/com/qualcomm/robotcore/hardware/logitech/LogitechGamepadF310.java
+++ /dev/null
@@ -1,106 +0,0 @@
-package com.qualcomm.robotcore.hardware.logitech;
-
-import android.os.Build.VERSION;
-import android.view.MotionEvent;
-import com.qualcomm.robotcore.hardware.Gamepad;
-
-public class LogitechGamepadF310 extends Gamepad {
- public LogitechGamepadF310() {
- this((Gamepad.GamepadCallback)null);
- }
-
- public LogitechGamepadF310(Gamepad.GamepadCallback var1) {
- super(var1);
- this.joystickDeadzone = 0.06F;
- }
-
- private void a(MotionEvent var1) {
- byte var2 = 1;
- this.left_stick_x = this.cleanMotionValues(var1.getAxisValue(0));
- this.left_stick_y = this.cleanMotionValues(var1.getAxisValue(var2));
- this.right_stick_x = this.cleanMotionValues(var1.getAxisValue(11));
- this.right_stick_y = this.cleanMotionValues(var1.getAxisValue(14));
- this.left_trigger = var1.getAxisValue(23);
- this.right_trigger = var1.getAxisValue(22);
- byte var3;
- if(var1.getAxisValue(16) > this.dpadThreshold) {
- var3 = var2;
- } else {
- var3 = 0;
- }
-
- this.dpad_down = (boolean)var3;
- byte var4;
- if(var1.getAxisValue(16) < -this.dpadThreshold) {
- var4 = var2;
- } else {
- var4 = 0;
- }
-
- this.dpad_up = (boolean)var4;
- byte var5;
- if(var1.getAxisValue(15) > this.dpadThreshold) {
- var5 = var2;
- } else {
- var5 = 0;
- }
-
- this.dpad_right = (boolean)var5;
- if(var1.getAxisValue(15) >= -this.dpadThreshold) {
- var2 = 0;
- }
-
- this.dpad_left = (boolean)var2;
- this.callCallback();
- }
-
- public String type() {
- return "F310";
- }
-
- public void update(MotionEvent var1) {
- byte var2 = 1;
- this.id = var1.getDeviceId();
- this.timestamp = var1.getEventTime();
- if(VERSION.RELEASE.startsWith("5")) {
- this.a(var1);
- } else {
- this.left_stick_x = this.cleanMotionValues(var1.getAxisValue(0));
- this.left_stick_y = this.cleanMotionValues(var1.getAxisValue(var2));
- this.right_stick_x = this.cleanMotionValues(var1.getAxisValue(12));
- this.right_stick_y = this.cleanMotionValues(var1.getAxisValue(13));
- this.left_trigger = (1.0F + var1.getAxisValue(11)) / 2.0F;
- this.right_trigger = (1.0F + var1.getAxisValue(14)) / 2.0F;
- byte var3;
- if(var1.getAxisValue(16) > this.dpadThreshold) {
- var3 = var2;
- } else {
- var3 = 0;
- }
-
- this.dpad_down = (boolean)var3;
- byte var4;
- if(var1.getAxisValue(16) < -this.dpadThreshold) {
- var4 = var2;
- } else {
- var4 = 0;
- }
-
- this.dpad_up = (boolean)var4;
- byte var5;
- if(var1.getAxisValue(15) > this.dpadThreshold) {
- var5 = var2;
- } else {
- var5 = 0;
- }
-
- this.dpad_right = (boolean)var5;
- if(var1.getAxisValue(15) >= -this.dpadThreshold) {
- var2 = 0;
- }
-
- this.dpad_left = (boolean)var2;
- this.callCallback();
- }
- }
-}
diff --git a/FtcRobotController/app/src/main/java/com/qualcomm/robotcore/hardware/microsoft/MicrosoftGamepadXbox360.java b/FtcRobotController/app/src/main/java/com/qualcomm/robotcore/hardware/microsoft/MicrosoftGamepadXbox360.java
deleted file mode 100644
index 7ab7484..0000000
--- a/FtcRobotController/app/src/main/java/com/qualcomm/robotcore/hardware/microsoft/MicrosoftGamepadXbox360.java
+++ /dev/null
@@ -1,18 +0,0 @@
-package com.qualcomm.robotcore.hardware.microsoft;
-
-import com.qualcomm.robotcore.hardware.Gamepad;
-
-public class MicrosoftGamepadXbox360 extends Gamepad {
- public MicrosoftGamepadXbox360() {
- this((Gamepad.GamepadCallback)null);
- }
-
- public MicrosoftGamepadXbox360(Gamepad.GamepadCallback var1) {
- super(var1);
- this.joystickDeadzone = 0.15F;
- }
-
- public String type() {
- return "Xbox 360";
- }
-}
diff --git a/FtcRobotController/app/src/main/java/com/qualcomm/robotcore/hardware/usb/RobotUsbDevice.java b/FtcRobotController/app/src/main/java/com/qualcomm/robotcore/hardware/usb/RobotUsbDevice.java
deleted file mode 100644
index 845cf03..0000000
--- a/FtcRobotController/app/src/main/java/com/qualcomm/robotcore/hardware/usb/RobotUsbDevice.java
+++ /dev/null
@@ -1,32 +0,0 @@
-package com.qualcomm.robotcore.hardware.usb;
-
-import com.qualcomm.robotcore.exception.RobotCoreException;
-
-public interface RobotUsbDevice {
- void close();
-
- void purge(RobotUsbDevice.Channel var1) throws RobotCoreException;
-
- int read(byte[] var1) throws RobotCoreException;
-
- int read(byte[] var1, int var2, int var3) throws RobotCoreException;
-
- void setBaudRate(int var1) throws RobotCoreException;
-
- void setDataCharacteristics(byte var1, byte var2, byte var3) throws RobotCoreException;
-
- void setLatencyTimer(int var1) throws RobotCoreException;
-
- void write(byte[] var1) throws RobotCoreException;
-
- public static enum Channel {
- BOTH,
- NONE,
- RX,
- TX;
-
- static {
- RobotUsbDevice.Channel[] var0 = new RobotUsbDevice.Channel[]{RX, TX, NONE, BOTH};
- }
- }
-}
diff --git a/FtcRobotController/app/src/main/java/com/qualcomm/robotcore/hardware/usb/RobotUsbManager.java b/FtcRobotController/app/src/main/java/com/qualcomm/robotcore/hardware/usb/RobotUsbManager.java
deleted file mode 100644
index 6d50ef9..0000000
--- a/FtcRobotController/app/src/main/java/com/qualcomm/robotcore/hardware/usb/RobotUsbManager.java
+++ /dev/null
@@ -1,15 +0,0 @@
-package com.qualcomm.robotcore.hardware.usb;
-
-import com.qualcomm.robotcore.exception.RobotCoreException;
-import com.qualcomm.robotcore.hardware.usb.RobotUsbDevice;
-import com.qualcomm.robotcore.util.SerialNumber;
-
-public interface RobotUsbManager {
- String getDeviceDescriptionByIndex(int index) throws RobotCoreException;
-
- SerialNumber getDeviceSerialNumberByIndex(int index) throws RobotCoreException;
-
- RobotUsbDevice openBySerialNumber(SerialNumber serialNumber) throws RobotCoreException;
-
- int scanForDevices() throws RobotCoreException;
-}
diff --git a/FtcRobotController/app/src/main/java/com/qualcomm/robotcore/hardware/usb/ftdi/RobotUsbDeviceFtdi.java b/FtcRobotController/app/src/main/java/com/qualcomm/robotcore/hardware/usb/ftdi/RobotUsbDeviceFtdi.java
deleted file mode 100644
index 3fa0350..0000000
--- a/FtcRobotController/app/src/main/java/com/qualcomm/robotcore/hardware/usb/ftdi/RobotUsbDeviceFtdi.java
+++ /dev/null
@@ -1,64 +0,0 @@
-package com.qualcomm.robotcore.hardware.usb.ftdi;
-
-import com.ftdi.j2xx.FT_Device;
-import com.qualcomm.robotcore.exception.RobotCoreException;
-import com.qualcomm.robotcore.hardware.usb.RobotUsbDevice;
-
-public class RobotUsbDeviceFtdi implements RobotUsbDevice {
- private FT_Device a;
-
- public RobotUsbDeviceFtdi(FT_Device var1) {
- this.a = var1;
- }
-
- public void close() {
- this.a.close();
- }
-
- public void purge(RobotUsbDevice.Channel var1) throws RobotCoreException {
- int var2 = null.a[var1.ordinal()];
- byte var3 = 0;
- switch(var2) {
- case 1:
- var3 = 1;
- break;
- case 2:
- var3 = 2;
- break;
- case 3:
- var3 = 3;
- }
-
- this.a.purge(var3);
- }
-
- public int read(byte[] var1) throws RobotCoreException {
- return this.a.read(var1);
- }
-
- public int read(byte[] var1, int var2, int var3) throws RobotCoreException {
- return this.a.read(var1, var2, (long)var3);
- }
-
- public void setBaudRate(int var1) throws RobotCoreException {
- if(!this.a.setBaudRate(var1)) {
- throw new RobotCoreException("failed to set baud rate to " + var1);
- }
- }
-
- public void setDataCharacteristics(byte var1, byte var2, byte var3) throws RobotCoreException {
- if(!this.a.setDataCharacteristics(var1, var2, var3)) {
- throw new RobotCoreException("failed to set data characteristics");
- }
- }
-
- public void setLatencyTimer(int var1) throws RobotCoreException {
- if(!this.a.setLatencyTimer((byte)var1)) {
- throw new RobotCoreException("failed to set latency timer to " + var1);
- }
- }
-
- public void write(byte[] var1) throws RobotCoreException {
- this.a.write(var1);
- }
-}
diff --git a/FtcRobotController/app/src/main/java/com/qualcomm/robotcore/hardware/usb/ftdi/RobotUsbManagerFtdi.java b/FtcRobotController/app/src/main/java/com/qualcomm/robotcore/hardware/usb/ftdi/RobotUsbManagerFtdi.java
deleted file mode 100644
index acbf1e7..0000000
--- a/FtcRobotController/app/src/main/java/com/qualcomm/robotcore/hardware/usb/ftdi/RobotUsbManagerFtdi.java
+++ /dev/null
@@ -1,46 +0,0 @@
-package com.qualcomm.robotcore.hardware.usb.ftdi;
-
-import android.content.Context;
-import com.ftdi.j2xx.D2xxManager;
-import com.ftdi.j2xx.FT_Device;
-import com.qualcomm.robotcore.exception.RobotCoreException;
-import com.qualcomm.robotcore.hardware.usb.RobotUsbDevice;
-import com.qualcomm.robotcore.hardware.usb.RobotUsbManager;
-import com.qualcomm.robotcore.util.RobotLog;
-import com.qualcomm.robotcore.util.SerialNumber;
-
-public class RobotUsbManagerFtdi implements RobotUsbManager {
- private Context context;
- private D2xxManager d2xxManager;
-
- public RobotUsbManagerFtdi(Context context) {
- this.context = context;
-
- try {
- this.d2xxManager = D2xxManager.getInstance(context);
- } catch (D2xxManager.D2xxException var3) {
- RobotLog.e("Unable to create D2xxManager; cannot open USB devices");
- }
- }
-
- public String getDeviceDescriptionByIndex(int var1) throws RobotCoreException {
- return this.d2xxManager.getDeviceInfoListDetail(var1).description;
- }
-
- public SerialNumber getDeviceSerialNumberByIndex(int var1) throws RobotCoreException {
- return new SerialNumber(this.d2xxManager.getDeviceInfoListDetail(var1).serialNumber);
- }
-
- public RobotUsbDevice openBySerialNumber(SerialNumber serialNumber) throws RobotCoreException {
- FT_Device ftDevice = this.d2xxManager.openBySerialNumber(this.context, serialNumber.toString());
- if(ftDevice == null) {
- throw new RobotCoreException("Unable to open USB device with serial number " + serialNumber);
- } else {
- return new RobotUsbDeviceFtdi(ftDevice);
- }
- }
-
- public int scanForDevices() throws RobotCoreException {
- return this.d2xxManager.createDeviceInfoList(this.context);
- }
-}
diff --git a/FtcRobotController/app/src/main/java/com/qualcomm/robotcore/robocol/Command.java b/FtcRobotController/app/src/main/java/com/qualcomm/robotcore/robocol/Command.java
deleted file mode 100644
index 46222d8..0000000
--- a/FtcRobotController/app/src/main/java/com/qualcomm/robotcore/robocol/Command.java
+++ /dev/null
@@ -1,129 +0,0 @@
-package com.qualcomm.robotcore.robocol;
-
-import com.qualcomm.robotcore.exception.RobotCoreException;
-import com.qualcomm.robotcore.robocol.RobocolParsable;
-import com.qualcomm.robotcore.util.TypeConversion;
-import java.nio.ByteBuffer;
-import java.nio.charset.Charset;
-import java.util.Comparator;
-
-public class Command implements RobocolParsable, Comparable, Comparator {
- public static final int MAX_COMMAND_LENGTH = 256;
- private static final Charset h = Charset.forName("UTF-8");
- String a;
- String b;
- byte[] c;
- byte[] d;
- long e;
- boolean f;
- byte g;
-
- public Command(String var1) {
- this(var1, "");
- }
-
- public Command(String var1, String var2) {
- this.f = false;
- this.g = 0;
- this.a = var1;
- this.b = var2;
- this.c = TypeConversion.stringToUtf8(this.a);
- this.d = TypeConversion.stringToUtf8(this.b);
- this.e = generateTimestamp();
- if(this.c.length > 256) {
- Object[] var4 = new Object[]{Integer.valueOf(256)};
- throw new IllegalArgumentException(String.format("command name length is too long (MAX: %d)", var4));
- } else if(this.d.length > 256) {
- Object[] var3 = new Object[]{Integer.valueOf(256)};
- throw new IllegalArgumentException(String.format("command extra data length is too long (MAX: %d)", var3));
- }
- }
-
- public Command(byte[] var1) throws RobotCoreException {
- this.f = false;
- this.g = 0;
- this.fromByteArray(var1);
- }
-
- public static long generateTimestamp() {
- return System.nanoTime();
- }
-
- public void acknowledge() {
- this.f = true;
- }
-
- public int compare(Command var1, Command var2) {
- return var1.compareTo(var2);
- }
-
- public int compareTo(Command var1) {
- int var2 = this.a.compareTo(var1.a);
- return var2 != 0?var2:(this.e < var1.e?-1:(this.e > var1.e?1:0));
- }
-
- public boolean equals(Object var1) {
- if(var1 instanceof Command) {
- Command var2 = (Command)var1;
- if(this.a.equals(var2.a) && this.e == var2.e) {
- return true;
- }
- }
-
- return false;
- }
-
- public void fromByteArray(byte[] var1) throws RobotCoreException {
- byte var2 = 1;
- ByteBuffer var3 = ByteBuffer.wrap(var1, 3, -3 + var1.length);
- this.e = var3.getLong();
- if(var3.get() != var2) {
- var2 = 0;
- }
-
- this.f = (boolean)var2;
- this.c = new byte[TypeConversion.unsignedByteToInt(var3.get())];
- var3.get(this.c);
- this.a = TypeConversion.utf8ToString(this.c);
- this.d = new byte[TypeConversion.unsignedByteToInt(var3.get())];
- var3.get(this.d);
- this.b = TypeConversion.utf8ToString(this.d);
- }
-
- public byte getAttempts() {
- return this.g;
- }
-
- public String getExtra() {
- return this.b;
- }
-
- public String getName() {
- return this.a;
- }
-
- public RobocolParsable.MsgType getRobocolMsgType() {
- return RobocolParsable.MsgType.COMMAND;
- }
-
- public long getTimestamp() {
- return this.e;
- }
-
- public int hashCode() {
- return (int)((long)this.a.hashCode() & this.e);
- }
-
- public boolean isAcknowledged() {
- return this.f;
- }
-
- public byte[] toByteArray() throws RobotCoreException {
- // $FF: Couldn't be decompiled
- }
-
- public String toString() {
- Object[] var1 = new Object[]{Long.valueOf(this.e), Boolean.valueOf(this.f), this.a};
- return String.format("command: %20d %5s %s", var1);
- }
-}
diff --git a/FtcRobotController/app/src/main/java/com/qualcomm/robotcore/robocol/Heartbeat.java b/FtcRobotController/app/src/main/java/com/qualcomm/robotcore/robocol/Heartbeat.java
deleted file mode 100644
index 0dcb1b2..0000000
--- a/FtcRobotController/app/src/main/java/com/qualcomm/robotcore/robocol/Heartbeat.java
+++ /dev/null
@@ -1,115 +0,0 @@
-package com.qualcomm.robotcore.robocol;
-
-import com.qualcomm.robotcore.exception.RobotCoreException;
-import com.qualcomm.robotcore.robocol.RobocolParsable;
-import com.qualcomm.robotcore.robot.RobotState;
-import com.qualcomm.robotcore.util.RobotLog;
-import java.nio.BufferOverflowException;
-import java.nio.ByteBuffer;
-
-public class Heartbeat implements RobocolParsable {
- public static final short BUFFER_SIZE = 14;
- public static final short MAX_SEQUENCE_NUMBER = 10000;
- public static final short PAYLOAD_SIZE = 11;
- private static short a = 0;
- private long b;
- private short c;
- private RobotState d;
-
- public Heartbeat() {
- this.c = a();
- this.b = System.nanoTime();
- this.d = RobotState.NOT_STARTED;
- }
-
- public Heartbeat(Heartbeat.Token var1) {
- switch(null.a[var1.ordinal()]) {
- case 1:
- this.c = 0;
- this.b = 0L;
- this.d = RobotState.NOT_STARTED;
- return;
- default:
- }
- }
-
- private static short a() {
- synchronized(Heartbeat.class){}
-
- short var1;
- try {
- var1 = a++;
- if(a > 10000) {
- a = 0;
- }
- } finally {
- ;
- }
-
- return var1;
- }
-
- public void fromByteArray(byte[] var1) throws RobotCoreException {
- if(var1.length < 14) {
- throw new RobotCoreException("Expected buffer of at least 14 bytes, received " + var1.length);
- } else {
- ByteBuffer var2 = ByteBuffer.wrap(var1, 3, 11);
- this.c = var2.getShort();
- this.b = var2.getLong();
- this.d = RobotState.fromByte(var2.get());
- }
- }
-
- public double getElapsedTime() {
- return (double)(System.nanoTime() - this.b) / 1.0E9D;
- }
-
- public RobocolParsable.MsgType getRobocolMsgType() {
- return RobocolParsable.MsgType.HEARTBEAT;
- }
-
- public byte getRobotState() {
- return this.d.asByte();
- }
-
- public short getSequenceNumber() {
- return this.c;
- }
-
- public long getTimestamp() {
- return this.b;
- }
-
- public void setRobotState(RobotState var1) {
- this.d = var1;
- }
-
- public byte[] toByteArray() throws RobotCoreException {
- ByteBuffer var1 = ByteBuffer.allocate(14);
-
- try {
- var1.put(this.getRobocolMsgType().asByte());
- var1.putShort((short)11);
- var1.putShort(this.c);
- var1.putLong(this.b);
- var1.put(this.d.asByte());
- } catch (BufferOverflowException var3) {
- RobotLog.logStacktrace((Exception)var3);
- }
-
- return var1.array();
- }
-
- public String toString() {
- Object[] var1 = new Object[]{Short.valueOf(this.c), Long.valueOf(this.b)};
- return String.format("Heartbeat - seq: %4d, time: %d", var1);
- }
-
- public static enum Token {
- EMPTY;
-
- static {
- Heartbeat.Token[] var0 = new Heartbeat.Token[]{EMPTY};
- }
- }
-}
diff --git a/FtcRobotController/app/src/main/java/com/qualcomm/robotcore/robocol/PeerDiscovery.java b/FtcRobotController/app/src/main/java/com/qualcomm/robotcore/robocol/PeerDiscovery.java
deleted file mode 100644
index 36acfea..0000000
--- a/FtcRobotController/app/src/main/java/com/qualcomm/robotcore/robocol/PeerDiscovery.java
+++ /dev/null
@@ -1,95 +0,0 @@
-package com.qualcomm.robotcore.robocol;
-
-import com.qualcomm.robotcore.exception.RobotCoreException;
-import com.qualcomm.robotcore.robocol.RobocolParsable;
-import com.qualcomm.robotcore.util.RobotLog;
-import java.nio.BufferOverflowException;
-import java.nio.ByteBuffer;
-
-public class PeerDiscovery implements RobocolParsable {
- public static final short BUFFER_SIZE = 13;
- public static final short PAYLOAD_SIZE = 10;
- public static final byte ROBOCOL_VERSION = 1;
- private PeerDiscovery.PeerType a;
-
- public PeerDiscovery(PeerDiscovery.PeerType var1) {
- this.a = var1;
- }
-
- public void fromByteArray(byte[] var1) throws RobotCoreException {
- if(var1.length < 13) {
- throw new RobotCoreException("Expected buffer of at least 13 bytes, received " + var1.length);
- } else {
- ByteBuffer var2 = ByteBuffer.wrap(var1, 3, 10);
- switch(var2.get()) {
- case 1:
- this.a = PeerDiscovery.PeerType.fromByte(var2.get());
- return;
- default:
- }
- }
- }
-
- public PeerDiscovery.PeerType getPeerType() {
- return this.a;
- }
-
- public RobocolParsable.MsgType getRobocolMsgType() {
- return RobocolParsable.MsgType.PEER_DISCOVERY;
- }
-
- public byte[] toByteArray() throws RobotCoreException {
- ByteBuffer var1 = ByteBuffer.allocate(13);
-
- try {
- var1.put(this.getRobocolMsgType().asByte());
- var1.putShort((short)10);
- var1.put((byte)1);
- var1.put(this.a.asByte());
- } catch (BufferOverflowException var3) {
- RobotLog.logStacktrace((Exception)var3);
- }
-
- return var1.array();
- }
-
- public String toString() {
- Object[] var1 = new Object[]{this.a.name()};
- return String.format("Peer Discovery - peer type: %s", var1);
- }
-
- public static enum PeerType {
- GROUP_OWNER(2),
- NOT_SET(0),
- PEER(1);
-
- private static final PeerDiscovery.PeerType[] a;
- private int b;
-
- static {
- PeerDiscovery.PeerType[] var0 = new PeerDiscovery.PeerType[]{NOT_SET, PEER, GROUP_OWNER};
- a = values();
- }
-
- private PeerType(int var3) {
- this.b = var3;
- }
-
- public static PeerDiscovery.PeerType fromByte(byte var0) {
- PeerDiscovery.PeerType var1 = NOT_SET;
-
- try {
- PeerDiscovery.PeerType var4 = a[var0];
- return var4;
- } catch (ArrayIndexOutOfBoundsException var5) {
- Object[] var3 = new Object[]{Byte.valueOf(var0), var5.toString()};
- RobotLog.w(String.format("Cannot convert %d to Peer: %s", var3));
- return var1;
- }
- }
-
- public byte asByte() {
- return (byte)this.b;
- }
- }
-}
diff --git a/FtcRobotController/app/src/main/java/com/qualcomm/robotcore/robocol/PeerDiscoveryManager.java b/FtcRobotController/app/src/main/java/com/qualcomm/robotcore/robocol/PeerDiscoveryManager.java
deleted file mode 100644
index aaed518..0000000
--- a/FtcRobotController/app/src/main/java/com/qualcomm/robotcore/robocol/PeerDiscoveryManager.java
+++ /dev/null
@@ -1,76 +0,0 @@
-package com.qualcomm.robotcore.robocol;
-
-import com.qualcomm.robotcore.exception.RobotCoreException;
-import com.qualcomm.robotcore.robocol.PeerDiscovery;
-import com.qualcomm.robotcore.robocol.RobocolDatagram;
-import com.qualcomm.robotcore.robocol.RobocolDatagramSocket;
-import com.qualcomm.robotcore.util.RobotLog;
-import java.net.InetAddress;
-import java.util.concurrent.Executors;
-import java.util.concurrent.ScheduledExecutorService;
-import java.util.concurrent.ScheduledFuture;
-import java.util.concurrent.TimeUnit;
-
-public class PeerDiscoveryManager {
- private InetAddress a;
- private final RobocolDatagramSocket b;
- private ScheduledExecutorService c;
- private ScheduledFuture> d;
- private final PeerDiscovery e;
-
- public PeerDiscoveryManager(RobocolDatagramSocket var1) {
- this.e = new PeerDiscovery(PeerDiscovery.PeerType.PEER);
- this.b = var1;
- }
-
- public InetAddress getPeerDiscoveryDevice() {
- return this.a;
- }
-
- public void start(InetAddress var1) {
- RobotLog.v("Starting peer discovery");
- if(var1 == this.b.getLocalAddress()) {
- RobotLog.v("No need for peer discovery, we are the peer discovery device");
- } else {
- if(this.d != null) {
- this.d.cancel(true);
- }
-
- this.a = var1;
- this.c = Executors.newSingleThreadScheduledExecutor();
- this.d = this.c.scheduleAtFixedRate(new PeerDiscoveryManager.a(null), 1L, 1L, TimeUnit.SECONDS);
- }
- }
-
- public void stop() {
- RobotLog.v("Stopping peer discovery");
- if(this.d != null) {
- this.d.cancel(true);
- }
-
- }
-
- private class a implements Runnable {
- private a() {
- }
-
- // $FF: synthetic method
- a(Object var2) {
- this();
- }
-
- public void run() {
- try {
- RobotLog.v("Sending peer discovery packet");
- RobocolDatagram var2 = new RobocolDatagram(PeerDiscoveryManager.this.e);
- if(PeerDiscoveryManager.this.b.getInetAddress() == null) {
- var2.setAddress(PeerDiscoveryManager.this.a);
- }
-
- PeerDiscoveryManager.this.b.send(var2);
- } catch (RobotCoreException var3) {
- RobotLog.d("Unable to send peer discovery packet: " + var3.toString());
- }
- }
- }
-}
diff --git a/FtcRobotController/app/src/main/java/com/qualcomm/robotcore/robocol/RobocolConfig.java b/FtcRobotController/app/src/main/java/com/qualcomm/robotcore/robocol/RobocolConfig.java
deleted file mode 100644
index 1bac510..0000000
--- a/FtcRobotController/app/src/main/java/com/qualcomm/robotcore/robocol/RobocolConfig.java
+++ /dev/null
@@ -1,66 +0,0 @@
-package com.qualcomm.robotcore.robocol;
-
-import com.qualcomm.robotcore.util.Network;
-import com.qualcomm.robotcore.util.RobotLog;
-import com.qualcomm.robotcore.util.TypeConversion;
-import java.io.IOException;
-import java.net.InetAddress;
-import java.net.NetworkInterface;
-import java.net.SocketException;
-import java.util.ArrayList;
-import java.util.Iterator;
-
-public class RobocolConfig {
- public static final int MAX_PACKET_SIZE = 4098;
- public static final int PORT_NUMBER = 20884;
- public static final int TIMEOUT = 1000;
- public static final int TTL = 3;
- public static final int WIFI_P2P_SUBNET_MASK = -256;
-
- public static InetAddress determineBindAddress(InetAddress param0) {
- // $FF: Couldn't be decompiled
- }
-
- public static InetAddress determineBindAddressBasedOnIsReachable(ArrayList var0, InetAddress var1) {
- Iterator var2 = var0.iterator();
-
- while(var2.hasNext()) {
- InetAddress var3 = (InetAddress)var2.next();
-
- boolean var8;
- try {
- var8 = var3.isReachable(NetworkInterface.getByInetAddress(var3), 3, 1000);
- } catch (SocketException var9) {
- Object[] var7 = new Object[]{var3.getHostAddress()};
- RobotLog.v(String.format("socket exception while trying to get network interface of %s", var7));
- continue;
- } catch (IOException var10) {
- Object[] var5 = new Object[]{var1.getHostAddress(), var3.getHostAddress()};
- RobotLog.v(String.format("IO exception while trying to determine if %s is reachable via %s", var5));
- continue;
- }
-
- if(var8) {
- return var3;
- }
- }
-
- return Network.getLoopbackAddress();
- }
-
- public static InetAddress determineBindAddressBasedOnWifiP2pSubnet(ArrayList var0, InetAddress var1) {
- int var2 = TypeConversion.byteArrayToInt(var1.getAddress());
- Iterator var3 = var0.iterator();
-
- InetAddress var4;
- do {
- if(!var3.hasNext()) {
- return Network.getLoopbackAddress();
- }
-
- var4 = (InetAddress)var3.next();
- } while((-256 & TypeConversion.byteArrayToInt(var4.getAddress())) != (var2 & -256));
-
- return var4;
- }
-}
diff --git a/FtcRobotController/app/src/main/java/com/qualcomm/robotcore/robocol/RobocolDatagram.java b/FtcRobotController/app/src/main/java/com/qualcomm/robotcore/robocol/RobocolDatagram.java
deleted file mode 100644
index ecf354a..0000000
--- a/FtcRobotController/app/src/main/java/com/qualcomm/robotcore/robocol/RobocolDatagram.java
+++ /dev/null
@@ -1,79 +0,0 @@
-package com.qualcomm.robotcore.robocol;
-
-import com.qualcomm.robotcore.exception.RobotCoreException;
-import com.qualcomm.robotcore.robocol.RobocolParsable;
-import java.net.DatagramPacket;
-import java.net.InetAddress;
-
-public class RobocolDatagram {
- private DatagramPacket a;
-
- protected RobocolDatagram() {
- this.a = null;
- }
-
- public RobocolDatagram(RobocolParsable var1) throws RobotCoreException {
- this.setData(var1.toByteArray());
- }
-
- protected RobocolDatagram(DatagramPacket var1) {
- this.a = var1;
- }
-
- public RobocolDatagram(byte[] var1) {
- this.setData(var1);
- }
-
- public InetAddress getAddress() {
- return this.a.getAddress();
- }
-
- public byte[] getData() {
- return this.a.getData();
- }
-
- public int getLength() {
- return this.a.getLength();
- }
-
- public RobocolParsable.MsgType getMsgType() {
- return RobocolParsable.MsgType.fromByte(this.a.getData()[0]);
- }
-
- protected DatagramPacket getPacket() {
- return this.a;
- }
-
- public int getPayloadLength() {
- return -3 + this.a.getLength();
- }
-
- public void setAddress(InetAddress var1) {
- this.a.setAddress(var1);
- }
-
- public void setData(byte[] var1) {
- this.a = new DatagramPacket(var1, var1.length);
- }
-
- protected void setPacket(DatagramPacket var1) {
- this.a = var1;
- }
-
- public String toString() {
- String var1 = "NONE";
- String var2;
- int var3;
- if(this.a != null && this.a.getAddress() != null && this.a.getLength() > 0) {
- var1 = RobocolParsable.MsgType.fromByte(this.a.getData()[0]).name();
- var3 = this.a.getLength();
- var2 = this.a.getAddress().getHostAddress();
- } else {
- var2 = null;
- var3 = 0;
- }
-
- Object[] var4 = new Object[]{var1, var2, Integer.valueOf(var3)};
- return String.format("RobocolDatagram - type:%s, addr:%s, size:%d", var4);
- }
-}
diff --git a/FtcRobotController/app/src/main/java/com/qualcomm/robotcore/robocol/RobocolDatagramSocket.java b/FtcRobotController/app/src/main/java/com/qualcomm/robotcore/robocol/RobocolDatagramSocket.java
deleted file mode 100644
index abfb2c0..0000000
--- a/FtcRobotController/app/src/main/java/com/qualcomm/robotcore/robocol/RobocolDatagramSocket.java
+++ /dev/null
@@ -1,117 +0,0 @@
-package com.qualcomm.robotcore.robocol;
-
-import com.qualcomm.robotcore.robocol.RobocolConfig;
-import com.qualcomm.robotcore.robocol.RobocolDatagram;
-import com.qualcomm.robotcore.util.RobotLog;
-import java.io.IOException;
-import java.net.DatagramPacket;
-import java.net.DatagramSocket;
-import java.net.InetAddress;
-import java.net.InetSocketAddress;
-import java.net.PortUnreachableException;
-import java.net.SocketException;
-
-public class RobocolDatagramSocket {
- private final byte[] a = new byte[4098];
- private DatagramSocket b;
- private final DatagramPacket c;
- private final RobocolDatagram d;
- private volatile RobocolDatagramSocket.State e;
-
- public RobocolDatagramSocket() {
- this.c = new DatagramPacket(this.a, this.a.length);
- this.d = new RobocolDatagram();
- this.e = RobocolDatagramSocket.State.CLOSED;
- }
-
- public void bind(InetSocketAddress var1) throws SocketException {
- if(this.e != RobocolDatagramSocket.State.CLOSED) {
- this.close();
- }
-
- this.e = RobocolDatagramSocket.State.LISTENING;
- RobotLog.d("RobocolDatagramSocket binding to " + var1.toString());
- this.b = new DatagramSocket(var1);
- }
-
- public void close() {
- this.e = RobocolDatagramSocket.State.CLOSED;
- if(this.b != null) {
- this.b.close();
- }
-
- RobotLog.d("RobocolDatagramSocket is closed");
- }
-
- public void connect(InetAddress var1) throws SocketException {
- InetSocketAddress var2 = new InetSocketAddress(var1, 20884);
- RobotLog.d("RobocolDatagramSocket connected to " + var2.toString());
- this.b.connect(var2);
- }
-
- public InetAddress getInetAddress() {
- return this.b == null?null:this.b.getInetAddress();
- }
-
- public InetAddress getLocalAddress() {
- return this.b == null?null:this.b.getLocalAddress();
- }
-
- public RobocolDatagramSocket.State getState() {
- return this.e;
- }
-
- public boolean isClosed() {
- return this.e == RobocolDatagramSocket.State.CLOSED;
- }
-
- public boolean isRunning() {
- return this.e == RobocolDatagramSocket.State.LISTENING;
- }
-
- public void listen(InetAddress var1) throws SocketException {
- this.bind(new InetSocketAddress(RobocolConfig.determineBindAddress(var1), 20884));
- }
-
- public RobocolDatagram recv() {
- try {
- this.b.receive(this.c);
- } catch (PortUnreachableException var4) {
- RobotLog.d("RobocolDatagramSocket receive error: remote port unreachable");
- return null;
- } catch (IOException var5) {
- RobotLog.d("RobocolDatagramSocket receive error: " + var5.toString());
- return null;
- } catch (NullPointerException var6) {
- RobotLog.d("RobocolDatagramSocket receive error: " + var6.toString());
- }
-
- this.d.setPacket(this.c);
- return this.d;
- }
-
- public void send(RobocolDatagram var1) {
- try {
- this.b.send(var1.getPacket());
- } catch (IllegalArgumentException var5) {
- RobotLog.w("Unable to send RobocolDatagram: " + var5.toString());
- RobotLog.w(" " + var1.toString());
- } catch (IOException var6) {
- RobotLog.w("Unable to send RobocolDatagram: " + var6.toString());
- RobotLog.w(" " + var1.toString());
- } catch (NullPointerException var7) {
- RobotLog.w("Unable to send RobocolDatagram: " + var7.toString());
- RobotLog.w(" " + var1.toString());
- }
- }
-
- public static enum State {
- CLOSED,
- ERROR,
- LISTENING;
-
- static {
- RobocolDatagramSocket.State[] var0 = new RobocolDatagramSocket.State[]{LISTENING, CLOSED, ERROR};
- }
- }
-}
diff --git a/FtcRobotController/app/src/main/java/com/qualcomm/robotcore/robocol/RobocolParsable.java b/FtcRobotController/app/src/main/java/com/qualcomm/robotcore/robocol/RobocolParsable.java
deleted file mode 100644
index d8650ce..0000000
--- a/FtcRobotController/app/src/main/java/com/qualcomm/robotcore/robocol/RobocolParsable.java
+++ /dev/null
@@ -1,53 +0,0 @@
-package com.qualcomm.robotcore.robocol;
-
-import com.qualcomm.robotcore.exception.RobotCoreException;
-import com.qualcomm.robotcore.util.RobotLog;
-
-public interface RobocolParsable {
- byte[] EMPTY_HEADER_BUFFER = new byte[3];
- int HEADER_LENGTH = 3;
-
- void fromByteArray(byte[] var1) throws RobotCoreException;
-
- RobocolParsable.MsgType getRobocolMsgType();
-
- byte[] toByteArray() throws RobotCoreException;
-
- public static enum MsgType {
- COMMAND(4),
- EMPTY(0),
- GAMEPAD(2),
- HEARTBEAT(1),
- PEER_DISCOVERY(3),
- TELEMETRY(5);
-
- private static final RobocolParsable.MsgType[] a;
- private final int b;
-
- static {
- RobocolParsable.MsgType[] var0 = new RobocolParsable.MsgType[]{EMPTY, HEARTBEAT, GAMEPAD, PEER_DISCOVERY, COMMAND, TELEMETRY};
- a = values();
- }
-
- private MsgType(int var3) {
- this.b = var3;
- }
-
- public static RobocolParsable.MsgType fromByte(byte var0) {
- RobocolParsable.MsgType var1 = EMPTY;
-
- try {
- RobocolParsable.MsgType var4 = a[var0];
- return var4;
- } catch (ArrayIndexOutOfBoundsException var5) {
- Object[] var3 = new Object[]{Byte.valueOf(var0), var5.toString()};
- RobotLog.w(String.format("Cannot convert %d to MsgType: %s", var3));
- return var1;
- }
- }
-
- public byte asByte() {
- return (byte)this.b;
- }
- }
-}
diff --git a/FtcRobotController/app/src/main/java/com/qualcomm/robotcore/robot/Robot.java b/FtcRobotController/app/src/main/java/com/qualcomm/robotcore/robot/Robot.java
deleted file mode 100644
index f48c972..0000000
--- a/FtcRobotController/app/src/main/java/com/qualcomm/robotcore/robot/Robot.java
+++ /dev/null
@@ -1,39 +0,0 @@
-package com.qualcomm.robotcore.robot;
-
-import com.qualcomm.robotcore.eventloop.EventLoop;
-import com.qualcomm.robotcore.eventloop.EventLoopManager;
-import com.qualcomm.robotcore.exception.RobotCoreException;
-import com.qualcomm.robotcore.robocol.RobocolDatagram;
-import com.qualcomm.robotcore.robocol.RobocolDatagramSocket;
-import com.qualcomm.robotcore.util.RobotLog;
-import java.net.InetAddress;
-import java.net.SocketException;
-import java.util.concurrent.ArrayBlockingQueue;
-
-public class Robot {
- public EventLoopManager eventLoopManager = null;
- public ArrayBlockingQueue eventQueue = null;
- public ArrayBlockingQueue sendQueue = null;
- public RobocolDatagramSocket socket = null;
-
- public void shutdown() {
- if(this.eventLoopManager != null) {
- this.eventLoopManager.shutdown();
- }
-
- if(this.socket != null) {
- this.socket.close();
- }
-
- }
-
- public void start(InetAddress var1, EventLoop var2) throws RobotCoreException {
- try {
- this.socket.listen(var1);
- this.eventLoopManager.start(var2);
- } catch (SocketException var4) {
- RobotLog.logStacktrace((Exception)var4);
- throw new RobotCoreException("Robot start failed: " + var4.toString());
- }
- }
-}
diff --git a/FtcRobotController/app/src/main/java/com/qualcomm/robotcore/robot/RobotState.java b/FtcRobotController/app/src/main/java/com/qualcomm/robotcore/robot/RobotState.java
deleted file mode 100644
index 423204d..0000000
--- a/FtcRobotController/app/src/main/java/com/qualcomm/robotcore/robot/RobotState.java
+++ /dev/null
@@ -1,41 +0,0 @@
-package com.qualcomm.robotcore.robot;
-
-import com.qualcomm.robotcore.util.RobotLog;
-
-public enum RobotState {
- DROPPED_CONNECTION(5),
- EMERGENCY_STOP(4),
- INIT(1),
- NOT_STARTED(0),
- RUNNING(2),
- STOPPED(3);
-
- private static final RobotState[] b;
- private int a;
-
- static {
- RobotState[] var0 = new RobotState[]{NOT_STARTED, INIT, RUNNING, STOPPED, EMERGENCY_STOP, DROPPED_CONNECTION};
- b = values();
- }
-
- private RobotState(int var3) {
- this.a = var3;
- }
-
- public static RobotState fromByte(byte var0) {
- RobotState var1 = NOT_STARTED;
-
- try {
- RobotState var4 = b[var0];
- return var4;
- } catch (ArrayIndexOutOfBoundsException var5) {
- Object[] var3 = new Object[]{Byte.valueOf(var0), var5.toString()};
- RobotLog.w(String.format("Cannot convert %d to RobotState: %s", var3));
- return var1;
- }
- }
-
- public byte asByte() {
- return (byte)this.a;
- }
-}
diff --git a/FtcRobotController/app/src/main/java/com/qualcomm/robotcore/sensor/SensorBase.java b/FtcRobotController/app/src/main/java/com/qualcomm/robotcore/sensor/SensorBase.java
deleted file mode 100644
index 3cbb371..0000000
--- a/FtcRobotController/app/src/main/java/com/qualcomm/robotcore/sensor/SensorBase.java
+++ /dev/null
@@ -1,24 +0,0 @@
-package com.qualcomm.robotcore.sensor;
-
-import com.qualcomm.robotcore.sensor.SensorListener;
-import java.util.List;
-
-public abstract class SensorBase {
- protected List> mListeners;
-
- public SensorBase(List> var1) {
- this.mListeners = var1;
- }
-
- public abstract boolean initialize();
-
- public abstract boolean pause();
-
- public abstract boolean resume();
-
- public abstract boolean shutdown();
-
- public final void update(T param1) {
- // $FF: Couldn't be decompiled
- }
-}
diff --git a/FtcRobotController/app/src/main/java/com/qualcomm/robotcore/sensor/SensorImageLocalizer.java b/FtcRobotController/app/src/main/java/com/qualcomm/robotcore/sensor/SensorImageLocalizer.java
deleted file mode 100644
index 3df1623..0000000
--- a/FtcRobotController/app/src/main/java/com/qualcomm/robotcore/sensor/SensorImageLocalizer.java
+++ /dev/null
@@ -1,230 +0,0 @@
-package com.qualcomm.robotcore.sensor;
-
-import android.util.Log;
-import com.qualcomm.robotcore.sensor.SensorBase;
-import com.qualcomm.robotcore.sensor.SensorListener;
-import com.qualcomm.robotcore.sensor.TargetInfo;
-import com.qualcomm.robotcore.sensor.TargetSize;
-import com.qualcomm.robotcore.sensor.TrackedTargetInfo;
-import com.qualcomm.robotcore.util.MatrixD;
-import com.qualcomm.robotcore.util.Pose;
-import com.qualcomm.robotcore.util.PoseUtils;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-
-public class SensorImageLocalizer extends SensorBase implements SensorListener> {
- private final boolean a = false;
- private final String b = "SensorImageLocalizer";
- private final Map c = new HashMap();
- private Pose d;
- private final HashMap e = new HashMap();
- private SensorImageLocalizer.a f;
-
- public SensorImageLocalizer(List> var1) {
- super(var1);
- }
-
- private boolean a(TrackedTargetInfo var1) {
- long var2 = System.currentTimeMillis() / 1000L;
- SensorImageLocalizer.a var4;
- if(this.e.containsKey(var1.mTargetInfo.mTargetName)) {
- var4 = (SensorImageLocalizer.a)this.e.get(var1.mTargetInfo.mTargetName);
- var4.b = var1.mTimeTracked;
- var4.e = var1.mConfidence;
- if(var2 - var4.b > 120L) {
- var4.c = 1;
- } else {
- ++var4.c;
- }
- } else {
- var4 = new SensorImageLocalizer.a(null);
- var4.e = var1.mConfidence;
- var4.d = var1.mTargetInfo.mTargetName;
- var4.b = var1.mTimeTracked;
- var4.c = 1;
- this.e.put(var1.mTargetInfo.mTargetName, var4);
- }
-
- if(this.f != null && this.f.d != var4.d && var2 - this.f.a < 10L) {
- Log.d("SensorImageLocalizer", "Ignoring target " + var1.mTargetInfo.mTargetName + " Time diff " + (var2 - this.f.a));
- return false;
- } else {
- return true;
- }
- }
-
- public void AddListener(SensorListener param1) {
- // $FF: Couldn't be decompiled
- }
-
- public void RemoveListener(SensorListener param1) {
- // $FF: Couldn't be decompiled
- }
-
- public boolean addRobotToCameraRef(double var1, double var3, double var5, double var7) {
- new MatrixD(3, 3);
- MatrixD var10 = Pose.makeRotationY(-var7);
- MatrixD var11 = new MatrixD(3, 4);
- var11.setSubmatrix(var10, 3, 3, 0, 0);
- var11.data()[0][3] = var3;
- var11.data()[1][3] = -var5;
- var11.data()[2][3] = var1;
- this.d = new Pose(var11);
- return true;
- }
-
- public boolean addTargetReference(String var1, double var2, double var4, double var6, double var8, double var10, double var12) {
- if(var1 == null) {
- throw new IllegalArgumentException("Null targetInfoWorldRef");
- } else if(this.c.containsKey(var1)) {
- return false;
- } else {
- MatrixD var14 = Pose.makeRotationY(Math.toRadians(var8));
- MatrixD var15 = new MatrixD(3, 4);
- var15.setSubmatrix(var14, 3, 3, 0, 0);
- var15.data()[0][3] = var4;
- var15.data()[1][3] = var6;
- var15.data()[2][3] = var2;
- Pose var17 = new Pose(var15);
- Log.d("SensorImageLocalizer", "Target Pose \n" + var15);
- TargetInfo var19 = new TargetInfo(var1, var17, new TargetSize(var1, var10, var12));
- this.c.put(var1, var19);
- return true;
- }
- }
-
- public boolean initialize() {
- return true;
- }
-
- public void onUpdate(List var1) {
- Log.d("SensorImageLocalizer", "SensorImageLocalizer onUpdate");
- if(var1 != null && var1.size() >= 1) {
- boolean var4 = false;
- double var5 = Double.MIN_VALUE;
- long var7 = System.currentTimeMillis() / 1000L;
- TrackedTargetInfo var9 = null;
- SensorImageLocalizer.a var10 = null;
-
- double var40;
- for(Iterator var11 = var1.iterator(); var11.hasNext(); var5 = var40) {
- TrackedTargetInfo var36;
- boolean var39;
- label40: {
- var36 = (TrackedTargetInfo)var11.next();
- if(this.c.containsKey(var36.mTargetInfo.mTargetName)) {
- if(this.a(var36) && var36.mConfidence > var5) {
- var10 = (SensorImageLocalizer.a)this.e.get(var36.mTargetInfo.mTargetName);
- var40 = var36.mConfidence;
- var39 = true;
- Log.d("SensorImageLocalizer", "Potential target " + var36.mTargetInfo.mTargetName + " Confidence " + var36.mConfidence);
- break label40;
- }
-
- Log.d("SensorImageLocalizer", "Ignoring target " + var36.mTargetInfo.mTargetName + " Confidence " + var36.mConfidence);
- }
-
- var36 = var9;
- var39 = var4;
- var40 = var5;
- }
-
- var9 = var36;
- var4 = var39;
- }
-
- if(!var4) {
- this.update((Object)null);
- } else {
- TargetInfo var12 = (TargetInfo)this.c.get(var9.mTargetInfo.mTargetName);
- var10.a = var7;
- this.f = var10;
- Log.d("SensorImageLocalizer", "Selected target " + var9.mTargetInfo.mTargetName + " time " + var7);
- Pose var14 = this.d;
- MatrixD var15 = null;
- if(var14 != null) {
- var15 = this.d.poseMatrix.submatrix(3, 3, 0, 0);
- }
-
- MatrixD var16 = var9.mTargetInfo.mTargetPose.poseMatrix.submatrix(3, 3, 0, 0).transpose();
- MatrixD var17 = var12.mTargetPose.poseMatrix.submatrix(3, 3, 0, 0);
- MatrixD var18 = Pose.makeRotationX(Math.toRadians(90.0D)).times(Pose.makeRotationY(Math.toRadians(90.0D)));
- MatrixD var19 = var18.times(var17).times(var16);
- MatrixD var20;
- if(var15 != null) {
- var20 = var19.times(var15);
- } else {
- var20 = var19;
- }
-
- MatrixD var21 = new MatrixD(3, 1);
- var21.data()[0][0] = var12.mTargetSize.mLongSide;
- var21.data()[1][0] = var12.mTargetSize.mShortSide;
- var21.data()[2][0] = 0.0D;
- MatrixD var22 = var16.times(var9.mTargetInfo.mTargetPose.getTranslationMatrix());
- MatrixD var23 = new MatrixD(3, 1);
- if(this.d != null) {
- var23 = this.d.getTranslationMatrix();
- }
-
- MatrixD var24 = var17.times(var22.add(var16.times(var23)).add(var21));
- MatrixD var25 = var18.times(var12.mTargetPose.getTranslationMatrix().subtract(var24));
- MatrixD var26 = new MatrixD(3, 4);
- var26.setSubmatrix(var20, 3, 3, 0, 0);
- var26.setSubmatrix(var25, 3, 1, 0, 3);
- Pose var29 = new Pose(var26);
- double[] var30 = PoseUtils.getAnglesAroundZ(var29);
- Object[] var31 = new Object[]{Double.valueOf(var30[0]), Double.valueOf(var30[1]), Double.valueOf(var30[2])};
- Log.d("SensorImageLocalizer", String.format("POSE_HEADING: x %8.4f z %8.4f up %8.4f", var31));
- MatrixD var33 = var29.getTranslationMatrix();
- Object[] var34 = new Object[]{Double.valueOf(var33.data()[0][0]), Double.valueOf(var33.data()[1][0]), Double.valueOf(var33.data()[2][0])};
- Log.d("SensorImageLocalizer", String.format("POSE_TRANS: x %8.4f y %8.4f z %8.4f", var34));
- this.update(var29);
- }
- } else {
- Log.d("SensorImageLocalizer", "SensorImageLocalizer onUpdate NULL");
- this.update((Object)null);
- }
- }
-
- public boolean pause() {
- return true;
- }
-
- public boolean removeTargetReference(String var1) {
- if(var1 == null) {
- throw new IllegalArgumentException("Null targetName");
- } else if(this.c.containsKey(var1)) {
- this.c.remove(var1);
- return true;
- } else {
- return false;
- }
- }
-
- public boolean resume() {
- return true;
- }
-
- public boolean shutdown() {
- return true;
- }
-
- private class a {
- public long a;
- public long b;
- public int c;
- public String d;
- public double e;
-
- private a() {
- }
-
- // $FF: synthetic method
- a(Object var2) {
- this();
- }
- }
-}
diff --git a/FtcRobotController/app/src/main/java/com/qualcomm/robotcore/sensor/SensorTargetPose.java b/FtcRobotController/app/src/main/java/com/qualcomm/robotcore/sensor/SensorTargetPose.java
deleted file mode 100644
index 248fc0a..0000000
--- a/FtcRobotController/app/src/main/java/com/qualcomm/robotcore/sensor/SensorTargetPose.java
+++ /dev/null
@@ -1,12 +0,0 @@
-package com.qualcomm.robotcore.sensor;
-
-import com.qualcomm.robotcore.sensor.SensorBase;
-import com.qualcomm.robotcore.sensor.SensorListener;
-import com.qualcomm.robotcore.sensor.TrackedTargetInfo;
-import java.util.List;
-
-public abstract class SensorTargetPose extends SensorBase> {
- public SensorTargetPose(List>> var1) {
- super(var1);
- }
-}
diff --git a/FtcRobotController/app/src/main/java/com/qualcomm/robotcore/sensor/TargetInfo.java b/FtcRobotController/app/src/main/java/com/qualcomm/robotcore/sensor/TargetInfo.java
deleted file mode 100644
index c528f38..0000000
--- a/FtcRobotController/app/src/main/java/com/qualcomm/robotcore/sensor/TargetInfo.java
+++ /dev/null
@@ -1,19 +0,0 @@
-package com.qualcomm.robotcore.sensor;
-
-import com.qualcomm.robotcore.sensor.TargetSize;
-import com.qualcomm.robotcore.util.Pose;
-
-public class TargetInfo {
- public String mTargetName;
- public Pose mTargetPose;
- public TargetSize mTargetSize;
-
- public TargetInfo() {
- }
-
- public TargetInfo(String var1, Pose var2, TargetSize var3) {
- this.mTargetName = var1;
- this.mTargetPose = var2;
- this.mTargetSize = var3;
- }
-}
diff --git a/FtcRobotController/app/src/main/java/com/qualcomm/robotcore/sensor/TargetSize.java b/FtcRobotController/app/src/main/java/com/qualcomm/robotcore/sensor/TargetSize.java
deleted file mode 100644
index 6793dd8..0000000
--- a/FtcRobotController/app/src/main/java/com/qualcomm/robotcore/sensor/TargetSize.java
+++ /dev/null
@@ -1,17 +0,0 @@
-package com.qualcomm.robotcore.sensor;
-
-public class TargetSize {
- public double mLongSide;
- public double mShortSide;
- public String mTargetName;
-
- public TargetSize() {
- this("", 0.0D, 0.0D);
- }
-
- public TargetSize(String var1, double var2, double var4) {
- this.mTargetName = var1;
- this.mLongSide = var2;
- this.mShortSide = var4;
- }
-}
diff --git a/FtcRobotController/app/src/main/java/com/qualcomm/robotcore/sensor/TrackedTargetInfo.java b/FtcRobotController/app/src/main/java/com/qualcomm/robotcore/sensor/TrackedTargetInfo.java
deleted file mode 100644
index cf4ca04..0000000
--- a/FtcRobotController/app/src/main/java/com/qualcomm/robotcore/sensor/TrackedTargetInfo.java
+++ /dev/null
@@ -1,15 +0,0 @@
-package com.qualcomm.robotcore.sensor;
-
-import com.qualcomm.robotcore.sensor.TargetInfo;
-
-public class TrackedTargetInfo {
- public double mConfidence;
- public TargetInfo mTargetInfo;
- public long mTimeTracked;
-
- public TrackedTargetInfo(TargetInfo var1, double var2, long var4) {
- this.mTargetInfo = var1;
- this.mConfidence = var2;
- this.mTimeTracked = var4;
- }
-}
diff --git a/FtcRobotController/app/src/main/java/com/qualcomm/robotcore/util/BatteryChecker.java b/FtcRobotController/app/src/main/java/com/qualcomm/robotcore/util/BatteryChecker.java
deleted file mode 100644
index 88b15ab..0000000
--- a/FtcRobotController/app/src/main/java/com/qualcomm/robotcore/util/BatteryChecker.java
+++ /dev/null
@@ -1,56 +0,0 @@
-package com.qualcomm.robotcore.util;
-
-import android.content.BroadcastReceiver;
-import android.content.Context;
-import android.content.Intent;
-import android.content.IntentFilter;
-import android.os.Handler;
-import com.qualcomm.robotcore.util.RobotLog;
-
-public class BatteryChecker {
- Runnable a = new Runnable() {
- public void run() {
- float var1 = BatteryChecker.this.getBatteryLevel();
- BatteryChecker.this.e.updateBatteryLevel(var1);
- RobotLog.i("Battery Checker, Level Remaining: " + var1);
- BatteryChecker.this.batteryHandler.postDelayed(BatteryChecker.this.a, BatteryChecker.this.c);
- }
- };
- private Context b;
- protected Handler batteryHandler;
- private long c;
- private long d = 5000L;
- private BatteryChecker.BatteryWatcher e;
-
- public BatteryChecker(Context var1, BatteryChecker.BatteryWatcher var2, long var3) {
- this.b = var1;
- this.e = var2;
- this.c = var3;
- this.batteryHandler = new Handler();
- }
-
- public void endBatteryMonitoring() {
- this.batteryHandler.removeCallbacks(this.a);
- }
-
- public float getBatteryLevel() {
- int var1 = -1;
- IntentFilter var2 = new IntentFilter("android.intent.action.BATTERY_CHANGED");
- Intent var3 = this.b.registerReceiver((BroadcastReceiver)null, var2);
- int var4 = var3.getIntExtra("level", var1);
- int var5 = var3.getIntExtra("scale", var1);
- if(var4 >= 0 && var5 > 0) {
- var1 = var4 * 100 / var5;
- }
-
- return (float)var1;
- }
-
- public void startBatteryMonitoring() {
- this.batteryHandler.postDelayed(this.a, this.d);
- }
-
- public interface BatteryWatcher {
- void updateBatteryLevel(float var1);
- }
-}
diff --git a/FtcRobotController/app/src/main/java/com/qualcomm/robotcore/util/CurvedWheelMotion.java b/FtcRobotController/app/src/main/java/com/qualcomm/robotcore/util/CurvedWheelMotion.java
deleted file mode 100644
index f970f13..0000000
--- a/FtcRobotController/app/src/main/java/com/qualcomm/robotcore/util/CurvedWheelMotion.java
+++ /dev/null
@@ -1,31 +0,0 @@
-package com.qualcomm.robotcore.util;
-
-import com.qualcomm.robotcore.util.RobotLog;
-
-public class CurvedWheelMotion {
- public static double getDiffDriveRobotRotVelocity(int var0, int var1, int var2) {
- return Math.toDegrees((double)((var1 - var0) / var2));
- }
-
- public static int getDiffDriveRobotTransVelocity(int var0, int var1) {
- return (var0 + var1) / 2;
- }
-
- public static int getDiffDriveRobotWheelVelocity(int var0, double var1, int var3, int var4, boolean var5) {
- double var6 = Math.toRadians(var1);
- double var8;
- if(var5) {
- var8 = ((double)(var0 * 2) - var6 * (double)var4) / (double)(var3 * 2);
- } else {
- var8 = ((double)(var0 * 2) + var6 * (double)var4) / (double)(var3 * 2);
- }
-
- return (int)(var8 * (double)var3);
- }
-
- public static int velocityForRotationMmPerSec(int var0, int var1, double var2, int var4, int var5) {
- int var6 = (int)(var2 * (6.283185307179586D * (double)((int)Math.sqrt(Math.pow((double)(var4 - var0), 2.0D) + Math.pow((double)(var5 - var1), 2.0D))) / 360.0D));
- RobotLog.d("CurvedWheelMotion rX " + var0 + ", theta " + var2 + ", velocity " + var6);
- return var6;
- }
-}
diff --git a/FtcRobotController/app/src/main/java/com/qualcomm/robotcore/util/DifferentialControlLoopCoefficients.java b/FtcRobotController/app/src/main/java/com/qualcomm/robotcore/util/DifferentialControlLoopCoefficients.java
deleted file mode 100644
index 1728f34..0000000
--- a/FtcRobotController/app/src/main/java/com/qualcomm/robotcore/util/DifferentialControlLoopCoefficients.java
+++ /dev/null
@@ -1,16 +0,0 @@
-package com.qualcomm.robotcore.util;
-
-public class DifferentialControlLoopCoefficients {
- public double d = 0.0D;
- public double i = 0.0D;
- public double p = 0.0D;
-
- public DifferentialControlLoopCoefficients() {
- }
-
- public DifferentialControlLoopCoefficients(double var1, double var3, double var5) {
- this.p = var1;
- this.i = var3;
- this.d = var5;
- }
-}
diff --git a/FtcRobotController/app/src/main/java/com/qualcomm/robotcore/util/Dimmer.java b/FtcRobotController/app/src/main/java/com/qualcomm/robotcore/util/Dimmer.java
deleted file mode 100644
index 307d40e..0000000
--- a/FtcRobotController/app/src/main/java/com/qualcomm/robotcore/util/Dimmer.java
+++ /dev/null
@@ -1,65 +0,0 @@
-package com.qualcomm.robotcore.util;
-
-import android.app.Activity;
-import android.os.Handler;
-import android.view.WindowManager.LayoutParams;
-
-public class Dimmer {
- public static final int DEFAULT_DIM_TIME = 30000;
- public static final int LONG_BRIGHT_TIME = 60000;
- public static final float MAXIMUM_BRIGHTNESS = 1.0F;
- public static final float MINIMUM_BRIGHTNESS = 0.05F;
- Handler a;
- Activity b;
- final LayoutParams c;
- long d;
- float e;
-
- public Dimmer(long var1, Activity var3) {
- this.a = new Handler();
- this.e = 1.0F;
- this.d = var1;
- this.b = var3;
- this.c = var3.getWindow().getAttributes();
- this.e = this.c.screenBrightness;
- }
-
- public Dimmer(Activity var1) {
- this(30000L, var1);
- }
-
- private float a() {
- float var1 = 0.05F * this.e;
- return var1 < 0.05F?0.05F:var1;
- }
-
- private void a(float var1) {
- this.c.screenBrightness = var1;
- this.b.runOnUiThread(new Runnable() {
- public void run() {
- Dimmer.this.b.getWindow().setAttributes(Dimmer.this.c);
- }
- });
- }
-
- public void handleDimTimer() {
- this.a(this.e);
- this.a.removeCallbacks((Runnable)null);
- this.a.postDelayed(new Runnable() {
- public void run() {
- Dimmer.this.a(Dimmer.this.a());
- }
- }, this.d);
- }
-
- public void longBright() {
- this.a(this.e);
- Runnable var1 = new Runnable() {
- public void run() {
- Dimmer.this.a(Dimmer.this.a());
- }
- };
- this.a.removeCallbacksAndMessages((Object)null);
- this.a.postDelayed(var1, 60000L);
- }
-}
diff --git a/FtcRobotController/app/src/main/java/com/qualcomm/robotcore/util/ElapsedTime.java b/FtcRobotController/app/src/main/java/com/qualcomm/robotcore/util/ElapsedTime.java
deleted file mode 100644
index 90aca3e..0000000
--- a/FtcRobotController/app/src/main/java/com/qualcomm/robotcore/util/ElapsedTime.java
+++ /dev/null
@@ -1,64 +0,0 @@
-package com.qualcomm.robotcore.util;
-
-import com.qualcomm.robotcore.util.RobotLog;
-
-public class ElapsedTime {
- private long a = 0L;
- private double b = 1.0E9D;
-
- public ElapsedTime() {
- this.reset();
- }
-
- public ElapsedTime(long var1) {
- this.a = var1;
- }
-
- public ElapsedTime(ElapsedTime.Resolution var1) {
- this.reset();
- switch(null.a[var1.ordinal()]) {
- case 1:
- this.b = 1.0E9D;
- return;
- case 2:
- this.b = 1000000.0D;
- return;
- default:
- }
- }
-
- private String a() {
- return this.b == 1.0E9D?"seconds":(this.b == 1000000.0D?"milliseconds":"Unknown units");
- }
-
- public void log(String var1) {
- Object[] var2 = new Object[]{var1, Double.valueOf(this.time()), this.a()};
- RobotLog.v(String.format("TIMER: %20s - %1.3f %s", var2));
- }
-
- public void reset() {
- this.a = System.nanoTime();
- }
-
- public double startTime() {
- return (double)this.a / this.b;
- }
-
- public double time() {
- return (double)(System.nanoTime() - this.a) / this.b;
- }
-
- public String toString() {
- Object[] var1 = new Object[]{Double.valueOf(this.time()), this.a()};
- return String.format("%1.4f %s", var1);
- }
-
- public static enum Resolution {
- MILLISECONDS,
- SECONDS;
-
- static {
- ElapsedTime.Resolution[] var0 = new ElapsedTime.Resolution[]{SECONDS, MILLISECONDS};
- }
- }
-}
diff --git a/FtcRobotController/app/src/main/java/com/qualcomm/robotcore/util/ExtractAssets.java b/FtcRobotController/app/src/main/java/com/qualcomm/robotcore/util/ExtractAssets.java
deleted file mode 100644
index 13bcb71..0000000
--- a/FtcRobotController/app/src/main/java/com/qualcomm/robotcore/util/ExtractAssets.java
+++ /dev/null
@@ -1,34 +0,0 @@
-package com.qualcomm.robotcore.util;
-
-import android.content.Context;
-import android.os.Environment;
-import android.util.Log;
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.Iterator;
-
-public class ExtractAssets {
- private static final String a = ExtractAssets.class.getSimpleName();
-
- public static ArrayList ExtractToStorage(Context var0, ArrayList var1, boolean var2) throws IOException {
- if(!var2 && !"mounted".equals(Environment.getExternalStorageState())) {
- throw new IOException("External Storage not accessible");
- } else {
- ArrayList var3 = new ArrayList();
- Iterator var4 = var1.iterator();
-
- while(var4.hasNext()) {
- a(var0, (String)var4.next(), var2, var3);
- if(var3 != null) {
- Log.d(a, "got " + var3.size() + " elements");
- }
- }
-
- return var3;
- }
- }
-
- private static ArrayList a(Context param0, String param1, boolean param2, ArrayList param3) {
- // $FF: Couldn't be decompiled
- }
-}
diff --git a/FtcRobotController/app/src/main/java/com/qualcomm/robotcore/util/GenericDialogFragment.java b/FtcRobotController/app/src/main/java/com/qualcomm/robotcore/util/GenericDialogFragment.java
deleted file mode 100644
index 8a1480a..0000000
--- a/FtcRobotController/app/src/main/java/com/qualcomm/robotcore/util/GenericDialogFragment.java
+++ /dev/null
@@ -1,20 +0,0 @@
-package com.qualcomm.robotcore.util;
-
-import android.app.Dialog;
-import android.app.DialogFragment;
-import android.app.AlertDialog.Builder;
-import android.content.DialogInterface;
-import android.content.DialogInterface.OnClickListener;
-import android.os.Bundle;
-
-public class GenericDialogFragment extends DialogFragment {
- public Dialog onCreateDialog(Bundle var1) {
- String var2 = this.getArguments().getString("dialogMsg", "App error condition!");
- Builder var3 = new Builder(this.getActivity());
- var3.setMessage(var2).setPositiveButton("OK", new OnClickListener() {
- public void onClick(DialogInterface var1, int var2) {
- }
- });
- return var3.create();
- }
-}
diff --git a/FtcRobotController/app/src/main/java/com/qualcomm/robotcore/util/Hardware.java b/FtcRobotController/app/src/main/java/com/qualcomm/robotcore/util/Hardware.java
deleted file mode 100644
index 60df54b..0000000
--- a/FtcRobotController/app/src/main/java/com/qualcomm/robotcore/util/Hardware.java
+++ /dev/null
@@ -1,49 +0,0 @@
-package com.qualcomm.robotcore.util;
-
-import android.os.Build;
-import android.view.InputDevice;
-import com.qualcomm.robotcore.util.RobotLog;
-import java.util.HashSet;
-import java.util.Set;
-
-public class Hardware {
- private static boolean a = CheckIfIFC();
-
- public static boolean CheckIfIFC() {
- String var0 = Build.BOARD;
- String var1 = Build.BRAND;
- String var2 = Build.DEVICE;
- String var3 = Build.HARDWARE;
- String var4 = Build.MANUFACTURER;
- String var5 = Build.MODEL;
- String var6 = Build.PRODUCT;
- RobotLog.d("Platform information: board = " + var0 + " brand = " + var1 + " device = " + var2 + " hardware = " + var3 + " manufacturer = " + var4 + " model = " + var5 + " product = " + var6);
- if(var0.equals("MSM8960") && var1.equals("qcom") && var2.equals("msm8960") && var3.equals("qcom") && var4.equals("unknown") && var5.equals("msm8960") && var6.equals("msm8960")) {
- RobotLog.d("Detected IFC6410 Device!");
- return true;
- } else {
- RobotLog.d("Detected regular SmartPhone Device!");
- return false;
- }
- }
-
- public static boolean IsIFC() {
- return a;
- }
-
- public static Set getGameControllerIds() {
- HashSet var0 = new HashSet();
- int[] var1 = InputDevice.getDeviceIds();
- int var2 = var1.length;
-
- for(int var3 = 0; var3 < var2; ++var3) {
- int var4 = var1[var3];
- int var5 = InputDevice.getDevice(var4).getSources();
- if((var5 & 1025) == 1025 || (var5 & 16777232) == 16777232) {
- var0.add(Integer.valueOf(var4));
- }
- }
-
- return var0;
- }
-}
diff --git a/FtcRobotController/app/src/main/java/com/qualcomm/robotcore/util/ImmersiveMode.java b/FtcRobotController/app/src/main/java/com/qualcomm/robotcore/util/ImmersiveMode.java
deleted file mode 100644
index 003ee71..0000000
--- a/FtcRobotController/app/src/main/java/com/qualcomm/robotcore/util/ImmersiveMode.java
+++ /dev/null
@@ -1,31 +0,0 @@
-package com.qualcomm.robotcore.util;
-
-import android.os.Handler;
-import android.os.Message;
-import android.os.Build.VERSION;
-import android.view.View;
-
-public class ImmersiveMode {
- View a;
- Handler b = new Handler() {
- public void handleMessage(Message var1) {
- ImmersiveMode.this.hideSystemUI();
- }
- };
-
- public ImmersiveMode(View var1) {
- this.a = var1;
- }
-
- public static boolean apiOver19() {
- return VERSION.SDK_INT >= 19;
- }
-
- public void cancelSystemUIHide() {
- this.b.removeMessages(0);
- }
-
- public void hideSystemUI() {
- this.a.setSystemUiVisibility(4098);
- }
-}
diff --git a/FtcRobotController/app/src/main/java/com/qualcomm/robotcore/util/MapView.java b/FtcRobotController/app/src/main/java/com/qualcomm/robotcore/util/MapView.java
deleted file mode 100644
index 12c77e5..0000000
--- a/FtcRobotController/app/src/main/java/com/qualcomm/robotcore/util/MapView.java
+++ /dev/null
@@ -1,207 +0,0 @@
-package com.qualcomm.robotcore.util;
-
-import android.content.Context;
-import android.graphics.Bitmap;
-import android.graphics.BitmapFactory;
-import android.graphics.Canvas;
-import android.graphics.Matrix;
-import android.graphics.Paint;
-import android.graphics.Bitmap.Config;
-import android.graphics.drawable.BitmapDrawable;
-import android.util.AttributeSet;
-import android.util.Log;
-import android.view.View;
-import java.util.HashMap;
-import java.util.Iterator;
-
-public class MapView extends View {
- MapView a;
- private int b;
- private int c;
- private int d;
- private int e;
- private Paint f;
- private Canvas g;
- private Bitmap h;
- private boolean i = false;
- private boolean j = false;
- private int k = 1;
- private float l;
- private float m;
- private BitmapDrawable n;
- private int o;
- private int p;
- private int q;
- private boolean r = false;
- private HashMap s;
- private Bitmap t;
-
- public MapView(Context var1) {
- super(var1);
- this.a();
- }
-
- public MapView(Context var1, AttributeSet var2) {
- super(var1, var2);
- this.a();
- }
-
- public MapView(Context var1, AttributeSet var2, int var3) {
- super(var1, var2, var3);
- this.a();
- }
-
- private int a(int var1) {
- return var1 % 2 == 0?var1:var1 + 1;
- }
-
- private void a() {
- this.f = new Paint();
- this.f.setColor(-16777216);
- this.f.setStrokeWidth(1.0F);
- this.f.setAntiAlias(true);
- this.a = this;
- this.s = new HashMap();
- }
-
- private float b(int var1) {
- return (float)var1 * this.l + (float)(this.getWidth() / 2);
- }
-
- private void b() {
- this.h = Bitmap.createBitmap(this.getWidth(), this.getHeight(), Config.ARGB_8888);
- this.g = new Canvas(this.h);
- Paint var1 = new Paint();
- var1.setColor(-1);
- var1.setAntiAlias(true);
- this.g.drawRect(0.0F, 0.0F, (float)this.g.getWidth(), (float)this.g.getHeight(), var1);
-
- for(int var2 = 0; var2 < this.c; var2 += this.e) {
- float var5 = (float)var2 * this.m;
- this.g.drawLine(0.0F, var5, (float)this.g.getWidth(), var5, this.f);
- }
-
- for(int var3 = 0; var3 < this.b; var3 += this.d) {
- float var4 = (float)var3 * this.l;
- this.g.drawLine(var4, 0.0F, var4, (float)this.g.getHeight(), this.f);
- }
-
- }
-
- private float c(int var1) {
- float var2 = (float)var1 * this.m;
- return (float)(this.getHeight() / 2) - var2;
- }
-
- private void c() {
- Iterator var1 = this.s.values().iterator();
-
- while(var1.hasNext()) {
- MapView.a var2 = (MapView.a)var1.next();
- float var3 = this.b(var2.b);
- float var4 = this.c(var2.c);
- if(var2.e) {
- Paint var5 = new Paint();
- var5.setColor(var2.d);
- this.g.drawCircle(var3, var4, 5.0F, var5);
- } else {
- Bitmap var6 = BitmapFactory.decodeResource(this.getResources(), var2.d);
- float var7 = var3 - (float)(var6.getWidth() / 2);
- float var8 = var4 - (float)(var6.getHeight() / 2);
- this.g.drawBitmap(var6, var7, var8, new Paint());
- }
- }
-
- }
-
- private int d(int var1) {
- return 360 - var1;
- }
-
- private void d() {
- float var1 = this.b(this.o);
- float var2 = this.c(this.p);
- int var3 = this.d(this.q);
- Matrix var4 = new Matrix();
- var4.postRotate((float)var3);
- var4.postScale(0.2F, 0.2F);
- Bitmap var7 = this.t;
- Bitmap var8 = Bitmap.createBitmap(var7, 0, 0, var7.getWidth(), var7.getHeight(), var4, true);
- float var9 = var1 - (float)(var8.getWidth() / 2);
- float var10 = var2 - (float)(var8.getHeight() / 2);
- this.g.drawBitmap(var8, var9, var10, new Paint());
- }
-
- public int addDrawable(int var1, int var2, int var3) {
- int var4 = this.k;
- this.k = var4 + 1;
- MapView.a var5 = new MapView.a(var4, -var1, var2, var3, false);
- this.s.put(Integer.valueOf(var4), var5);
- return var4;
- }
-
- public int addMarker(int var1, int var2, int var3) {
- int var4 = this.k;
- this.k = var4 + 1;
- MapView.a var5 = new MapView.a(var4, -var1, var2, var3, true);
- this.s.put(Integer.valueOf(var4), var5);
- return var4;
- }
-
- protected void onSizeChanged(int var1, int var2, int var3, int var4) {
- this.l = (float)this.getWidth() / (float)this.b;
- this.m = (float)this.getHeight() / (float)this.c;
- this.j = true;
- this.redraw();
- Log.e("MapView", "Size changed");
- }
-
- public void redraw() {
- if(this.i && this.j) {
- this.b();
- this.c();
- if(this.r) {
- this.d();
- }
- }
-
- this.n = new BitmapDrawable(this.getResources(), this.h);
- this.a.setBackgroundDrawable(this.n);
- }
-
- public boolean removeMarker(int var1) {
- return this.s.remove(Integer.valueOf(var1)) != null;
- }
-
- public void setRobotLocation(int var1, int var2, int var3) {
- this.o = -var1;
- this.p = var2;
- this.q = var3;
- this.r = true;
- }
-
- public void setup(int var1, int var2, int var3, int var4, Bitmap var5) {
- this.b = var1 * 2;
- this.c = var2 * 2;
- this.d = this.b / this.a(var3);
- this.e = this.c / this.a(var4);
- this.t = var5;
- this.i = true;
- }
-
- private class a {
- public int a;
- public int b;
- public int c;
- public int d;
- public boolean e;
-
- public a(int var2, int var3, int var4, int var5, boolean var6) {
- this.a = var2;
- this.b = var3;
- this.c = var4;
- this.d = var5;
- this.e = var6;
- }
- }
-}
diff --git a/FtcRobotController/app/src/main/java/com/qualcomm/robotcore/util/MatrixD.java b/FtcRobotController/app/src/main/java/com/qualcomm/robotcore/util/MatrixD.java
deleted file mode 100644
index 3473126..0000000
--- a/FtcRobotController/app/src/main/java/com/qualcomm/robotcore/util/MatrixD.java
+++ /dev/null
@@ -1,305 +0,0 @@
-package com.qualcomm.robotcore.util;
-
-import android.util.Log;
-import java.lang.reflect.Array;
-
-public class MatrixD {
- protected int mCols;
- protected double[][] mData;
- protected int mRows;
-
- public MatrixD(int var1, int var2) {
- int[] var3 = new int[]{var1, var2};
- this((double[][])Array.newInstance(Double.TYPE, var3));
- }
-
- public MatrixD(double[] var1, int var2, int var3) {
- this(var2, var3);
- if(var1 == null) {
- throw new IllegalArgumentException("Attempted to initialize MatrixF with null array");
- } else if(var1.length != var2 * var3) {
- throw new IllegalArgumentException("Attempted to initialize MatrixF with rows/cols not matching init data");
- } else {
- for(int var4 = 0; var4 < var2; ++var4) {
- for(int var5 = 0; var5 < var3; ++var5) {
- this.mData[var4][var5] = var1[var5 + var3 * var4];
- }
- }
-
- }
- }
-
- public MatrixD(float[] var1, int var2, int var3) {
- this(var2, var3);
- if(var1 == null) {
- throw new IllegalArgumentException("Attempted to initialize MatrixF with null array");
- } else if(var1.length != var2 * var3) {
- throw new IllegalArgumentException("Attempted to initialize MatrixF with rows/cols not matching init data");
- } else {
- for(int var4 = 0; var4 < var2; ++var4) {
- for(int var5 = 0; var5 < var3; ++var5) {
- this.mData[var4][var5] = (double)var1[var5 + var3 * var4];
- }
- }
-
- }
- }
-
- public MatrixD(double[][] var1) {
- int var2 = 0;
- super();
- this.mData = var1;
- if(this.mData == null) {
- throw new IllegalArgumentException("Attempted to initialize MatrixF with null array");
- } else {
- this.mRows = this.mData.length;
- if(this.mRows <= 0) {
- throw new IllegalArgumentException("Attempted to initialize MatrixF with 0 rows");
- } else {
- for(this.mCols = this.mData[0].length; var2 < this.mRows; ++var2) {
- if(this.mData[var2].length != this.mCols) {
- throw new IllegalArgumentException("Attempted to initialize MatrixF with rows of unequal length");
- }
- }
-
- }
- }
- }
-
- public static void test() {
- Log.e("MatrixD", "Hello2 matrix");
- MatrixD var1 = new MatrixD(new double[][]{{1.0D, 0.0D, -2.0D}, {0.0D, 3.0D, -1.0D}});
- Log.e("MatrixD", "Hello3 matrix");
- Log.e("MatrixD", "A = \n" + var1.toString());
- MatrixD var4 = new MatrixD(new double[][]{{0.0D, 3.0D}, {-2.0D, -1.0D}, {0.0D, 4.0D}});
- Log.e("MatrixD", "B = \n" + var4.toString());
- MatrixD var6 = var1.transpose();
- Log.e("MatrixD", "A transpose = " + var6.toString());
- MatrixD var8 = var4.transpose();
- Log.e("MatrixD", "B transpose = " + var8.toString());
- MatrixD var10 = var1.times(var4);
- Log.e("MatrixD", "AB = \n" + var10.toString());
- MatrixD var12 = var4.times(var1);
- Log.e("MatrixD", "BA = \n" + var12.toString());
- MatrixD var14 = var12.times(2.0D);
- Log.e("MatrixD", "BA*2 = " + var14.toString());
- MatrixD var16 = var12.submatrix(3, 2, 0, 1);
- Log.e("MatrixD", "BA submatrix 3,2,0,1 = " + var16);
- MatrixD var18 = var12.submatrix(2, 1, 1, 2);
- Log.e("MatrixD", "BA submatrix 2,1,1,2 = " + var18);
- }
-
- public MatrixD add(double var1) {
- int[] var3 = new int[]{this.numRows(), this.numCols()};
- double[][] var4 = (double[][])Array.newInstance(Double.TYPE, var3);
- int var5 = this.numRows();
- int var6 = this.numCols();
-
- for(int var7 = 0; var7 < var5; ++var7) {
- for(int var8 = 0; var8 < var6; ++var8) {
- var4[var7][var8] = var1 + this.data()[var7][var8];
- }
- }
-
- return new MatrixD(var4);
- }
-
- public MatrixD add(MatrixD var1) {
- int[] var2 = new int[]{this.numRows(), this.numCols()};
- double[][] var3 = (double[][])Array.newInstance(Double.TYPE, var2);
- int var4 = this.numRows();
- int var5 = this.numCols();
-
- for(int var6 = 0; var6 < var4; ++var6) {
- for(int var7 = 0; var7 < var5; ++var7) {
- var3[var6][var7] = this.data()[var6][var7] + var1.data()[var6][var7];
- }
- }
-
- return new MatrixD(var3);
- }
-
- public double[][] data() {
- return this.mData;
- }
-
- public double length() {
- if(this.numRows() != 1 && this.numCols() != 1) {
- throw new IndexOutOfBoundsException("Not a 1D matrix ( " + this.numRows() + ", " + this.numCols() + " )");
- } else {
- double var1 = 0.0D;
-
- double var5;
- for(int var3 = 0; var3 < this.numRows(); ++var3) {
- for(int var4 = 0; var4 < this.numCols(); var1 = var5) {
- var5 = var1 + this.mData[var3][var4] * this.mData[var3][var4];
- ++var4;
- }
- }
-
- return Math.sqrt(var1);
- }
- }
-
- public int numCols() {
- return this.mCols;
- }
-
- public int numRows() {
- return this.mRows;
- }
-
- public boolean setSubmatrix(MatrixD var1, int var2, int var3, int var4, int var5) {
- if(var1 == null) {
- throw new IllegalArgumentException("Input data to setSubMatrix null");
- } else if(var2 <= this.numRows() && var3 <= this.numCols()) {
- if(var4 + var2 <= this.numRows() && var5 + var3 <= this.numCols()) {
- if(var2 <= var1.numRows() && var3 <= var1.numCols()) {
- if(var4 + var2 <= var1.numRows() && var5 + var3 <= this.numCols()) {
- for(int var6 = 0; var6 < var2; ++var6) {
- for(int var7 = 0; var7 < var3; ++var7) {
- this.data()[var4 + var6][var5 + var7] = var1.data()[var6][var7];
- }
- }
-
- return true;
- } else {
- throw new IllegalArgumentException("Input matrix Attempted to access out of bounds data with row or col offset out of range");
- }
- } else {
- throw new IllegalArgumentException("Input matrix small for setSubMatrix");
- }
- } else {
- throw new IllegalArgumentException("Attempted to access out of bounds data with row or col offset out of range");
- }
- } else {
- throw new IllegalArgumentException("Attempted to get submatrix with size larger than original");
- }
- }
-
- public MatrixD submatrix(int var1, int var2, int var3, int var4) {
- if(var1 <= this.numRows() && var2 <= this.numCols()) {
- if(var3 + var1 <= this.numRows() && var4 + var2 <= this.numCols()) {
- int[] var5 = new int[]{var1, var2};
- double[][] var6 = (double[][])Array.newInstance(Double.TYPE, var5);
-
- for(int var7 = 0; var7 < var1; ++var7) {
- for(int var8 = 0; var8 < var2; ++var8) {
- var6[var7][var8] = this.data()[var3 + var7][var4 + var8];
- }
- }
-
- return new MatrixD(var6);
- } else {
- throw new IllegalArgumentException("Attempted to access out of bounds data with row or col offset out of range");
- }
- } else {
- throw new IllegalArgumentException("Attempted to get submatrix with size larger than original");
- }
- }
-
- public MatrixD subtract(double var1) {
- int[] var3 = new int[]{this.numRows(), this.numCols()};
- double[][] var4 = (double[][])Array.newInstance(Double.TYPE, var3);
- int var5 = this.numRows();
- int var6 = this.numCols();
-
- for(int var7 = 0; var7 < var5; ++var7) {
- for(int var8 = 0; var8 < var6; ++var8) {
- var4[var7][var8] = this.data()[var7][var8] - var1;
- }
- }
-
- return new MatrixD(var4);
- }
-
- public MatrixD subtract(MatrixD var1) {
- int[] var2 = new int[]{this.numRows(), this.numCols()};
- double[][] var3 = (double[][])Array.newInstance(Double.TYPE, var2);
- int var4 = this.numRows();
- int var5 = this.numCols();
-
- for(int var6 = 0; var6 < var4; ++var6) {
- for(int var7 = 0; var7 < var5; ++var7) {
- var3[var6][var7] = this.data()[var6][var7] - var1.data()[var6][var7];
- }
- }
-
- return new MatrixD(var3);
- }
-
- public MatrixD times(double var1) {
- int[] var3 = new int[]{this.numRows(), this.numCols()};
- double[][] var4 = (double[][])Array.newInstance(Double.TYPE, var3);
-
- for(int var5 = 0; var5 < this.numRows(); ++var5) {
- for(int var6 = 0; var6 < this.numCols(); ++var6) {
- var4[var5][var6] = var1 * this.data()[var5][var6];
- }
- }
-
- return new MatrixD(var4);
- }
-
- public MatrixD times(MatrixD var1) {
- if(this.numCols() != var1.numRows()) {
- throw new IllegalArgumentException("Attempted to multiply matrices of invalid dimensions (AB) where A is " + this.numRows() + "x" + this.numCols() + ", B is " + var1.numRows() + "x" + var1.numCols());
- } else {
- int var2 = this.numCols();
- int var3 = this.numRows();
- int var4 = var1.numCols();
- int[] var5 = new int[]{var3, var4};
- double[][] var6 = (double[][])Array.newInstance(Double.TYPE, var5);
-
- for(int var7 = 0; var7 < var3; ++var7) {
- for(int var8 = 0; var8 < var4; ++var8) {
- for(int var9 = 0; var9 < var2; ++var9) {
- double[] var10 = var6[var7];
- var10[var8] += this.data()[var7][var9] * var1.data()[var9][var8];
- }
- }
- }
-
- return new MatrixD(var6);
- }
- }
-
- public String toString() {
- String var1 = new String();
-
- for(int var2 = 0; var2 < this.numRows(); ++var2) {
- String var3 = new String();
-
- for(int var4 = 0; var4 < this.numCols(); ++var4) {
- StringBuilder var5 = (new StringBuilder()).append(var3);
- Object[] var6 = new Object[]{Double.valueOf(this.data()[var2][var4])};
- var3 = var5.append(String.format("%.4f", var6)).toString();
- if(var4 < -1 + this.numCols()) {
- var3 = var3 + ", ";
- }
- }
-
- var1 = var1 + var3;
- if(var2 < -1 + this.numRows()) {
- var1 = var1 + "\n";
- }
- }
-
- return var1 + "\n";
- }
-
- public MatrixD transpose() {
- int var1 = this.mRows;
- int var2 = this.mCols;
- int[] var3 = new int[]{var2, var1};
- double[][] var4 = (double[][])Array.newInstance(Double.TYPE, var3);
-
- for(int var5 = 0; var5 < var2; ++var5) {
- for(int var6 = 0; var6 < var1; ++var6) {
- var4[var5][var6] = this.mData[var6][var5];
- }
- }
-
- return new MatrixD(var4);
- }
-}
diff --git a/FtcRobotController/app/src/main/java/com/qualcomm/robotcore/util/Network.java b/FtcRobotController/app/src/main/java/com/qualcomm/robotcore/util/Network.java
deleted file mode 100644
index 6855834..0000000
--- a/FtcRobotController/app/src/main/java/com/qualcomm/robotcore/util/Network.java
+++ /dev/null
@@ -1,84 +0,0 @@
-package com.qualcomm.robotcore.util;
-
-import java.net.Inet4Address;
-import java.net.Inet6Address;
-import java.net.InetAddress;
-import java.net.UnknownHostException;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Iterator;
-
-public class Network {
- public static ArrayList getHostAddresses(Collection var0) {
- ArrayList var1 = new ArrayList();
-
- String var3;
- for(Iterator var2 = var0.iterator(); var2.hasNext(); var1.add(var3)) {
- var3 = ((InetAddress)var2.next()).getHostAddress();
- if(var3.contains("%")) {
- var3 = var3.substring(0, var3.indexOf(37));
- }
- }
-
- return var1;
- }
-
- public static ArrayList getLocalIpAddress(String param0) {
- // $FF: Couldn't be decompiled
- }
-
- public static ArrayList getLocalIpAddresses() {
- // $FF: Couldn't be decompiled
- }
-
- public static InetAddress getLoopbackAddress() {
- try {
- InetAddress var1 = InetAddress.getByAddress(new byte[]{(byte)127, (byte)0, (byte)0, (byte)1});
- return var1;
- } catch (UnknownHostException var2) {
- return null;
- }
- }
-
- public static ArrayList removeIPv4Addresses(Collection var0) {
- ArrayList var1 = new ArrayList();
- Iterator var2 = var0.iterator();
-
- while(var2.hasNext()) {
- InetAddress var3 = (InetAddress)var2.next();
- if(var3 instanceof Inet6Address) {
- var1.add(var3);
- }
- }
-
- return var1;
- }
-
- public static ArrayList removeIPv6Addresses(Collection var0) {
- ArrayList var1 = new ArrayList();
- Iterator var2 = var0.iterator();
-
- while(var2.hasNext()) {
- InetAddress var3 = (InetAddress)var2.next();
- if(var3 instanceof Inet4Address) {
- var1.add(var3);
- }
- }
-
- return var1;
- }
-
- public static ArrayList removeLoopbackAddresses(Collection var0) {
- ArrayList var1 = new ArrayList();
- Iterator var2 = var0.iterator();
-
- while(var2.hasNext()) {
- InetAddress var3 = (InetAddress)var2.next();
- if(!var3.isLoopbackAddress()) {
- var1.add(var3);
- }
- }
-
- return var1;
- }
-}
diff --git a/FtcRobotController/app/src/main/java/com/qualcomm/robotcore/util/Pose.java b/FtcRobotController/app/src/main/java/com/qualcomm/robotcore/util/Pose.java
deleted file mode 100644
index 949b946..0000000
--- a/FtcRobotController/app/src/main/java/com/qualcomm/robotcore/util/Pose.java
+++ /dev/null
@@ -1,144 +0,0 @@
-package com.qualcomm.robotcore.util;
-
-import com.qualcomm.robotcore.util.MatrixD;
-import com.qualcomm.robotcore.util.PoseUtils;
-import java.lang.reflect.Array;
-
-public class Pose {
- public MatrixD poseMatrix;
- public double transX;
- public double transY;
- public double transZ;
-
- public Pose() {
- this.transX = 0.0D;
- this.transY = 0.0D;
- this.transZ = 0.0D;
- }
-
- public Pose(double var1, double var3, double var5) {
- this.transX = var1;
- this.transY = var3;
- this.transZ = var5;
- this.poseMatrix = new MatrixD(3, 4);
- double[] var7 = this.poseMatrix.data()[0];
- double[] var8 = this.poseMatrix.data()[1];
- this.poseMatrix.data()[2][2] = 1.0D;
- var8[1] = 1.0D;
- var7[0] = 1.0D;
- this.poseMatrix.data()[0][3] = var1;
- this.poseMatrix.data()[1][3] = var3;
- this.poseMatrix.data()[2][3] = var5;
- }
-
- public Pose(MatrixD var1) {
- if(var1 == null) {
- throw new IllegalArgumentException("Attempted to construct Pose from null matrix");
- } else if(var1.numRows() == 3 && var1.numCols() == 4) {
- this.poseMatrix = var1;
- this.transX = var1.data()[0][3];
- this.transY = var1.data()[1][3];
- this.transZ = var1.data()[2][3];
- } else {
- throw new IllegalArgumentException("Invalid matrix size ( " + var1.numRows() + ", " + var1.numCols() + " )");
- }
- }
-
- public static MatrixD makeRotationX(double var0) {
- int[] var2 = new int[]{3, 3};
- double[][] var3 = (double[][])Array.newInstance(Double.TYPE, var2);
- double var4 = Math.cos(var0);
- double var6 = Math.sin(var0);
- var3[0][0] = 1.0D;
- double[] var8 = var3[0];
- double[] var9 = var3[0];
- double[] var10 = var3[1];
- var3[2][0] = 0.0D;
- var10[0] = 0.0D;
- var9[2] = 0.0D;
- var8[1] = 0.0D;
- double[] var11 = var3[1];
- var3[2][2] = var4;
- var11[1] = var4;
- var3[1][2] = -var6;
- var3[2][1] = var6;
- return new MatrixD(var3);
- }
-
- public static MatrixD makeRotationY(double var0) {
- int[] var2 = new int[]{3, 3};
- double[][] var3 = (double[][])Array.newInstance(Double.TYPE, var2);
- double var4 = Math.cos(var0);
- double var6 = Math.sin(var0);
- double[] var8 = var3[0];
- double[] var9 = var3[1];
- double[] var10 = var3[1];
- var3[2][1] = 0.0D;
- var10[2] = 0.0D;
- var9[0] = 0.0D;
- var8[1] = 0.0D;
- var3[1][1] = 1.0D;
- double[] var11 = var3[0];
- var3[2][2] = var4;
- var11[0] = var4;
- var3[0][2] = var6;
- var3[2][0] = -var6;
- return new MatrixD(var3);
- }
-
- public static MatrixD makeRotationZ(double var0) {
- int[] var2 = new int[]{3, 3};
- double[][] var3 = (double[][])Array.newInstance(Double.TYPE, var2);
- double var4 = Math.cos(var0);
- double var6 = Math.sin(var0);
- var3[2][2] = 1.0D;
- double[] var8 = var3[2];
- double[] var9 = var3[2];
- double[] var10 = var3[0];
- var3[1][2] = 0.0D;
- var10[2] = 0.0D;
- var9[1] = 0.0D;
- var8[0] = 0.0D;
- double[] var11 = var3[0];
- var3[1][1] = var4;
- var11[0] = var4;
- var3[0][1] = -var6;
- var3[1][0] = var6;
- return new MatrixD(var3);
- }
-
- public double getDistanceInMm() {
- return Math.sqrt(Math.pow(this.transX, 2.0D) + Math.pow(this.transY, 2.0D) + Math.pow(this.transZ, 2.0D));
- }
-
- public MatrixD getTranslationMatrix() {
- double[][] var1 = new double[3][];
- double[] var2 = new double[]{this.transX};
- var1[0] = var2;
- double[] var3 = new double[]{this.transY};
- var1[1] = var3;
- double[] var4 = new double[]{this.transZ};
- var1[2] = var4;
- return new MatrixD(var1);
- }
-
- public String toString() {
- StringBuilder var1 = new StringBuilder();
- double[] var2 = PoseUtils.getAnglesAroundZ(this);
- Object[] var3 = new Object[]{Double.valueOf(this.transX)};
- var1.append(String.format("(XYZ %1$,.2f ", var3));
- Object[] var5 = new Object[]{Double.valueOf(this.transY)};
- var1.append(String.format(" %1$,.2f ", var5));
- Object[] var7 = new Object[]{Double.valueOf(this.transZ)};
- var1.append(String.format(" %1$,.2f mm)", var7));
- Object[] var9 = new Object[]{Double.valueOf(var2[0])};
- var1.append(String.format("(Angles %1$,.2f, ", var9));
- Object[] var11 = new Object[]{Double.valueOf(var2[1])};
- var1.append(String.format(" %1$,.2f, ", var11));
- Object[] var13 = new Object[]{Double.valueOf(var2[2])};
- var1.append(String.format(" %1$,.2f ", var13));
- var1.append('°');
- var1.append(")");
- return var1.toString();
- }
-}
diff --git a/FtcRobotController/app/src/main/java/com/qualcomm/robotcore/util/PoseUtils.java b/FtcRobotController/app/src/main/java/com/qualcomm/robotcore/util/PoseUtils.java
deleted file mode 100644
index 2e319dd..0000000
--- a/FtcRobotController/app/src/main/java/com/qualcomm/robotcore/util/PoseUtils.java
+++ /dev/null
@@ -1,33 +0,0 @@
-package com.qualcomm.robotcore.util;
-
-import android.util.Log;
-import com.qualcomm.robotcore.util.MatrixD;
-import com.qualcomm.robotcore.util.Pose;
-
-public class PoseUtils {
- public static double[] getAnglesAroundZ(MatrixD var0) {
- if(var0.numRows() == 3 && var0.numCols() == 3) {
- MatrixD var1 = var0.times(new MatrixD(new double[][]{{0.0D}, {0.0D}, {1.0D}}));
- double var2 = Math.toDegrees(Math.atan2(var1.data()[1][0], var1.data()[0][0]));
- double var4 = Math.toDegrees(Math.atan2(var1.data()[0][0], var1.data()[1][0]));
- double var6 = var1.length();
- return new double[]{var2, var4, Math.toDegrees(Math.asin(var1.data()[2][0] / var6))};
- } else {
- throw new IllegalArgumentException("Invalid Matrix Dimension: Expected (3,3) got (" + var0.numRows() + "," + var0.numCols() + ")");
- }
- }
-
- public static double[] getAnglesAroundZ(Pose var0) {
- if(var0 != null && var0.poseMatrix != null) {
- return getAnglesAroundZ(var0.poseMatrix.submatrix(3, 3, 0, 0));
- } else {
- Log.e("PoseUtils", "null input");
- return null;
- }
- }
-
- public static double smallestAngularDifferenceDegrees(double var0, double var2) {
- double var4 = 3.141592653589793D * (var0 - var2) / 180.0D;
- return 180.0D * Math.atan2(Math.sin(var4), Math.cos(var4)) / 3.141592653589793D;
- }
-}
diff --git a/FtcRobotController/app/src/main/java/com/qualcomm/robotcore/util/Range.java b/FtcRobotController/app/src/main/java/com/qualcomm/robotcore/util/Range.java
deleted file mode 100644
index da5db35..0000000
--- a/FtcRobotController/app/src/main/java/com/qualcomm/robotcore/util/Range.java
+++ /dev/null
@@ -1,23 +0,0 @@
-package com.qualcomm.robotcore.util;
-
-public class Range {
- public static double clip(double var0, double var2, double var4) {
- return var0 < var2?var2:(var0 > var4?var4:var0);
- }
-
- public static float clip(float var0, float var1, float var2) {
- return var0 < var1?var1:(var0 > var2?var2:var0);
- }
-
- public static double scale(double var0, double var2, double var4, double var6, double var8) {
- double var10 = (var6 - var8) / (var2 - var4);
- return var6 - var2 * (var6 - var8) / (var2 - var4) + var10 * var0;
- }
-
- public static void throwIfRangeIsInvalid(double var0, double var2, double var4) throws IllegalArgumentException {
- if(var0 < var2 || var0 > var4) {
- Object[] var6 = new Object[]{Double.valueOf(var0), Double.valueOf(var2), Double.valueOf(var4)};
- throw new IllegalArgumentException(String.format("number %f is invalid; valid ranges are %f..%f", var6));
- }
- }
-}
diff --git a/FtcRobotController/app/src/main/java/com/qualcomm/robotcore/util/RobotLog.java b/FtcRobotController/app/src/main/java/com/qualcomm/robotcore/util/RobotLog.java
deleted file mode 100644
index 449d6c7..0000000
--- a/FtcRobotController/app/src/main/java/com/qualcomm/robotcore/util/RobotLog.java
+++ /dev/null
@@ -1,154 +0,0 @@
-package com.qualcomm.robotcore.util;
-
-import android.content.Context;
-import android.os.Environment;
-import android.util.Log;
-import com.qualcomm.robotcore.exception.RobotCoreException;
-import com.qualcomm.robotcore.util.RunShellCommand;
-import java.io.File;
-
-public class RobotLog {
- public static final String TAG = "RobotCore";
- private static String a = "";
- private static boolean b = false;
-
- public static void cancelWriteLogcatToDisk(Context var0) {
- final String var1 = var0.getPackageName();
- final String var2 = (new File(Environment.getExternalStorageDirectory(), var1)).getAbsolutePath();
- b = false;
- (new Thread() {
- public void run() {
- try {
- Thread.sleep(1000L);
- } catch (InterruptedException var5) {
- ;
- }
-
- try {
- RobotLog.v("closing logcat file " + var2);
- RunShellCommand var3 = new RunShellCommand();
- RunShellCommand.killSpawnedProcess("logcat", var1, var3);
- } catch (RobotCoreException var4) {
- RobotLog.v("Unable to cancel writing log file to disk: " + var4.toString());
- }
- }
- }).start();
- }
-
- public static void clearGlobalErrorMsg() {
- a = "";
- }
-
- public static void d(String var0) {
- Log.d("RobotCore", var0);
- }
-
- public static void e(String var0) {
- Log.e("RobotCore", var0);
- }
-
- public static String getGlobalErrorMsg() {
- return a;
- }
-
- public static String getLogFilename(Context var0) {
- String var1 = Environment.getExternalStorageDirectory().getAbsolutePath() + "/" + var0.getPackageName();
- return var1 + ".logcat";
- }
-
- public static boolean hasGlobalErrorMsg() {
- return !a.isEmpty();
- }
-
- public static void i(String var0) {
- Log.i("RobotCore", var0);
- }
-
- public static void logAndThrow(String var0) throws RobotCoreException {
- w(var0);
- throw new RobotCoreException(var0);
- }
-
- public static void logStacktrace(RobotCoreException var0) {
- e(var0.toString());
- StackTraceElement[] var1 = var0.getStackTrace();
- int var2 = var1.length;
-
- for(int var3 = 0; var3 < var2; ++var3) {
- e(var1[var3].toString());
- }
-
- if(var0.isChainedException()) {
- e("Exception chained from:");
- if(!(var0.getChainedException() instanceof RobotCoreException)) {
- logStacktrace(var0.getChainedException());
- return;
- }
-
- logStacktrace((RobotCoreException)var0.getChainedException());
- }
-
- }
-
- public static void logStacktrace(Exception var0) {
- e(var0.toString());
- StackTraceElement[] var1 = var0.getStackTrace();
- int var2 = var1.length;
-
- for(int var3 = 0; var3 < var2; ++var3) {
- e(var1[var3].toString());
- }
-
- }
-
- public static void setGlobalErrorMsg(String var0) {
- if(a.isEmpty()) {
- a = a + var0;
- }
-
- }
-
- public static void setGlobalErrorMsgAndThrow(String var0, RobotCoreException var1) throws RobotCoreException {
- setGlobalErrorMsg(var0 + "\n" + var1.getMessage());
- throw var1;
- }
-
- public static void v(String var0) {
- Log.v("RobotCore", var0);
- }
-
- public static void w(String var0) {
- Log.w("RobotCore", var0);
- }
-
- public static void writeLogcatToDisk(Context var0, final int var1) {
- if(!b) {
- b = true;
- final String var2 = var0.getPackageName();
- (new Thread("Logging Thread") {
- // $FF: synthetic field
- final String a;
-
- {
- this.a = var2x;
- }
-
- public void run() {
- try {
- RobotLog.v("saving logcat to " + this.a);
- RunShellCommand var5 = new RunShellCommand();
- RunShellCommand.killSpawnedProcess("logcat", var2, var5);
- Object[] var6 = new Object[]{this.a, Integer.valueOf(var1), Integer.valueOf(1), "UsbRequestJNI:S UsbRequest:S *:V"};
- var5.run(String.format("logcat -f %s -r%d -n%d -v time %s", var6));
- return;
- } catch (RobotCoreException var9) {
- RobotLog.v("Error while writing log file to disk: " + var9.toString());
- } finally {
- RobotLog.b = false;
- }
-
- }
- }).start();
- }
- }
-}
diff --git a/FtcRobotController/app/src/main/java/com/qualcomm/robotcore/util/RollingAverage.java b/FtcRobotController/app/src/main/java/com/qualcomm/robotcore/util/RollingAverage.java
deleted file mode 100644
index c24c2c2..0000000
--- a/FtcRobotController/app/src/main/java/com/qualcomm/robotcore/util/RollingAverage.java
+++ /dev/null
@@ -1,46 +0,0 @@
-package com.qualcomm.robotcore.util;
-
-import java.util.LinkedList;
-import java.util.Queue;
-
-public class RollingAverage {
- public static final int DEFAULT_SIZE = 100;
- private final Queue a = new LinkedList();
- private long b;
- private int c;
-
- public RollingAverage() {
- this.resize(100);
- }
-
- public RollingAverage(int var1) {
- this.resize(var1);
- }
-
- public void addNumber(int var1) {
- if(this.a.size() >= this.c) {
- int var3 = ((Integer)this.a.remove()).intValue();
- this.b -= (long)var3;
- }
-
- this.a.add(Integer.valueOf(var1));
- this.b += (long)var1;
- }
-
- public int getAverage() {
- return this.a.isEmpty()?0:(int)(this.b / (long)this.a.size());
- }
-
- public void reset() {
- this.a.clear();
- }
-
- public void resize(int var1) {
- this.c = var1;
- this.a.clear();
- }
-
- public int size() {
- return this.c;
- }
-}
diff --git a/FtcRobotController/app/src/main/java/com/qualcomm/robotcore/util/RunShellCommand.java b/FtcRobotController/app/src/main/java/com/qualcomm/robotcore/util/RunShellCommand.java
deleted file mode 100644
index b2558f4..0000000
--- a/FtcRobotController/app/src/main/java/com/qualcomm/robotcore/util/RunShellCommand.java
+++ /dev/null
@@ -1,73 +0,0 @@
-package com.qualcomm.robotcore.util;
-
-import com.qualcomm.robotcore.exception.RobotCoreException;
-import com.qualcomm.robotcore.util.RobotLog;
-
-public class RunShellCommand {
- boolean a = false;
-
- private String a(String param1, boolean param2) {
- // $FF: Couldn't be decompiled
- }
-
- public static int getSpawnedProcessPid(String var0, String var1, RunShellCommand var2) {
- int var3 = 0;
- String var4 = var2.run("ps");
- String var5 = "invalid";
- String[] var6 = var4.split("\n");
- int var7 = var6.length;
-
- for(int var8 = 0; var8 < var7; ++var8) {
- String var12 = var6[var8];
- if(var12.contains(var1)) {
- var5 = var12.split("\\s+")[0];
- break;
- }
- }
-
- String[] var9 = var4.split("\n");
-
- for(int var10 = var9.length; var3 < var10; ++var3) {
- String var11 = var9[var3];
- if(var11.contains(var0) && var11.contains(var5)) {
- return Integer.parseInt(var11.split("\\s+")[1]);
- }
- }
-
- return -1;
- }
-
- public static void killSpawnedProcess(String param0, String param1, RunShellCommand param2) throws RobotCoreException {
- // $FF: Couldn't be decompiled
- }
-
- public void enableLogging(boolean var1) {
- this.a = var1;
- }
-
- public String run(String var1) {
- if(this.a) {
- RobotLog.v("running command: " + var1);
- }
-
- String var2 = this.a(var1, false);
- if(this.a) {
- RobotLog.v(" output: " + var2);
- }
-
- return var2;
- }
-
- public String runAsRoot(String var1) {
- if(this.a) {
- RobotLog.v("running command: " + var1);
- }
-
- String var2 = this.a(var1, true);
- if(this.a) {
- RobotLog.v(" output: " + var2);
- }
-
- return var2;
- }
-}
diff --git a/FtcRobotController/app/src/main/java/com/qualcomm/robotcore/util/SerialNumber.java b/FtcRobotController/app/src/main/java/com/qualcomm/robotcore/util/SerialNumber.java
deleted file mode 100644
index 5d81a5d..0000000
--- a/FtcRobotController/app/src/main/java/com/qualcomm/robotcore/util/SerialNumber.java
+++ /dev/null
@@ -1,49 +0,0 @@
-package com.qualcomm.robotcore.util;
-
-import java.io.Serializable;
-
-public class SerialNumber implements Serializable {
- private String a;
-
- public SerialNumber() {
- this.a = "N/A";
- }
-
- public SerialNumber(String var1) {
- this.a = var1;
- }
-
- public boolean equals(Object var1) {
- if(var1 != null) {
- if(var1 == this) {
- return true;
- }
-
- if(var1 instanceof SerialNumber) {
- return this.a.equals(((SerialNumber)var1).getSerialNumber());
- }
-
- if(var1 instanceof String) {
- return this.a.equals(var1);
- }
- }
-
- return false;
- }
-
- public String getSerialNumber() {
- return this.a;
- }
-
- public int hashCode() {
- return this.a.hashCode();
- }
-
- public void setSerialNumber(String var1) {
- this.a = var1;
- }
-
- public String toString() {
- return this.a;
- }
-}
diff --git a/FtcRobotController/app/src/main/java/com/qualcomm/robotcore/util/TypeConversion.java b/FtcRobotController/app/src/main/java/com/qualcomm/robotcore/util/TypeConversion.java
deleted file mode 100644
index de86f34..0000000
--- a/FtcRobotController/app/src/main/java/com/qualcomm/robotcore/util/TypeConversion.java
+++ /dev/null
@@ -1,83 +0,0 @@
-package com.qualcomm.robotcore.util;
-
-import java.nio.ByteBuffer;
-import java.nio.ByteOrder;
-import java.nio.charset.Charset;
-
-public class TypeConversion {
- private static final Charset a = Charset.forName("UTF-8");
-
- public static int byteArrayToInt(byte[] var0) {
- return byteArrayToInt(var0, ByteOrder.BIG_ENDIAN);
- }
-
- public static int byteArrayToInt(byte[] var0, ByteOrder var1) {
- return ByteBuffer.wrap(var0).order(var1).getInt();
- }
-
- public static long byteArrayToLong(byte[] var0) {
- return byteArrayToLong(var0, ByteOrder.BIG_ENDIAN);
- }
-
- public static long byteArrayToLong(byte[] var0, ByteOrder var1) {
- return ByteBuffer.wrap(var0).order(var1).getLong();
- }
-
- public static short byteArrayToShort(byte[] var0) {
- return byteArrayToShort(var0, ByteOrder.BIG_ENDIAN);
- }
-
- public static short byteArrayToShort(byte[] var0, ByteOrder var1) {
- return ByteBuffer.wrap(var0).order(var1).getShort();
- }
-
- public static byte[] intToByteArray(int var0) {
- return intToByteArray(var0, ByteOrder.BIG_ENDIAN);
- }
-
- public static byte[] intToByteArray(int var0, ByteOrder var1) {
- return ByteBuffer.allocate(4).order(var1).putInt(var0).array();
- }
-
- public static byte[] longToByteArray(long var0) {
- return longToByteArray(var0, ByteOrder.BIG_ENDIAN);
- }
-
- public static byte[] longToByteArray(long var0, ByteOrder var2) {
- return ByteBuffer.allocate(8).order(var2).putLong(var0).array();
- }
-
- public static byte[] shortToByteArray(short var0) {
- return shortToByteArray(var0, ByteOrder.BIG_ENDIAN);
- }
-
- public static byte[] shortToByteArray(short var0, ByteOrder var1) {
- return ByteBuffer.allocate(2).order(var1).putShort(var0).array();
- }
-
- public static byte[] stringToUtf8(String var0) {
- byte[] var1 = var0.getBytes(a);
- if(!var0.equals(new String(var1, a))) {
- Object[] var2 = new Object[]{a.name(), var0, new String(var1, a)};
- throw new IllegalArgumentException(String.format("string cannot be cleanly encoded into %s - \'%s\' -> \'%s\'", var2));
- } else {
- return var1;
- }
- }
-
- public static double unsignedByteToDouble(byte var0) {
- return (double)(var0 & 255);
- }
-
- public static int unsignedByteToInt(byte var0) {
- return var0 & 255;
- }
-
- public static long unsignedIntToLong(int var0) {
- return 4294967295L & (long)var0;
- }
-
- public static String utf8ToString(byte[] var0) {
- return new String(var0, a);
- }
-}
diff --git a/FtcRobotController/app/src/main/java/com/qualcomm/robotcore/util/Util.java b/FtcRobotController/app/src/main/java/com/qualcomm/robotcore/util/Util.java
deleted file mode 100644
index f3097c0..0000000
--- a/FtcRobotController/app/src/main/java/com/qualcomm/robotcore/util/Util.java
+++ /dev/null
@@ -1,54 +0,0 @@
-package com.qualcomm.robotcore.util;
-
-import android.widget.TextView;
-import java.io.File;
-import java.util.Arrays;
-import java.util.Comparator;
-import java.util.Random;
-
-public class Util {
- public static String ASCII_RECORD_SEPARATOR = "\u001e";
- public static final String LOWERCASE_ALPHA_NUM_CHARACTERS = "0123456789qwertyuiopasdfghjklzxcvbnm";
-
- public static byte[] concatenateByteArrays(byte[] var0, byte[] var1) {
- byte[] var2 = new byte[var0.length + var1.length];
- System.arraycopy(var0, 0, var2, 0, var0.length);
- System.arraycopy(var1, 0, var2, var0.length, var1.length);
- return var2;
- }
-
- public static String getRandomString(int var0, String var1) {
- Random var2 = new Random();
- StringBuilder var3 = new StringBuilder();
-
- for(int var4 = 0; var4 < var0; ++var4) {
- var3.append(var1.charAt(var2.nextInt(var1.length())));
- }
-
- return var3.toString();
- }
-
- public static void sortFilesByName(File[] var0) {
- Arrays.sort(var0, new Comparator() {
- public int a(File var1, File var2) {
- return var1.getName().compareTo(var2.getName());
- }
-
- // $FF: synthetic method
- public int compare(Object var1, Object var2) {
- return this.a((File)var1, (File)var2);
- }
- });
- }
-
- public static void updateTextView(final TextView var0, final String var1) {
- if(var0 != null) {
- var0.post(new Runnable() {
- public void run() {
- var0.setText(var1);
- }
- });
- }
-
- }
-}
diff --git a/FtcRobotController/app/src/main/java/com/qualcomm/robotcore/util/Version.java b/FtcRobotController/app/src/main/java/com/qualcomm/robotcore/util/Version.java
deleted file mode 100644
index d3df496..0000000
--- a/FtcRobotController/app/src/main/java/com/qualcomm/robotcore/util/Version.java
+++ /dev/null
@@ -1,9 +0,0 @@
-package com.qualcomm.robotcore.util;
-
-public class Version {
- public static final String LIBRARY_VERSION = "15.10.02";
-
- public static String getLibraryVersion() {
- return "15.10.02";
- }
-}
diff --git a/FtcRobotController/app/src/main/java/com/qualcomm/robotcore/wifi/FixWifiDirectSetup.java b/FtcRobotController/app/src/main/java/com/qualcomm/robotcore/wifi/FixWifiDirectSetup.java
deleted file mode 100644
index aa5a446..0000000
--- a/FtcRobotController/app/src/main/java/com/qualcomm/robotcore/wifi/FixWifiDirectSetup.java
+++ /dev/null
@@ -1,17 +0,0 @@
-package com.qualcomm.robotcore.wifi;
-
-import android.net.wifi.WifiManager;
-
-public class FixWifiDirectSetup {
- public static final int WIFI_TOGGLE_DELAY = 2000;
-
- private static void a(boolean var0, WifiManager var1) throws InterruptedException {
- var1.setWifiEnabled(var0);
- Thread.sleep(2000L);
- }
-
- public static void fixWifiDirectSetup(WifiManager var0) throws InterruptedException {
- a(false, var0);
- a(true, var0);
- }
-}
diff --git a/FtcRobotController/app/src/main/java/com/qualcomm/robotcore/wifi/WifiAssistant.java b/FtcRobotController/app/src/main/java/com/qualcomm/robotcore/wifi/WifiAssistant.java
deleted file mode 100644
index 6de6992..0000000
--- a/FtcRobotController/app/src/main/java/com/qualcomm/robotcore/wifi/WifiAssistant.java
+++ /dev/null
@@ -1,78 +0,0 @@
-package com.qualcomm.robotcore.wifi;
-
-import android.content.BroadcastReceiver;
-import android.content.Context;
-import android.content.Intent;
-import android.content.IntentFilter;
-import android.net.NetworkInfo;
-import com.qualcomm.robotcore.util.RobotLog;
-
-public class WifiAssistant {
- private final IntentFilter a;
- private final Context b;
- private final WifiAssistant.a c;
-
- public WifiAssistant(Context var1, WifiAssistant.WifiAssistantCallback var2) {
- this.b = var1;
- if(var2 == null) {
- RobotLog.v("WifiAssistantCallback is null");
- }
-
- this.c = new WifiAssistant.a(var2);
- this.a = new IntentFilter();
- this.a.addAction("android.net.wifi.STATE_CHANGE");
- }
-
- public void disable() {
- this.b.unregisterReceiver(this.c);
- }
-
- public void enable() {
- this.b.registerReceiver(this.c, this.a);
- }
-
- public interface WifiAssistantCallback {
- void wifiEventCallback(WifiAssistant.WifiState var1);
- }
-
- public static enum WifiState {
- CONNECTED,
- NOT_CONNECTED;
-
- static {
- WifiAssistant.WifiState[] var0 = new WifiAssistant.WifiState[]{CONNECTED, NOT_CONNECTED};
- }
- }
-
- private static class a extends BroadcastReceiver {
- private WifiAssistant.WifiState a = null;
- private final WifiAssistant.WifiAssistantCallback b;
-
- public a(WifiAssistant.WifiAssistantCallback var1) {
- this.b = var1;
- }
-
- private void a(WifiAssistant.WifiState var1) {
- if(this.a != var1) {
- this.a = var1;
- if(this.b != null) {
- this.b.wifiEventCallback(this.a);
- return;
- }
- }
-
- }
-
- public void onReceive(Context var1, Intent var2) {
- if(var2.getAction().equals("android.net.wifi.STATE_CHANGE")) {
- if(!((NetworkInfo)var2.getParcelableExtra("networkInfo")).isConnected()) {
- this.a(WifiAssistant.WifiState.NOT_CONNECTED);
- return;
- }
-
- this.a(WifiAssistant.WifiState.CONNECTED);
- }
-
- }
- }
-}
diff --git a/FtcRobotController/app/src/main/java/com/qualcomm/robotcore/wifi/WifiDirectAssistant.java b/FtcRobotController/app/src/main/java/com/qualcomm/robotcore/wifi/WifiDirectAssistant.java
deleted file mode 100644
index 7e0d715..0000000
--- a/FtcRobotController/app/src/main/java/com/qualcomm/robotcore/wifi/WifiDirectAssistant.java
+++ /dev/null
@@ -1,508 +0,0 @@
-package com.qualcomm.robotcore.wifi;
-
-import android.content.BroadcastReceiver;
-import android.content.Context;
-import android.content.Intent;
-import android.content.IntentFilter;
-import android.net.NetworkInfo;
-import android.net.wifi.p2p.WifiP2pConfig;
-import android.net.wifi.p2p.WifiP2pDevice;
-import android.net.wifi.p2p.WifiP2pDeviceList;
-import android.net.wifi.p2p.WifiP2pGroup;
-import android.net.wifi.p2p.WifiP2pInfo;
-import android.net.wifi.p2p.WifiP2pManager;
-import android.net.wifi.p2p.WifiP2pManager.ActionListener;
-import android.net.wifi.p2p.WifiP2pManager.Channel;
-import android.net.wifi.p2p.WifiP2pManager.ChannelListener;
-import android.net.wifi.p2p.WifiP2pManager.ConnectionInfoListener;
-import android.net.wifi.p2p.WifiP2pManager.GroupInfoListener;
-import android.net.wifi.p2p.WifiP2pManager.PeerListListener;
-import android.os.Looper;
-import com.qualcomm.robotcore.util.RobotLog;
-import java.net.InetAddress;
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-
-public class WifiDirectAssistant {
- private static WifiDirectAssistant a = null;
- private final List b = new ArrayList();
- private Context c = null;
- private boolean d = false;
- private final IntentFilter e;
- private final Channel f;
- private final WifiP2pManager g;
- private WifiDirectAssistant.d h;
- private final WifiDirectAssistant.a i;
- private final WifiDirectAssistant.c j;
- private final WifiDirectAssistant.b k;
- private int l = 0;
- private WifiDirectAssistant.ConnectStatus m;
- private WifiDirectAssistant.Event n;
- private String o;
- private String p;
- private InetAddress q;
- private String r;
- private String s;
- private String t;
- private boolean u;
- private int v;
- private WifiDirectAssistant.WifiDirectAssistantCallback w;
-
- private WifiDirectAssistant(Context var1) {
- this.m = WifiDirectAssistant.ConnectStatus.NOT_CONNECTED;
- this.n = null;
- this.o = "";
- this.p = "";
- this.q = null;
- this.r = "";
- this.s = "";
- this.t = "";
- this.u = false;
- this.v = 0;
- this.w = null;
- this.c = var1;
- this.e = new IntentFilter();
- this.e.addAction("android.net.wifi.p2p.STATE_CHANGED");
- this.e.addAction("android.net.wifi.p2p.PEERS_CHANGED");
- this.e.addAction("android.net.wifi.p2p.CONNECTION_STATE_CHANGE");
- this.e.addAction("android.net.wifi.p2p.THIS_DEVICE_CHANGED");
- this.g = (WifiP2pManager)var1.getSystemService("wifip2p");
- this.f = this.g.initialize(var1, Looper.getMainLooper(), (ChannelListener)null);
- this.h = new WifiDirectAssistant.d(null);
- this.i = new WifiDirectAssistant.a(null);
- this.j = new WifiDirectAssistant.c(null);
- this.k = new WifiDirectAssistant.b(null);
- }
-
- private void a(WifiP2pDevice var1) {
- this.p = var1.deviceName;
- this.o = var1.deviceAddress;
- RobotLog.v("Wifi Direct device information: " + this.p + " " + this.o);
- }
-
- private void a(WifiDirectAssistant.Event var1) {
- if(this.n != var1 || this.n == WifiDirectAssistant.Event.PEERS_AVAILABLE) {
- this.n = var1;
- if(this.w != null) {
- this.w.onWifiDirectEvent(var1);
- return;
- }
- }
-
- }
-
- public static String failureReasonToString(int var0) {
- switch(var0) {
- case 0:
- return "ERROR";
- case 1:
- return "P2P_UNSUPPORTED";
- case 2:
- return "BUSY";
- default:
- return "UNKNOWN (reason " + var0 + ")";
- }
- }
-
- public static WifiDirectAssistant getWifiDirectAssistant(Context var0) {
- synchronized(WifiDirectAssistant.class){}
-
- WifiDirectAssistant var2;
- try {
- if(a == null) {
- a = new WifiDirectAssistant(var0);
- }
-
- var2 = a;
- } finally {
- ;
- }
-
- return var2;
- }
-
- public void cancelDiscoverPeers() {
- RobotLog.d("Wifi Direct stop discovering peers");
- this.g.stopPeerDiscovery(this.f, (ActionListener)null);
- }
-
- public void connect(WifiP2pDevice var1) {
- if(this.m != WifiDirectAssistant.ConnectStatus.CONNECTING && this.m != WifiDirectAssistant.ConnectStatus.CONNECTED) {
- RobotLog.d("WifiDirect connecting to " + var1.deviceAddress);
- this.m = WifiDirectAssistant.ConnectStatus.CONNECTING;
- WifiP2pConfig var2 = new WifiP2pConfig();
- var2.deviceAddress = var1.deviceAddress;
- var2.wps.setup = 0;
- var2.groupOwnerIntent = 1;
- this.g.connect(this.f, var2, new ActionListener() {
- public void onFailure(int var1) {
- String var2 = WifiDirectAssistant.failureReasonToString(var1);
- WifiDirectAssistant.this.l = var1;
- RobotLog.d("WifiDirect connect cannot start - reason: " + var2);
- WifiDirectAssistant.this.a(WifiDirectAssistant.Event.ERROR);
- }
-
- public void onSuccess() {
- RobotLog.d("WifiDirect connect started");
- WifiDirectAssistant.this.a(WifiDirectAssistant.Event.CONNECTING);
- }
- });
- } else {
- RobotLog.d("WifiDirect connection request to " + var1.deviceAddress + " ignored, already connected");
- }
- }
-
- public void createGroup() {
- this.g.createGroup(this.f, new ActionListener() {
- public void onFailure(int var1) {
- if(var1 == 2) {
- RobotLog.d("Wifi Direct cannot create group, does group already exist?");
- } else {
- String var2 = WifiDirectAssistant.failureReasonToString(var1);
- WifiDirectAssistant.this.l = var1;
- RobotLog.w("Wifi Direct failure while trying to create group - reason: " + var2);
- WifiDirectAssistant.this.m = WifiDirectAssistant.ConnectStatus.ERROR;
- WifiDirectAssistant.this.a(WifiDirectAssistant.Event.ERROR);
- }
- }
-
- public void onSuccess() {
- WifiDirectAssistant.this.m = WifiDirectAssistant.ConnectStatus.GROUP_OWNER;
- WifiDirectAssistant.this.a(WifiDirectAssistant.Event.GROUP_CREATED);
- RobotLog.d("Wifi Direct created group");
- }
- });
- }
-
- public void disable() {
- synchronized(this){}
-
- try {
- this.v += -1;
- RobotLog.v("There are " + this.v + " Wifi Direct Assistant Clients (-)");
- if(this.v == 0) {
- RobotLog.v("Disabling Wifi Direct Assistant");
- this.g.stopPeerDiscovery(this.f, (ActionListener)null);
- this.g.cancelConnect(this.f, (ActionListener)null);
-
- try {
- this.c.unregisterReceiver(this.h);
- } catch (IllegalArgumentException var5) {
- ;
- }
-
- this.n = null;
- }
- } finally {
- ;
- }
-
- }
-
- public void discoverPeers() {
- this.g.discoverPeers(this.f, new ActionListener() {
- public void onFailure(int var1) {
- String var2 = WifiDirectAssistant.failureReasonToString(var1);
- WifiDirectAssistant.this.l = var1;
- RobotLog.w("Wifi Direct failure while trying to discover peers - reason: " + var2);
- WifiDirectAssistant.this.a(WifiDirectAssistant.Event.ERROR);
- }
-
- public void onSuccess() {
- WifiDirectAssistant.this.a(WifiDirectAssistant.Event.DISCOVERING_PEERS);
- RobotLog.d("Wifi Direct discovering peers");
- }
- });
- }
-
- public void enable() {
- synchronized(this){}
-
- try {
- ++this.v;
- RobotLog.v("There are " + this.v + " Wifi Direct Assistant Clients (+)");
- if(this.v == 1) {
- RobotLog.v("Enabling Wifi Direct Assistant");
- if(this.h == null) {
- this.h = new WifiDirectAssistant.d(null);
- }
-
- this.c.registerReceiver(this.h, this.e);
- }
- } finally {
- ;
- }
-
- }
-
- public WifiDirectAssistant.WifiDirectAssistantCallback getCallback() {
- return this.w;
- }
-
- public WifiDirectAssistant.ConnectStatus getConnectStatus() {
- return this.m;
- }
-
- public String getDeviceMacAddress() {
- return this.o;
- }
-
- public String getDeviceName() {
- return this.p;
- }
-
- public String getFailureReason() {
- return failureReasonToString(this.l);
- }
-
- public InetAddress getGroupOwnerAddress() {
- return this.q;
- }
-
- public String getGroupOwnerMacAddress() {
- return this.r;
- }
-
- public String getGroupOwnerName() {
- return this.s;
- }
-
- public String getPassphrase() {
- return this.t;
- }
-
- public List getPeers() {
- return new ArrayList(this.b);
- }
-
- public boolean isConnected() {
- return this.m == WifiDirectAssistant.ConnectStatus.CONNECTED || this.m == WifiDirectAssistant.ConnectStatus.GROUP_OWNER;
- }
-
- public boolean isEnabled() {
- synchronized(this){}
- boolean var5 = false;
-
- int var2;
- try {
- var5 = true;
- var2 = this.v;
- var5 = false;
- } finally {
- if(var5) {
- ;
- }
- }
-
- boolean var3;
- if(var2 > 0) {
- var3 = true;
- } else {
- var3 = false;
- }
-
- return var3;
- }
-
- public boolean isGroupOwner() {
- return this.m == WifiDirectAssistant.ConnectStatus.GROUP_OWNER;
- }
-
- public boolean isWifiP2pEnabled() {
- return this.d;
- }
-
- public void removeGroup() {
- this.g.removeGroup(this.f, (ActionListener)null);
- }
-
- public void setCallback(WifiDirectAssistant.WifiDirectAssistantCallback var1) {
- this.w = var1;
- }
-
- public static enum ConnectStatus {
- CONNECTED,
- CONNECTING,
- ERROR,
- GROUP_OWNER,
- NOT_CONNECTED;
-
- static {
- WifiDirectAssistant.ConnectStatus[] var0 = new WifiDirectAssistant.ConnectStatus[]{NOT_CONNECTED, CONNECTING, CONNECTED, GROUP_OWNER, ERROR};
- }
- }
-
- public static enum Event {
- CONNECTED_AS_GROUP_OWNER,
- CONNECTED_AS_PEER,
- CONNECTING,
- CONNECTION_INFO_AVAILABLE,
- DISCONNECTED,
- DISCOVERING_PEERS,
- ERROR,
- GROUP_CREATED,
- PEERS_AVAILABLE;
-
- static {
- WifiDirectAssistant.Event[] var0 = new WifiDirectAssistant.Event[]{DISCOVERING_PEERS, PEERS_AVAILABLE, GROUP_CREATED, CONNECTING, CONNECTED_AS_PEER, CONNECTED_AS_GROUP_OWNER, DISCONNECTED, CONNECTION_INFO_AVAILABLE, ERROR};
- }
- }
-
- public interface WifiDirectAssistantCallback {
- void onWifiDirectEvent(WifiDirectAssistant.Event var1);
- }
-
- private class a implements ConnectionInfoListener {
- private a() {
- }
-
- // $FF: synthetic method
- a(Object var2) {
- this();
- }
-
- public void onConnectionInfoAvailable(WifiP2pInfo var1) {
- WifiDirectAssistant.this.g.requestGroupInfo(WifiDirectAssistant.this.f, WifiDirectAssistant.this.k);
- WifiDirectAssistant.this.q = var1.groupOwnerAddress;
- RobotLog.d("Group owners address: " + WifiDirectAssistant.this.q.toString());
- if(var1.groupFormed && var1.isGroupOwner) {
- RobotLog.d("Wifi Direct group formed, this device is the group owner (GO)");
- WifiDirectAssistant.this.m = WifiDirectAssistant.ConnectStatus.GROUP_OWNER;
- WifiDirectAssistant.this.a(WifiDirectAssistant.Event.CONNECTED_AS_GROUP_OWNER);
- } else if(var1.groupFormed) {
- RobotLog.d("Wifi Direct group formed, this device is a client");
- WifiDirectAssistant.this.m = WifiDirectAssistant.ConnectStatus.CONNECTED;
- WifiDirectAssistant.this.a(WifiDirectAssistant.Event.CONNECTED_AS_PEER);
- } else {
- RobotLog.d("Wifi Direct group NOT formed, ERROR: " + var1.toString());
- WifiDirectAssistant.this.l = 0;
- WifiDirectAssistant.this.m = WifiDirectAssistant.ConnectStatus.ERROR;
- WifiDirectAssistant.this.a(WifiDirectAssistant.Event.ERROR);
- }
- }
- }
-
- private class b implements GroupInfoListener {
- private b() {
- }
-
- // $FF: synthetic method
- b(Object var2) {
- this();
- }
-
- public void onGroupInfoAvailable(WifiP2pGroup var1) {
- if(var1 != null) {
- if(var1.isGroupOwner()) {
- WifiDirectAssistant.this.r = WifiDirectAssistant.this.o;
- WifiDirectAssistant.this.s = WifiDirectAssistant.this.p;
- } else {
- WifiP2pDevice var2 = var1.getOwner();
- WifiDirectAssistant.this.r = var2.deviceAddress;
- WifiDirectAssistant.this.s = var2.deviceName;
- }
-
- WifiDirectAssistant.this.t = var1.getPassphrase();
- WifiDirectAssistant var6 = WifiDirectAssistant.this;
- String var7;
- if(WifiDirectAssistant.this.t != null) {
- var7 = WifiDirectAssistant.this.t;
- } else {
- var7 = "";
- }
-
- var6.t = var7;
- RobotLog.v("Wifi Direct connection information available");
- WifiDirectAssistant.this.a(WifiDirectAssistant.Event.CONNECTION_INFO_AVAILABLE);
- }
- }
- }
-
- private class c implements PeerListListener {
- private c() {
- }
-
- // $FF: synthetic method
- c(Object var2) {
- this();
- }
-
- public void onPeersAvailable(WifiP2pDeviceList var1) {
- WifiDirectAssistant.this.b.clear();
- WifiDirectAssistant.this.b.addAll(var1.getDeviceList());
- RobotLog.v("Wifi Direct peers found: " + WifiDirectAssistant.this.b.size());
- Iterator var3 = WifiDirectAssistant.this.b.iterator();
-
- while(var3.hasNext()) {
- WifiP2pDevice var4 = (WifiP2pDevice)var3.next();
- RobotLog.v(" peer: " + var4.deviceAddress + " " + var4.deviceName);
- }
-
- WifiDirectAssistant.this.a(WifiDirectAssistant.Event.PEERS_AVAILABLE);
- }
- }
-
- private class d extends BroadcastReceiver {
- private d() {
- }
-
- // $FF: synthetic method
- d(Object var2) {
- this();
- }
-
- public void onReceive(Context var1, Intent var2) {
- String var3 = var2.getAction();
- if("android.net.wifi.p2p.STATE_CHANGED".equals(var3)) {
- int var8 = var2.getIntExtra("wifi_p2p_state", -1);
- WifiDirectAssistant var9 = WifiDirectAssistant.this;
- boolean var10;
- if(var8 == 2) {
- var10 = true;
- } else {
- var10 = false;
- }
-
- var9.d = var10;
- RobotLog.d("Wifi Direct state - enabled: " + WifiDirectAssistant.this.d);
- } else {
- if("android.net.wifi.p2p.PEERS_CHANGED".equals(var3)) {
- RobotLog.d("Wifi Direct peers changed");
- WifiDirectAssistant.this.g.requestPeers(WifiDirectAssistant.this.f, WifiDirectAssistant.this.j);
- return;
- }
-
- if("android.net.wifi.p2p.CONNECTION_STATE_CHANGE".equals(var3)) {
- NetworkInfo var4 = (NetworkInfo)var2.getParcelableExtra("networkInfo");
- WifiP2pInfo var5 = (WifiP2pInfo)var2.getParcelableExtra("wifiP2pInfo");
- RobotLog.d("Wifi Direct connection changed - connected: " + var4.isConnected());
- if(var4.isConnected()) {
- WifiDirectAssistant.this.g.requestConnectionInfo(WifiDirectAssistant.this.f, WifiDirectAssistant.this.i);
- WifiDirectAssistant.this.g.stopPeerDiscovery(WifiDirectAssistant.this.f, (ActionListener)null);
- return;
- }
-
- WifiDirectAssistant.this.m = WifiDirectAssistant.ConnectStatus.NOT_CONNECTED;
- if(!WifiDirectAssistant.this.u) {
- WifiDirectAssistant.this.discoverPeers();
- }
-
- if(WifiDirectAssistant.this.isConnected()) {
- WifiDirectAssistant.this.a(WifiDirectAssistant.Event.DISCONNECTED);
- }
-
- WifiDirectAssistant.this.u = var5.groupFormed;
- return;
- }
-
- if("android.net.wifi.p2p.THIS_DEVICE_CHANGED".equals(var3)) {
- RobotLog.d("Wifi Direct this device changed");
- WifiDirectAssistant.this.a((WifiP2pDevice)var2.getParcelableExtra("wifiP2pDevice"));
- return;
- }
- }
-
- }
- }
-}
diff --git a/FtcRobotController/app/src/main/res/anim/fadein.xml b/FtcRobotController/app/src/main/res/anim/fadein.xml
deleted file mode 100644
index 8c8929c..0000000
Binary files a/FtcRobotController/app/src/main/res/anim/fadein.xml and /dev/null differ
diff --git a/FtcRobotController/app/src/main/res/anim/fadeout.xml b/FtcRobotController/app/src/main/res/anim/fadeout.xml
deleted file mode 100644
index c9cc249..0000000
Binary files a/FtcRobotController/app/src/main/res/anim/fadeout.xml and /dev/null differ
diff --git a/FtcRobotController/app/src/main/res/drawable-hdpi-v4/button_shape.xml b/FtcRobotController/app/src/main/res/drawable-hdpi-v4/button_shape.xml
deleted file mode 100644
index c60f5ca..0000000
Binary files a/FtcRobotController/app/src/main/res/drawable-hdpi-v4/button_shape.xml and /dev/null differ
diff --git a/FtcRobotController/app/src/main/res/drawable-hdpi-v4/ic_launcher.png b/FtcRobotController/app/src/main/res/drawable-hdpi-v4/ic_launcher.png
deleted file mode 100644
index 7cf6f3c..0000000
Binary files a/FtcRobotController/app/src/main/res/drawable-hdpi-v4/ic_launcher.png and /dev/null differ
diff --git a/FtcRobotController/app/src/main/res/drawable-hdpi-v4/icon_battery0.png b/FtcRobotController/app/src/main/res/drawable-hdpi-v4/icon_battery0.png
deleted file mode 100644
index ee37721..0000000
Binary files a/FtcRobotController/app/src/main/res/drawable-hdpi-v4/icon_battery0.png and /dev/null differ
diff --git a/FtcRobotController/app/src/main/res/drawable-hdpi-v4/icon_battery100.png b/FtcRobotController/app/src/main/res/drawable-hdpi-v4/icon_battery100.png
deleted file mode 100644
index cbe32ef..0000000
Binary files a/FtcRobotController/app/src/main/res/drawable-hdpi-v4/icon_battery100.png and /dev/null differ
diff --git a/FtcRobotController/app/src/main/res/drawable-hdpi-v4/icon_battery25.png b/FtcRobotController/app/src/main/res/drawable-hdpi-v4/icon_battery25.png
deleted file mode 100644
index 6fb1a57..0000000
Binary files a/FtcRobotController/app/src/main/res/drawable-hdpi-v4/icon_battery25.png and /dev/null differ
diff --git a/FtcRobotController/app/src/main/res/drawable-hdpi-v4/icon_battery50.png b/FtcRobotController/app/src/main/res/drawable-hdpi-v4/icon_battery50.png
deleted file mode 100644
index 41b46d9..0000000
Binary files a/FtcRobotController/app/src/main/res/drawable-hdpi-v4/icon_battery50.png and /dev/null differ
diff --git a/FtcRobotController/app/src/main/res/drawable-hdpi-v4/icon_battery75.png b/FtcRobotController/app/src/main/res/drawable-hdpi-v4/icon_battery75.png
deleted file mode 100644
index fcf7f6a..0000000
Binary files a/FtcRobotController/app/src/main/res/drawable-hdpi-v4/icon_battery75.png and /dev/null differ
diff --git a/FtcRobotController/app/src/main/res/drawable-hdpi-v4/icon_menu.png b/FtcRobotController/app/src/main/res/drawable-hdpi-v4/icon_menu.png
deleted file mode 100644
index 8fda661..0000000
Binary files a/FtcRobotController/app/src/main/res/drawable-hdpi-v4/icon_menu.png and /dev/null differ
diff --git a/FtcRobotController/app/src/main/res/drawable-hdpi-v4/icon_robotcontroller.png b/FtcRobotController/app/src/main/res/drawable-hdpi-v4/icon_robotcontroller.png
deleted file mode 100644
index 5f0cf80..0000000
Binary files a/FtcRobotController/app/src/main/res/drawable-hdpi-v4/icon_robotcontroller.png and /dev/null differ
diff --git a/FtcRobotController/app/src/main/res/drawable-mdpi-v4/ic_launcher.png b/FtcRobotController/app/src/main/res/drawable-mdpi-v4/ic_launcher.png
deleted file mode 100644
index 9503e2c..0000000
Binary files a/FtcRobotController/app/src/main/res/drawable-mdpi-v4/ic_launcher.png and /dev/null differ
diff --git a/FtcRobotController/app/src/main/res/drawable-xhdpi-v4/ic_launcher.png b/FtcRobotController/app/src/main/res/drawable-xhdpi-v4/ic_launcher.png
deleted file mode 100644
index 37eb37f..0000000
Binary files a/FtcRobotController/app/src/main/res/drawable-xhdpi-v4/ic_launcher.png and /dev/null differ
diff --git a/FtcRobotController/app/src/main/res/drawable-xhdpi-v4/icon_battery0.png b/FtcRobotController/app/src/main/res/drawable-xhdpi-v4/icon_battery0.png
deleted file mode 100644
index ee37721..0000000
Binary files a/FtcRobotController/app/src/main/res/drawable-xhdpi-v4/icon_battery0.png and /dev/null differ
diff --git a/FtcRobotController/app/src/main/res/drawable-xhdpi-v4/icon_battery100.png b/FtcRobotController/app/src/main/res/drawable-xhdpi-v4/icon_battery100.png
deleted file mode 100644
index cbe32ef..0000000
Binary files a/FtcRobotController/app/src/main/res/drawable-xhdpi-v4/icon_battery100.png and /dev/null differ
diff --git a/FtcRobotController/app/src/main/res/drawable-xhdpi-v4/icon_battery25.png b/FtcRobotController/app/src/main/res/drawable-xhdpi-v4/icon_battery25.png
deleted file mode 100644
index 6fb1a57..0000000
Binary files a/FtcRobotController/app/src/main/res/drawable-xhdpi-v4/icon_battery25.png and /dev/null differ
diff --git a/FtcRobotController/app/src/main/res/drawable-xhdpi-v4/icon_battery50.png b/FtcRobotController/app/src/main/res/drawable-xhdpi-v4/icon_battery50.png
deleted file mode 100644
index 41b46d9..0000000
Binary files a/FtcRobotController/app/src/main/res/drawable-xhdpi-v4/icon_battery50.png and /dev/null differ
diff --git a/FtcRobotController/app/src/main/res/drawable-xhdpi-v4/icon_battery75.png b/FtcRobotController/app/src/main/res/drawable-xhdpi-v4/icon_battery75.png
deleted file mode 100644
index fcf7f6a..0000000
Binary files a/FtcRobotController/app/src/main/res/drawable-xhdpi-v4/icon_battery75.png and /dev/null differ
diff --git a/FtcRobotController/app/src/main/res/drawable-xhdpi-v4/icon_menu.png b/FtcRobotController/app/src/main/res/drawable-xhdpi-v4/icon_menu.png
deleted file mode 100644
index 8fda661..0000000
Binary files a/FtcRobotController/app/src/main/res/drawable-xhdpi-v4/icon_menu.png and /dev/null differ
diff --git a/FtcRobotController/app/src/main/res/drawable-xhdpi-v4/icon_robotcontroller.png b/FtcRobotController/app/src/main/res/drawable-xhdpi-v4/icon_robotcontroller.png
deleted file mode 100644
index 5f0cf80..0000000
Binary files a/FtcRobotController/app/src/main/res/drawable-xhdpi-v4/icon_robotcontroller.png and /dev/null differ
diff --git a/FtcRobotController/app/src/main/res/drawable-xxhdpi-v4/ic_launcher.png b/FtcRobotController/app/src/main/res/drawable-xxhdpi-v4/ic_launcher.png
deleted file mode 100644
index 406a16d..0000000
Binary files a/FtcRobotController/app/src/main/res/drawable-xxhdpi-v4/ic_launcher.png and /dev/null differ
diff --git a/FtcRobotController/app/src/main/res/drawable/button_shape.xml b/FtcRobotController/app/src/main/res/drawable/button_shape.xml
deleted file mode 100644
index 8ec7e49..0000000
Binary files a/FtcRobotController/app/src/main/res/drawable/button_shape.xml and /dev/null differ
diff --git a/FtcRobotController/app/src/main/res/layout/activity_about.xml b/FtcRobotController/app/src/main/res/layout/activity_about.xml
deleted file mode 100644
index de3eba5..0000000
Binary files a/FtcRobotController/app/src/main/res/layout/activity_about.xml and /dev/null differ
diff --git a/FtcRobotController/app/src/main/res/layout/activity_autoconfigure.xml b/FtcRobotController/app/src/main/res/layout/activity_autoconfigure.xml
deleted file mode 100644
index fd55826..0000000
Binary files a/FtcRobotController/app/src/main/res/layout/activity_autoconfigure.xml and /dev/null differ
diff --git a/FtcRobotController/app/src/main/res/layout/activity_config_wifi_direct.xml b/FtcRobotController/app/src/main/res/layout/activity_config_wifi_direct.xml
deleted file mode 100644
index 288f699..0000000
Binary files a/FtcRobotController/app/src/main/res/layout/activity_config_wifi_direct.xml and /dev/null differ
diff --git a/FtcRobotController/app/src/main/res/layout/activity_ftc_configuration.xml b/FtcRobotController/app/src/main/res/layout/activity_ftc_configuration.xml
deleted file mode 100644
index efbb430..0000000
Binary files a/FtcRobotController/app/src/main/res/layout/activity_ftc_configuration.xml and /dev/null differ
diff --git a/FtcRobotController/app/src/main/res/layout/activity_ftc_controller.xml b/FtcRobotController/app/src/main/res/layout/activity_ftc_controller.xml
deleted file mode 100644
index 3c5aa56..0000000
Binary files a/FtcRobotController/app/src/main/res/layout/activity_ftc_controller.xml and /dev/null differ
diff --git a/FtcRobotController/app/src/main/res/layout/activity_ftc_driver_station.xml b/FtcRobotController/app/src/main/res/layout/activity_ftc_driver_station.xml
deleted file mode 100644
index ca6e553..0000000
Binary files a/FtcRobotController/app/src/main/res/layout/activity_ftc_driver_station.xml and /dev/null differ
diff --git a/FtcRobotController/app/src/main/res/layout/activity_ftc_pair_wifi_direct.xml b/FtcRobotController/app/src/main/res/layout/activity_ftc_pair_wifi_direct.xml
deleted file mode 100644
index 647d751..0000000
Binary files a/FtcRobotController/app/src/main/res/layout/activity_ftc_pair_wifi_direct.xml and /dev/null differ
diff --git a/FtcRobotController/app/src/main/res/layout/activity_ftc_wifi_channel_selector.xml b/FtcRobotController/app/src/main/res/layout/activity_ftc_wifi_channel_selector.xml
deleted file mode 100644
index 085a670..0000000
Binary files a/FtcRobotController/app/src/main/res/layout/activity_ftc_wifi_channel_selector.xml and /dev/null differ
diff --git a/FtcRobotController/app/src/main/res/layout/activity_load.xml b/FtcRobotController/app/src/main/res/layout/activity_load.xml
deleted file mode 100644
index 8df28f5..0000000
Binary files a/FtcRobotController/app/src/main/res/layout/activity_load.xml and /dev/null differ
diff --git a/FtcRobotController/app/src/main/res/layout/activity_settings.xml b/FtcRobotController/app/src/main/res/layout/activity_settings.xml
deleted file mode 100644
index 2b8ce9a..0000000
Binary files a/FtcRobotController/app/src/main/res/layout/activity_settings.xml and /dev/null differ
diff --git a/FtcRobotController/app/src/main/res/layout/activity_view_logs.xml b/FtcRobotController/app/src/main/res/layout/activity_view_logs.xml
deleted file mode 100644
index d5308c5..0000000
Binary files a/FtcRobotController/app/src/main/res/layout/activity_view_logs.xml and /dev/null differ
diff --git a/FtcRobotController/app/src/main/res/layout/analog_input_device.xml b/FtcRobotController/app/src/main/res/layout/analog_input_device.xml
deleted file mode 100644
index 01cb948..0000000
Binary files a/FtcRobotController/app/src/main/res/layout/analog_input_device.xml and /dev/null differ
diff --git a/FtcRobotController/app/src/main/res/layout/analog_inputs.xml b/FtcRobotController/app/src/main/res/layout/analog_inputs.xml
deleted file mode 100644
index 6974701..0000000
Binary files a/FtcRobotController/app/src/main/res/layout/analog_inputs.xml and /dev/null differ
diff --git a/FtcRobotController/app/src/main/res/layout/analog_output_device.xml b/FtcRobotController/app/src/main/res/layout/analog_output_device.xml
deleted file mode 100644
index 1e04746..0000000
Binary files a/FtcRobotController/app/src/main/res/layout/analog_output_device.xml and /dev/null differ
diff --git a/FtcRobotController/app/src/main/res/layout/analog_outputs.xml b/FtcRobotController/app/src/main/res/layout/analog_outputs.xml
deleted file mode 100644
index 5689da2..0000000
Binary files a/FtcRobotController/app/src/main/res/layout/analog_outputs.xml and /dev/null differ
diff --git a/FtcRobotController/app/src/main/res/layout/custom_dialog_title_bar.xml b/FtcRobotController/app/src/main/res/layout/custom_dialog_title_bar.xml
deleted file mode 100644
index ac094b5..0000000
Binary files a/FtcRobotController/app/src/main/res/layout/custom_dialog_title_bar.xml and /dev/null differ
diff --git a/FtcRobotController/app/src/main/res/layout/device_interface_module.xml b/FtcRobotController/app/src/main/res/layout/device_interface_module.xml
deleted file mode 100644
index c3ebe8d..0000000
Binary files a/FtcRobotController/app/src/main/res/layout/device_interface_module.xml and /dev/null differ
diff --git a/FtcRobotController/app/src/main/res/layout/device_name.xml b/FtcRobotController/app/src/main/res/layout/device_name.xml
deleted file mode 100644
index b843f34..0000000
Binary files a/FtcRobotController/app/src/main/res/layout/device_name.xml and /dev/null differ
diff --git a/FtcRobotController/app/src/main/res/layout/digital_device.xml b/FtcRobotController/app/src/main/res/layout/digital_device.xml
deleted file mode 100644
index 39345e3..0000000
Binary files a/FtcRobotController/app/src/main/res/layout/digital_device.xml and /dev/null differ
diff --git a/FtcRobotController/app/src/main/res/layout/digital_devices.xml b/FtcRobotController/app/src/main/res/layout/digital_devices.xml
deleted file mode 100644
index 77fd972..0000000
Binary files a/FtcRobotController/app/src/main/res/layout/digital_devices.xml and /dev/null differ
diff --git a/FtcRobotController/app/src/main/res/layout/file_info.xml b/FtcRobotController/app/src/main/res/layout/file_info.xml
deleted file mode 100644
index cfc6fa7..0000000
Binary files a/FtcRobotController/app/src/main/res/layout/file_info.xml and /dev/null differ
diff --git a/FtcRobotController/app/src/main/res/layout/header.xml b/FtcRobotController/app/src/main/res/layout/header.xml
deleted file mode 100644
index 6ede143..0000000
Binary files a/FtcRobotController/app/src/main/res/layout/header.xml and /dev/null differ
diff --git a/FtcRobotController/app/src/main/res/layout/i2c_device.xml b/FtcRobotController/app/src/main/res/layout/i2c_device.xml
deleted file mode 100644
index 959e570..0000000
Binary files a/FtcRobotController/app/src/main/res/layout/i2c_device.xml and /dev/null differ
diff --git a/FtcRobotController/app/src/main/res/layout/i2cs.xml b/FtcRobotController/app/src/main/res/layout/i2cs.xml
deleted file mode 100644
index c99f5fe..0000000
Binary files a/FtcRobotController/app/src/main/res/layout/i2cs.xml and /dev/null differ
diff --git a/FtcRobotController/app/src/main/res/layout/info_button.xml b/FtcRobotController/app/src/main/res/layout/info_button.xml
deleted file mode 100644
index ae97850..0000000
Binary files a/FtcRobotController/app/src/main/res/layout/info_button.xml and /dev/null differ
diff --git a/FtcRobotController/app/src/main/res/layout/legacy.xml b/FtcRobotController/app/src/main/res/layout/legacy.xml
deleted file mode 100644
index 62fe523..0000000
Binary files a/FtcRobotController/app/src/main/res/layout/legacy.xml and /dev/null differ
diff --git a/FtcRobotController/app/src/main/res/layout/matrices.xml b/FtcRobotController/app/src/main/res/layout/matrices.xml
deleted file mode 100644
index bdf6489..0000000
Binary files a/FtcRobotController/app/src/main/res/layout/matrices.xml and /dev/null differ
diff --git a/FtcRobotController/app/src/main/res/layout/matrix_devices.xml b/FtcRobotController/app/src/main/res/layout/matrix_devices.xml
deleted file mode 100644
index 01cb6de..0000000
Binary files a/FtcRobotController/app/src/main/res/layout/matrix_devices.xml and /dev/null differ
diff --git a/FtcRobotController/app/src/main/res/layout/motors.xml b/FtcRobotController/app/src/main/res/layout/motors.xml
deleted file mode 100644
index e6e72ba..0000000
Binary files a/FtcRobotController/app/src/main/res/layout/motors.xml and /dev/null differ
diff --git a/FtcRobotController/app/src/main/res/layout/orange_warning.xml b/FtcRobotController/app/src/main/res/layout/orange_warning.xml
deleted file mode 100644
index a1dd594..0000000
Binary files a/FtcRobotController/app/src/main/res/layout/orange_warning.xml and /dev/null differ
diff --git a/FtcRobotController/app/src/main/res/layout/pwm_device.xml b/FtcRobotController/app/src/main/res/layout/pwm_device.xml
deleted file mode 100644
index f830f42..0000000
Binary files a/FtcRobotController/app/src/main/res/layout/pwm_device.xml and /dev/null differ
diff --git a/FtcRobotController/app/src/main/res/layout/pwms.xml b/FtcRobotController/app/src/main/res/layout/pwms.xml
deleted file mode 100644
index d25209b..0000000
Binary files a/FtcRobotController/app/src/main/res/layout/pwms.xml and /dev/null differ
diff --git a/FtcRobotController/app/src/main/res/layout/servo.xml b/FtcRobotController/app/src/main/res/layout/servo.xml
deleted file mode 100644
index 512c9be..0000000
Binary files a/FtcRobotController/app/src/main/res/layout/servo.xml and /dev/null differ
diff --git a/FtcRobotController/app/src/main/res/layout/servos.xml b/FtcRobotController/app/src/main/res/layout/servos.xml
deleted file mode 100644
index 29ccf0e..0000000
Binary files a/FtcRobotController/app/src/main/res/layout/servos.xml and /dev/null differ
diff --git a/FtcRobotController/app/src/main/res/layout/shape.xml b/FtcRobotController/app/src/main/res/layout/shape.xml
deleted file mode 100644
index 8dfbb33..0000000
Binary files a/FtcRobotController/app/src/main/res/layout/shape.xml and /dev/null differ
diff --git a/FtcRobotController/app/src/main/res/layout/simple_device.xml b/FtcRobotController/app/src/main/res/layout/simple_device.xml
deleted file mode 100644
index bfde762..0000000
Binary files a/FtcRobotController/app/src/main/res/layout/simple_device.xml and /dev/null differ
diff --git a/FtcRobotController/app/src/main/res/layout/spinner_textview.xml b/FtcRobotController/app/src/main/res/layout/spinner_textview.xml
deleted file mode 100644
index 76f921e..0000000
Binary files a/FtcRobotController/app/src/main/res/layout/spinner_textview.xml and /dev/null differ
diff --git a/FtcRobotController/app/src/main/res/menu/ftc_driver_station.xml b/FtcRobotController/app/src/main/res/menu/ftc_driver_station.xml
deleted file mode 100644
index 3206dc3..0000000
Binary files a/FtcRobotController/app/src/main/res/menu/ftc_driver_station.xml and /dev/null differ
diff --git a/FtcRobotController/app/src/main/res/menu/ftc_robot_controller.xml b/FtcRobotController/app/src/main/res/menu/ftc_robot_controller.xml
index e371a0e..950ad1a 100644
Binary files a/FtcRobotController/app/src/main/res/menu/ftc_robot_controller.xml and b/FtcRobotController/app/src/main/res/menu/ftc_robot_controller.xml differ
diff --git a/FtcRobotController/app/src/main/res/menu/menu_load.xml b/FtcRobotController/app/src/main/res/menu/menu_load.xml
index 8359b03..560012b 100644
Binary files a/FtcRobotController/app/src/main/res/menu/menu_load.xml and b/FtcRobotController/app/src/main/res/menu/menu_load.xml differ
diff --git a/FtcRobotController/app/src/main/res/values-sw720dp-land-v13/dimens.xml b/FtcRobotController/app/src/main/res/values-sw720dp-land-v13/dimens.xml
new file mode 100644
index 0000000..3f11e48
--- /dev/null
+++ b/FtcRobotController/app/src/main/res/values-sw720dp-land-v13/dimens.xml
@@ -0,0 +1,4 @@
+
+
+ 128.0dip
+
diff --git a/FtcRobotController/app/src/main/res/values-v11/styles.xml b/FtcRobotController/app/src/main/res/values-v11/styles.xml
new file mode 100644
index 0000000..8134c26
--- /dev/null
+++ b/FtcRobotController/app/src/main/res/values-v11/styles.xml
@@ -0,0 +1,5 @@
+
+
+
+
+
diff --git a/FtcRobotController/app/src/main/res/values-v14/styles.xml b/FtcRobotController/app/src/main/res/values-v14/styles.xml
new file mode 100644
index 0000000..c1bfd63
--- /dev/null
+++ b/FtcRobotController/app/src/main/res/values-v14/styles.xml
@@ -0,0 +1,5 @@
+
+
+
+
+
diff --git a/FtcRobotController/app/src/main/res/values/arrays.xml b/FtcRobotController/app/src/main/res/values/arrays.xml
new file mode 100644
index 0000000..f45bcf5
--- /dev/null
+++ b/FtcRobotController/app/src/main/res/values/arrays.xml
@@ -0,0 +1,56 @@
+
+
+
+ - GYRO
+ - TOUCH_SENSOR
+ - COMPASS
+ - IR_SEEKER
+ - LIGHT_SENSOR
+ - ACCELEROMETER
+ - ULTRASONIC_SENSOR
+ - MOTOR_CONTROLLER
+ - SERVO_CONTROLLER
+ - TOUCH_SENSOR_MULTIPLEXER
+ - COLOR_SENSOR
+ - NOTHING
+
+
+ - NOTHING
+ - OPTICAL_DISTANCE_SENSOR
+ - ANALOG_INPUT
+
+
+ - NOTHING
+ - ANALOG_OUTPUT
+
+
+ - NOTHING
+ - TOUCH_SENSOR
+ - LED
+ - DIGITAL_DEVICE
+
+
+ - NOTHING
+ - IR_SEEKER_V3
+ - ADAFRUIT_COLOR_SENSOR
+ - COLOR_SENSOR
+ - I2C_DEVICE
+
+
+ - PWM Devices
+ - I2C Devices
+ - Analog Input Devices
+ - Digital Devices
+ - Analog Output Devices
+
+
+ - Auto - device selects channel
+ - 2.4GHz, Channel 1
+ - 2.4GHz, Channel 6
+ - 2.4GHz, Channel 11
+ - 5GHz, Channel 149
+ - 5GHz, Channel 153
+ - 5GHz, Channel 157
+ - 5GHz, Channel 161
+
+
diff --git a/FtcRobotController/app/src/main/res/values/colors.xml b/FtcRobotController/app/src/main/res/values/colors.xml
new file mode 100644
index 0000000..d2ce74d
--- /dev/null
+++ b/FtcRobotController/app/src/main/res/values/colors.xml
@@ -0,0 +1,14 @@
+
+
+ #ff000000
+ #ff309ea4
+ #ffa6040e
+ #ffff0a19
+ #ff3f0206
+ #ffc1e2e4
+ #ff790e15
+ #ff4e0106
+ #00000000
+ #ffbf0510
+ #ffffffff
+
diff --git a/FtcRobotController/app/src/main/res/values/dimens.xml b/FtcRobotController/app/src/main/res/values/dimens.xml
new file mode 100644
index 0000000..8e936a9
--- /dev/null
+++ b/FtcRobotController/app/src/main/res/values/dimens.xml
@@ -0,0 +1,5 @@
+
+
+ 16.0dip
+ 5.0dip
+
diff --git a/FtcRobotController/app/src/main/res/values/ids.xml b/FtcRobotController/app/src/main/res/values/ids.xml
new file mode 100644
index 0000000..a3f6683
--- /dev/null
+++ b/FtcRobotController/app/src/main/res/values/ids.xml
@@ -0,0 +1,208 @@
+
+
+ - false
+ - false
+ - false
+ - false
+ - false
+ - false
+ - false
+ - false
+ - false
+ - false
+ - false
+ - false
+ - false
+ - false
+ - false
+ - false
+ - false
+ - false
+ - false
+ - false
+ - false
+ - false
+ - false
+ - false
+ - false
+ - false
+ - false
+ - false
+ - false
+ - false
+ - false
+ - false
+ - false
+ - false
+ - false
+ - false
+ - false
+ - false
+ - false
+ - false
+ - false
+ - false
+ - false
+ - false
+ - false
+ - false
+ - false
+ - false
+ - false
+ - false
+ - false
+ - false
+ - false
+ - false
+ - false
+ - false
+ - false
+ - false
+ - false
+ - false
+ - false
+ - false
+ - false
+ - false
+ - false
+ - false
+ - false
+ - false
+ - false
+ - false
+ - false
+ - false
+ - false
+ - false
+ - false
+ - false
+ - false
+ - false
+ - false
+ - false
+ - false
+ - false
+ - false
+ - false
+ - false
+ - false
+ - false
+ - false
+ - false
+ - false
+ - false
+ - false
+ - false
+ - false
+ - false
+ - false
+ - false
+ - false
+ - false
+ - false
+ - false
+ - false
+ - false
+ - false
+ - false
+ - false
+ - false
+ - false
+ - false
+ - false
+ - false
+ - false
+ - false
+ - false
+ - false
+ - false
+ - false
+ - false
+ - false
+ - false
+ - false
+ - false
+ - false
+ - false
+ - false
+ - false
+ - false
+ - false
+ - false
+ - false
+ - false
+ - false
+ - false
+ - false
+ - false
+ - false
+ - false
+ - false
+ - false
+ - false
+ - false
+ - false
+ - false
+ - false
+ - false
+ - false
+ - false
+ - false
+ - false
+ - false
+ - false
+ - false
+ - false
+ - false
+ - false
+ - false
+ - false
+ - false
+ - false
+ - false
+ - false
+ - false
+ - false
+ - false
+ - false
+ - false
+ - false
+ - false
+ - false
+ - false
+ - false
+ - false
+ - false
+ - false
+ - false
+ - false
+ - false
+ - false
+ - false
+ - false
+ - false
+ - false
+ - false
+ - false
+ - false
+ - false
+ - false
+ - false
+ - false
+ - false
+ - false
+ - false
+ - false
+ - false
+ - false
+ - false
+ - false
+ - false
+ - false
+ - false
+ - false
+ - false
+ - false
+ - false
+ - false
+
diff --git a/FtcRobotController/app/src/main/res/values/public.xml b/FtcRobotController/app/src/main/res/values/public.xml
new file mode 100644
index 0000000..7013176
--- /dev/null
+++ b/FtcRobotController/app/src/main/res/values/public.xml
@@ -0,0 +1,390 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/FtcRobotController/app/src/main/res/values/strings.xml b/FtcRobotController/app/src/main/res/values/strings.xml
new file mode 100644
index 0000000..1da9396
--- /dev/null
+++ b/FtcRobotController/app/src/main/res/values/strings.xml
@@ -0,0 +1,115 @@
+
+
+ About
+ About
+ Configure Robot
+ Exit
+ Settings
+ View logs
+ Wifi Channel Selection
+ Add Motor Controller
+ Add Servo Controller
+ FTC Robot Controller
+ Attached
+ AutoConfigure
+ Press this button to use the AutoConfigure tool
+ AutoConfigure
+ Clear Logs
+ Cancel
+ Which sensor is attached?
+ Which sensor is attached?
+ Which sensor is attached?
+ Which sensor is attached?
+ Which sensor is attached?
+ Configure Robot
+ Configure Robot
+ Configure
+ 0
+ Device Info
+ Device Types
+ Done
+ Edit Analog Input Devices
+ Edit Analog Output Devices
+ Edit Controller
+ Edit Core Device Interface Module Controller
+ Edit Digital Devices
+ Edit I2c Devices
+ Edit Legacy Module Controller
+ Edit Matrix Controller
+ Edit Motor Controller
+ Edit Motor Controller
+ Edit PWM Devices
+ Edit Servo Controller
+ Activate
+ Delete
+ Edit
+ Choose Configuration File
+ Filename
+ Enter device name here
+ Device name
+ K9LegacyBot
+ K9USBBot
+ Launch WiFi Settings
+ Enter the name for this legacy module here
+ Load Configuration File
+ Matrix Controller
+ Enter the name for this matrix controller here
+ Motors
+ Matrix name
+ 1
+ 2
+ 3
+ 4
+ 1
+ 2
+ 3
+ 4
+ Servos
+ Motor Controller
+ Enter the name for this motor controller here
+ Enter motor name
+ Motor name
+ 1
+ 2
+ Enter name
+ Device name
+ OK
+ Port
+ Change Wifi Channel
+ Robot Configuration Settings
+ pref_hardware_config_filename
+ pref_launch_autoconfigure
+ pref_launch_configure
+ pref_launch_settings
+ Wifi Channel Selection
+ Select an XML file to instantiate a Robot from that file
+ Restart Robot
+ Restore Saved WiFi Settings
+ 0
+ 1
+ 2
+ 3
+ 4
+ 5
+ 6
+ Save
+ Save Configuration
+ Scan
+ Press this button to scan for attached devices
+ Servo Controller
+ Enter the name for this servo controller here
+ Servo name
+ Settings
+ Settings
+ Device type
+ Autoconfigure Robot
+ Configure Wifi Direct
+ Load Configuration File
+ View Logs
+ Wifi Channel Selection
+ View Logs
+ View logs
+ Please wait while we update the Wifi Direct settings on this device.
+ Select an XML file to instantiate a Robot from that file
+ Press this button to write the current configuration to an XML file
+
diff --git a/FtcRobotController/app/src/main/res/values/styles.xml b/FtcRobotController/app/src/main/res/values/styles.xml
new file mode 100644
index 0000000..42f3e32
--- /dev/null
+++ b/FtcRobotController/app/src/main/res/values/styles.xml
@@ -0,0 +1,26 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/FtcRobotController/app/src/main/res/xml/device_filter.xml b/FtcRobotController/app/src/main/res/xml/device_filter.xml
deleted file mode 100644
index 081ca1e..0000000
Binary files a/FtcRobotController/app/src/main/res/xml/device_filter.xml and /dev/null differ
diff --git a/FtcRobotController/app/src/main/res/xml/preferences.xml b/FtcRobotController/app/src/main/res/xml/preferences.xml
index 4d5213e..0efdbd5 100644
Binary files a/FtcRobotController/app/src/main/res/xml/preferences.xml and b/FtcRobotController/app/src/main/res/xml/preferences.xml differ
diff --git a/FtcRobotController/build.gradle b/FtcRobotController/build.gradle
index 1b7886d..ad91f4d 100644
--- a/FtcRobotController/build.gradle
+++ b/FtcRobotController/build.gradle
@@ -1,3 +1,13 @@
+/*
+ * Copyright © 2015 David Sargent
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
@@ -15,5 +25,8 @@ buildscript {
allprojects {
repositories {
jcenter()
+ flatDir {
+ dirs 'out'
+ }
}
-}
+}
\ No newline at end of file
diff --git a/FtcRobotController/ftcrobotcontroller/.gitignore b/FtcRobotController/ftcrobotcontroller/.gitignore
new file mode 100644
index 0000000..796b96d
--- /dev/null
+++ b/FtcRobotController/ftcrobotcontroller/.gitignore
@@ -0,0 +1 @@
+/build
diff --git a/FtcRobotController/ftcrobotcontroller/build.gradle b/FtcRobotController/ftcrobotcontroller/build.gradle
new file mode 100644
index 0000000..2412af0
--- /dev/null
+++ b/FtcRobotController/ftcrobotcontroller/build.gradle
@@ -0,0 +1,44 @@
+apply plugin: 'com.android.application'
+
+android {
+ compileSdkVersion 22
+ buildToolsVersion '22.0.1'
+ defaultConfig {
+ applicationId "com.qualcomm.ftcrobotcontroller"
+ minSdkVersion 19
+ targetSdkVersion 22
+ versionCode 1
+ versionName "1.0"
+ }
+ buildTypes {
+ release {
+ minifyEnabled false
+ proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
+ }
+ }
+ compileOptions {
+ sourceCompatibility JavaVersion.VERSION_1_7
+ targetCompatibility JavaVersion.VERSION_1_7
+ }
+ productFlavors {
+ }
+}
+
+// temp dependecies
+repositories {
+ flatDir {
+ dirs 'libs'
+ }
+}
+
+
+dependencies {
+ compile fileTree(include: ['*.jar'], dir: 'libs')
+ testCompile 'junit:junit:4.12'
+ compile project(':Analytics')
+ compile project(':FtcCommon')
+ compile project(':Hardware')
+ compile project(':ModernRobotics')
+ compile project(':robotcore')
+ compile project(':WirelessP2p')
+}
\ No newline at end of file
diff --git a/FtcRobotController/ftcrobotcontroller/ftcrobotcontroller.iml b/FtcRobotController/ftcrobotcontroller/ftcrobotcontroller.iml
new file mode 100644
index 0000000..55697b6
--- /dev/null
+++ b/FtcRobotController/ftcrobotcontroller/ftcrobotcontroller.iml
@@ -0,0 +1,97 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ generateDebugAndroidTestSources
+ generateDebugSources
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/FtcRobotController/ftcrobotcontroller/proguard-rules.pro b/FtcRobotController/ftcrobotcontroller/proguard-rules.pro
new file mode 100644
index 0000000..db73af4
--- /dev/null
+++ b/FtcRobotController/ftcrobotcontroller/proguard-rules.pro
@@ -0,0 +1,17 @@
+# Add project specific ProGuard rules here.
+# By default, the flags in this file are appended to flags specified
+# in C:\Users\Public\Android\sdk/tools/proguard/proguard-android.txt
+# You can edit the include path and order by changing the proguardFiles
+# directive in build.gradle.
+#
+# For more details, see
+# http://developer.android.com/guide/developing/tools/proguard.html
+
+# Add any project specific keep options here:
+
+# If your project uses WebView with JS, uncomment the following
+# and specify the fully qualified class name to the JavaScript interface
+# class:
+#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
+# public *;
+#}
diff --git a/FtcRobotController/ftcrobotcontroller/src/androidTest/java/com/qualcomm/ftcrobotcontroller/ApplicationTest.java b/FtcRobotController/ftcrobotcontroller/src/androidTest/java/com/qualcomm/ftcrobotcontroller/ApplicationTest.java
new file mode 100644
index 0000000..6e7660c
--- /dev/null
+++ b/FtcRobotController/ftcrobotcontroller/src/androidTest/java/com/qualcomm/ftcrobotcontroller/ApplicationTest.java
@@ -0,0 +1,13 @@
+package com.qualcomm.ftcrobotcontroller;
+
+import android.app.Application;
+import android.test.ApplicationTestCase;
+
+/**
+ * Testing Fundamentals
+ */
+public class ApplicationTest extends ApplicationTestCase {
+ public ApplicationTest() {
+ super(Application.class);
+ }
+}
\ No newline at end of file
diff --git a/FtcRobotController/ftcrobotcontroller/src/main/AndroidManifest.xml b/FtcRobotController/ftcrobotcontroller/src/main/AndroidManifest.xml
new file mode 100644
index 0000000..e8efcbe
--- /dev/null
+++ b/FtcRobotController/ftcrobotcontroller/src/main/AndroidManifest.xml
@@ -0,0 +1,97 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/FtcRobotController/ftcrobotcontroller/src/main/java/com/qualcomm/ftcrobotcontroller/FtcRobotControllerActivity.java b/FtcRobotController/ftcrobotcontroller/src/main/java/com/qualcomm/ftcrobotcontroller/FtcRobotControllerActivity.java
new file mode 100644
index 0000000..5e23cf3
--- /dev/null
+++ b/FtcRobotController/ftcrobotcontroller/src/main/java/com/qualcomm/ftcrobotcontroller/FtcRobotControllerActivity.java
@@ -0,0 +1,376 @@
+/* Copyright (c) 2014, 2015 Qualcomm Technologies Inc
+All rights reserved.
+Redistribution and use in source and binary forms, with or without modification,
+are permitted (subject to the limitations in the disclaimer below) provided that
+the following conditions are met:
+Redistributions of source code must retain the above copyright notice, this list
+of conditions and the following disclaimer.
+Redistributions in binary form must reproduce the above copyright notice, this
+list of conditions and the following disclaimer in the documentation and/or
+other materials provided with the distribution.
+Neither the name of Qualcomm Technologies Inc nor the names of its contributors
+may be used to endorse or promote products derived from this software without
+specific prior written permission.
+NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE GRANTED BY THIS
+LICENSE. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
+FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */
+
+package com.qualcomm.ftcrobotcontroller;
+
+import android.app.ActionBar;
+import android.app.Activity;
+import android.content.ComponentName;
+import android.content.Context;
+import android.content.Intent;
+import android.content.ServiceConnection;
+import android.content.SharedPreferences;
+import android.content.res.Configuration;
+import android.hardware.usb.UsbManager;
+import android.os.Bundle;
+import android.os.IBinder;
+import android.preference.PreferenceManager;
+import android.view.Gravity;
+import android.view.Menu;
+import android.view.MenuItem;
+import android.view.MotionEvent;
+import android.view.View;
+import android.widget.ImageButton;
+import android.widget.LinearLayout;
+import android.widget.TextView;
+import android.widget.Toast;
+
+import com.qualcomm.ftccommon.DbgLog;
+import com.qualcomm.ftccommon.FtcEventLoop;
+import com.qualcomm.ftccommon.FtcRobotControllerService;
+import com.qualcomm.ftccommon.FtcRobotControllerService.FtcRobotControllerBinder;
+import com.qualcomm.ftccommon.LaunchActivityConstantsList;
+import com.qualcomm.ftccommon.Restarter;
+import com.qualcomm.ftccommon.UpdateUI;
+import com.qualcomm.ftcrobotcontroller.opmodes.FtcOpModeRegister;
+import com.qualcomm.hardware.ModernRoboticsHardwareFactory;
+import com.qualcomm.robotcore.hardware.HardwareFactory;
+import com.qualcomm.robotcore.hardware.configuration.Utility;
+import com.qualcomm.robotcore.util.Dimmer;
+import com.qualcomm.robotcore.util.ImmersiveMode;
+import com.qualcomm.robotcore.util.RobotLog;
+import com.qualcomm.robotcore.wifi.WifiDirectAssistant;
+
+import java.io.FileInputStream;
+import java.io.FileNotFoundException;
+import java.io.Serializable;
+
+public class FtcRobotControllerActivity extends Activity {
+
+ public static final String CONFIGURE_FILENAME = "CONFIGURE_FILENAME";
+ private static final int REQUEST_CONFIG_WIFI_CHANNEL = 1;
+ private static final boolean USE_DEVICE_EMULATION = false;
+ private static final int NUM_GAMEPADS = 2;
+ protected SharedPreferences preferences;
+
+ protected UpdateUI.Callback callback;
+ protected Context context;
+ protected ImageButton buttonMenu;
+ protected TextView textDeviceName;
+ protected TextView textWifiDirectStatus;
+ protected TextView textRobotStatus;
+ protected TextView[] textGamepad = new TextView[NUM_GAMEPADS];
+ protected TextView textOpMode;
+ protected TextView textErrorMessage;
+ protected ImmersiveMode immersion;
+ protected UpdateUI updateUI;
+ protected Dimmer dimmer;
+ protected LinearLayout entireScreenLayout;
+ protected FtcRobotControllerService controllerService;
+ protected FtcEventLoop eventLoop;
+ private Utility utility;
+ protected ServiceConnection connection = new ServiceConnection() {
+ @Override
+ public void onServiceConnected(ComponentName name, IBinder service) {
+ FtcRobotControllerBinder binder = (FtcRobotControllerBinder) service;
+ onServiceBind(binder.getService());
+ }
+
+ @Override
+ public void onServiceDisconnected(ComponentName name) {
+ controllerService = null;
+ }
+ };
+
+ @Override
+ protected void onNewIntent(Intent intent) {
+ super.onNewIntent(intent);
+ if (UsbManager.ACTION_USB_ACCESSORY_ATTACHED.equals(intent.getAction())) {
+ // a new USB device has been attached
+ DbgLog.msg("USB Device attached; app restart may be needed");
+ }
+ }
+
+ @Override
+ protected void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+
+ setContentView(R.layout.activity_ftc_controller);
+
+ utility = new Utility(this);
+ context = this;
+ entireScreenLayout = (LinearLayout) findViewById(R.id.entire_screen);
+ buttonMenu = (ImageButton) findViewById(R.id.menu_buttons);
+ buttonMenu.setOnClickListener(new View.OnClickListener() {
+ @Override
+ public void onClick(View v) {
+ openOptionsMenu();
+ }
+ });
+
+ textDeviceName = (TextView) findViewById(R.id.textDeviceName);
+ textWifiDirectStatus = (TextView) findViewById(R.id.textWifiDirectStatus);
+ textRobotStatus = (TextView) findViewById(R.id.textRobotStatus);
+ textOpMode = (TextView) findViewById(R.id.textOpMode);
+ textErrorMessage = (TextView) findViewById(R.id.textErrorMessage);
+ textGamepad[0] = (TextView) findViewById(R.id.textGamepad1);
+ textGamepad[1] = (TextView) findViewById(R.id.textGamepad2);
+ immersion = new ImmersiveMode(getWindow().getDecorView());
+ dimmer = new Dimmer(this);
+ dimmer.longBright();
+ Restarter restarter = new RobotRestarter();
+
+ updateUI = new UpdateUI(this, dimmer);
+ updateUI.setRestarter(restarter);
+ updateUI.setTextViews(textWifiDirectStatus, textRobotStatus,
+ textGamepad, textOpMode, textErrorMessage, textDeviceName);
+ callback = updateUI.new Callback();
+
+ PreferenceManager.setDefaultValues(this, R.xml.preferences, false);
+ preferences = PreferenceManager.getDefaultSharedPreferences(this);
+
+ hittingMenuButtonBrightensScreen();
+
+ if (USE_DEVICE_EMULATION) {
+ ModernRoboticsHardwareFactory.enableDeviceEmulation();
+ }
+ }
+
+ @Override
+ protected void onStart() {
+ super.onStart();
+
+ // save 4MB of logcat to the SD card
+ RobotLog.writeLogcatToDisk(this, 4 * 1024);
+
+ Intent intent = new Intent(this, FtcRobotControllerService.class);
+ bindService(intent, connection, Context.BIND_AUTO_CREATE);
+
+ utility.updateHeader(Utility.NO_FILE, R.string.pref_hardware_config_filename, R.id.active_filename, R.id.included_header);
+
+ callback.wifiDirectUpdate(WifiDirectAssistant.Event.DISCONNECTED);
+
+ entireScreenLayout.setOnTouchListener(new View.OnTouchListener() {
+ @Override
+ public boolean onTouch(View v, MotionEvent event) {
+ dimmer.handleDimTimer();
+ return false;
+ }
+ });
+
+ }
+
+ @Override
+ protected void onResume() {
+ super.onResume();
+ }
+
+ @Override
+ public void onPause() {
+ super.onPause();
+ }
+
+ @Override
+ protected void onStop() {
+ super.onStop();
+
+ if (controllerService != null) unbindService(connection);
+
+ RobotLog.cancelWriteLogcatToDisk(this);
+ }
+
+ @Override
+ public void onWindowFocusChanged(boolean hasFocus) {
+ super.onWindowFocusChanged(hasFocus);
+ // When the window loses focus (e.g., the action overflow is shown),
+ // cancel any pending hide action. When the window gains focus,
+ // hide the system UI.
+ if (hasFocus) {
+ if (ImmersiveMode.apiOver19()) {
+ // Immersive flag only works on API 19 and above.
+ immersion.hideSystemUI();
+ }
+ } else {
+ immersion.cancelSystemUIHide();
+ }
+ }
+
+ @Override
+ public boolean onCreateOptionsMenu(Menu menu) {
+ getMenuInflater().inflate(R.menu.ftc_robot_controller, menu);
+ return true;
+ }
+
+ @Override
+ public boolean onOptionsItemSelected(MenuItem item) {
+ switch (item.getItemId()) {
+ case R.id.action_restart_robot:
+ dimmer.handleDimTimer();
+ Toast.makeText(context, "Restarting Robot", Toast.LENGTH_SHORT).show();
+ requestRobotRestart();
+ return true;
+ case R.id.action_settings:
+ // The string to launch this activity must match what's in AndroidManifest of FtcCommon for this activity.
+ Intent settingsIntent = new Intent("com.qualcomm.ftccommon.FtcRobotControllerSettingsActivity.intent.action.Launch");
+ startActivityForResult(settingsIntent, LaunchActivityConstantsList.FTC_ROBOT_CONTROLLER_ACTIVITY_CONFIGURE_ROBOT);
+ return true;
+ case R.id.action_about:
+ // The string to launch this activity must match what's in AndroidManifest of FtcCommon for this activity.
+ Intent intent = new Intent("com.qualcomm.ftccommon.configuration.AboutActivity.intent.action.Launch");
+ startActivity(intent);
+ return true;
+ case R.id.action_exit_app:
+ finish();
+ return true;
+ case R.id.action_view_logs:
+ // The string to launch this activity must match what's in AndroidManifest of FtcCommon for this activity.
+ Intent viewLogsIntent = new Intent("com.qualcomm.ftccommon.ViewLogsActivity.intent.action.Launch");
+ viewLogsIntent.putExtra(LaunchActivityConstantsList.VIEW_LOGS_ACTIVITY_FILENAME, RobotLog.getLogFilename(this));
+ startActivity(viewLogsIntent);
+ return true;
+ default:
+ return super.onOptionsItemSelected(item);
+ }
+ }
+
+ @Override
+ public void onConfigurationChanged(Configuration newConfig) {
+ super.onConfigurationChanged(newConfig);
+ // don't destroy assets on screen rotation
+ }
+
+ @Override
+ protected void onActivityResult(int request, int result, Intent intent) {
+ if (request == REQUEST_CONFIG_WIFI_CHANNEL) {
+ if (result == RESULT_OK) {
+ Toast toast = Toast.makeText(context, "Configuration Complete", Toast.LENGTH_LONG);
+ toast.setGravity(Gravity.CENTER, 0, 0);
+ showToast(toast);
+ }
+ }
+ if (request == LaunchActivityConstantsList.FTC_ROBOT_CONTROLLER_ACTIVITY_CONFIGURE_ROBOT) {
+ if (result == RESULT_OK) {
+ Serializable extra = intent.getSerializableExtra(FtcRobotControllerActivity.CONFIGURE_FILENAME);
+ if (extra != null) {
+ utility.saveToPreferences(extra.toString(), R.string.pref_hardware_config_filename);
+ utility.updateHeader(Utility.NO_FILE, R.string.pref_hardware_config_filename, R.id.active_filename, R.id.included_header);
+ }
+ }
+
+ }
+ }
+
+ public void onServiceBind(FtcRobotControllerService service) {
+ DbgLog.msg("Bound to Ftc Controller Service");
+ controllerService = service;
+ updateUI.setControllerService(controllerService);
+
+ callback.wifiDirectUpdate(controllerService.getWifiDirectStatus());
+ callback.robotUpdate(controllerService.getRobotStatus());
+ requestRobotSetup();
+ }
+
+ private void requestRobotSetup() {
+ if (controllerService == null) return;
+
+ FileInputStream fis = fileSetup();
+ // if we can't find the file, don't try and build the robot.
+ if (fis == null) {
+ return;
+ }
+
+ HardwareFactory factory;
+
+ // Modern Robotics Factory for use with Modern Robotics hardware
+ ModernRoboticsHardwareFactory modernRoboticsFactory = new ModernRoboticsHardwareFactory(context);
+ modernRoboticsFactory.setXmlInputStream(fis);
+ factory = modernRoboticsFactory;
+
+ eventLoop = new FtcEventLoop(factory, new FtcOpModeRegister(), callback, this);
+
+ controllerService.setCallback(callback);
+ controllerService.setupRobot(eventLoop);
+ }
+
+ private FileInputStream fileSetup() {
+
+ final String filename = Utility.CONFIG_FILES_DIR
+ + utility.getFilenameFromPrefs(R.string.pref_hardware_config_filename, Utility.NO_FILE) + Utility.FILE_EXT;
+
+ FileInputStream fis;
+ try {
+ fis = new FileInputStream(filename);
+ } catch (FileNotFoundException e) {
+ String msg = "Cannot open robot configuration file - " + filename;
+ utility.complainToast(msg, context);
+ DbgLog.msg(msg);
+ utility.saveToPreferences(Utility.NO_FILE, R.string.pref_hardware_config_filename);
+ fis = null;
+ }
+ utility.updateHeader(Utility.NO_FILE, R.string.pref_hardware_config_filename, R.id.active_filename, R.id.included_header);
+ return fis;
+ }
+
+ private void requestRobotShutdown() {
+ if (controllerService == null) return;
+ controllerService.shutdownRobot();
+ }
+
+ private void requestRobotRestart() {
+ requestRobotShutdown();
+ requestRobotSetup();
+ }
+
+ protected void hittingMenuButtonBrightensScreen() {
+ ActionBar actionBar = getActionBar();
+ if (actionBar != null) {
+ actionBar.addOnMenuVisibilityListener(new ActionBar.OnMenuVisibilityListener() {
+ @Override
+ public void onMenuVisibilityChanged(boolean isVisible) {
+ if (isVisible) {
+ dimmer.handleDimTimer();
+ }
+ }
+ });
+ }
+ }
+
+ public void showToast(final Toast toast) {
+ runOnUiThread(new Runnable() {
+ @Override
+ public void run() {
+ toast.show();
+ }
+ });
+ }
+
+ protected class RobotRestarter implements Restarter {
+
+ public void requestRestart() {
+ requestRobotRestart();
+ }
+
+ }
+}
\ No newline at end of file
diff --git a/FtcRobotController/ftcrobotcontroller/src/main/java/com/qualcomm/ftcrobotcontroller/opmodes/FtcOpModeRegister.java b/FtcRobotController/ftcrobotcontroller/src/main/java/com/qualcomm/ftcrobotcontroller/opmodes/FtcOpModeRegister.java
new file mode 100644
index 0000000..dc58aca
--- /dev/null
+++ b/FtcRobotController/ftcrobotcontroller/src/main/java/com/qualcomm/ftcrobotcontroller/opmodes/FtcOpModeRegister.java
@@ -0,0 +1,12 @@
+package com.qualcomm.ftcrobotcontroller.opmodes;
+
+
+import com.qualcomm.robotcore.eventloop.opmode.OpModeManager;
+import com.qualcomm.robotcore.eventloop.opmode.OpModeRegister;
+
+public class FtcOpModeRegister implements OpModeRegister {
+ @Override
+ public void register(OpModeManager var1) {
+ // register your code here
+ }
+}
diff --git a/FtcRobotController/ftcrobotcontroller/src/main/res/drawable-hdpi/button_shape.xml b/FtcRobotController/ftcrobotcontroller/src/main/res/drawable-hdpi/button_shape.xml
new file mode 100644
index 0000000..9418a5b
--- /dev/null
+++ b/FtcRobotController/ftcrobotcontroller/src/main/res/drawable-hdpi/button_shape.xml
@@ -0,0 +1,28 @@
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/FtcRobotController/ftcrobotcontroller/src/main/res/drawable-hdpi/ic_launcher.png b/FtcRobotController/ftcrobotcontroller/src/main/res/drawable-hdpi/ic_launcher.png
new file mode 100644
index 0000000..eebbc09
Binary files /dev/null and b/FtcRobotController/ftcrobotcontroller/src/main/res/drawable-hdpi/ic_launcher.png differ
diff --git a/FtcRobotController/ftcrobotcontroller/src/main/res/drawable-mdpi/ic_launcher.png b/FtcRobotController/ftcrobotcontroller/src/main/res/drawable-mdpi/ic_launcher.png
new file mode 100644
index 0000000..078253c
Binary files /dev/null and b/FtcRobotController/ftcrobotcontroller/src/main/res/drawable-mdpi/ic_launcher.png differ
diff --git a/FtcRobotController/ftcrobotcontroller/src/main/res/drawable-xhdpi/ic_launcher.png b/FtcRobotController/ftcrobotcontroller/src/main/res/drawable-xhdpi/ic_launcher.png
new file mode 100644
index 0000000..af143c7
Binary files /dev/null and b/FtcRobotController/ftcrobotcontroller/src/main/res/drawable-xhdpi/ic_launcher.png differ
diff --git a/FtcRobotController/ftcrobotcontroller/src/main/res/drawable-xhdpi/icon_battery0.png b/FtcRobotController/ftcrobotcontroller/src/main/res/drawable-xhdpi/icon_battery0.png
new file mode 100644
index 0000000..53d890f
Binary files /dev/null and b/FtcRobotController/ftcrobotcontroller/src/main/res/drawable-xhdpi/icon_battery0.png differ
diff --git a/FtcRobotController/ftcrobotcontroller/src/main/res/drawable-xhdpi/icon_battery100.png b/FtcRobotController/ftcrobotcontroller/src/main/res/drawable-xhdpi/icon_battery100.png
new file mode 100644
index 0000000..bacbcaa
Binary files /dev/null and b/FtcRobotController/ftcrobotcontroller/src/main/res/drawable-xhdpi/icon_battery100.png differ
diff --git a/FtcRobotController/ftcrobotcontroller/src/main/res/drawable-xhdpi/icon_battery25.png b/FtcRobotController/ftcrobotcontroller/src/main/res/drawable-xhdpi/icon_battery25.png
new file mode 100644
index 0000000..872c3cd
Binary files /dev/null and b/FtcRobotController/ftcrobotcontroller/src/main/res/drawable-xhdpi/icon_battery25.png differ
diff --git a/FtcRobotController/ftcrobotcontroller/src/main/res/drawable-xhdpi/icon_battery50.png b/FtcRobotController/ftcrobotcontroller/src/main/res/drawable-xhdpi/icon_battery50.png
new file mode 100644
index 0000000..f77dbf2
Binary files /dev/null and b/FtcRobotController/ftcrobotcontroller/src/main/res/drawable-xhdpi/icon_battery50.png differ
diff --git a/FtcRobotController/ftcrobotcontroller/src/main/res/drawable-xhdpi/icon_battery75.png b/FtcRobotController/ftcrobotcontroller/src/main/res/drawable-xhdpi/icon_battery75.png
new file mode 100644
index 0000000..7314256
Binary files /dev/null and b/FtcRobotController/ftcrobotcontroller/src/main/res/drawable-xhdpi/icon_battery75.png differ
diff --git a/FtcRobotController/ftcrobotcontroller/src/main/res/drawable-xhdpi/icon_menu.png b/FtcRobotController/ftcrobotcontroller/src/main/res/drawable-xhdpi/icon_menu.png
new file mode 100644
index 0000000..6b9e997
Binary files /dev/null and b/FtcRobotController/ftcrobotcontroller/src/main/res/drawable-xhdpi/icon_menu.png differ
diff --git a/FtcRobotController/ftcrobotcontroller/src/main/res/drawable-xhdpi/icon_robotcontroller.png b/FtcRobotController/ftcrobotcontroller/src/main/res/drawable-xhdpi/icon_robotcontroller.png
new file mode 100644
index 0000000..022552f
Binary files /dev/null and b/FtcRobotController/ftcrobotcontroller/src/main/res/drawable-xhdpi/icon_robotcontroller.png differ
diff --git a/FtcRobotController/ftcrobotcontroller/src/main/res/drawable-xxhdpi/ic_launcher.png b/FtcRobotController/ftcrobotcontroller/src/main/res/drawable-xxhdpi/ic_launcher.png
new file mode 100644
index 0000000..aeafa54
Binary files /dev/null and b/FtcRobotController/ftcrobotcontroller/src/main/res/drawable-xxhdpi/ic_launcher.png differ
diff --git a/FtcRobotController/ftcrobotcontroller/src/main/res/layout/activity_ftc_controller.xml b/FtcRobotController/ftcrobotcontroller/src/main/res/layout/activity_ftc_controller.xml
new file mode 100644
index 0000000..eaa98eb
--- /dev/null
+++ b/FtcRobotController/ftcrobotcontroller/src/main/res/layout/activity_ftc_controller.xml
@@ -0,0 +1,120 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/FtcRobotController/ftcrobotcontroller/src/main/res/layout/header.xml b/FtcRobotController/ftcrobotcontroller/src/main/res/layout/header.xml
new file mode 100644
index 0000000..a2df769
--- /dev/null
+++ b/FtcRobotController/ftcrobotcontroller/src/main/res/layout/header.xml
@@ -0,0 +1,39 @@
+
+
+
+
+
+
+
+
+
diff --git a/FtcRobotController/ftcrobotcontroller/src/main/res/layout/spinner_textview.xml b/FtcRobotController/ftcrobotcontroller/src/main/res/layout/spinner_textview.xml
new file mode 100644
index 0000000..7535c36
--- /dev/null
+++ b/FtcRobotController/ftcrobotcontroller/src/main/res/layout/spinner_textview.xml
@@ -0,0 +1,16 @@
+
+
+
\ No newline at end of file
diff --git a/FtcRobotController/ftcrobotcontroller/src/main/res/menu/ftc_robot_controller.xml b/FtcRobotController/ftcrobotcontroller/src/main/res/menu/ftc_robot_controller.xml
new file mode 100644
index 0000000..7518459
--- /dev/null
+++ b/FtcRobotController/ftcrobotcontroller/src/main/res/menu/ftc_robot_controller.xml
@@ -0,0 +1,42 @@
+
+
+
diff --git a/FtcRobotController/ftcrobotcontroller/src/main/res/menu/menu_load.xml b/FtcRobotController/ftcrobotcontroller/src/main/res/menu/menu_load.xml
new file mode 100644
index 0000000..c870ae8
--- /dev/null
+++ b/FtcRobotController/ftcrobotcontroller/src/main/res/menu/menu_load.xml
@@ -0,0 +1,19 @@
+
+
+
diff --git a/FtcRobotController/ftcrobotcontroller/src/main/res/values-sw600dp/dimens.xml b/FtcRobotController/ftcrobotcontroller/src/main/res/values-sw600dp/dimens.xml
new file mode 100644
index 0000000..03b23ca
--- /dev/null
+++ b/FtcRobotController/ftcrobotcontroller/src/main/res/values-sw600dp/dimens.xml
@@ -0,0 +1,18 @@
+
+
+
+
+
+
+
diff --git a/FtcRobotController/ftcrobotcontroller/src/main/res/values-sw720dp-land/dimens.xml b/FtcRobotController/ftcrobotcontroller/src/main/res/values-sw720dp-land/dimens.xml
new file mode 100644
index 0000000..11da41b
--- /dev/null
+++ b/FtcRobotController/ftcrobotcontroller/src/main/res/values-sw720dp-land/dimens.xml
@@ -0,0 +1,9 @@
+
+
+
+
+
+
diff --git a/FtcRobotController/ftcrobotcontroller/src/main/res/values-v11/styles.xml b/FtcRobotController/ftcrobotcontroller/src/main/res/values-v11/styles.xml
new file mode 100644
index 0000000..431fd35
--- /dev/null
+++ b/FtcRobotController/ftcrobotcontroller/src/main/res/values-v11/styles.xml
@@ -0,0 +1,21 @@
+
+
+
+
+
+
+
+
diff --git a/FtcRobotController/ftcrobotcontroller/src/main/res/values-v14/styles.xml b/FtcRobotController/ftcrobotcontroller/src/main/res/values-v14/styles.xml
new file mode 100644
index 0000000..ac40af5
--- /dev/null
+++ b/FtcRobotController/ftcrobotcontroller/src/main/res/values-v14/styles.xml
@@ -0,0 +1,22 @@
+
+
+
+
+
+
+
+
diff --git a/FtcRobotController/ftcrobotcontroller/src/main/res/values-w820dp/dimens.xml b/FtcRobotController/ftcrobotcontroller/src/main/res/values-w820dp/dimens.xml
new file mode 100644
index 0000000..30685bd
--- /dev/null
+++ b/FtcRobotController/ftcrobotcontroller/src/main/res/values-w820dp/dimens.xml
@@ -0,0 +1,16 @@
+
+
+
+
+ 64dp
+
diff --git a/FtcRobotController/ftcrobotcontroller/src/main/res/values/colors.xml b/FtcRobotController/ftcrobotcontroller/src/main/res/values/colors.xml
new file mode 100644
index 0000000..5fe26b0
--- /dev/null
+++ b/FtcRobotController/ftcrobotcontroller/src/main/res/values/colors.xml
@@ -0,0 +1,21 @@
+
+
+
+ #790E15
+ #3F0206
+ #4e0106
+ #bf0510
+ #A6040E
+ #ff0a19
+ #FFFFFF
+ #000000
+ #00000000
+
diff --git a/FtcRobotController/ftcrobotcontroller/src/main/res/values/dimens.xml b/FtcRobotController/ftcrobotcontroller/src/main/res/values/dimens.xml
new file mode 100644
index 0000000..33d8572
--- /dev/null
+++ b/FtcRobotController/ftcrobotcontroller/src/main/res/values/dimens.xml
@@ -0,0 +1,17 @@
+
+
+
+
+
+ 16dp
+ 5dp
+
+
\ No newline at end of file
diff --git a/FtcRobotController/ftcrobotcontroller/src/main/res/values/strings.xml b/FtcRobotController/ftcrobotcontroller/src/main/res/values/strings.xml
new file mode 100644
index 0000000..2b2bb47
--- /dev/null
+++ b/FtcRobotController/ftcrobotcontroller/src/main/res/values/strings.xml
@@ -0,0 +1,44 @@
+
+
+
+
+ FTC Robot Controller
+ OK
+
+ Robot Configuration Settings
+ Configure Robot
+ Wifi Channel Selection
+
+ Restart Robot
+ Exit
+ About
+ Settings
+ Settings
+ pref_hardware_config_filename
+ Settings
+ Autoconfigure Robot
+
+
+ Configure Wifi Direct
+
+
+ View logs
+ View logs
+ View Logs
+ Clear Logs
+
+
+ pref_launch_settings
+ Change Wifi Channel
+ pref_launch_configure
+ pref_launch_autoconfigure
+
+
diff --git a/FtcRobotController/ftcrobotcontroller/src/main/res/values/styles.xml b/FtcRobotController/ftcrobotcontroller/src/main/res/values/styles.xml
new file mode 100644
index 0000000..f52fb43
--- /dev/null
+++ b/FtcRobotController/ftcrobotcontroller/src/main/res/values/styles.xml
@@ -0,0 +1,48 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/FtcRobotController/ftcrobotcontroller/src/main/res/xml/device_filter.xml b/FtcRobotController/ftcrobotcontroller/src/main/res/xml/device_filter.xml
new file mode 100644
index 0000000..c947aaf
--- /dev/null
+++ b/FtcRobotController/ftcrobotcontroller/src/main/res/xml/device_filter.xml
@@ -0,0 +1,6 @@
+
+
+
+
diff --git a/FtcRobotController/ftcrobotcontroller/src/main/res/xml/preferences.xml b/FtcRobotController/ftcrobotcontroller/src/main/res/xml/preferences.xml
new file mode 100644
index 0000000..2bf2130
--- /dev/null
+++ b/FtcRobotController/ftcrobotcontroller/src/main/res/xml/preferences.xml
@@ -0,0 +1,38 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/FtcRobotController/ftcrobotcontroller/src/test/java/com/qualcomm/ftcrobotcontroller/ExampleUnitTest.java b/FtcRobotController/ftcrobotcontroller/src/test/java/com/qualcomm/ftcrobotcontroller/ExampleUnitTest.java
new file mode 100644
index 0000000..ff8509b
--- /dev/null
+++ b/FtcRobotController/ftcrobotcontroller/src/test/java/com/qualcomm/ftcrobotcontroller/ExampleUnitTest.java
@@ -0,0 +1,15 @@
+package com.qualcomm.ftcrobotcontroller;
+
+import org.junit.Test;
+
+import static org.junit.Assert.*;
+
+/**
+ * To work on unit tests, switch the Test Artifact in the Build Variants view.
+ */
+public class ExampleUnitTest {
+ @Test
+ public void addition_isCorrect() throws Exception {
+ assertEquals(4, 2 + 2);
+ }
+}
\ No newline at end of file
diff --git a/FtcRobotController/robotcore/.gitignore b/FtcRobotController/robotcore/.gitignore
new file mode 100644
index 0000000..796b96d
--- /dev/null
+++ b/FtcRobotController/robotcore/.gitignore
@@ -0,0 +1 @@
+/build
diff --git a/FtcRobotController/robotcore/build.gradle b/FtcRobotController/robotcore/build.gradle
new file mode 100644
index 0000000..e4f8894
--- /dev/null
+++ b/FtcRobotController/robotcore/build.gradle
@@ -0,0 +1,29 @@
+apply plugin: 'com.android.library'
+
+android {
+ compileSdkVersion 22
+ buildToolsVersion '22.0.1'
+ defaultConfig {
+ minSdkVersion 19
+ targetSdkVersion 22
+ versionCode 1
+ versionName "1.0"
+ }
+ buildTypes {
+ release {
+ minifyEnabled false
+ proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
+ }
+ }
+ compileOptions {
+ sourceCompatibility JavaVersion.VERSION_1_7
+ targetCompatibility JavaVersion.VERSION_1_7
+ }
+ productFlavors {
+ }
+}
+
+dependencies {
+ compile fileTree(include: ['*.jar'], dir: 'libs')
+ testCompile 'junit:junit:4.12'
+}
diff --git a/FtcRobotController/robotcore/proguard-rules.pro b/FtcRobotController/robotcore/proguard-rules.pro
new file mode 100644
index 0000000..db73af4
--- /dev/null
+++ b/FtcRobotController/robotcore/proguard-rules.pro
@@ -0,0 +1,17 @@
+# Add project specific ProGuard rules here.
+# By default, the flags in this file are appended to flags specified
+# in C:\Users\Public\Android\sdk/tools/proguard/proguard-android.txt
+# You can edit the include path and order by changing the proguardFiles
+# directive in build.gradle.
+#
+# For more details, see
+# http://developer.android.com/guide/developing/tools/proguard.html
+
+# Add any project specific keep options here:
+
+# If your project uses WebView with JS, uncomment the following
+# and specify the fully qualified class name to the JavaScript interface
+# class:
+#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
+# public *;
+#}
diff --git a/FtcRobotController/robotcore/robotcore.iml b/FtcRobotController/robotcore/robotcore.iml
new file mode 100644
index 0000000..ddd875d
--- /dev/null
+++ b/FtcRobotController/robotcore/robotcore.iml
@@ -0,0 +1,94 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ generateDebugAndroidTestSources
+ generateDebugSources
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/FtcRobotController/robotcore/src/androidTest/java/com/qualcomm/robotcore/ApplicationTest.java b/FtcRobotController/robotcore/src/androidTest/java/com/qualcomm/robotcore/ApplicationTest.java
new file mode 100644
index 0000000..4d7d8f3
--- /dev/null
+++ b/FtcRobotController/robotcore/src/androidTest/java/com/qualcomm/robotcore/ApplicationTest.java
@@ -0,0 +1,13 @@
+package com.qualcomm.robotcore;
+
+import android.app.Application;
+import android.test.ApplicationTestCase;
+
+/**
+ * Testing Fundamentals
+ */
+public class ApplicationTest extends ApplicationTestCase {
+ public ApplicationTest() {
+ super(Application.class);
+ }
+}
\ No newline at end of file
diff --git a/FtcRobotController/robotcore/src/main/AndroidManifest.xml b/FtcRobotController/robotcore/src/main/AndroidManifest.xml
new file mode 100644
index 0000000..cc320d6
--- /dev/null
+++ b/FtcRobotController/robotcore/src/main/AndroidManifest.xml
@@ -0,0 +1,11 @@
+
+
+
+
+
+
+
diff --git a/FtcRobotController/robotcore/src/main/java/com/qualcomm/robotcore/eventloop/EventLoop.java b/FtcRobotController/robotcore/src/main/java/com/qualcomm/robotcore/eventloop/EventLoop.java
new file mode 100644
index 0000000..9a60554
--- /dev/null
+++ b/FtcRobotController/robotcore/src/main/java/com/qualcomm/robotcore/eventloop/EventLoop.java
@@ -0,0 +1,17 @@
+package com.qualcomm.robotcore.eventloop;
+
+import com.qualcomm.robotcore.eventloop.opmode.OpModeManager;
+import com.qualcomm.robotcore.exception.RobotCoreException;
+import com.qualcomm.robotcore.robocol.Command;
+
+public interface EventLoop {
+ OpModeManager getOpModeManager();
+
+ void init(EventLoopManager var1) throws RobotCoreException, InterruptedException;
+
+ void loop() throws RobotCoreException, InterruptedException;
+
+ void processCommand(Command var1);
+
+ void teardown() throws RobotCoreException, InterruptedException;
+}
diff --git a/FtcRobotController/app/src/main/java/com/qualcomm/robotcore/eventloop/EventLoopManager.java b/FtcRobotController/robotcore/src/main/java/com/qualcomm/robotcore/eventloop/EventLoopManager.java
similarity index 79%
rename from FtcRobotController/app/src/main/java/com/qualcomm/robotcore/eventloop/EventLoopManager.java
rename to FtcRobotController/robotcore/src/main/java/com/qualcomm/robotcore/eventloop/EventLoopManager.java
index fe2fd05..4639b72 100644
--- a/FtcRobotController/app/src/main/java/com/qualcomm/robotcore/eventloop/EventLoopManager.java
+++ b/FtcRobotController/robotcore/src/main/java/com/qualcomm/robotcore/eventloop/EventLoopManager.java
@@ -1,526 +1,526 @@
-//
-// Source code recreated from a .class file by IntelliJ IDEA
-// (powered by Fernflower decompiler)
-//
-
-package com.qualcomm.robotcore.eventloop;
-
-import com.qualcomm.robotcore.eventloop.opmode.OpModeManager;
-import com.qualcomm.robotcore.exception.RobotCoreException;
-import com.qualcomm.robotcore.hardware.Gamepad;
-import com.qualcomm.robotcore.robocol.Command;
-import com.qualcomm.robotcore.robocol.Heartbeat;
-import com.qualcomm.robotcore.robocol.PeerDiscovery;
-import com.qualcomm.robotcore.robocol.RobocolDatagram;
-import com.qualcomm.robotcore.robocol.RobocolDatagramSocket;
-import com.qualcomm.robotcore.robocol.Telemetry;
-import com.qualcomm.robotcore.robocol.Heartbeat.Token;
-import com.qualcomm.robotcore.robocol.PeerDiscovery.PeerType;
-import com.qualcomm.robotcore.robot.RobotState;
-import com.qualcomm.robotcore.util.ElapsedTime;
-import com.qualcomm.robotcore.util.Range;
-import com.qualcomm.robotcore.util.RobotLog;
-import java.net.InetAddress;
-import java.net.SocketException;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.Set;
-import java.util.concurrent.CopyOnWriteArraySet;
-
-public class EventLoopManager {
- public static final String SYSTEM_TELEMETRY = "SYSTEM_TELEMETRY";
- public static final String ROBOT_BATTERY_LEVEL_KEY = "Robot Battery Level";
- public static final String RC_BATTERY_LEVEL_KEY = "RobotController Battery Level";
- private static final EventLoop a = new EventLoopManager.a((EventLoopManager.SyntheticClass_1)null);
- public RobotState state;
- private Thread b;
- private Thread scheduledSendsThread;
- private final RobocolDatagramSocket socket;
- private boolean isShutDown;
- private ElapsedTime elapsed;
- private EventLoop eventLoop;
- private final Gamepad[] gamepads;
- private Heartbeat heartbeat;
- private EventLoopManager.EventLoopMonitor eventLoopMonitor;
- private final Set syncdDevices;
- private final Command[] commands;
- private int m;
- private final Set n;
- private InetAddress inetAddress;
-
- public void handleDroppedConnection() {
- OpModeManager var1 = this.eventLoop.getOpModeManager();
- String var2 = "Lost connection while running op mode: " + var1.getActiveOpModeName();
- var1.initActiveOpMode("Stop Robot");
- this.reportRobotState(RobotState.DROPPED_CONNECTION);
- RobotLog.i(var2);
- }
-
- public EventLoopManager(RobocolDatagramSocket socket) {
- this.state = RobotState.NOT_STARTED;
- this.b = new Thread();
- this.scheduledSendsThread = new Thread();
- this.isShutDown = false;
- this.elapsed = new ElapsedTime();
- this.eventLoop = a;
- this.gamepads = new Gamepad[]{new Gamepad(), new Gamepad()};
- this.heartbeat = new Heartbeat(Token.EMPTY);
- this.eventLoopMonitor = null;
- this.syncdDevices = new CopyOnWriteArraySet();
- this.commands = new Command[8];
- this.m = 0;
- this.n = new CopyOnWriteArraySet();
- this.socket = socket;
- this.reportRobotState(RobotState.NOT_STARTED);
- }
-
- public void setMonitor(EventLoopManager.EventLoopMonitor monitor) {
- this.eventLoopMonitor = monitor;
- }
-
- public void start(EventLoop eventLoop) throws RobotCoreException {
- this.isShutDown = false;
- this.scheduledSendsThread = new Thread(new EventLoopManager.d((EventLoopManager.SyntheticClass_1)null), "Scheduled Sends");
- this.scheduledSendsThread.start();
- (new Thread(new EventLoopManager.c((EventLoopManager.SyntheticClass_1)null))).start();
- this.setEventLoop(eventLoop);
- }
-
- public void shutdown() {
- this.socket.close();
- this.scheduledSendsThread.interrupt();
- this.isShutDown = true;
- this.b();
- }
-
- public void registerSyncdDevice(SyncdDevice device) {
- this.syncdDevices.add(device);
- }
-
- public void unregisterSyncdDevice(SyncdDevice device) {
- this.syncdDevices.remove(device);
- }
-
- public void setEventLoop(EventLoop eventLoop) throws RobotCoreException {
- if(eventLoop == null) {
- eventLoop = a;
- RobotLog.d("Event loop cannot be null, using empty event loop");
- }
-
- this.b();
- this.eventLoop = eventLoop;
- this.a();
- }
-
- public EventLoop getEventLoop() {
- return this.eventLoop;
- }
-
- public Gamepad getGamepad() {
- return this.getGamepad(0);
- }
-
- public Gamepad getGamepad(int port) {
- Range.throwIfRangeIsInvalid((double)port, 0.0D, 1.0D);
- return this.gamepads[port];
- }
-
- public Gamepad[] getGamepads() {
- return this.gamepads;
- }
-
- public Heartbeat getHeartbeat() {
- return this.heartbeat;
- }
-
- public void sendTelemetryData(Telemetry telemetry) {
- try {
- this.socket.send(new RobocolDatagram(telemetry.toByteArray()));
- } catch (RobotCoreException var3) {
- RobotLog.w("Failed to send telemetry data");
- RobotLog.logStacktrace(var3);
- }
-
- telemetry.clearData();
- }
-
- public void sendCommand(Command command) {
- this.n.add(command);
- }
-
- private void a() throws RobotCoreException {
- try {
- this.reportRobotState(RobotState.INIT);
- this.eventLoop.init(this);
- Iterator var1 = this.syncdDevices.iterator();
-
- while(var1.hasNext()) {
- SyncdDevice var2 = (SyncdDevice)var1.next();
- var2.startBlockingWork();
- }
- } catch (Exception var3) {
- RobotLog.w("Caught exception during looper init: " + var3.toString());
- RobotLog.logStacktrace(var3);
- this.reportRobotState(RobotState.EMERGENCY_STOP);
- if(RobotLog.hasGlobalErrorMsg()) {
- this.buildAndSendTelemetry("SYSTEM_TELEMETRY", RobotLog.getGlobalErrorMsg());
- }
-
- throw new RobotCoreException("Robot failed to start: " + var3.getMessage());
- }
-
- this.elapsed = new ElapsedTime(0L);
- this.reportRobotState(RobotState.RUNNING);
- this.b = new Thread(new EventLoopManager.b((EventLoopManager.SyntheticClass_1)null), "Event Loop");
- this.b.start();
- }
-
- private void b() {
- this.b.interrupt();
-
- try {
- Thread.sleep(200L);
- } catch (InterruptedException var2) {
- ;
- }
-
- this.reportRobotState(RobotState.STOPPED);
- this.eventLoop = a;
- this.syncdDevices.clear();
- }
-
- private void reportRobotState(RobotState var1) {
- this.state = var1;
- RobotLog.v("EventLoopManager state is " + var1.toString());
- if(this.eventLoopMonitor != null) {
- this.eventLoopMonitor.onStateChange(var1);
- }
-
- }
-
- private void a(RobocolDatagram var1) throws RobotCoreException {
- Gamepad var2 = new Gamepad();
- var2.fromByteArray(var1.getData());
- if(var2.user >= 1 && var2.user <= 2) {
- int var3 = var2.user - 1;
- this.gamepads[var3] = var2;
- if(this.gamepads[0].id == this.gamepads[1].id) {
- RobotLog.v("Gamepad moved position, removing stale gamepad");
- if(var3 == 0) {
- this.gamepads[1] = new Gamepad();
- }
-
- if(var3 == 1) {
- this.gamepads[0] = new Gamepad();
- }
- }
-
- } else {
- RobotLog.d("Gamepad with user %d received. Only users 1 and 2 are valid");
- }
- }
-
- private void b(RobocolDatagram var1) throws RobotCoreException {
- Heartbeat var2 = new Heartbeat(Token.EMPTY);
- var2.fromByteArray(var1.getData());
- var2.setRobotState(this.state);
- var1.setData(var2.toByteArray());
- this.socket.send(var1);
- this.elapsed.reset();
- this.heartbeat = var2;
- }
-
- private void c(RobocolDatagram var1) throws RobotCoreException {
- if(!var1.getAddress().equals(this.inetAddress)) {
- if(this.state == RobotState.DROPPED_CONNECTION) {
- this.reportRobotState(RobotState.RUNNING);
- }
-
- if(this.eventLoop != a) {
- this.inetAddress = var1.getAddress();
- RobotLog.i("new remote peer discovered: " + this.inetAddress.getHostAddress());
-
- try {
- this.socket.connect(this.inetAddress);
- } catch (SocketException var4) {
- RobotLog.e("Unable to connect to peer:" + var4.toString());
- }
-
- PeerDiscovery var2 = new PeerDiscovery(PeerType.PEER);
- RobotLog.v("Sending peer discovery packet");
- RobocolDatagram var3 = new RobocolDatagram(var2);
- if(this.socket.getInetAddress() == null) {
- var3.setAddress(this.inetAddress);
- }
-
- this.socket.send(var3);
- }
- }
- }
-
- private void d(RobocolDatagram var1) throws RobotCoreException {
- Command var2 = new Command(var1.getData());
- if(var2.isAcknowledged()) {
- this.n.remove(var2);
- } else {
- var2.acknowledge();
- this.socket.send(new RobocolDatagram(var2));
- Command[] var3 = this.commands;
- int var4 = var3.length;
-
- for(int var5 = 0; var5 < var4; ++var5) {
- Command var6 = var3[var5];
- if(var6 != null && var6.equals(var2)) {
- return;
- }
- }
-
- this.commands[this.m++ % this.commands.length] = var2;
-
- try {
- this.eventLoop.processCommand(var2);
- } catch (Exception var7) {
- RobotLog.e("Event loop threw an exception while processing a command");
- RobotLog.logStacktrace(var7);
- }
-
- }
- }
-
- private void c() {
- }
-
- private void e(RobocolDatagram var1) {
- RobotLog.w("RobotCore event loop received unknown event type: " + var1.getMsgType().name());
- }
-
- public void buildAndSendTelemetry(String tag, String msg) {
- Telemetry var3 = new Telemetry();
- var3.setTag(tag);
- var3.addData(tag, msg);
- this.sendTelemetryData(var3);
- }
-
- public static enum State {
- NOT_STARTED,
- INIT,
- RUNNING,
- STOPPED,
- EMERGENCY_STOP,
- DROPPED_CONNECTION;
-
- private State() {
- }
- }
-
- private static class a implements EventLoop {
- private a() {
- }
-
- public void init(EventLoopManager eventProcessor) {
- }
-
- public void loop() {
- }
-
- public void teardown() {
- }
-
- public void processCommand(Command command) {
- RobotLog.w("Dropping command " + command.getName() + ", no active event loop");
- }
-
- public OpModeManager getOpModeManager() {
- return null;
- }
- }
-
- private class b implements Runnable {
- private b() {
- }
-
- public void run() {
- RobotLog.v("EventLoopRunnable has started");
-
- try {
- ElapsedTime var1 = new ElapsedTime();
- double var2 = 0.001D;
- long var4 = 5L;
-
- while(!Thread.interrupted()) {
- while(var1.time() < 0.001D) {
- Thread.sleep(5L);
- }
-
- var1.reset();
- if(RobotLog.hasGlobalErrorMsg()) {
- EventLoopManager.this.buildAndSendTelemetry("SYSTEM_TELEMETRY", RobotLog.getGlobalErrorMsg());
- }
-
- if(EventLoopManager.this.elapsed.startTime() == 0.0D) {
- Thread.sleep(500L);
- } else if(EventLoopManager.this.elapsed.time() > 2.0D) {
- EventLoopManager.this.handleDroppedConnection();
- EventLoopManager.this.inetAddress = null;
- EventLoopManager.this.elapsed = new ElapsedTime(0L);
- }
-
- Iterator var6 = EventLoopManager.this.syncdDevices.iterator();
-
- SyncdDevice var7;
- while(var6.hasNext()) {
- var7 = (SyncdDevice)var6.next();
- var7.blockUntilReady();
- }
-
- boolean var16 = false;
-
- try {
- var16 = true;
- EventLoopManager.this.eventLoop.loop();
- var16 = false;
- } catch (Exception var17) {
- RobotLog.e("Event loop threw an exception");
- RobotLog.logStacktrace(var17);
- String var22 = var17.getMessage();
- RobotLog.setGlobalErrorMsg("User code threw an uncaught exception: " + var22);
- EventLoopManager.this.buildAndSendTelemetry("SYSTEM_TELEMETRY", RobotLog.getGlobalErrorMsg());
- throw new RobotCoreException("EventLoop Exception in loop()");
- } finally {
- if(var16) {
- Iterator var9 = EventLoopManager.this.syncdDevices.iterator();
-
- while(var9.hasNext()) {
- SyncdDevice var10 = (SyncdDevice)var9.next();
- var10.startBlockingWork();
- }
-
- }
- }
-
- var6 = EventLoopManager.this.syncdDevices.iterator();
-
- while(var6.hasNext()) {
- var7 = (SyncdDevice)var6.next();
- var7.startBlockingWork();
- }
- }
- } catch (InterruptedException var20) {
- RobotLog.v("EventLoopRunnable interrupted");
- EventLoopManager.this.reportRobotState(RobotState.STOPPED);
- } catch (RobotCoreException var21) {
- RobotLog.v("RobotCoreException in EventLoopManager: " + var21.getMessage());
- EventLoopManager.this.reportRobotState(RobotState.EMERGENCY_STOP);
- EventLoopManager.this.buildAndSendTelemetry("SYSTEM_TELEMETRY", RobotLog.getGlobalErrorMsg());
- }
-
- try {
- EventLoopManager.this.eventLoop.teardown();
- } catch (Exception var18) {
- RobotLog.w("Caught exception during looper teardown: " + var18.toString());
- RobotLog.logStacktrace(var18);
- if(RobotLog.hasGlobalErrorMsg()) {
- EventLoopManager.this.buildAndSendTelemetry("SYSTEM_TELEMETRY", RobotLog.getGlobalErrorMsg());
- }
- }
-
- RobotLog.v("EventLoopRunnable has exited");
- }
- }
-
- private class c implements Runnable {
- ElapsedTime a;
-
- private c() {
- this.a = new ElapsedTime();
- }
-
- public void run() {
- while(true) {
- RobocolDatagram var1 = EventLoopManager.this.socket.recv();
- if(EventLoopManager.this.isShutDown || EventLoopManager.this.socket.isClosed()) {
- return;
- }
-
- if(var1 == null) {
- Thread.yield();
- } else {
- if(RobotLog.hasGlobalErrorMsg()) {
- EventLoopManager.this.buildAndSendTelemetry("SYSTEM_TELEMETRY", RobotLog.getGlobalErrorMsg());
- }
-
- try {
- switch(EventLoopManager.SyntheticClass_1.a[var1.getMsgType().ordinal()]) {
- case 1:
- EventLoopManager.this.a(var1);
- break;
- case 2:
- EventLoopManager.this.b(var1);
- break;
- case 3:
- EventLoopManager.this.c(var1);
- break;
- case 4:
- EventLoopManager.this.d(var1);
- break;
- case 5:
- EventLoopManager.this.c();
- break;
- default:
- EventLoopManager.this.e(var1);
- }
- } catch (RobotCoreException var3) {
- RobotLog.w("RobotCore event loop cannot process event: " + var3.toString());
- }
- }
- }
- }
- }
-
- private class d implements Runnable {
- private Set b;
-
- private d() {
- this.b = new HashSet();
- }
-
- public void run() {
- while(!Thread.interrupted()) {
- Iterator var1 = EventLoopManager.this.n.iterator();
-
- while(var1.hasNext()) {
- Command var2 = (Command)var1.next();
- if(var2.getAttempts() > 10) {
- RobotLog.w("Failed to send command, too many attempts: " + var2.toString());
- this.b.add(var2);
- } else if(var2.isAcknowledged()) {
- RobotLog.v("Command " + var2.getName() + " has been acknowledged by remote device");
- this.b.add(var2);
- } else {
- try {
- RobotLog.v("Sending command: " + var2.getName() + ", attempt " + var2.getAttempts());
- EventLoopManager.this.socket.send(new RobocolDatagram(var2.toByteArray()));
- } catch (RobotCoreException var5) {
- RobotLog.w("Failed to send command " + var2.getName());
- RobotLog.logStacktrace(var5);
- }
- }
- }
-
- EventLoopManager.this.n.removeAll(this.b);
- this.b.clear();
-
- try {
- Thread.sleep(100L);
- } catch (InterruptedException var4) {
- return;
- }
- }
-
- }
- }
-
- public interface EventLoopMonitor {
- void onStateChange(RobotState var1);
- }
-}
+//
+// Source code recreated from a .class file by IntelliJ IDEA
+// (powered by Fernflower decompiler)
+//
+
+package com.qualcomm.robotcore.eventloop;
+
+import com.qualcomm.robotcore.eventloop.opmode.OpModeManager;
+import com.qualcomm.robotcore.exception.RobotCoreException;
+import com.qualcomm.robotcore.hardware.Gamepad;
+import com.qualcomm.robotcore.robocol.Command;
+import com.qualcomm.robotcore.robocol.Heartbeat;
+import com.qualcomm.robotcore.robocol.Heartbeat.Token;
+import com.qualcomm.robotcore.robocol.PeerDiscovery;
+import com.qualcomm.robotcore.robocol.PeerDiscovery.PeerType;
+import com.qualcomm.robotcore.robocol.RobocolDatagram;
+import com.qualcomm.robotcore.robocol.RobocolDatagramSocket;
+import com.qualcomm.robotcore.robocol.Telemetry;
+import com.qualcomm.robotcore.robot.RobotState;
+import com.qualcomm.robotcore.util.ElapsedTime;
+import com.qualcomm.robotcore.util.Range;
+import com.qualcomm.robotcore.util.RobotLog;
+
+import java.net.InetAddress;
+import java.net.SocketException;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.Set;
+import java.util.concurrent.CopyOnWriteArraySet;
+
+public class EventLoopManager {
+ public static final String SYSTEM_TELEMETRY = "SYSTEM_TELEMETRY";
+ public static final String ROBOT_BATTERY_LEVEL_KEY = "Robot Battery Level";
+ public static final String RC_BATTERY_LEVEL_KEY = "RobotController Battery Level";
+ private static final EventLoop a = new a();
+ private final RobocolDatagramSocket socket;
+ private final Gamepad[] gamepads;
+ private final Set syncdDevices;
+ private final Command[] commands;
+ private final Set n;
+ public RobotState state;
+ private Thread b;
+ private Thread scheduledSendsThread;
+ private boolean isShutDown;
+ private ElapsedTime elapsed;
+ private EventLoop eventLoop;
+ private Heartbeat heartbeat;
+ private EventLoopMonitor eventLoopMonitor;
+ private int m;
+ private InetAddress inetAddress;
+
+ public EventLoopManager(RobocolDatagramSocket socket) {
+ this.state = RobotState.NOT_STARTED;
+ this.b = new Thread();
+ this.scheduledSendsThread = new Thread();
+ this.isShutDown = false;
+ this.elapsed = new ElapsedTime();
+ this.eventLoop = a;
+ this.gamepads = new Gamepad[]{new Gamepad(), new Gamepad()};
+ this.heartbeat = new Heartbeat(Token.EMPTY);
+ this.eventLoopMonitor = null;
+ this.syncdDevices = new CopyOnWriteArraySet();
+ this.commands = new Command[8];
+ this.m = 0;
+ this.n = new CopyOnWriteArraySet();
+ this.socket = socket;
+ this.reportRobotState(RobotState.NOT_STARTED);
+ }
+
+ public void handleDroppedConnection() {
+ OpModeManager var1 = this.eventLoop.getOpModeManager();
+ String var2 = "Lost connection while running op mode: " + var1.getActiveOpModeName();
+ var1.initActiveOpMode("Stop Robot");
+ this.reportRobotState(RobotState.DROPPED_CONNECTION);
+ RobotLog.i(var2);
+ }
+
+ public void setMonitor(EventLoopMonitor monitor) {
+ this.eventLoopMonitor = monitor;
+ }
+
+ public void start(EventLoop eventLoop) throws RobotCoreException {
+ this.isShutDown = false;
+ this.scheduledSendsThread = new Thread(new d(), "Scheduled Sends");
+ this.scheduledSendsThread.start();
+ (new Thread(new c())).start();
+ this.setEventLoop(eventLoop);
+ }
+
+ public void shutdown() {
+ this.socket.close();
+ this.scheduledSendsThread.interrupt();
+ this.isShutDown = true;
+ this.b();
+ }
+
+ public void registerSyncdDevice(SyncdDevice device) {
+ this.syncdDevices.add(device);
+ }
+
+ public void unregisterSyncdDevice(SyncdDevice device) {
+ this.syncdDevices.remove(device);
+ }
+
+ public EventLoop getEventLoop() {
+ return this.eventLoop;
+ }
+
+ public void setEventLoop(EventLoop eventLoop) throws RobotCoreException {
+ if (eventLoop == null) {
+ eventLoop = a;
+ RobotLog.d("Event loop cannot be null, using empty event loop");
+ }
+
+ this.b();
+ this.eventLoop = eventLoop;
+ this.a();
+ }
+
+ public Gamepad getGamepad() {
+ return this.getGamepad(0);
+ }
+
+ public Gamepad getGamepad(int port) {
+ Range.throwIfRangeIsInvalid((double) port, 0.0D, 1.0D);
+ return this.gamepads[port];
+ }
+
+ public Gamepad[] getGamepads() {
+ return this.gamepads;
+ }
+
+ public Heartbeat getHeartbeat() {
+ return this.heartbeat;
+ }
+
+ public void sendTelemetryData(Telemetry telemetry) {
+ try {
+ this.socket.send(new RobocolDatagram(telemetry.toByteArray()));
+ } catch (RobotCoreException var3) {
+ RobotLog.w("Failed to send telemetry data");
+ RobotLog.logStacktrace(var3);
+ }
+
+ telemetry.clearData();
+ }
+
+ public void sendCommand(Command command) {
+ this.n.add(command);
+ }
+
+ private void a() throws RobotCoreException {
+ try {
+ this.reportRobotState(RobotState.INIT);
+ this.eventLoop.init(this);
+ Iterator var1 = this.syncdDevices.iterator();
+
+ while (var1.hasNext()) {
+ SyncdDevice var2 = (SyncdDevice) var1.next();
+ var2.startBlockingWork();
+ }
+ } catch (Exception var3) {
+ RobotLog.w("Caught exception during looper init: " + var3.toString());
+ RobotLog.logStacktrace(var3);
+ this.reportRobotState(RobotState.EMERGENCY_STOP);
+ if (RobotLog.hasGlobalErrorMsg()) {
+ this.buildAndSendTelemetry("SYSTEM_TELEMETRY", RobotLog.getGlobalErrorMsg());
+ }
+
+ throw new RobotCoreException("Robot failed to start: " + var3.getMessage());
+ }
+
+ this.elapsed = new ElapsedTime(0L);
+ this.reportRobotState(RobotState.RUNNING);
+ this.b = new Thread(new b(), "Event Loop");
+ this.b.start();
+ }
+
+ private void b() {
+ this.b.interrupt();
+
+ try {
+ Thread.sleep(200L);
+ } catch (InterruptedException var2) {
+ }
+
+ this.reportRobotState(RobotState.STOPPED);
+ this.eventLoop = a;
+ this.syncdDevices.clear();
+ }
+
+ private void reportRobotState(RobotState var1) {
+ this.state = var1;
+ RobotLog.v("EventLoopManager state is " + var1.toString());
+ if (this.eventLoopMonitor != null) {
+ this.eventLoopMonitor.onStateChange(var1);
+ }
+
+ }
+
+ private void a(RobocolDatagram var1) throws RobotCoreException {
+ Gamepad var2 = new Gamepad();
+ var2.fromByteArray(var1.getData());
+ if (var2.user >= 1 && var2.user <= 2) {
+ int var3 = var2.user - 1;
+ this.gamepads[var3] = var2;
+ if (this.gamepads[0].id == this.gamepads[1].id) {
+ RobotLog.v("Gamepad moved position, removing stale gamepad");
+ if (var3 == 0) {
+ this.gamepads[1] = new Gamepad();
+ }
+
+ if (var3 == 1) {
+ this.gamepads[0] = new Gamepad();
+ }
+ }
+
+ } else {
+ RobotLog.d("Gamepad with user %d received. Only users 1 and 2 are valid");
+ }
+ }
+
+ private void b(RobocolDatagram var1) throws RobotCoreException {
+ Heartbeat var2 = new Heartbeat(Token.EMPTY);
+ var2.fromByteArray(var1.getData());
+ var2.setRobotState(this.state);
+ var1.setData(var2.toByteArray());
+ this.socket.send(var1);
+ this.elapsed.reset();
+ this.heartbeat = var2;
+ }
+
+ private void c(RobocolDatagram var1) throws RobotCoreException {
+ if (!var1.getAddress().equals(this.inetAddress)) {
+ if (this.state == RobotState.DROPPED_CONNECTION) {
+ this.reportRobotState(RobotState.RUNNING);
+ }
+
+ if (this.eventLoop != a) {
+ this.inetAddress = var1.getAddress();
+ RobotLog.i("new remote peer discovered: " + this.inetAddress.getHostAddress());
+
+ try {
+ this.socket.connect(this.inetAddress);
+ } catch (SocketException var4) {
+ RobotLog.e("Unable to connect to peer:" + var4.toString());
+ }
+
+ PeerDiscovery var2 = new PeerDiscovery(PeerType.PEER);
+ RobotLog.v("Sending peer discovery packet");
+ RobocolDatagram var3 = new RobocolDatagram(var2);
+ if (this.socket.getInetAddress() == null) {
+ var3.setAddress(this.inetAddress);
+ }
+
+ this.socket.send(var3);
+ }
+ }
+ }
+
+ private void d(RobocolDatagram var1) throws RobotCoreException {
+ Command var2 = new Command(var1.getData());
+ if (var2.isAcknowledged()) {
+ this.n.remove(var2);
+ } else {
+ var2.acknowledge();
+ this.socket.send(new RobocolDatagram(var2));
+ Command[] var3 = this.commands;
+ int var4 = var3.length;
+
+ for (int var5 = 0; var5 < var4; ++var5) {
+ Command var6 = var3[var5];
+ if (var6 != null && var6.equals(var2)) {
+ return;
+ }
+ }
+
+ this.commands[this.m++ % this.commands.length] = var2;
+
+ try {
+ this.eventLoop.processCommand(var2);
+ } catch (Exception var7) {
+ RobotLog.e("Event loop threw an exception while processing a command");
+ RobotLog.logStacktrace(var7);
+ }
+
+ }
+ }
+
+ private void c() {
+ }
+
+ private void e(RobocolDatagram var1) {
+ RobotLog.w("RobotCore event loop received unknown event type: " + var1.getMsgType().name());
+ }
+
+ public void buildAndSendTelemetry(String tag, String msg) {
+ Telemetry var3 = new Telemetry();
+ var3.setTag(tag);
+ var3.addData(tag, msg);
+ this.sendTelemetryData(var3);
+ }
+
+ public enum State {
+ NOT_STARTED,
+ INIT,
+ RUNNING,
+ STOPPED,
+ EMERGENCY_STOP,
+ DROPPED_CONNECTION;
+
+ State() {
+ }
+ }
+
+ public interface EventLoopMonitor {
+ void onStateChange(RobotState var1);
+ }
+
+ private static class a implements EventLoop {
+ private a() {
+ }
+
+ public void init(EventLoopManager eventProcessor) {
+ }
+
+ public void loop() {
+ }
+
+ public void teardown() {
+ }
+
+ public void processCommand(Command command) {
+ RobotLog.w("Dropping command " + command.getName() + ", no active event loop");
+ }
+
+ public OpModeManager getOpModeManager() {
+ return null;
+ }
+ }
+
+ private class b implements Runnable {
+ private b() {
+ }
+
+ public void run() {
+ RobotLog.v("EventLoopRunnable has started");
+
+ try {
+ ElapsedTime var1 = new ElapsedTime();
+ double var2 = 0.001D;
+ long var4 = 5L;
+
+ while (!Thread.interrupted()) {
+ while (var1.time() < 0.001D) {
+ Thread.sleep(5L);
+ }
+
+ var1.reset();
+ if (RobotLog.hasGlobalErrorMsg()) {
+ EventLoopManager.this.buildAndSendTelemetry("SYSTEM_TELEMETRY", RobotLog.getGlobalErrorMsg());
+ }
+
+ if (EventLoopManager.this.elapsed.startTime() == 0.0D) {
+ Thread.sleep(500L);
+ } else if (EventLoopManager.this.elapsed.time() > 2.0D) {
+ EventLoopManager.this.handleDroppedConnection();
+ EventLoopManager.this.inetAddress = null;
+ EventLoopManager.this.elapsed = new ElapsedTime(0L);
+ }
+
+ Iterator var6 = EventLoopManager.this.syncdDevices.iterator();
+
+ SyncdDevice var7;
+ while (var6.hasNext()) {
+ var7 = (SyncdDevice) var6.next();
+ var7.blockUntilReady();
+ }
+
+ boolean var16 = false;
+
+ try {
+ var16 = true;
+ EventLoopManager.this.eventLoop.loop();
+ var16 = false;
+ } catch (Exception var17) {
+ RobotLog.e("Event loop threw an exception");
+ RobotLog.logStacktrace(var17);
+ String var22 = var17.getMessage();
+ RobotLog.setGlobalErrorMsg("User code threw an uncaught exception: " + var22);
+ EventLoopManager.this.buildAndSendTelemetry("SYSTEM_TELEMETRY", RobotLog.getGlobalErrorMsg());
+ throw new RobotCoreException("EventLoop Exception in loop()");
+ } finally {
+ if (var16) {
+ Iterator var9 = EventLoopManager.this.syncdDevices.iterator();
+
+ while (var9.hasNext()) {
+ SyncdDevice var10 = (SyncdDevice) var9.next();
+ var10.startBlockingWork();
+ }
+
+ }
+ }
+
+ var6 = EventLoopManager.this.syncdDevices.iterator();
+
+ while (var6.hasNext()) {
+ var7 = (SyncdDevice) var6.next();
+ var7.startBlockingWork();
+ }
+ }
+ } catch (InterruptedException var20) {
+ RobotLog.v("EventLoopRunnable interrupted");
+ EventLoopManager.this.reportRobotState(RobotState.STOPPED);
+ } catch (RobotCoreException var21) {
+ RobotLog.v("RobotCoreException in EventLoopManager: " + var21.getMessage());
+ EventLoopManager.this.reportRobotState(RobotState.EMERGENCY_STOP);
+ EventLoopManager.this.buildAndSendTelemetry("SYSTEM_TELEMETRY", RobotLog.getGlobalErrorMsg());
+ }
+
+ try {
+ EventLoopManager.this.eventLoop.teardown();
+ } catch (Exception var18) {
+ RobotLog.w("Caught exception during looper teardown: " + var18.toString());
+ RobotLog.logStacktrace(var18);
+ if (RobotLog.hasGlobalErrorMsg()) {
+ EventLoopManager.this.buildAndSendTelemetry("SYSTEM_TELEMETRY", RobotLog.getGlobalErrorMsg());
+ }
+ }
+
+ RobotLog.v("EventLoopRunnable has exited");
+ }
+ }
+
+ private class c implements Runnable {
+ ElapsedTime a;
+
+ private c() {
+ this.a = new ElapsedTime();
+ }
+
+ public void run() {
+ while (true) {
+ RobocolDatagram var1 = EventLoopManager.this.socket.recv();
+ if (EventLoopManager.this.isShutDown || EventLoopManager.this.socket.isClosed()) {
+ return;
+ }
+
+ if (var1 == null) {
+ Thread.yield();
+ } else {
+ if (RobotLog.hasGlobalErrorMsg()) {
+ EventLoopManager.this.buildAndSendTelemetry("SYSTEM_TELEMETRY", RobotLog.getGlobalErrorMsg());
+ }
+
+ try {
+ switch (var1.getMsgType().ordinal()) {
+ case 1:
+ EventLoopManager.this.a(var1);
+ break;
+ case 2:
+ EventLoopManager.this.b(var1);
+ break;
+ case 3:
+ EventLoopManager.this.c(var1);
+ break;
+ case 4:
+ EventLoopManager.this.d(var1);
+ break;
+ case 5:
+ EventLoopManager.this.c();
+ break;
+ default:
+ EventLoopManager.this.e(var1);
+ }
+ } catch (RobotCoreException var3) {
+ RobotLog.w("RobotCore event loop cannot process event: " + var3.toString());
+ }
+ }
+ }
+ }
+ }
+
+ private class d implements Runnable {
+ private Set b;
+
+ private d() {
+ this.b = new HashSet();
+ }
+
+ public void run() {
+ while (!Thread.interrupted()) {
+ Iterator var1 = EventLoopManager.this.n.iterator();
+
+ while (var1.hasNext()) {
+ Command var2 = (Command) var1.next();
+ if (var2.getAttempts() > 10) {
+ RobotLog.w("Failed to send command, too many attempts: " + var2.toString());
+ this.b.add(var2);
+ } else if (var2.isAcknowledged()) {
+ RobotLog.v("Command " + var2.getName() + " has been acknowledged by remote device");
+ this.b.add(var2);
+ } else {
+ try {
+ RobotLog.v("Sending command: " + var2.getName() + ", attempt " + var2.getAttempts());
+ EventLoopManager.this.socket.send(new RobocolDatagram(var2.toByteArray()));
+ } catch (RobotCoreException var5) {
+ RobotLog.w("Failed to send command " + var2.getName());
+ RobotLog.logStacktrace(var5);
+ }
+ }
+ }
+
+ EventLoopManager.this.n.removeAll(this.b);
+ this.b.clear();
+
+ try {
+ Thread.sleep(100L);
+ } catch (InterruptedException var4) {
+ return;
+ }
+ }
+
+ }
+ }
+}
diff --git a/FtcRobotController/app/src/main/java/com/qualcomm/robotcore/eventloop/SyncdDevice.java b/FtcRobotController/robotcore/src/main/java/com/qualcomm/robotcore/eventloop/SyncdDevice.java
similarity index 54%
rename from FtcRobotController/app/src/main/java/com/qualcomm/robotcore/eventloop/SyncdDevice.java
rename to FtcRobotController/robotcore/src/main/java/com/qualcomm/robotcore/eventloop/SyncdDevice.java
index f5c86f0..e2b86b0 100644
--- a/FtcRobotController/app/src/main/java/com/qualcomm/robotcore/eventloop/SyncdDevice.java
+++ b/FtcRobotController/robotcore/src/main/java/com/qualcomm/robotcore/eventloop/SyncdDevice.java
@@ -1,9 +1,9 @@
-package com.qualcomm.robotcore.eventloop;
-
-import com.qualcomm.robotcore.exception.RobotCoreException;
-
-public interface SyncdDevice {
- void blockUntilReady() throws RobotCoreException, InterruptedException;
-
- void startBlockingWork();
-}
+package com.qualcomm.robotcore.eventloop;
+
+import com.qualcomm.robotcore.exception.RobotCoreException;
+
+public interface SyncdDevice {
+ void blockUntilReady() throws RobotCoreException, InterruptedException;
+
+ void startBlockingWork();
+}
diff --git a/FtcRobotController/app/src/main/java/com/qualcomm/robotcore/eventloop/opmode/LinearOpMode.java b/FtcRobotController/robotcore/src/main/java/com/qualcomm/robotcore/eventloop/opmode/LinearOpMode.java
similarity index 85%
rename from FtcRobotController/app/src/main/java/com/qualcomm/robotcore/eventloop/opmode/LinearOpMode.java
rename to FtcRobotController/robotcore/src/main/java/com/qualcomm/robotcore/eventloop/opmode/LinearOpMode.java
index 5f7fdc6..0e27b5f 100644
--- a/FtcRobotController/app/src/main/java/com/qualcomm/robotcore/eventloop/opmode/LinearOpMode.java
+++ b/FtcRobotController/robotcore/src/main/java/com/qualcomm/robotcore/eventloop/opmode/LinearOpMode.java
@@ -1,137 +1,136 @@
-//
-// Source code recreated from a .class file by IntelliJ IDEA
-// (powered by Fernflower decompiler)
-//
-
-package com.qualcomm.robotcore.eventloop.opmode;
-
-import com.qualcomm.robotcore.eventloop.opmode.OpMode;
-import com.qualcomm.robotcore.util.ElapsedTime;
-import com.qualcomm.robotcore.util.RobotLog;
-
-public abstract class LinearOpMode extends OpMode {
- private LinearOpMode.a a = null;
- private Thread b = null;
- private ElapsedTime c = new ElapsedTime();
- private volatile boolean d = false;
-
- public LinearOpMode() {
- }
-
- public abstract void runOpMode() throws InterruptedException;
-
- public synchronized void waitForStart() throws InterruptedException {
- while(!this.d) {
- synchronized(this) {
- this.wait();
- }
- }
-
- }
-
- public void waitOneFullHardwareCycle() throws InterruptedException {
- this.waitForNextHardwareCycle();
- Thread.sleep(1L);
- this.waitForNextHardwareCycle();
- }
-
- public void waitForNextHardwareCycle() throws InterruptedException {
- synchronized(this) {
- this.wait();
- }
- }
-
- public void sleep(long milliseconds) throws InterruptedException {
- Thread.sleep(milliseconds);
- }
-
- public boolean opModeIsActive() {
- return this.d;
- }
-
- public final void init() {
- this.a = new LinearOpMode.a(this);
- this.b = new Thread(this.a, "Linear OpMode Helper");
- this.b.start();
- }
-
- public final void init_loop() {
- }
-
- public final void start() {
- this.d = true;
- synchronized(this) {
- this.notifyAll();
- }
- }
-
- public final void loop() {
- if(this.a.a()) {
- throw this.a.b();
- } else {
- synchronized(this) {
- this.notifyAll();
- }
- }
- }
-
- public final void stop() {
- this.d = false;
- if(!this.a.c()) {
- this.b.interrupt();
- }
-
- this.c.reset();
-
- while(!this.a.c() && this.c.time() < 0.5D) {
- Thread.yield();
- }
-
- if(!this.a.c()) {
- RobotLog.e("*****************************************************************");
- RobotLog.e("User Linear Op Mode took too long to exit; emergency killing app.");
- RobotLog.e("Possible infinite loop in user code?");
- RobotLog.e("*****************************************************************");
- System.exit(-1);
- }
-
- }
-
- private static class a implements Runnable {
- private RuntimeException a = null;
- private boolean b = false;
- private final LinearOpMode c;
-
- public a(LinearOpMode var1) {
- this.c = var1;
- }
-
- public void run() {
- this.a = null;
- this.b = false;
-
- try {
- this.c.runOpMode();
- } catch (InterruptedException var6) {
- RobotLog.d("LinearOpMode received an Interrupted Exception; shutting down this linear op mode");
- } catch (RuntimeException var7) {
- this.a = var7;
- } finally {
- this.b = true;
- }
-
- }
-
- public boolean a() {
- return this.a != null;
- }
-
- public RuntimeException b() {
- return this.a;
- }
-
- public boolean c() {
- return this.b;
- }
- }
-}
+//
+// Source code recreated from a .class file by IntelliJ IDEA
+// (powered by Fernflower decompiler)
+//
+
+package com.qualcomm.robotcore.eventloop.opmode;
+
+import com.qualcomm.robotcore.util.ElapsedTime;
+import com.qualcomm.robotcore.util.RobotLog;
+
+public abstract class LinearOpMode extends OpMode {
+ private LinearOpMode.a a = null;
+ private Thread b = null;
+ private ElapsedTime c = new ElapsedTime();
+ private volatile boolean d = false;
+
+ public LinearOpMode() {
+ }
+
+ public abstract void runOpMode() throws InterruptedException;
+
+ public synchronized void waitForStart() throws InterruptedException {
+ while (!this.d) {
+ synchronized (this) {
+ this.wait();
+ }
+ }
+
+ }
+
+ public void waitOneFullHardwareCycle() throws InterruptedException {
+ this.waitForNextHardwareCycle();
+ Thread.sleep(1L);
+ this.waitForNextHardwareCycle();
+ }
+
+ public void waitForNextHardwareCycle() throws InterruptedException {
+ synchronized (this) {
+ this.wait();
+ }
+ }
+
+ public void sleep(long milliseconds) throws InterruptedException {
+ Thread.sleep(milliseconds);
+ }
+
+ public boolean opModeIsActive() {
+ return this.d;
+ }
+
+ public final void init() {
+ this.a = new a(this);
+ this.b = new Thread(this.a, "Linear OpMode Helper");
+ this.b.start();
+ }
+
+ public final void init_loop() {
+ }
+
+ public final void start() {
+ this.d = true;
+ synchronized (this) {
+ this.notifyAll();
+ }
+ }
+
+ public final void loop() {
+ if (this.a.a()) {
+ throw this.a.b();
+ } else {
+ synchronized (this) {
+ this.notifyAll();
+ }
+ }
+ }
+
+ public final void stop() {
+ this.d = false;
+ if (!this.a.c()) {
+ this.b.interrupt();
+ }
+
+ this.c.reset();
+
+ while (!this.a.c() && this.c.time() < 0.5D) {
+ Thread.yield();
+ }
+
+ if (!this.a.c()) {
+ RobotLog.e("*****************************************************************");
+ RobotLog.e("User Linear Op Mode took too long to exit; emergency killing app.");
+ RobotLog.e("Possible infinite loop in user code?");
+ RobotLog.e("*****************************************************************");
+ System.exit(-1);
+ }
+
+ }
+
+ private static class a implements Runnable {
+ private final LinearOpMode c;
+ private RuntimeException a = null;
+ private boolean b = false;
+
+ public a(LinearOpMode var1) {
+ this.c = var1;
+ }
+
+ public void run() {
+ this.a = null;
+ this.b = false;
+
+ try {
+ this.c.runOpMode();
+ } catch (InterruptedException var6) {
+ RobotLog.d("LinearOpMode received an Interrupted Exception; shutting down this linear op mode");
+ } catch (RuntimeException var7) {
+ this.a = var7;
+ } finally {
+ this.b = true;
+ }
+
+ }
+
+ public boolean a() {
+ return this.a != null;
+ }
+
+ public RuntimeException b() {
+ return this.a;
+ }
+
+ public boolean c() {
+ return this.b;
+ }
+ }
+}
diff --git a/FtcRobotController/robotcore/src/main/java/com/qualcomm/robotcore/eventloop/opmode/OpMode.java b/FtcRobotController/robotcore/src/main/java/com/qualcomm/robotcore/eventloop/opmode/OpMode.java
new file mode 100644
index 0000000..21ac0f4
--- /dev/null
+++ b/FtcRobotController/robotcore/src/main/java/com/qualcomm/robotcore/eventloop/opmode/OpMode.java
@@ -0,0 +1,42 @@
+package com.qualcomm.robotcore.eventloop.opmode;
+
+import com.qualcomm.robotcore.hardware.Gamepad;
+import com.qualcomm.robotcore.hardware.HardwareMap;
+import com.qualcomm.robotcore.robocol.Telemetry;
+
+import java.util.concurrent.TimeUnit;
+
+public abstract class OpMode {
+ public Gamepad gamepad1 = new Gamepad();
+ public Gamepad gamepad2 = new Gamepad();
+ public HardwareMap hardwareMap = new HardwareMap();
+ public Telemetry telemetry = new Telemetry();
+ public double time = 0.0D;
+ private long a = 0L;
+
+ public OpMode() {
+ this.a = System.nanoTime();
+ }
+
+ public double getRuntime() {
+ double var1 = (double) TimeUnit.SECONDS.toNanos(1L);
+ return (double) (System.nanoTime() - this.a) / var1;
+ }
+
+ public abstract void init();
+
+ public void init_loop() {
+ }
+
+ public abstract void loop();
+
+ public void resetStartTime() {
+ this.a = System.nanoTime();
+ }
+
+ public void start() {
+ }
+
+ public void stop() {
+ }
+}
diff --git a/FtcRobotController/app/src/main/java/com/qualcomm/robotcore/eventloop/opmode/OpModeManager.java b/FtcRobotController/robotcore/src/main/java/com/qualcomm/robotcore/eventloop/opmode/OpModeManager.java
similarity index 74%
rename from FtcRobotController/app/src/main/java/com/qualcomm/robotcore/eventloop/opmode/OpModeManager.java
rename to FtcRobotController/robotcore/src/main/java/com/qualcomm/robotcore/eventloop/opmode/OpModeManager.java
index ddf30bc..cda1f42 100644
--- a/FtcRobotController/app/src/main/java/com/qualcomm/robotcore/eventloop/opmode/OpModeManager.java
+++ b/FtcRobotController/robotcore/src/main/java/com/qualcomm/robotcore/eventloop/opmode/OpModeManager.java
@@ -1,258 +1,254 @@
-//
-// Source code recreated from a .class file by IntelliJ IDEA
-// (powered by Fernflower decompiler)
-//
-
-package com.qualcomm.robotcore.eventloop.opmode;
-
-import com.qualcomm.robotcore.eventloop.opmode.OpMode;
-import com.qualcomm.robotcore.eventloop.opmode.OpModeRegister;
-import com.qualcomm.robotcore.hardware.DcMotor;
-import com.qualcomm.robotcore.hardware.DcMotorController;
-import com.qualcomm.robotcore.hardware.Gamepad;
-import com.qualcomm.robotcore.hardware.HardwareMap;
-import com.qualcomm.robotcore.hardware.LightSensor;
-import com.qualcomm.robotcore.hardware.ServoController;
-import com.qualcomm.robotcore.hardware.DcMotorController.DeviceMode;
-import com.qualcomm.robotcore.hardware.DcMotorController.RunMode;
-import com.qualcomm.robotcore.util.RobotLog;
-import java.util.Iterator;
-import java.util.LinkedHashMap;
-import java.util.LinkedHashSet;
-import java.util.Map;
-import java.util.Set;
-import java.util.Map.Entry;
-
-public class OpModeManager {
- public static final String DEFAULT_OP_MODE_NAME = "Stop Robot";
- public static final OpMode DEFAULT_OP_MODE = new OpModeManager.a();
- private Map> a = new LinkedHashMap();
- private Map b = new LinkedHashMap();
- private String c = "Stop Robot";
- private OpMode d;
- private String e;
- private HardwareMap f;
- private HardwareMap g;
- private OpModeManager.b h;
- private boolean i;
- private boolean j;
- private boolean k;
-
- public OpModeManager(HardwareMap hardwareMap) {
- this.d = DEFAULT_OP_MODE;
- this.e = "Stop Robot";
- this.f = new HardwareMap();
- this.g = new HardwareMap();
- this.h = OpModeManager.b.a;
- this.i = false;
- this.j = false;
- this.k = false;
- this.f = hardwareMap;
- this.register("Stop Robot", OpModeManager.a.class);
- this.initActiveOpMode("Stop Robot");
- }
-
- public void registerOpModes(OpModeRegister register) {
- register.register(this);
- }
-
- public void setHardwareMap(HardwareMap hardwareMap) {
- this.f = hardwareMap;
- }
-
- public HardwareMap getHardwareMap() {
- return this.f;
- }
-
- public Set getOpModes() {
- LinkedHashSet var1 = new LinkedHashSet();
- var1.addAll(this.a.keySet());
- var1.addAll(this.b.keySet());
- return var1;
- }
-
- public String getActiveOpModeName() {
- return this.c;
- }
-
- public OpMode getActiveOpMode() {
- return this.d;
- }
-
- public void initActiveOpMode(String name) {
- this.e = name;
- this.i = true;
- this.j = true;
- this.h = OpModeManager.b.a;
- }
-
- public void startActiveOpMode() {
- this.h = OpModeManager.b.b;
- this.k = true;
- }
-
- public void stopActiveOpMode() {
- this.d.stop();
- this.initActiveOpMode("Stop Robot");
- }
-
- public void runActiveOpMode(Gamepad[] gamepads) {
- this.d.time = this.d.getRuntime();
- this.d.gamepad1 = gamepads[0];
- this.d.gamepad2 = gamepads[1];
- if(this.i) {
- this.d.stop();
- this.a();
- this.h = OpModeManager.b.a;
- this.j = true;
- }
-
- if(this.h == OpModeManager.b.a) {
- if(this.j) {
- this.d.hardwareMap = this.f;
- this.d.resetStartTime();
- this.d.init();
- this.j = false;
- }
-
- this.d.init_loop();
- } else {
- if(this.k) {
- this.d.start();
- this.k = false;
- }
-
- this.d.loop();
- }
-
- }
-
- public void logOpModes() {
- int var1 = this.a.size() + this.b.size();
- RobotLog.i("There are " + var1 + " Op Modes");
- Iterator var2 = this.a.entrySet().iterator();
-
- Entry var3;
- while(var2.hasNext()) {
- var3 = (Entry)var2.next();
- RobotLog.i(" Op Mode: " + (String)var3.getKey());
- }
-
- var2 = this.b.entrySet().iterator();
-
- while(var2.hasNext()) {
- var3 = (Entry)var2.next();
- RobotLog.i(" Op Mode: " + (String)var3.getKey());
- }
-
- }
-
- public void register(String name, Class opMode) {
- if(this.a(name)) {
- throw new IllegalArgumentException("Cannot register the same op mode name twice");
- } else {
- this.a.put(name, opMode);
- }
- }
-
- public void register(String name, OpMode opMode) {
- if(this.a(name)) {
- throw new IllegalArgumentException("Cannot register the same op mode name twice");
- } else {
- this.b.put(name, opMode);
- }
- }
-
- private void a() {
- RobotLog.i("Attempting to switch to op mode " + this.e);
-
- try {
- if(this.b.containsKey(this.e)) {
- this.d = (OpMode)this.b.get(this.e);
- } else {
- this.d = (OpMode)((Class)this.a.get(this.e)).newInstance();
- }
-
- this.c = this.e;
- } catch (InstantiationException var2) {
- this.a((Exception)var2);
- } catch (IllegalAccessException var3) {
- this.a((Exception)var3);
- }
-
- this.i = false;
- }
-
- private boolean a(String var1) {
- return this.getOpModes().contains(var1);
- }
-
- private void a(Exception var1) {
- RobotLog.e("Unable to start op mode " + this.c);
- RobotLog.logStacktrace(var1);
- this.c = "Stop Robot";
- this.d = DEFAULT_OP_MODE;
- }
-
- private static class a extends OpMode {
- public a() {
- }
-
- public void init() {
- this.a();
- }
-
- public void init_loop() {
- this.a();
- this.telemetry.addData("Status", "Robot is stopped");
- }
-
- public void loop() {
- this.a();
- this.telemetry.addData("Status", "Robot is stopped");
- }
-
- public void stop() {
- }
-
- private void a() {
- Iterator var1 = this.hardwareMap.servoController.iterator();
-
- while(var1.hasNext()) {
- ServoController var2 = (ServoController)var1.next();
- var2.pwmDisable();
- }
-
- var1 = this.hardwareMap.dcMotorController.iterator();
-
- while(var1.hasNext()) {
- DcMotorController var3 = (DcMotorController)var1.next();
- var3.setMotorControllerDeviceMode(DeviceMode.WRITE_ONLY);
- }
-
- var1 = this.hardwareMap.dcMotor.iterator();
-
- while(var1.hasNext()) {
- DcMotor var4 = (DcMotor)var1.next();
- var4.setPower(0.0D);
- var4.setChannelMode(RunMode.RUN_WITHOUT_ENCODERS);
- }
-
- var1 = this.hardwareMap.lightSensor.iterator();
-
- while(var1.hasNext()) {
- LightSensor var5 = (LightSensor)var1.next();
- var5.enableLed(false);
- }
-
- }
- }
-
- private static enum b {
- a,
- b;
-
- private b() {
- }
- }
-}
+//
+// Source code recreated from a .class file by IntelliJ IDEA
+// (powered by Fernflower decompiler)
+//
+
+package com.qualcomm.robotcore.eventloop.opmode;
+
+import com.qualcomm.robotcore.hardware.DcMotor;
+import com.qualcomm.robotcore.hardware.DcMotorController;
+import com.qualcomm.robotcore.hardware.DcMotorController.DeviceMode;
+import com.qualcomm.robotcore.hardware.DcMotorController.RunMode;
+import com.qualcomm.robotcore.hardware.Gamepad;
+import com.qualcomm.robotcore.hardware.HardwareMap;
+import com.qualcomm.robotcore.hardware.LightSensor;
+import com.qualcomm.robotcore.hardware.ServoController;
+import com.qualcomm.robotcore.util.RobotLog;
+
+import java.util.Iterator;
+import java.util.LinkedHashMap;
+import java.util.LinkedHashSet;
+import java.util.Map;
+import java.util.Map.Entry;
+import java.util.Set;
+
+public class OpModeManager {
+ public static final String DEFAULT_OP_MODE_NAME = "Stop Robot";
+ public static final OpMode DEFAULT_OP_MODE = new a();
+ private Map> a = new LinkedHashMap();
+ private Map opModeBasedRegister = new LinkedHashMap();
+ private String c = "Stop Robot";
+ private OpMode d;
+ private String e;
+ private HardwareMap f;
+ private HardwareMap g;
+ private OpModeManager.b h;
+ private boolean i;
+ private boolean j;
+ private boolean k;
+
+ public OpModeManager(HardwareMap hardwareMap) {
+ this.d = DEFAULT_OP_MODE;
+ this.e = "Stop Robot";
+ this.f = new HardwareMap();
+ this.g = new HardwareMap();
+ this.h = OpModeManager.b.a;
+ this.i = false;
+ this.j = false;
+ this.k = false;
+ this.f = hardwareMap;
+ this.register("Stop Robot", OpModeManager.a.class);
+ this.initActiveOpMode("Stop Robot");
+ }
+
+ public void registerOpModes(OpModeRegister register) {
+ register.register(this);
+ }
+
+ public HardwareMap getHardwareMap() {
+ return this.f;
+ }
+
+ public void setHardwareMap(HardwareMap hardwareMap) {
+ this.f = hardwareMap;
+ }
+
+ public Set getOpModes() {
+ LinkedHashSet var1 = new LinkedHashSet();
+ var1.addAll(this.a.keySet());
+ var1.addAll(this.opModeBasedRegister.keySet());
+ return var1;
+ }
+
+ public String getActiveOpModeName() {
+ return this.c;
+ }
+
+ public OpMode getActiveOpMode() {
+ return this.d;
+ }
+
+ public void initActiveOpMode(String name) {
+ this.e = name;
+ this.i = true;
+ this.j = true;
+ this.h = OpModeManager.b.a;
+ }
+
+ public void startActiveOpMode() {
+ this.h = OpModeManager.b.b;
+ this.k = true;
+ }
+
+ public void stopActiveOpMode() {
+ this.d.stop();
+ this.initActiveOpMode("Stop Robot");
+ }
+
+ public void runActiveOpMode(Gamepad[] gamepads) {
+ this.d.time = this.d.getRuntime();
+ this.d.gamepad1 = gamepads[0];
+ this.d.gamepad2 = gamepads[1];
+ if (this.i) {
+ this.d.stop();
+ this.a();
+ this.h = OpModeManager.b.a;
+ this.j = true;
+ }
+
+ if (this.h == OpModeManager.b.a) {
+ if (this.j) {
+ this.d.hardwareMap = this.f;
+ this.d.resetStartTime();
+ this.d.init();
+ this.j = false;
+ }
+
+ this.d.init_loop();
+ } else {
+ if (this.k) {
+ this.d.start();
+ this.k = false;
+ }
+
+ this.d.loop();
+ }
+
+ }
+
+ public void logOpModes() {
+ int var1 = this.a.size() + this.opModeBasedRegister.size();
+ RobotLog.i("There are " + var1 + " Op Modes");
+ Iterator var2 = this.a.entrySet().iterator();
+
+ Entry var3;
+ while (var2.hasNext()) {
+ var3 = (Entry) var2.next();
+ RobotLog.i(" Op Mode: " + var3.getKey());
+ }
+
+ var2 = this.opModeBasedRegister.entrySet().iterator();
+
+ while (var2.hasNext()) {
+ var3 = (Entry) var2.next();
+ RobotLog.i(" Op Mode: " + var3.getKey());
+ }
+
+ }
+
+ public void register(String name, Class opMode) {
+ if (this.a(name)) {
+ throw new IllegalArgumentException("Cannot register the same op mode name twice");
+ } else {
+ this.a.put(name, opMode);
+ }
+ }
+
+ public void register(String name, OpMode opMode) {
+ if (this.a(name)) {
+ throw new IllegalArgumentException("Cannot register the same op mode name twice");
+ } else {
+ this.opModeBasedRegister.put(name, opMode);
+ }
+ }
+
+ private void a() {
+ RobotLog.i("Attempting to switch to op mode " + this.e);
+
+ try {
+ if (this.opModeBasedRegister.containsKey(this.e)) {
+ this.d = this.opModeBasedRegister.get(this.e);
+ } else {
+ this.d = (OpMode) ((Class) this.a.get(this.e)).newInstance();
+ }
+
+ this.c = this.e;
+ } catch (InstantiationException var2) {
+ this.a(var2);
+ } catch (IllegalAccessException var3) {
+ this.a(var3);
+ }
+
+ this.i = false;
+ }
+
+ private boolean a(String var1) {
+ return this.getOpModes().contains(var1);
+ }
+
+ private void a(Exception var1) {
+ RobotLog.e("Unable to start op mode " + this.c);
+ RobotLog.logStacktrace(var1);
+ this.c = "Stop Robot";
+ this.d = DEFAULT_OP_MODE;
+ }
+
+ private enum b {
+ a,
+ b
+ }
+
+ private static class a extends OpMode {
+ public a() {
+ }
+
+ public void init() {
+ this.a();
+ }
+
+ public void init_loop() {
+ this.a();
+ this.telemetry.addData("Status", "Robot is stopped");
+ }
+
+ public void loop() {
+ this.a();
+ this.telemetry.addData("Status", "Robot is stopped");
+ }
+
+ public void stop() {
+ }
+
+ private void a() {
+ Iterator var1 = this.hardwareMap.servoController.iterator();
+
+ while (var1.hasNext()) {
+ ServoController var2 = (ServoController) var1.next();
+ var2.pwmDisable();
+ }
+
+ var1 = this.hardwareMap.dcMotorController.iterator();
+
+ while (var1.hasNext()) {
+ DcMotorController var3 = (DcMotorController) var1.next();
+ var3.setMotorControllerDeviceMode(DeviceMode.WRITE_ONLY);
+ }
+
+ var1 = this.hardwareMap.dcMotor.iterator();
+
+ while (var1.hasNext()) {
+ DcMotor var4 = (DcMotor) var1.next();
+ var4.setPower(0.0D);
+ var4.setChannelMode(RunMode.RUN_WITHOUT_ENCODERS);
+ }
+
+ var1 = this.hardwareMap.lightSensor.iterator();
+
+ while (var1.hasNext()) {
+ LightSensor var5 = (LightSensor) var1.next();
+ var5.enableLed(false);
+ }
+
+ }
+ }
+}
diff --git a/FtcRobotController/robotcore/src/main/java/com/qualcomm/robotcore/eventloop/opmode/OpModeRegister.java b/FtcRobotController/robotcore/src/main/java/com/qualcomm/robotcore/eventloop/opmode/OpModeRegister.java
new file mode 100644
index 0000000..74997e5
--- /dev/null
+++ b/FtcRobotController/robotcore/src/main/java/com/qualcomm/robotcore/eventloop/opmode/OpModeRegister.java
@@ -0,0 +1,5 @@
+package com.qualcomm.robotcore.eventloop.opmode;
+
+public interface OpModeRegister {
+ void register(OpModeManager var1);
+}
diff --git a/FtcRobotController/robotcore/src/main/java/com/qualcomm/robotcore/exception/RobotCoreException.java b/FtcRobotController/robotcore/src/main/java/com/qualcomm/robotcore/exception/RobotCoreException.java
new file mode 100644
index 0000000..eb3d0d9
--- /dev/null
+++ b/FtcRobotController/robotcore/src/main/java/com/qualcomm/robotcore/exception/RobotCoreException.java
@@ -0,0 +1,22 @@
+package com.qualcomm.robotcore.exception;
+
+public class RobotCoreException extends Exception {
+ private Exception a = null;
+
+ public RobotCoreException(String var1) {
+ super(var1);
+ }
+
+ public RobotCoreException(String var1, Exception var2) {
+ super(var1);
+ this.a = var2;
+ }
+
+ public Exception getChainedException() {
+ return this.a;
+ }
+
+ public boolean isChainedException() {
+ return this.a != null;
+ }
+}
diff --git a/FtcRobotController/robotcore/src/main/java/com/qualcomm/robotcore/exception/RobotCoreNonResponsiveException.java b/FtcRobotController/robotcore/src/main/java/com/qualcomm/robotcore/exception/RobotCoreNonResponsiveException.java
new file mode 100644
index 0000000..dc9c6c4
--- /dev/null
+++ b/FtcRobotController/robotcore/src/main/java/com/qualcomm/robotcore/exception/RobotCoreNonResponsiveException.java
@@ -0,0 +1,7 @@
+package com.qualcomm.robotcore.exception;
+
+public class RobotCoreNonResponsiveException extends RobotCoreException {
+ public RobotCoreNonResponsiveException(String var1) {
+ super(var1);
+ }
+}
diff --git a/FtcRobotController/robotcore/src/main/java/com/qualcomm/robotcore/factory/RobotFactory.java b/FtcRobotController/robotcore/src/main/java/com/qualcomm/robotcore/factory/RobotFactory.java
new file mode 100644
index 0000000..e529cc0
--- /dev/null
+++ b/FtcRobotController/robotcore/src/main/java/com/qualcomm/robotcore/factory/RobotFactory.java
@@ -0,0 +1,17 @@
+package com.qualcomm.robotcore.factory;
+
+import com.qualcomm.robotcore.eventloop.EventLoopManager;
+import com.qualcomm.robotcore.exception.RobotCoreException;
+import com.qualcomm.robotcore.robocol.RobocolDatagramSocket;
+import com.qualcomm.robotcore.robot.Robot;
+
+public class RobotFactory {
+ public static Robot createRobot() throws RobotCoreException {
+ RobocolDatagramSocket var0 = new RobocolDatagramSocket();
+ EventLoopManager var1 = new EventLoopManager(var0);
+ Robot var2 = new Robot();
+ var2.eventLoopManager = var1;
+ var2.socket = var0;
+ return var2;
+ }
+}
diff --git a/FtcRobotController/robotcore/src/main/java/com/qualcomm/robotcore/hardware/AccelerationSensor.java b/FtcRobotController/robotcore/src/main/java/com/qualcomm/robotcore/hardware/AccelerationSensor.java
new file mode 100644
index 0000000..bf2fb1e
--- /dev/null
+++ b/FtcRobotController/robotcore/src/main/java/com/qualcomm/robotcore/hardware/AccelerationSensor.java
@@ -0,0 +1,32 @@
+package com.qualcomm.robotcore.hardware;
+
+public abstract class AccelerationSensor implements HardwareDevice {
+ public abstract Acceleration getAcceleration();
+
+ public abstract String status();
+
+ public String toString() {
+ return this.getAcceleration().toString();
+ }
+
+ public static class Acceleration {
+ public double x;
+ public double y;
+ public double z;
+
+ public Acceleration() {
+ this(0.0D, 0.0D, 0.0D);
+ }
+
+ public Acceleration(double var1, double var3, double var5) {
+ this.x = var1;
+ this.y = var3;
+ this.z = var5;
+ }
+
+ public String toString() {
+ Object[] var1 = new Object[]{Double.valueOf(this.x), Double.valueOf(this.y), Double.valueOf(this.z)};
+ return String.format("Acceleration - x: %5.2f, y: %5.2f, z: %5.2f", var1);
+ }
+ }
+}
diff --git a/FtcRobotController/robotcore/src/main/java/com/qualcomm/robotcore/hardware/AnalogInput.java b/FtcRobotController/robotcore/src/main/java/com/qualcomm/robotcore/hardware/AnalogInput.java
new file mode 100644
index 0000000..c9b0c59
--- /dev/null
+++ b/FtcRobotController/robotcore/src/main/java/com/qualcomm/robotcore/hardware/AnalogInput.java
@@ -0,0 +1,30 @@
+package com.qualcomm.robotcore.hardware;
+
+public class AnalogInput implements HardwareDevice {
+ private AnalogInputController a = null;
+ private int b = -1;
+
+ public AnalogInput(AnalogInputController var1, int var2) {
+ this.a = var1;
+ this.b = var2;
+ }
+
+ public void close() {
+ }
+
+ public String getConnectionInfo() {
+ return this.a.getConnectionInfo() + "; analog port " + this.b;
+ }
+
+ public String getDeviceName() {
+ return "Analog Input";
+ }
+
+ public int getValue() {
+ return this.a.getAnalogInputValue(this.b);
+ }
+
+ public int getVersion() {
+ return 1;
+ }
+}
diff --git a/FtcRobotController/app/src/main/java/com/qualcomm/robotcore/hardware/AnalogInputController.java b/FtcRobotController/robotcore/src/main/java/com/qualcomm/robotcore/hardware/AnalogInputController.java
similarity index 53%
rename from FtcRobotController/app/src/main/java/com/qualcomm/robotcore/hardware/AnalogInputController.java
rename to FtcRobotController/robotcore/src/main/java/com/qualcomm/robotcore/hardware/AnalogInputController.java
index 7f2bdbd..82999a4 100644
--- a/FtcRobotController/app/src/main/java/com/qualcomm/robotcore/hardware/AnalogInputController.java
+++ b/FtcRobotController/robotcore/src/main/java/com/qualcomm/robotcore/hardware/AnalogInputController.java
@@ -1,10 +1,9 @@
-package com.qualcomm.robotcore.hardware;
-
-import com.qualcomm.robotcore.hardware.HardwareDevice;
-import com.qualcomm.robotcore.util.SerialNumber;
-
-public interface AnalogInputController extends HardwareDevice {
- int getAnalogInputValue(int var1);
-
- SerialNumber getSerialNumber();
-}
+package com.qualcomm.robotcore.hardware;
+
+import com.qualcomm.robotcore.util.SerialNumber;
+
+public interface AnalogInputController extends HardwareDevice {
+ int getAnalogInputValue(int var1);
+
+ SerialNumber getSerialNumber();
+}
diff --git a/FtcRobotController/robotcore/src/main/java/com/qualcomm/robotcore/hardware/AnalogOutput.java b/FtcRobotController/robotcore/src/main/java/com/qualcomm/robotcore/hardware/AnalogOutput.java
new file mode 100644
index 0000000..fd7412c
--- /dev/null
+++ b/FtcRobotController/robotcore/src/main/java/com/qualcomm/robotcore/hardware/AnalogOutput.java
@@ -0,0 +1,38 @@
+package com.qualcomm.robotcore.hardware;
+
+public class AnalogOutput implements HardwareDevice {
+ private AnalogOutputController a = null;
+ private int b = -1;
+
+ public AnalogOutput(AnalogOutputController var1, int var2) {
+ this.a = var1;
+ this.b = var2;
+ }
+
+ public void close() {
+ }
+
+ public String getConnectionInfo() {
+ return this.a.getConnectionInfo() + "; analog port " + this.b;
+ }
+
+ public String getDeviceName() {
+ return "Analog Output";
+ }
+
+ public int getVersion() {
+ return 1;
+ }
+
+ public void setAnalogOutputFrequency(int var1) {
+ this.a.setAnalogOutputFrequency(this.b, var1);
+ }
+
+ public void setAnalogOutputMode(byte var1) {
+ this.a.setAnalogOutputMode(this.b, var1);
+ }
+
+ public void setAnalogOutputVoltage(int var1) {
+ this.a.setAnalogOutputVoltage(this.b, var1);
+ }
+}
diff --git a/FtcRobotController/robotcore/src/main/java/com/qualcomm/robotcore/hardware/AnalogOutputController.java b/FtcRobotController/robotcore/src/main/java/com/qualcomm/robotcore/hardware/AnalogOutputController.java
new file mode 100644
index 0000000..858dba6
--- /dev/null
+++ b/FtcRobotController/robotcore/src/main/java/com/qualcomm/robotcore/hardware/AnalogOutputController.java
@@ -0,0 +1,13 @@
+package com.qualcomm.robotcore.hardware;
+
+import com.qualcomm.robotcore.util.SerialNumber;
+
+public interface AnalogOutputController extends HardwareDevice {
+ SerialNumber getSerialNumber();
+
+ void setAnalogOutputFrequency(int var1, int var2);
+
+ void setAnalogOutputMode(int var1, byte var2);
+
+ void setAnalogOutputVoltage(int var1, int var2);
+}
diff --git a/FtcRobotController/robotcore/src/main/java/com/qualcomm/robotcore/hardware/ColorSensor.java b/FtcRobotController/robotcore/src/main/java/com/qualcomm/robotcore/hardware/ColorSensor.java
new file mode 100644
index 0000000..b48f49e
--- /dev/null
+++ b/FtcRobotController/robotcore/src/main/java/com/qualcomm/robotcore/hardware/ColorSensor.java
@@ -0,0 +1,20 @@
+package com.qualcomm.robotcore.hardware;
+
+public abstract class ColorSensor implements HardwareDevice {
+ public abstract int alpha();
+
+ public abstract int argb();
+
+ public abstract int blue();
+
+ public abstract void enableLed(boolean var1);
+
+ public abstract int green();
+
+ public abstract int red();
+
+ public String toString() {
+ Object[] var1 = new Object[]{Integer.valueOf(this.argb())};
+ return String.format("argb: %d", var1);
+ }
+}
diff --git a/FtcRobotController/robotcore/src/main/java/com/qualcomm/robotcore/hardware/CompassSensor.java b/FtcRobotController/robotcore/src/main/java/com/qualcomm/robotcore/hardware/CompassSensor.java
new file mode 100644
index 0000000..411f223
--- /dev/null
+++ b/FtcRobotController/robotcore/src/main/java/com/qualcomm/robotcore/hardware/CompassSensor.java
@@ -0,0 +1,25 @@
+package com.qualcomm.robotcore.hardware;
+
+public abstract class CompassSensor implements HardwareDevice {
+ public abstract boolean calibrationFailed();
+
+ public abstract double getDirection();
+
+ public abstract void setMode(CompassMode var1);
+
+ public abstract String status();
+
+ public String toString() {
+ Object[] var1 = new Object[]{Double.valueOf(this.getDirection())};
+ return String.format("Compass: %3.1f", var1);
+ }
+
+ public enum CompassMode {
+ CALIBRATION_MODE,
+ MEASUREMENT_MODE;
+
+ static {
+ CompassMode[] var0 = new CompassMode[]{MEASUREMENT_MODE, CALIBRATION_MODE};
+ }
+ }
+}
diff --git a/FtcRobotController/robotcore/src/main/java/com/qualcomm/robotcore/hardware/DcMotor.java b/FtcRobotController/robotcore/src/main/java/com/qualcomm/robotcore/hardware/DcMotor.java
new file mode 100644
index 0000000..9324dc1
--- /dev/null
+++ b/FtcRobotController/robotcore/src/main/java/com/qualcomm/robotcore/hardware/DcMotor.java
@@ -0,0 +1,133 @@
+package com.qualcomm.robotcore.hardware;
+
+public class DcMotor implements HardwareDevice {
+ protected DcMotorController controller;
+ protected DcMotorController.DeviceMode devMode;
+ protected Direction direction;
+ protected DcMotorController.RunMode mode;
+ protected int portNumber;
+
+ public DcMotor(DcMotorController var1, int var2) {
+ this(var1, var2, Direction.FORWARD);
+ }
+
+ public DcMotor(DcMotorController var1, int var2, Direction var3) {
+ this.direction = Direction.FORWARD;
+ this.controller = null;
+ this.portNumber = -1;
+ this.mode = DcMotorController.RunMode.RUN_WITHOUT_ENCODERS;
+ this.devMode = DcMotorController.DeviceMode.WRITE_ONLY;
+ this.controller = var1;
+ this.portNumber = var2;
+ this.direction = var3;
+ }
+
+ public void close() {
+ this.setPowerFloat();
+ }
+
+ public DcMotorController.RunMode getChannelMode() {
+ return this.controller.getMotorChannelMode(this.portNumber);
+ }
+
+ public void setChannelMode(DcMotorController.RunMode var1) {
+ this.mode = var1;
+ this.controller.setMotorChannelMode(this.portNumber, var1);
+ }
+
+ public String getConnectionInfo() {
+ return this.controller.getConnectionInfo() + "; port " + this.portNumber;
+ }
+
+ public DcMotorController getController() {
+ return this.controller;
+ }
+
+ public int getCurrentPosition() {
+ int var1 = this.controller.getMotorCurrentPosition(this.portNumber);
+ if (this.direction == Direction.REVERSE) {
+ var1 *= -1;
+ }
+
+ return var1;
+ }
+
+ public String getDeviceName() {
+ return "DC Motor";
+ }
+
+ public Direction getDirection() {
+ return this.direction;
+ }
+
+ public void setDirection(Direction var1) {
+ this.direction = var1;
+ }
+
+ public int getPortNumber() {
+ return this.portNumber;
+ }
+
+ public double getPower() {
+ double var1 = this.controller.getMotorPower(this.portNumber);
+ if (this.direction == Direction.REVERSE && var1 != 0.0D) {
+ var1 *= -1.0D;
+ }
+
+ return var1;
+ }
+
+ public void setPower(double var1) {
+ if (this.direction == Direction.REVERSE) {
+ var1 *= -1.0D;
+ }
+
+ if (this.mode == DcMotorController.RunMode.RUN_TO_POSITION) {
+ var1 = Math.abs(var1);
+ }
+
+ this.controller.setMotorPower(this.portNumber, var1);
+ }
+
+ public boolean getPowerFloat() {
+ return this.controller.getMotorPowerFloat(this.portNumber);
+ }
+
+ public int getTargetPosition() {
+ int var1 = this.controller.getMotorTargetPosition(this.portNumber);
+ if (this.direction == Direction.REVERSE) {
+ var1 *= -1;
+ }
+
+ return var1;
+ }
+
+ public void setTargetPosition(int var1) {
+ if (this.direction == Direction.REVERSE) {
+ var1 *= -1;
+ }
+
+ this.controller.setMotorTargetPosition(this.portNumber, var1);
+ }
+
+ public int getVersion() {
+ return 1;
+ }
+
+ public boolean isBusy() {
+ return this.controller.isBusy(this.portNumber);
+ }
+
+ public void setPowerFloat() {
+ this.controller.setMotorPowerFloat(this.portNumber);
+ }
+
+ public enum Direction {
+ FORWARD,
+ REVERSE;
+
+ static {
+ Direction[] var0 = new Direction[]{FORWARD, REVERSE};
+ }
+ }
+}
diff --git a/FtcRobotController/robotcore/src/main/java/com/qualcomm/robotcore/hardware/DcMotorController.java b/FtcRobotController/robotcore/src/main/java/com/qualcomm/robotcore/hardware/DcMotorController.java
new file mode 100644
index 0000000..cdb070f
--- /dev/null
+++ b/FtcRobotController/robotcore/src/main/java/com/qualcomm/robotcore/hardware/DcMotorController.java
@@ -0,0 +1,50 @@
+package com.qualcomm.robotcore.hardware;
+
+public interface DcMotorController extends HardwareDevice {
+ RunMode getMotorChannelMode(int var1);
+
+ DeviceMode getMotorControllerDeviceMode();
+
+ void setMotorControllerDeviceMode(DeviceMode var1);
+
+ int getMotorCurrentPosition(int var1);
+
+ double getMotorPower(int var1);
+
+ boolean getMotorPowerFloat(int var1);
+
+ int getMotorTargetPosition(int var1);
+
+ boolean isBusy(int var1);
+
+ void setMotorChannelMode(int var1, RunMode var2);
+
+ void setMotorPower(int var1, double var2);
+
+ void setMotorPowerFloat(int var1);
+
+ void setMotorTargetPosition(int var1, int var2);
+
+ enum DeviceMode {
+ READ_ONLY,
+ READ_WRITE,
+ SWITCHING_TO_READ_MODE,
+ SWITCHING_TO_WRITE_MODE,
+ WRITE_ONLY;
+
+ static {
+ DeviceMode[] var0 = new DeviceMode[]{SWITCHING_TO_READ_MODE, SWITCHING_TO_WRITE_MODE, READ_ONLY, WRITE_ONLY, READ_WRITE};
+ }
+ }
+
+ enum RunMode {
+ RESET_ENCODERS,
+ RUN_TO_POSITION,
+ RUN_USING_ENCODERS,
+ RUN_WITHOUT_ENCODERS;
+
+ static {
+ RunMode[] var0 = new RunMode[]{RUN_USING_ENCODERS, RUN_WITHOUT_ENCODERS, RUN_TO_POSITION, RESET_ENCODERS};
+ }
+ }
+}
diff --git a/FtcRobotController/robotcore/src/main/java/com/qualcomm/robotcore/hardware/DeviceInterfaceModule.java b/FtcRobotController/robotcore/src/main/java/com/qualcomm/robotcore/hardware/DeviceInterfaceModule.java
new file mode 100644
index 0000000..7bbb23a
--- /dev/null
+++ b/FtcRobotController/robotcore/src/main/java/com/qualcomm/robotcore/hardware/DeviceInterfaceModule.java
@@ -0,0 +1,17 @@
+package com.qualcomm.robotcore.hardware;
+
+public interface DeviceInterfaceModule extends AnalogInputController, AnalogOutputController, DigitalChannelController, I2cController, PWMOutputController {
+ byte getDigitalIOControlByte();
+
+ void setDigitalIOControlByte(byte var1);
+
+ int getDigitalInputStateByte();
+
+ byte getDigitalOutputStateByte();
+
+ boolean getLEDState(int var1);
+
+ void setDigitalOutputByte(byte var1);
+
+ void setLED(int var1, boolean var2);
+}
diff --git a/FtcRobotController/robotcore/src/main/java/com/qualcomm/robotcore/hardware/DeviceManager.java b/FtcRobotController/robotcore/src/main/java/com/qualcomm/robotcore/hardware/DeviceManager.java
new file mode 100644
index 0000000..5dadffc
--- /dev/null
+++ b/FtcRobotController/robotcore/src/main/java/com/qualcomm/robotcore/hardware/DeviceManager.java
@@ -0,0 +1,84 @@
+package com.qualcomm.robotcore.hardware;
+
+import com.qualcomm.robotcore.exception.RobotCoreException;
+import com.qualcomm.robotcore.util.SerialNumber;
+
+import java.util.Map;
+
+public abstract class DeviceManager {
+ public abstract ColorSensor createAdafruitI2cColorSensor(DeviceInterfaceModule var1, int var2);
+
+ public abstract AnalogInput createAnalogInputDevice(AnalogInputController var1, int var2);
+
+ public abstract OpticalDistanceSensor createAnalogOpticalDistanceSensor(DeviceInterfaceModule var1, int var2);
+
+ public abstract AnalogOutput createAnalogOutputDevice(AnalogOutputController var1, int var2);
+
+ public DcMotor createDcMotor(DcMotorController var1, int var2) {
+ return new DcMotor(var1, var2, DcMotor.Direction.FORWARD);
+ }
+
+ public abstract DeviceInterfaceModule createDeviceInterfaceModule(SerialNumber var1) throws RobotCoreException, InterruptedException;
+
+ public abstract DigitalChannel createDigitalChannelDevice(DigitalChannelController var1, int var2);
+
+ public abstract TouchSensor createDigitalTouchSensor(DeviceInterfaceModule var1, int var2);
+
+ public abstract I2cDevice createI2cDevice(I2cController var1, int var2);
+
+ public abstract IrSeekerSensor createI2cIrSeekerSensorV3(DeviceInterfaceModule var1, int var2);
+
+ public abstract LED createLED(DigitalChannelController var1, int var2);
+
+ public abstract ColorSensor createModernRoboticsI2cColorSensor(DeviceInterfaceModule var1, int var2);
+
+ public abstract AccelerationSensor createNxtAccelerationSensor(LegacyModule var1, int var2);
+
+ public abstract ColorSensor createNxtColorSensor(LegacyModule var1, int var2);
+
+ public abstract CompassSensor createNxtCompassSensor(LegacyModule var1, int var2);
+
+ public abstract DcMotorController createNxtDcMotorController(LegacyModule var1, int var2);
+
+ public abstract GyroSensor createNxtGyroSensor(LegacyModule var1, int var2);
+
+ public abstract IrSeekerSensor createNxtIrSeekerSensor(LegacyModule var1, int var2);
+
+ public abstract LightSensor createNxtLightSensor(LegacyModule var1, int var2);
+
+ public abstract ServoController createNxtServoController(LegacyModule var1, int var2);
+
+ public abstract TouchSensor createNxtTouchSensor(LegacyModule var1, int var2);
+
+ public abstract TouchSensorMultiplexer createNxtTouchSensorMultiplexer(LegacyModule var1, int var2);
+
+ public abstract UltrasonicSensor createNxtUltrasonicSensor(LegacyModule var1, int var2);
+
+ public abstract PWMOutput createPwmOutputDevice(DeviceInterfaceModule var1, int var2);
+
+ public Servo createServo(ServoController var1, int var2) {
+ return new Servo(var1, var2, Servo.Direction.FORWARD);
+ }
+
+ public abstract DcMotorController createUsbDcMotorController(SerialNumber var1) throws RobotCoreException, InterruptedException;
+
+ public abstract LegacyModule createUsbLegacyModule(SerialNumber var1) throws RobotCoreException, InterruptedException;
+
+ public abstract ServoController createUsbServoController(SerialNumber var1) throws RobotCoreException, InterruptedException;
+
+ public abstract Map scanForUsbDevices() throws RobotCoreException;
+
+ public enum DeviceType {
+ FTDI_USB_UNKNOWN_DEVICE,
+ MODERN_ROBOTICS_USB_DC_MOTOR_CONTROLLER,
+ MODERN_ROBOTICS_USB_DEVICE_INTERFACE_MODULE,
+ MODERN_ROBOTICS_USB_LEGACY_MODULE,
+ MODERN_ROBOTICS_USB_SENSOR_MUX,
+ MODERN_ROBOTICS_USB_SERVO_CONTROLLER,
+ MODERN_ROBOTICS_USB_UNKNOWN_DEVICE;
+
+ static {
+ DeviceType[] var0 = new DeviceType[]{FTDI_USB_UNKNOWN_DEVICE, MODERN_ROBOTICS_USB_UNKNOWN_DEVICE, MODERN_ROBOTICS_USB_DC_MOTOR_CONTROLLER, MODERN_ROBOTICS_USB_SERVO_CONTROLLER, MODERN_ROBOTICS_USB_LEGACY_MODULE, MODERN_ROBOTICS_USB_DEVICE_INTERFACE_MODULE, MODERN_ROBOTICS_USB_SENSOR_MUX};
+ }
+ }
+}
diff --git a/FtcRobotController/robotcore/src/main/java/com/qualcomm/robotcore/hardware/DigitalChannel.java b/FtcRobotController/robotcore/src/main/java/com/qualcomm/robotcore/hardware/DigitalChannel.java
new file mode 100644
index 0000000..ef5e538
--- /dev/null
+++ b/FtcRobotController/robotcore/src/main/java/com/qualcomm/robotcore/hardware/DigitalChannel.java
@@ -0,0 +1,42 @@
+package com.qualcomm.robotcore.hardware;
+
+public class DigitalChannel implements HardwareDevice {
+ private DigitalChannelController a = null;
+ private int b = -1;
+
+ public DigitalChannel(DigitalChannelController var1, int var2) {
+ this.a = var1;
+ this.b = var2;
+ }
+
+ public void close() {
+ }
+
+ public String getConnectionInfo() {
+ return this.a.getConnectionInfo() + "; digital port " + this.b;
+ }
+
+ public String getDeviceName() {
+ return "Digital Channel";
+ }
+
+ public DigitalChannelController.Mode getMode() {
+ return this.a.getDigitalChannelMode(this.b);
+ }
+
+ public void setMode(DigitalChannelController.Mode var1) {
+ this.a.setDigitalChannelMode(this.b, var1);
+ }
+
+ public boolean getState() {
+ return this.a.getDigitalChannelState(this.b);
+ }
+
+ public void setState(boolean var1) {
+ this.a.setDigitalChannelState(this.b, var1);
+ }
+
+ public int getVersion() {
+ return 1;
+ }
+}
diff --git a/FtcRobotController/robotcore/src/main/java/com/qualcomm/robotcore/hardware/DigitalChannelController.java b/FtcRobotController/robotcore/src/main/java/com/qualcomm/robotcore/hardware/DigitalChannelController.java
new file mode 100644
index 0000000..75b528a
--- /dev/null
+++ b/FtcRobotController/robotcore/src/main/java/com/qualcomm/robotcore/hardware/DigitalChannelController.java
@@ -0,0 +1,24 @@
+package com.qualcomm.robotcore.hardware;
+
+import com.qualcomm.robotcore.util.SerialNumber;
+
+public interface DigitalChannelController extends HardwareDevice {
+ Mode getDigitalChannelMode(int var1);
+
+ boolean getDigitalChannelState(int var1);
+
+ SerialNumber getSerialNumber();
+
+ void setDigitalChannelMode(int var1, Mode var2);
+
+ void setDigitalChannelState(int var1, boolean var2);
+
+ enum Mode {
+ INPUT,
+ OUTPUT;
+
+ static {
+ Mode[] var0 = new Mode[]{INPUT, OUTPUT};
+ }
+ }
+}
diff --git a/FtcRobotController/app/src/main/java/com/qualcomm/robotcore/hardware/Gamepad.java b/FtcRobotController/robotcore/src/main/java/com/qualcomm/robotcore/hardware/Gamepad.java
similarity index 71%
rename from FtcRobotController/app/src/main/java/com/qualcomm/robotcore/hardware/Gamepad.java
rename to FtcRobotController/robotcore/src/main/java/com/qualcomm/robotcore/hardware/Gamepad.java
index 11f7378..106b6cb 100644
--- a/FtcRobotController/app/src/main/java/com/qualcomm/robotcore/hardware/Gamepad.java
+++ b/FtcRobotController/robotcore/src/main/java/com/qualcomm/robotcore/hardware/Gamepad.java
@@ -1,397 +1,394 @@
-//
-// Source code recreated from a .class file by IntelliJ IDEA
-// (powered by Fernflower decompiler)
-//
-
-package com.qualcomm.robotcore.hardware;
-
-import android.annotation.TargetApi;
-import android.os.Build.VERSION;
-import android.view.InputDevice;
-import android.view.KeyEvent;
-import android.view.MotionEvent;
-import com.qualcomm.robotcore.exception.RobotCoreException;
-import com.qualcomm.robotcore.robocol.RobocolParsable;
-import com.qualcomm.robotcore.robocol.RobocolParsable.MsgType;
-import com.qualcomm.robotcore.util.Range;
-import com.qualcomm.robotcore.util.RobotLog;
-import java.nio.BufferOverflowException;
-import java.nio.ByteBuffer;
-import java.util.HashSet;
-import java.util.Set;
-import java.util.AbstractMap.SimpleEntry;
-
-public class Gamepad implements RobocolParsable {
- public static final int ID_UNASSOCIATED = -1;
- public float left_stick_x;
- public float left_stick_y;
- public float right_stick_x;
- public float right_stick_y;
- public boolean dpad_up;
- public boolean dpad_down;
- public boolean dpad_left;
- public boolean dpad_right;
- public boolean a;
- public boolean b;
- public boolean x;
- public boolean y;
- public boolean guide;
- public boolean start;
- public boolean back;
- public boolean left_bumper;
- public boolean right_bumper;
- public boolean left_stick_button;
- public boolean right_stick_button;
- public float left_trigger;
- public float right_trigger;
- public byte user;
- public int id;
- public long timestamp;
- protected float dpadThreshold;
- protected float joystickDeadzone;
- private final Gamepad.GamepadCallback c;
- private static Set d = new HashSet();
- private static Set e = null;
-
- public Gamepad() {
- this((Gamepad.GamepadCallback)null);
- }
-
- public Gamepad(Gamepad.GamepadCallback callback) {
- this.left_stick_x = 0.0F;
- this.left_stick_y = 0.0F;
- this.right_stick_x = 0.0F;
- this.right_stick_y = 0.0F;
- this.dpad_up = false;
- this.dpad_down = false;
- this.dpad_left = false;
- this.dpad_right = false;
- this.a = false;
- this.b = false;
- this.x = false;
- this.y = false;
- this.guide = false;
- this.start = false;
- this.back = false;
- this.left_bumper = false;
- this.right_bumper = false;
- this.left_stick_button = false;
- this.right_stick_button = false;
- this.left_trigger = 0.0F;
- this.right_trigger = 0.0F;
- this.user = -1;
- this.id = -1;
- this.timestamp = 0L;
- this.dpadThreshold = 0.2F;
- this.joystickDeadzone = 0.2F;
- this.c = callback;
- }
-
- public void setJoystickDeadzone(float deadzone) {
- if(deadzone >= 0.0F && deadzone <= 1.0F) {
- this.joystickDeadzone = deadzone;
- } else {
- throw new IllegalArgumentException("deadzone cannot be greater than max joystick value");
- }
- }
-
- public void update(MotionEvent event) {
- this.id = event.getDeviceId();
- this.timestamp = event.getEventTime();
- this.left_stick_x = this.cleanMotionValues(event.getAxisValue(0));
- this.left_stick_y = this.cleanMotionValues(event.getAxisValue(1));
- this.right_stick_x = this.cleanMotionValues(event.getAxisValue(11));
- this.right_stick_y = this.cleanMotionValues(event.getAxisValue(14));
- this.left_trigger = event.getAxisValue(17);
- this.right_trigger = event.getAxisValue(18);
- this.dpad_down = event.getAxisValue(16) > this.dpadThreshold;
- this.dpad_up = event.getAxisValue(16) < -this.dpadThreshold;
- this.dpad_right = event.getAxisValue(15) > this.dpadThreshold;
- this.dpad_left = event.getAxisValue(15) < -this.dpadThreshold;
- this.callCallback();
- }
-
- public void update(KeyEvent event) {
- this.id = event.getDeviceId();
- this.timestamp = event.getEventTime();
- int var2 = event.getKeyCode();
- if(var2 == 19) {
- this.dpad_up = this.pressed(event);
- } else if(var2 == 20) {
- this.dpad_down = this.pressed(event);
- } else if(var2 == 22) {
- this.dpad_right = this.pressed(event);
- } else if(var2 == 21) {
- this.dpad_left = this.pressed(event);
- } else if(var2 == 96) {
- this.a = this.pressed(event);
- } else if(var2 == 97) {
- this.b = this.pressed(event);
- } else if(var2 == 99) {
- this.x = this.pressed(event);
- } else if(var2 == 100) {
- this.y = this.pressed(event);
- } else if(var2 == 110) {
- this.guide = this.pressed(event);
- } else if(var2 == 108) {
- this.start = this.pressed(event);
- } else if(var2 == 4) {
- this.back = this.pressed(event);
- } else if(var2 == 103) {
- this.right_bumper = this.pressed(event);
- } else if(var2 == 102) {
- this.left_bumper = this.pressed(event);
- } else if(var2 == 106) {
- this.left_stick_button = this.pressed(event);
- } else if(var2 == 107) {
- this.right_stick_button = this.pressed(event);
- }
-
- this.callCallback();
- }
-
- public MsgType getRobocolMsgType() {
- return MsgType.GAMEPAD;
- }
-
- public byte[] toByteArray() throws RobotCoreException {
- ByteBuffer var1 = ByteBuffer.allocate(45);
-
- try {
- byte var2 = 0;
- var1.put(this.getRobocolMsgType().asByte());
- var1.putShort((short)42);
- var1.put((byte)2);
- var1.putInt(this.id);
- var1.putLong(this.timestamp).array();
- var1.putFloat(this.left_stick_x).array();
- var1.putFloat(this.left_stick_y).array();
- var1.putFloat(this.right_stick_x).array();
- var1.putFloat(this.right_stick_y).array();
- var1.putFloat(this.left_trigger).array();
- var1.putFloat(this.right_trigger).array();
- int var4 = (var2 << 1) + (this.left_stick_button?1:0);
- var4 = (var4 << 1) + (this.right_stick_button?1:0);
- var4 = (var4 << 1) + (this.dpad_up?1:0);
- var4 = (var4 << 1) + (this.dpad_down?1:0);
- var4 = (var4 << 1) + (this.dpad_left?1:0);
- var4 = (var4 << 1) + (this.dpad_right?1:0);
- var4 = (var4 << 1) + (this.a?1:0);
- var4 = (var4 << 1) + (this.b?1:0);
- var4 = (var4 << 1) + (this.x?1:0);
- var4 = (var4 << 1) + (this.y?1:0);
- var4 = (var4 << 1) + (this.guide?1:0);
- var4 = (var4 << 1) + (this.start?1:0);
- var4 = (var4 << 1) + (this.back?1:0);
- var4 = (var4 << 1) + (this.left_bumper?1:0);
- var4 = (var4 << 1) + (this.right_bumper?1:0);
- var1.putInt(var4);
- var1.put(this.user);
- } catch (BufferOverflowException var3) {
- RobotLog.logStacktrace(var3);
- }
-
- return var1.array();
- }
-
- public void fromByteArray(byte[] byteArray) throws RobotCoreException {
- if(byteArray.length < 45) {
- throw new RobotCoreException("Expected buffer of at least 45 bytes, received " + byteArray.length);
- } else {
- ByteBuffer var2 = ByteBuffer.wrap(byteArray, 3, 42);
- boolean var3 = false;
- byte var4 = var2.get();
- if(var4 >= 1) {
- this.id = var2.getInt();
- this.timestamp = var2.getLong();
- this.left_stick_x = var2.getFloat();
- this.left_stick_y = var2.getFloat();
- this.right_stick_x = var2.getFloat();
- this.right_stick_y = var2.getFloat();
- this.left_trigger = var2.getFloat();
- this.right_trigger = var2.getFloat();
- int var5 = var2.getInt();
- this.left_stick_button = (var5 & 16384) != 0;
- this.right_stick_button = (var5 & 8192) != 0;
- this.dpad_up = (var5 & 4096) != 0;
- this.dpad_down = (var5 & 2048) != 0;
- this.dpad_left = (var5 & 1024) != 0;
- this.dpad_right = (var5 & 512) != 0;
- this.a = (var5 & 256) != 0;
- this.b = (var5 & 128) != 0;
- this.x = (var5 & 64) != 0;
- this.y = (var5 & 32) != 0;
- this.guide = (var5 & 16) != 0;
- this.start = (var5 & 8) != 0;
- this.back = (var5 & 4) != 0;
- this.left_bumper = (var5 & 2) != 0;
- this.right_bumper = (var5 & 1) != 0;
- }
-
- if(var4 >= 2) {
- this.user = var2.get();
- }
-
- this.callCallback();
- }
- }
-
- public boolean atRest() {
- return this.left_stick_x == 0.0F && this.left_stick_y == 0.0F && this.right_stick_x == 0.0F && this.right_stick_y == 0.0F && this.left_trigger == 0.0F && this.right_trigger == 0.0F;
- }
-
- public String type() {
- return "Standard";
- }
-
- public String toString() {
- String var1 = new String();
- if(this.dpad_up) {
- var1 = var1 + "dpad_up ";
- }
-
- if(this.dpad_down) {
- var1 = var1 + "dpad_down ";
- }
-
- if(this.dpad_left) {
- var1 = var1 + "dpad_left ";
- }
-
- if(this.dpad_right) {
- var1 = var1 + "dpad_right ";
- }
-
- if(this.a) {
- var1 = var1 + "a ";
- }
-
- if(this.b) {
- var1 = var1 + "b ";
- }
-
- if(this.x) {
- var1 = var1 + "x ";
- }
-
- if(this.y) {
- var1 = var1 + "y ";
- }
-
- if(this.guide) {
- var1 = var1 + "guide ";
- }
-
- if(this.start) {
- var1 = var1 + "start ";
- }
-
- if(this.back) {
- var1 = var1 + "back ";
- }
-
- if(this.left_bumper) {
- var1 = var1 + "left_bumper ";
- }
-
- if(this.right_bumper) {
- var1 = var1 + "right_bumper ";
- }
-
- if(this.left_stick_button) {
- var1 = var1 + "left stick button ";
- }
-
- if(this.right_stick_button) {
- var1 = var1 + "right stick button ";
- }
-
- return String.format("ID: %2d user: %2d lx: % 1.2f ly: % 1.2f rx: % 1.2f ry: % 1.2f lt: %1.2f rt: %1.2f %s", new Object[]{Integer.valueOf(this.id), Byte.valueOf(this.user), Float.valueOf(this.left_stick_x), Float.valueOf(this.left_stick_y), Float.valueOf(this.right_stick_x), Float.valueOf(this.right_stick_y), Float.valueOf(this.left_trigger), Float.valueOf(this.right_trigger), var1});
- }
-
- protected float cleanMotionValues(float number) {
- if(number < this.joystickDeadzone && number > -this.joystickDeadzone) {
- return 0.0F;
- } else if(number > 1.0F) {
- return 1.0F;
- } else if(number < -1.0F) {
- return -1.0F;
- } else {
- if(number < 0.0F) {
- Range.scale((double)number, (double)this.joystickDeadzone, 1.0D, 0.0D, 1.0D);
- }
-
- if(number > 0.0F) {
- Range.scale((double)number, (double)(-this.joystickDeadzone), -1.0D, 0.0D, -1.0D);
- }
-
- return number;
- }
- }
-
- protected boolean pressed(KeyEvent event) {
- return event.getAction() == 0;
- }
-
- protected void callCallback() {
- if(this.c != null) {
- this.c.gamepadChanged(this);
- }
-
- }
-
- public static void enableWhitelistFilter(int vendorId, int productId) {
- if(e == null) {
- e = new HashSet();
- }
-
- e.add(new Gamepad.a(vendorId, productId));
- }
-
- public static void clearWhitelistFilter() {
- e = null;
- }
-
- @TargetApi(19)
- public static synchronized boolean isGamepadDevice(int deviceId) {
- if(d.contains(Integer.valueOf(deviceId))) {
- return true;
- } else {
- d = new HashSet();
- int[] var1 = InputDevice.getDeviceIds();
- int[] var2 = var1;
- int var3 = var1.length;
-
- for(int var4 = 0; var4 < var3; ++var4) {
- int var5 = var2[var4];
- InputDevice var6 = InputDevice.getDevice(var5);
- int var7 = var6.getSources();
- if((var7 & 1025) == 1025 || (var7 & 16777232) == 16777232) {
- if(VERSION.SDK_INT >= 19) {
- if(e == null || e.contains(new Gamepad.a(var6.getVendorId(), var6.getProductId()))) {
- d.add(Integer.valueOf(var5));
- }
- } else {
- d.add(Integer.valueOf(var5));
- }
- }
- }
-
- if(d.contains(Integer.valueOf(deviceId))) {
- return true;
- } else {
- return false;
- }
- }
- }
-
- private static class a extends SimpleEntry {
- public a(int var1, int var2) {
- super(Integer.valueOf(var1), Integer.valueOf(var2));
- }
- }
-
- public interface GamepadCallback {
- void gamepadChanged(Gamepad var1);
- }
-}
+//
+// Source code recreated from a .class file by IntelliJ IDEA
+// (powered by Fernflower decompiler)
+//
+
+package com.qualcomm.robotcore.hardware;
+
+import android.annotation.TargetApi;
+import android.os.Build.VERSION;
+import android.view.InputDevice;
+import android.view.KeyEvent;
+import android.view.MotionEvent;
+
+import com.qualcomm.robotcore.exception.RobotCoreException;
+import com.qualcomm.robotcore.robocol.RobocolParsable;
+import com.qualcomm.robotcore.util.Range;
+import com.qualcomm.robotcore.util.RobotLog;
+
+import java.nio.BufferOverflowException;
+import java.nio.ByteBuffer;
+import java.util.AbstractMap.SimpleEntry;
+import java.util.HashSet;
+import java.util.Set;
+
+public class Gamepad implements RobocolParsable {
+ public static final int ID_UNASSOCIATED = -1;
+ private static Set d = new HashSet();
+ private static Set e = null;
+ private final GamepadCallback c;
+ public float left_stick_x;
+ public float left_stick_y;
+ public float right_stick_x;
+ public float right_stick_y;
+ public boolean dpad_up;
+ public boolean dpad_down;
+ public boolean dpad_left;
+ public boolean dpad_right;
+ public boolean a;
+ public boolean b;
+ public boolean x;
+ public boolean y;
+ public boolean guide;
+ public boolean start;
+ public boolean back;
+ public boolean left_bumper;
+ public boolean right_bumper;
+ public boolean left_stick_button;
+ public boolean right_stick_button;
+ public float left_trigger;
+ public float right_trigger;
+ public byte user;
+ public int id;
+ public long timestamp;
+ protected float dpadThreshold;
+ protected float joystickDeadzone;
+
+ public Gamepad() {
+ this(null);
+ }
+
+ public Gamepad(GamepadCallback callback) {
+ this.left_stick_x = 0.0F;
+ this.left_stick_y = 0.0F;
+ this.right_stick_x = 0.0F;
+ this.right_stick_y = 0.0F;
+ this.dpad_up = false;
+ this.dpad_down = false;
+ this.dpad_left = false;
+ this.dpad_right = false;
+ this.a = false;
+ this.b = false;
+ this.x = false;
+ this.y = false;
+ this.guide = false;
+ this.start = false;
+ this.back = false;
+ this.left_bumper = false;
+ this.right_bumper = false;
+ this.left_stick_button = false;
+ this.right_stick_button = false;
+ this.left_trigger = 0.0F;
+ this.right_trigger = 0.0F;
+ this.user = -1;
+ this.id = -1;
+ this.timestamp = 0L;
+ this.dpadThreshold = 0.2F;
+ this.joystickDeadzone = 0.2F;
+ this.c = callback;
+ }
+
+ public static void enableWhitelistFilter(int vendorId, int productId) {
+ if (e == null) {
+ e = new HashSet();
+ }
+
+ e.add(new a(vendorId, productId));
+ }
+
+ public static void clearWhitelistFilter() {
+ e = null;
+ }
+
+ @TargetApi(19)
+ public static synchronized boolean isGamepadDevice(int deviceId) {
+ if (d.contains(Integer.valueOf(deviceId))) {
+ return true;
+ } else {
+ d = new HashSet();
+ int[] var1 = InputDevice.getDeviceIds();
+ int[] var2 = var1;
+ int var3 = var1.length;
+
+ for (int var4 = 0; var4 < var3; ++var4) {
+ int var5 = var2[var4];
+ InputDevice var6 = InputDevice.getDevice(var5);
+ int var7 = var6.getSources();
+ if ((var7 & 1025) == 1025 || (var7 & 16777232) == 16777232) {
+ if (VERSION.SDK_INT >= 19) {
+ if (e == null || e.contains(new a(var6.getVendorId(), var6.getProductId()))) {
+ d.add(Integer.valueOf(var5));
+ }
+ } else {
+ d.add(Integer.valueOf(var5));
+ }
+ }
+ }
+
+ return d.contains(Integer.valueOf(deviceId));
+ }
+ }
+
+ public void setJoystickDeadzone(float deadzone) {
+ if (deadzone >= 0.0F && deadzone <= 1.0F) {
+ this.joystickDeadzone = deadzone;
+ } else {
+ throw new IllegalArgumentException("deadzone cannot be greater than max joystick value");
+ }
+ }
+
+ public void update(MotionEvent event) {
+ this.id = event.getDeviceId();
+ this.timestamp = event.getEventTime();
+ this.left_stick_x = this.cleanMotionValues(event.getAxisValue(0));
+ this.left_stick_y = this.cleanMotionValues(event.getAxisValue(1));
+ this.right_stick_x = this.cleanMotionValues(event.getAxisValue(11));
+ this.right_stick_y = this.cleanMotionValues(event.getAxisValue(14));
+ this.left_trigger = event.getAxisValue(17);
+ this.right_trigger = event.getAxisValue(18);
+ this.dpad_down = event.getAxisValue(16) > this.dpadThreshold;
+ this.dpad_up = event.getAxisValue(16) < -this.dpadThreshold;
+ this.dpad_right = event.getAxisValue(15) > this.dpadThreshold;
+ this.dpad_left = event.getAxisValue(15) < -this.dpadThreshold;
+ this.callCallback();
+ }
+
+ public void update(KeyEvent event) {
+ this.id = event.getDeviceId();
+ this.timestamp = event.getEventTime();
+ int var2 = event.getKeyCode();
+ if (var2 == 19) {
+ this.dpad_up = this.pressed(event);
+ } else if (var2 == 20) {
+ this.dpad_down = this.pressed(event);
+ } else if (var2 == 22) {
+ this.dpad_right = this.pressed(event);
+ } else if (var2 == 21) {
+ this.dpad_left = this.pressed(event);
+ } else if (var2 == 96) {
+ this.a = this.pressed(event);
+ } else if (var2 == 97) {
+ this.b = this.pressed(event);
+ } else if (var2 == 99) {
+ this.x = this.pressed(event);
+ } else if (var2 == 100) {
+ this.y = this.pressed(event);
+ } else if (var2 == 110) {
+ this.guide = this.pressed(event);
+ } else if (var2 == 108) {
+ this.start = this.pressed(event);
+ } else if (var2 == 4) {
+ this.back = this.pressed(event);
+ } else if (var2 == 103) {
+ this.right_bumper = this.pressed(event);
+ } else if (var2 == 102) {
+ this.left_bumper = this.pressed(event);
+ } else if (var2 == 106) {
+ this.left_stick_button = this.pressed(event);
+ } else if (var2 == 107) {
+ this.right_stick_button = this.pressed(event);
+ }
+
+ this.callCallback();
+ }
+
+ public MsgType getRobocolMsgType() {
+ return MsgType.GAMEPAD;
+ }
+
+ public byte[] toByteArray() throws RobotCoreException {
+ ByteBuffer var1 = ByteBuffer.allocate(45);
+
+ try {
+ byte var2 = 0;
+ var1.put(this.getRobocolMsgType().asByte());
+ var1.putShort((short) 42);
+ var1.put((byte) 2);
+ var1.putInt(this.id);
+ var1.putLong(this.timestamp).array();
+ var1.putFloat(this.left_stick_x).array();
+ var1.putFloat(this.left_stick_y).array();
+ var1.putFloat(this.right_stick_x).array();
+ var1.putFloat(this.right_stick_y).array();
+ var1.putFloat(this.left_trigger).array();
+ var1.putFloat(this.right_trigger).array();
+ int var4 = (var2 << 1) + (this.left_stick_button ? 1 : 0);
+ var4 = (var4 << 1) + (this.right_stick_button ? 1 : 0);
+ var4 = (var4 << 1) + (this.dpad_up ? 1 : 0);
+ var4 = (var4 << 1) + (this.dpad_down ? 1 : 0);
+ var4 = (var4 << 1) + (this.dpad_left ? 1 : 0);
+ var4 = (var4 << 1) + (this.dpad_right ? 1 : 0);
+ var4 = (var4 << 1) + (this.a ? 1 : 0);
+ var4 = (var4 << 1) + (this.b ? 1 : 0);
+ var4 = (var4 << 1) + (this.x ? 1 : 0);
+ var4 = (var4 << 1) + (this.y ? 1 : 0);
+ var4 = (var4 << 1) + (this.guide ? 1 : 0);
+ var4 = (var4 << 1) + (this.start ? 1 : 0);
+ var4 = (var4 << 1) + (this.back ? 1 : 0);
+ var4 = (var4 << 1) + (this.left_bumper ? 1 : 0);
+ var4 = (var4 << 1) + (this.right_bumper ? 1 : 0);
+ var1.putInt(var4);
+ var1.put(this.user);
+ } catch (BufferOverflowException var3) {
+ RobotLog.logStacktrace(var3);
+ }
+
+ return var1.array();
+ }
+
+ public void fromByteArray(byte[] byteArray) throws RobotCoreException {
+ if (byteArray.length < 45) {
+ throw new RobotCoreException("Expected buffer of at least 45 bytes, received " + byteArray.length);
+ } else {
+ ByteBuffer var2 = ByteBuffer.wrap(byteArray, 3, 42);
+ boolean var3 = false;
+ byte var4 = var2.get();
+ if (var4 >= 1) {
+ this.id = var2.getInt();
+ this.timestamp = var2.getLong();
+ this.left_stick_x = var2.getFloat();
+ this.left_stick_y = var2.getFloat();
+ this.right_stick_x = var2.getFloat();
+ this.right_stick_y = var2.getFloat();
+ this.left_trigger = var2.getFloat();
+ this.right_trigger = var2.getFloat();
+ int var5 = var2.getInt();
+ this.left_stick_button = (var5 & 16384) != 0;
+ this.right_stick_button = (var5 & 8192) != 0;
+ this.dpad_up = (var5 & 4096) != 0;
+ this.dpad_down = (var5 & 2048) != 0;
+ this.dpad_left = (var5 & 1024) != 0;
+ this.dpad_right = (var5 & 512) != 0;
+ this.a = (var5 & 256) != 0;
+ this.b = (var5 & 128) != 0;
+ this.x = (var5 & 64) != 0;
+ this.y = (var5 & 32) != 0;
+ this.guide = (var5 & 16) != 0;
+ this.start = (var5 & 8) != 0;
+ this.back = (var5 & 4) != 0;
+ this.left_bumper = (var5 & 2) != 0;
+ this.right_bumper = (var5 & 1) != 0;
+ }
+
+ if (var4 >= 2) {
+ this.user = var2.get();
+ }
+
+ this.callCallback();
+ }
+ }
+
+ public boolean atRest() {
+ return this.left_stick_x == 0.0F && this.left_stick_y == 0.0F && this.right_stick_x == 0.0F && this.right_stick_y == 0.0F && this.left_trigger == 0.0F && this.right_trigger == 0.0F;
+ }
+
+ public String type() {
+ return "Standard";
+ }
+
+ public String toString() {
+ String var1 = new String();
+ if (this.dpad_up) {
+ var1 = var1 + "dpad_up ";
+ }
+
+ if (this.dpad_down) {
+ var1 = var1 + "dpad_down ";
+ }
+
+ if (this.dpad_left) {
+ var1 = var1 + "dpad_left ";
+ }
+
+ if (this.dpad_right) {
+ var1 = var1 + "dpad_right ";
+ }
+
+ if (this.a) {
+ var1 = var1 + "a ";
+ }
+
+ if (this.b) {
+ var1 = var1 + "b ";
+ }
+
+ if (this.x) {
+ var1 = var1 + "x ";
+ }
+
+ if (this.y) {
+ var1 = var1 + "y ";
+ }
+
+ if (this.guide) {
+ var1 = var1 + "guide ";
+ }
+
+ if (this.start) {
+ var1 = var1 + "start ";
+ }
+
+ if (this.back) {
+ var1 = var1 + "back ";
+ }
+
+ if (this.left_bumper) {
+ var1 = var1 + "left_bumper ";
+ }
+
+ if (this.right_bumper) {
+ var1 = var1 + "right_bumper ";
+ }
+
+ if (this.left_stick_button) {
+ var1 = var1 + "left stick button ";
+ }
+
+ if (this.right_stick_button) {
+ var1 = var1 + "right stick button ";
+ }
+
+ return String.format("ID: %2d user: %2d lx: % 1.2f ly: % 1.2f rx: % 1.2f ry: % 1.2f lt: %1.2f rt: %1.2f %s", Integer.valueOf(this.id), Byte.valueOf(this.user), Float.valueOf(this.left_stick_x), Float.valueOf(this.left_stick_y), Float.valueOf(this.right_stick_x), Float.valueOf(this.right_stick_y), Float.valueOf(this.left_trigger), Float.valueOf(this.right_trigger), var1);
+ }
+
+ protected float cleanMotionValues(float number) {
+ if (number < this.joystickDeadzone && number > -this.joystickDeadzone) {
+ return 0.0F;
+ } else if (number > 1.0F) {
+ return 1.0F;
+ } else if (number < -1.0F) {
+ return -1.0F;
+ } else {
+ if (number < 0.0F) {
+ Range.scale((double) number, (double) this.joystickDeadzone, 1.0D, 0.0D, 1.0D);
+ }
+
+ if (number > 0.0F) {
+ Range.scale((double) number, (double) (-this.joystickDeadzone), -1.0D, 0.0D, -1.0D);
+ }
+
+ return number;
+ }
+ }
+
+ protected boolean pressed(KeyEvent event) {
+ return event.getAction() == 0;
+ }
+
+ protected void callCallback() {
+ if (this.c != null) {
+ this.c.gamepadChanged(this);
+ }
+
+ }
+
+ public interface GamepadCallback {
+ void gamepadChanged(Gamepad var1);
+ }
+
+ private static class a extends SimpleEntry {
+ public a(int var1, int var2) {
+ super(Integer.valueOf(var1), Integer.valueOf(var2));
+ }
+ }
+}
diff --git a/FtcRobotController/robotcore/src/main/java/com/qualcomm/robotcore/hardware/GyroSensor.java b/FtcRobotController/robotcore/src/main/java/com/qualcomm/robotcore/hardware/GyroSensor.java
new file mode 100644
index 0000000..63cd14d
--- /dev/null
+++ b/FtcRobotController/robotcore/src/main/java/com/qualcomm/robotcore/hardware/GyroSensor.java
@@ -0,0 +1,12 @@
+package com.qualcomm.robotcore.hardware;
+
+public abstract class GyroSensor implements HardwareDevice {
+ public abstract double getRotation();
+
+ public abstract String status();
+
+ public String toString() {
+ Object[] var1 = new Object[]{Double.valueOf(this.getRotation())};
+ return String.format("Gyro: %3.1f", var1);
+ }
+}
diff --git a/FtcRobotController/robotcore/src/main/java/com/qualcomm/robotcore/hardware/HardwareDevice.java b/FtcRobotController/robotcore/src/main/java/com/qualcomm/robotcore/hardware/HardwareDevice.java
new file mode 100644
index 0000000..c523baa
--- /dev/null
+++ b/FtcRobotController/robotcore/src/main/java/com/qualcomm/robotcore/hardware/HardwareDevice.java
@@ -0,0 +1,11 @@
+package com.qualcomm.robotcore.hardware;
+
+public interface HardwareDevice {
+ void close();
+
+ String getConnectionInfo();
+
+ String getDeviceName();
+
+ int getVersion();
+}
diff --git a/FtcRobotController/app/src/main/java/com/qualcomm/robotcore/hardware/HardwareFactory.java b/FtcRobotController/robotcore/src/main/java/com/qualcomm/robotcore/hardware/HardwareFactory.java
similarity index 54%
rename from FtcRobotController/app/src/main/java/com/qualcomm/robotcore/hardware/HardwareFactory.java
rename to FtcRobotController/robotcore/src/main/java/com/qualcomm/robotcore/hardware/HardwareFactory.java
index ec79107..fc43f17 100644
--- a/FtcRobotController/app/src/main/java/com/qualcomm/robotcore/hardware/HardwareFactory.java
+++ b/FtcRobotController/robotcore/src/main/java/com/qualcomm/robotcore/hardware/HardwareFactory.java
@@ -1,9 +1,8 @@
-package com.qualcomm.robotcore.hardware;
-
-import com.qualcomm.robotcore.eventloop.EventLoopManager;
-import com.qualcomm.robotcore.exception.RobotCoreException;
-import com.qualcomm.robotcore.hardware.HardwareMap;
-
-public interface HardwareFactory {
- HardwareMap createHardwareMap(EventLoopManager var1) throws RobotCoreException, InterruptedException;
-}
+package com.qualcomm.robotcore.hardware;
+
+import com.qualcomm.robotcore.eventloop.EventLoopManager;
+import com.qualcomm.robotcore.exception.RobotCoreException;
+
+public interface HardwareFactory {
+ HardwareMap createHardwareMap(EventLoopManager var1) throws RobotCoreException, InterruptedException;
+}
diff --git a/FtcRobotController/robotcore/src/main/java/com/qualcomm/robotcore/hardware/HardwareMap.java b/FtcRobotController/robotcore/src/main/java/com/qualcomm/robotcore/hardware/HardwareMap.java
new file mode 100644
index 0000000..68e561a
--- /dev/null
+++ b/FtcRobotController/robotcore/src/main/java/com/qualcomm/robotcore/hardware/HardwareMap.java
@@ -0,0 +1,112 @@
+package com.qualcomm.robotcore.hardware;
+
+import android.content.Context;
+
+import com.qualcomm.robotcore.util.RobotLog;
+
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.Map;
+import java.util.Map.Entry;
+import java.util.Set;
+
+public class HardwareMap {
+ public DeviceMapping accelerationSensor = new DeviceMapping();
+ public DeviceMapping analogInput = new DeviceMapping();
+ public DeviceMapping analogOutput = new DeviceMapping();
+ public Context appContext = null;
+ public DeviceMapping colorSensor = new DeviceMapping();
+ public DeviceMapping compassSensor = new DeviceMapping();
+ public DeviceMapping dcMotor = new DeviceMapping();
+ public DeviceMapping dcMotorController = new DeviceMapping();
+ public DeviceMapping deviceInterfaceModule = new DeviceMapping();
+ public DeviceMapping digitalChannel = new DeviceMapping();
+ public DeviceMapping gyroSensor = new DeviceMapping();
+ public DeviceMapping i2cDevice = new DeviceMapping();
+ public DeviceMapping irSeekerSensor = new DeviceMapping();
+ public DeviceMapping led = new DeviceMapping();
+ public DeviceMapping