Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
75 changes: 75 additions & 0 deletions src/Log4YM.Contracts/Events/LogEvents.cs
Original file line number Diff line number Diff line change
Expand Up @@ -899,3 +899,78 @@ 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
);
3 changes: 3 additions & 0 deletions src/Log4YM.Contracts/Models/Settings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,9 @@ public class UserSettings
[BsonElement("ai")]
public AiSettings Ai { get; set; } = new();

[BsonElement("udpProviders")]
public UdpProviderSettings UdpProviders { get; set; } = new();

[BsonElement("layoutJson")]
public string? LayoutJson { get; set; }

Expand Down
71 changes: 71 additions & 0 deletions src/Log4YM.Contracts/Models/UdpProviderSettings.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
using MongoDB.Bson.Serialization.Attributes;

namespace Log4YM.Contracts.Models;

/// <summary>
/// Settings for UDP-based integrations (WSJT-X, JTDX, MSHV, GridTracker, Hamlib, etc.)
/// </summary>
public class UdpProviderSettings
{
[BsonElement("providers")]
public List<UdpProviderConfig> Providers { get; set; } = new()
{
// WSJT-X/JTDX/MSHV (compatible protocol)
new UdpProviderConfig
{
Id = "wsjtx",
Name = "WSJT-X / JTDX / MSHV",
Enabled = false,
Port = 2237,
SupportsMulticast = true,
MulticastEnabled = false,
MulticastAddress = "224.0.0.73",
MulticastTtl = 1,
ForwardingEnabled = false,
ForwardingAddresses = new List<string>(),
Description = "Digital mode applications (FT8, FT4, JT65, etc.)"
}
};
}

/// <summary>
/// Configuration for a single UDP provider
/// </summary>
public class UdpProviderConfig
{
[BsonElement("id")]
public string Id { get; set; } = string.Empty;

[BsonElement("name")]
public string Name { get; set; } = string.Empty;

[BsonElement("enabled")]
public bool Enabled { get; set; }

[BsonElement("port")]
public int Port { get; set; }

[BsonElement("supportsMulticast")]
public bool SupportsMulticast { get; set; }

[BsonElement("multicastEnabled")]
public bool MulticastEnabled { get; set; }

[BsonElement("multicastAddress")]
public string MulticastAddress { get; set; } = "224.0.0.73";

[BsonElement("multicastTtl")]
public int MulticastTtl { get; set; } = 1;

[BsonElement("forwardingEnabled")]
public bool ForwardingEnabled { get; set; }

[BsonElement("forwardingAddresses")]
public List<string> ForwardingAddresses { get; set; } = new();

[BsonElement("description")]
public string Description { get; set; } = string.Empty;

[BsonElement("customSettings")]
public Dictionary<string, string> CustomSettings { get; set; } = new();
}
6 changes: 6 additions & 0 deletions src/Log4YM.Server/Hubs/LogHub.cs
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,12 @@ public interface ILogHubClient

// RBN events
Task OnRbnSpot(RbnSpot spot);

// UDP Provider events
Task OnUdpProviderStatusChanged(UdpProviderStatusChangedEvent evt);
Task OnWsjtxStatusReceived(WsjtxStatusReceivedEvent evt);
Task OnWsjtxDecodeReceived(WsjtxDecodeReceivedEvent evt);
Task OnWsjtxQsoLogged(WsjtxQsoLoggedEvent evt);
}

public class LogHub : Hub<ILogHubClient>
Expand Down
4 changes: 4 additions & 0 deletions src/Log4YM.Server/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -206,6 +206,10 @@
// Register CW Keyer service
builder.Services.AddSingleton<CwKeyerService>();

// Register UDP Provider services
builder.Services.AddSingleton<Log4YM.Server.Services.UdpProviders.WsjtxUdpService>();
builder.Services.AddHostedService(sp => sp.GetRequiredService<Log4YM.Server.Services.UdpProviders.WsjtxUdpService>());

var app = builder.Build();

// Configure middleware
Expand Down
Loading
Loading