Rev 2312 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 2312 | Rev 2313 | ||
---|---|---|---|
Line 23... | Line 23... | ||
23 | DONE = 1 |
23 | DONE = 1 |
24 | } |
24 | } |
Line 25... | Line 25... | ||
25 | 25 | ||
26 | public static string CAMAngle(int iVal) |
26 | public static string CAMAngle(int iVal) |
27 | { |
27 | { |
28 | if (iVal == 255) |
28 | if (iVal == 255 | iVal < 0) |
29 | return "Auto"; |
29 | return "Auto"; |
30 | if (iVal < 0) |
30 | //if (iVal < 0) |
31 | return "POI " + iVal.ToString(); |
31 | // return "WP " + (Math.Abs(iVal)).ToString(); |
32 | if (iVal == 0) |
32 | if (iVal == 0) |
Line 33... | Line 33... | ||
33 | return "- - -"; |
33 | return "- - -"; |
34 | 34 | ||
Line 35... | Line 35... | ||
35 | return iVal.ToString(); |
35 | return iVal.ToString("0 °"); |
36 | } |
36 | } |
37 | 37 | ||
Line 45... | Line 45... | ||
45 | return "Poti" + (256 - iVal).ToString(); |
45 | return "Poti" + (256 - iVal).ToString(); |
Line 46... | Line 46... | ||
46 | 46 | ||
47 | return iVal.ToString(); |
47 | return iVal.ToString(); |
Line -... | Line 48... | ||
- | 48 | } |
|
- | 49 | ||
- | 50 | public static string Heading(int iVal) |
|
- | 51 | { |
|
- | 52 | if (iVal == 0) |
|
- | 53 | return "- - -"; |
|
- | 54 | if (iVal > 0 && iVal < 360) |
|
- | 55 | return iVal.ToString("0 °"); |
|
- | 56 | if (iVal < 0) |
|
- | 57 | return "WP " + (Math.Abs(iVal)).ToString(); |
|
- | 58 | ||
48 | } |
59 | return iVal.ToString(); |
49 | 60 | } |
|
50 | public static DataRow toDataRow(byte[]data, DataRow dr) |
61 | public static DataRow toDataRow(byte[]data, DataRow dr) |
51 | { |
62 | { |
52 | double longitude = 0, latitude = 0, altitude = 0; |
63 | double longitude = 0, latitude = 0, altitude = 0; |
Line 53... | Line 64... | ||
53 | int pstatus = 0, heading = 0, tolRadius = 0, holdTime = 0, eventFlag = 0, index = 0, type = 0, WPeventChanVal = 0, altitudeRate = 0, speed = 0, camAngle = 0, autoTrigger=0; |
64 | int pstatus = 0, heading = 0, tolRadius = 0, holdTime = 0, eventFlag = 0, index = 0, type = 0, WPeventChanVal = 0, altitudeRate = 0, speed = 0, camAngle = 0, autoTrigger=0; |
54 | string name = ""; |
65 | string name = ""; |
55 | 66 | ||
- | 67 | if (data.Length >= 28) |
|
56 | if (data.Length >= 28) |
68 | { |
57 | { |
69 | int i_32, iVal; |
58 | int i_32, iVal; |
70 | |
59 | i_32 = data[5]; |
71 | i_32 = data[5]; |
60 | iVal = i_32 << 24; |
72 | iVal = i_32 << 24; |
61 | i_32 = data[4]; |
73 | i_32 = data[4]; |
62 | iVal += i_32 << 16; |
74 | iVal += i_32 << 16; |
63 | i_32 = data[3]; |
- | |
64 | iVal += i_32 << 8; |
75 | i_32 = data[3]; |
Line 65... | Line 76... | ||
65 | iVal += data[2]; |
76 | iVal += i_32 << 8; |
66 | 77 | iVal += data[2]; |
|
67 | longitude = (double)iVal / Math.Pow(10, 7); |
78 | longitude = (double)iVal / Math.Pow(10, 7); |
Line 75... | Line 86... | ||
75 | iVal += data[6]; |
86 | iVal += data[6]; |
76 | latitude = (double)iVal / Math.Pow(10, 7); |
87 | latitude = (double)iVal / Math.Pow(10, 7); |
Line 77... | Line 88... | ||
77 | 88 | ||
78 | 89 | ||
79 | i_32 = data[13]; |
90 | i_32 = data[13]; |
80 | iVal = i_32 << 24; |
91 | iVal = (i_32 << 24); |
81 | i_32 = data[12]; |
92 | i_32 = data[12]; |
82 | iVal += i_32 << 16; |
93 | iVal += i_32 << 16; |
83 | i_32 = data[11]; |
94 | i_32 = data[11]; |
84 | iVal += i_32 << 8; |
95 | iVal += i_32 << 8; |
Line 85... | Line 96... | ||
85 | iVal += data[10]; |
96 | iVal += data[10]; |
Line 86... | Line 97... | ||
86 | altitude = (double)iVal / Math.Pow(10, 7); |
97 | altitude = (double)iVal/10; |
87 | 98 | ||
88 | pstatus = data[14]; |
99 | pstatus = data[14]; |
89 | - | ||
90 | i_32 = data[16]; |
100 | |
- | 101 | i_32 = (int)(sbyte)data[16]; |
|
91 | iVal = i_32 << 8; |
102 | iVal = i_32 << 8; |
92 | iVal += data[15]; |
103 | iVal += data[15]; |
93 | 104 | heading = iVal; |
|
94 | heading = iVal; |
105 | |
95 | tolRadius = data[17]; |
106 | tolRadius = data[17]; |
96 | holdTime = data[18]; |
107 | holdTime = data[18]; |
97 | eventFlag = data[19]; |
108 | eventFlag = data[19]; |
98 | index = data[1]; |
109 | index = data[1]; |
99 | // index = data[20]; |
110 | // index = data[20]; |
100 | type = data[21]; |
111 | type = data[21]; |
Line 101... | Line 112... | ||
101 | WPeventChanVal = data[22]; |
112 | WPeventChanVal = data[22]; |
Line 102... | Line 113... | ||
102 | altitudeRate = data[23]; |
113 | altitudeRate = data[23]; |
- | 114 | speed = data[24]; |
|
Line 103... | Line 115... | ||
103 | speed = data[24]; |
115 | camAngle = (int)(sbyte)data[25]; |
104 | camAngle = data[25]; |
116 | |
105 | 117 | name = new string(ASCIIEncoding.ASCII.GetChars(data, 26, 4)).Trim('\0'); |
|
Line 106... | Line 118... | ||
106 | name = new string(ASCIIEncoding.ASCII.GetChars(data, 26, 4)).Trim('\0'); |
118 | |
107 | 119 | autoTrigger = data[30]; |