Details | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
221 | ligi | 1 | /********************************************************************************************************************************** |
2 | * Statistics from MK-Connection ( needed for 2. Thread and Readability of Code ) * |
||
3 | * * |
||
4 | * Author: Marcus -LiGi- Bueschleb * |
||
5 | * Project-Start: 9/2007 * |
||
6 | * Version: 0.07 * |
||
7 | * Mailto: ligi@smart4mobile.de * |
||
8 | * Licence: Creative Commons / Non Commercial * |
||
9 | * Big Up: Holger&Ingo * |
||
10 | *********************************************************************************************************************************/ |
||
11 | |||
12 | public class MKWatchDog |
||
13 | implements Runnable |
||
14 | { |
||
15 | |||
16 | MKCommunicator mk=null; |
||
17 | |||
18 | int debug_data_count_buff=-123; |
||
19 | |||
20 | public MKWatchDog(MKCommunicator _mk) |
||
21 | { |
||
22 | mk=_mk; |
||
23 | new Thread( this ).start(); // fire up main Thread |
||
24 | } |
||
25 | |||
26 | public void run() |
||
27 | { |
||
28 | while(true) |
||
29 | { |
||
30 | try { Thread.sleep(1500); } |
||
31 | catch (Exception e) { } |
||
32 | |||
33 | if (mk.connected) |
||
34 | { |
||
35 | if (debug_data_count_buff==mk.debug_data_count) |
||
36 | mk.close_connections(false); |
||
37 | debug_data_count_buff=mk.debug_data_count; |
||
38 | if (mk.version.major==-1) |
||
39 | mk.get_version(); |
||
40 | if (mk.lcd_data_count==0) |
||
41 | mk.LCD.trigger_LCD(); |
||
42 | |||
43 | } |
||
44 | else |
||
45 | { |
||
46 | |||
47 | } |
||
48 | |||
49 | } |
||
50 | } |
||
51 | |||
52 | |||
53 | } |