Subversion Repositories FlightCtrl

Rev

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

Rev 208 Rev 210
Line 30... Line 30...
30
    public boolean fatal=false; // flag which is set when an error is so fatal that reconnecting won't be tried - e.g. unknown version number.
30
    public boolean fatal=false; // flag which is set when an error is so fatal that reconnecting won't be tried - e.g. unknown version number.
Line 31... Line 31...
31
 
31
 
Line 32... Line -...
32
 
-
 
33
    public String mk_url=""; // buffer the url which is given in the constuctor for reconnectin purposes
-
 
34
   
-
 
35
   
-
 
36
    // version Info from Flight Control
-
 
37
    public int version_major=-1;
-
 
38
    public int version_minor=-1;
32
 
-
 
33
    public String mk_url=""; // buffer the url which is given in the constuctor for reconnectin purposes
-
 
34
   
Line 39... Line 35...
39
    public int version_compatible=-1;
35
    public MKLCD LCD;
Line 40... Line 36...
40
 
36
    public MKVersion version;
Line 60... Line 56...
60
 
56
 
61
 
57
 
62
    /******************  Section: public Methods ************************************************/
58
    /******************  Section: public Methods ************************************************/
63
    public MKCommunicator(String url)     // Constructor with URL string e.g. "btspp://XXXXXXXXXXXX:1" - the X-Part is the MAC-Adress of the Bluetooth-Device connected to the Fligth-Control
-
 
-
 
59
    public MKCommunicator(String url)     // Constructor with URL string e.g. "btspp://XXXXXXXXXXXX:1" - the X-Part is the MAC-Adress of the Bluetooth-Device connected to the Fligth-Control
64
    {
60
    {
65
 
61
        version=new MKVersion();
Line 66... Line 62...
66
        debug_data=new MKDebugData();
62
        debug_data=new MKDebugData();
67
        mk_url=url; // remember URL for connecting / reconnecting later
63
        mk_url=url; // remember URL for connecting / reconnecting later
Line 180... Line 176...
180
            { // problem sending data to FC
176
            { // problem sending data to FC
181
            }
177
            }
Line 182... Line 178...
182
       
178
       
Line 183... Line -...
183
    }
-
 
-
 
179
    }
184
 
180
 
185
    MKDebugData debug_data;
181
 
186
    public void process_data(int[] data,int len)
182
    public void process_data(int[] data,int len)
Line 187... Line 183...
187
    {
183
    {
188
        int[] decoded_data;
184
        int[] decoded_data;
Line 189... Line 185...
189
 
185
 
190
       
-
 
191
        switch((char)data[2])
-
 
192
            {
-
 
193
           
-
 
194
            case 'D': // debug Data
186
       
-
 
187
        switch((char)data[2])
195
                decoded_data=Decode64(data,3,50);
188
            {
Line 196... Line 189...
196
                debug_data=new MKDebugData(decoded_data);
189
           
197
               
-
 
198
 
-
 
199
                debug_data_count++;
-
 
200
                break;
-
 
201
               
190
            case 'D': // debug Data
202
            case 'V': // Version Info
-
 
-
 
191
                debug_data_count++;
203
                decoded_data=Decode64(data,3,6);
192
                debug_data.set_by_mk_data(Decode64(data,3,50),version);
Line 204... Line 193...
204
                version_major=decoded_data[0];
193
                break;
205
                version_minor=decoded_data[1];
194
               
206
                version_compatible=decoded_data[2];
195
            case 'V': // Version Info