Details | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
303 | ligi | 1 | /************************************** |
2 | * |
||
3 | * Author: Marcus -LiGi- Bueschleb |
||
4 | * Project-Start: 9/2007 |
||
5 | * Mailto: ligi@smart4mobile.de |
||
6 | * |
||
7 | **************************************/ |
||
221 | ligi | 8 | |
9 | public class MKWatchDog |
||
10 | implements Runnable |
||
11 | { |
||
12 | |||
13 | MKCommunicator mk=null; |
||
14 | |||
15 | int debug_data_count_buff=-123; |
||
303 | ligi | 16 | int lcd_data_count_buff=-123; |
221 | ligi | 17 | |
18 | public MKWatchDog(MKCommunicator _mk) |
||
19 | { |
||
20 | mk=_mk; |
||
21 | new Thread( this ).start(); // fire up main Thread |
||
22 | } |
||
23 | |||
24 | public void run() |
||
25 | { |
||
26 | while(true) |
||
27 | { |
||
303 | ligi | 28 | try { Thread.sleep(1000); } |
221 | ligi | 29 | catch (Exception e) { } |
30 | |||
303 | ligi | 31 | if (mk.connected&&(!mk.force_disconnect)) |
221 | ligi | 32 | { |
33 | if (debug_data_count_buff==mk.debug_data_count) |
||
34 | mk.close_connections(false); |
||
303 | ligi | 35 | |
36 | if ((lcd_data_count_buff==mk.lcd_data_count)||(mk.lcd_data_count==0)) |
||
37 | mk.LCD.trigger_LCD(); |
||
38 | |||
221 | ligi | 39 | debug_data_count_buff=mk.debug_data_count; |
303 | ligi | 40 | lcd_data_count_buff=mk.lcd_data_count; |
41 | |||
221 | ligi | 42 | if (mk.version.major==-1) |
43 | mk.get_version(); |
||
44 | |||
314 | ligi | 45 | if (mk.params.field[0][0]==-1) |
303 | ligi | 46 | mk.get_params(1); |
314 | ligi | 47 | else if (mk.params.field[1][0]==-1) |
48 | mk.get_params(2); |
||
49 | else if (mk.params.field[2][0]==-1) |
||
50 | mk.get_params(3); |
||
51 | else if (mk.params.field[3][0]==-1) |
||
52 | mk.get_params(4); |
||
53 | else if (mk.params.field[4][0]==-1) |
||
54 | mk.get_params(5); |
||
55 | |||
221 | ligi | 56 | |
314 | ligi | 57 | |
221 | ligi | 58 | } |
303 | ligi | 59 | |
221 | ligi | 60 | |
61 | } |
||
62 | } |
||
63 | |||
64 | |||
65 | } |