Subversion Repositories Projects

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
92 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
package org.ligi;
13
 
14
public class MKWatchDog
15
   implements Runnable
16
{
17
 
18
    MKCommunicator mk=null;
19
 
20
    int debug_data_count_buff=-123;
21
    int lcd_data_count_buff=-123;
22
 
23
 
24
    public MKWatchDog(MKCommunicator _mk)
25
    {
26
 
27
        mk=_mk;
28
        new Thread( this ).start(); // fire up main Thread 
29
    }
30
 
31
    public void run()
32
    {
33
        while(true)
34
            {
35
                try { Thread.sleep(3000); }
36
                catch (Exception e)  {   }
37
 
38
                if (mk.connected&&(!mk.force_disconnect))
39
                    {
40
                        if (debug_data_count_buff==mk.debug_data_count)
41
                            {
42
                                //                              mk.close_connections(false);
43
                            }
44
                        if ((lcd_data_count_buff==mk.lcd_data_count)||(mk.lcd_data_count==0))
45
                            mk.LCD.trigger_LCD();
46
 
47
                        debug_data_count_buff=mk.debug_data_count;
48
                        lcd_data_count_buff=mk.lcd_data_count;
49
 
50
 
51
 
52
                        if (mk.version.major==-1)
53
                            mk.get_version();
54
 
55
                        for ( int cnt=0;cnt<5;cnt++)
56
                            if (mk.params.field[cnt]==null)
57
                                {
58
                                    mk.get_params(cnt+1);
59
                                    break;
60
                                }
61
 
62
                        for (int c=0;c<32;c++)
63
                            if (!mk.debug_data.got_name[c])
64
                                {
65
                                    mk.get_debug_name(c);
66
                                    break;
67
                                }
68
 
69
 
70
                    }
71
 
72
 
73
            }
74
    }
75
 
76
 
77
}