-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathpic32ubldlg.cpp
More file actions
695 lines (585 loc) · 21.4 KB
/
pic32ubldlg.cpp
File metadata and controls
695 lines (585 loc) · 21.4 KB
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
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
#include "stdafx.h"
#include "comport.h"
#include "ethernet.h"
#include "usbhid.h"
#include "hex.h"
#include "bootloader.h"
#include "pic32ubldlg.h"
#include "ui_pic32ubldlg.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#endif
#define BOOTLOADER_ROUTINE_TIMER 1
#define BOOTLOADER_GUI_UPDATE_TIMER 2
#define SWAP(x) ( ((x<<24)&(0xFF000000)) | ((x<<8)&(0x00FF0000)) | ((x>>24)&(0x000000FF)) | ((x>>8)&(0x0000FF00)) )
#define SAVE 1
#define RESTORE 2
#define SaveButtonStatus() ButtonStatus(SAVE)
#define RestoreButtonStatus() ButtonStatus(RESTORE)
Q_DECLARE_METATYPE(unsigned char)
Q_DECLARE_METATYPE(unsigned char *)
CPIC32UBLDlg::CPIC32UBLDlg(QWidget *parent) :
QMainWindow(parent),
ui(new Ui::CPIC32UBLDlg)
{
ui->setupUi(this);
qRegisterMetaType<unsigned char>("unsigned char");
qRegisterMetaType<unsigned char *>("unsigned char *");
ExtraInitialization();
}
CPIC32UBLDlg::~CPIC32UBLDlg()
{
delete ui;
}
void CPIC32UBLDlg::on_ctrlButtonBootloaderVer_clicked()
{
OnBnClickedButtonBootVer();
}
void CPIC32UBLDlg::on_ctrlButtonLoadHex_clicked()
{
OnBnClickedButtonLoadhex();
}
void CPIC32UBLDlg::on_ctrlButtonErase_clicked()
{
OnBnClickedButtonErase();
}
void CPIC32UBLDlg::on_ctrlButtonProgram_clicked()
{
OnBnClickedButtonProgram();
}
void CPIC32UBLDlg::on_ctrlButtonVerify_clicked()
{
OnBnClickedButtonVerify();
}
void CPIC32UBLDlg::on_ctrlButtonRunApplication_clicked()
{
OnBnClickedButtonRunapplication();
}
void CPIC32UBLDlg::on_ctrlButtonEraseProgVerify_clicked()
{
OnBnClickedButtonEraseProgVerify();
}
void CPIC32UBLDlg::on_ctrlButtonConnectDevice_clicked()
{
OnBnClickedButtonConnect();
}
void CPIC32UBLDlg::on_ctrlCheckBoxComEnable_clicked()
{
OnBnClickedCheckComEnable();
}
void CPIC32UBLDlg::on_ctrlCheckBoxUSBEnable_clicked()
{
OnBnClickedCheckUsbEnable();
}
void CPIC32UBLDlg::on_ctrlCheckBoxEthEnable_clicked()
{
OnBnClickedCheckEthEnable();
}
/****************************************************************************
* Invoked when connect button is clicked
*
*
*****************************************************************************/
void CPIC32UBLDlg::OnBnClickedButtonConnect()
{
QString comport;
QString baudString;
INT baud;
QString string;
QString vidpidString;
UINT vid;
UINT pid;
ULONG ip;
USHORT skt;
// UpdateData(true);
if(ConnectionEstablished)
{
// Already connected. Disconnect now.
ConnectionEstablished = false;
// Shut down the rx-tx thread, if already opened.
mBootLoader.ShutdownThread();
if(mBootLoader.GetPortOpenStatus(PortSelected))
{
// com port already opened. close com port
mBootLoader.ClosePort(PortSelected);
}
// Print console.
PrintKonsole("Device disconnected");
EnableAllButtons(false);
ui->ctrlButtonConnectDevice->setText("Connect");
ui->ctrlButtonConnectDevice->setEnabled(true);
}
else
{
// Establish new connection.
comport = ui->ctrlComboBoxComPort->currentText();
baudString = ui->ctrlComboBoxBaudRate->currentText();
sscanf(baudString.toStdString().c_str(), "%d", &baud);
vidpidString = ui->ctrlComboBoxVIDPID->currentText();
sscanf(vidpidString.toStdString().c_str(), "%4X:%4X", &vid, &pid);
// Read ip address;
ip = SWAP(ip_value);
skt = (USHORT)valEditBoxSocket;
// UpdateData(false);
if(mBootLoader.GetPortOpenStatus(PortSelected))
{
// com port already opened. close com port
mBootLoader.ClosePort(PortSelected);
}
// Open Communication port freshly.
mBootLoader.OpenPort(PortSelected, comport, baud, vid, pid, skt, ip);
if(mBootLoader.GetPortOpenStatus(PortSelected))
{ // COM port opened.
// Shut down the rx-tx thread, if already opened.
mBootLoader.ShutdownThread();
// Create a new thread to do Rx Tx in the back ground.
mBootLoader.CreateRxTxThread(this); // Create Rx Tx thread.
// Trigger Read boot info command
mBootLoader.SendCommand(READ_BOOT_INFO, 30, 200);
// Start timer to handle GUI updates.
updateTimer.setInterval(300);
updateTimer.start();
connect(&updateTimer,SIGNAL(timeout()),SLOT(OnTimer()));
// Print a message to user/
PrintKonsole("Please reset device and invoke bootloader");
// Save button status.
SaveButtonStatus();
// Disable all buttons to avoid further operations
EnableAllButtons(false);
}
}
}
/****************************************************************************
* Invoked just after dialog is created. Do some extra initialization
* like enabling and disabling buttons and so on.
*
*****************************************************************************/
void CPIC32UBLDlg::ExtraInitialization()
{
char com[9][15] = { "/dev/ttyS0", "/dev/ttyS1", "/dev/ttyS2", "/dev/ttyS3", "/dev/ttyS4", "/dev/ttyUSB0", "/dev/ttyUSB1", "/dev/ttyUSB2", "/dev/ttyUSB3"};
char baud[5][10] = {"9600", "19200", "38400", "57600", "115200"};
EraseProgVer = false;
// Fill Com Port Combo Box with "COM1, COM2 ........, COM9"
for(int i = 0; i < 9; i++)
{
ui->ctrlComboBoxComPort->addItem(QString(com[i]));
}
// By default set "COM1" in com port combo box
ui->ctrlComboBoxComPort->setCurrentIndex(0);
// Fill Baud Rate Combo Box with "9600, 19200, 38400, 57600, 115200"
for(int i = 0; i < 5; i++)
{
ui->ctrlComboBoxBaudRate->addItem(QString(baud[i]));
}
// By default set "115200" in baud rate combo box
ui->ctrlComboBoxBaudRate->setCurrentIndex(4);
// Mask all buttons, except for "Connect Device"
EnableAllButtons(false);
ui->ctrlButtonConnectDevice->setEnabled(true);
// Mark this flag as false.
ConnectionEstablished = false;
// Select communication "Com Port" by default.
ui->ctrlCheckBoxComEnable->setChecked(true);
PortSelected = COM;
// Diasble serial port selection and baud rate selection.
ui->ctrlComboBoxBaudRate->setEnabled(true);
ui->ctrlComboBoxComPort->setEnabled(true);
// Enable USB VID and PID edit boxes.
ui->ctrlComboBoxVIDPID->setEnabled(false);
// Enable IP Address and Socket
ui->ctrlEditBoxIPaddress->setEnabled(false);
ui->ctrlEditBoxSocketaddress->setEnabled(false);
// Set default IP address to 192.168.1.11
ip_value = inet_addr("192.168.1.11");
ip_value = SWAP(ip_value);
valEditBoxSocket = 6234;
ui->ctrlProgressBar->setRange(0, 100);
ui->ctrlProgressBar->setValue(0);
struct hid_device_info *deviceInfosLinkedList = hid_enumerate(0, 0);
struct hid_device_info *current = deviceInfosLinkedList;
std::set<QString> addedStrings;
if (deviceInfosLinkedList)
{
while (current)
{
QString vidpid;
vidpid.sprintf("%04X:%04X", current->vendor_id, current->product_id);
if (addedStrings.count(vidpid) == 0)
{
ui->ctrlComboBoxVIDPID->addItem(vidpid);
addedStrings.insert(vidpid);
}
current = current->next;
}
hid_free_enumeration(deviceInfosLinkedList);
}
// UpdateData(false);
}
/****************************************************************************
* Just do some mundane things here, like getting progress bar status,
disabling buttons if connection cuts.
This function is called everytime the timer elapses.
*
*
*****************************************************************************/
void CPIC32UBLDlg::OnTimer()
{
int Lower;
int Upper;
// Update progress bar.
mBootLoader.GetProgress(&Lower, &Upper);
ui->ctrlProgressBar->setRange(0, Upper);
ui->ctrlProgressBar->setValue(Lower);
}
/****************************************************************************
* Invoked when button erase is clicked.
*
*
*****************************************************************************/
void CPIC32UBLDlg::OnBnClickedButtonErase()
{
SaveButtonStatus();
// Disable all buttons, to avoid further operation.
EnableAllButtons(false);
mBootLoader.SendCommand(ERASE_FLASH, 3, 5000); //5s retry delay, becuse erase takes considerable time.
}
/****************************************************************************
* Enables all button, if the parameter passed is true.
*
*
*****************************************************************************/
void CPIC32UBLDlg::EnableAllButtons(bool enbl)
{
// Mask all buttons, except for "Connect Device"
ui->ctrlButtonProgram->setEnabled(enbl);
ui->ctrlButtonLoadHex->setEnabled(enbl);
ui->ctrlButtonErase->setEnabled(enbl);
ui->ctrlButtonVerify->setEnabled(enbl);
ui->ctrlButtonRunApplication->setEnabled(enbl);
// ui->ctrlButtonConnectDevice->setEnabled(enbl);
ui->ctrlButtonEraseProgVerify->setEnabled(enbl);
ui->ctrlButtonBootloaderVer->setEnabled(enbl);
}
/****************************************************************************
* Invoked when load hex button is clicked.
*
*
*****************************************************************************/
void CPIC32UBLDlg::OnBnClickedButtonLoadhex()
{
// Save button status.
SaveButtonStatus();
if(mBootLoader.LoadHexFile())
{
PrintKonsole("Hex file loaded successfully");
// Enable Program button
ui->ctrlButtonProgram->setEnabled(true);
ui->ctrlButtonEraseProgVerify->setEnabled(true);
}
else
{
PrintKonsole("Hex file loading failed");
}
}
/****************************************************************************
* This function is invoked when there is a response from the device.
Process the response based on the command.
*
*
*****************************************************************************/
void CPIC32UBLDlg::OnReceiveResponse(unsigned char cmd, unsigned char *RxDataPtrAdrs)
{
char MajorVer;// = RxData[3];
char MinorVer ;//= RxData[4];
char *RxData;
QString string;
unsigned short crc;
RxData = (char *)RxDataPtrAdrs;
MajorVer = RxData[0];
MinorVer = RxData[1];
switch(cmd)
{
case READ_BOOT_INFO:
if(ConnectionEstablished == false)
{
// New connection.
ClearKonsole();
string = "Device connected";
PrintKonsole(string);
}
string.sprintf("Bootloader Firmware Version: %d.%d", MajorVer, MinorVer);
PrintKonsole(string);
// Enable only load hex, Disconnect and erase buttons for next operation.
ui->ctrlButtonLoadHex->setEnabled(true);
ui->ctrlButtonErase->setEnabled(true);
// Change the connect button to disconnect.
ConnectionEstablished = true;
ui->ctrlButtonConnectDevice->setText("Disconnect");
// Disable baud rate and com port combo boxes.
ui->ctrlComboBoxBaudRate->setEnabled(false);
ui->ctrlComboBoxComPort->setEnabled(false);
// Disable USB VID and PID boxes.
ui->ctrlComboBoxVIDPID->setEnabled(false);
// Also enable bootloader version info.
ui->ctrlButtonBootloaderVer->setEnabled(true);
break;
case ERASE_FLASH:
PrintKonsole("Flash Erased");
if(EraseProgVer)// Operation Erase->Program->Verify
{
// Erase completed. Next operation is programming.
mBootLoader.SendCommand(PROGRAM_FLASH, 3, 500); // 500ms delay
}
// Restore button status to allow further operations.
RestoreButtonStatus();
break;
case PROGRAM_FLASH:
PrintKonsole("Programming completed");
// Restore button status to allow further operations.
RestoreButtonStatus();
ui->ctrlButtonVerify->setEnabled(true);
ui->ctrlButtonRunApplication->setEnabled(true);
if(EraseProgVer)// Operation Erase->Program->Verify
{
// Programming completed. Next operation is verification.
mBootLoader.SendCommand(READ_CRC, 3, 5000);// 5 second delay
}
break;
case READ_CRC:
crc = ((RxData[1] << 8) & 0xFF00) | (RxData[0] & 0x00FF);
if(crc == mBootLoader.CalculateFlashCRC())
{
PrintKonsole("Verification successfull");
}
else
{
PrintKonsole("Verification failed");
}
// Reset erase->program-verify operation.
EraseProgVer = false;
// Restore button status to allow further operations.
RestoreButtonStatus();
ui->ctrlButtonVerify->setEnabled(true);
ui->ctrlButtonRunApplication->setEnabled(true);
break;
}
if(!ConnectionEstablished)
{
// Disable all buttons, if disconnected.
EnableAllButtons(false);
}
}
/****************************************************************************
* This function is invoked when there is no resonse from the device, even after
retries.
*
*****************************************************************************/
void CPIC32UBLDlg::OnTransmitFailure(unsigned char cmd)
{
EraseProgVer = false;
switch(cmd)
{
case READ_BOOT_INFO:
case ERASE_FLASH:
case PROGRAM_FLASH:
case READ_CRC:
PrintKonsole("No Response from the device. Operation failed");
RestoreButtonStatus();
break;
}
if(!ConnectionEstablished)
{
// Disable all buttons, if disconnected.
EnableAllButtons(false);
}
}
/****************************************************************************
* Invoked when the button program is clicked.
*
*
*****************************************************************************/
void CPIC32UBLDlg::OnBnClickedButtonProgram()
{
// Save button status.
SaveButtonStatus();
// Disable all buttons to avoid further operations
EnableAllButtons(false);
mBootLoader.SendCommand(PROGRAM_FLASH, 3, 5000); // 500ms delay
}
/****************************************************************************
* This function is invoked when button verify is clicked
*
*
*****************************************************************************/
void CPIC32UBLDlg::OnBnClickedButtonVerify()
{
// Save button status.
SaveButtonStatus();
// Disable all buttons to avoid further operations
EnableAllButtons(false);
mBootLoader.SendCommand(READ_CRC, 3, 5000);
}
/****************************************************************************
* This function is invoked when button Erase-Program-Verify is clicked
*
*
*****************************************************************************/
void CPIC32UBLDlg::OnBnClickedButtonEraseProgVerify()
{
// TODO: Add your control notification handler code here
// Save button status.
SaveButtonStatus();
// Disable all buttons to avoid further operations
EnableAllButtons(false);
EraseProgVer = true;
// Start with erase. Rest is automatically handled by state machine.
mBootLoader.SendCommand(ERASE_FLASH, 3, 5000); // 5s delay
}
/****************************************************************************
* This function is invoked when button run application is clicked
*
*
*****************************************************************************/
void CPIC32UBLDlg::OnBnClickedButtonRunapplication()
{
mBootLoader.SendCommand(JMP_TO_APP, 1, 10); // 10ms delay
PrintKonsole("\nCommand issued to run application");
}
/****************************************************************************
* This function is invoked when button Read Version is clicked
*
*
*****************************************************************************/
void CPIC32UBLDlg::OnBnClickedButtonBootVer()
{
// TODO: Add your control notification handler code here
// Save button status.
SaveButtonStatus();
// Disable all buttons to avoid further operations
EnableAllButtons(false);
mBootLoader.SendCommand(READ_BOOT_INFO, 50, 200);
}
/****************************************************************************
* Print Konsole
*
*
*****************************************************************************/
void CPIC32UBLDlg::PrintKonsole(QString string)
{
// UpdateData(false);
// Set the console window vertical scroll to the end.
ui->ctrlEditConsole->setPlainText(ui->ctrlEditConsole->toPlainText().append(string).append("\n"));
}
/****************************************************************************
* Clears konsole
*
*
*****************************************************************************/
void CPIC32UBLDlg::ClearKonsole(void)
{
// UpdateData(false);
// Set the console window vertical scroll to the end.
ui->ctrlEditConsole->setPlainText("");
}
/****************************************************************************
* Saves the current status of the button and restores the button
*
*
*****************************************************************************/
void CPIC32UBLDlg::ButtonStatus(unsigned int oprn)
{
static unsigned int status;
if(oprn == SAVE)
{
(ui->ctrlButtonProgram->isEnabled())? status |= 0x01: status &= ~0x01;
(ui->ctrlButtonLoadHex->isEnabled())? status |= 0x02: status &= ~0x02;
(ui->ctrlButtonErase->isEnabled())? status |= 0x04: status &= ~0x04;
(ui->ctrlButtonVerify->isEnabled())? status |= 0x08: status &= ~0x08;
(ui->ctrlButtonRunApplication->isEnabled())? status |= 0x10: status &= ~0x10;
(ui->ctrlButtonConnectDevice->isEnabled())? status |= 0x20: status &= ~0x20;
(ui->ctrlButtonEraseProgVerify->isEnabled())? status |= 0x40: status &= ~0x40;
(ui->ctrlButtonBootloaderVer->isEnabled())? status |= 0x80: status &= ~0x80;
}
else
{
// Restore
(status & 0x01)? ui->ctrlButtonProgram->setEnabled(true): ui->ctrlButtonProgram->setEnabled(false);
(status & 0x02)? ui->ctrlButtonLoadHex->setEnabled(true): ui->ctrlButtonLoadHex->setEnabled(false);
(status & 0x04)? ui->ctrlButtonErase->setEnabled(true): ui->ctrlButtonErase->setEnabled(false);
(status & 0x08)? ui->ctrlButtonVerify->setEnabled(true): ui->ctrlButtonVerify->setEnabled(false);
(status & 0x10)? ui->ctrlButtonRunApplication->setEnabled(true): ui->ctrlButtonRunApplication->setEnabled(false);
(status & 0x20)? ui->ctrlButtonConnectDevice->setEnabled(true): ui->ctrlButtonConnectDevice->setEnabled(false);
(status & 0x40)? ui->ctrlButtonEraseProgVerify->setEnabled(true): ui->ctrlButtonEraseProgVerify->setEnabled(false);
(status & 0x80)? ui->ctrlButtonBootloaderVer->setEnabled(true): ui->ctrlButtonBootloaderVer->setEnabled(false);
}
}
/****************************************************************************
* COM check box button clicked.
*
*
*****************************************************************************/
void CPIC32UBLDlg::OnBnClickedCheckComEnable()
{
// TODO: Add your control notification handler code here
// UpdateData(true);
ui->ctrlCheckBoxComEnable->setChecked(true);
ui->ctrlCheckBoxUSBEnable->setChecked(false);
ui->ctrlCheckBoxEthEnable->setChecked(false);
PortSelected = COM;
// Enable serial port selection and baud rate selection.
ui->ctrlComboBoxBaudRate->setEnabled(true);
ui->ctrlComboBoxComPort->setEnabled(true);
// Disable USB VID and PID edit boxes.
ui->ctrlComboBoxVIDPID->setEnabled(false);
// Disable IP Address and Socket
ui->ctrlEditBoxIPaddress->setEnabled(false);
ui->ctrlEditBoxSocketaddress->setEnabled(false);
// UpdateData(false);
}
/****************************************************************************
* USB check box button clicked.
*
*
*****************************************************************************/
void CPIC32UBLDlg::OnBnClickedCheckUsbEnable()
{
// TODO: Add your control notification handler code here
// UpdateData(true);
ui->ctrlCheckBoxUSBEnable->setChecked(true);
ui->ctrlCheckBoxComEnable->setChecked(false);
ui->ctrlCheckBoxEthEnable->setChecked(false);
PortSelected = USB;
// Diasble serial port selection and baud rate selection.
ui->ctrlComboBoxBaudRate->setEnabled(false);
ui->ctrlComboBoxComPort->setEnabled(false);
// Enable USB VID and PID edit boxes.
ui->ctrlComboBoxVIDPID->setEnabled(true);
// Enable IP Address and Socket
ui->ctrlEditBoxIPaddress->setEnabled(false);
ui->ctrlEditBoxSocketaddress->setEnabled(false);
// UpdateData(false);
}
/****************************************************************************
* Ethernet check box button clicked.
*
*
*****************************************************************************/
void CPIC32UBLDlg::OnBnClickedCheckEthEnable()
{
// TODO: Add your control notification handler code here
// UpdateData(true);
ui->ctrlCheckBoxEthEnable->setChecked(true);
ui->ctrlCheckBoxComEnable->setChecked(false);
ui->ctrlCheckBoxUSBEnable->setChecked(false);
PortSelected = ETH;
// Diasble serial port selection and baud rate selection.
ui->ctrlComboBoxBaudRate->setEnabled(false);
ui->ctrlComboBoxComPort->setEnabled(false);
// Enable USB VID and PID edit boxes.
ui->ctrlComboBoxVIDPID->setEnabled(false);
// Enable IP Address and Socket
ui->ctrlEditBoxIPaddress->setEnabled(true);
ui->ctrlEditBoxSocketaddress->setEnabled(true);
// UpdateData(false);
}
/********************************End of file**********************************/