Go to most recent revision | Details | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
255 | ligi | 1 | /************************************** |
2 | * |
||
3 | * WatchDog for MK-Connection |
||
4 | * |
||
5 | * Author: Marcus -LiGi- Bueschleb |
||
6 | * |
||
7 | * see README for further Infos |
||
8 | * |
||
9 | * |
||
10 | |||
11 | **************************************/ |
||
12 | |||
13 | |||
14 | public class FirmwareLoader |
||
15 | implements Runnable |
||
16 | { |
||
17 | |||
18 | public final static String base_url= "http://mikrocontroller.cco-ev.de/mikrosvn/Projects/DUBwise/trunk/misc/firmwares/"; |
||
19 | boolean got_list=false; |
||
20 | String list_str=""; |
||
21 | |||
22 | String[] names; |
||
23 | String[] filenames; |
||
24 | |||
25 | public FirmwareLoader() |
||
26 | { |
||
27 | new Thread( this ).start(); // fire up main Thread |
||
28 | } |
||
29 | |||
30 | public void run() |
||
31 | { |
||
32 | if (!got_list) |
||
33 | { |
||
34 | list_str=DUBwiseHelper.get_http_string(base_url+"list"); |
||
35 | |||
36 | |||
37 | String[] split=DUBwiseHelper.split_str(list_str,"\n"); |
||
38 | names=new String[ split.length]; |
||
39 | filenames=new String[ split.length]; |
||
40 | |||
41 | |||
42 | for ( int i=0;i<split.length;i++) |
||
43 | { |
||
44 | String[] sp2=DUBwiseHelper.split_str(split[i],":"); |
||
45 | if (sp2.length==2) |
||
46 | { |
||
47 | names[i]=sp2[0]; |
||
48 | filenames[i]=sp2[1]; |
||
49 | } |
||
50 | else |
||
51 | names[i]="fail"; |
||
52 | |||
53 | |||
54 | } |
||
55 | |||
56 | System.out.println(list_str); |
||
57 | |||
58 | got_list=true; |
||
59 | } |
||
60 | else |
||
61 | { |
||
62 | |||
63 | } |
||
64 | } |
||
65 | |||
66 | |||
67 | } |