Search in sources :

Example 1 with ProgramSectionCommand

use of com.neuronrobotics.sdk.commands.neuronrobotics.bootloader.ProgramSectionCommand in project java-bowler by NeuronRobotics.

the class NRBootLoader method write.

public boolean write(int core, ByteData flashData) {
    BowlerDatagram b = null;
    for (int i = 0; i < 10; i++) {
        try {
            b = send(new ProgramSectionCommand(core, (int) flashData.getStartAddress(), new ByteList(flashData.getData())));
        } catch (Exception e) {
            e.printStackTrace();
            b = null;
        }
        if (b != null) {
            if (!b.getRPC().contains("_err"))
                return true;
        }
    }
    System.err.println("\nFailed to send 10 times!\n");
    return false;
}
Also used : ByteList(com.neuronrobotics.sdk.common.ByteList) ProgramSectionCommand(com.neuronrobotics.sdk.commands.neuronrobotics.bootloader.ProgramSectionCommand) BowlerDatagram(com.neuronrobotics.sdk.common.BowlerDatagram) IOException(java.io.IOException)

Aggregations

ProgramSectionCommand (com.neuronrobotics.sdk.commands.neuronrobotics.bootloader.ProgramSectionCommand)1 BowlerDatagram (com.neuronrobotics.sdk.common.BowlerDatagram)1 ByteList (com.neuronrobotics.sdk.common.ByteList)1 IOException (java.io.IOException)1