diff --git a/README.md b/README.md index f4e17f9..957c34b 100644 --- a/README.md +++ b/README.md @@ -1,125 +1,129 @@ -# This like many, are ideas. There may or may not be progress as inspiration and time allows. - # SharpCAT -C#, .NET Standard based CAT control library with ASP.NET Core Web API server. -I am targeting .Net Standard so that the assembly may be used with .Net Core or the .Net framework. +**SharpCAT** is a C#/.NET cross-platform library and Web API server for CAT (Computer Aided Transceiver) radio control. It supports serial port CAT operations, modern async programming, and provides a REST API for remote radio control. -## Components +--- -### SharpCAT Library -The core .NET Standard 2.0 library for CAT (Computer Aided Transceiver) control. +## Features -### SharpCAT Server -A cross-platform ASP.NET Core Web API server that provides REST endpoints for CAT control operations. Located in `Server/SharpCAT.Server/`. +- **Core Library**: .NET Standard-based, works with .NET Core and .NET Framework +- **Cross-platform Server**: ASP.NET Core Web API server, works on Windows, Linux, and macOS +- **REST API**: Endpoints for serial port management and sending arbitrary CAT commands +- **Swagger/OpenAPI**: Interactive API docs and testing interface +- **Async/Await**: Modern async support for non-blocking IO +- **Extensible**: Designed for adding radios and protocols (FT818, ID-4100A, TH-D74A, etc.) +- **Built-in Logging and Error Handling** -**Key Features:** -- REST API for serial port management and CAT commands -- Cross-platform support (Windows, Linux, macOS) -- Swagger/OpenAPI documentation -- Built-in error handling and logging +--- + +## Quick Start + +### Prerequisites + +- [.NET 8.0 SDK](https://dotnet.microsoft.com/download) or later + +### Running the Web API Server -**Quick Start:** ```bash cd Server/SharpCAT.Server dotnet run ``` -Then visit `http://localhost:5188` for the Swagger UI. +The server listens on `http://localhost:5188` by default. +Open [http://localhost:5188](http://localhost:5188) in your browser for the Swagger UI. -## Development Setup +--- -### Prerequisites -- [.NET 8.0 SDK](https://dotnet.microsoft.com/download) or later -- [Visual Studio Code](https://code.visualstudio.com/) -- [C# Extension for VS Code](https://marketplace.visualstudio.com/items?itemName=ms-dotnettools.csharp) +## Usage Examples -### Building and Running +### List Available Serial Ports -This project is configured for development in Visual Studio Code with the .NET CLI. +```bash +curl http://localhost:5188/api/cat/ports +``` + +### Open a Serial Port + +```bash +curl -X POST http://localhost:5188/api/cat/open \ + -H "Content-Type: application/json" \ + -d '{"portName": "COM3", "baudRate": 9600}' +``` + +### Send a CAT Command + +```bash +curl -X POST http://localhost:5188/api/cat/command \ + -H "Content-Type: application/json" \ + -d '{"command": "FA;"}' +``` + +--- + +## Project Structure + +``` +SharpCAT/ # Core CAT library (cross-platform) +Server/SharpCAT.Server/ # ASP.NET Core Web API server +``` + +--- + +## Development + +### Build Everything -**To build the entire solution:** ```bash dotnet build ``` -**To build just the library:** +### Build Just the Core Library + ```bash dotnet build SharpCAT/SharpCAT.csproj ``` -**To build and run the Web API server:** -```bash -cd Server/SharpCAT.Server -dotnet run -``` +### VS Code Tasks -**To clean the project:** -```bash -dotnet clean -``` +This repo includes VS Code tasks for building, cleaning, restoring, publishing, and watching changes. -**To restore packages:** -```bash -dotnet restore -``` +--- -**VS Code Tasks:** -The repository includes pre-configured VS Code tasks (`Ctrl+Shift+P` → "Tasks: Run Task"): -- **build** - Builds the project (default build task: `Ctrl+Shift+B`) -- **clean** - Cleans build outputs -- **restore** - Restores NuGet packages -- **publish** - Publishes the library -- **watch** - Watches for changes and rebuilds automatically +## Roadmap & Ideas -I'm starting with the FT818, I then plan on adding my ID-4100a, and TH-D74A. +- Implement generic IRadio interface and radio-specific drivers +- Support multiple concurrent radios +- Fully async serial operations +- Remote sharing of serial ports +- Implement flrig protocol support +- Potential AGWPE integration +- Service/daemon operation support +- Additional radio protocols (CAT, CI-V, etc.) -If you wish to help let me know, or create a pull request. I'm not a pro developer, just a hack -that normally builds small tools for himself. +--- -Ideas on how to do this are appreciated! +## Why? -# Why? -Yes, there's Hamlib, and yes there's HamLibSharp. +While Hamlib and HamLibSharp exist, there is a need for a modern, pure .NET CAT control library and server for direct integration with C# projects, without C++/PInvoke dependencies. -https://github.com/N0NB/hamlib +--- -https://github.com/k5jae/HamLibSharp +## Contributing -I don't speak C++ and PInvoke is nasty. +Contributions are very welcome! Please open issues, submit PRs, or share your ideas. -That being said, there's also not a pure .Net (C#) CAT control lib out there that I know of. +--- -# What needs done? -The project is in an early very phase. The following is in no particular order, except the IRadio bit. +## License -1. Implement an IRadio interface. +This project follows the same license as the parent SharpCAT project. -2. Settle on how the radios and commands are defined. +--- - JSON? - - Or just use a .cs file (current)? - -3. Need to support opening / using an arbitrary number of radios. +## Credits - RigControl can do 2. - -4. Fully support asynchronous operations. +- Inspired by FT818, ID-4100A, TH-D74A, Yaesu FT991a, and others +- Thanks to all open source contributors and radio amateurs for protocol documentation and ideas - There's some handy events exposed by .net for data received on the Serial Port. - -5. Add support for remote sharing of serial ports. +--- -6. Implemtment the flrig control protocol. - - Use this in place of flrig if desired. - -7. Maybe implement AGWPE? - -8. Implement the ability to run as a service. - -9. Implement CAT and CIV control. - - This will come with the first Icom radio implemented I figure. - - I've switched radios, so I have a Yaesu FT991a, Baofeng BF-T1, WLN KD-C1, Baofeng UV-5x3, TH-D72a, FT-2DR and an D878UV. +*If you wish to help, let me know or create a pull request. I'm not a pro developer, just a hobbyist building tools for myself and others.*