-
Notifications
You must be signed in to change notification settings - Fork 8
Expand file tree
/
Copy pathLogEvents.cs
More file actions
976 lines (884 loc) · 19.2 KB
/
Copy pathLogEvents.cs
File metadata and controls
976 lines (884 loc) · 19.2 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
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
namespace Log4YM.Contracts.Events;
/// <summary>
/// Emitted when user focuses on a callsign (typing, clicking spot, etc.)
/// </summary>
public record CallsignFocusedEvent(
string Callsign,
string Source,
string? Grid = null,
double? Frequency = null,
string? Mode = null
);
/// <summary>
/// Emitted after successful QRZ/callbook lookup
/// </summary>
public record CallsignLookedUpEvent(
string Callsign,
string? Name,
string? Grid,
double? Latitude,
double? Longitude,
string? Country,
int? Dxcc,
int? CqZone,
int? ItuZone,
string? State,
string? ImageUrl,
double? Bearing = null,
double? Distance = null
);
/// <summary>
/// Emitted when a QSO is logged
/// </summary>
public record QsoLoggedEvent(
string Id,
string Callsign,
DateTime QsoDate,
string TimeOn,
string Band,
string Mode,
double? Frequency,
string? RstSent,
string? RstRcvd,
string? Grid
);
/// <summary>
/// Current station location
/// </summary>
public record StationLocationEvent(
string Callsign,
string Grid,
double Latitude,
double Longitude
);
/// <summary>
/// New DX spot received
/// </summary>
public record SpotReceivedEvent(
string Id,
string DxCall,
string Spotter,
double Frequency,
string? Mode,
string? Comment,
DateTime Timestamp,
string Source,
string? Country,
int? Dxcc,
string? Grid,
string? SpotterCountry = null,
int? SpotterDxcc = null,
string? SpotterGrid = null,
string? SpotterContinent = null
);
/// <summary>
/// User clicked on a spot
/// </summary>
public record SpotSelectedEvent(
string DxCall,
double Frequency,
string? Mode,
string? Grid
);
/// <summary>
/// Current rotator position
/// </summary>
public record RotatorPositionEvent(
string RotatorId,
double CurrentAzimuth,
bool IsMoving,
double? TargetAzimuth = null
);
/// <summary>
/// Request to move rotator
/// </summary>
public record RotatorCommandEvent(
string RotatorId,
double TargetAzimuth,
string Source
);
/// <summary>
/// Current rig frequency/mode
/// </summary>
public record RigStatusEvent(
string RigId,
double Frequency,
string Mode,
bool IsTransmitting
);
// ===== Antenna Genius Events =====
/// <summary>
/// Antenna Genius device discovered on network
/// </summary>
public record AntennaGeniusDiscoveredEvent(
string IpAddress,
int Port,
string Version,
string Serial,
string Name,
int RadioPorts,
int AntennaPorts,
string Mode,
int Uptime
);
/// <summary>
/// Antenna Genius device disconnected
/// </summary>
public record AntennaGeniusDisconnectedEvent(
string Serial
);
/// <summary>
/// Full status update from Antenna Genius
/// </summary>
public record AntennaGeniusStatusEvent(
string DeviceSerial,
string DeviceName,
string IpAddress,
string Version,
bool IsConnected,
List<AntennaGeniusAntennaInfo> Antennas,
List<AntennaGeniusBandInfo> Bands,
AntennaGeniusPortStatus PortA,
AntennaGeniusPortStatus PortB
);
/// <summary>
/// Antenna info for events (without BSON attributes)
/// </summary>
public record AntennaGeniusAntennaInfo(
int Id,
string Name,
ushort TxBandMask,
ushort RxBandMask,
ushort InbandMask
);
/// <summary>
/// Band info for events
/// </summary>
public record AntennaGeniusBandInfo(
int Id,
string Name,
double FreqStart,
double FreqStop
);
/// <summary>
/// Port status for events
/// </summary>
public record AntennaGeniusPortStatus(
int PortId,
bool Auto,
string Source,
int Band,
int RxAntenna,
int TxAntenna,
bool IsTransmitting,
bool IsInhibited
);
/// <summary>
/// Port status changed (antenna selection, band change, etc.)
/// </summary>
public record AntennaGeniusPortChangedEvent(
string DeviceSerial,
int PortId,
bool Auto,
string Source,
int Band,
int RxAntenna,
int TxAntenna,
bool IsTransmitting,
bool IsInhibited
);
/// <summary>
/// Request to select antenna for a port (client to server)
/// </summary>
public record SelectAntennaCommand(
string DeviceSerial,
int PortId,
int AntennaId
);
// ===== PGXL Amplifier Events =====
/// <summary>
/// PGXL amplifier discovered on network
/// </summary>
public record PgxlDiscoveredEvent(
string IpAddress,
int Port,
string Serial,
string Model
);
/// <summary>
/// PGXL amplifier disconnected
/// </summary>
public record PgxlDisconnectedEvent(
string Serial
);
/// <summary>
/// Full status update from PGXL amplifier
/// </summary>
public record PgxlStatusEvent(
string Serial,
string IpAddress,
bool IsConnected,
bool IsOperating,
bool IsTransmitting,
string Band,
string BiasA,
string BiasB,
PgxlMeters Meters,
PgxlSetup Setup
);
/// <summary>
/// PGXL meter readings
/// </summary>
public record PgxlMeters(
double ForwardPowerDbm,
double ForwardPowerWatts,
double ReturnLossDb,
double SwrRatio,
double DrivePowerDbm,
double PaCurrent,
double TemperatureC
);
/// <summary>
/// PGXL setup/configuration
/// </summary>
public record PgxlSetup(
string BandSource,
int SelectedAntenna,
bool AttenuatorEnabled,
int BiasOffset,
int PttDelay,
int KeyDelay,
bool HighSwr,
bool OverTemp,
bool OverCurrent
);
/// <summary>
/// Request to set PGXL operate mode (client to server)
/// </summary>
public record SetPgxlOperateCommand(
string Serial
);
/// <summary>
/// Request to set PGXL standby mode (client to server)
/// </summary>
public record SetPgxlStandbyCommand(
string Serial
);
/// <summary>
/// Request to disable FlexRadio pairing for a PGXL slice (client to server)
/// </summary>
public record DisablePgxlFlexRadioPairingCommand(
string Serial,
string Slice
);
// ===== Radio CAT Control Events =====
/// <summary>
/// Type of radio/protocol
/// </summary>
public enum RadioType
{
FlexRadio,
Tci,
Hamlib
}
/// <summary>
/// Radio connection state
/// </summary>
public enum RadioConnectionState
{
Disconnected,
Discovering,
Connecting,
Connected,
Monitoring,
Error
}
/// <summary>
/// Radio discovered on network
/// </summary>
public record RadioDiscoveredEvent(
string Id,
RadioType Type,
string Model,
string IpAddress,
int Port,
string? Nickname,
List<string>? Slices // For FlexRadio - available slices
);
/// <summary>
/// Radio no longer available
/// </summary>
public record RadioRemovedEvent(
string Id
);
/// <summary>
/// Radio connection state changed
/// </summary>
public record RadioConnectionStateChangedEvent(
string RadioId,
RadioConnectionState State,
string? ErrorMessage = null
);
/// <summary>
/// Radio frequency/mode/TX state update
/// </summary>
public record RadioStateChangedEvent(
string RadioId,
long FrequencyHz,
string Mode,
bool IsTransmitting,
string Band,
string? SliceOrInstance
);
/// <summary>
/// Available slices updated (FlexRadio)
/// </summary>
public record RadioSlicesUpdatedEvent(
string RadioId,
List<RadioSliceInfo> Slices
);
/// <summary>
/// Slice information for FlexRadio
/// </summary>
public record RadioSliceInfo(
string Id,
string Letter, // A, B, C, D
long FrequencyHz,
string Mode,
bool IsActive
);
/// <summary>
/// Command to start radio discovery
/// </summary>
public record StartRadioDiscoveryCommand(
RadioType Type
);
/// <summary>
/// Command to stop radio discovery
/// </summary>
public record StopRadioDiscoveryCommand(
RadioType Type
);
/// <summary>
/// Command to connect to a radio
/// </summary>
public record ConnectRadioCommand(
string RadioId
);
/// <summary>
/// Command to disconnect from a radio
/// </summary>
public record DisconnectRadioCommand(
string RadioId
);
/// <summary>
/// Command to select a slice to monitor (FlexRadio)
/// </summary>
public record SelectRadioSliceCommand(
string RadioId,
string SliceId
);
/// <summary>
/// Command to select an instance to monitor (TCI)
/// </summary>
public record SelectRadioInstanceCommand(
string RadioId,
int Instance
);
// ===== CW Keyer Commands and Events =====
/// <summary>
/// Command to send CW/Morse code text
/// </summary>
public record SendCwKeyCommand(
string RadioId,
string Message,
int? SpeedWpm = null
);
/// <summary>
/// Command to stop CW keying immediately
/// </summary>
public record StopCwKeyCommand(
string RadioId
);
/// <summary>
/// Command to set CW keyer speed
/// </summary>
public record SetCwSpeedCommand(
string RadioId,
int SpeedWpm
);
/// <summary>
/// CW keyer status event
/// </summary>
public record CwKeyerStatusEvent(
string RadioId,
bool IsKeying,
int SpeedWpm,
string? CurrentMessage = null
);
// ===== Hamlib Configuration Events =====
/// <summary>
/// Hamlib connection type
/// </summary>
public enum HamlibConnectionType
{
Serial,
Network
}
/// <summary>
/// Hamlib data bits options
/// </summary>
public enum HamlibDataBits
{
Five = 5,
Six = 6,
Seven = 7,
Eight = 8
}
/// <summary>
/// Hamlib stop bits options
/// </summary>
public enum HamlibStopBits
{
One = 1,
Two = 2
}
/// <summary>
/// Hamlib flow control options
/// </summary>
public enum HamlibFlowControl
{
None,
Hardware,
Software
}
/// <summary>
/// Hamlib parity options
/// </summary>
public enum HamlibParity
{
None,
Even,
Odd,
Mark,
Space
}
/// <summary>
/// Hamlib PTT type
/// </summary>
public enum HamlibPttType
{
None,
Rig,
Dtr,
Rts
}
/// <summary>
/// Information about a Hamlib rig model
/// </summary>
public record HamlibRigModelInfo(
int ModelId,
string Manufacturer,
string Model,
string Version,
string DisplayName
);
/// <summary>
/// Hamlib rig capabilities
/// </summary>
public record HamlibRigCapabilities(
bool CanGetFreq,
bool CanGetMode,
bool CanGetVfo,
bool CanGetPtt,
bool CanGetPower,
bool CanGetRit,
bool CanGetXit,
bool CanGetKeySpeed,
bool CanSendMorse,
int DefaultDataBits,
int DefaultStopBits,
bool IsNetworkOnly,
bool SupportsSerial,
bool SupportsNetwork
);
/// <summary>
/// Hamlib rig configuration
/// </summary>
public record HamlibRigConfigDto(
int ModelId,
string ModelName,
HamlibConnectionType ConnectionType,
string? SerialPort,
int BaudRate,
HamlibDataBits DataBits,
HamlibStopBits StopBits,
HamlibFlowControl FlowControl,
HamlibParity Parity,
string? Hostname,
int NetworkPort,
HamlibPttType PttType,
string? PttPort,
bool GetFrequency,
bool GetMode,
bool GetVfo,
bool GetPtt,
bool GetPower,
bool GetRit,
bool GetXit,
bool GetKeySpeed,
int PollIntervalMs
);
/// <summary>
/// Hamlib rig list response
/// </summary>
public record HamlibRigListEvent(
List<HamlibRigModelInfo> Rigs
);
/// <summary>
/// Hamlib rig capabilities response
/// </summary>
public record HamlibRigCapsEvent(
int ModelId,
HamlibRigCapabilities Capabilities
);
/// <summary>
/// Available serial ports
/// </summary>
public record HamlibSerialPortsEvent(
List<string> Ports
);
/// <summary>
/// Hamlib configuration loaded
/// </summary>
public record HamlibConfigLoadedEvent(
HamlibRigConfigDto? Config
);
/// <summary>
/// Hamlib library initialization status
/// </summary>
public record HamlibStatusEvent(
bool IsInitialized,
bool IsConnected,
string? RadioId,
string? ErrorMessage
);
// ===== SmartUnlink Events =====
/// <summary>
/// Known FlexRadio models for SmartUnlink
/// </summary>
public static class FlexRadioModels
{
public static readonly string[] All = new[]
{
"FLEX-5100", // Aurora series
"FLEX-5200", // Aurora series
"FLEX-6400", // Signature series
"FLEX-6400M", // Signature series with ATU
"FLEX-6600", // Signature series
"FLEX-6600M", // Signature series with ATU
"FLEX-6700", // Signature series
"FLEX-8400", // Maestro series
"FLEX-8600", // Maestro series
"FlexRadio", // Generic placeholder
};
}
/// <summary>
/// SmartUnlink radio configuration
/// </summary>
public record SmartUnlinkRadio(
string Id,
string Name,
string IpAddress,
string Model,
string SerialNumber,
string? Callsign,
bool Enabled,
DateTime CreatedAt,
DateTime UpdatedAt
);
/// <summary>
/// SmartUnlink radio configuration DTO for API
/// </summary>
public record SmartUnlinkRadioDto(
string? Id,
string Name,
string IpAddress,
string Model,
string SerialNumber,
string? Callsign,
bool Enabled,
string Version = "4.1.3.39644"
);
/// <summary>
/// SmartUnlink radio added event
/// </summary>
public record SmartUnlinkRadioAddedEvent(
string Id,
string Name,
string IpAddress,
string Model,
string SerialNumber,
string? Callsign,
bool Enabled,
string Version = "4.1.3.39644"
);
/// <summary>
/// SmartUnlink radio updated event
/// </summary>
public record SmartUnlinkRadioUpdatedEvent(
string Id,
string Name,
string IpAddress,
string Model,
string SerialNumber,
string? Callsign,
bool Enabled,
string Version = "4.1.3.39644"
);
/// <summary>
/// SmartUnlink radio removed event
/// </summary>
public record SmartUnlinkRadioRemovedEvent(
string Id
);
/// <summary>
/// SmartUnlink broadcast status event
/// </summary>
public record SmartUnlinkBroadcastStatusEvent(
string RadioId,
bool IsBroadcasting,
DateTime? LastBroadcast
);
/// <summary>
/// Full SmartUnlink status for initial load
/// </summary>
public record SmartUnlinkStatusEvent(
List<SmartUnlinkRadioAddedEvent> Radios
);
// ===== DX Cluster Events =====
/// <summary>
/// DX Cluster connection status changed
/// </summary>
public record ClusterStatusChangedEvent(
string ClusterId,
string Name,
string Status, // "connected" | "connecting" | "disconnected" | "error"
string? ErrorMessage = null
);
// ===== QRZ Sync Events =====
/// <summary>
/// QRZ sync progress update
/// </summary>
public record QrzSyncProgressEvent(
int Total,
int Completed,
int Successful,
int Failed,
bool IsComplete,
string? CurrentCallsign,
string? Message
);
// ===== ADIF Import Events =====
/// <summary>
/// ADIF import progress update
/// </summary>
public record AdifImportProgressEvent(
int Total,
int Processed,
int Imported,
int Skipped,
int Failed,
bool IsComplete,
string? CurrentCallsign,
string? Message
);
// ===== Tuner Genius Events =====
/// <summary>
/// Tuner Genius device discovered on network
/// </summary>
public record TunerGeniusDiscoveredEvent(
string IpAddress,
int Port,
string Version,
string Serial,
string Name,
string Model,
int Uptime
);
/// <summary>
/// Tuner Genius device disconnected
/// </summary>
public record TunerGeniusDisconnectedEvent(
string Serial
);
/// <summary>
/// Full status update from Tuner Genius XL.
/// The TGXL is a single tuner with one L/C network serving up to two radios.
/// Swr, Power, L/C positions and bypass/operate state are tuner-level (not per-radio).
/// FreqAMhz / FreqBMhz are the frequencies reported by the two radio inputs.
/// </summary>
public record TunerGeniusStatusEvent(
string DeviceSerial,
string DeviceName,
string IpAddress,
string Version,
string Model,
bool IsConnected,
// Tuner state
bool IsOperating, // true = Operate, false = Standby
bool IsBypassed, // true = tuner bypassed (out of circuit)
bool IsTuning, // true = tune cycle in progress
int ActiveRadio, // 1 or 2
// Metering
double ForwardPowerWatts,
double Swr, // e.g. 1.5
// Matching network positions (0-255)
int L,
int C1,
int C2,
// Per-radio frequency inputs
double FreqAMhz,
double FreqBMhz,
// Legacy port wrappers (PortA = Radio 1, PortB = Radio 2)
TunerGeniusPortStatus PortA,
TunerGeniusPortStatus? PortB
);
/// <summary>
/// Per-radio input status (frequency and band).
/// L/C/SWR/power are tuner-level — see TunerGeniusStatusEvent.
/// </summary>
public record TunerGeniusPortStatus(
int PortId,
bool Auto,
string Band,
double FrequencyMhz,
int Swr, // SWR * 10 (e.g. 15 = 1.5:1) — kept for UI compat
bool IsTuning,
bool IsTransmitting,
int? SelectedAntenna,
string TuneResult // "OK", "HighSWR", "Timeout", "Error"
);
/// <summary>
/// Fired on every status poll — carries full tuner + radio state.
/// </summary>
public record TunerGeniusPortChangedEvent(
string DeviceSerial,
int PortId,
bool Auto,
string Band,
double FrequencyMhz,
int Swr,
bool IsTuning,
bool IsTransmitting,
int? SelectedAntenna,
string TuneResult,
// Tuner-level additions
bool IsBypassed,
bool IsOperating,
double ForwardPowerWatts,
double SwrDecimal, // SWR as double e.g. 1.5
int L,
int C1,
int C2,
int ActiveRadio
);
/// <summary>
/// Command to initiate auto-tune (client to server)
/// </summary>
public record TuneTunerGeniusCommand(
string DeviceSerial,
int PortId
);
/// <summary>
/// Command to toggle bypass state (client to server)
/// </summary>
public record BypassTunerGeniusCommand(
string DeviceSerial,
int PortId,
bool Bypass
);
/// <summary>
/// Command to set Operate / Standby mode (client to server)
/// </summary>
public record OperateTunerGeniusCommand(
string DeviceSerial,
bool Operate
);
/// <summary>
/// Command to activate a radio channel (client to server)
/// </summary>
public record ActivateChannelTunerGeniusCommand(
string DeviceSerial,
int Channel // 1 or 2
);
// ===== UDP Provider Events =====
/// <summary>
/// UDP provider status changed
/// </summary>
public record UdpProviderStatusChangedEvent(
string ProviderId,
string ProviderName,
bool IsRunning,
bool IsListening,
int? ListeningPort,
bool? IsMulticastEnabled,
string? ErrorMessage = null
);
/// <summary>
/// WSJT-X status update received
/// </summary>
public record WsjtxStatusReceivedEvent(
string Id,
long DialFrequency,
string Mode,
string DxCall,
string DxGrid,
string DeCall,
string DeGrid,
bool TxEnabled,
bool Transmitting,
bool Decoding,
int RxDf,
int TxDf,
string SubMode,
int FreqTolerance,
double TrPeriod,
string Report,
string TxMessage
);
/// <summary>
/// WSJT-X decode message received
/// </summary>
public record WsjtxDecodeReceivedEvent(
string Id,
bool IsNew,
DateTime Time,
int Snr,
double DeltaTime,
int DeltaFrequency,
string Mode,
string Message,
bool LowConfidence,
bool OffAir
);
/// <summary>
/// WSJT-X QSO logged event
/// </summary>
public record WsjtxQsoLoggedEvent(
string Id,
string DxCall,
string DxGrid,
long TxFrequency,
string Mode,
string ReportSent,
string ReportReceived,
string TxPower,
DateTime TimeOn,
DateTime TimeOff,
string MyCall,
string MyGrid,
string? Comments = null,
string? ExchangeSent = null,
string? ExchangeReceived = null
);