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