Commands - nricciar/sparkplug GitHub Wiki
Commands
All commands are sent as json encoded strings. The primary key cmd
represents the requested command being sent to the server. All other paramaters are specific to the command being executed.
- getReceivers
- getRadios
- addReceiver
- removeReceiver
- setRunning
- setFrequency
- setMode
- getVersion
- subscribeToSpots
- subscribeToSpectrum
- subscribeToAudio
getReceivers
Example Request
{ "cmd": "getReceivers" }
Example Response
Parameter | Description |
---|---|
Receivers | List of receivers connected to this server |
Receivers.ID | Receiver ID |
Receivers.Mode | Mode of the receiver e.g. USB |
Receivers.Frequency | Tuned frequency of the receiver |
Receivers.FilterLow | Receiver filter low value |
Receivers.FilterHigh | Receiver filter high value |
{"cmd":"getReceiversResponse","Receivers":[{"cmd":"ReceiverResponse","ID":0,"Mode":"LSB","Frequency":7141000.0,"FilterLow":-3000.0,"FilterHigh":-150.0},...]}
getRadios
Example Request
{ "cmd": "getRadios" }
Example Response
Parameter | Description |
---|---|
Radios | List of radios connected to this server |
Radios.ID | Radio ID |
Radios.Name | Name of the radio |
Radios.Running | State of the current radio (powered on/off) |
{"cmd":"getRadiosResponse","Radios":[{"ID":0,"Name":"Hermes Lite 2 hpsdr_0-28-192-162-19-221","Running":true}]}
addReceiver
Add a new receiver to a radio by id.
Example Request
Parameter | Description |
---|---|
ID | Radio ID for request |
{"cmd":"addReceiver","ID":0}
Example Response
This response is the same as the getReceivers command.
removeReceiver
Remove a receiver by receiver id
Example Request
Parameter | Description |
---|---|
ID | Radio ID for request |
{"cmd":"removeReceiver","ID":0}
Example Response
This response is the same as the getReceivers command.
setRunning
Turn on/off the radio by id.
Example Request
Parameter | Description |
---|---|
ID | Radio ID for request |
Running | Enable/Disable radio |
{"cmd":"setRunning","ID":0,"Running":true}
Example Response
This response is the same as the getRadios command.
setFrequency
Sets the frequency of a receiver by id.
Example Request
Parameter | Description |
---|---|
ID | Receiver ID for request |
Frequency | Frequency to tune the receiver |
{"cmd":"setFrequency","ID":0,"Frequency":7141000}
Example Response
Parameter | Description |
---|---|
ID | Receiver ID |
Frequency | New frequency of the receiver |
Mode | New mode of the receiver |
FilterLow | Receiver filter low value |
FilterHigh | Receiver filter high value |
{"cmd":"ReceiverResponse","ID":0,"Mode":"LSB","Frequency":7141001.0,"FilterLow":-3000.0,"FilterHigh":-150.0}
setMode
Sets the mode of a receiver by id.
Example Request
Parameter | Description |
---|---|
ID | Receiver ID for request |
Mode | Mode to set the receiver e.g. `LSB |
{"cmd":"setFrequency","ID":0,"Frequency":7141000}
Example Response
This response is the same as the setFrequency command.
getVersion
Gets version information from server.
Example Request
{"cmd":"getVersion"}
Example Response
Parameter | Description |
---|---|
ProtocolVersion | WebSocket API version |
Host | Application Name |
HostVersion | Application Version |
{"cmd":"getVersionResponse","ProtocolVersion":"0.1.2","Host":"SparkSDR","HostVersion":"2.0.4.5"}
subscribeToSpots
Request spot data from the server.
Example Request
Parameter | Description |
---|---|
Enable | Subscribe/Unsubscribe to spots |
{"cmd":"subscribeToSpots","Enable":true}
Example Response
Once subscribed to spot data you will continue to receive spot data from the server until you unsubscribe.
Parameter | Description |
---|---|
spots | List of spots |
{"cmd":"spotResponse","spots":[{"time":"2020-11-30T23:12:00Z","frequency":3576404.0,"tunedfrequency":3575000.0,"power":0,"drift":0,"snr":-7,"dt":-0.0,"msg":"CQ KD0XD EN12","mode":"FT4","distance":1490.7643834497214,"call":"KD0XD","color":1,"locator":"EN12","valid":true,"offsetFrequency":1404.0}]}
subscribeToSpectrum
Request spectrum data from a receiver by id.
Example Request
Parameter | Description |
---|---|
RxID | Receiver ID for request |
Enable | Subscribe/Unsubscribe to spectrum |
{"cmd":"subscribeToSpectrum","RxID":0}
Example Response
Once subscribed to a spectrum channel you will continue to receive spectrum data from the server in the form of binary encoded websocket messages until you unsubscribe.
For more information see Binary Messages#Spectrum
subscribeToAudio
Request audio from a receiver by id.
Example Request
Parameter | Description |
---|---|
RxID | Receiver ID for request |
Enable | Subscribe/Unsubscribe to audio |
{"cmd":"subscribeToAudio","RxID":0}
Example Response
Once subscribed to an audio channel you will continue to receive chunked audio data from the server in the form of binary encoded websocket messages until you unsubscribe.
For more information see Binary Messages#Audio