Rev 206 | Rev 266 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 206 | Rev 211 | ||
---|---|---|---|
Line 19... | Line 19... | ||
19 | package org.ligi.ufo; |
19 | package org.ligi.ufo; |
Line 20... | Line 20... | ||
20 | 20 | ||
21 | 21 | ||
- | 22 | import java.lang.Math; |
|
22 | import java.lang.Math; |
23 | public class MKGPSPosition |
23 | public class MKGPSPosition |
- | |
24 | { |
- | |
25 | public final byte GPS_FORMAT_DECIMAL=0; |
- | |
Line 26... | Line 24... | ||
26 | public final byte GPS_FORMAT_MINSEC=1; |
24 | implements DUBwiseDefinitions |
- | 25 | { |
|
Line 27... | Line 26... | ||
27 | public final byte GPS_FORMAT_COUNT=2; |
26 | |
Line 28... | Line 27... | ||
28 | 27 | public byte act_gps_format=GPS_FORMAT_DECIMAL; |
|
29 | byte act_gps_format=GPS_FORMAT_DECIMAL; |
28 | public byte act_speed_format=SPEED_FORMAT_KMH; |
Line 218... | Line 217... | ||
218 | LatWP[last_wp]=Latitude; |
217 | LatWP[last_wp]=Latitude; |
Line 219... | Line 218... | ||
219 | 218 | ||
220 | last_wp++; |
219 | last_wp++; |
Line 221... | Line 220... | ||
221 | } |
220 | } |
222 | 221 | ||
223 | public void next_gps_format() |
222 | /* public void next_gps_format() |
224 | { |
223 | { |
Line 225... | Line 224... | ||
225 | act_gps_format=(byte)((act_gps_format+1)%GPS_FORMAT_COUNT); |
224 | act_gps_format=(byte)((act_gps_format+1)%GPS_FORMAT_COUNT); |
226 | } |
225 | }*/ |
227 | 226 | ||
228 | public String act_gps_format_str(int val) |
227 | public String act_gps_format_str(int val) |
Line 236... | Line 235... | ||
236 | default: |
235 | default: |
237 | return "invalid format"; |
236 | return "invalid format"; |
238 | } |
237 | } |
239 | } |
238 | } |
Line -... | Line 239... | ||
- | 239 | ||
- | 240 | ||
- | 241 | ||
- | 242 | public String act_speed_format_str(int val) |
|
- | 243 | { |
|
- | 244 | switch(act_speed_format) |
|
- | 245 | { |
|
- | 246 | case SPEED_FORMAT_KMH: |
|
- | 247 | return "" + ((((val*60)/100)*60)/1000) + " km/h"; |
|
- | 248 | ||
- | 249 | case SPEED_FORMAT_MPH: |
|
- | 250 | return "" + (((((val*60)/100)*60)/1000)*10)/16 + " m/h"; |
|
- | 251 | ||
- | 252 | case SPEED_FORMAT_CMS: |
|
- | 253 | return "" + val+ " cm/s"; |
|
- | 254 | ||
- | 255 | default: |
|
- | 256 | return "invalid speed format"; |
|
- | 257 | } |
|
- | 258 | } |
|
- | 259 | ||
- | 260 | public String GroundSpeed_str() |
|
- | 261 | { |
|
- | 262 | return act_speed_format_str(GroundSpeed); |
|
- | 263 | ||
- | 264 | } |
|
240 | 265 | ||
241 | public String WP_Latitude_str(int id) |
266 | public String WP_Latitude_str(int id) |
Line 242... | Line 267... | ||
242 | { |
267 | { |
243 | 268 | ||
Line 250... | Line 275... | ||
250 | 275 | ||
Line 251... | Line 276... | ||
251 | } |
276 | } |
252 | 277 | ||
253 | public String Latitude_str() |
- | |
254 | { |
278 | public String Latitude_str() |
255 | 279 | { |
|
Line 256... | Line 280... | ||
256 | return act_gps_format_str(Latitude) ; |
280 | return act_gps_format_str(Latitude) ; |
257 | } |
281 | } |
258 | 282 | ||
259 | public String Longitude_str() |
- | |
260 | { |
283 | public String Longitude_str() |
Line 261... | Line 284... | ||
261 | return act_gps_format_str(Longitude) ; |
284 | { |
262 | 285 | return act_gps_format_str(Longitude) ; |
|
Line 273... | Line 296... | ||
273 | return act_gps_format_str(TargetLongitude) ; |
296 | return act_gps_format_str(TargetLongitude) ; |
274 | } |
297 | } |
Line 275... | Line 298... | ||
275 | 298 | ||
276 | public String HomeLatitude_str() |
299 | public String HomeLatitude_str() |
277 | { |
- | |
278 | 300 | { |
|
279 | return act_gps_format_str(HomeLatitude) ; |
301 | return act_gps_format_str(HomeLatitude) ; |
Line 280... | Line 302... | ||
280 | } |
302 | } |
281 | 303 | ||
282 | public String HomeLongitude_str() |
304 | public String HomeLongitude_str() |
283 | { |
305 | { |
Line 284... | Line -... | ||
284 | return act_gps_format_str(HomeLongitude) ; |
- | |
285 | } |
- | |
286 | 306 | return act_gps_format_str(HomeLongitude) ; |
|
287 | 307 | } |
|
288 | 308 | ||
Line 289... | Line 309... | ||
289 | 309 | ||
Line 312... | Line 332... | ||
312 | NameWP[2]="Treffpunkt Seba"; |
332 | NameWP[2]="Treffpunkt Seba"; |
313 | */ |
333 | */ |
Line 314... | Line 334... | ||
314 | 334 | ||
315 | last_wp=0; |
335 | last_wp=0; |
316 | } |
- | |
317 | 336 | } |
|
318 | private int parse_arr_4(int offset,int[] in_arr) |
337 | private int parse_arr_4(int offset,int[] in_arr) |
319 | { |
338 | { |
320 | return ((in_arr[offset+3]<<24) | |
339 | return ((in_arr[offset+3]<<24) | |
321 | (in_arr[offset+2]<<16) | |
340 | (in_arr[offset+2]<<16) | |
322 | (in_arr[offset+1]<<8) | |
341 | (in_arr[offset+1]<<8) | |
323 | (in_arr[offset+0])); |
342 | (in_arr[offset+0])); |
Line 324... | Line -... | ||
324 | } |
- | |
325 | 343 | } |
|
326 | 344 | ||
327 | private int parse_arr_2(int offset,int[] in_arr) |
345 | private int parse_arr_2(int offset,int[] in_arr) |
328 | { |
346 | { |
329 | return ((in_arr[offset+1]<<8) | |
347 | return (((in_arr[offset+1]&0xFF)<<8) | |
Line 330... | Line 348... | ||
330 | (in_arr[offset+0])); |
348 | (in_arr[offset+0]&0xFF )); |
Line 365... | Line 383... | ||
365 | Variometer=parse_arr_2(52,in_arr);; // climb(+) and sink(-) rate |
383 | Variometer=parse_arr_2(52,in_arr);; // climb(+) and sink(-) rate |
366 | FlyingTime=parse_arr_2(54,in_arr);; |
384 | FlyingTime=parse_arr_2(54,in_arr);; |
Line 367... | Line 385... | ||
367 | 385 | ||
Line -... | Line 386... | ||
- | 386 | UBatt= in_arr[56]; |
|
368 | UBatt= in_arr[56]; |
387 | |
369 | 388 | ||
370 | GroundSpeed= parse_arr_2(57,in_arr); |
389 | GroundSpeed= parse_arr_2(57,in_arr); |
Line 371... | Line 390... | ||
371 | Heading= parse_arr_2(59,in_arr); |
390 | Heading= parse_arr_2(59,in_arr); |
Line 379... | Line 398... | ||
379 | NCFlags=in_arr[67]; |
398 | NCFlags=in_arr[67]; |
Line 380... | Line 399... | ||
380 | 399 | ||
Line 381... | Line -... | ||
381 | ErrorCode=in_arr[67]; |
- | |
382 | - | ||
383 | - | ||
384 | // ground_speed 54 / 55 |
- | |
385 | /* |
- | |
386 | if (version.compare(0,11)==version.VERSION_PREVIOUS) |
- | |
387 | { |
- | |
388 | - | ||
389 | TargetLongitude=parse_arr(8,in_arr); |
- | |
390 | TargetLatitude=parse_arr(12,in_arr); |
- | |
391 | Distance2Target=parse_arr(16,in_arr); |
- | |
392 | Angle2Target=parse_arr(20,in_arr); |
- | |
393 | Used_Sat=(byte)in_arr[24]; |
- | |
394 | } |
- | |
395 | else |
- | |
396 | { |
- | |
397 | - | ||
398 | Longitude=parse_arr(0,in_arr); |
- | |
399 | Latitude=parse_arr(4,in_arr); |
- | |
400 | - | ||
401 | TargetLongitude=parse_arr(13,in_arr); |
- | |
402 | TargetLatitude=parse_arr(17,in_arr); |
- | |
403 | - | ||
404 | Distance2Target=-23 ; //parse_arr(16,in_arr); |
- | |
405 | Angle2Target=parse_arr(20,in_arr); |
- | |
406 | - | ||
407 | WayPointNumber=-1; |
- | |
408 | WayPointIndex=-1; |
- | |
409 | Used_Sat=(byte)in_arr[24]; |
- | |
410 | - | ||
411 | - | ||
412 | 400 | ErrorCode=in_arr[67]; |
|
Line 413... | Line 401... | ||
413 | } |
401 |