Protofile

This commit is contained in:
assada 2023-08-15 15:37:59 +03:00
parent cc470fdaff
commit 35f77b10f0
Signed by: assada
GPG Key ID: 8905E8CE5CC3000D
2 changed files with 21 additions and 2 deletions

View File

@ -0,0 +1,17 @@
package guru.dead.icf320;
public enum ICF320Proto {
READ("FEFEFEFEFEFEFEFEFEFEFEFEFEFEFEFEFEFEFEFEFEFEFEFEFEFEFEFEFEFEFEFEEEEFE020550000FDFEFEEEEFFEFEFEFEFEFEFEFEFEFEFEFEFEFEFEFEFEFEFEFEFEFEFEFEFEFEFEFEFEFEFEEEEFE0205500FEFEFEFEFEEEEFE020550000FD00FDFEFEEFEEE1205502007368697070696E67202020202020202049432D463331302023353220202020200000000F010200FDFEFEFEFEFEFEFEFEFEFEFEFEFEFEFEFEFEFEFEFEFEFEEEEFE220550200FEFEFEFEFEFEFEFEFEFEFEFEFEFEFEFEFEFEFEFEFEEEEFE220550200FDFDFEFEEFEE"),
WRITE("FF"); //TODO: sniff the protocol
public final String bytes;
private ICF320Proto(String bytes) {
this.bytes = bytes;
}
@Override
public String toString() {
return bytes;
}
}

View File

@ -268,7 +268,7 @@ public class MainController extends SerialController {
log("ERROR", "Please select a valid COM port.\n");
return;
}
sendData("FEFEFEFEFEFEFEFEFEFEFEFEFEFEFEFEFEFEFEFEFEFEFEFEFEFEFEFEFEFEFEFEEEEFE020550000FDFEFEEEEFFEFEFEFEFEFEFEFEFEFEFEFEFEFEFEFEFEFEFEFEFEFEFEFEFEFEFEFEFEFEFEEEEFE0205500FEFEFEFEFEEEEFE020550000FD00FDFEFEEFEEE1205502007368697070696E67202020202020202049432D463331302023353220202020200000000F010200FDFEFEFEFEFEFEFEFEFEFEFEFEFEFEFEFEFEFEFEFEFEFEEEEFE220550200FEFEFEFEFEFEFEFEFEFEFEFEFEFEFEFEFEFEFEFEFEEEEFE220550200FDFDFEFEEFEE");
sendData(ICF320Proto.READ.toString());
}
public void onOpenItemClick(ActionEvent actionEvent) {
@ -295,7 +295,7 @@ public class MainController extends SerialController {
}
}
public void onCloneWriteItemClick(ActionEvent actionEvent) {
public void onCloneWriteItemClick(ActionEvent actionEvent) throws IOException {
if (getSelectedPort() == null || !getSelectedPort().isOpen()) {
log("ERROR", "Please select a valid COM port.\n");
return;
@ -305,7 +305,9 @@ public class MainController extends SerialController {
return;
}
String fileContent = Files.readString(selectedFile.toPath());
sendData(ICF320Proto.WRITE.toString() + "\n" + fileContent);
}
private Boolean fileFormatValid (String fileContent) {