Place messages in AltosFlashListener instead of using the same strings
in three different places.
Signed-off-by: Keith Packard <keithp@keithp.com>
int flash_addr = (int) image.address;
int image_start = 0;
int flash_addr = (int) image.address;
int image_start = 0;
+ action(AltosFlashListener.flash_start, 0);
action(0, image.data.length);
while (remain > 0 && !aborted) {
int this_time = remain;
action(0, image.data.length);
while (remain > 0 && !aborted) {
int this_time = remain;
action(image.data.length - remain, image.data.length);
}
if (!aborted) {
action(image.data.length - remain, image.data.length);
}
if (!aborted) {
+ action(AltosFlashListener.flash_done, 100);
if (debug != null) {
debug.set_pc((int) image.address);
debug.resume();
if (debug != null) {
debug.set_pc((int) image.address);
debug.resume();
package org.altusmetrum.altoslib_13;
public interface AltosFlashListener {
package org.altusmetrum.altoslib_13;
public interface AltosFlashListener {
+
+ public final static String flash_start = "start";
+ public final static String flash_done = "done";
+
public void position(String label, int percent);
}
public void position(String label, int percent);
}
long flash_addr = image.address;
int image_start = 0;
long flash_addr = image.address;
int image_start = 0;
+ action(AltosFlashListener.flash_start, 0);
action(0, image.data.length);
while (remain > 0 && !aborted) {
int this_time = remain;
action(0, image.data.length);
while (remain > 0 && !aborted) {
int this_time = remain;
action(image.data.length - remain, image.data.length);
}
if (!aborted) {
action(image.data.length - remain, image.data.length);
}
if (!aborted) {
+ action(AltosFlashListener.flash_done, 100);
}
close();
} catch (IOException ie) {
}
close();
} catch (IOException ie) {
JOptionPane.ERROR_MESSAGE);
setVisible(false);
dispose();
JOptionPane.ERROR_MESSAGE);
setVisible(false);
dispose();
- } else if (cmd.equals("done")) {
+ } else if (cmd.equals(AltosFlashListener.flash_done)) {
setVisible(false);
dispose();
setVisible(false);
dispose();
- } else if (cmd.equals("start")) {
+ } else if (cmd.equals(AltosFlashListener.flash_start)) {
setVisible(true);
} else {
pbar.setValue(e.getID());
setVisible(true);
} else {
pbar.setValue(e.getID());