Protofile
This commit is contained in:
parent
cc470fdaff
commit
35f77b10f0
17
src/main/java/guru/dead/icf320/ICF320Proto.java
Normal file
17
src/main/java/guru/dead/icf320/ICF320Proto.java
Normal 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;
|
||||||
|
}
|
||||||
|
}
|
@ -268,7 +268,7 @@ public class MainController extends SerialController {
|
|||||||
log("ERROR", "Please select a valid COM port.\n");
|
log("ERROR", "Please select a valid COM port.\n");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
sendData("FEFEFEFEFEFEFEFEFEFEFEFEFEFEFEFEFEFEFEFEFEFEFEFEFEFEFEFEFEFEFEFEEEEFE020550000FDFEFEEEEFFEFEFEFEFEFEFEFEFEFEFEFEFEFEFEFEFEFEFEFEFEFEFEFEFEFEFEFEFEFEFEEEEFE0205500FEFEFEFEFEEEEFE020550000FD00FDFEFEEFEEE1205502007368697070696E67202020202020202049432D463331302023353220202020200000000F010200FDFEFEFEFEFEFEFEFEFEFEFEFEFEFEFEFEFEFEFEFEFEFEEEEFE220550200FEFEFEFEFEFEFEFEFEFEFEFEFEFEFEFEFEFEFEFEFEEEEFE220550200FDFDFEFEEFEE");
|
sendData(ICF320Proto.READ.toString());
|
||||||
}
|
}
|
||||||
|
|
||||||
public void onOpenItemClick(ActionEvent actionEvent) {
|
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()) {
|
if (getSelectedPort() == null || !getSelectedPort().isOpen()) {
|
||||||
log("ERROR", "Please select a valid COM port.\n");
|
log("ERROR", "Please select a valid COM port.\n");
|
||||||
return;
|
return;
|
||||||
@ -305,7 +305,9 @@ public class MainController extends SerialController {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
String fileContent = Files.readString(selectedFile.toPath());
|
||||||
|
|
||||||
|
sendData(ICF320Proto.WRITE.toString() + "\n" + fileContent);
|
||||||
}
|
}
|
||||||
|
|
||||||
private Boolean fileFormatValid (String fileContent) {
|
private Boolean fileFormatValid (String fileContent) {
|
||||||
|
Loading…
Reference in New Issue
Block a user