/hmrcmd

Crossplatform/Executable webserver in Go/Hyperapp that talks to hardware via serial port calls!

Primary LanguageJavaScriptMIT LicenseMIT

HMRCMD

Ham Radio Command Center 🙏

image

Portable executable webserver/client that can be run on Windows/MacOS/Linux.

RESTful WebServer in Go that talks to radios via serial port calls.

Frontend is in Hyperapp

Supported Radios

Currently ICOM is the main development focus.

However you can input any SERIAL_PORT/BAUD_RATE/HEX you like, so technically anything (like sending hex to an arduino)!

Releases/Executables

Please check the releases page: https://github.com/selfup/hmrcmd/releases

Downloading/Installing/Running HMRCMD

Go to the releases page: https://github.com/selfup/hmrcmd/releases

  1. Windows, download the latest .exe release
  2. MacOS, download the latest darwin- release
  3. Linux, download the latest linux- release

Once downloaded:

  1. Windows:

    1. Double click the exe
    2. Warning Protected Screen click -> More Info -> Allow
    3. Firewall -> Allow
    4. Done!
  2. MacOS/Linux execute the file via the commandline: ./path/to/latest/release

It will auto open a browser window and be ready to run 🎉

API

  1. ICOM Endpoint

    • Url: http://localhost:8792
    • Route: /api/v1/icom-cmd
    • Method: POST
    • Body (JSON): {SerialPort: '', IcomCommand: '', BaudRate: ''}
    • Example payload: {SerialPort: 'COM3', IcomCommand: 'FE FE 94 E0 26 00 05 00 01 FD', BaudRate: '9600'}

😄

Development Guidelines

Please read the CODE_OF_CONDUCT.md file 🙏

I use VSCode with three extensions for this project:

  1. Powershell
  2. Editorconfig
  3. Go Code

Please fork the project and make a Pull Request (PR) to contribute!

Development Deps

  1. Golang
  2. Node
  3. go-serial
  4. packr

Install Go Deps: go mod download

Install JS deps: npm install

Run the frontend

npm start

Caveats

Can make API calls when running the go server but you have to kill and reload the go server for new backend functionality.

Run the backend

To make calls to the radio while using the frontend:

go run main.go

To test API calls without using the frontend there are scripts!

Windows

./scripts/post.cmd.ps1

MacOS / Linux

./scripts/post.cmd.sh

Compile into a binary release

./scripts/releases.sh

Virtual Ports and Observing Calls Without Hardware

Windows

  1. RealTerm
  2. com0com

Observing commands on Windows

Create a virtual port pair with com0com and then connect to one of the port pairs with RealTerm.

Set baudrate to 9600 and on the display tab set to either hex [with space] or binary (up to you)

Now make sure to send the commands to the other end of the pair!

Example:

  1. com0com pair: COM12 - COM13
  2. RealTerm listen to: COM12
  3. SerialPort for HEX command: COM13

MacOS/Linux

  1. socat
  2. screen

MacOS

Install socat brew install socat or install the binary yourself.

Linux (Ubuntu)

Install socat sudo apt install socat or install the binary yourself.

Observing commands on MacOS/Linux

Ok this gets interesting

In a terminal/pane/tab can either run:

  1. socat -d -d pty,raw,echo=0 pty,raw,echo=0
  2. ./scripts/virtual.pair.sh

You will see output like so

2018/07/29 09:43:54 socat[20004] N PTY is /dev/ttys007
2018/07/29 09:43:54 socat[20004] N PTY is /dev/ttys008
2018/07/29 09:43:54 socat[20004] N starting data transfer loop with FDs [5,5] and [7,7]

Now you will want to pick on of the tty pairs and cat the hexdump in another terminal/pane/tab:

cat /dev/ttys007 | hexdump

Now when you make an API call make sure to use the other port in the pair.

Once you send the message to 008, you will see the hexdump from 007!

It seems you have to make two calls to see it... 🤔

Do not be discouraged! 😄

Example screenshot:

screen shot 2018-07-29 at 10 17 32 am

Reading Materials

  1. HEX to BIN table
  2. CI-V Reference Manual
  3. ICOM IC-7610 Reference Manual
  4. Old CT-17 Reference Manual with BASIC code blocks
  5. Decimal Array to Binary $port.Write/3
  6. System.IO.Ports.SerialPort.Write .NET API

CI-V Manual Message Format Snippet

basic-message-format-icom