22 |
} |
} |
23 |
|
|
24 |
|
|
25 |
|
void OrbitalInfoItem::fill(TArrayC* data){ |
26 |
|
//pos = float[3]; |
27 |
|
//vel = float[3] |
28 |
|
long tempData = 0; |
29 |
|
time = (((data->At(1) << 24) & 0xFF000000) + ((data->At(0) << 16) & 0x00FF0000) + ((data->At(3) << 8) & 0x0000FF00) + (data->At(2) & 0x000000FF))/128.0; |
30 |
|
|
31 |
|
short index = 0; |
32 |
|
for (int i = 0; i < 3; i++){ |
33 |
|
index = 4*i; |
34 |
|
tempData = ((data->At(index + 4) << 24) & 0xFF000000) + ((data->At(index + 5) << 16) & 0x00FF0000) + ((data->At(index + 6) << 8) & 0x0000FF00) + (data->At(index + 7) & 0x000000FF); |
35 |
|
if (data->At(index + 4) >> 8) { |
36 |
|
pos[i] = (~tempData * -1.0)/262144.0; |
37 |
|
} else { |
38 |
|
pos[i] = tempData /262144.0; |
39 |
|
} |
40 |
|
|
41 |
|
tempData = ((data->At(index + 16) << 24) & 0xFF000000) + ((data->At(index + 17) << 16) & 0x00FF0000) + ((data->At(index + 18) << 8) & 0x0000FF00) + (data->At(index + 19) & 0x000000FF); |
42 |
|
if (data->At(index + 16) >> 8) { |
43 |
|
vel[i] = (~tempData * -1.0)/134217728.0; |
44 |
|
} else { |
45 |
|
vel[i] = tempData /134217728.0; |
46 |
|
} |
47 |
|
} |
48 |
|
} |
49 |
|
|
50 |
|
const char* OrbitalInfoItem::toXML(char* tab = ""){ |
51 |
|
stringstream oss; |
52 |
|
oss.str(""); |
53 |
|
oss << tab << "<param name = 'time'>" << time << "</param>\n"; |
54 |
|
oss << tab << "<param name = 'posX'>" << pos[0] << "</param>\n"; |
55 |
|
oss << tab << "<param name = 'posY'>" << pos[1] << "</param>\n"; |
56 |
|
oss << tab << "<param name = 'posZ'>" << pos[2] << "</param>\n"; |
57 |
|
oss << tab << "<param name = 'velX'>" << vel[0] << "</param>\n"; |
58 |
|
oss << tab << "<param name = 'velY'>" << vel[1] << "</param>\n"; |
59 |
|
oss << tab << "<param name = 'velZ'>" << vel[2] << "</param>\n"; |
60 |
|
return oss.str().c_str(); |
61 |
|
} |
62 |
|
|
63 |
|
|
64 |
|
void InclinationInfoItem::fill(TArrayC* data){ |
65 |
|
short extIndex = 0; |
66 |
|
short innIndex = 0; |
67 |
|
long tempData = 0; |
68 |
|
for (int i = 0; i < 6; i++){ |
69 |
|
extIndex = 20*i; |
70 |
|
time[i] = (((data->At(extIndex) << 24) & 0xFF000000) + |
71 |
|
((data->At(extIndex + 1) << 16) & 0x00FF0000) + ((data->At(extIndex + 2) << 8) & 0x0000FF00) + |
72 |
|
(data->At(extIndex + 3) & 0x000000FF))/128.0; |
73 |
|
|
74 |
|
for (int j = 0; j < 4; j++){ |
75 |
|
innIndex = extIndex + 4*j; |
76 |
|
tempData = ((data->At(innIndex + 4) << 24) & 0xFF000000) + ((data->At(innIndex + 5) << 16) & 0x00FF0000) + ((data->At(innIndex + 6) << 8) & 0x0000FF00) + (data->At(innIndex + 7) & 0x000000FF); |
77 |
|
if (data->At(innIndex + 4) >> 8) { |
78 |
|
quat[i][j] = (~tempData * -1.0)/1073741824.0; |
79 |
|
} else { |
80 |
|
quat[i][j] = tempData / 1073741824.0; |
81 |
|
} |
82 |
|
} |
83 |
|
} |
84 |
|
} |
85 |
|
|
86 |
|
const char* InclinationInfoItem::toXML(char* tab = ""){ |
87 |
|
stringstream oss; |
88 |
|
oss.str(""); |
89 |
|
for (int i = 0; i < 6; i++){ |
90 |
|
oss << tab << "<QUATERNION>\n"; |
91 |
|
oss << tab << "\t <param name = 'time'>" << time[i] << "</param>\n"; |
92 |
|
oss << tab << "\t <param name = 'L0'>" << quat[i][0] << "</param>\n"; |
93 |
|
oss << tab << "\t <param name = 'L1'>" << quat[i][1] << "</param>\n"; |
94 |
|
oss << tab << "\t <param name = 'L2'>" << quat[i][2] << "</param>\n"; |
95 |
|
oss << tab << "\t <param name = 'L3'>" << quat[i][3] << "</param>\n"; |
96 |
|
oss << tab << "</QUATERNION>\n"; |
97 |
|
} |
98 |
|
return oss.str().c_str(); |
99 |
|
} |
100 |
|
|
101 |
void TimeSyncItem::fill(TArrayC* data){ |
void TimeSyncItem::fill(TArrayC* data){ |
102 |
newTime = (((unsigned int)data->At(0)<<24)&0xFF000000) + (((unsigned int)data->At(1)<<16)&0x00FF0000) + (((unsigned int)data->At(2)<<8)&0x0000FF00) + (((unsigned int)data->At(3))&0x000000FF); |
newTime = (((unsigned int)data->At(0)<<24)&0xFF000000) + (((unsigned int)data->At(1)<<16)&0x00FF0000) + (((unsigned int)data->At(2)<<8)&0x0000FF00) + (((unsigned int)data->At(3))&0x000000FF); |
103 |
} |
} |
110 |
} |
} |
111 |
|
|
112 |
|
|
|
|
|
|
|
|
|
|
|
113 |
void SelectOpModeItem::fill(TArrayC* data){ |
void SelectOpModeItem::fill(TArrayC* data){ |
114 |
/*for (int i = 0; i<data->GetSize(); i++){ |
/*for (int i = 0; i<data->GetSize(); i++){ |
115 |
printf("array[%i]: %x", i, data->At(i)); |
printf("array[%i]: %x", i, data->At(i)); |
147 |
case 0xE0: |
case 0xE0: |
148 |
mcmdItem = new TimeSyncItem(); |
mcmdItem = new TimeSyncItem(); |
149 |
break; |
break; |
150 |
|
case 0xE1: |
151 |
|
mcmdItem = new OrbitalInfoItem(); |
152 |
|
break; |
153 |
|
case 0xE2: |
154 |
|
mcmdItem = new InclinationInfoItem(); |
155 |
|
break; |
156 |
case 0x33: |
case 0x33: |
157 |
mcmdItem = new SelectOpModeItem(); |
mcmdItem = new SelectOpModeItem(); |
158 |
break; |
break; |