-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathForm1.h
445 lines (412 loc) · 15 KB
/
Form1.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
#pragma once
/***************************************************************************
This file is part of Project Apollo - NASSP
Copyright 2004-2008
Telemetry Client main window
Project Apollo is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
Project Apollo is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Project Apollo; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
See http://nassp.sourceforge.net/license/ for more details.
**************************** Revision History ****************************
* $Log: Form1.h,v $
* Revision 1.6 2008/10/18 07:01:29 movieman523
* More telemetry and rationalisation.
*
* Revision 1.5 2008/10/17 03:14:21 movieman523
* More low bit-rate decoding.
*
**************************************************************************/
namespace GroundStation
{
using namespace System;
using namespace System::ComponentModel;
using namespace System::Collections;
using namespace System::Windows::Forms;
using namespace System::Data;
using namespace System::Drawing;
using namespace System::Threading;
// Winsock
WSADATA wsaData;
SOCKET m_socket;
sockaddr_in clientService;
int conn_status;
/// <summary>
/// Summary for Form1
///
/// WARNING: If you change the name of this class, you will need to change the
/// 'Resource File Name' property for the managed resource compiler tool
/// associated with all .resx files this class depends on. Otherwise,
/// the designers will not be able to interact properly with localized
/// resources associated with this form.
/// </summary>
public __gc class Form1 : public System::Windows::Forms::Form
{
public:
Form1(void)
{
InitializeComponent();
}
protected:
void Dispose(Boolean disposing)
{
if (trd != NULL && trd->IsAlive)
trd->Abort();
WSACleanup();
if (disposing && components)
{
components->Dispose();
}
__super::Dispose(disposing);
}
private: System::Windows::Forms::Button * ConnectBtn;
private: System::Windows::Forms::Label * label1;
private: System::Windows::Forms::TextBox * HostAddrBox;
private: System::Windows::Forms::Label * label2;
private: System::Windows::Forms::TextBox * StatusBox;
private: System::Windows::Forms::Button * ShowStrBtn;
private: System::Windows::Forms::Button * ShowEPSBtn;
private: System::Windows::Forms::Button * ShowLESBtn;
private: System::Windows::Forms::Button * ShowECSBtn;
private: System::Windows::Forms::Button * ShowGNBtn;
private: System::Windows::Forms::Button * ShowSCSBtn;
private: System::Windows::Forms::Button * ShowCrewBtn;
private: System::Windows::Forms::Button * ShowSPSBtn;
private: System::Windows::Forms::Button * ShowTCMBtn;
private: System::Windows::Forms::GroupBox * groupBox1;
private:
/// <summary>
/// Required designer variable.
/// </summary>
System::ComponentModel::Container * components;
private: System::Windows::Forms::Button * ShowCMCBtn;
private: System::Windows::Forms::Button * ShowUplinkBtn;
// Crap
// Service Thread
Thread *trd;
void CommThread();
// Functions
void WinsockInit();
void ConnectToHost();
void ShowStructures();
void ShowEPS();
void ShowELS();
void ShowECS();
void ShowGNC();
void ShowSCS();
void ShowSPS();
void ShowCrew();
void ShowTelecom();
void ShowCMC();
void ShowUplink();
void cmc_uplink_process();
void cmc_uplink_word(char * data);
int lock_type;
int framect;
int framead;
int frame_addr;
// CMC datastream parser
unsigned int cmc_w0,cmc_w1;
unsigned int cmc_upbuff __nogc[20];
unsigned int cmc_compnumb;
unsigned int cmc_upoldmod;
unsigned int cmc_upverb;
unsigned int cmc_upcount;
unsigned int cmc_upindex;
int cmc_lock_type;
int cmc_framect;
int cmc_frame_addr;
unsigned int dsptab __nogc[12]; // DSKY Display Table
// Other forms
__gc class StructuresForm * str_form;
__gc class ELSForm * els_form;
__gc class ECSForm * ecs_form;
__gc class GNCForm * gnc_form;
__gc class SCSForm * scs_form;
__gc class SPSForm * sps_form;
__gc class CrewForm * crw_form;
__gc class TelecomForm * tcm_form;
__gc class EPSForm * eps_form;
__gc class CMCForm * cmc_form;
__gc class UplinkForm * upl_form;
// Other utility
void end_hbr();
void end_lbr();
void parse_cmc();
void setup_cmc_list();
char get_dsky_char(unsigned int bits);
double unscale_data(unsigned char data,double low,double high);
double unscale_data_sq(unsigned char data,double low,double high);
void parse_hbr(unsigned char data, int bytect);
void parse_lbr(unsigned char data, int bytect);
void display(unsigned char data, int channel, int type, int ccode);
typedef System::Windows::Forms::TextBox textDisplay;
void showValue( textDisplay *tb, char *msg );
void showPercentage( textDisplay *tb, unsigned char data );
void showPercentage( textDisplay *tb, unsigned char data, double maxPercent );
void showSci( textDisplay *tb, unsigned char data );
void showPSIA( textDisplay *tb, unsigned char data, double low, double high );
void showTempF( textDisplay *tb, unsigned char data, double low, double high );
void showDEG( textDisplay *tb, unsigned char data, double low, double high );
void showEvent( textDisplay *tb, unsigned char data, int bit);
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
void InitializeComponent(void)
{
this->ConnectBtn = new System::Windows::Forms::Button();
this->label1 = new System::Windows::Forms::Label();
this->HostAddrBox = new System::Windows::Forms::TextBox();
this->label2 = new System::Windows::Forms::Label();
this->StatusBox = new System::Windows::Forms::TextBox();
this->ShowStrBtn = new System::Windows::Forms::Button();
this->ShowEPSBtn = new System::Windows::Forms::Button();
this->ShowLESBtn = new System::Windows::Forms::Button();
this->ShowECSBtn = new System::Windows::Forms::Button();
this->ShowGNBtn = new System::Windows::Forms::Button();
this->ShowSCSBtn = new System::Windows::Forms::Button();
this->ShowCrewBtn = new System::Windows::Forms::Button();
this->ShowSPSBtn = new System::Windows::Forms::Button();
this->ShowTCMBtn = new System::Windows::Forms::Button();
this->groupBox1 = new System::Windows::Forms::GroupBox();
this->ShowCMCBtn = new System::Windows::Forms::Button();
this->ShowUplinkBtn = new System::Windows::Forms::Button();
this->groupBox1->SuspendLayout();
this->SuspendLayout();
//
// ConnectBtn
//
this->ConnectBtn->Location = System::Drawing::Point(200, 8);
this->ConnectBtn->Name = S"ConnectBtn";
this->ConnectBtn->TabIndex = 0;
this->ConnectBtn->Text = S"Connect";
this->ConnectBtn->Click += new System::EventHandler(this, &GroundStation::Form1::ConnectBtn_Click);
//
// label1
//
this->label1->Location = System::Drawing::Point(8, 8);
this->label1->Name = S"label1";
this->label1->Size = System::Drawing::Size(80, 24);
this->label1->TabIndex = 1;
this->label1->Text = S"Host Address:";
this->label1->TextAlign = System::Drawing::ContentAlignment::MiddleCenter;
//
// HostAddrBox
//
this->HostAddrBox->Location = System::Drawing::Point(88, 8);
this->HostAddrBox->Name = S"HostAddrBox";
this->HostAddrBox->Size = System::Drawing::Size(104, 20);
this->HostAddrBox->TabIndex = 2;
this->HostAddrBox->Text = S"127.0.0.1";
//
// label2
//
this->label2->Location = System::Drawing::Point(8, 40);
this->label2->Name = S"label2";
this->label2->Size = System::Drawing::Size(40, 24);
this->label2->TabIndex = 3;
this->label2->Text = S"Status:";
this->label2->TextAlign = System::Drawing::ContentAlignment::MiddleCenter;
//
// StatusBox
//
this->StatusBox->Enabled = false;
this->StatusBox->Location = System::Drawing::Point(48, 40);
this->StatusBox->Name = S"StatusBox";
this->StatusBox->Size = System::Drawing::Size(224, 20);
this->StatusBox->TabIndex = 4;
this->StatusBox->Text = S"";
//
// ShowStrBtn
//
this->ShowStrBtn->Location = System::Drawing::Point(176, 16);
this->ShowStrBtn->Name = S"ShowStrBtn";
this->ShowStrBtn->TabIndex = 5;
this->ShowStrBtn->Text = S"STRUCT";
this->ShowStrBtn->Click += new System::EventHandler(this, &GroundStation::Form1::ShowStrBtn_Click);
//
// ShowEPSBtn
//
this->ShowEPSBtn->Location = System::Drawing::Point(96, 64);
this->ShowEPSBtn->Name = S"ShowEPSBtn";
this->ShowEPSBtn->TabIndex = 6;
this->ShowEPSBtn->Text = S"EPS";
this->ShowEPSBtn->Click += new System::EventHandler(this, &GroundStation::Form1::ShowEPSBtn_Click);
//
// ShowLESBtn
//
this->ShowLESBtn->Location = System::Drawing::Point(16, 16);
this->ShowLESBtn->Name = S"ShowLESBtn";
this->ShowLESBtn->TabIndex = 7;
this->ShowLESBtn->Text = S"LES/ELS";
this->ShowLESBtn->Click += new System::EventHandler(this, &GroundStation::Form1::ShowLESBtn_Click);
//
// ShowECSBtn
//
this->ShowECSBtn->Location = System::Drawing::Point(16, 40);
this->ShowECSBtn->Name = S"ShowECSBtn";
this->ShowECSBtn->TabIndex = 8;
this->ShowECSBtn->Text = S"ECS";
this->ShowECSBtn->Click += new System::EventHandler(this, &GroundStation::Form1::ShowECSBtn_Click);
//
// ShowGNBtn
//
this->ShowGNBtn->Location = System::Drawing::Point(96, 16);
this->ShowGNBtn->Name = S"ShowGNBtn";
this->ShowGNBtn->TabIndex = 9;
this->ShowGNBtn->Text = S"GNC/FLT";
this->ShowGNBtn->Click += new System::EventHandler(this, &GroundStation::Form1::ShowGNBtn_Click);
//
// ShowSCSBtn
//
this->ShowSCSBtn->Location = System::Drawing::Point(96, 40);
this->ShowSCSBtn->Name = S"ShowSCSBtn";
this->ShowSCSBtn->TabIndex = 10;
this->ShowSCSBtn->Text = S"SCS";
this->ShowSCSBtn->Click += new System::EventHandler(this, &GroundStation::Form1::ShowSCSBtn_Click);
//
// ShowCrewBtn
//
this->ShowCrewBtn->Location = System::Drawing::Point(16, 64);
this->ShowCrewBtn->Name = S"ShowCrewBtn";
this->ShowCrewBtn->TabIndex = 11;
this->ShowCrewBtn->Text = S"CREW/SCI";
this->ShowCrewBtn->Click += new System::EventHandler(this, &GroundStation::Form1::ShowCrewBtn_Click);
//
// ShowSPSBtn
//
this->ShowSPSBtn->Location = System::Drawing::Point(176, 40);
this->ShowSPSBtn->Name = S"ShowSPSBtn";
this->ShowSPSBtn->TabIndex = 12;
this->ShowSPSBtn->Text = S"SPS/RCS";
this->ShowSPSBtn->Click += new System::EventHandler(this, &GroundStation::Form1::ShowSPSBtn_Click);
//
// ShowTCMBtn
//
this->ShowTCMBtn->Location = System::Drawing::Point(176, 64);
this->ShowTCMBtn->Name = S"ShowTCMBtn";
this->ShowTCMBtn->TabIndex = 13;
this->ShowTCMBtn->Text = S"TELECOM";
this->ShowTCMBtn->Click += new System::EventHandler(this, &GroundStation::Form1::ShowTCMBtn_Click);
//
// groupBox1
//
this->groupBox1->Controls->Add(this->ShowCMCBtn);
this->groupBox1->Controls->Add(this->ShowCrewBtn);
this->groupBox1->Controls->Add(this->ShowSCSBtn);
this->groupBox1->Controls->Add(this->ShowTCMBtn);
this->groupBox1->Controls->Add(this->ShowLESBtn);
this->groupBox1->Controls->Add(this->ShowSPSBtn);
this->groupBox1->Controls->Add(this->ShowECSBtn);
this->groupBox1->Controls->Add(this->ShowGNBtn);
this->groupBox1->Controls->Add(this->ShowEPSBtn);
this->groupBox1->Controls->Add(this->ShowStrBtn);
this->groupBox1->Location = System::Drawing::Point(8, 144);
this->groupBox1->Name = S"groupBox1";
this->groupBox1->Size = System::Drawing::Size(264, 120);
this->groupBox1->TabIndex = 14;
this->groupBox1->TabStop = false;
this->groupBox1->Text = S"Downlink Data Display Select";
//
// ShowCMCBtn
//
this->ShowCMCBtn->Location = System::Drawing::Point(96, 88);
this->ShowCMCBtn->Name = S"ShowCMCBtn";
this->ShowCMCBtn->TabIndex = 113;
this->ShowCMCBtn->Text = S"CMC DATA";
this->ShowCMCBtn->Click += new System::EventHandler(this, &GroundStation::Form1::ShowCMCBtn_Click);
//
// ShowUplinkBtn
//
this->ShowUplinkBtn->Location = System::Drawing::Point(104, 112);
this->ShowUplinkBtn->Name = S"ShowUplinkBtn";
this->ShowUplinkBtn->TabIndex = 15;
this->ShowUplinkBtn->Text = S"UPLINK";
this->ShowUplinkBtn->Click += new System::EventHandler(this, &GroundStation::Form1::ShowUplinkBtn_Click);
//
// Form1
//
this->AutoScaleBaseSize = System::Drawing::Size(5, 13);
this->ClientSize = System::Drawing::Size(278, 266);
this->Controls->Add(this->ShowUplinkBtn);
this->Controls->Add(this->groupBox1);
this->Controls->Add(this->StatusBox);
this->Controls->Add(this->HostAddrBox);
this->Controls->Add(this->label2);
this->Controls->Add(this->label1);
this->Controls->Add(this->ConnectBtn);
this->FormBorderStyle = System::Windows::Forms::FormBorderStyle::Fixed3D;
this->Name = S"Form1";
this->Text = S"Apollo Ground Station";
this->Load += new System::EventHandler(this, &GroundStation::Form1::Form1_Load);
this->groupBox1->ResumeLayout(false);
this->ResumeLayout(false);
}
private: System::Void ConnectBtn_Click(System::Object * sender, System::EventArgs * e)
{
ConnectToHost();
}
private: System::Void Form1_Load(System::Object * sender, System::EventArgs * e)
{
// Setup
trd = NULL;
WinsockInit();
}
private: System::Void ShowStrBtn_Click(System::Object * sender, System::EventArgs * e)
{
ShowStructures();
}
private: System::Void ShowEPSBtn_Click(System::Object * sender, System::EventArgs * e)
{
ShowEPS();
}
private: System::Void ShowLESBtn_Click(System::Object * sender, System::EventArgs * e)
{
ShowELS();
}
private: System::Void ShowECSBtn_Click(System::Object * sender, System::EventArgs * e)
{
ShowECS();
}
private: System::Void ShowGNBtn_Click(System::Object * sender, System::EventArgs * e)
{
ShowGNC();
}
private: System::Void ShowSCSBtn_Click(System::Object * sender, System::EventArgs * e)
{
ShowSCS();
}
private: System::Void ShowCrewBtn_Click(System::Object * sender, System::EventArgs * e)
{
ShowCrew();
}
private: System::Void ShowSPSBtn_Click(System::Object * sender, System::EventArgs * e)
{
ShowSPS();
}
private: System::Void ShowTCMBtn_Click(System::Object * sender, System::EventArgs * e)
{
ShowTelecom();
}
private: System::Void ShowCMCBtn_Click(System::Object * sender, System::EventArgs * e)
{
ShowCMC();
}
private: System::Void ShowUplinkBtn_Click(System::Object * sender, System::EventArgs * e)
{
ShowUplink();
}
private: void ThreadTask()
{
CommThread();
}
};
}