mirror of
https://github.com/Team4388/RidgeScout.git
synced 2026-06-09 08:38:03 -06:00
Use android log. Fixes #5
This commit is contained in:
@@ -1,5 +1,7 @@
|
||||
package com.ridgebotics.ridgescout.scoutingData;
|
||||
|
||||
import android.util.Log;
|
||||
|
||||
import com.ridgebotics.ridgescout.scoutingData.transfer.TransferType;
|
||||
import com.ridgebotics.ridgescout.types.ScoutingArray;
|
||||
import com.ridgebotics.ridgescout.types.data.RawDataType;
|
||||
@@ -31,15 +33,15 @@ public class ScoutingDataWriter {
|
||||
switch (data[i].getValueType()){
|
||||
case NUM:
|
||||
bb.addInt((int) data[i].forceGetValue());
|
||||
System.out.println("Saved INT: " + data[i].getUUID() + ", ("+ data[i].get() +")");
|
||||
Log.i(ScoutingDataWriter.class.toString(),"Saved INT: " + data[i].getUUID() + ", ("+ data[i].get() +")");
|
||||
break;
|
||||
case STRING:
|
||||
bb.addString((String) data[i].forceGetValue());
|
||||
System.out.println("Saved STR: " + data[i].getUUID() + ", ("+ data[i].get() +")");
|
||||
Log.i(ScoutingDataWriter.class.toString(), "Saved STR: " + data[i].getUUID() + ", ("+ data[i].get() +")");
|
||||
break;
|
||||
case NUMARR:
|
||||
bb.addIntArray((int[]) data[i].forceGetValue());
|
||||
System.out.println("Saved INT Array: " + data[i].getUUID() + ", ("+ Arrays.toString((int[]) data[i].get()) +")");
|
||||
Log.i(ScoutingDataWriter.class.toString(), "Saved INT Array: " + data[i].getUUID() + ", ("+ Arrays.toString((int[]) data[i].get()) +")");
|
||||
}
|
||||
}
|
||||
byte[] bytes = bb.build();
|
||||
@@ -82,17 +84,17 @@ public class ScoutingDataWriter {
|
||||
case 1: // Int
|
||||
rawDataTypes[i] = IntType.newNull(values[version][i].UUID);
|
||||
rawDataTypes[i].forceSetValue(objects.get(i+2).get());
|
||||
System.out.println("Loaded INT: " + values[version][i].name + " (" + values[version][i].UUID + ") " + ", ("+ rawDataTypes[i].get() +")");
|
||||
Log.i(ParsedScoutingDataResult.class.toString(),"Loaded INT: " + values[version][i].name + " (" + values[version][i].UUID + ") " + ", ("+ rawDataTypes[i].get() +")");
|
||||
break;
|
||||
case 2: // String
|
||||
rawDataTypes[i] = StringType.newNull(values[version][i].UUID);
|
||||
rawDataTypes[i].forceSetValue(objects.get(i+2).get());
|
||||
System.out.println("Loaded STR: " + values[version][i].name + " (" + values[version][i].UUID + ") " + ", ("+ rawDataTypes[i].get() +")");
|
||||
Log.i(ParsedScoutingDataResult.class.toString(),"Loaded STR: " + values[version][i].name + " (" + values[version][i].UUID + ") " + ", ("+ rawDataTypes[i].get() +")");
|
||||
break;
|
||||
case 3: // Int array
|
||||
rawDataTypes[i] = IntArrType.newNull(values[version][i].UUID);
|
||||
rawDataTypes[i].forceSetValue(objects.get(i+2).get());
|
||||
System.out.println("Loaded intARR: " + values[version][i].name + " (" + values[version][i].UUID + ") " + ", ("+ Arrays.toString((int[]) rawDataTypes[i].get()) +")");
|
||||
Log.i(ParsedScoutingDataResult.class.toString(),"Loaded intARR: " + values[version][i].name + " (" + values[version][i].UUID + ") " + ", ("+ Arrays.toString((int[]) rawDataTypes[i].get()) +")");
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
package com.ridgebotics.ridgescout.types;
|
||||
|
||||
import android.util.Log;
|
||||
|
||||
import com.ridgebotics.ridgescout.scoutingData.transfer.CreateTransferType;
|
||||
import com.ridgebotics.ridgescout.scoutingData.transfer.DirectTransferType;
|
||||
import com.ridgebotics.ridgescout.scoutingData.transfer.TransferType;
|
||||
@@ -44,7 +46,7 @@ public class ScoutingArray {
|
||||
}
|
||||
this.array = new_values;
|
||||
version++;
|
||||
System.out.println("Updated to " + version);
|
||||
Log.i(getClass().toString(),"Updated to " + version);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -10,6 +10,7 @@ import static com.ridgebotics.ridgescout.utility.DataManager.rescout_list;
|
||||
|
||||
import android.app.ProgressDialog;
|
||||
import android.os.Bundle;
|
||||
import android.util.Log;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
@@ -63,7 +64,7 @@ public class FieldDataFragment extends Fragment {
|
||||
|
||||
for (int i = 0; i < filenames.size(); i++) {
|
||||
try {
|
||||
System.out.println("Loading: " + filenames.get(i));
|
||||
Log.i(getClass().toString(), "Loading: " + filenames.get(i));
|
||||
ScoutingDataWriter.ParsedScoutingDataResult psda = ScoutingDataWriter.load(filenames.get(i), match_values, match_transferValues);
|
||||
if (psda.data.array[fieldIndex] != null && psda.data.array[fieldIndex].get() != null && !psda.data.array[fieldIndex].isNull())
|
||||
teamData.add(psda.data.array[fieldIndex]);
|
||||
@@ -75,7 +76,7 @@ public class FieldDataFragment extends Fragment {
|
||||
data.put(teamNum, teamData);
|
||||
}
|
||||
|
||||
System.out.println("Finished!");
|
||||
Log.i(getClass().toString(), "Finished!");
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -8,6 +8,7 @@ import static com.ridgebotics.ridgescout.utility.DataManager.event;
|
||||
import android.app.AlertDialog;
|
||||
import android.os.Bundle;
|
||||
import android.text.InputType;
|
||||
import android.util.Log;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
@@ -276,7 +277,7 @@ public class EventFragment extends Fragment {
|
||||
builder.setPositiveButton("OK", (dialogInterface, i) -> {
|
||||
|
||||
int index = dropdown.getIndex();
|
||||
System.out.println(index);
|
||||
Log.i(getClass().toString(), String.valueOf(index));
|
||||
if(!(index >= 0 && index < teamNums.size())) return;
|
||||
|
||||
event.teams.remove(index);
|
||||
|
||||
@@ -9,6 +9,7 @@ import static com.ridgebotics.ridgescout.utility.DataManager.event;
|
||||
|
||||
import android.annotation.SuppressLint;
|
||||
import android.os.Bundle;
|
||||
import android.util.Log;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
@@ -150,7 +151,7 @@ public class MatchScoutingFragment extends Fragment {
|
||||
|
||||
|
||||
public void save(){
|
||||
System.out.println("Saved!");
|
||||
Log.i(this.getClass().toString(), "Saved!");
|
||||
edited = false;
|
||||
enableRescoutButton();
|
||||
AlertManager.toast("Saved " + filename);
|
||||
@@ -377,9 +378,9 @@ public class MatchScoutingFragment extends Fragment {
|
||||
}
|
||||
|
||||
if(ScoutingDataWriter.save(DataManager.match_values.length-1, ScoutingDataWriter.checkAddName(fileUsernames, username), filename, types))
|
||||
System.out.println("Saved!");
|
||||
Log.i(getClass().toString(), "Saved!");
|
||||
else
|
||||
System.out.println("Error saving");
|
||||
Log.i(getClass().toString(), "Error saving");
|
||||
}
|
||||
|
||||
private void enableRescoutButton(){
|
||||
|
||||
@@ -10,6 +10,7 @@ import static com.ridgebotics.ridgescout.utility.DataManager.pit_transferValues;
|
||||
import static com.ridgebotics.ridgescout.utility.DataManager.pit_values;
|
||||
|
||||
import android.os.Bundle;
|
||||
import android.util.Log;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
@@ -91,10 +92,10 @@ public class PitScoutingFragment extends Fragment {
|
||||
}
|
||||
|
||||
if(ScoutingDataWriter.save(pit_values.length-1, ScoutingDataWriter.checkAddName(fileUsernames, username), filename, types)) {
|
||||
System.out.println("Saved!");
|
||||
AlertManager.toast("Saved " + filename);
|
||||
Log.i(getClass().toString(), "Saved!");
|
||||
Log.i(getClass().toString(), "Saved " + filename);
|
||||
}else
|
||||
System.out.println("Error saving");
|
||||
Log.i(getClass().toString(), "Error saving");
|
||||
}
|
||||
|
||||
public void set_indicator_color(int color){
|
||||
|
||||
@@ -7,6 +7,7 @@ import android.annotation.SuppressLint;
|
||||
import android.app.Activity;
|
||||
import android.app.AlertDialog;
|
||||
import android.os.Bundle;
|
||||
import android.util.Log;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
@@ -270,7 +271,7 @@ public class FieldsFragment extends Fragment {
|
||||
|
||||
System.arraycopy(currentValues, 0, newValues, 0, currentValues.length);
|
||||
|
||||
System.out.println("Length: " + values.size());
|
||||
Log.i(getClass().toString(), "Length: " + values.size());
|
||||
|
||||
newValues[currentValues.length] = new FieldType[values.size()];
|
||||
for(int i = 0; i < values.size(); i++) {
|
||||
|
||||
@@ -3,6 +3,8 @@ package com.ridgebotics.ridgescout.ui.transfer;
|
||||
import static com.ridgebotics.ridgescout.utility.DataManager.evcode;
|
||||
import static com.ridgebotics.ridgescout.utility.FileEditor.baseDir;
|
||||
|
||||
import android.util.Log;
|
||||
|
||||
import com.ridgebotics.ridgescout.utility.AlertManager;
|
||||
import com.ridgebotics.ridgescout.utility.BuiltByteParser;
|
||||
import com.ridgebotics.ridgescout.utility.ByteBuilder;
|
||||
@@ -157,13 +159,13 @@ public class FTPSync extends Thread {
|
||||
|
||||
if (remoteTimestamp == null || after(localTimeStamp, remoteTimestamp)) {
|
||||
uploadFile(localFile);
|
||||
System.out.println("Uploaded" + localFile.getName());
|
||||
Log.i(getClass().toString(), "Uploaded" + localFile.getName());
|
||||
|
||||
setLocalFileTimestamp(localFile, curSyncTime);
|
||||
remoteTimestamps.put(localFile.getName(), curSyncTime);
|
||||
upCount++;
|
||||
}else{
|
||||
System.out.println("Did not upload");
|
||||
Log.i(getClass().toString(), "Did not upload");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -192,17 +194,17 @@ public class FTPSync extends Thread {
|
||||
if (!localFile.exists() || (after(remoteTimestamp, localTimeStamp) && !localTimeStamp.equals(remoteTimestamp))) {
|
||||
downloadFile(remoteFile, localFile);
|
||||
|
||||
System.out.println("Downloaded " + localFile.getName());
|
||||
Log.i(getClass().toString(), "Downloaded " + localFile.getName());
|
||||
|
||||
if(!localFile.exists()) System.out.println("Not exist");
|
||||
else if(after(remoteTimestamp, localTimeStamp)) System.out.println("Before: " + (localTimeStamp.getTime()-remoteTimestamp.getTime()));
|
||||
if(!localFile.exists()) Log.i(getClass().toString(), "Not exist");
|
||||
else if(after(remoteTimestamp, localTimeStamp)) Log.i(getClass().toString(), "Before: " + (localTimeStamp.getTime()-remoteTimestamp.getTime()));
|
||||
|
||||
// Date d = getUtcTimestamp(remoteFile);
|
||||
setLocalFileTimestamp(localFile, remoteTimestamps.get(localFile.getName()));
|
||||
// remoteTimestamps.put(remoteFile, curSyncTime);
|
||||
downCount++;
|
||||
}else{
|
||||
System.out.println("Did not download");
|
||||
Log.i(getClass().toString(), "Did not download");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -2,6 +2,8 @@ package com.ridgebotics.ridgescout.ui.transfer;
|
||||
|
||||
import static com.ridgebotics.ridgescout.utility.FileEditor.baseDir;
|
||||
|
||||
import android.util.Log;
|
||||
|
||||
import com.ridgebotics.ridgescout.utility.AlertManager;
|
||||
import com.ridgebotics.ridgescout.utility.BuiltByteParser;
|
||||
import com.ridgebotics.ridgescout.utility.ByteBuilder;
|
||||
@@ -126,7 +128,6 @@ public class HttpSync extends Thread {
|
||||
for(int i = 0; i < localFiles.size(); i++){
|
||||
TransferFile localFile = localFiles.get(i);
|
||||
|
||||
System.out.print("LocalFile: " + localFile.filename + ", " + localFile.checksum + ", " + localFile.updated + ": ");
|
||||
TransferFile remoteFile = findInFileArray(remoteFiles, localFile.filename);
|
||||
|
||||
|
||||
@@ -146,10 +147,10 @@ public class HttpSync extends Thread {
|
||||
)) {
|
||||
uploadFile(localFile, serverIP, serverKey);
|
||||
// await();
|
||||
System.out.println("Uploaded");
|
||||
Log.d(getClass().toString(), "LocalFile: " + localFile.filename + ", " + localFile.checksum + ", " + localFile.updated + ": Uploaded");
|
||||
upCount++;
|
||||
}else {
|
||||
System.out.println("Did not upload");
|
||||
Log.d(getClass().toString(), "LocalFile: " + localFile.filename + ", " + localFile.checksum + ", " + localFile.updated + ": Not uploaded");
|
||||
}
|
||||
|
||||
setUpdateIndicator("Uploading " + (Math.floor((double) (i * 1000) / localFiles.size()) / 10) + "%");
|
||||
@@ -160,7 +161,6 @@ public class HttpSync extends Thread {
|
||||
for(int i = 0; i < remoteFiles.size(); i++){
|
||||
TransferFile remoteFile = remoteFiles.get(i);
|
||||
|
||||
System.out.print("RemoteFile: " + remoteFile.filename + ", " + remoteFile.checksum + ", " + remoteFile.updated + ": ");
|
||||
TransferFile localFile = findInFileArray(localFiles, remoteFile.filename);
|
||||
|
||||
if(localFile == null ||
|
||||
@@ -172,10 +172,10 @@ public class HttpSync extends Thread {
|
||||
) {
|
||||
downloadFile(remoteFile, serverIP);
|
||||
// await();
|
||||
System.out.println("Downloaded");
|
||||
Log.d(getClass().toString(), "RemoteFile: " + remoteFile.filename + ", " + remoteFile.checksum + ", " + remoteFile.updated + ": Downloaded");
|
||||
downCount++;
|
||||
} else {
|
||||
System.out.println("Did not download");
|
||||
Log.d(getClass().toString(), "RemoteFile: " + remoteFile.filename + ", " + remoteFile.checksum + ", " + remoteFile.updated + ": Not downloaded");
|
||||
}
|
||||
|
||||
|
||||
|
||||
+2
-1
@@ -8,6 +8,7 @@ import android.bluetooth.BluetoothSocket;
|
||||
import android.content.Context;
|
||||
import android.content.pm.PackageManager;
|
||||
import android.os.Build;
|
||||
import android.util.Log;
|
||||
|
||||
import androidx.core.app.ActivityCompat;
|
||||
import androidx.core.content.ContextCompat;
|
||||
@@ -139,7 +140,7 @@ public class BluetoothReceiver {
|
||||
} catch (IOException e) {
|
||||
if (e.getMessage() != null && e.getMessage().contains("bt socket closed, read return: -1")) {
|
||||
receiveddata.onConnectionStop();
|
||||
System.out.println("Bluetooth socket closed, treating as end of stream");
|
||||
Log.i(getClass().toString(), "Bluetooth socket closed, treating as end of stream");
|
||||
} else {
|
||||
throw e;
|
||||
}
|
||||
|
||||
+3
-2
@@ -1,6 +1,7 @@
|
||||
package com.ridgebotics.ridgescout.ui.transfer.bluetooth;
|
||||
|
||||
import android.os.Bundle;
|
||||
import android.util.Log;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
@@ -117,7 +118,7 @@ public class BluetoothReceiverFragment extends Fragment {
|
||||
|
||||
private void receiveData(byte[] data, int bytes) {
|
||||
byte[] newBytes = FileEditor.getByteBlock(data, 0, bytes);
|
||||
System.out.println("Recieved " + bytes + " Bytes over bluetooth!");
|
||||
Log.i(getClass().toString(), "Recieved " + bytes + " Bytes over bluetooth!");
|
||||
recievedBytes.add(newBytes);
|
||||
}
|
||||
|
||||
@@ -138,7 +139,7 @@ public class BluetoothReceiverFragment extends Fragment {
|
||||
ScoutingFile f = ScoutingFile.decode((byte[]) result.get(i).get());
|
||||
|
||||
if (f != null) {
|
||||
System.out.println(f.filename);
|
||||
Log.i(getClass().toString(), f.filename);
|
||||
if (f.write())
|
||||
result_filenames += f.filename + "\n";
|
||||
}
|
||||
|
||||
@@ -7,6 +7,7 @@ import android.graphics.Canvas;
|
||||
import android.graphics.Paint;
|
||||
import android.graphics.RectF;
|
||||
import android.util.AttributeSet;
|
||||
import android.util.Log;
|
||||
import android.view.View;
|
||||
|
||||
import com.ridgebotics.ridgescout.types.data.RawDataType;
|
||||
@@ -208,7 +209,7 @@ public class CandlestickView extends View {
|
||||
upperQuartile = DataProcessing.calculatePercentile(teamDataArray, 75);
|
||||
}
|
||||
|
||||
System.out.println(locmin + ", " + lowerQuartile + ", " + avg + ", " + upperQuartile + ", " + locmax);
|
||||
Log.i(getClass().toString(), locmin + ", " + lowerQuartile + ", " + avg + ", " + upperQuartile + ", " + locmax);
|
||||
setData(locmin, lowerQuartile, avg, upperQuartile, locmax, absmin, absmax);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user