192 lines
7.6 KiB
Markdown
192 lines
7.6 KiB
Markdown
# The PACTOR-TCP-BRIDGE
|
|
|
|
<img src="pics/ptb.png" alt="logo" width="200" style="float: right">
|
|
by Torsten Harenberg (DL1THM)
|
|
|
|
## What is the PACTOR-TCP-BRIDGE (ptb)?
|
|
|
|
It's a tool that was written to be used with [Pat](https://getpat.io/), so that Pat can use PACTOR. It connects via a serial line
|
|
(USB or Bluetooth) or via TCP to a [PACTOR modems](https://scs-ptc.com/modems.html) made by [SCS](https://scs-ptc.com) using the extended WA8DED hostmode
|
|
[(see the manual, chapter 10)](https://www.p4dragon.com/download/SCS_Manual_PTC-IIIusb_4.1.pdf) protocol these modems offer. To Pat, tho tools provides the following interfaces:
|
|
|
|
- two TCP sockets (DATA and Command)
|
|
- optionally: another TCP socket that either forwards NMEA data from an attached GNSS receiver or even translates that NMEA data to a gpsd compatible protocol, so it can be used by Pat directly
|
|
- optionally: a pseudo tty (pty) for hamlib to use to steer the attached transceiver
|
|
|
|
The following picture depicts all possibilities:
|
|
|
|
<img src="pics/ptb_connections.png">
|
|
|
|
## What it is used for?
|
|
|
|
The main purpose is to build a connection between Pat and PACTOR modems. In order to establish a "listen" mode for PACTOR in Pat,
|
|
the modem needs to be kept in the WA8DED hostmode. I found it easiest to create a separate program
|
|
for that - in the same way, the VARA modem is a separate program.
|
|
|
|
On the long run, this tool will replace the current PACTOR driver in Pat.
|
|
|
|
## How to use it
|
|
|
|
In order to use this tool, you'll need to configure it.
|
|
|
|
If you start it for the first time, it will create a default configuration file and will tell you its location:
|
|
|
|
```bash
|
|
% ./ptb
|
|
new Config file /Users/harenber/.config/dl1thm.pactortcpbridge/Config.yaml created. Please edit the Config file and restart the application
|
|
```
|
|
|
|
Now edit the file and configure it accordingly:
|
|
|
|
```yaml
|
|
device: /tmp/ttyUSB0
|
|
baudrate: 9600
|
|
mycall: N0CALL
|
|
server_address: 127.0.0.1:8300
|
|
data_address: 127.0.0.1:8301
|
|
gpsd_address: 0.0.0.0:2947
|
|
cmdline_init: ""
|
|
vara_mode: false
|
|
```
|
|
|
|
Next time ptb will start using the settings in your config file.
|
|
|
|
## Settings
|
|
|
|
The meaning of the vables in the config file are as follows:
|
|
|
|
| Variable | Meaning |
|
|
|-------------------|----------------------------------------------------------------------------------------------------------------|
|
|
| `device` | Path to the serial device where the modem is connected **or** `tcp://address:port` (useful for Android) |
|
|
| `baudrate` | baud rate of the modem |
|
|
| `mycall` | The callsign to be used on HF |
|
|
| `server_address` | server socket address for the **commands** |
|
|
| `data_address` | server socket address for the **data** |
|
|
| `gpsd_address` | **optional** See the chapter about GPS below |
|
|
| `nmeapassthrough` | **only when gpsd_address has been set** bool value: if true pass NMEA data trough instead of interpreting them |
|
|
| `cmdline_init` | extra commands sent to the modem before going into hostmode, separated by semicolons, Ex: `DISP BR 1;DISP A 1;DISP DIMMOFF` |
|
|
| `vara_mode` | see the chapter about the VARA mode |
|
|
|
|
|
|
|
|
## VARA mode
|
|
|
|
The VARA mode translate WA8DED commands into VARA commands and vice versa. See the VARA homepage for the "VARA TNC Commands"
|
|
doumentation.
|
|
|
|
If enabled, software which is written to interact with the VARA software TNC to work
|
|
with PACTOR as well. It was used by the author to use the [VARA driver for Pat](https://github.com/n8jja/Pat-Vara)
|
|
with the PACTOR-TCP-Bridge.
|
|
|
|
If you plan to you Pat with the VARA driver, your `data_address` you **must** use a port number one number higher than the `server_address`. This is a limitation of Pat's
|
|
VARA driver.
|
|
|
|
A matching Pat config using VARA for the example above would look like:
|
|
|
|
```yaml
|
|
"varahf": {
|
|
"addr": "localhost:8300",
|
|
"bandwidth": 2300,
|
|
"rig": "",
|
|
"ptt_ctrl": false
|
|
}
|
|
```
|
|
|
|
Using PACTOR, the PTT is triggered through the modem, so you need to set `ptt_ctrl` to `false`! If you configure a `rig`, it
|
|
needs to be connected in a way that `rigctl` can configure it. That can be done though this software, if your TRX remote control interface
|
|
is connected to the PACTOR modem (as depicted above). Or you have attached the remote control directly to your computer. In this case you'd
|
|
use `rigctl` normally.
|
|
|
|
## GPS(d) mode
|
|
|
|
The PTC offer the possibility to attach a NMEA compatible GNSS receiver to them. To use them with Pat, the
|
|
PACTOR-TCP-bridge contains a small server which provides a [gpsd](https://gpsd.gitlab.io/gpsd/) compatible server.
|
|
|
|
So your setup looks like this:
|
|
|
|
GNSS-receiver <--serial line--> PTC <--bluetooth or USB--> PC/tablet/phone running ptb
|
|
|
|
Please note, that this builtin server does the bare minimum needed to get your position forwarded to Pat. It's
|
|
by far no full-featured gpsd. However, it eliminates the need to run an additional process (gpsd) just
|
|
to make your position visible to Pat (or any other gpsd client).
|
|
|
|
To configure it you just need to add a line like
|
|
|
|
```yaml
|
|
gpsd_address: 0.0.0.0:2947`
|
|
```
|
|
|
|
to the config file. In Pat, a possible counterpart could look like this:
|
|
|
|
```yaml
|
|
"gpsd": {
|
|
"enable_http": true,
|
|
"allow_forms": true,
|
|
"use_server_time": false,
|
|
"addr": "192.168.188.37:2947"
|
|
},
|
|
```
|
|
|
|
### NMEA Pass-Through
|
|
|
|
If you need the **raw** NMEA data (for example if your GPS is not supported by the built-in mini-gpsd, or you want to
|
|
run your own gpsd), set `nmeapassthough` to `true`, for example:
|
|
|
|
```yaml
|
|
gpsd_address: 0.0.0.0:8888
|
|
nmeapassthough: true
|
|
```
|
|
|
|
Note that if you plan to use Pat, you'd need to run `gpsd` to use
|
|
the position of the GNSS receiver.
|
|
|
|
## TRX Control
|
|
|
|
to be written.
|
|
|
|
## How to run
|
|
|
|
As a rule of thumb, you have to start the PACTOR-TCP-bridge before you want to use
|
|
Pat and stop it after you finished using Pat.
|
|
|
|
So a typical session works like this
|
|
|
|
1. start the PACTOR-TCP-Bridge
|
|
2. wait for it to finish configure your modem
|
|
3. use Pat (or any other software)
|
|
4. quit Pat
|
|
5. stop the PACTOR-TCP-Bridge
|
|
|
|
The software supports command line options:
|
|
|
|
```bash
|
|
% ./ptb --help
|
|
Usage of ptb - the PACTOR-IP-Bridge:
|
|
-c, --configfile string Name of config file (default "Config.yaml")
|
|
-d, --daemon Daemon mode (no TUI)
|
|
-l, --logfile string Path to the log file (default "/tmp/ptb.log")
|
|
```
|
|
|
|
which should be rather self-explaining.
|
|
|
|
A typical session (without using the daemon mode, see below) looks like this:
|
|
|
|

|
|
|
|
- on the upper left you will see all **payload** from and to the PACTOR modem
|
|
- on the lower left the **commands** (with VARA translations, if switched on) to and **answers** from the modem
|
|
- on the right hand side you'll see a clock, then a mode indicator (showing `VARA` or `TCP`). Furthermore, you'll see two indicator (`TCP CMD` and `TCP DATA`) which will turn green when a client is connected. The 4 counters below show the usage of the buffers.
|
|
|
|
|
|
## "Daemon"-mode
|
|
|
|
The "daemon"-mode will omit the terminal UI ("TUI") and might be useful if you have no full terminal (or you want to run the tool with systemd).
|
|
|
|
Instead of the UI, you will only see a message saying that you may quit with CTRL-C.
|
|
|
|
## Keys
|
|
|
|
- **CTRL-C**<br />Quits the program
|
|
- **CTRL-V**<br />swtiches between the VARA and normal mode
|
|
|