Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Aug 6, 2025

This PR implements a complete Client-Server architecture refactoring for SharpCAT, transforming the monolithic library into a distributed system that enables remote radio control and management.

New Architecture

The refactoring introduces three distinct components:

  • SharpCAT Library (/SharpCAT/): The original .NET Standard 2.0 library remains unchanged, preserving all existing CAT control logic and radio models
  • SharpCAT.Server (/Server/): New ASP.NET Core Web API that exposes the core library functionality through REST endpoints
  • SharpCAT.Client (/Client/): New .NET class library providing a typed client interface for consuming the Server APIs

Key Features

Server APIs

The new ExampleController exposes essential radio control endpoints:

  • GET /api/example/health - Server health monitoring
  • GET /api/example/ports - Discovery of available serial ports
  • GET /api/example/ctcss-tones - Retrieval of CTCSS tone frequencies
  • GET /api/example/dcs-codes - Access to DCS code definitions

Typed Client Library

The SharpCATApiClient provides a clean, async interface:

var client = new SharpCATApiClient("http://localhost:5245");

// Get available serial ports
var ports = await client.GetAvailablePortsAsync();

// Get CTCSS tones
var tones = await client.GetCTCSSTonesAsync();

// Check server health
var health = await client.GetHealthAsync();

Benefits

This architecture enables:

  • Remote Operation: Control radios over HTTP from any network location
  • Service-Oriented Design: Multiple clients can connect to a single server instance
  • Technology Flexibility: Clients can be built in any language that supports HTTP
  • Scalability: Server can be deployed as a microservice with load balancing
  • Security: Future authentication and authorization can be centrally managed

Migration Path

Existing users can continue using the original SharpCAT library unchanged. The new architecture is additive and maintains full backward compatibility.

Next Steps

The foundation is now in place for expanding the API surface to include:

  • Radio-specific control endpoints (frequency, mode, power)
  • Real-time status updates via WebSocket
  • Configuration management
  • Authentication and security features

Testing was performed to verify all components build successfully and the Server APIs respond correctly to HTTP requests.


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

@ekinnee ekinnee marked this pull request as ready for review August 6, 2025 21:39
@ekinnee ekinnee merged commit 75a98c3 into master Aug 6, 2025
1 check passed
Copilot AI changed the title [WIP] Refactor repository into Client-Server architecture (SharpCAT.Server & SharpCAT.Client projects) Refactor SharpCAT into Client-Server architecture Aug 6, 2025
Copilot AI requested a review from ekinnee August 6, 2025 21:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants