Details | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
210 | ligi | 1 | /********************************************************************************************************************************* |
2 | * * |
||
3 | * Handling of MK LCD * |
||
4 | * * |
||
5 | * Author: Marcus -LiGi- Bueschleb * |
||
6 | * Project-Start: 9/2007 * |
||
7 | * Mailto: ligi@smart4mobile.de * |
||
8 | * Licence: Creative Commons / Non Commercial * |
||
9 | * Big Up: Holger&Ingo * |
||
10 | *********************************************************************************************************************************/ |
||
11 | |||
12 | public class MKLCD |
||
13 | implements Runnable |
||
14 | { |
||
15 | |||
16 | MKCommunicator mk=null; |
||
17 | |||
18 | public String[] LCD_str; |
||
19 | |||
20 | public MKLCD(MKCommunicator _mk) |
||
21 | { |
||
22 | LCD_str=new String[4]; |
||
23 | mk=_mk; |
||
24 | new Thread( this ).start(); // fire up main Thread |
||
25 | } |
||
26 | |||
27 | public void run() |
||
28 | { |
||
29 | while(true) |
||
30 | { |
||
303 | ligi | 31 | try { |
210 | ligi | 32 | if (mk.connected) |
33 | { |
||
303 | ligi | 34 | |
210 | ligi | 35 | trigger_LCD(); |
36 | |||
37 | } |
||
38 | else |
||
39 | { |
||
40 | |||
41 | } |
||
303 | ligi | 42 | Thread.sleep(100); } |
210 | ligi | 43 | catch (Exception e) { } |
44 | } |
||
45 | } |
||
46 | |||
47 | |||
48 | public void handle_lcd_data(int[] data,int row) |
||
49 | { |
||
50 | LCD_str[row]=""; |
||
51 | for(int foo=0;foo<20;foo++) |
||
52 | LCD_str[row]+=(char)data[foo]; |
||
53 | } |
||
54 | |||
55 | public void trigger_LCD() |
||
56 | { |
||
303 | ligi | 57 | try { |
210 | ligi | 58 | |
325 | ligi | 59 | mk.trigger_LCD(act_key); |
303 | ligi | 60 | act_key=0; |
61 | } |
||
62 | catch (Exception e) { } |
||
210 | ligi | 63 | } |
325 | ligi | 64 | |
210 | ligi | 65 | |
66 | int act_key=0; |
||
67 | |||
68 | |||
69 | public void LCD_NEXTPAGE() |
||
70 | { |
||
71 | act_key=2; |
||
72 | } |
||
73 | |||
74 | public void LCD_PREVPAGE() |
||
75 | { |
||
76 | act_key=1; |
||
77 | } |
||
78 | |||
79 | } |