Subversion Repositories FlightCtrl

Rev

Rev 210 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 210 Rev 221
Line 33... Line 33...
33
    public String mk_url=""; // buffer the url which is given in the constuctor for reconnectin purposes
33
    public String mk_url=""; // buffer the url which is given in the constuctor for reconnectin purposes
Line 34... Line 34...
34
   
34
   
35
    public MKLCD LCD;
35
    public MKLCD LCD;
36
    public MKVersion version;
36
    public MKVersion version;
-
 
37
    public MKDebugData debug_data;
Line 37... Line 38...
37
    public MKDebugData debug_data;
38
    public MKWatchDog watchdog;
Line 38... Line 39...
38
 
39
 
Line 75... Line 76...
75
                writer=connection.openOutputStream();
76
                writer=connection.openOutputStream();
Line 76... Line 77...
76
               
77
               
77
                connection_start_time=System.currentTimeMillis();
78
                connection_start_time=System.currentTimeMillis();
78
                connected=true; // if we get here everything seems to be OK
79
                connected=true; // if we get here everything seems to be OK
-
 
80
                get_version();
-
 
81
                lcd_data_count=0;
-
 
82
                debug_data_count=0;
-
 
83
                version_data_count=0;
79
                get_version();
84
 
-
 
85
                LCD= new MKLCD(this);
80
                LCD= new MKLCD(this);
86
                watchdog=new MKWatchDog(this);
81
           }
87
           }
82
        catch (Exception ex)
88
        catch (Exception ex)
83
            {
89
            {
84
                // TODO difference fatal errors from those which will lead to reconnection
90
                // TODO difference fatal errors from those which will lead to reconnection
Line 201... Line 207...
201
            case '1':
207
            case '1':
202
            case '2':
208
            case '2':
203
            case '3':
209
            case '3':
204
                LCD.handle_lcd_data(Decode64(data,3,20),data[2]-(int)'0');
210
                LCD.handle_lcd_data(Decode64(data,3,20),data[2]-(int)'0');
205
                lcd_data_count++;
211
                lcd_data_count++;
206
                //              decoded_data=
-
 
207
 
-
 
208
               
-
 
209
                //              if ((data[2]-(int)'0')!=3) 
-
 
210
                //              get_LCD();
-
 
211
                break;
212
                break;
Line 212... Line 213...
212
 
213
 
213
            default:
214
            default:
214
                other_data_count++;
215
                other_data_count++;
Line 223... Line 224...
223
 
224
 
Line 224... Line 225...
224
    String o_msg="";
225
    String o_msg="";
Line 225... Line 226...
225
 
226
 
226
    public boolean force_disconnect=false;
227
    public boolean force_disconnect=false;
227
 
228
 
228
    public void close_connections()
229
    public void close_connections(boolean force)
229
    {
230
    {
Line 230... Line 231...
230
        force_disconnect=true;
231
        force_disconnect=force;
231
        try{ reader.close(); }
232
        try{ reader.close(); }
Line 272... Line 273...
272
                   }
273
                   }
273
        catch (Exception ex)
274
        catch (Exception ex)
274
            {
275
            {
275
                msg="Problem reading from MK";
276
                msg="Problem reading from MK";
276
                // close the connection 
277
                // close the connection 
277
                close_connections();
278
                close_connections(false);
Line 278... Line 279...
278
 
279
 
Line 279... Line 280...
279
 
280