-
Notifications
You must be signed in to change notification settings - Fork 3
/
realterm1.pas
5853 lines (5294 loc) · 181 KB
/
realterm1.pas
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
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
{ Program to capture data from serial port to a file....}
{ To Do:
Freeze overflows. Change to dump when buffer near critical
Stop capture resets display mode
command line for com port and baud rate
Add data auto-synchronise mode
}
{SJB $Date: 2004-02-22 16:20:00+13 $ $Revision: 1.45 $}
unit Realterm1;
{$J+} //D7
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
StdCtrls, AdPort, AdWnPort, AdProtcl, {AdTerm,} AdSocket, ExtCtrls, Spin,
AdStatLt,AdWUtil, {AdIniDB,} adExcept, Paramlst, ComCtrls, ToolWin, Buttons,
checklst, Menus, TrayIcon, PicProgN, PortIO, {verslab,} AFVersionCaption,
ADTrmEmu, OoMisc, Mask, AdSpcEmu, AdPStat, StBase, StWmDCpy, StFirst,
{TVicCommUnit,} StExpr, StVInfo, sc, AppEvnts, AdPacket;
type
TForm1 = class(TForm)
Port1: TApdWinsockPort;
AdEmulator_Plain: TAdVT100Emulator;
Timer1: TTimer;
AdEmulator_Hex: TAdTTYEmulator;
ApdSLController1: TApdSLController;
EchoPort: TApdWinsockPort;
Parameter1: TParameter;
SaveDialog1: TSaveDialog;
StatusBar1: TStatusBar;
PageControl1: TPageControl;
TabSheetDisplay: TTabSheet;
RadioGroupDisplayType: TRadioGroup;
TabSheetPort: TTabSheet;
GroupBoxFrames: TGroupBox;
Label4: TLabel;
SpinEditFrameSize: TSpinEdit;
CheckBoxSingleFrame: TCheckBox;
ButtonGulp1: TButton;
AdTerminal1: TAdTerminal;
GroupBox2: TGroupBox;
StopBitsGroup: TRadioGroup;
ParityGroup: TRadioGroup;
DataBitsGroup: TRadioGroup;
SoftwareFlowGroup: TGroupBox;
Label14: TLabel;
Label15: TLabel;
ReceiveFlowBox: TCheckBox;
TransmitFlowBox: TCheckBox;
XonCharEdit: TEdit;
XoffCharEdit: TEdit;
HardwareFlowGroup: TRadioGroup;
BitBtnSetPort: TBitBtn;
CheckBoxInvertData: TCheckBox;
Pins: TTabSheet;
TabSheetSend: TTabSheet;
Label13: TLabel;
CheckBoxHalfDuplex: TCheckBox;
GroupBoxStatus: TGroupBox;
ApdStatusLightConnected: TApdStatusLight;
LabelConnected: TLabel;
ApdStatusLightRxd: TApdStatusLight;
Label6: TLabel;
ApdStatusLightTXD: TApdStatusLight;
LabelApdStatusTXD: TLabel;
ApdStatusLightCTS: TApdStatusLight;
Label8: TLabel;
ApdStatusLightDCD: TApdStatusLight;
Label10: TLabel;
ApdStatusLightDSR: TApdStatusLight;
Label11: TLabel;
ApdStatusLightBREAK: TApdStatusLight;
Label12: TLabel;
ApdStatusERROR: TApdStatusLight;
LabelApdStatusError: TLabel;
MemoPinNumbers: TMemo;
ApdProtocol1: TApdProtocol;
GroupBoxBinarySync: TGroupBox;
ComboBoxSyncString: TComboBox;
RadioGroupSyncIs: TRadioGroup;
BitBtnChangeBinarySync: TBitBtn;
TabSheetCapture: TTabSheet;
GroupBoxCapture: TGroupBox;
Label1: TLabel;
ButtonCaptureOverwrite: TButton;
ButtonCaptureAppend: TButton;
ButtonCaptureStop: TButton;
CheckBoxDirectCapture: TCheckBox;
ComboBoxSaveFName: TComboBox;
ButtonSaveFName: TButton;
RadioGroupCaptureSizeUnits: TRadioGroup;
OpenDialog1: TOpenDialog;
PanelBaud1: TPanel;
ComboBoxBaud: TComboBox;
Panel2: TPanel;
ComboBoxComPort: TComboBox;
ComboBoxSyncXOR: TComboBox;
ComboBoxSyncAND: TComboBox;
Label16: TLabel;
Label18: TLabel;
TabSheetEcho: TTabSheet;
GroupBoxEchoPort: TGroupBox;
EchoStopBitsGroup: TRadioGroup;
EchoParityGroup: TRadioGroup;
EchoDataBitsGroup: TRadioGroup;
EchoSoftwareFlowGroup: TGroupBox;
Label20: TLabel;
Label21: TLabel;
EchoReceiveFlowBox: TCheckBox;
EchoTransmitFlowBox: TCheckBox;
EchoXonCharEdit: TEdit;
EchoXoffCharEdit: TEdit;
EchoHardwareFlowGroup: TRadioGroup;
BitBtnSetEchoPort: TBitBtn;
Panel3: TPanel;
ComboBoxEchoBaud: TComboBox;
CheckBoxEchoOn: TCheckBox;
ApdStatusLightRI: TApdStatusLight;
Label22: TLabel;
FontDialog1: TFontDialog;
ButtonFont: TButton;
GroupBox7: TGroupBox;
ButtonSetRTS: TButton;
ApdStatusLightRTS: TApdStatusLight;
ButtonClrRTS: TButton;
GroupBox4: TGroupBox;
ButtonSetDTR: TButton;
ApdStatusLightDTR: TApdStatusLight;
ButtonClearDTR: TButton;
GroupBox8: TGroupBox;
ButtonSetBreak: TButton;
ButtonClearBreak: TButton;
Button500msBreak: TButton;
CheckBoxBigEndian: TCheckBox;
GroupBox10: TGroupBox;
Label24: TLabel;
ComboBoxTraceFName: TComboBox;
ButtonTraceFName: TButton;
CheckBoxTrace: TCheckBox;
CheckBoxLog: TCheckBox;
ProgressBarCapture: TProgressBar;
ComboBoxCaptureSize: TComboBox;
TrayIcon1: TTrayIcon;
PopupMenu1: TPopupMenu;
MenuItemTitle: TMenuItem;
MenuItemPort: TMenuItem;
MenuItemShow: TMenuItem;
MenuItemClose: TMenuItem;
MenuItemCapture: TMenuItem;
N1: TMenuItem;
N2: TMenuItem;
SpeedButtonPort1Open: TSpeedButton;
MenuItemBaud: TMenuItem;
PicProg: TPicPN;
Panel4: TPanel;
ComboBoxEchoPort: TComboBox;
Label19: TLabel;
ApdSLControllerEcho: TApdSLController;
LabelEchoConnected: TLabel;
ApdStatusLightEchoConnected: TApdStatusLight;
ApdStatusLightEchoTXD: TApdStatusLight;
Label25: TLabel;
ApdStatusLightEchoRXD: TApdStatusLight;
Label26: TLabel;
N3: TMenuItem;
MenuItemEcho: TMenuItem;
GroupBoxWSRetry: TGroupBox;
SpinEditTelnetRetryPeriod: TSpinEdit;
TabSheetI2C: TTabSheet;
LabelI2CChip: TLabel;
AFVersionCaption1: TAFVersionCaption;
HideControls1: TMenuItem;
CheckBoxEchoPortMonitoring: TCheckBox;
PanelFloatingButtons: TPanel;
ButtonFreeze: TButton;
ButtonClear: TButton;
SpinEditTerminalRows: TSpinEdit;
Label2: TLabel;
RadioGroupBusNum: TRadioGroup;
ButtonIStart: TButton;
ButtonIStop: TButton;
ButtonIRead: TButton;
SpinEditIBytes2Read: TSpinEdit;
Label3: TLabel;
ButtonIGetStatus: TButton;
ButtonIQueryPins: TButton;
ButtonNewLine: TButton;
CheckBoxNewLine: TCheckBox;
GroupBox1: TGroupBox;
ComboBoxSend1: TComboBox;
ButtonSendNumbers1: TButton;
ButtonSendAscii1: TButton;
ButtonSendAscii2: TButton;
GroupBoxEOL: TGroupBox;
CheckBoxCR1: TCheckBox;
CheckBoxLF1: TCheckBox;
CheckBoxCR2: TCheckBox;
CheckBoxLF2: TCheckBox;
ComboBoxSend2: TComboBox;
SpinEditNumTimesToSend: TSpinEdit;
BitBtnCancelSend: TBitBtn;
CheckBoxStripSpaces: TCheckBox;
ButtonSendNumbers2: TButton;
Label17: TLabel;
StWMDataCopy1: TStWMDataCopy;
ParameterRemote: TParameter;
ButtonSMBusAlert: TButton;
ButtonI2CGCAReset: TButton;
TabsheetMISC: TTabSheet;
MenuItemSend: TMenuItem;
MenuItemSendString1: TMenuItem;
EditSendNumeric: TEdit;
ButtonSend0: TButton;
ButtonSend3: TButton;
GroupBoxGPIB: TGroupBox;
ButtonGPIBCtrlC: TButton;
ButtonGPIBSetup: TButton;
ButtonGPIBRST: TButton;
ButtonGPIBIDN: TButton;
ButtonGPIBERR: TButton;
ButtonGPIBTST: TButton;
GroupBoxPP: TGroupBox;
SpeedButtonPower: TSpeedButton;
ApdStatusLightRB7: TApdStatusLight;
Label23: TLabel;
ButtonReset1: TButton;
ButtonReset2: TButton;
ButtonResetBoth: TButton;
SpinEditLPT: TSpinEdit;
ButtonOpenLPT: TButton;
SpeedButtonSpy1: TSpeedButton;
CheckBoxLiteralStrings: TCheckBox;
GroupBoxIAddress: TGroupBox;
SpinEditISubAddress: TSpinEdit;
Label31: TLabel;
CheckBoxCRC: TCheckBox;
GroupBoxSignalWsConnect: TGroupBox;
CheckBoxSignalWsWithDTR: TCheckBox;
CheckBoxSignalWsWithRTS: TCheckBox;
GroupBoxNL: TGroupBox;
CheckBoxNLBefore: TCheckBox;
CheckBoxNLAfter: TCheckBox;
N4: TMenuItem;
MenuItemCopyTerminal: TMenuItem;
MenuItemPasteTerminal: TMenuItem;
GroupBoxIWrite: TGroupBox;
ButtonIWrite: TButton;
EditIData2Write: TEdit;
StExpressionEditIW: TStExpressionEdit;
ButtonIWByte: TButton;
ButtonIWWordBE: TButton;
ButtonIWWordLE: TButton;
ButtonIWAscii: TButton;
CheckBoxIWCompactAscii: TCheckBox;
ButtonIWClear: TButton;
ButtonIWrite00: TButton;
ButtonIWriteFF: TButton;
ButtonIWBit: TButton;
ButtonIWNotBit: TButton;
ButtonIWBitClear: TButton;
SpeedButtonIWBit7: TSpeedButton;
SpeedButtonIWBit6: TSpeedButton;
SpeedButtonIWBit5: TSpeedButton;
SpeedButtonIWBit4: TSpeedButton;
SpeedButtonIWBit3: TSpeedButton;
SpeedButtonIWBit2: TSpeedButton;
SpeedButtonIWBit1: TSpeedButton;
SpeedButtonIWBit0: TSpeedButton;
RadioGroupWsTelnet: TRadioGroup;
TimerSendFile: TTimer;
CommSpy1: TetaSerialCop;
CheckBoxClearTerminalOnDisplayChange: TCheckBox;
CheckBoxClearTerminalOnPortChange: TCheckBox;
CheckboxScrollback: TCheckBox;
Help1: TMenuItem;
TabSheetI2CMisc: TTabSheet;
GroupBox3: TGroupBox;
ButtonI2CSend2M5451D4: TButton;
EditI2CDigits: TEdit;
ButtonM5451Clear: TButton;
GroupBox6: TGroupBox;
ButtonIRead1WireID: TButton;
GroupBoxSensirion: TGroupBox;
ButtonSHTReadTemp: TButton;
ButtonSHTReadHumidity: TButton;
ButtonSHTClear: TButton;
CheckBoxSHTCRC: TCheckBox;
ButtonSHTReadStatus: TButton;
ButtonSHTSoftReset: TButton;
CheckboxSHTWrHideAck: TCheckBox;
ButtonSHTWriteStatus: TButton;
EditSHTStatus: TEdit;
CheckBoxTraceHex: TCheckBox;
CheckBoxLogHex: TCheckBox;
ButtonIWriteThenRead: TButton;
SpinEditIBytes2Read2: TSpinEdit;
Label5: TLabel;
LabeledEditIWriteB4Data: TLabeledEdit;
TabSheetI2C2: TTabSheet;
GroupBoxBL301: TGroupBox;
ButtonBL301WriteAscii2LCD: TButton;
ButtonBL301InitLCD: TButton;
ButtonBL301SetContrast: TButton;
ButtonBL301SetLeds: TButton;
ButtonBL301ReadSwitches: TButton;
SpinEditBL301Contrast: TSpinEdit;
SpeedButtonBL301Leds7: TSpeedButton;
SpeedButtonBL301Leds6: TSpeedButton;
SpeedButtonBL301Leds5: TSpeedButton;
SpeedButtonBL301Leds4: TSpeedButton;
SpeedButtonBL301Leds3: TSpeedButton;
SpeedButtonBL301Leds2: TSpeedButton;
SpeedButtonBL301Leds1: TSpeedButton;
SpeedButtonBL301Leds0: TSpeedButton;
ComboBoxIWAscii: TComboBox;
CheckBoxIWAsciiLiteral: TCheckBox;
ComboBoxBL301Ascii: TComboBox;
SpeedButtonBL301ClearLedButtons: TSpeedButton;
CheckBoxBL301AsciiLiteral: TCheckBox;
GroupBoxaSC7511: TGroupBox;
Button1: TButton;
Button2: TButton;
Button3: TButton;
Button4: TButton;
Button5: TButton;
Label9: TLabel;
Label27: TLabel;
GroupBoxSPI: TGroupBox;
ButtonSpiCSInit: TButton;
ButtonSpiCS00: TButton;
ButtonSpiCS01: TButton;
ButtonSpiCS11: TButton;
ButtonSpiCS10: TButton;
ApdStatusLightEchoCTS: TApdStatusLight;
ApdStatusLightEchoDSR: TApdStatusLight;
Label28: TLabel;
Label32: TLabel;
ApdStatusLightEchoDCD: TApdStatusLight;
Label33: TLabel;
ApdStatusLightEchoBreak: TApdStatusLight;
Label34: TLabel;
ButtonIRead1WireDS1820: TButton;
SpinEditScrollbackRows: TSpinEdit;
GroupBoxSendFile: TGroupBox;
LabelRepeats: TLabel;
LabelProtocolError: TLabel;
ProgressBarSendFile: TProgressBar;
ComboBoxSendFName: TComboBox;
ButtonSendFName: TButton;
ButtonSendFile: TButton;
BitBtnAbortSendFile: TBitBtn;
SpinEditAsciiCharDelay: TSpinEdit;
SpinEditAsciiLineDelay: TSpinEdit;
SpinEditFileSendDelay: TSpinEdit;
SpinEditFileSendRepeats: TSpinEdit;
PanelSpecialCapture: TPanel;
CheckBoxCaptureAsHex: TCheckBox;
RadioGroupTimeStamp: TRadioGroup;
GroupBoxPCA9544: TGroupBox;
RadioGroupPCA9544BusNum: TRadioGroup;
ButtonPCA9544Status: TButton;
Label35: TLabel;
ButtonWriteTranslatorLogFile: TButton;
ComboBoxIAddress: TComboBox;
ButtonChangeTraceFName: TButton;
ButtonClearTraceLog: TButton;
ButtonDumpTraceLog: TButton;
GroupBoxBlueSMiRF: TGroupBox;
ButtonBSEnterAT: TButton;
ButtonBSExitAT: TButton;
ButtonBSFastMode: TButton;
ComboBoxBSBaud: TComboBox;
ButtonBSBaud: TButton;
ButtonBSRSSI: TButton;
ButtonBSPark: TButton;
ButtonSendLF: TButton;
GroupBoxMAX127: TGroupBox;
RadioGroupMax127Range: TRadioGroup;
ButtonMax127Read: TButton;
SpinEditTerminalCols: TSpinEdit;
Label36: TLabel;
TimerCallback: TTimer;
RadioGroupTimeStampDelimiter: TRadioGroup;
ApdDataPacket1: TApdDataPacket;
TabSheetEvents: TTabSheet;
RadioGroupSendEvent: TRadioGroup;
LabelLastEvent: TLabel;
GroupBoxDataTrigger: TGroupBox;
ApdStatusLightDataTrigger: TApdStatusLight;
ButtonEditDataTrigger1: TButton;
CheckBoxDataTrigger1: TCheckBox;
ButtonBSQueryBaud: TButton;
ComboBoxBaudMult: TComboBox;
ButtonBL301MAscii: TButton;
SpinEditBL301MNumDisplay: TSpinEdit;
ComboBoxBL301MString: TComboBox;
ButtonBL301MInit: TButton;
RadioGroupEchoWsTelnet: TRadioGroup;
ComboBoxCRC: TComboBox;
GroupBox5: TGroupBox;
ButtonPCA9545Status: TButton;
GroupBox9: TGroupBox;
CheckBox9545_Bus0: TCheckBox;
CheckBox9545_Bus1: TCheckBox;
CheckBox9545_Bus2: TCheckBox;
CheckBox9545_Bus3: TCheckBox;
C1: TMenuItem;
SendBreak1: TMenuItem;
ButtonI2CTestM5451: TButton;
CheckBoxI2CM5451_Color: TCheckBox;
CheckBoxLeadingSync: TCheckBox;
Label7: TLabel;
ButtonPopupMenu: TButton;
SpeedButton1: TSpeedButton;
Label37: TLabel;
Label38: TLabel;
CheckBoxDisplayTimeStamp: TCheckBox;
GroupBoxAddCannedString: TGroupBox;
EditCannedStringTitle: TEdit;
EditCannedStringContents: TEdit;
ButtonAddCannedString: TButton;
GroupBoxBitBash: TGroupBox;
ButtonBL233_BitBashIdle: TButton;
SpeedButtonP7: TSpeedButton;
SpeedButtonP6: TSpeedButton;
SpeedButtonP5: TSpeedButton;
SpeedButtonP4: TSpeedButton;
SpeedButtonP3: TSpeedButton;
SpeedButtonP2: TSpeedButton;
SpeedButtonP1: TSpeedButton;
SpeedButtonP0: TSpeedButton;
Label39: TLabel;
ButtonBL233ReadPins: TButton;
EditCannedStringShortcut: TEdit;
LabelSyncCount: TLabel;
Label40: TLabel;
GroupBoxColors: TGroupBox;
EditColors: TEdit;
ButtonScanBus: TButton;
PopupMenuI2CControlRegister: TPopupMenu;
MenuItemCR7: TMenuItem;
MenuItemCR6: TMenuItem;
MenuItemCR5: TMenuItem;
MenuItemCR4: TMenuItem;
MenuItemCR3: TMenuItem;
MenuItemCR2: TMenuItem;
MenuItemCR1: TMenuItem;
MenuItemCR0: TMenuItem;
GroupBoxI2CControlRegister2: TGroupBox;
CheckBox1: TCheckBox;
CheckBox2: TCheckBox;
CheckBox3: TCheckBox;
CheckBox4: TCheckBox;
CheckBox5: TCheckBox;
CheckBox6: TCheckBox;
CheckBox7: TCheckBox;
CheckBox8: TCheckBox;
GroupBoxI2CControlRegister: TGroupBox;
CheckBoxMenuItemCR7: TCheckBox;
CheckBoxMenuItemCR1: TCheckBox;
ButtonI2CCRMore: TButton;
abc1: TMenuItem;
MenuItemCRDefault: TMenuItem;
Function1: TMenuItem;
N5: TMenuItem;
TabSheetI2CMem: TTabSheet;
GroupBox11: TGroupBox;
Edit1: TEdit;
Edit2: TEdit;
SpinEditIMWriteTime: TSpinEdit;
Label41: TLabel;
SpinEdit1: TSpinEdit;
Label42: TLabel;
Label43: TLabel;
Button6: TButton;
SpinEditMax127Channel: TSpinEdit;
Label44: TLabel;
ButtonShowEventsTab: TButton;
StatusBarFormattedData: TStatusBar;
SpeedButtonShowFormattedData: TSpeedButton;
GroupBoxHexCSV: TGroupBox;
Label29: TLabel;
ComboBoxHexCSVFormat: TComboBox;
RadioGroupHexCSVTerminalShows: TRadioGroup;
PopupMenuHexCSVFormat: TPopupMenu;
Clear1: TMenuItem;
uUnsignedBigendian1: TMenuItem;
sSignedBigendian1: TMenuItem;
fFloatBigendian1: TMenuItem;
gFloatlittleendian1: TMenuItem;
dBCDLiteralDecimal1: TMenuItem;
bBinary1: TMenuItem;
aASCII1: TMenuItem;
vUnsignedLittleendian1: TMenuItem;
tSignedLittleEndian1: TMenuItem;
ButtonHexCSVFormat: TButton;
N6: TMenuItem;
N7: TMenuItem;
N8: TMenuItem;
HexCSVFormatCharacters1: TMenuItem;
RadioGroupHexCSVStatusShows: TRadioGroup;
LabeledEditDataTriggerLastString1: TLabeledEdit;
CheckBoxMaskMSB: TCheckBox;
Panel1: TPanel;
GroupBox12: TGroupBox;
GroupBox13: TGroupBox;
procedure ButtonCaptureOverwriteClick(Sender: TObject);
procedure ButtonCaptureAppendClick(Sender: TObject);
procedure ButtonCaptureStopClick(Sender: TObject);
{procedure AdEmulator_PlainProcessCharOld(CP: TObject; C: Char;
var Command: TEmuCommand);}
procedure Timer1Timer(Sender: TObject);
procedure RadioGroupDisplayTypeClick(Sender: TObject);
{procedure AdEmulator_HexProcessCharOld(CP: TObject; C: Char;
var Command: TEmuCommand);}
procedure SpinEditFrameSizeChange(Sender: TObject);
procedure ButtonFreezeClick(Sender: TObject);
procedure SetPortClick(Sender: TObject);
procedure Port1WsConnect(Sender: TObject);
procedure Port1WsDisconnect(Sender: TObject);
procedure FormClose(Sender: TObject; var Action: TCloseAction);
procedure FormActivate(Sender: TObject);
procedure Port1WsAccept(Sender: TObject; Addr: TInAddr;
var Accept: Boolean);
procedure CheckBoxSingleFrameClick(Sender: TObject);
procedure ButtonGulp1Click(Sender: TObject);
procedure ComboBoxCaptureSizeChange(Sender: TObject);
procedure ParameterParamMatch(Sender: TObject; CaseMatch: Boolean;
Param, Reference: String);
procedure FormCreate(Sender: TObject);
procedure BitBtnSetPortClick(Sender: TObject);
procedure CheckBoxInvertDataClick(Sender: TObject);
procedure ButtonSetRTSClick(Sender: TObject);
procedure ButtonClrRTSClick(Sender: TObject);
procedure ButtonSetDTRClick(Sender: TObject);
procedure ButtonClearDTRClick(Sender: TObject);
procedure Button500msBreakClick(Sender: TObject);
procedure ButtonSendAscii1Click(Sender: TObject);
procedure ButtonSendAscii2Click(Sender: TObject);
procedure CheckBoxHalfDuplexClick(Sender: TObject);
procedure ButtonSetBreakClick(Sender: TObject);
procedure ButtonClearBreakClick(Sender: TObject);
procedure ButtonSendFileClick(Sender: TObject);
procedure BitBtnAbortSendFileClick(Sender: TObject);
procedure SpinEditLPTChange(Sender: TObject);
procedure BitBtnChangeBinarySyncClick(Sender: TObject);
procedure ButtonSendNumbers1Click(Sender: TObject);
procedure ButtonSendNumbers2Click(Sender: TObject);
procedure ButtonSaveFNameClick(Sender: TObject);
procedure ButtonSendFNameClick(Sender: TObject);
procedure Button16Click(Sender: TObject);
procedure Button17Click(Sender: TObject);
procedure SpeedButtonPowerClick(Sender: TObject);
procedure ButtonResetBothClick(Sender: TObject);
procedure ButtonReset1Click(Sender: TObject);
procedure ButtonReset2Click(Sender: TObject);
procedure PortTriggerAvail(CP: TObject; Count: Word);
procedure EchoPortWsAccept(Sender: TObject; Addr: TInAddr;
var Accept: Boolean);
procedure BitBtnSetEchoPortClick(Sender: TObject);
procedure CheckBoxEchoOnClick(Sender: TObject);
procedure ButtonFontClick(Sender: TObject);
procedure CheckBoxBigEndianClick(Sender: TObject);
procedure CheckBoxTraceClick(Sender: TObject);
procedure CheckBoxLogClick(Sender: TObject);
procedure ComboBoxTraceFNameChange(Sender: TObject);
procedure ButtonTraceFNameClick(Sender: TObject);
procedure ButtonOpenLPTClick(Sender: TObject);
procedure MenuItemShowClick(Sender: TObject);
procedure MenuItemCloseClick(Sender: TObject);
procedure TrayIcon1Click(Sender: TObject);
procedure MenuItemCaptureClick(Sender: TObject);
procedure MenuItemPortClick(Sender: TObject);
procedure SpeedButtonPort1OpenClick(Sender: TObject);
procedure Hide1Click(Sender: TObject);
procedure FormResize(Sender: TObject);
procedure EchoPortWsDisconnect(Sender: TObject);
procedure EchoPortWsConnect(Sender: TObject);
procedure EchoPortTrigger(CP: TObject; Msg, TriggerHandle, Data: Word);
procedure Port1TriggerCaptureWrite(CP: TObject; Msg, TriggerHandle, Data: Word);
procedure Port1TriggerEchoOut(CP: TObject; Msg, TriggerHandle, Data: Word);
procedure MenuItemEchoClick(Sender: TObject);
procedure ApdProtocol1ProtocolFinish(CP: TObject; ErrorCode: Integer);
procedure ApdProtocol1ProtocolStatus(CP: TObject; Options: Word);
procedure HideControls1Click(Sender: TObject);
procedure SpinEditAsciiCharDelayChange(Sender: TObject);
procedure SpinEditAsciiLineDelayChange(Sender: TObject);
procedure AdEmulator_PlainProcessChar(Sender: TObject; Character: Char;
var ReplaceWith: String; Commands: TAdEmuCommandList;
CharSource: TAdCharSource);
//procedure AdEmulator_HexProcessChar(Sender: TObject; C: Char;
// var ReplaceWith: String; Commands: TAdEmuCommandList;
// CharSource: TAdCharSource);
procedure AdEmulator_ShowAllProcessChar(Sender: TObject;
Character: Char; var ReplaceWith: String; Commands: TAdEmuCommandList;
CharSource: TAdCharSource);
procedure CheckBoxEchoPortMonitoringClick(Sender: TObject);
procedure ButtonClearClick(Sender: TObject);
procedure SpinEditTerminalRowsChange(Sender: TObject);
procedure AdTerminal1Click(Sender: TObject);
procedure RadioGroupBusNumClick(Sender: TObject);
procedure ButtonIStartClick(Sender: TObject);
procedure ButtonIStopClick(Sender: TObject);
procedure ButtonIReadClick(Sender: TObject);
procedure ButtonIRead1WireIDClick(Sender: TObject);
procedure ButtonIGetStatusClick(Sender: TObject);
procedure ButtonIWriteClick(Sender: TObject);
procedure ButtonIQueryPinsClick(Sender: TObject);
procedure ButtonNewLineClick(Sender: TObject);
procedure CheckBoxNewLineClick(Sender: TObject);
procedure SpinEditFileSendRepeatsChange(Sender: TObject);
procedure StWMDataCopy1DataReceived(Sender: TObject;
//D3 CopyData: TCopyDataStruct);
CopyData: tagCopyDataStruct);
procedure TrayIcon1RightClick(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
// procedure ButtonKReadAllClick(Sender: TObject);
procedure FontDialog1Apply(Sender: TObject; Wnd: HWND);
//D3 procedure FontDialog1Apply(Sender: TObject; Wnd: Integer);
procedure ApdProtocol1ProtocolError(CP: TObject; ErrorCode: Integer);
procedure ButtonSMBusAlertClick(Sender: TObject);
procedure ButtonI2CGCAResetClick(Sender: TObject);
procedure ButtonI2CSend2M5451D4Click(Sender: TObject);
procedure ButtonGPIBCtrlCClick(Sender: TObject);
procedure ButtonGPIBSetupClick(Sender: TObject);
procedure ButtonGPIBRSTClick(Sender: TObject);
procedure ButtonGPIBIDNClick(Sender: TObject);
procedure ButtonGPIBERRClick(Sender: TObject);
procedure ButtonSend0Click(Sender: TObject);
procedure ButtonSend3Click(Sender: TObject);
procedure EditSendNumericChange(Sender: TObject);
procedure MenuItemSendStringClick(Sender: TObject);
procedure ButtonGPIBTSTClick(Sender: TObject);
procedure SpeedButtonSpy1Click(Sender: TObject);
{ procedure VicCommSpy1Received(ComNumber: Byte; sValue: String);
procedure VicCommSpy1Sent(ComNumber: Byte; sValue: String);
} procedure TerminalNewLine;
procedure MenuItemCopyTerminalClick(Sender: TObject);
procedure MenuItemPasteTerminalClick(Sender: TObject);
procedure IWrite(S:string);
procedure IRead(BytesToRead:byte);
procedure ButtonIWrite00Click(Sender: TObject);
procedure ButtonIWriteFFClick(Sender: TObject);
procedure ButtonM5451ClearClick(Sender: TObject);
procedure ButtonIWAsciiClick(Sender: TObject);
procedure ButtonIWClearClick(Sender: TObject);
procedure ButtonIWByteClick(Sender: TObject);
procedure ButtonIWWordBEClick(Sender: TObject);
procedure ButtonIWWordLEClick(Sender: TObject);
procedure ButtonIWBitClearClick(Sender: TObject);
procedure ButtonIWBitClick(Sender: TObject);
procedure ButtonIWNotBitClick(Sender: TObject);
procedure RadioGroupWsTelnetClick(Sender: TObject);
procedure ComboBoxComPortDblClick(Sender: TObject);
procedure TimerCallbackTimer(Sender: TObject);
procedure TimerSendFileTimer(Sender: TObject);
procedure CommSpy1Received(CommIndex: Byte; Data: String;
Info: Cardinal);
procedure CommSpy1Sent(CommIndex: Byte; Data: String;
Info: Cardinal);
procedure CheckboxScrollbackClick(Sender: TObject);
procedure LabelHTMLClick(Sender: TObject);
procedure Help1Click(Sender: TObject);
procedure ButtonSHTReadTempClick(Sender: TObject);
procedure ButtonSHTClearClick(Sender: TObject);
procedure ButtonSHTReadHumidityClick(Sender: TObject);
procedure ButtonSHTReadStatusClick(Sender: TObject);
procedure ButtonSHTSoftResetClick(Sender: TObject);
procedure ButtonSHTWriteStatusClick(Sender: TObject);
procedure CheckBoxTraceHexClick(Sender: TObject);
procedure CheckBoxLogHexClick(Sender: TObject);
procedure ButtonIWriteThenReadClick(Sender: TObject);
procedure ButtonBL301WriteAscii2LCDClick(Sender: TObject);
procedure ButtonBL301InitLCDClick(Sender: TObject);
procedure SpeedButtonBL301ClearLedButtonsClick(Sender: TObject);
procedure ButtonBL301SetContrastClick(Sender: TObject);
procedure ButtonBL301SetLedsClick(Sender: TObject);
procedure ButtonBL301ReadSwitchesClick(Sender: TObject);
procedure Button1Click(Sender: TObject);
procedure Button2Click(Sender: TObject);
procedure Button3Click(Sender: TObject);
procedure Button4Click(Sender: TObject);
procedure Button5Click(Sender: TObject);
procedure Port1TriggerAvail(CP: TObject; Count: Word);
procedure ButtonSpiCSInitClick(Sender: TObject);
procedure ButtonSpiCS00Click(Sender: TObject);
procedure ButtonSpiCS01Click(Sender: TObject);
procedure ButtonSpiCS10Click(Sender: TObject);
procedure ButtonSpiCS11Click(Sender: TObject);
procedure ButtonIRead1WireDS1820Click(Sender: TObject);
procedure SpinEditScrollbackRowsChange(Sender: TObject);
procedure RadioGroupPCA9544BusNumClick(Sender: TObject);
procedure ButtonPCA9544StatusClick(Sender: TObject);
procedure ButtonWriteTranslatorLogFileClick(Sender: TObject);
procedure TabSheetI2CShow(Sender: TObject);
procedure ButtonChangeTraceFNameClick(Sender: TObject);
procedure ButtonClearTraceLogClick(Sender: TObject);
procedure ButtonDumpTraceLogClick(Sender: TObject);
procedure ButtonUser1Click(Sender: TObject);
function FormHelp(Command: Word; Data: Integer;
var CallHelp: Boolean): Boolean;
procedure ButtonBSEnterATClick(Sender: TObject);
procedure ButtonBSExitATClick(Sender: TObject);
procedure ButtonBSFastModeClick(Sender: TObject);
procedure ButtonBSBaudClick(Sender: TObject);
procedure ButtonBSRSSIClick(Sender: TObject);
procedure ButtonBSParkClick(Sender: TObject);
procedure ButtonSendLFClick(Sender: TObject);
procedure ButtonMax127ReadClick(Sender: TObject);
procedure RadioGroupSendEventClick(Sender: TObject);
procedure SpinEditTerminalColsChange(Sender: TObject);
procedure CheckBoxDirectCaptureClick(Sender: TObject);
procedure ButtonEditDataTrigger1Click(Sender: TObject);
procedure CheckBoxDataTrigger1Click(Sender: TObject);
procedure ApdDataPacket1Packet(Sender: TObject; Data: Pointer;
Size: Integer);
procedure StatusBar1DblClick(Sender: TObject);
procedure ButtonBL233_BitBashIdleClick(Sender: TObject);
procedure ApdDataPacket1Timeout(Sender: TObject);
procedure ButtonBSQueryBaudClick(Sender: TObject);
procedure LabelApdStatusErrorDblClick(Sender: TObject);
procedure LabelApdStatusTXDDblClick(Sender: TObject);
procedure PanelBaud1DblClick(Sender: TObject);
procedure ButtonBL301MAsciiClick(Sender: TObject);
procedure ButtonBL301MInitClick(Sender: TObject);
procedure RadioGroupEchoWsTelnetClick(Sender: TObject);
procedure CheckBoxCRCClick(Sender: TObject);
procedure ButtonPCA9545StatusClick(Sender: TObject);
procedure CheckBox9545_BusXClick(Sender: TObject);
procedure SendBreak1Click(Sender: TObject);
procedure C1Click(Sender: TObject);
procedure ButtonI2CTestM5451Click(Sender: TObject);
procedure CheckBoxI2CM5451_ColorClick(Sender: TObject);
procedure ButtonTerminalEnableClick(Sender: TObject);
procedure ButtonTerminalActiveClick(Sender: TObject);
procedure ButtonPopupMenuClick(Sender: TObject);
procedure ButtonAddCannedStringClick(Sender: TObject);
procedure SpeedButtonP0Click(Sender: TObject);
procedure ButtonBL233ReadPinsClick(Sender: TObject);
procedure LabelSyncCountClick(Sender: TObject);
procedure EditColorsChange(Sender: TObject);
procedure ButtonScanBusClick(Sender: TObject);
procedure ButtonI2CCRMoreClick(Sender: TObject);
procedure CheckBoxMenuItemCR7Click(Sender: TObject);
procedure CheckBoxMenuItemCR1Click(Sender: TObject);
procedure PopupMenuI2CControlRegisterChange(Sender: TObject;
Source: TMenuItem; Rebuild: Boolean);
procedure MenuItemCRClick(Sender: TObject);
procedure MenuItemCRDefaultClick(Sender: TObject);
procedure ButtonShowEventsTabClick(Sender: TObject);
procedure SpeedButtonShowFormattedDataClick(Sender: TObject);
procedure ButtonHexCSVFormatClick(Sender: TObject);
procedure ComboBoxHexCSVFormatDblClick(Sender: TObject);
procedure HexCSVFormatChars1Click(Sender: TObject);
procedure Clear1Click(Sender: TObject);
procedure RadioGroupHexCSVTerminalShowsClick(Sender: TObject);
procedure RadioGroupHexCSVStatusShowsClick(Sender: TObject);
procedure CheckBoxMaskMSBClick(Sender: TObject);
//procedure CheckBox9545_AllOffClick(Sender: TObject);
private
{ Private declarations }
CaptureStopTime:TDateTime;
CaptureAutoQuit:boolean; //quit program when capture is done
SpyModeAutoStart:Boolean; //automatically starts SPY mode.
LastCharCount:Cardinal;
fCharCount:cardinal;
fEchoPortConnected:boolean; //as telnet ports can be open, but not connected to anything
CaptureAutostart :TAdCaptureMode; //triggers immediate capture after startup
Color4Keyboard: TColor;
Color4Port: TColor;
Color4WriteChar: TColor;
Color4SpyTx : TColor;
Color4SpyRx : TColor;
// SendStringAutostartString:string; //sends the string immediately after start
SendFileAutostart:boolean;
SendFileAutoQuit:boolean; //quit program when sendfile is done
// QuitNow:boolean; //makes timer routine close the program
SendFileCounter:cardinal;
PendingInvisible:boolean;
PendingHelp:boolean;
Port1Changed:boolean;
EchoPortChanged:boolean;
AdShowAllEmulator : TAdTTYEmulator;
CannedStrings: TStringlist;
// DataTriggerCount:integer;
IsCurrentDataTrigger:boolean;
DataTriggerLightTimer:integer;
FirstAvailablePort:word; //0 for none/not searched
// LastDataTriggerCount:integer;
// SuppressPortScan:boolean;
// PortScanLastPort:integer;
// PortScanLastPortOnStartup:integer;
procedure CaptureButtonsEnable(Enabled:boolean);
procedure ShowSerialStatus(ForceShow:boolean);
procedure UpdateTrayIcon(Name:string);
procedure OptimiseTerminalWidth(N:integer);
procedure SetDisplayWidth;
// procedure Port1Trigger(CP: TObject; Msg, TriggerHandle, Data: Word);
procedure SetCharCount(CC: cardinal); //keeps last<=current
procedure IncCharCount(Increment:cardinal); //always safely wraps to 0
procedure SendString(S:string); //sends a string
procedure SendTabSendString(S:string); //sends string, controlled by SendTab global controls: CRC, Repeats etc
procedure SendASCIIString(S:string;AppendCR,AppendLF,StripSpaces:boolean); //sends a string, appending CRLF as chosen, a number of times
procedure SendTabSendASCIIString(S:string;AppendCR,AppendLF,StripSpaces:boolean);
procedure PositionFloatingButtons;
// procedure Send2KCDXO(Add,Command,Data:string);
procedure SetHalfDuplex(State:boolean); //wrapper for setting terminal HD
procedure PopulateComNumbers(LastComport:integer; ShowForm:boolean); //shell chooses between two methods depending on Window version
procedure PopulateComNumbersFromRegistry(LastComport:integer; ShowForm:boolean);
procedure PopulateComNumbersBySearch(LastComport:integer; ShowForm:boolean);
procedure Port1PutChar(C:char);
procedure Port1PutString(S:string);
procedure SendCannedString(Index:integer); //index is 0 based
procedure AddCannedString(AsText, AsChars :string); //adds a canned string to the list if new
procedure SetPortAndBaudCaptions; //writes menu and statusbar strings.
procedure SetComPortClick(Sender: TObject); //changes the comport
procedure SpyModeOpen(Open:boolean); //programatically enter start mode.
procedure SignalWsConnectedThroughRTSDTR(Connected:boolean; OtherPort:TApdWinsockPort);
function IWBitValue:byte;
procedure IWriteThenRead(WriteData:string;BytesToRead:byte);
procedure ItemIndexToHWFlowOptions(ItemIndex:integer;Port:TApdWinsockPort);
procedure SHT(S:string);
function BL301LEDBitValue: byte;
procedure SpiCSButtonClick(Sender:TObject; CommandStr:string);
procedure SetDataTriggerLight;
function ICRBitValue:byte;
procedure SpyOpen(State:boolean);
function SpyDriversInstalled:boolean; //detect an install of the driver, using the Realterm driver installer.
procedure ShowHideStatusBarFormattedData;
procedure InvertAndMaskChars(Character: char; var ReplaceWith:String);
public
CaptureMode:TAdCaptureMode;
IsCapturing:boolean;
IsSendingFile:boolean;
CaptureSize:integer;
CaptureTime:integer; //seconds
CaptureTimeLeft:integer; //seconds
CaptureCountForCallback:integer;
CPS:cardinal;
QuitNow:boolean; //makes timer routine close the program
property CharCount : cardinal read fCharCount write SetCharCount;
procedure StartCapture(CaptureMode: TAdCaptureMode);
procedure StopCapture;
function SelectTabSheet(TabCaption:string):boolean;
//procedure Set_ComPort(Com:TApdWinsockPort; const Value: WideString);
procedure DisplayHint(Sender: TObject);
procedure SetTerminalCharColor(Sender:TObject;CharSource:TADCharSource);
procedure SetColors(ColorString:string);
{ Public declarations }
end;
var
Form1: TForm1;
const
StatusBarPanelHints=0;
StatusBarPanelCharCount=1;
StatusBarPanelCPS=2;
StatusBarPanelEnd=3;
PortScanLastPort:integer=MaxComHandles;
PortScanLastPortOnStartup:integer=MaxComHandles;
procedure SetGroupItemByString(Value:String; RadioGroup:TRadioGroup);
//procedure ComboBoxPutStringAtTop(CB:TComboBox; MaxLength:integer);
procedure ComboBoxPushString(CB:TComboBox; S:string; Maxlength:Integer);
implementation
uses gnugettext, RealtermIntf,Ststrs,Ststrl,StUtils,math,ComServ, adSelCom, Registry,
M545X, EscapeString, ModbusCRC{, gnugettextD5},SpyNagDialog, ShellApi,
RTAboutBox, D6OnHelpFix, DateUtils, ScanPorts, AdPackEd, StrUtils, CRC8, HexEmulator,
Checksums, I2Cx, ComportFinder;
{$R *.DFM}
const CRLF=chr(13)+chr(10);
var F: file;
Block : array[0..1023] of Char;
TimerHandle : word;
CurrentEmulator : TAdTerminalEmulator;
// KAdjustingF0:boolean; //set while F0 is being adjusted
SaveOnTrigger:TTriggerEvent; //save port trigger handler during direct capture
NoNagAboutSpy:boolean;
PlainCapture:boolean;
TimeStampDelimiter:char;
var HexEmulator : THexEmulator;
const Capturing:boolean=false;
//interlocks the capture buttons
procedure SetGroupItemByString(Value:String; RadioGroup:TRadioGroup);
var i:integer;
ThisItem:string;
begin
Value:=uppercase(Value);
for i:=0 to RadioGroup.ControlCount-1 do begin
ThisItem:= uppercase(RadioGroup.Items[i]);
if Value[1]= ThisItem[1]
then begin
RadioGroup.ItemIndex:=i; // set when match found
exit;
end;
end;
//no match
//no error handler, just ignore
end;
procedure TForm1.SetTerminalCharColor(Sender:TObject;CharSource:TADCharSource);
begin
with sender as TAdTerminalEmulator do begin
case CharSource of
csUnknown: ;
csKeyboard: Buffer.ForeColor:= Color4Keyboard;
csPort: begin
IncCharCount(1);
Buffer.ForeColor := Color4Port;
end;
csWriteChar: Buffer.ForeColor:=Color4WriteChar;
//else
end; //case
end; //with
end;
procedure TForm1.DisplayHint(Sender: TObject);
begin
if StatusBar1.SimplePanel
then StatusBar1.SimpleText := GetLongHint(Application.Hint)
else StatusBar1.panels[0].Text:= GetLongHint(Application.Hint);
end;
procedure TForm1.Port1PutString(S:string);
begin
Port1.PutString(S);
if CheckBoxHalfDuplex.checked then AdTerminal1.WriteString(S);
end;
procedure TForm1.Port1PutChar(C:char);
begin
Port1.PutChar(C);
if CheckBoxHalfDuplex.checked then AdTerminal1.WriteString(C);
end;
//try to find a page with the matching caption (case independent)
function TForm1.SelectTabSheet(TabCaption:string):boolean; //true if Caption is found
var I:integer;
begin
result:=false;
for I:=0 to PageControl1.PageCount-1 do begin
if ( uppercase(PageControl1.Pages[I].Caption) = uppercase(TabCaption) ) then begin
PageControl1.ActivePage:=PageControl1.Pages[I];
PageControl1.Pages[I].visible:=true; //in case page was hidden
PageControl1.Pages[I].TabVisible:=true; //in case page was hidden
result:=true;
end;
end;
end; //select tab
function NumericStringToChars(var S :string):boolean ;
var i,WC, Value:word; R:string;
begin
WC:=WordCountS(S,' ,');
R:='';
i:=1;
result:=true;
while ( i<=WC ) do begin
if Str2WordS(ExtractWordS(i,S,' ,'),Value) and (Value<256)
then
R:=R+char(Value)
else begin
R:='';
result:=false;
break;
end;
i:=i+1;
end;
S:=R;
end; //NumericStringToChars
const MAXLENGTHOFMENUCAPTION=20;
procedure TForm1.AddCannedString(AsText, AsChars :string); //adds a canned string to the list if new
var index:integer;
procedure RenumberMenuItems;
begin
//for i:=
end;
procedure InsertMenuItem(index:integer); //index is 0 based
var base :integer;
mi:TMenuItem;
begin
base:=MenuItemSend.Indexof(MenuItemSendString1); //get base index of string menu items
//if base+index >= MenuItemSend.Count then exit; //check exists