Rev 255 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 255 | Rev 382 | ||
---|---|---|---|
Line 8... | Line 8... | ||
8 | * |
8 | * |
9 | * |
9 | * |
Line 10... | Line 10... | ||
10 | 10 | ||
Line -... | Line 11... | ||
- | 11 | **************************************/ |
|
- | 12 | ||
Line 11... | Line 13... | ||
11 | **************************************/ |
13 | import java.util.Vector; |
12 | 14 | import java.io.*; |
|
- | 15 | ||
- | 16 | public class FirmwareLoader |
|
13 | 17 | implements Runnable // for http download task |
|
Line 14... | Line 18... | ||
14 | public class FirmwareLoader |
18 | ,org.ligi.ufo.DUBwiseLangDefs |
15 | implements Runnable |
19 | , DUBwiseUIDefinitions |
16 | { |
20 | { |
Line 17... | Line 21... | ||
17 | 21 | ||
18 | public final static String base_url= "http://mikrocontroller.cco-ev.de/mikrosvn/Projects/DUBwise/trunk/misc/firmwares/"; |
22 | public final static String base_url= "http://mikrocontroller.cco-ev.de/mikrosvn/Projects/DUBwise/trunk/misc/firmwares/"; |
Line -... | Line 23... | ||
- | 23 | boolean got_list=false; |
|
- | 24 | String list_str=""; |
|
- | 25 | ||
- | 26 | String[] names; |
|
19 | boolean got_list=false; |
27 | String[] filenames; |
- | 28 | ||
- | 29 | DUBwiseCanvas canvas; |
|
- | 30 | ||
- | 31 | ||
- | 32 | int selected=0; |
|
- | 33 | public void menu_fire(byte pos) |
|
- | 34 | { |
|
- | 35 | ||
- | 36 | if ( pos<(names.length-1)) |
|
- | 37 | { |
|
- | 38 | selected=pos; |
|
- | 39 | canvas.chg_state(STATEID_FLASHING); |
|
- | 40 | } |
|
- | 41 | else |
|
20 | String list_str=""; |
42 | canvas.chg_state(STATEID_MAINMENU); |
- | 43 | ||
- | 44 | } |
|
- | 45 | ||
- | 46 | ||
- | 47 | public InputStream get_input_str() |
|
- | 48 | { |
|
- | 49 | if ( selected<fws_in_jar) |
|
- | 50 | return this.getClass().getResourceAsStream("/fw_"+avrsig+"_"+selected+".bin"); |
|
- | 51 | ||
- | 52 | return null; |
|
- | 53 | } |
|
- | 54 | ||
- | 55 | ||
- | 56 | int fws_in_jar=0; |
|
- | 57 | int avrsig; |
|
- | 58 | ||
- | 59 | public FirmwareLoader(int _avrsig,DUBwiseCanvas _canvas) |
|
- | 60 | { |
|
- | 61 | avrsig=_avrsig; |
|
- | 62 | canvas=_canvas; |
|
- | 63 | ||
- | 64 | // firmware files in jar |
|
- | 65 | Vector jar_names_vector = new Vector(); |
|
- | 66 | ||
- | 67 | String tmp_str=""; |
|
- | 68 | try { |
|
- | 69 | InputStream in=this.getClass().getResourceAsStream("/fw_"+avrsig+".lst"); |
|
- | 70 | char ch=0; |
|
- | 71 | while (in.available()>0) |
|
- | 72 | { |
|
- | 73 | if ( (ch=(char)in.read())!='\n') |
|
- | 74 | tmp_str+=ch; |
|
- | 75 | else |
|
- | 76 | { |
|
- | 77 | jar_names_vector.addElement( tmp_str ); |
|
- | 78 | tmp_str=""; |
|
- | 79 | } |
|
- | 80 | ||
- | 81 | } |
|
- | 82 | } |
|
- | 83 | catch (Exception e) {} |
|
- | 84 | ||
- | 85 | fws_in_jar= jar_names_vector.size(); |
|
- | 86 | ||
- | 87 | names=new String[ fws_in_jar+2]; |
|
- | 88 | ||
- | 89 | if ( jar_names_vector.size()>0) |
|
21 | 90 | for(int loop=0; loop<fws_in_jar; loop++) |
|
22 | String[] names; |
91 | names[loop] = (String)jar_names_vector.elementAt(loop); |
Line 23... | Line 92... | ||
23 | String[] filenames; |
92 | |
24 | 93 | names[jar_names_vector.size()]="Download"; |
|
25 | public FirmwareLoader() |
94 | names[jar_names_vector.size()+1]=canvas.l(STRINGID_BACK); |