mirror of
https://github.com/PhotonVision/photonvision
synced 2026-06-20 00:51:41 +00:00
added init general settings function
This commit is contained in:
@@ -1,8 +1,12 @@
|
||||
package Classes;
|
||||
import Objects.*;
|
||||
import org.json.JSONObject;
|
||||
|
||||
import java.io.*;
|
||||
import java.nio.file.*;
|
||||
import com.google.gson.Gson;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
||||
import edu.wpi.cscore.*;
|
||||
|
||||
public class SettingsManager {
|
||||
private static SettingsManager instance;
|
||||
@@ -28,12 +32,30 @@ public class SettingsManager {
|
||||
public static DefaultGeneralSettings GeneralSettings;
|
||||
public static HashMap CameraPort = new HashMap();
|
||||
public static HashMap CamerasCurrentPipeline = new HashMap();
|
||||
private Path SettingsPath = Paths.get(System.getProperty("user.dir"),"Settings");
|
||||
private Path CamsPath = Paths.get(SettingsPath.toString(),"Cams");
|
||||
|
||||
|
||||
private void InitiateGeneralSettings(){
|
||||
System.out.println("run");
|
||||
if (!Files.exists(SettingsPath)){
|
||||
try {
|
||||
Files.createDirectories(SettingsPath);
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
try {
|
||||
GeneralSettings = new Gson().fromJson(new FileReader(Paths.get(SettingsPath.toString(),"Settings.json").toString()),DefaultGeneralSettings.class);
|
||||
} catch (FileNotFoundException e) {
|
||||
GeneralSettings = new DefaultGeneralSettings();
|
||||
}
|
||||
}
|
||||
|
||||
private void InitiateCamerasInfo(){
|
||||
UsbCameraInfo[] TrueCameras = new UsbCameraInfo[];
|
||||
UsbCameraInfo[] UsbDevices = UsbCamera.enumerateUsbCameras();
|
||||
|
||||
System.out.println("");
|
||||
|
||||
}
|
||||
private void InitiateUsbCameras(){
|
||||
|
||||
Reference in New Issue
Block a user