FRStack WebAPI Service

Raspberry Pi

Install .NET Core 3.1 on RPi

# You should be in your Pi download folder: cd ~/Downloads/

wget <the dot net core download for your RPi device>

# The following website has this info. https://dotnet.microsoft.com/download/dotnet-core/3.1

# Here is the current one for ARM32 devices
# https://download.visualstudio.microsoft.com/download/pr/92e90ed5-dba3-427b-a876-8b46fe5e16b6/69cae4fe4a0ec6bc7585de6fa889fd66/aspnetcore-runtime-3.1.6-linux-arm.tar.gz

# From the Downloads folder, execute the following commands:

sudo mkdir -p /opt/dotnet
sudo tar -zxf aspnetcore-runtime-3.1.5-linux-arm.tar.gz -C /opt/dotnet
sudo ln -s /opt/dotnet/dotnet /usr/bin

Install Node Red on RPi

bash <(curl -sL https://raw.githubusercontent.com/node-red/linux-installers/master/deb/update-nodejs-and-nodered)

See https://nodered.org/docs/getting-started/raspberrypi

Default address for Node Red is http://hostname:1880

Running Node Red on RPi

On pi to run node red in terminal use:

node-red

The following commands are provided to work with the service:

node-red-start - this starts the Node-RED service and displays its log output. Pressing Ctrl-C or closing the window does not stop the service; it keeps running in the background
node-red-stop - this stops the Node-RED service
node-red-restart - this stops and restarts the Node-RED service
node-red-log - this displays the log output of the service

If you want Node-RED to run when the Pi is turned on, or re-booted, you can enable the service to autostart by running the command:

sudo systemctl enable nodered.service

To disable the service, run the command:

sudo systemctl disable nodered.service

Install FRStack WebAPI on RPi

sudo mkdir -p /usr/local/frstack
cd /usr/local/frstack
sudo wget http://www.mkcmsoftware.com/download/FRStackWebApiRpi.zip
sudo unzip FRStackWebApiRpi
# to update specific files from ZIP add the name of the file(s) after the ZIP filename
# for example: sudo unzip FRStackWebApiRpi.zip FRStackWebApi.dll frstackNodeRedV102.json

Run FRStack WebAPI from commandline

dotnet FRStackWebApi.dll --urls "http://*:5025"

Install FRStackWebApi as service

sudo cp FRStackWebApi.service /lib/systemd/system
sudo systemctl daemon-reload 
sudo systemctl enable FRStackWebApi

Note the FRStackWebApi.service contains the port the API will listen on

[Unit]
Description=FRStack Web APIs
After=network.target
 
[Service]
Type=notify
WorkingDirectory=/usr/local/frstack
ExecStart=/usr/bin/dotnet FRStackWebApi.dll --urls "http://*:5025"
Restart=on-failure
 
[Install]
WantedBy=multi-user.target

Start FRStackWebApi service

sudo systemctl start FRStackWebApi 

View FRStackWebApi service status

systemctl status FRStackWebApi

Tail FRStackWebApi service log

journalctl --unit FRStackWebApi --follow

Stop FRStackWebApi service

sudo systemctl stop FRStackWebApi 
systemctl status FRStackWebApi 

Cleaning up FRStackWebApi service

Ensure service is stopped

sudo systemctl stop FRStackWebApi 

Disable the FRStackWebApi service

sudo systemctl disable FRStackWebApi 

Remove and reload SystemD

sudo rm FRStackWebApi.service /lib/systemd/system/FRStackWebApi.service 
sudo systemctl daemon-reload 

Verify SystemD is no longer aware of the FRStackWebApi service

Empty is what we want here

systemctl --type service |& grep FRStackWebApi

Sample Node Red Script

frstackNodeRedV102.json

Configuration

The appSettings.json file contains the startup configuration for the service.

{
  "Logging": {
    "LogLevel": {
      "Default": "Information",
      "Microsoft": "Warning",
      "Microsoft.Hosting.Lifetime": "Information"
      }
    },
  "AllowedHosts": "*",

  "SvcConfig": {
    "AutoConnect": "true",
    "initRadioName": null, // optionally configure the default radio name here to autoconnect to
    "initClientName": null, // optionally configure the default client name to bind to
    "MRUMatchDelta": "0.000999",
    "FollowActiveSlice": "true",
    "MuteOthersOnSliceActive": "true",
    "EnableTxOnSliceActive": "true",
    "TempUnitInF": "true",
    "PgxlTuneStandby": "true",
    "PgxlModeRestore": "true",
    "PgxlRadioMaxPower": "50",
    "PgxlRadioStandbyPower": "100",
    "PGXLOnAntenna": "0", // 0 or 1 or 2
    "RCATXACCTuneDisable": "false",
    "RCATX1TuneDisable": "false",
    "RCATX2TuneDisable": "false",
    "RCATX3TuneDisable": "false",
    "RadioTuneModeDetect": "false",
    "SPEComPort": "",
    "SPETuneStandby": "false",
    "SPEModeRestore": "false",
    "SPEOnAntenna": "0", // 0 or 1 or 2
    "SPEUseDTR": "false",
    "SPEProtocolV1": "false",
    "SPEAutoOpen": "false",
    "SteppIRComPort": "", // port,baud,parity,stop,FollowAntInt,EnabledBool,SyncManualBool,AntTxInhibitInt
    "FDXProtect": "false,false,false,false,false,false", // enabled,ant1,ant2,rxa,rxb,wide
    "UDPSettings": "false,255.255.255.255,12070,false,127.0.0.1,12071,false,127.0.0.1,12072,false,127.0.0.1,12073", // enabled,IPADDR,PORT, enabled,IPADDR,PORT, enabled,IPADDR,PORT, enabled,IPADDR,PORT 
    "UDPMeterSettings": "false,255.255.255.255,12270,false" // enabled,IPADDR,PORT,SMeterEnabled
  }
}

APIs

FRStack Commands
http://localhost:5025/FRStack/{cmd}?param={val}

Radio cmd val Parameter
AUTOCONNECT True to enable auto connect to radio, false to disable
DISCONNECT 1 to disconnect radio
CONNECT Nickname or Serial Number of radio to connect with,
or radio number (1 for 1st radio found sorted by nickname)
RADIOS No Param - Returns list of detected 6x00 radio Nicknames to use for CONNECT,
or Param is Nickname or Serial No. for dump of Radio object (for testing)
SLICES No Param - Returns list of Slice Letter(Index) strings for the connected radio,
or Param is Letter(Index) for dump of Slice object (for testing)
MUTEOTHERSONSLICEACTIVE 2 to toggle MUTE OTHERS ON SLICE ACTIVE, 1 or true to enable, 0 or false to disable
ENABLETXONSLICEACTIVE 2 to toggle ENABLE TX ON SLICE ACTIVE, 1 or true to enable, 0 or false to disable
FOLLOWACTIVESLICE 2 to toggle FOLLOW ACTIVE SLICE, 1 or true to enable, 0 or false to disable
-XX- Invalid cmd



Radio Commands
http://localhost:5025/Radio/{cmd}?param={val}

Radio cmd val Parameter
INFO returns radio information
ENUMINFO returns radio properties enumeration information
ACC 0 turn off, 1 turn on, other toggle setting
AMCARRIER UP* to increase level, DOWN* to decrease level, or carrier level
AMPOPERATE 0 turn off, 1 turn on, other toggle setting
ATU Param values are START, BYPASS or CLEAR
ATUMEM 0 turn off, 1 turn on, other toggle setting
AUDIOGAIN UP* to increase level, DOWN* to decrease level, or audio level
BINAURAL 0 turn off, 1 turn on, other toggle setting
CLIENT NEXT to switch clients, or set client station name, returns client station name
CLIENTS returns list of clients
CWBREAKIN 0 turn off, 1 turn on, other toggle setting
CWDELAY UP* to increase offset, DOWN* to decrease offset
CWIAMBICMODEA 0 turn off, 1 turn on, other toggle setting
CWIAMBICMODEB 0 turn off, 1 turn on, other toggle setting
CWPITCH UP* to increase offset, DOWN* to decrease offset
CWSIDETONE 0 turn off, 1 turn on, other toggle setting
CWSPEED UP* to increase offset, DOWN* to decrease offset
CWSWAPPADDLES 0 turn off, 1 turn on, other toggle setting
CWX 1 - 12 transmits the CWX Macro
CWXQSK 0 turn off, 1 turn on, other toggle setting
CWXSPEED UP* increase speed, DOWN* decrease speed, or speed value
CWXDELAY UP* increase delay, DOWN* decrease delay, or delay value
DAX 0 turn off, 1 turn on, other toggle setting
DEXP 0 turn off, 1 turn on, other toggle setting
DEXPLEVEL UP* to increase level, DOWN* to decrease level, or DEXP level
FDX 0 turn off, 1 turn on, other toggle setting
GLOBALPROFILE Param is the profile you are selecting
HEADPHONEGAIN UP* to increase level, DOWN* to decrease level, or audio level
HEADPHONEMUTE 0 turn off, 1 turn on, other toggle setting
METERINRX Meter in RX - 0 turn off, 1 turn on, other toggle setting
MIC UP to set previous, DOWN to set next
MICBIAS Mic Bias - 0 turn off, 1 turn on, other toggle setting
MICBOOST Mic Boost - 0 turn off, 1 turn on, other toggle setting
MICLEVEL UP* to increase level, DOWN* to decrease level, or mic level
MICPROFILE Param is the profile you are selecting
MON TX Monitor - 0 turn off, 1 turn on, other toggle setting
MONGAINTXCW TX Monitor CW Gain - UP* to increase level, DOWN* to decrease level, or level
MONPANTXCW TX Monitor CW Pan - UP* to increase level, DOWN* to decrease level, or level
MONGAINTXSB TX Monitor SSB Gain - UP* to increase level, DOWN* to decrease level, or level
MONPANTXSB TX Monitor SSB Pan - UP* to increase level, DOWN* to decrease level, or level
MOX 0 turn off, 1 turn on, other toggle setting
MUTE 0 turn off, 1 turn on, other toggle setting
MUTEALL n/a
PROC 0 turn off, 1 turn on, other toggle setting
PROCLEVEL UP increase proc, DOWN decrease proc, value of 0, 1 or 2
RFPOWER UP to increase power, DOWN to decrease power, or power level
SLICE UP to previous slice, DOWN to next slice, CREATE to add slice, DELETE to remove slice
TUNE 0 turn off, 1 turn on, other toggle setting
TUNEPOWER UP* to increase power, DOWN* to decrease power, or power level
TXFILTER Returns delta between High and Low
TXFILTERLOW UP* to increase offset, DOWN* to decrease offset
TXFILTERHIGH UP* to increase offset, DOWN* to decrease offset
TXPROFILE Param is the profile you are selecting
VOX 0 turn off, 1 turn on, other toggle setting
VOXLEVEL UP* to increase, DOWN* do decrease, or level value
VOXDELAY UP* to increase, DOWN* do decrease, or delay value
-XX- Invalid cmd

* NOTE
- DOWN can be replaced by -1, -2, -5, -10, -20 or -50 to step non-default values
- UP can be replaced by +1, +2, +5, +10, +20 or +50 to step non-default values; You must prefix with the +


Slice / Active Slice Commands
http://localhost:5025/ActiveSlice/{cmd}?param={val}
To target specific slice letter use
http://localhost:5025/Slice/{A-H}/{cmd}?param={val}

Slice cmd val Parameter
INFO returns slice information
ACTIVE return active state and 1 to set it active
AGCMODE DOWN to next mode
AGCLEVEL UP* to increase level, DOWN* to decrease level, or level value
ANF 0 turn off, 1 turn on, other toggle setting
ANFLEVEL UP* to increase level, DOWN* to decrease level, or level value
APF 0 turn off, 1 turn on, other toggle setting
APFLEVEL UP* to increase level, DOWN* to decrease level, or level value
AUDIOGAIN UP* to increase level, DOWN* to decrease level, or level value
AUDIOPAN UP* to increase level, DOWN* to decrease level, or level value
BAND band selections
Set band values like 2200, 160, 40, 20, GEN, WWV
or XVTR0, XVTR1, XVTR2, XVTR3
CLOSE 1 to Close Slice
DAX 0 turn off, 1 - 8 DAX channel
DIV 0 turn off, 1 turn on, other toggle setting
FILTER UP to previous filter, DOWN to next filter, 0 - 9 to select filter
FILTERLOW UP* to increase offset, DOWN* to decrease offset
FILTERHIGH UP* to increase offset, DOWN* to decrease offset
FREQ UP moves FREQ up by STEP, DOWN moves FREQ down by STEP, other is MHz value
Use 1 - 6 to format exponent length of Frequency; e.g. 2 results in 7.12
FREQE Frequency Entry; Param values are 0,1,2,3,4,5,6,7,8,9,., CLEAR or ENTER
ENTER will set the Slice Frequency to accumulated value
LETTER returns slice letter and index
LOCK 0 turn off, 1 turn on, other toggle setting
MODE UP to previous mode, DOWN to next mode, other MODE setting (eg. AM, LSB)
MUTE 0 turn off, 1 turn on, other toggle setting
NR 0 turn off, 1 turn on, other toggle setting
NRLEVEL UP* to increase level, DOWN* to decrease level, or level value
NB 0 turn off, 1 turn on, other toggle setting
NBLEVEL UP* to increase level, DOWN* to decrease level, or level value
PAN Panadapter settings
CENTER center panadapter on slice
UP increase bandwidth, DOWN decrease bandwidth
SEGMENT zooms to band segment, BAND zooms to band
MIN zooms to min bandwidth, MAX zooms to maximum bandwidth
1 - 1000 sets bandwidth
PLAY 0 turn off, 1 turn on, other toggle setting
RECORD 0 turn off, 1 turn on, other toggle setting
RFGAIN UP to increase gain, DOWN to decrease gain, or gain value
RIT 0 turn off, 1 turn on, other toggle setting
RITFREQ UP* to increase offset, DOWN* to decrease offset, or freq value
RXANT RX antenna selection or , NEXT selects next in list, PREV selects previous in list
SPLIT 1 will attempt to SPLIT slice. Will silently fail if no remaining slices for client. This is not a toggle.
STEP UP to increase step, DOWN to decrease step, or step value
SCAN start scan on scan bank
Set scan bank number 1 - 20
or 0 to get scanning bank number
SMUTE 0 - 7 slice number to toggle mute setting
SWAP 0 - 7 slice number to swap with active slice, if 2+ slices present use NEXT swap active slice with next one
TX 0 turn off, 1 turn on, other toggle setting
TXANT TX antenna selection or NEXT selects next in list, PREV selects previous in list
WNB 0 turn off, 1 turn on, other toggle setting
WNBLEVEL UP* to increase level, DOWN* to decrease level, or level value
XIT 0 turn off, 1 turn on, other toggle setting
XITFREQ UP* to increase offset, DOWN* to decrease offset, or freq value
-XX- Invalid cmd
-- Slice not found

* NOTE
- DOWN can be replaced by -1, -2, -5, -10, -20 or -50 to step non-default values
- UP can be replaced by +1, +2, +5, +10, +20 or +50 to step non-default values; You must prefix with the +


SPE Amplifier Slice Commands
http://localhost:5025/SPEAMP/{cmd}?param={val}

SPEAMP cmd val Parameter
OPEN 1 to Open COM port
OPER 1 toggle Operate
ANT 1 switch Antenna
CLOSE 1 to Close COM port, DTR feature must be enabled
INPUT 1 switch Input
POWER 1 to change Power Level
TUNE 1 to initiate Tune
BAND reports Band
AMPS reports Amps
MEMB report Memory Bank
MODEL reports Model
OUTPUT report Output Power
VOLTS reports Volts
SWR reports Ant SWR
SWRT reports Tuner SWR
RX reports ON when in RX
TX reports ON when in TX
-- Amp not configured
-XX- Invalid cmd



SteppIR Commands
http://localhost:5025/STEPPIR/{cmd}?param={val}

SteppIR cmd val Parameter
ANTSTATE returns Antenna State hex code
ANTSTATESTR returns Antenna State code string
BIDIR 1 to set Bi-Directional for Beam, 3/4 for Vertical
CALIBRATE 1 to Calibrate
DIR returns the direction
FORWARD 1 to set Forward
FREQ returns the Freq
FREQANT sets the Antenna Freq in Manual sync mode, returns the Antenna Freq
FREQE Frequency Entry; Param values are 0,1,2,3,4,5,6,7,8,9,., CLEAR or ENTER
ENTER will set the Antenna Frequency to accumulated value
MANUAL 0 to manually sync, 1 to auto sync Freq with Antenna Freq, 2 toggles setting
OPEN 0 to Close, 1 to Open, 2 to Toggle Open/Close
RETRACT 1 to Retract
REVERSE 1 to set Reverse
SYNC 1 to set Slice Frequency to Antenna in Manual sync mode
34 1 to set 3/4 in Vertical, Bi-Directional for Beam
TXINHIBIT returns Inhibit boolean

Note:




Meter information over WebSocket

http://localhost:5025/ws/meters

Json Data returned

{
 "station":"6600M",
 "callsign":"W3II",
 "nickname":"6600M",
 "ipaddr":"192.168.1.202",
 "meters":{
    "+13.8A":"14.2",
    "PATEMPC":"32.1",
    "FWDPWR":"0.0",
    "REVPWR":"0.0",
    "SWR":"1.0",
    "AMP PWR":"0",
    "AMP ID":"0",
    "AMP SWR":"1.1",
    "AMP TEMPC":"30.2",
    "AMP TEMPF":"86.3",
    "PATEMPF":"89.8"}
}